Repository navigation
feat(snapshot): support CAP-85 ExternalRef contract executables and offline spec resolution (#2703) - #2853
Closed
jdjioe5-cpu wants to merge 1 commit into
Closed
feat(snapshot): support CAP-85 ExternalRef contract executables and offline spec resolution (#2703)#2853jdjioe5-cpu wants to merge 1 commit into
jdjioe5-cpu wants to merge 1 commit into
Conversation
…ffline spec resolution (stellar#2703)
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.
What
Closes #2703.
This PR adds full support for contract executables in snapshot operations:
snapshot createcaptures CAP-85ExternalRefexecutables:SearchInputswithcontract_data_keys: HashSet<(ScAddress, ScVal)>to allow targeted filtering on specificContractDatakeys.ContractExecutable::ExternalRef(external_ref),snapshot createtracks the reference entry key(external_ref.executable_owner, ScVal::ExecutableTag(external_ref.tag))for the next search pass.ScVal::ExecutableTagentry, decodes the referenced 32-byte WasmHashintonext.wasm_hashes, ensuring the underlyingContractCodeis discovered and included in the snapshot._ => {}wildcard with explicit, exhaustive handling for all threeContractExecutablevariants (Wasm,StellarAsset,ExternalRef).cmd/soroban-cli/src/commands/snapshot/inspect.rs:get_contract_instanceresolve_external_ref_wasm_hashget_wasm_from_hashget_wasm_hash_for_contractget_contract_wasmget_contract_specget_spec.rs,wasm.rs) for offline snapshot analysis acrossStellarAsset,Wasm, andExternalRef.inspect.rstestingStellarAssetbuilt-in spec extraction, directWasmresolution, and two-hopExternalRefresolution (Instance -> ExecutableTag ContractData -> Wasm Hash -> ContractCode -> Bytecode/Spec).create.rsverifyingSearchInputsfiltering and expansion forExternalRef.Why
Previously,
snapshot createonly handledWasmandStellarAsset, whileExternalReffell into a catch-all_ => {}and was silently dropped. As a result, snapshots of contracts using externally-managed executables were incomplete, missing both the reference entry and the underlying Wasm bytecode. Furthermore, there were no offline helpers to resolve contract specs or executables directly from aLedgerSnapshot.