Skip to content
Merged
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
14 changes: 7 additions & 7 deletions execution/protocol/misc/eip7708.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ var (
// keccak256('Transfer(address,address,uint256)')
EthTransferLogEvent = common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")

// keccak256('Selfdestruct(address,uint256)')
EthSelfDestructLogEvent = common.HexToHash("0x4bfaba3443c1a1836cd362418edc679fc96cae8449cbefccb6457cdf2c943083")
// keccak256('Burn(address,uint256)')
EthBurnLogEvent = common.HexToHash("0xcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5")
)

// EthTransferLog creates and ETH transfer log according to EIP-7708.
Expand All @@ -56,14 +56,14 @@ func EthTransferLog(from, to common.Address, amount uint256.Int) *types.Log {
}
}

// EthSelfDestructLog creates and ETH self-destruct burn log according to EIP-7708.
// EthBurnLog creates an ETH burn log according to EIP-7708.
// Specification: https://eips.ethereum.org/EIPS/eip-7708
func EthSelfDestructLog(from common.Address, amount uint256.Int) *types.Log {
func EthBurnLog(from common.Address, amount uint256.Int) *types.Log {
amount32 := amount.Bytes32()
return &types.Log{
Address: params.SystemAddress.Value(),
Topics: []common.Hash{
EthSelfDestructLogEvent,
EthBurnLogEvent,
from.Hash(),
},
Data: amount32[:],
Expand Down Expand Up @@ -92,15 +92,15 @@ func LogSelfDestructedAccounts(ibs evmtypes.IntraBlockState, sender accounts.Add
if !rules.IsAmsterdam {
return
}
// Emit SelfDestruct logs where accounts with non-empty balances have been deleted
// Emit burn logs where accounts with non-empty balances have been deleted
// See case (2) in https://eips.ethereum.org/EIPS/eip-7708#selfdestruct-processing
removedWithBalance := ibs.GetRemovedAccountsWithBalance()
if removedWithBalance != nil {
sort.Slice(removedWithBalance, func(i, j int) bool {
return removedWithBalance[i].Address.Cmp(removedWithBalance[j].Address) < 0
})
for _, sd := range removedWithBalance {
ibs.AddLog(EthSelfDestructLog(sd.Address, sd.Balance))
ibs.AddLog(EthBurnLog(sd.Address, sd.Balance))
}
}
}
2 changes: 1 addition & 1 deletion execution/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ func opSelfdestruct6780(pc uint64, evm *EVM, scope *CallContext) (uint64, []byte
if self != beneficiaryAddr {
ibs.AddLog(misc.EthTransferLog(self.Value(), beneficiaryAddr.Value(), balance))
} else if newContract {
ibs.AddLog(misc.EthSelfDestructLog(self.Value(), balance))
ibs.AddLog(misc.EthBurnLog(self.Value(), balance))
}
}
tracer := evm.Config().Tracer
Expand Down
Loading