Added unit test to check different keccak256 on transaction

This commit is contained in:
Matthieu Vachon 2024-05-01 19:26:40 -04:00
parent bc4162e99f
commit b567b08329
3 changed files with 405 additions and 0 deletions

View file

@ -72,6 +72,7 @@ func TestFirehoseChain(t *testing.T) {
func TestFirehosePrestate(t *testing.T) {
testFolders := []string{
"./testdata/TestFirehosePrestate/keccak256_too_few_memory_bytes_get_padded",
"./testdata/TestFirehosePrestate/keccak256_wrong_diff",
}
for _, folder := range testFolders {

View file

@ -0,0 +1,232 @@
{
"hash": "IPNVZgyygE0HzwAtWVr0ghv9lxf+N0C45NHNCWv5Oyg=",
"number": "3733424",
"size": "673",
"header": {
"parentHash": "f7pk/8VV6aRiIPz5tngJXJEAkJokLyPKgV4W7ujmnP8=",
"uncleHash": "HcxN6N7HXXqrhbVntszUGtMSRRuUinQT8KFC/UDUk0c=",
"coinbase": "AAAAaRaoe4IzP0JFBGYjsjeUxlw=",
"stateRoot": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"transactionsRoot": "qGt8M+EeGIjvA3CmiVt41zk8Ap6NokQ0xxIVjv/5oCY=",
"receiptRoot": "VugfFxvMVab/g0XmksD4bltI4BuZbK3AAWIvteNjtCE=",
"logsBloom": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"difficulty": {
"bytes": "AA=="
},
"totalDifficulty": {
"bytes": "PGVtIwKasA=="
},
"number": "3733424",
"gasLimit": "30000000",
"timestamp": "2023-06-20T21:02:36Z",
"mixHash": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"hash": "IPNVZgyygE0HzwAtWVr0ghv9lxf+N0C45NHNCWv5Oyg=",
"baseFeePerGas": {
"bytes": "Cqc="
},
"parentBeaconRoot": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
},
"transactionTraces": [
{
"to": "VJoy1Xw102gR3mpGJZaXDIPqmyM=",
"nonce": "27",
"gasPrice": {
"bytes": "C0U="
},
"gasLimit": "200000",
"input": "ASy2ctjBKKzAgl3Lr2HkOik6WlJ2",
"v": "Gw==",
"r": "/n8N4OD9KzN9vfG0/fl6FERX+FAklxcusTRKtuJaaAY=",
"s": "C4wVifsU3LuR1ToPisse4e3pAciXSe4Vv+hsa+7HBS4=",
"gasUsed": "50990",
"hash": "E2euJ14Brg/hLbsRFBismbxzpqbwfKtvvBhA1ZB2cD8=",
"from": "6z09YW8+Q+ntNh7dLQ5kTRjRebc=",
"beginOrdinal": "1",
"endOrdinal": "22",
"status": "SUCCEEDED",
"receipt": {
"cumulativeGasUsed": "50990",
"logsBloom": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAIAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"logs": [
{
"address": "LLZy2MEorMCCXcuvYeQ6KTpaUnY=",
"topics": [
"3fJSrRviyJtpwrBo/DeNqpUrp/FjxKEWKPVaTfUjs+8=",
"AAAAAAAAAAAAAAAAVJoy1Xw102gR3mpGJZaXDIPqmyM=",
"AAAAAAAAAAAAAAAA6z09YW8+Q+ntNh7dLQ5kTRjRebc="
],
"data": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJY=",
"ordinal": "16"
}
]
},
"calls": [
{
"index": 1,
"callType": "CALL",
"caller": "6z09YW8+Q+ntNh7dLQ5kTRjRebc=",
"address": "VJoy1Xw102gR3mpGJZaXDIPqmyM=",
"gasLimit": "178664",
"gasConsumed": "34454",
"input": "ASy2ctjBKKzAgl3Lr2HkOik6WlJ2",
"executedCode": true,
"balanceChanges": [
{
"address": "6z09YW8+Q+ntNh7dLQ5kTRjRebc=",
"oldValue": {
"bytes": "B5sluMJIrb4="
},
"newValue": {
"bytes": "B5sluJ/kW34="
},
"reason": "REASON_GAS_BUY",
"ordinal": "2"
},
{
"address": "6z09YW8+Q+ntNh7dLQ5kTRjRebc=",
"oldValue": {
"bytes": "B5sluJ/kW34="
},
"newValue": {
"bytes": "B5sluLmEBFg="
},
"reason": "REASON_GAS_REFUND",
"ordinal": "20"
},
{
"address": "AAAAaRaoe4IzP0JFBGYjsjeUxlw=",
"oldValue": {
"bytes": "Aecpt9WGjDPX8TY="
},
"newValue": {
"bytes": "Aecpt9WGjDRS35o="
},
"reason": "REASON_REWARD_TRANSACTION_FEE",
"ordinal": "21"
}
],
"nonceChanges": [
{
"address": "6z09YW8+Q+ntNh7dLQ5kTRjRebc=",
"oldValue": "27",
"newValue": "28",
"ordinal": "4"
}
],
"gasChanges": [
{
"oldValue": "200000",
"newValue": "178664",
"reason": "REASON_INTRINSIC_GAS",
"ordinal": "3"
},
{
"oldValue": "178437",
"newValue": "175937",
"reason": "REASON_STATE_COLD_ACCESS",
"ordinal": "6"
},
{
"oldValue": "178537",
"newValue": "2748",
"reason": "REASON_CALL",
"ordinal": "7"
},
{
"oldValue": "2748",
"newValue": "173596",
"reason": "REASON_REFUND_AFTER_EXECUTION",
"ordinal": "10"
},
{
"oldValue": "171474",
"newValue": "2677",
"reason": "REASON_CALL",
"ordinal": "11"
},
{
"oldValue": "2677",
"newValue": "144210",
"reason": "REASON_REFUND_AFTER_EXECUTION",
"ordinal": "18"
}
],
"endOrdinal": "19"
},
{
"index": 2,
"parentIndex": 1,
"depth": 1,
"callType": "CALL",
"caller": "VJoy1Xw102gR3mpGJZaXDIPqmyM=",
"address": "LLZy2MEorMCCXcuvYeQ6KTpaUnY=",
"gasLimit": "173186",
"gasConsumed": "2338",
"returnData": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJY=",
"input": "cKCCMQAAAAAAAAAAAAAAAFSaMtV8NdNoEd5qRiWWlwyD6psj",
"executedCode": true,
"keccakPreimages": {
"dfecc5e296fad583cf3240a878ef92ffb0955f284f0216e1670f60c2279e53ba": "000000000000000000000000549a32d57c35d36811de6a462596970c83ea9b230000000000000000000000000000000000000000000000000000000000000000"
},
"beginOrdinal": "8",
"endOrdinal": "9"
},
{
"index": 3,
"parentIndex": 1,
"depth": 1,
"callType": "CALL",
"caller": "VJoy1Xw102gR3mpGJZaXDIPqmyM=",
"address": "LLZy2MEorMCCXcuvYeQ6KTpaUnY=",
"gasLimit": "168697",
"gasConsumed": "27164",
"input": "qQWcuwAAAAAAAAAAAAAAAOs9PWFvPkPp7TYe3S0OZE0Y0Xm3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJY=",
"executedCode": true,
"keccakPreimages": {
"bb65ff7a03b11b79143b011da0de7c67f6d9bb8f57df2381d88d503cdb07b0b6": "000000000000000000000000eb3d3d616f3e43e9ed361edd2d0e644d18d179b70000000000000000000000000000000000000000000000000000000000000000",
"dfecc5e296fad583cf3240a878ef92ffb0955f284f0216e1670f60c2279e53ba": "000000000000000000000000549a32d57c35d36811de6a462596970c83ea9b230000000000000000000000000000000000000000000000000000000000000000"
},
"storageChanges": [
{
"address": "LLZy2MEorMCCXcuvYeQ6KTpaUnY=",
"key": "u2X/egOxG3kUOwEdoN58Z/bZu49X3yOB2I1QPNsHsLY=",
"oldValue": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"newValue": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJY=",
"ordinal": "13"
},
{
"address": "LLZy2MEorMCCXcuvYeQ6KTpaUnY=",
"key": "3+zF4pb61YPPMkCoeO+S/7CVXyhPAhbhZw9gwieeU7o=",
"oldValue": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJY=",
"newValue": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"ordinal": "14"
}
],
"logs": [
{
"address": "LLZy2MEorMCCXcuvYeQ6KTpaUnY=",
"topics": [
"3fJSrRviyJtpwrBo/DeNqpUrp/FjxKEWKPVaTfUjs+8=",
"AAAAAAAAAAAAAAAAVJoy1Xw102gR3mpGJZaXDIPqmyM=",
"AAAAAAAAAAAAAAAA6z09YW8+Q+ntNh7dLQ5kTRjRebc="
],
"data": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJY=",
"ordinal": "16"
}
],
"gasChanges": [
{
"oldValue": "143289",
"newValue": "141533",
"reason": "REASON_EVENT_LOG",
"ordinal": "15"
}
],
"beginOrdinal": "12",
"endOrdinal": "17"
}
]
}
],
"ver": 3
}

View file

@ -0,0 +1,172 @@
{
"genesis": {
"baseFeePerGas": "2935",
"difficulty": "0",
"extraData": "0x6769756c696f207761732068657265",
"gasLimit": "30000000",
"hash": "0xb606f9eea389beb86ad7b90f716ab8b2145b09806e3cae6d866cc406176ff953",
"miner": "0x008b3b2f992c0e14edaa6e2c662bec549caa8df1",
"mixHash": "0x0fbfbdea994592940443188d440d955b4a24241fd297fe6dc51842ed481c46da",
"nonce": "0x0000000000000000",
"number": "3733423",
"stateRoot": "0x6ade0dc69a4852c342f189cf0f98fd0c4eb3357ce1fcb19e039b95d4780148dc",
"timestamp": "1687294944",
"totalDifficulty": "17000018015853232",
"withdrawals": [
{
"index": "0xb53221",
"validatorIndex": "0x3d4",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
},
{
"index": "0xb53222",
"validatorIndex": "0x3d5",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
},
{
"index": "0xb53223",
"validatorIndex": "0x3d6",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
},
{
"index": "0xb53224",
"validatorIndex": "0x3d7",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2fc09"
},
{
"index": "0xb53225",
"validatorIndex": "0x3d8",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
},
{
"index": "0xb53226",
"validatorIndex": "0x3d9",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x247dd"
},
{
"index": "0xb53227",
"validatorIndex": "0x3da",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
},
{
"index": "0xb53228",
"validatorIndex": "0x3db",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2fc09"
},
{
"index": "0xb53229",
"validatorIndex": "0x3dc",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
},
{
"index": "0xb5322a",
"validatorIndex": "0x3dd",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
},
{
"index": "0xb5322b",
"validatorIndex": "0x3de",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
},
{
"index": "0xb5322c",
"validatorIndex": "0x3df",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
},
{
"index": "0xb5322d",
"validatorIndex": "0x3e0",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
},
{
"index": "0xb5322e",
"validatorIndex": "0x3e1",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
},
{
"index": "0xb5322f",
"validatorIndex": "0x3e2",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x238d9"
},
{
"index": "0xb53230",
"validatorIndex": "0x3e3",
"address": "0xe276bc378a527a8792b353cdca5b5e53263dfb9e",
"amount": "0x2ed05"
}
],
"withdrawalsRoot": "0x3cb455e987780d127dae999ae7a1666b3314a2207953019902fd7f8f30a3c367",
"alloc": {
"0x0000006916a87b82333f4245046623b23794c65c": {
"balance": "0x1e729b7d5868c33d7f136",
"nonce": "5"
},
"0x2cb672d8c128acc0825dcbaf61e43a293a5a5276": {
"balance": "0x0",
"code": "0x60003560e01c8063095ea7b31461005c57806340c10f1914610062578063a9059cbb146100d957806323b872dd1461015657806318160ddd1461015857806370a08231146101695763dd62ed3e1461018957346101895760006000f35b60006000f35b60043573ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206000602435856000526040600020805482018083119155600254820180831190600255600154331415171761018957600052a360006000f35b60043573ffffffffffffffffffffffffffffffffffffffff16337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206000602435856000526040600020805482018083119155813360005260406000208054828103809111915590503417176101505760006000fd5b600052a3005b005b346101895760025460005260206000f35b346101895760043560005260406000205460005260206000f35b60006000f35b60006000fd",
"nonce": "1",
"storage": {
"0xbb65ff7a03b11b79143b011da0de7c67f6d9bb8f57df2381d88d503cdb07b0b6": "0x0000000000000000000000000000000000000000000000000000000000000000",
"0xdfecc5e296fad583cf3240a878ef92ffb0955f284f0216e1670f60c2279e53ba": "0x0000000000000000000000000000000000000000000000000000000000000096"
}
},
"0x549a32d57c35d36811de6a462596970c83ea9b23": {
"balance": "0x0",
"code": "0x60003560f81c806000146100985780600114610022576002146100965760006000fd5b6000600060446000600060013560601c60206024602460006000857f70a0823100000000000000000000000000000000000000000000000000000000600052306004525af1507fa9059cbb000000000000000000000000000000000000000000000000000000006000526000546004525af1005b005b00",
"nonce": "1",
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000eb3d3d616f3e43e9ed361edd2d0e644d18d179b7"
}
},
"0xeb3d3d616f3e43e9ed361edd2d0e644d18d179b7": {
"balance": "0x79b25b8c248adbe",
"nonce": "27"
}
},
"config": {
"chainId": 11155111,
"homesteadBlock": 0,
"daoForkSupport": true,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"mergeNetsplitBlock": 1735371,
"shanghaiTime": 1677557088,
"cancunTime": 1706655072,
"terminalTotalDifficulty": 17000000000000000,
"terminalTotalDifficultyPassed": true,
"ethash": {}
}
},
"context": {
"number": "3733424",
"difficulty": "0",
"timestamp": "1687294956",
"gasLimit": "30000000",
"miner": "0x0000006916a87b82333f4245046623b23794c65c",
"baseFeePerGas": "2727"
},
"input": "0xf8771b820b4583030d4094549a32d57c35d36811de6a462596970c83ea9b238095012cb672d8c128acc0825dcbaf61e43a293a5a52761ba0fe7f0de0e0fd2b337dbdf1b4fdf97a144457f8502497172eb1344ab6e25a6806a00b8c1589fb14dcbb91d53a0f8acb1ee1ede901c89749ee15bfe86c6beec7052e"
}