fix test cases

This commit is contained in:
maskpp 2024-09-13 22:29:31 +08:00
parent bf5d9ff88c
commit d584160a70

View file

@ -94,19 +94,19 @@ func TestStructLogMarshalingOmitEmpty(t *testing.T) {
`{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0,"error":"this failed"}`}, `{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0,"error":"this failed"}`},
{"with mem", &StructLog{Memory: make([]byte, 2), MemorySize: 2}, {"with mem", &StructLog{Memory: make([]byte, 2), MemorySize: 2},
`{"pc":0,"op":0,"gas":"0x0","gasCost":"0x0","memory":"0x0000","memSize":2,"stack":null,"depth":0,"refund":0,"opName":"STOP"}`, `{"pc":0,"op":0,"gas":"0x0","gasCost":"0x0","memory":"0x0000","memSize":2,"stack":null,"depth":0,"refund":0,"opName":"STOP"}`,
`{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0,"memory":[]}`}, `{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0}`},
{"with 0-size mem", &StructLog{Memory: make([]byte, 0)}, {"with 0-size mem", &StructLog{Memory: make([]byte, 0)},
`{"pc":0,"op":0,"gas":"0x0","gasCost":"0x0","memSize":0,"stack":null,"depth":0,"refund":0,"opName":"STOP"}`, `{"pc":0,"op":0,"gas":"0x0","gasCost":"0x0","memSize":0,"stack":null,"depth":0,"refund":0,"opName":"STOP"}`,
`{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0,"memory":[]}`}, `{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0}`},
{"with stack mem", &StructLog{Memory: make([]byte, 0), Stack: make([]uint256.Int, 0)}, {"with stack mem", &StructLog{Memory: make([]byte, 0), Stack: make([]uint256.Int, 0)},
`{"pc":0,"op":0,"gas":"0x0","gasCost":"0x0","memSize":0,"stack":[],"depth":0,"refund":0,"opName":"STOP"}`, `{"pc":0,"op":0,"gas":"0x0","gasCost":"0x0","memSize":0,"stack":[],"depth":0,"refund":0,"opName":"STOP"}`,
`{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0,"stack":[],"memory":[]}`}, `{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0}`},
{"with empty storage", &StructLog{Memory: make([]byte, 32), Storage: make(map[common.Hash]common.Hash)}, {"with empty storage", &StructLog{Memory: make([]byte, 32), Storage: make(map[common.Hash]common.Hash)},
`{"pc":0,"op":0,"gas":"0x0","gasCost":"0x0","memory":"0x0000000000000000000000000000000000000000000000000000000000000000","memSize":0,"stack":null,"depth":0,"refund":0,"opName":"STOP"}`, `{"pc":0,"op":0,"gas":"0x0","gasCost":"0x0","memory":"0x0000000000000000000000000000000000000000000000000000000000000000","memSize":0,"stack":null,"depth":0,"refund":0,"opName":"STOP"}`,
`{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0,"memory":["0000000000000000000000000000000000000000000000000000000000000000"],"storage":{}}`}, `{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0,"memory":["0x0000000000000000000000000000000000000000000000000000000000000000"]}`},
{"with storage", &StructLog{Storage: map[common.Hash]common.Hash{common.HexToHash("0x1234"): common.HexToHash("0xaabb")}}, {"with storage", &StructLog{Storage: map[common.Hash]common.Hash{common.HexToHash("0x1234"): common.HexToHash("0xaabb")}},
`{"pc":0,"op":0,"gas":"0x0","gasCost":"0x0","memSize":0,"stack":null,"depth":0,"refund":0,"opName":"STOP"}`, `{"pc":0,"op":0,"gas":"0x0","gasCost":"0x0","memSize":0,"stack":null,"depth":0,"refund":0,"opName":"STOP"}`,
`{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0,"storage":{"0000000000000000000000000000000000000000000000000000000000001234":"000000000000000000000000000000000000000000000000000000000000aabb"}}`}, `{"pc":0,"op":"STOP","gas":0,"gasCost":0,"depth":0,"storage":{"0000000000000000000000000000000000000000000000000000000000001234":"0x000000000000000000000000000000000000000000000000000000000000aabb"}}`},
} }
for _, tt := range tests { for _, tt := range tests {