Conversation
WMAS pays, from its own locked MAS, for the datastore balance entry created when transferring/approving to a fresh address (charged to the executing SC in set_data_entry). WMAS is a widely-used singleton that cannot be redeployed without forcing all holders/integrations to migrate. This adds a one-time, versioning-gated irregular state change: at the activation of MipComponent::Execution version WMAS_PATCH_EXEC_VERSION, every node deterministically overwrites the WMAS bytecode with an audited fixed build, in execute_slot (shared by candidate and final execution). Why this is safe: - bytecode is stored separately from datastore + coin balance, so all balances and locked MAS are preserved by the swap; - the module cache is keyed by bytecode hash, so the new bytecode is recompiled on first use with no explicit invalidation; - the change is part of the slot's ledger changes and thus of final state, so nodes bootstrapping after activation get the patched bytecode. Note: coin transfers (e.g. WMAS.withdraw) are NOT affected by the drain: transfer_coins funds a new address's creation cost out of the transferred amount and fails if it is insufficient, never touching the SC balance. Operational values to fill before enabling (loud TODOs): - WMAS_ADDRESS: verified mainnet address; - resources/wmas_patched.wasm: reproducible fixed build (empty here, so the crate builds while the patch stays inert; applying empty bytecode is refused as a fail-safe); - register the activation MIP bumping MipComponent::Execution to WMAS_PATCH_EXEC_VERSION. Until then execution_component_version never reaches it and this code is inert. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds MIP-0002-WMAS-BytecodePatch, bumping MipComponent::Execution to 2 (= WMAS_PATCH_EXEC_VERSION). This is the network-coordinated trigger for the one-time WMAS bytecode override in massa-execution-worker: until this MIP is active, execution_component_version never reaches 2 and the patch code stays inert. Only the Execution component is bumped (the patch flows through normal ledger changes and does not alter the final-state format, so FinalState is left unchanged). TODO(release): the start/timeout/defined dates are placeholders (future, so the MIP cannot activate prematurely). Set real dates only once WMAS_ADDRESS and resources/wmas_patched.wasm are filled in. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replaces the `include_bytes!` from resources/wmas_patched.wasm with an in-source `PATCHED_WMAS_BYTECODE` constant (wmas_bytecode.rs), so the patch carries no external build artifact and the exact bytes are reviewable in the source tree. The generated module records the source, length and sha256 of the wasm for verification. Also harden the activation path: wmas_address() now returns Option and the hook skips (with a warning) unless BOTH a valid address and non-empty bytecode are present, so a placeholder/misconfiguration can never panic or apply a partial patch in consensus execution. TODO(release): regenerate wmas_bytecode.rs from the reproducible, audited build of the deployed WMAS contract and set WMAS_ADDRESS before enabling the MIP.
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.
resync_checkflag