Repository navigation
Reject Action Data With Bytes Left After the Arguments - #131
Conversation
The generated dispatcher, `SYSIO_DISPATCH` and the native-module dispatcher fail an action whose data holds bytes after its declared arguments. An action with `ignore<T>` parameters reads the rest itself and can finish with the new `sysio::check_action_data_consumed`. Notification handlers are not checked, since their data belongs to another contract's action. Change-Id: Iac34245422cfa991f6f8e953327d81e44c289f5c
|
[P2 / Medium] Preserve the notification exemption in At libraries/sysiolib/contracts/sysio/dispatcher.hpp:125–126, I reproduced this with a handler Please make consumption validation conditional on direct action dispatch ( Validation: the new dispatcher unit tests, both new toolchain cases, and focused generated-native-dispatch checks passed. Full chain integration tests were not run. |
…ecked `execute_action` checks for bytes left after the arguments only when the action is the receiver's own (`self == code`). A hand-written `apply()` also routes notifications through it, and a notification handler may declare only the leading arguments of another contract's action. The native-module dispatcher unpacks through the same helper. Change-Id: I9c06636757f827307d515de849a4eb53145b44ed
|
Fixed in 88ea074. The unpack helper behind |
huangminghuang
left a comment
There was a problem hiding this comment.
Re-reviewed the full PR diff at 88ea074, including the follow-up commit. The previous notification finding is fixed: argument-consumption checks run only for the receiver's own actions, and regression coverage includes notifications routed through a hand-written apply(). No remaining actionable findings.
Local validation passed:
- All six dispatcher unit cases, including execute_action_notification_test.
- The original notification regression reproducer.
- Both new toolchain cases: dispatch_ignore_parameters and dispatch_pinned.
- Regenerated native-dispatch checks for ordinary arguments, ignored arguments, and return values.
- All four action_data_tests chain integration cases (17 assertions), using contracts freshly compiled against the current PR headers.
Remote CI on this head currently reports failure. The Linux run contains only the failing aggregate gate, and the macOS run contains only the notification job; neither run provides build/test job results.
The generated dispatcher,
SYSIO_DISPATCHand the native-module dispatcher now accept exactly an action's declared arguments, and otherwise fail withaction data has bytes left after the arguments. All three call one check in<sysio/dispatcher.hpp>.ignore<T>parameters, taken by value, by const reference or through an alias, reads the rest of its data itself. The dispatcher leaves it to the action, which can finish withsysio::check_action_data_consumed.This changes the WASM of every contract built with it, not its ABI.
build-pass/dispatch_pinnedpins the output.Pairs with Wire-Network/wire-sysio#755, whose system and test contracts are built with this branch. Merge them together. A wire-sysio tag build uses the latest wire-cdt release, so wire-cdt needs a release before the next wire-sysio tag.