Skip to content

Commit

Permalink
Add call trace test for transfer precompile
Browse files Browse the repository at this point in the history
The precompile must show up as a CALL in call tracing.

This test exercises both the call tracer and the transfer precompile. It
is the first test that checks for the gas cost and return value of the
precompile.

See #69
  • Loading branch information
karlb committed Jul 17, 2024
1 parent b9d3e28 commit dd7c849
Showing 1 changed file with 83 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"genesis": {
"baseFeePerGas": "875000000",
"difficulty": "0",
"extraData": "0xd8820100846765746888676f312e32312e368664617277696e",
"gasLimit": "11511229",
"hash": "0x5d605116d6623291269abed0d1f35e1e3bb04dd44e2039007e3111ca0cef1624",
"miner": "0x0000000000000000000000000000000000000000",
"mixHash": "0x5e9f72a9c84605a6ac33f5b5c603a7ce89c63be3f9b9de3072beb167f0062131",
"nonce": "0x0000000000000000",
"number": "1",
"stateRoot": "0x72c0d1653648a020479291917e2fedce749162b54a6d33962481f58815d2537f",
"timestamp": "1721214738",
"totalDifficulty": "1",
"withdrawals": [],
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"alloc": {
"0x0000000000000000000000000000000000000000": {
"balance": "0x0"
},
"0x00000000000000000000000000000000000000fd": {
"balance": "0x0"
},
"0x42cf1bbc38baaa3c4898ce8790e21ed2738c6a4a": {
"balance": "0x56bc74344293a6d9c",
"nonce": "1"
},
"0x471ece3750da237f93b8e339c536989b8978a438": {
"balance": "0x0",
"code": "0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c80637b1039991161011a578063a91ee0dc116100ad578063d4d83cfb1161007c578063d4d83cfb14610565578063db2b4d101461056d578063dd62ed3e14610593578063e1d6aceb146105c1578063f2fde38b14610646576101fb565b8063a91ee0dc146104f4578063b921e1631461051a578063c4d66de814610537578063c80ec5221461055d576101fb565b80639358928b116100e95780639358928b1461048c57806395d89b4114610494578063a457c2d71461049c578063a9059cbb146104c8576101fb565b80637b1039991461043b57806387f8ab261461045f5780638da5cb5b1461047c5780638f32d59b14610484576101fb565b8063395093511161019257806354255be01161016157806354255be0146103d757806370a0823114610405578063715018a61461042b57806376348f7114610433576101fb565b8063395093511461035a5780633a70a5ca1461038657806340c10f191461038e57806342966c68146103ba576101fb565b806318160ddd116101ce57806318160ddd146102e457806323b872dd146102fe578063265126bd14610334578063313ce5671461033c576101fb565b80630562b9f71461020057806306fdde031461021f578063095ea7b31461029c578063158ef93e146102dc575b600080fd5b61021d6004803603602081101561021657600080fd5b503561066c565b005b61022761070d565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610261578181015183820152602001610249565b50505050905090810190601f16801561028e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102c8600480360360408110156102b257600080fd5b506001600160a01b038135169060200135610739565b604080519115158252519081900360200190f35b6102c86107fe565b6102ec610807565b60408051918252519081900360200190f35b6102c86004803603606081101561031457600080fd5b506001600160a01b03813581169160208101359091169060400135610846565b6102ec610b17565b610344610b29565b6040805160ff9092168252519081900360200190f35b6102c86004803603604081101561037057600080fd5b506001600160a01b038135169060200135610b2e565b6102ec610c2a565b6102c8600480360360408110156103a457600080fd5b506001600160a01b038135169060200135610c8e565b6102c8600480360360208110156103d057600080fd5b5035610eb6565b6103df610ec4565b604080519485526020850193909352838301919091526060830152519081900360800190f35b6102ec6004803603602081101561041b57600080fd5b50356001600160a01b0316610ed1565b61021d610ede565b6102c8610f74565b610443610f88565b604080516001600160a01b039092168252519081900360200190f35b61021d6004803603602081101561047557600080fd5b5035610f97565b610443611033565b6102c8611047565b6102ec611070565b61022761109e565b6102c8600480360360408110156104b257600080fd5b506001600160a01b0381351690602001356110bc565b6102c8600480360360408110156104de57600080fd5b506001600160a01b0381351690602001356110f1565b61021d6004803603602081101561050a57600080fd5b50356001600160a01b0316611104565b61021d6004803603602081101561053057600080fd5b50356111f0565b61021d6004803603602081101561054d57600080fd5b50356001600160a01b0316611257565b6102ec6112d4565b6104436112da565b61021d6004803603602081101561058357600080fd5b50356001600160a01b03166112e9565b6102ec600480360360408110156105a957600080fd5b506001600160a01b03813581169160200135166113e3565b6102c8600480360360608110156105d757600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561060757600080fd5b82018360208201111561061957600080fd5b8035906020019184600183028401116401000000008311171561063b57600080fd5b50909250905061140e565b61021d6004803603602081101561065c57600080fd5b50356001600160a01b0316611486565b610674610f74565b6106af5760405162461bcd60e51b81526004018080602001828103825260238152602001806119e76023913960400191505060405180910390fd5b6016602160991b0133146106f45760405162461bcd60e51b81526004018080602001828103825260228152602001806119076022913960400191505060405180910390fd5b600454610707908263ffffffff6114d616565b60045550565b60408051808201909152601181527010d95b1bc81b985d1a5d9948185cdcd95d607a1b60208201525b90565b60006001600160a01b038316610796576040805162461bcd60e51b815260206004820152601a60248201527f63616e6e6f742073657420616c6c6f77616e636520666f722030000000000000604482015290519081900360640190fd5b3360008181526003602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60005460ff1681565b6000610811610f74565b1561083d57600454610836906b033b2e3c9fd0803ce80000009063ffffffff61153016565b9050610736565b50600254610736565b60006001600160a01b03831661088d5760405162461bcd60e51b815260040180806020018281038252602a815260200180611a0a602a913960400191505060405180910390fd5b61089684610ed1565b8211156108d45760405162461bcd60e51b81526004018080602001828103825260298152602001806119be6029913960400191505060405180910390fd5b6001600160a01b03841660009081526003602090815260408083203384529091529020548211156109365760405162461bcd60e51b8152600401808060200182810382526036815260200180611a346036913960400191505060405180910390fd5b600060fd815a9087878760405160200180846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b0316815260200182815260200193505050506040516020818303038152906040526040518082805190602001908083835b602083106109c05780518252601f1990920191602091820191016109a1565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381858888f193505050503d8060008114610a23576040519150601f19603f3d011682016040523d82523d6000602084013e610a28565b606091505b50508091505080610a77576040805162461bcd60e51b815260206004820152601460248201527310d15313c81d1c985b9cd9995c8819985a5b195960621b604482015290519081900360640190fd5b6001600160a01b0385166000908152600360209081526040808320338452909152902054610aab908463ffffffff61153016565b6001600160a01b03808716600081815260036020908152604080832033845282529182902094909455805187815290519288169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3506001949350505050565b6000610b2461dead610ed1565b905090565b601290565b60006001600160a01b038316610b8b576040805162461bcd60e51b815260206004820152601a60248201527f63616e6e6f742073657420616c6c6f77616e636520666f722030000000000000604482015290519081900360640190fd5b3360009081526003602090815260408083206001600160a01b038716845290915281205490610bc0828563ffffffff6114d616565b3360008181526003602090815260408083206001600160a01b038b16808552908352928190208590558051858152905194955091937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3506001949350505050565b6000610c34610f74565b610c6f5760405162461bcd60e51b81526004018080602001828103825260238152602001806119e76023913960400191505060405180910390fd5b506005546001600160a01b0316316b033b2e3c9fd0803ce80000000390565b6000610c98611572565b3315610cde576040805162461bcd60e51b815260206004820152601060248201526f13db9b1e4815934818d85b8818d85b1b60821b604482015290519081900360640190fd5b81610ceb575060016107f8565b6001600160a01b038316610d305760405162461bcd60e51b81526004018080602001828103825260268152602001806119296026913960400191505060405180910390fd5b600254610d43908363ffffffff6114d616565b600255600060fd815a6040805160006020808301919091526001600160a01b038a168284015260608083018a905283518084039091018152608090920192839052815193949391929182918401908083835b60208310610db45780518252601f199092019160209182019101610d95565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381858888f193505050503d8060008114610e17576040519150601f19603f3d011682016040523d82523d6000602084013e610e1c565b606091505b50508091505080610e6b576040805162461bcd60e51b815260206004820152601460248201527310d15313c81d1c985b9cd9995c8819985a5b195960621b604482015290519081900360640190fd5b6040805184815290516001600160a01b038616916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35060019392505050565b60006107f861dead836115b8565b6001806003600090919293565b6001600160a01b03163190565b610ee6611047565b610f25576040805162461bcd60e51b8152602060048201819052602482015260008051602061199e833981519152604482015290519081900360640190fd5b600080546040516101009091046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360008054610100600160a81b0319169055565b63ffffffff6018602160991b013b16151590565b6001546001600160a01b031681565b3315610fdd576040805162461bcd60e51b815260206004820152601060248201526f13db9b1e4815934818d85b8818d85b1b60821b604482015290519081900360640190fd5b610fe5610f74565b6110205760405162461bcd60e51b81526004018080602001828103825260238152602001806119e76023913960400191505060405180910390fd5b600454610707908263ffffffff61153016565b60005461010090046001600160a01b031690565b6000805461010090046001600160a01b031661106161176f565b6001600160a01b031614905090565b6000610b2461107f6000610ed1565b61109261108a610b17565b611092610807565b9063ffffffff61153016565b60408051808201909152600481526343454c4f60e01b602082015290565b3360009081526003602090815260408083206001600160a01b038616845290915281205481610bc0828563ffffffff61153016565b60006110fd8383611773565b9392505050565b61110c611047565b61114b576040805162461bcd60e51b8152602060048201819052602482015260008051602061199e833981519152604482015290519081900360640190fd5b6001600160a01b0381166111a6576040805162461bcd60e51b815260206004820181905260248201527f43616e6e6f7420726567697374657220746865206e756c6c2061646472657373604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040517f27fe5f0c1c3b1ed427cc63d0f05759ffdecf9aec9e18d31ef366fc8a6cb5dc3b90600090a250565b6111f8611572565b331561123e576040805162461bcd60e51b815260206004820152601060248201526f13db9b1e4815934818d85b8818d85b1b60821b604482015290519081900360640190fd5b600254611251908263ffffffff6114d616565b60025550565b60005460ff16156112af576040805162461bcd60e51b815260206004820152601c60248201527f636f6e747261637420616c726561647920696e697469616c697a656400000000604482015290519081900360640190fd5b6000805460ff191660011781556002556112c8336117c4565b6112d181611104565b50565b60045481565b6005546001600160a01b031681565b6112f1611047565b611330576040805162461bcd60e51b8152602060048201819052602482015260008051602061199e833981519152604482015290519081900360640190fd5b6001600160a01b03811615158061135557506005546001600160a01b03828116911614155b611399576040805162461bcd60e51b815260206004820152601060248201526f24b73b30b634b21030b2323932b9b99760811b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0383169081179091556040517f4b0e16c81bce2248d2d60ed469d2fe74152253bde95ba850f22ae056723980a690600090a250565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b60008061141b8686611773565b90507fe5d4e30fb8364e57bc4d662a07d0cf36f4c34552004c4c3624620a2c1d1c03dc848460405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a195945050505050565b61148e611047565b6114cd576040805162461bcd60e51b8152602060048201819052602482015260008051602061199e833981519152604482015290519081900360640190fd5b6112d1816117c4565b6000828201838110156110fd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006110fd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061186f565b61157a610f74565b156115b65760405162461bcd60e51b81526004018080602001828103825260298152602001806119756029913960400191505060405180910390fd5b565b60006115c333610ed1565b8211156116015760405162461bcd60e51b81526004018080602001828103825260298152602001806119be6029913960400191505060405180910390fd5b600060fd815a60408051336020808301919091526001600160a01b038a168284015260608083018a905283518084039091018152608090920192839052815193949391929182918401908083835b6020831061166e5780518252601f19909201916020918201910161164f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381858888f193505050503d80600081146116d1576040519150601f19603f3d011682016040523d82523d6000602084013e6116d6565b606091505b50508091505080611725576040805162461bcd60e51b815260206004820152601460248201527310d15313c81d1c985b9cd9995c8819985a5b195960621b604482015290519081900360640190fd5b6040805184815290516001600160a01b0386169133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35060019392505050565b3390565b60006001600160a01b0383166117ba5760405162461bcd60e51b815260040180806020018281038252602a815260200180611a0a602a913960400191505060405180910390fd5b6110fd83836115b8565b6001600160a01b0381166118095760405162461bcd60e51b815260040180806020018281038252602681526020018061194f6026913960400191505060405180910390fd5b600080546040516001600160a01b038085169361010090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600081848411156118fe5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156118c35781810151838201526020016118ab565b50505050905090810190601f1680156118f05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505090039056fe4f6e6c79204c32546f4c314d6573736167655061737365722063616e2063616c6c2e6d696e7420617474656d7074656420746f2072657365727665642061646472657373203078304f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737354686973206d6574686f64206973206e6f206c6f6e67657220737570706f7274656420696e204c322e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65727472616e736665722076616c75652065786365656465642062616c616e6365206f662073656e64657254686973206d6574686f64206973206e6f7420737570706f7274656420696e204c312e7472616e7366657220617474656d7074656420746f2072657365727665642061646472657373203078307472616e736665722076616c75652065786365656465642073656e646572277320616c6c6f77616e636520666f72207370656e646572a265627a7a72315820883737fc20fdb370fa6d2083191051192e78e14b9c9ed5974e58cd42d97124f264736f6c63430005110032"
}
},
"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": {
"number": "2",
"difficulty": "0",
"timestamp": "1721214739",
"gasLimit": "11522469",
"miner": "0x0000000000000000000000000000000000000000"
},
"input": "0x02f8ad820539018084684ee18082857e94471ece3750da237f93b8e339c536989b8978a43880b844a9059cbb000000000000000000000000000000000000000000000000000000000000dead0000000000000000000000000000000000000000000000000000000000000064c080a08e63474fbf5acffb6848dca77cb51ab6341ee34e2a8dd3e13af9bb99363eb068a0439aee6906e998ba44680f29c309bd82621f7eae4591e9439ec2636b0ad933c6",
"result": {
"from": "0x42cf1bbc38baaa3c4898ce8790e21ed2738c6a4a",
"gas": "0x857e",
"gasUsed": "0x83c9",
"to": "0x471ece3750da237f93b8e339c536989b8978a438",
"input": "0xa9059cbb000000000000000000000000000000000000000000000000000000000000dead0000000000000000000000000000000000000000000000000000000000000064",
"output": "0x0000000000000000000000000000000000000000000000000000000000000001",
"calls": [
{
"from": "0x471ece3750da237f93b8e339c536989b8978a438",
"gas": "0x2c16",
"gasUsed": "0x2328",
"to": "0x00000000000000000000000000000000000000fd",
"input": "0x00000000000000000000000042cf1bbc38baaa3c4898ce8790e21ed2738c6a4a000000000000000000000000000000000000000000000000000000000000dead0000000000000000000000000000000000000000000000000000000000000064",
"value": "0x0",
"type": "CALL"
}
],
"value": "0x0",
"type": "CALL"
}
}

0 comments on commit dd7c849

Please sign in to comment.