Skip to content

Remove Context-Free Actions - #754

Merged
heifner merged 2 commits into
masterfrom
feature/remove-context-free
Nov 9, 2026
Merged

heifner merged 2 commits into
masterfrom
feature/remove-context-free

Conversation

@heifner

@heifner heifner commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Draft, for discussion. Wire charges NET for every byte of a transaction and never prunes context-free data, so a context-free action has nothing to offer over a regular one. This removes the feature and keeps only the transaction fields.

  • Transactions. A transaction may not carry context-free actions, and so no context-free data. check_transaction_authorization rejects such a transaction the same way. The context_free_actions and context_free_data fields stay, so signing digests, transaction ids and every client serializer are unchanged.
  • Intrinsics. send_context_free_inline and get_context_free_data are removed from the host, the genesis intrinsic list, the OC intrinsic table, the signature registry and the native-module exports. The context-free precondition and its context-aware counterpart go too, so every intrinsic registers through the same two macros. The OC code cache header (SYSVMOC2) and codegen version (2) move, because the intrinsic ordinals changed.
  • Execution. apply_context and transaction_context lose the context-free flag, the context-free inline queue and the context-free billing branch.
  • Traces. action_trace loses context_free, in the trace API, in SHiP's action_trace_v0/v1 and in deep mind.
  • Chain parameters. context_free_discount_net_usage_num and _den are removed from chain_config, the genesis, SHiP and sysio.system's setparams. The ids above them shift down by two, as in the base_per_transaction_net_usage removal. The genesis changes, so the chain id does too.

Tests that ran code in a context-free context are removed, or now use regular actions: the light-validation restart test, the state-history split-log test, the checktime nonce and trx_generator's nonce (now a regular sysio.noop::nonce action with no authorization). New tests cover the input rejection with and without data, authorizations, payers and large entries, and the check_transaction_authorization rejection.

The deep-mind log, the snapshot compatibility files, the consensus blockchain data and the sys-util snapshot info expectations are regenerated.

Pairs with Wire-Network/wire-cdt#130, which removes the API from CDT. Merge them together; wire-cdt needs a release before the next wire-sysio tag. When this lands, wire-libraries-ts drops context_free from sdk-core's TransactionTrace and regenerates SysioContractTypes, and wire-tools-ts drops the two parameters from its genesis renderer and docs/production-bootstrap.md.

A transaction may not carry context-free actions, which leaves it no context-free data either, and `check_transaction_authorization` rejects such a transaction too. The `context_free_actions` and `context_free_data` fields stay in the transaction format, so signing digests and transaction ids are unchanged.

Contracts can no longer send context-free inline actions or read context-free data: the `send_context_free_inline` and `get_context_free_data` intrinsics are removed, with the context-free execution path and the preconditions that told context-free and context-aware intrinsics apart. Action traces lose `context_free`, in the trace API and in SHiP. The OC code cache header and codegen version move to 2, because the intrinsic table changed.

`chain_config` drops `context_free_discount_net_usage_num` and `context_free_discount_net_usage_den`, and the ids above them shift down by two. That changes the genesis and so the chain id, the SHiP `chain_config`, and `sysio.system`'s `setparams`.

Every system and test contract is rebuilt with the matching wire-cdt. The deep-mind log, the snapshot compatibility files, the consensus blockchain data and the sys-util snapshot info expectations are regenerated.

Change-Id: Ibc528e4dd4249ba21f0ddcee863f643d7811497d
@huangminghuang

Copy link
Copy Markdown
Contributor

[P2] Preserve the nonce when custom actions are rebuilt

In trx_generator_base::update_resign_transaction(), lines 70–75, the new code assumes the last action is the nonce appended during initial construction. However, the custom generator override, lines 240–244, replaces trx.actions with generate_actions() before calling this method, dropping that nonce.

With the default --noop-nonce=true, the base method therefore inspects the last user action and throws the last action is not the sysio.noop nonce action. Custom transaction generation stops before sending its first transaction.

Preserve or reappend the nonce after rebuilding the custom actions, and add coverage using trx_generator with the nonce enabled; the updated test exercises only trx_generator_base.

Validated at head be48fd6 with a focused compiled reproduction: custom-generator setup succeeds with two actions, then its first update throws at line 74. The existing base-generator nonce test passes. Full node build and test suite were not run.

trx_generator rebuilds a transaction's actions on every re-sign, which dropped the sysio.noop nonce action, so the first re-sign threw. It now appends a new nonce action after the rebuilt actions. The base generator still gives its nonce action new data in place.

Change-Id: Ic18646b3173f858e1b604b584a96181dc33f6e54
@heifner

heifner commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 4937bab. trx_generator now appends a new nonce action after it rebuilds its actions, and the base generator still refreshes its nonce in place. noop_nonce_on_custom_actions runs trx_generator with the nonce on through two re-signs; on be48fd6 it fails with the transaction_exception you saw.

@huangminghuang huangminghuang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed head 4937bab and the complete PR diff. The previously reported nonce regression is fixed: custom action generation appends a new nonce after rebuilding actions, while the base generator refreshes its existing nonce. No remaining actionable code findings.

Validation: compiled the updated transaction generator and its tests against available prebuilt dependencies. All four focused nonce tests pass: noop_nonce_action_is_optional, noop_nonce_on_custom_actions, noop_nonce_off_requires_acct_per_trx, and noop_nonce_off_substitutes_nested_placeholders. The new regression test exercises two re-signs without losing or accumulating nonce actions.

Full node build and test suite were not run locally. Current-head Linux and macOS workflows report failure before any build/test job is listed, so full CI validation remains outstanding.

@heifner
heifner marked this pull request as ready for review November 9, 2026 23:17
@heifner
heifner merged commit ec2d8f2 into master Nov 9, 2026
18 checks passed
heifner added a commit that referenced this pull request Nov 10, 2026
Brings in the context-free action removal (#754), the action data trailing-bytes check (#755) and the msig propose payer (#751). sysio.token, sysio.liq and sysio.swap are rebuilt with wire-cdt master. Master's new transfer trailing-bytes test is kept, and open_tests stays removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants