Merged
Conversation
…elds Background A pre-existing compiler bug caused selector-based multi-entrypoint contracts to fail when contract fields were present. The failure was not caused by covenant declaration macros; it existed in general script composition logic. Bug shape - Contract has multiple entrypoints (selector dispatch enabled) - Contract also has state fields (field prolog emitted) - Runtime fails with VerifyError when dispatching entrypoints Root cause (compiler-level, macro-independent) The dispatch selector was effectively disrupted by how field prolog and dispatch logic were composed. This is core entrypoint compilation behavior and applies to any contract using selector dispatch + fields, regardless of whether covenant macros are used. Fix context The underlying fix is to ensure selector dispatch executes before branch-local field prolog consumption, preserving correct selector semantics for all branches. What this commit adds - New regression test: runs_selector_dispatch_with_contract_fields - Test constructs a non-covenant contract with two entrypoints and two fields - Test executes both entrypoints via VM and asserts success Why this matters This test would have caught the original bug early and protects against future regressions in compiler dispatch/prolog composition outside the covenant macro feature set.
…ed lowered src code
someone235
previously approved these changes
Mar 9, 2026
someone235
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces covenant declarations for silverscript, with compiler integration and thorough test coverage.
Included:
#[covenant(...)], includingsingletonandfanoutsugar.groupsandterminationrules.covenant_compiler_tests.rs)covenant_declaration_ast_tests.rs)covenant_declaration_security_tests.rs)DECL.md.readInputStatestate-segment offset calculation from the current script layoutvalidateOutputStatefull script reconstruction around updated state segment