Conversation
…sign_dynamic program_checksum
…cleaned up printlns
…ng dynamic calls, restrict input types for dynamic calls
… prepare-verifier-inputs; prevoius translation tests working again
…ecord_view_key and gamma to Option; minor polishing
…thub.com/ProvableHQ/snarkVM into feat/dynamic-dispatch-extension-case1wip
Re-add defense-in-depth check that compares the number of translation inputs derived from the authorization against those computed during verification, ensuring they agree before dispatching to the verifier. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: d0cd <23022326+d0cd@users.noreply.github.com> Signed-off-by: d0cd <23022326+d0cd@users.noreply.github.com>
…nt-outputs Disallow constant outputs in dynamic calls
Antonio95
approved these changes
Mar 11, 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.
TODO
credits.aleorecord translation keys.mainnet: 81 programs, 117 records totaltestnet: 1097 programs, 1790 records totalcanary: 3 programs, 3 records totalFor Reviewers
You may find these questions in context by grepping for
@reviewers.Summary
Implements ARC-0009: Dynamic Dispatch for
ConsensusVersion::V14.Implementation Overview
1. Console Data Types (
console/program/src/data/dynamic/)DynamicRecord represents a static record as a fixed-size Merkle commitment.
It stores the owner, a Merkle root of the record entries, the nonce, and the version.
The
from_record()method builds a depth-5 tree (max 32 entries) using Poseidon8 for leaf hashes and Poseidon2 for path nodes.The optional
datafield holds the full entry map when available for extraction.DynamicFuture represents a future as a fixed-size Merkle commitment.
It stores the program name, network, and function name as field elements, plus a Merkle root of the arguments.
The
from_future()method builds a depth-4 tree (max 16 arguments) using the same hash scheme.Field encoding of identifiers enables runtime resolution without variable-size strings.
2. Circuit Types (
circuit/program/src/data/dynamic/)circuit::DynamicRecord mirrors the console type with circuit-native field representations.
It optionally stores the console data for ejection.
The
from_record()method performs in-circuit Merkle tree construction.The
find()method verifies a Merkle path to a specific entry and returns the entry value.circuit::DynamicFuture mirrors the console type for circuit verification.
It optionally stores the console arguments for ejection.
3. Request and Transition Versioning
Request (
console/program/src/request/) is now versioned.V1 requests represent static calls with no dynamic flag.
V2 requests add an optional
dynamicflag and methodscaller_inputs()andcaller_input_ids()that convert record inputs to their dynamic representations.Transition (
ledger/block/src/transition/) is now versioned.V2 transitions include
TransitionCallerMetadatacontaining the caller's view of inputs and outputs.This metadata is essential because the caller sees static records while the callee sees dynamic records.
Translation proofs use this dual view to verify record equivalence.
Both versions of requests and transitions are supported.
4. Instructions (
synthesizer/program/src/logic/instruction/operation/)call.dynamic (
call/dynamic.rs) enables runtime function dispatch.The first three operands specify the program name, network, and function name as field elements.
Subsequent operands are the function arguments.
Records are automatically converted to dynamic records at call boundaries.
Destinations receive plaintexts, dynamic records, or dynamic futures.
get.record.dynamic (
get_record_dynamic.rs) extracts an entry from a dynamic record.In evaluate mode, it retrieves the entry from the data map.
In execute mode, it constructs the expected leaf hash and verifies a Merkle path against the record's root.
5. Execution (
synthesizer/process/src/stack/call/dynamic.rs)CallDynamicimplements theevaluate()andexecute()methods of theCallTrait.The implementation is similar in structure to the
Call, however it does differ non-trivially.The
resolve_dynamic_target()method converts field operands to a program ID and function name.Dynamic calls to
credits.aleo/fee_privateandfee_publicare blocked.The
collect_input_translations()andcollect_output_translations()methods identify records that require translation proofs.6. Translation Proofs (
synthesizer/process/src/trace/translation/)Translation proofs verify that a dynamic record and static record represent the same underlying data.
RecordTranslationData captures the metadata for one translation: both record forms, the function ID, whether it is an input or output, and the computed IDs for each form.
TranslationAssignment (
assignment.rs) defines the translation circuit.The circuit proves that the owner, nonce, and version match, and that the Merkle root of the static record entries equals the dynamic record's root.
prepare.rs handles key synthesis for translation circuits, with separate paths for regular calls and fee operations.
7. Varuna Integration (
algorithms/src/snark/varuna/)Translation proofs are batched with execution proofs in
prove_batch_with_terminator().The
Translationstruct insynthesizer/process/src/trace/translation/mod.rsgenerates verifier inputs by matching caller and callee views across transitions.8. Dynamic Mapping Operations (
synthesizer/program/src/logic/command/)These finalize-time commands access mappings using runtime-resolved program IDs.
contains.dynamic checks if a key exists in an external mapping.
get.dynamic retrieves a value from an external mapping, failing if the key is absent.
get.or_use.dynamic retrieves a value with a fallback default if the key is absent.
Each command takes field operands for the program name, network, and mapping name, plus the key operand.
Tests (
synthesizer/src/vm/tests/test_v14/)call_dynamic.rsdynamic_futures.rsdynamic_mapping_operations.rsget_record_dynamic.rstranslation.rsrecursion.rscast.rsDynamicRecord::from_record()consistency, external and non-external record castingmixed.rsAppended: an overview of semver breaking changes from commit 44644ef
semver_checks_results.txt