[pallet-revive]: Version the trace_block runtime API function#12244
Open
0xOmarA wants to merge 14 commits into
Open
[pallet-revive]: Version the trace_block runtime API function#122440xOmarA wants to merge 14 commits into
trace_block runtime API function#122440xOmarA wants to merge 14 commits into
Conversation
0xRVE
reviewed
Jun 2, 2026
|
|
||
| sp_api::decl_runtime_apis! { | ||
| /// The API used to dry-run contract interactions. | ||
| #[api_version(1)] |
Contributor
There was a problem hiding this comment.
I think this needs a bump too
Contributor
Author
There was a problem hiding this comment.
I agree with you. I just read the docs here and I think that we would want to bump the API version at the top too:
polkadot-sdk/substrate/primitives/api/src/lib.rs
Lines 209 to 263 in a6871c6
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.
Description
This PR is a follow up from the various discussions we have had as a team around versioning of the runtime API and the approach that we should take.
This PR versions a single runtime API function in pallet-revive: the
trace_blockfunction. In the process, I also implemented #11532 to demonstrate how the various pieces connect together when we want to version a specific runtime API function as the last commit in the PR.This PR is meant to show case how everything in versioning works e2e before we go ahead and version the rest of the runtime API using this strategy.
All of the wire types we use for tracing have been added to the
typescrate. It houses the wire types and the payload types that we use for the runtime APIs.The following concepts were added to the codebase:
${name}V${version}- A version of a specific type. For exampleCallLogV1.${name}InputPayloadV${version}- A specific version of the input payload for some runtime API function. For exampleTraceBlockInputPayloadV1.${name}OutputPayloadV${version}- A specific version of the output payload for some runtime API function. For exampleTraceBlockOutputPayloadV1.${name}VersionedInputPayload- An enum of all of the possible versions that the input payload for some runtime API function can have.${name}VersionedOutputPayload- An enum of all of the possible versions that the output payload for some runtime API function can have.${name}InputPayload- Execution type input payload of some runtime API function.${name}OutputPayload- Execution type output payload of some runtime API function.There are a few things worth noting:
pallet-reviveand into thetypescrate.Tests
The new
test_trace_block_returns_v1_trace_on_v1_input_and_v2_trace_on_v2_inputtest is probably the best test for this functionality. It shows that the versioned runtime API function fortrace_blockfunctions exactly in the way that we expect it to do: given a V1 input we get a V1 output back and given a V2 input we get a V2 output back. It shows that versioning works end to end.