mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
core, params: add comments, move consts to params
This commit is contained in:
parent
593a6a77da
commit
7036b1cb39
4 changed files with 26 additions and 19 deletions
|
|
@ -120,8 +120,8 @@ func testEthTransferLogs(t *testing.T, value uint64) {
|
|||
|
||||
var expLogs = []*types.Log{
|
||||
{
|
||||
Address: types.EthSystemLogAddress,
|
||||
Topics: []common.Hash{types.EthTransferLogTopic0, addr2hash(addr1), addr2hash(addr2)},
|
||||
Address: params.SystemAddress,
|
||||
Topics: []common.Hash{params.EthTransferLogEvent, addr2hash(addr1), addr2hash(addr2)},
|
||||
Data: u256(value),
|
||||
},
|
||||
{
|
||||
|
|
@ -130,8 +130,8 @@ func testEthTransferLogs(t *testing.T, value uint64) {
|
|||
Data: nil,
|
||||
},
|
||||
{
|
||||
Address: types.EthSystemLogAddress,
|
||||
Topics: []common.Hash{types.EthTransferLogTopic0, addr2hash(addr2), addr2hash(addr3)},
|
||||
Address: params.SystemAddress,
|
||||
Topics: []common.Hash{params.EthTransferLogEvent, addr2hash(addr2), addr2hash(addr3)},
|
||||
Data: u256(value / 2),
|
||||
},
|
||||
{
|
||||
|
|
@ -140,8 +140,8 @@ func testEthTransferLogs(t *testing.T, value uint64) {
|
|||
Data: nil,
|
||||
},
|
||||
{
|
||||
Address: types.EthSystemLogAddress,
|
||||
Topics: []common.Hash{types.EthTransferLogTopic0, addr2hash(addr3), addr2hash(addr4)},
|
||||
Address: params.SystemAddress,
|
||||
Topics: []common.Hash{params.EthTransferLogEvent, addr2hash(addr3), addr2hash(addr4)},
|
||||
Data: u256(value / 2),
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -849,6 +849,13 @@ type RemovedAccountWithBalance struct {
|
|||
Balance *uint256.Int
|
||||
}
|
||||
|
||||
// GetRemovedAccountsWithBalance returns a list of accounts scheduled for
|
||||
// removal which still have positive balance. The purpose of this function is
|
||||
// to handle a corner case of EIP-7708 where a self-destructed account might
|
||||
// still receive funds between sending/burning its previous balance and actual
|
||||
// removal. In this case the burning of these remaining balances still need to
|
||||
// be logged.
|
||||
// Specification EIP-7708: https://eips.ethereum.org/EIPS/eip-7708
|
||||
func (s *StateDB) GetRemovedAccountsWithBalance() (list []RemovedAccountWithBalance) {
|
||||
for addr := range s.journal.dirties {
|
||||
if obj, exist := s.stateObjects[addr]; exist &&
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/holiman/uint256"
|
||||
)
|
||||
|
||||
|
|
@ -66,23 +67,14 @@ type logMarshaling struct {
|
|||
Index hexutil.Uint
|
||||
}
|
||||
|
||||
var (
|
||||
// system contract address
|
||||
EthSystemLogAddress = common.HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe")
|
||||
// keccak256('Transfer(address,address,uint256)')
|
||||
EthTransferLogTopic0 = common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef")
|
||||
// keccak256('Selfdestruct(address,uint256)')
|
||||
EthSelfDestructLogTopic0 = common.HexToHash("0x4bfaba3443c1a1836cd362418edc679fc96cae8449cbefccb6457cdf2c943083")
|
||||
)
|
||||
|
||||
// EthTransferLog creates and ETH transfer log according to EIP-7708.
|
||||
// Specification: https://eips.ethereum.org/EIPS/eip-7708
|
||||
func EthTransferLog(blockNumber *big.Int, from, to common.Address, amount *uint256.Int) *Log {
|
||||
amount32 := amount.Bytes32()
|
||||
return &Log{
|
||||
Address: EthSystemLogAddress,
|
||||
Address: params.SystemAddress,
|
||||
Topics: []common.Hash{
|
||||
EthTransferLogTopic0,
|
||||
params.EthTransferLogEvent,
|
||||
common.BytesToHash(from.Bytes()),
|
||||
common.BytesToHash(to.Bytes()),
|
||||
},
|
||||
|
|
@ -98,9 +90,9 @@ func EthTransferLog(blockNumber *big.Int, from, to common.Address, amount *uint2
|
|||
func EthSelfDestructLog(blockNumber *big.Int, from common.Address, amount *uint256.Int) *Log {
|
||||
amount32 := amount.Bytes32()
|
||||
return &Log{
|
||||
Address: EthSystemLogAddress,
|
||||
Address: params.SystemAddress,
|
||||
Topics: []common.Hash{
|
||||
EthSelfDestructLogTopic0,
|
||||
params.EthSelfDestructLogEvent,
|
||||
common.BytesToHash(from.Bytes()),
|
||||
},
|
||||
Data: amount32[:],
|
||||
|
|
|
|||
|
|
@ -220,3 +220,11 @@ var (
|
|||
ConsolidationQueueAddress = common.HexToAddress("0x0000BBdDc7CE488642fb579F8B00f3a590007251")
|
||||
ConsolidationQueueCode = common.FromHex("3373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd")
|
||||
)
|
||||
|
||||
// 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)')
|
||||
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue