Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: force conversion of withdrawal code #449

Draft
wants to merge 1 commit into
base: base-root-last-merkle-root-merge
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,17 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
// Amount is in gwei, turn into wei
amount := new(big.Int).Mul(new(big.Int).SetUint64(w.Amount), big.NewInt(params.GWei))
statedb.AddBalance(w.Address, amount)

// fix: during the transition, if the withdrawals account
// hasn't been translated yet, then the code will not make
// it to the verkle tree when it's being written.
if state.Database().InTransition() {
codeHash := state.GetCodeHash(w.Address)
if codeHash != types.EmptyCodeHash {
code := state.GetCode(w.Address)
state.GetTrie().UpdateContractCode(w.Address, codeHash, code)
}
}
}
if chainConfig.IsPrague(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp) {
if err := overlay.OverlayVerkleTransition(statedb, common.Hash{}, chainConfig.OverlayStride); err != nil {
Expand Down
11 changes: 11 additions & 0 deletions consensus/beacon/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,17 @@ func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.
amount = amount.Mul(amount, big.NewInt(params.GWei))
state.AddBalance(w.Address, amount)

// fix: during the transition, if the withdrawals account
// hasn't been translated yet, then the code will not make
// it to the verkle tree when it's being written.
if state.Database().InTransition() {
codeHash := state.GetCodeHash(w.Address)
if codeHash != types.EmptyCodeHash {
code := state.GetCode(w.Address)
state.GetTrie().UpdateContractCode(w.Address, codeHash, code)
}
}

// The returned gas is not charged
state.Witness().TouchFullAccount(w.Address[:], true)
}
Expand Down