feat: save configs for re-execution on re-starts #860
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.
Save Runtime Execution Config for Restarts
Summary
Implements persistence of runtime execution configuration to ensure pre-confirmed blocks are re-executed with the same config values used during original execution, even after node restarts with different configuration.
Problem
When a node restarts with a pre-confirmed block, re-execution must use the exact same configuration (ChainConfig, VersionedConstants, and
no_charge_fee) that was used during original execution. Without this, transaction receipts and state diffs would differ between original execution and re-execution, causing validation failures.Solution
New Module: Created
runtime_exec_config.rsinprimitives/chain_configto handle serialization of runtime execution config with version-aware ChainConfig handlingDatabase Persistence: Added database operations to save/load
RuntimeExecutionConfigon restartRe-execution Logic: Modified
close_preconfirmed_block_if_existsto:ChainConfig,VersionedConstants, andno_charge_feefor re-executionVersion Handling: Implemented round-trip YAML serialization that automatically handles ChainConfig version changes
Key Changes
madara/crates/primitives/chain_config/src/runtime_exec_config.rs- RuntimeExecutionConfig serializationblock_production/src/lib.rs- Save/load config on restart, use saved values for re-executiondb/src/rocksdb/meta.rs- Database operations for runtime exec configdb/src/storage.rs,db/src/lib.rs,db/src/rocksdb/mod.rs- Storage trait and implementationsTesting
test_reexecution_uses_saved_no_charge_fee_valueto verify saved config is used for re-executionBreaking Changes
None - backward compatible.