mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
add storage clearing test case for eth_call
This commit is contained in:
parent
da3102e5ae
commit
6a2c96c490
1 changed files with 34 additions and 0 deletions
|
|
@ -434,12 +434,20 @@ func TestCall(t *testing.T) {
|
|||
// Initialize test accounts
|
||||
var (
|
||||
accounts = newAccounts(3)
|
||||
dad = common.HexToAddress("0x0000000000000000000000000000000000000dad")
|
||||
genesis = &core.Genesis{
|
||||
Config: params.TestChainConfig,
|
||||
Alloc: core.GenesisAlloc{
|
||||
accounts[0].addr: {Balance: big.NewInt(params.Ether)},
|
||||
accounts[1].addr: {Balance: big.NewInt(params.Ether)},
|
||||
accounts[2].addr: {Balance: big.NewInt(params.Ether)},
|
||||
dad: {
|
||||
Balance: big.NewInt(params.Ether),
|
||||
Nonce: 1,
|
||||
Storage: map[common.Hash]common.Hash{
|
||||
common.Hash{}: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001"),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
genBlocks = 10
|
||||
|
|
@ -572,6 +580,32 @@ func TestCall(t *testing.T) {
|
|||
blockOverrides: BlockOverrides{Number: (*hexutil.Big)(big.NewInt(11))},
|
||||
want: "0x000000000000000000000000000000000000000000000000000000000000000b",
|
||||
},
|
||||
// Clear storage trie
|
||||
{
|
||||
blockNumber: rpc.LatestBlockNumber,
|
||||
call: TransactionArgs{
|
||||
From: &accounts[1].addr,
|
||||
// Yul:
|
||||
// object "Test" {
|
||||
// code {
|
||||
// let dad := 0x0000000000000000000000000000000000000dad
|
||||
// if eq(balance(dad), 0) {
|
||||
// revert(0, 0)
|
||||
// }
|
||||
// let slot := sload(0)
|
||||
// mstore(0, slot)
|
||||
// return(0, 32)
|
||||
// }
|
||||
// }
|
||||
Input: hex2Bytes("610dad6000813103600f57600080fd5b6000548060005260206000f3"),
|
||||
},
|
||||
overrides: StateOverride{
|
||||
dad: OverrideAccount{
|
||||
State: &map[common.Hash]common.Hash{},
|
||||
},
|
||||
},
|
||||
want: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
},
|
||||
}
|
||||
for i, tc := range testSuite {
|
||||
result, err := api.Call(context.Background(), tc.call, rpc.BlockNumberOrHash{BlockNumber: &tc.blockNumber}, &tc.overrides, &tc.blockOverrides)
|
||||
|
|
|
|||
Loading…
Reference in a new issue