EVM: Handle coinbase transfers for linked beneficiaries#5423
Open
mpapierski wants to merge 1 commit into
Open
Conversation
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.
Summary
Adds
block.coinbasesupport for Casper block proposers whose public key is not secp256k1, with the main target being ed25519 validators.Previously, finalized EVM execution derived the block beneficiary with
Address::from_public_key(&proposer).unwrap_or(Address::ZERO). SinceAddress::from_public_keyis intentionally secp256k1-only, ed25519 proposers exposed0x0000000000000000000000000000000000000000asblock.coinbase, and EVM transfers toblock.coinbasecould not credit the validator’s Casper account.This PR introduces a Casper-defined proposer receive alias for non-secp256k1 proposers and prelinks that alias to the proposer’s Casper account before finalized EVM execution.
Behavior
For finalized EVM execution:
proposer.to_account_hash()as the EVMblock.coinbaseaddress.if an EVM contract transfers value to
block.coinbase, the value is credited through the identity link to the proposer account’s main purse.This means patterns like:
credit the ed25519 validator’s Casper account main purse when the block is proposed by that validator and the proposer identity can be safely linked.
Important Caveats
The non-secp256k1 beneficiary address is a Casper-defined receive alias, not an Ethereum key-derived EOA.
It cannot sign Ethereum transactions.
Address::from_public_keyremains secp256k1-only and keeps its Ethereum-native semantics.The proposer identity link is created before finalized EVM execution, not lazily during EVM state application. This keeps the EVM executor from creating
Key::Accountbridges.Existing EVM identity state is not overwritten:
Key::Accountidentity, that identity is preserved;Key::URefidentity, that identity is preserved;If an existing linked beneficiary has code, a transfer to block.coinbase follows normal EVM semantics and executes that code.