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
4 changes: 2 additions & 2 deletions core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ func ApplyTransactionWithEVM(msg *Message, gp *GasPool, statedb *state.StateDB,
return nil, cumulativeGas, err
}
if evm.ChainConfig().IsAmsterdam(blockNumber, blockTime) {
// Emit Selfdesctruct logs where accounts with non-empty balances have been deleted
// Emit burn logs where accounts with non-empty balances have been deleted
removedWithBalance := statedb.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 {
statedb.AddLog(types.EthSelfDestructLog(blockNumber, sd.Address, sd.Balance))
statedb.AddLog(types.EthBurnLog(blockNumber, sd.Address, sd.Balance))
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions core/types/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ func EthTransferLog(blockNumber *big.Int, from, to common.Address, amount *uint2
}
}

// 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(blockNumber *big.Int, from common.Address, amount *uint256.Int) *Log {
func EthBurnLog(blockNumber *big.Int, from common.Address, amount *uint256.Int) *Log {
amount32 := amount.Bytes32()
return &Log{
Address: params.SystemAddress,
Topics: []common.Hash{
params.EthSelfDestructLogEvent,
params.EthBurnLogEvent,
common.BytesToHash(from.Bytes()),
},
Data: amount32[:],
Expand Down
2 changes: 1 addition & 1 deletion core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ func opSelfdestruct6780(pc *uint64, evm *EVM, scope *ScopeContext) ([]byte, erro
if this != beneficiary {
evm.StateDB.AddLog(types.EthTransferLog(evm.Context.BlockNumber, this, beneficiary, balance))
} else if newContract {
evm.StateDB.AddLog(types.EthSelfDestructLog(evm.Context.BlockNumber, this, balance))
evm.StateDB.AddLog(types.EthBurnLog(evm.Context.BlockNumber, this, balance))
}
}

Expand Down
6 changes: 3 additions & 3 deletions params/protocol_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ var (

// System log events.
var (
// EIP-7708 - System logs emitted for ETH transfer and self-destruct balance burn
EthTransferLogEvent = common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") // keccak256('Transfer(address,address,uint256)')
EthSelfDestructLogEvent = common.HexToHash("0x4bfaba3443c1a1836cd362418edc679fc96cae8449cbefccb6457cdf2c943083") // keccak256('Selfdestruct(address,uint256)')
// EIP-7708 - System logs emitted for ETH transfer and burn
EthTransferLogEvent = common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") // keccak256('Transfer(address,address,uint256)')
EthBurnLogEvent = common.HexToHash("0xcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5") // keccak256('Burn(address,uint256)')

)
Loading