[Feature] Introduce constructor, Operand::Checksum and Operand::Edition#2653
[Feature] Introduce constructor, Operand::Checksum and Operand::Edition#2653
constructor, Operand::Checksum and Operand::Edition#2653Conversation
| let constructor_types = stack.get_constructor_types()?.clone(); | ||
|
|
||
| // Initialize the finalize registers. | ||
| let mut registers = FinalizeRegisters::new(state, transition_id, *program_id.name(), constructor_types, nonce); |
There was a problem hiding this comment.
Auditors: The parameters used to initialize the FinalizeRegisters here should be reviewed for correctness and soundness.
There was a problem hiding this comment.
@d0cd make sure to go over all unresolved comments and copy them over in the new PR you're making.
There was a problem hiding this comment.
Gonna keep this PR, but I think we're all resolved in this one no?
|
The parsing looks good. These are matching changes to the ABNF grammar: According to some discussion in this PR, we expect a change of the new rule to i.e. at least one command in a constructor. |
acoglio
left a comment
There was a problem hiding this comment.
I just reviewed the parsing code.
ljedrz
left a comment
There was a problem hiding this comment.
Reviewed the engineering aspects, left a suggestion.
@vicsn since we'd like to do updatability all in one go, does it make more sense to add docs at once? |
If it is to be added, then +1 on adding it sooner. |
The benefits of rushing in a synchronous upgrade are limited, let's add it to Consensus V6 (see the PR description for release dates). @d0cd can you make:
|
See this PR. |
|
Closed in favor of #2807 |
[NO NEW COMMITS ARE ALLOWED AS OF 5/27/25]
DO NOT MERGE WITHOUT AUDIT
Motivation
This PR introduces:
constructors to programs. Constructors are blocks of code that are run on-chain when finalizing a deployment.Operand::Checksum. An operand that returns a field element containing the program's checksum. The checksum is defined as theBHP1024hash over the program's bits.Operand::Edition. The edition for the program. This is currently enforced to beN::EDITION(0) for all programs.Note: The keyword
constructoris now restricted afterConsensusVersion::V6by this PR. This is enforced at the consensus-level as opposed to the program-level to ensure backwards compatibility.Test Plan
Integration test cases were added to verify:
Regression tests were re-ran to verify that the changes to the execution cost calculations do not affect existing programs.