Skip to content

Instrument SELFDESTRUCT gas func #490

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

Open
wants to merge 2 commits into
base: cbp-feature
Choose a base branch
from

Conversation

MishkaRogachev
Copy link
Contributor

@MishkaRogachev MishkaRogachev commented Jul 17, 2025

For NIT-3485

Instrument SELFDESTRUCT opcode with multigas calculations:

  • Base gasSelfdestruct func
  • makeSelfdestructGasFn for EIP-2929 and EIP-3529
  • gasSelfdestructEIP4762 for EIP-4762 (Verkle trees)

@cla-bot cla-bot bot added the s CLA signed label Jul 17, 2025
@MishkaRogachev MishkaRogachev changed the base branch from master to cbp-feature July 18, 2025 11:18
@@ -517,26 +517,27 @@ func gasStaticCall(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memo
}

func gasSelfdestruct(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (*multigas.MultiGas, uint64, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params.SelfdestructGasEIP150 -> StorageAccess
params.CreateBySelfdestructGas -> StorageGrowth

Based on:
https://github.com/OffchainLabs/go-ethereum/blob/496de0b167b23ae2710059abd75f0ef18830519a/eth/tracers/native/gas_dimension_calc.go#L1061C4-L1061C7

@@ -133,7 +133,9 @@ func gasSelfdestructEIP4762(evm *EVM, contract *Contract, stack *Stack, mem *Mem
statelessGas += evm.AccessEvents.BasicDataGas(beneficiaryAddr, true)
}
}
return multigas.ZeroGas(), statelessGas, nil
multiGas := multigas.StorageAccessGas(statelessGas)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verkle/Stateless mode -> StorageAccess

@MishkaRogachev MishkaRogachev marked this pull request as ready for review July 18, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s CLA signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants