diff --git a/common/celo_types.go b/common/celo_types.go index 390cc13138..e4eafe4abb 100644 --- a/common/celo_types.go +++ b/common/celo_types.go @@ -1,6 +1,8 @@ package common import ( + "encoding/json" + "fmt" "math/big" ) @@ -16,6 +18,39 @@ type FeeCurrencyContext struct { IntrinsicGasCosts IntrinsicGasCosts } +// Only used in tracer tests +func (fc *FeeCurrencyContext) UnmarshalJSON(data []byte) error { + var raw struct { + ExchangeRates map[Address][]json.Number `json:"exchangeRates"` + IntrinsicGasCosts map[Address]uint64 `json:"intrinsicGasCosts"` + } + + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + + fc.ExchangeRates = make(ExchangeRates) + for addr, rateArr := range raw.ExchangeRates { + if len(rateArr) != 2 { + return fmt.Errorf("invalid exchange rate array for address %s: expected 2 elements, got %d", addr, len(rateArr)) + } + numerator, ok := new(big.Int).SetString(string(rateArr[0]), 10) + if !ok { + return fmt.Errorf("invalid numerator for address %s: %s", addr, rateArr[0]) + } + denominator, ok := new(big.Int).SetString(string(rateArr[1]), 10) + if !ok { + return fmt.Errorf("invalid denominator for address %s: %s", addr, rateArr[1]) + } + + rate := new(big.Rat).SetFrac(numerator, denominator) + fc.ExchangeRates[addr] = rate + } + fc.IntrinsicGasCosts = raw.IntrinsicGasCosts + + return nil +} + func MaxAllowedIntrinsicGasCost(i IntrinsicGasCosts, feeCurrency *Address) (uint64, bool) { intrinsicGas, ok := CurrencyIntrinsicGasCost(i, feeCurrency) if !ok { diff --git a/contracts/fee_currencies.go b/contracts/fee_currencies.go index 86d6ab4d86..fa51467760 100644 --- a/contracts/fee_currencies.go +++ b/contracts/fee_currencies.go @@ -41,6 +41,15 @@ func TryDebitFees(tx *types.Transaction, from common.Address, backend *CeloBacke // Debits transaction fees from the transaction sender and stores them in the temporary address func DebitFees(evm *vm.EVM, feeCurrency *common.Address, address common.Address, amount *big.Int) (uint64, error) { + // Hide this function from traces + if evm.Config.Tracer != nil && !evm.Config.Tracer.TraceDebitCredit { + origTracer := evm.Config.Tracer + defer func() { + evm.Config.Tracer = origTracer + }() + evm.Config.Tracer = nil + } + if amount.Cmp(big.NewInt(0)) == 0 { return 0, nil } @@ -78,6 +87,15 @@ func CreditFees( refund, feeTip, baseFee, l1DataFee *big.Int, gasUsedDebit uint64, ) error { + // Hide this function from traces + if evm.Config.Tracer != nil && !evm.Config.Tracer.TraceDebitCredit { + origTracer := evm.Config.Tracer + defer func() { + evm.Config.Tracer = origTracer + }() + evm.Config.Tracer = nil + } + // Our old `creditGasFees` function does not accept an l1DataFee and // the fee currencies do not implement the new interface yet. Since tip // and data fee both go to the sequencer, we can work around that for diff --git a/core/tracing/hooks.go b/core/tracing/hooks.go index 9efe11a2d9..940b78d58f 100644 --- a/core/tracing/hooks.go +++ b/core/tracing/hooks.go @@ -193,6 +193,9 @@ type Hooks struct { OnCodeChange CodeChangeHook OnStorageChange StorageChangeHook OnLog LogHook + + // Celo specific: should the tracer be run when fee currencies are debited/credited for gas? + TraceDebitCredit bool } // BalanceChangeReason is used to indicate the reason for a balance change, useful diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/fee_currency.json b/eth/tracers/internal/tracetest/testdata/call_tracer/fee_currency.json new file mode 100644 index 0000000000..4c9fde0dee --- /dev/null +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/fee_currency.json @@ -0,0 +1,84 @@ +{ + "genesis": { + "difficulty": "0", + "extraData": "0xd8820100846765746888676f312e32312e368664617277696e", + "gasLimit": "11533720", + "hash": "0x64579a9548b63477d50175fe20108afda5ffcbc38d7ff709dd2f07cae0077bdb", + "miner": "0x0000000000000000000000000000000000000000", + "mixHash": "0xa5bdfbdd8f30e8eb34108e78f94274cd60dd348aed7428a47330f94e6d8f0378", + "nonce": "0x0000000000000000", + "number": "3", + "stateRoot": "0xe7ce9d40973a218b36332fcfd42b102e1b1f620a914f344de0f996b429e26b2c", + "timestamp": "1721119176", + "totalDifficulty": "1", + "withdrawals": [], + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "alloc": { + "0x0000000000000000000000000000000000000000": { + "balance": "0xa410", + "nonce": "1" + }, + "0x000000000000000000000000000000000000ce16": { + "balance": "0x0", + "code": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806358cf96721161008c57806395d89b411161006657806395d89b41146101ca578063a457c2d7146101d2578063a9059cbb146101e5578063dd62ed3e146101f857600080fd5b806358cf96721461016c5780636a30b2531461018157806370a082311461019457600080fd5b806323b872dd116100bd57806323b872dd14610137578063313ce5671461014a578063395093511461015957600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f99190610c15565b60405180910390f35b610115610110366004610cb1565b6102d0565b60405190151581526020016100f9565b6002545b6040519081526020016100f9565b610115610145366004610cdb565b6102e8565b604051601281526020016100f9565b610115610167366004610cb1565b61030e565b61017f61017a366004610cb1565b61035a565b005b61017f61018f366004610d17565b61041e565b6101296101a2366004610d8f565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6100ec610510565b6101156101e0366004610cb1565b61051f565b6101156101f3366004610cb1565b6105fb565b610129610206366004610daa565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461024d90610ddd565b80601f016020809104026020016040519081016040528092919081815260200182805461027990610ddd565b80156102c65780601f1061029b576101008083540402835291602001916102c6565b820191906000526020600020905b8154815290600101906020018083116102a957829003601f168201915b5050505050905090565b6000336102de818585610609565b5060019392505050565b6000336102f68582856107bc565b610301858585610893565b60019150505b9392505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906102de9082908690610355908790610e5f565b610609565b33156103c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040812080548392906103fc908490610e77565b9250508190555080600260008282546104159190610e77565b90915550505050565b3315610486576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000060448201526064016103be565b73ffffffffffffffffffffffffffffffffffffffff8816600090815260208190526040812080548692906104bb908490610e5f565b909155506104cc9050888683610b46565b6104d69085610e5f565b93506104e3888885610b46565b6104ed9085610e5f565b935083600260008282546105019190610e5f565b90915550505050505050505050565b60606004805461024d90610ddd565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156105e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016103be565b6105f08286868403610609565b506001949350505050565b6000336102de818585610893565b73ffffffffffffffffffffffffffffffffffffffff83166106ab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff821661074e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461088d5781811015610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016103be565b61088d8484848403610609565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff82166109d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610a8f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220858503905591851681529081208054849290610ad3908490610e5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b3991815260200190565b60405180910390a361088d565b600073ffffffffffffffffffffffffffffffffffffffff8316610b6b57506000610307565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604081208054849290610ba0908490610e5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c0691815260200190565b60405180910390a35092915050565b600060208083528351808285015260005b81811015610c4257858101830151858201604001528201610c26565b81811115610c54576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610cac57600080fd5b919050565b60008060408385031215610cc457600080fd5b610ccd83610c88565b946020939093013593505050565b600080600060608486031215610cf057600080fd5b610cf984610c88565b9250610d0760208501610c88565b9150604084013590509250925092565b600080600080600080600080610100898b031215610d3457600080fd5b610d3d89610c88565b9750610d4b60208a01610c88565b9650610d5960408a01610c88565b9550610d6760608a01610c88565b979a969950949760808101359660a0820135965060c0820135955060e0909101359350915050565b600060208284031215610da157600080fd5b61030782610c88565b60008060408385031215610dbd57600080fd5b610dc683610c88565b9150610dd460208401610c88565b90509250929050565b600181811c90821680610df157607f821691505b602082108103610e2a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115610e7257610e72610e30565b500190565b600082821015610e8957610e89610e30565b50039056fea164736f6c634300080f000a", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000056bc75e2d63100000", + "0x85de51d5625304e72107ba46e4bf731a09f455f609080a043a4ca2c0db099937": "0x0000000000000000000000000000000000000000000000056bc75e2d63100000" + } + }, + "0x00000000000000000000000000000000deadbeef": { + "balance": "0x2" + }, + "0x42cf1bbc38baaa3c4898ce8790e21ed2738c6a4a": { + "balance": "0x56bc787f65890fb62", + "nonce": "3" + } + }, + "config": { + "chainId": 1337, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "muirGlacierBlock": 0, + "berlinBlock": 0, + "londonBlock": 0, + "arrowGlacierBlock": 0, + "grayGlacierBlock": 0, + "shanghaiTime": 0, + "cel2Time": 0, + "terminalTotalDifficulty": 0, + "terminalTotalDifficultyPassed": true + } + }, + "context": { + "baseFeePerGas": "670833297", + "number": "4", + "difficulty": "0", + "timestamp": "1721119177", + "gasLimit": "11544982", + "miner": "0x0000000000000000000000000000000000000000", + "feeCurrencyContext": { + "exchangeRates": { + "0x000000000000000000000000000000000000cE16": [2, 1] + }, + "intrinsicGasCosts": { + "0x000000000000000000000000000000000000cE16": 50000 + } + } + }, + "input": "0x7bf87e8205390380847735940083015f909400000000000000000000000000000000deadbeef0280c094000000000000000000000000000000000000ce1680a06b175ce301873e64da4ef5c2fa5c8f6eb61b9ab1d7bfbe103812a32ad94a5c4fa05d55f5f23e76ce11491f4776299a1a65d4af48924b330a7681e394b2ef8e173b", + "result": { + "from": "0x42cf1bbc38baaa3c4898ce8790e21ed2738c6a4a", + "gas": "0x15f90", + "gasUsed": "0x11558", + "to": "0x00000000000000000000000000000000deadbeef", + "input": "0x", + "value": "0x2", + "type": "CALL" + } +} diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer/fee_currency.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer/fee_currency.json new file mode 100644 index 0000000000..d31da99ff6 --- /dev/null +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer/fee_currency.json @@ -0,0 +1,98 @@ +{ + "genesis": { + "difficulty": "0", + "extraData": "0xd8820100846765746888676f312e32312e368664617277696e", + "gasLimit": "11533720", + "hash": "0x64579a9548b63477d50175fe20108afda5ffcbc38d7ff709dd2f07cae0077bdb", + "miner": "0x0000000000000000000000000000000000000000", + "mixHash": "0xa5bdfbdd8f30e8eb34108e78f94274cd60dd348aed7428a47330f94e6d8f0378", + "nonce": "0x0000000000000000", + "number": "3", + "stateRoot": "0xe7ce9d40973a218b36332fcfd42b102e1b1f620a914f344de0f996b429e26b2c", + "timestamp": "1721119176", + "totalDifficulty": "1", + "withdrawals": [], + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "alloc": { + "0x0000000000000000000000000000000000000000": { + "balance": "0xa410", + "nonce": "1" + }, + "0x000000000000000000000000000000000000ce16": { + "balance": "0x0", + "code": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806358cf96721161008c57806395d89b411161006657806395d89b41146101ca578063a457c2d7146101d2578063a9059cbb146101e5578063dd62ed3e146101f857600080fd5b806358cf96721461016c5780636a30b2531461018157806370a082311461019457600080fd5b806323b872dd116100bd57806323b872dd14610137578063313ce5671461014a578063395093511461015957600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f99190610c15565b60405180910390f35b610115610110366004610cb1565b6102d0565b60405190151581526020016100f9565b6002545b6040519081526020016100f9565b610115610145366004610cdb565b6102e8565b604051601281526020016100f9565b610115610167366004610cb1565b61030e565b61017f61017a366004610cb1565b61035a565b005b61017f61018f366004610d17565b61041e565b6101296101a2366004610d8f565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6100ec610510565b6101156101e0366004610cb1565b61051f565b6101156101f3366004610cb1565b6105fb565b610129610206366004610daa565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461024d90610ddd565b80601f016020809104026020016040519081016040528092919081815260200182805461027990610ddd565b80156102c65780601f1061029b576101008083540402835291602001916102c6565b820191906000526020600020905b8154815290600101906020018083116102a957829003601f168201915b5050505050905090565b6000336102de818585610609565b5060019392505050565b6000336102f68582856107bc565b610301858585610893565b60019150505b9392505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906102de9082908690610355908790610e5f565b610609565b33156103c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040812080548392906103fc908490610e77565b9250508190555080600260008282546104159190610e77565b90915550505050565b3315610486576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000060448201526064016103be565b73ffffffffffffffffffffffffffffffffffffffff8816600090815260208190526040812080548692906104bb908490610e5f565b909155506104cc9050888683610b46565b6104d69085610e5f565b93506104e3888885610b46565b6104ed9085610e5f565b935083600260008282546105019190610e5f565b90915550505050505050505050565b60606004805461024d90610ddd565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156105e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016103be565b6105f08286868403610609565b506001949350505050565b6000336102de818585610893565b73ffffffffffffffffffffffffffffffffffffffff83166106ab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff821661074e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461088d5781811015610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016103be565b61088d8484848403610609565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff82166109d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610a8f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220858503905591851681529081208054849290610ad3908490610e5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b3991815260200190565b60405180910390a361088d565b600073ffffffffffffffffffffffffffffffffffffffff8316610b6b57506000610307565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604081208054849290610ba0908490610e5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c0691815260200190565b60405180910390a35092915050565b600060208083528351808285015260005b81811015610c4257858101830151858201604001528201610c26565b81811115610c54576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610cac57600080fd5b919050565b60008060408385031215610cc457600080fd5b610ccd83610c88565b946020939093013593505050565b600080600060608486031215610cf057600080fd5b610cf984610c88565b9250610d0760208501610c88565b9150604084013590509250925092565b600080600080600080600080610100898b031215610d3457600080fd5b610d3d89610c88565b9750610d4b60208a01610c88565b9650610d5960408a01610c88565b9550610d6760608a01610c88565b979a969950949760808101359660a0820135965060c0820135955060e0909101359350915050565b600060208284031215610da157600080fd5b61030782610c88565b60008060408385031215610dbd57600080fd5b610dc683610c88565b9150610dd460208401610c88565b90509250929050565b600181811c90821680610df157607f821691505b602082108103610e2a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115610e7257610e72610e30565b500190565b600082821015610e8957610e89610e30565b50039056fea164736f6c634300080f000a", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000056bc75e2d63100000", + "0x544d4f2940ad90cc7147a86952e118002f47e179e05bd1add1e9972168d958aa": "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x85de51d5625304e72107ba46e4bf731a09f455f609080a043a4ca2c0db099937": "0x0000000000000000000000000000000000000000000000056bc75e2d63100000" + } + }, + "0x00000000000000000000000000000000deadbeef": { + "balance": "0x2" + }, + "0x42cf1bbc38baaa3c4898ce8790e21ed2738c6a4a": { + "balance": "0x56bc787f65890fb62", + "nonce": "3" + } + }, + "config": { + "chainId": 1337, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "muirGlacierBlock": 0, + "berlinBlock": 0, + "londonBlock": 0, + "arrowGlacierBlock": 0, + "grayGlacierBlock": 0, + "shanghaiTime": 0, + "cel2Time": 0, + "terminalTotalDifficulty": 0, + "terminalTotalDifficultyPassed": true + } + }, + "context": { + "baseFeePerGas": "670833297", + "number": "4", + "difficulty": "0", + "timestamp": "1721119177", + "gasLimit": "11544982", + "miner": "0x0000000000000000000000000000000000000000", + "feeCurrencyContext": { + "exchangeRates": { + "0x000000000000000000000000000000000000cE16": [2, 1] + }, + "intrinsicGasCosts": { + "0x000000000000000000000000000000000000cE16": 50000 + } + } + }, + "input": "0x7bf87e8205390380847735940083015f909400000000000000000000000000000000deadbeef0280c094000000000000000000000000000000000000ce1680a06b175ce301873e64da4ef5c2fa5c8f6eb61b9ab1d7bfbe103812a32ad94a5c4fa05d55f5f23e76ce11491f4776299a1a65d4af48924b330a7681e394b2ef8e173b", + "result": { + "0x0000000000000000000000000000000000000000": { + "balance": "0xa410", + "nonce": 1 + }, + "0x000000000000000000000000000000000000ce16": { + "balance": "0x0", + "code": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806358cf96721161008c57806395d89b411161006657806395d89b41146101ca578063a457c2d7146101d2578063a9059cbb146101e5578063dd62ed3e146101f857600080fd5b806358cf96721461016c5780636a30b2531461018157806370a082311461019457600080fd5b806323b872dd116100bd57806323b872dd14610137578063313ce5671461014a578063395093511461015957600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f99190610c15565b60405180910390f35b610115610110366004610cb1565b6102d0565b60405190151581526020016100f9565b6002545b6040519081526020016100f9565b610115610145366004610cdb565b6102e8565b604051601281526020016100f9565b610115610167366004610cb1565b61030e565b61017f61017a366004610cb1565b61035a565b005b61017f61018f366004610d17565b61041e565b6101296101a2366004610d8f565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6100ec610510565b6101156101e0366004610cb1565b61051f565b6101156101f3366004610cb1565b6105fb565b610129610206366004610daa565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461024d90610ddd565b80601f016020809104026020016040519081016040528092919081815260200182805461027990610ddd565b80156102c65780601f1061029b576101008083540402835291602001916102c6565b820191906000526020600020905b8154815290600101906020018083116102a957829003601f168201915b5050505050905090565b6000336102de818585610609565b5060019392505050565b6000336102f68582856107bc565b610301858585610893565b60019150505b9392505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906102de9082908690610355908790610e5f565b610609565b33156103c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040812080548392906103fc908490610e77565b9250508190555080600260008282546104159190610e77565b90915550505050565b3315610486576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000060448201526064016103be565b73ffffffffffffffffffffffffffffffffffffffff8816600090815260208190526040812080548692906104bb908490610e5f565b909155506104cc9050888683610b46565b6104d69085610e5f565b93506104e3888885610b46565b6104ed9085610e5f565b935083600260008282546105019190610e5f565b90915550505050505050505050565b60606004805461024d90610ddd565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156105e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016103be565b6105f08286868403610609565b506001949350505050565b6000336102de818585610893565b73ffffffffffffffffffffffffffffffffffffffff83166106ab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff821661074e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461088d5781811015610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016103be565b61088d8484848403610609565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff82166109d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610a8f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220858503905591851681529081208054849290610ad3908490610e5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b3991815260200190565b60405180910390a361088d565b600073ffffffffffffffffffffffffffffffffffffffff8316610b6b57506000610307565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604081208054849290610ba0908490610e5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c0691815260200190565b60405180910390a35092915050565b600060208083528351808285015260005b81811015610c4257858101830151858201604001528201610c26565b81811115610c54576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610cac57600080fd5b919050565b60008060408385031215610cc457600080fd5b610ccd83610c88565b946020939093013593505050565b600080600060608486031215610cf057600080fd5b610cf984610c88565b9250610d0760208501610c88565b9150604084013590509250925092565b600080600080600080600080610100898b031215610d3457600080fd5b610d3d89610c88565b9750610d4b60208a01610c88565b9650610d5960408a01610c88565b9550610d6760608a01610c88565b979a969950949760808101359660a0820135965060c0820135955060e0909101359350915050565b600060208284031215610da157600080fd5b61030782610c88565b60008060408385031215610dbd57600080fd5b610dc683610c88565b9150610dd460208401610c88565b90509250929050565b600181811c90821680610df157607f821691505b602082108103610e2a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115610e7257610e72610e30565b500190565b600082821015610e8957610e89610e30565b50039056fea164736f6c634300080f000a", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000056bc75e2d63100000", + "0x544d4f2940ad90cc7147a86952e118002f47e179e05bd1add1e9972168d958aa": "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x85de51d5625304e72107ba46e4bf731a09f455f609080a043a4ca2c0db099937": "0x0000000000000000000000000000000000000000000000056bc75e2d63100000" + } + }, + "0x00000000000000000000000000000000deadbeef": { + "balance": "0x2" + }, + "0x42cf1bbc38baaa3c4898ce8790e21ed2738c6a4a": { + "balance": "0x56bc787f65890fb62", + "nonce": 3 + } + } +} diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/fee_currency.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/fee_currency.json new file mode 100644 index 0000000000..b3b405eb5f --- /dev/null +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/fee_currency.json @@ -0,0 +1,115 @@ +{ + "genesis": { + "baseFeePerGas": "1000000000", + "blobGasUsed": "0", + "difficulty": "0", + "excessBlobGas": "0", + "extraData": "0x", + "gasLimit": "11500000", + "hash": "0xc7251007be38d4facc71896878b1540ab6fb3b789aa5993f8cc4b7be7190f42e", + "miner": "0x0000000000000000000000000000000000000000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "0", + "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "stateRoot": "0x951ef51a39ef66705f08bcaf5ead3fec1de67effda449899b83d9e1800a1463d", + "timestamp": "0", + "totalDifficulty": "0", + "withdrawals": [], + "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "alloc": { + "0x0000000000000000000000000000000000000000": { + "balance": "0x0" + }, + "0x000000000000000000000000000000000000ce16": { + "balance": "0x0", + "code": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806358cf96721161008c57806395d89b411161006657806395d89b41146101ca578063a457c2d7146101d2578063a9059cbb146101e5578063dd62ed3e146101f857600080fd5b806358cf96721461016c5780636a30b2531461018157806370a082311461019457600080fd5b806323b872dd116100bd57806323b872dd14610137578063313ce5671461014a578063395093511461015957600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f99190610c15565b60405180910390f35b610115610110366004610cb1565b6102d0565b60405190151581526020016100f9565b6002545b6040519081526020016100f9565b610115610145366004610cdb565b6102e8565b604051601281526020016100f9565b610115610167366004610cb1565b61030e565b61017f61017a366004610cb1565b61035a565b005b61017f61018f366004610d17565b61041e565b6101296101a2366004610d8f565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6100ec610510565b6101156101e0366004610cb1565b61051f565b6101156101f3366004610cb1565b6105fb565b610129610206366004610daa565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461024d90610ddd565b80601f016020809104026020016040519081016040528092919081815260200182805461027990610ddd565b80156102c65780601f1061029b576101008083540402835291602001916102c6565b820191906000526020600020905b8154815290600101906020018083116102a957829003601f168201915b5050505050905090565b6000336102de818585610609565b5060019392505050565b6000336102f68582856107bc565b610301858585610893565b60019150505b9392505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906102de9082908690610355908790610e5f565b610609565b33156103c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040812080548392906103fc908490610e77565b9250508190555080600260008282546104159190610e77565b90915550505050565b3315610486576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000060448201526064016103be565b73ffffffffffffffffffffffffffffffffffffffff8816600090815260208190526040812080548692906104bb908490610e5f565b909155506104cc9050888683610b46565b6104d69085610e5f565b93506104e3888885610b46565b6104ed9085610e5f565b935083600260008282546105019190610e5f565b90915550505050505050505050565b60606004805461024d90610ddd565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156105e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016103be565b6105f08286868403610609565b506001949350505050565b6000336102de818585610893565b73ffffffffffffffffffffffffffffffffffffffff83166106ab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff821661074e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461088d5781811015610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016103be565b61088d8484848403610609565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff82166109d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610a8f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220858503905591851681529081208054849290610ad3908490610e5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b3991815260200190565b60405180910390a361088d565b600073ffffffffffffffffffffffffffffffffffffffff8316610b6b57506000610307565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604081208054849290610ba0908490610e5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c0691815260200190565b60405180910390a35092915050565b600060208083528351808285015260005b81811015610c4257858101830151858201604001528201610c26565b81811115610c54576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610cac57600080fd5b919050565b60008060408385031215610cc457600080fd5b610ccd83610c88565b946020939093013593505050565b600080600060608486031215610cf057600080fd5b610cf984610c88565b9250610d0760208501610c88565b9150604084013590509250925092565b600080600080600080600080610100898b031215610d3457600080fd5b610d3d89610c88565b9750610d4b60208a01610c88565b9650610d5960408a01610c88565b9550610d6760608a01610c88565b979a969950949760808101359660a0820135965060c0820135955060e0909101359350915050565b600060208284031215610da157600080fd5b61030782610c88565b60008060408385031215610dbd57600080fd5b610dc683610c88565b9150610dd460208401610c88565b90509250929050565b600181811c90821680610df157607f821691505b602082108103610e2a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115610e7257610e72610e30565b500190565b600082821015610e8957610e89610e30565b50039056fea164736f6c634300080f000a", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000056bc75e2d63100000", + "0x544d4f2940ad90cc7147a86952e118002f47e179e05bd1add1e9972168d958aa": "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x85de51d5625304e72107ba46e4bf731a09f455f609080a043a4ca2c0db099937": "0x0000000000000000000000000000000000000000000000056bc75e2d63100000" + } + }, + "0x00000000000000000000000000000000deadbeef": { + "balance": "0x0" + }, + "0x42cf1bbc38baaa3c4898ce8790e21ed2738c6a4a": { + "balance": "0x56bc75e2d63100000" + } + }, + "config": { + "chainId": 1337, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "muirGlacierBlock": 0, + "berlinBlock": 0, + "londonBlock": 0, + "arrowGlacierBlock": 0, + "grayGlacierBlock": 0, + "shanghaiTime": 0, + "cancunTime": 0, + "cel2Time": 0, + "gingerbreadBlock": 0, + "terminalTotalDifficulty": 0, + "terminalTotalDifficultyPassed": true + } + }, + "context": { + "number": "1", + "difficulty": "0", + "timestamp": "1724850836", + "gasLimit": "11511229", + "miner": "0x0000000000000000000000000000000000000000", + "baseFeePerGas": "875000000", + "feeCurrencyContext": { + "exchangeRates": { + "0x000000000000000000000000000000000000cE16": [2, 1] + }, + "intrinsicGasCosts": { + "0x000000000000000000000000000000000000cE16": 50000 + } + } + }, + "input": "0x7bf87e8205398080847735940083015f909400000000000000000000000000000000deadbeef0280c094000000000000000000000000000000000000ce1680a01d720daf50795cffe30b998633b4a45f2fd3b4deed459d4cb47386090ecaadcba0098844fc954eccaea1463a2322072acc58782dc31e95cc640d5fe141650cb039", + "result": { + "post": { + "0x000000000000000000000000000000000000ce16": { + "storage": { + "0x544d4f2940ad90cc7147a86952e118002f47e179e05bd1add1e9972168d958aa": "0x00000000000000000000000000000000000000000000000000007101351d0400", + "0x85de51d5625304e72107ba46e4bf731a09f455f609080a043a4ca2c0db099937": "0x0000000000000000000000000000000000000000000000056bc6ed2c2df2fc00" + } + }, + "0x00000000000000000000000000000000deadbeef": { + "balance": "0x2" + }, + "0x42cf1bbc38baaa3c4898ce8790e21ed2738c6a4a": { + "balance": "0x56bc75e2d630ffffe", + "nonce": 1 + } + }, + "pre": { + "0x000000000000000000000000000000000000ce16": { + "balance": "0x0", + "code": "0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806358cf96721161008c57806395d89b411161006657806395d89b41146101ca578063a457c2d7146101d2578063a9059cbb146101e5578063dd62ed3e146101f857600080fd5b806358cf96721461016c5780636a30b2531461018157806370a082311461019457600080fd5b806323b872dd116100bd57806323b872dd14610137578063313ce5671461014a578063395093511461015957600080fd5b806306fdde03146100e4578063095ea7b31461010257806318160ddd14610125575b600080fd5b6100ec61023e565b6040516100f99190610c15565b60405180910390f35b610115610110366004610cb1565b6102d0565b60405190151581526020016100f9565b6002545b6040519081526020016100f9565b610115610145366004610cdb565b6102e8565b604051601281526020016100f9565b610115610167366004610cb1565b61030e565b61017f61017a366004610cb1565b61035a565b005b61017f61018f366004610d17565b61041e565b6101296101a2366004610d8f565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6100ec610510565b6101156101e0366004610cb1565b61051f565b6101156101f3366004610cb1565b6105fb565b610129610206366004610daa565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b60606003805461024d90610ddd565b80601f016020809104026020016040519081016040528092919081815260200182805461027990610ddd565b80156102c65780601f1061029b576101008083540402835291602001916102c6565b820191906000526020600020905b8154815290600101906020018083116102a957829003601f168201915b5050505050905090565b6000336102de818585610609565b5060019392505050565b6000336102f68582856107bc565b610301858585610893565b60019150505b9392505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906102de9082908690610355908790610e5f565b610609565b33156103c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040812080548392906103fc908490610e77565b9250508190555080600260008282546104159190610e77565b90915550505050565b3315610486576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f6e6c7920564d2063616e2063616c6c0000000000000000000000000000000060448201526064016103be565b73ffffffffffffffffffffffffffffffffffffffff8816600090815260208190526040812080548692906104bb908490610e5f565b909155506104cc9050888683610b46565b6104d69085610e5f565b93506104e3888885610b46565b6104ed9085610e5f565b935083600260008282546105019190610e5f565b90915550505050505050505050565b60606004805461024d90610ddd565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156105e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016103be565b6105f08286868403610609565b506001949350505050565b6000336102de818585610893565b73ffffffffffffffffffffffffffffffffffffffff83166106ab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff821661074e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461088d5781811015610880576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016103be565b61088d8484848403610609565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff82166109d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610a8f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016103be565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220858503905591851681529081208054849290610ad3908490610e5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b3991815260200190565b60405180910390a361088d565b600073ffffffffffffffffffffffffffffffffffffffff8316610b6b57506000610307565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604081208054849290610ba0908490610e5f565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c0691815260200190565b60405180910390a35092915050565b600060208083528351808285015260005b81811015610c4257858101830151858201604001528201610c26565b81811115610c54576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610cac57600080fd5b919050565b60008060408385031215610cc457600080fd5b610ccd83610c88565b946020939093013593505050565b600080600060608486031215610cf057600080fd5b610cf984610c88565b9250610d0760208501610c88565b9150604084013590509250925092565b600080600080600080600080610100898b031215610d3457600080fd5b610d3d89610c88565b9750610d4b60208a01610c88565b9650610d5960408a01610c88565b9550610d6760608a01610c88565b979a969950949760808101359660a0820135965060c0820135955060e0909101359350915050565b600060208284031215610da157600080fd5b61030782610c88565b60008060408385031215610dbd57600080fd5b610dc683610c88565b9150610dd460208401610c88565b90509250929050565b600181811c90821680610df157607f821691505b602082108103610e2a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115610e7257610e72610e30565b500190565b600082821015610e8957610e89610e30565b50039056fea164736f6c634300080f000a", + "storage": { + "0x85de51d5625304e72107ba46e4bf731a09f455f609080a043a4ca2c0db099937": "0x0000000000000000000000000000000000000000000000056bc75e2d63100000" + } + }, + "0x00000000000000000000000000000000deadbeef": { + "balance": "0x0" + }, + "0x42cf1bbc38baaa3c4898ce8790e21ed2738c6a4a": { + "balance": "0x56bc75e2d63100000" + } + } + }, + "tracerConfig": { + "diffMode": true + } +} diff --git a/eth/tracers/internal/tracetest/util.go b/eth/tracers/internal/tracetest/util.go index a74a96f8a4..fd9483f263 100644 --- a/eth/tracers/internal/tracetest/util.go +++ b/eth/tracers/internal/tracetest/util.go @@ -32,6 +32,8 @@ type callContext struct { GasLimit math.HexOrDecimal64 `json:"gasLimit"` Miner common.Address `json:"miner"` BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas"` + // Celo specific + FeeCurrencyContext common.FeeCurrencyContext `json:"feeCurrencyContext"` } func (c *callContext) toBlockContext(genesis *core.Genesis) vm.BlockContext { @@ -43,6 +45,8 @@ func (c *callContext) toBlockContext(genesis *core.Genesis) vm.BlockContext { Time: uint64(c.Time), Difficulty: (*big.Int)(c.Difficulty), GasLimit: uint64(c.GasLimit), + // Celo specific + FeeCurrencyContext: c.FeeCurrencyContext, } if genesis.Config.IsLondon(context.BlockNumber) { context.BaseFee = (*big.Int)(c.BaseFee) diff --git a/eth/tracers/native/prestate.go b/eth/tracers/native/prestate.go index b353c06960..ebef3387df 100644 --- a/eth/tracers/native/prestate.go +++ b/eth/tracers/native/prestate.go @@ -93,6 +93,8 @@ func newPrestateTracer(ctx *tracers.Context, cfg json.RawMessage) (*tracers.Trac OnTxStart: t.OnTxStart, OnTxEnd: t.OnTxEnd, OnOpcode: t.OnOpcode, + // Celo + TraceDebitCredit: true, }, GetResult: t.GetResult, Stop: t.Stop, @@ -158,6 +160,9 @@ func (t *prestateTracer) OnTxStart(env *tracing.VMContext, tx *types.Transaction t.lookupAccount(from) t.lookupAccount(t.to) t.lookupAccount(env.Coinbase) + if tx.FeeCurrency() != nil { + t.lookupAccount(*tx.FeeCurrency()) + } } func (t *prestateTracer) OnTxEnd(receipt *types.Receipt, err error) {