Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix t8n tool #1354

Merged
merged 6 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update t8n tool testdata
  • Loading branch information
jangko committed Dec 8, 2022
commit a57471197fe4e311c0a63ebac88caa3dc6ec2dbb
63 changes: 63 additions & 0 deletions tools/t8n/t8n_test.nim
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,69 @@ const
output: T8nOutput(alloc: true, result: true),
expOut: "exp.json",
),
TestSpec(
name : "0-touch reward on pre EIP150 networks -1(txs.rlp)",
base : "testdata/00-501",
input : t8nInput(
"alloc.json", "txs.rlp", "env.json", "EIP150", "-1"
),
output: T8nOutput(alloc: true, result: true),
expOut: "exp.json",
),
TestSpec(
name : "0-touch reward on pre EIP150 networks(txs.rlp)",
base : "testdata/00-502",
input : t8nInput(
"alloc.json", "txs.rlp", "env.json", "EIP150", ""
),
output: T8nOutput(alloc: true, result: true),
expOut: "exp.json",
),
TestSpec(
name : "0-touch reward on pre EIP150 networks(txs.json)",
base : "testdata/00-502",
input : t8nInput(
"alloc.json", "txs.json", "env.json", "EIP150", ""
),
output: T8nOutput(alloc: true, result: true),
expOut: "exp.json",
),
TestSpec(
name : "calculate basefee from parentBaseFee -1",
base : "testdata/00-503",
input : t8nInput(
"alloc.json", "txs.json", "env.json", "London", "-1"
),
output: T8nOutput(alloc: true, result: true),
expOut: "exp.json",
),
TestSpec(
name : "calculate basefee from parentBaseFee",
base : "testdata/00-504",
input : t8nInput(
"alloc.json", "txs.json", "env.json", "London", ""
),
output: T8nOutput(alloc: true, result: true),
expOut: "exp.json",
),
TestSpec(
name : "BLOCKHASH opcode -1",
base : "testdata/00-505",
input : t8nInput(
"alloc.json", "txs.json", "env.json", "London", "-1"
),
output: T8nOutput(alloc: true, result: true),
expOut: "exp.json",
),
TestSpec(
name : "BLOCKHASH opcode",
base : "testdata/00-506",
input : t8nInput(
"alloc.json", "txs.json", "env.json", "London", ""
),
output: T8nOutput(alloc: true, result: true),
expOut: "exp.json",
)
]

proc main() =
Expand Down
16 changes: 16 additions & 0 deletions tools/t8n/testdata/00-501/alloc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x3b9aca00",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
},
"0xd0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0" : {
"balance" : "0x00",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
}
}
8 changes: 8 additions & 0 deletions tools/t8n/testdata/00-501/env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "0x020000",
"currentNumber" : "0x00",
"currentTimestamp" : "0x00",
"currentGasLimit" : "0x05500000",
"previousHash" : "0x0000000000000000000000000000000000000000000000000000000000000000"
}
26 changes: 26 additions & 0 deletions tools/t8n/testdata/00-501/exp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"alloc": {
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"balance": "0x3b9aca00"
},
"0xd0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0": {
"balance": "0x0"
}
},
"result": {
"stateRoot": "0x1751725d1aad5298768fbcf64069b2c1b85aeaffcc561146067d6beedd08052a",
"txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts": [],
"rejected": [
{
"index": 0,
"error": "insufficient funds for gas * price + value: address 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B have 1000000000 want 115792089237316195423570985008687907853269984665640564039457584007914129628001"
}
],
"currentDifficulty": "0x20000",
"gasUsed": "0x0"
}
}
1 change: 1 addition & 0 deletions tools/t8n/testdata/00-501/txs.rlp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"0xf880f87e809f031eea408f8e1799cb883da2927b1336521d73c2c14accfebb70d5c5af006c82520894d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d001801ca039b081ab7094dff1b3ac79cbf8e381adc9f7a4e16290d7abc42dd006e5e062c5a033af00e26e5eb4431dcad601b2c8bf12d51eef2bd037d14681f22692ffab1ccd"
16 changes: 16 additions & 0 deletions tools/t8n/testdata/00-502/alloc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x3b9aca00",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
},
"0xd0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0" : {
"balance" : "0x00",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
}
}
13 changes: 13 additions & 0 deletions tools/t8n/testdata/00-502/env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentNumber" : "0x01",
"currentTimestamp" : "0x03e8",
"currentGasLimit" : "0x05500000",
"previousHash" : "0xa96bbebc0b60fd343eead12143896f9331f436013c0f28cfd13698f0348f4b03",
"parentTimestamp" : "0x00",
"parentDifficulty" : "0x020000",
"parentUncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"blockHashes" : {
"0" : "0xa96bbebc0b60fd343eead12143896f9331f436013c0f28cfd13698f0348f4b03"
}
}
29 changes: 29 additions & 0 deletions tools/t8n/testdata/00-502/exp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"alloc": {
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba": {
"balance": "0x0"
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"balance": "0x3b9aca00"
},
"0xd0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0": {
"balance": "0x0"
}
},
"result": {
"stateRoot": "0x7e18cda82e88b51f339192016b7f3e803051e1e115260efb25f8602b894226ec",
"txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts": [],
"rejected": [
{
"index": 0,
"error": "insufficient funds for gas * price + value: address 0xa94f5374Fce5edBC8E2a8697C15331677e6EbF0B have 1000000000 want 115792089237316195423570985008687907853269984665640564039457584007914129628001"
}
],
"currentDifficulty": "0x20000",
"gasUsed": "0x0"
}
}
13 changes: 13 additions & 0 deletions tools/t8n/testdata/00-502/txs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"data" : "0x",
"gasLimit" : "0x5208",
"gasPrice" : "0x31eea408f8e1799cb883da2927b1336521d73c2c14accfebb70d5c5af006c",
"nonce" : "0x0",
"to" : "0xd0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0",
"value" : "0x1",
"v" : "0x1c",
"r" : "0x39b081ab7094dff1b3ac79cbf8e381adc9f7a4e16290d7abc42dd006e5e062c5",
"s" : "0x33af00e26e5eb4431dcad601b2c8bf12d51eef2bd037d14681f22692ffab1ccd"
}
]
1 change: 1 addition & 0 deletions tools/t8n/testdata/00-502/txs.rlp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"0xf880f87e809f031eea408f8e1799cb883da2927b1336521d73c2c14accfebb70d5c5af006c82520894d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d001801ca039b081ab7094dff1b3ac79cbf8e381adc9f7a4e16290d7abc42dd006e5e062c5a033af00e26e5eb4431dcad601b2c8bf12d51eef2bd037d14681f22692ffab1ccd"
23 changes: 23 additions & 0 deletions tools/t8n/testdata/00-503/alloc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"balance" : "0x0de0b6b3a7640000",
"code" : "0x600160010160005500",
"nonce" : "0x00",
"storage" : {
}
},
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "0x00",
"code" : "0x",
"nonce" : "0x01",
"storage" : {
}
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x0de0b6b3a7640000",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
}
}
11 changes: 11 additions & 0 deletions tools/t8n/testdata/00-503/env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "0x020000",
"currentNumber" : "0x00",
"currentTimestamp" : "0x00",
"currentGasLimit" : "0xff112233445566",
"previousHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentBaseFee" : "0x0b",
"parentGasUsed" : "0x00",
"parentGasLimit" : "0xff112233445566"
}
43 changes: 43 additions & 0 deletions tools/t8n/testdata/00-503/exp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"alloc": {
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87": {
"code": "0x600160010160005500",
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000002"
},
"balance": "0xde0b6b3a76586a0"
},
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba": {
"balance": "0x0",
"nonce": "0x1"
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"balance": "0xde0b6b3a75be550",
"nonce": "0x1"
}
},
"result": {
"stateRoot": "0xe8010ce590f401c9d61fef8ab05bea9bcec24281b795e5868809bc4e515aa530",
"txRoot": "0xf91abed7e00f88cadedc98279f8fe12e181da598fdf28c61aa18908e2e32d531",
"receiptsRoot": "0x06f890d54ec65d8650b6c73eefd1fbc39f78b5b25f4e1ec10885c9f29f84ee98",
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts": [
{
"root": "0x",
"status": "0x1",
"cumulativeGasUsed": "0xa868",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null,
"transactionHash": "0xeda4d6763740fbccc99cc8873ff09b8504d192e83f73bd16ccf5feb053a4e3cd",
"contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0xa868",
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transactionIndex": "0x0"
}
],
"currentDifficulty": "0x20000",
"gasUsed": "0xa868",
"currentBaseFee": "0xa"
}
}
13 changes: 13 additions & 0 deletions tools/t8n/testdata/00-503/txs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"input" : "0x",
"gas" : "0x61a80",
"gasPrice" : "0xa",
"nonce" : "0x0",
"to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
"value" : "0x186a0",
"v" : "0x1b",
"r" : "0xffb600e63115a7362e7811894a91d8ba4330e526f22121c994c4692035dfdfd5",
"s" : "0x6198379fcac8de3dbfac48b165df4bf88e2088f294b61efb9a65fe2281c76e16"
}
]
23 changes: 23 additions & 0 deletions tools/t8n/testdata/00-504/alloc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"balance" : "0x0de0b6b3a7640000",
"code" : "0x600160010160005500",
"nonce" : "0x00",
"storage" : {
}
},
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : {
"balance" : "0x00",
"code" : "0x",
"nonce" : "0x01",
"storage" : {
}
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "0x0de0b6b3a7640000",
"code" : "0x",
"nonce" : "0x00",
"storage" : {
}
}
}
16 changes: 16 additions & 0 deletions tools/t8n/testdata/00-504/env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentNumber" : "0x01",
"currentTimestamp" : "0x03e8",
"currentGasLimit" : "0xff112233445566",
"previousHash" : "0x7f46f93fbcd604ebdb14d90b1b4337f471a44117474b441ce139c34fca1963f0",
"parentTimestamp" : "0x00",
"parentDifficulty" : "0x020000",
"parentUncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"parentBaseFee" : "0x0b",
"parentGasUsed" : "0x00",
"parentGasLimit" : "0xff112233445566",
"blockHashes" : {
"0" : "0x7f46f93fbcd604ebdb14d90b1b4337f471a44117474b441ce139c34fca1963f0"
}
}
43 changes: 43 additions & 0 deletions tools/t8n/testdata/00-504/exp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"alloc": {
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87": {
"code": "0x600160010160005500",
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000002"
},
"balance": "0xde0b6b3a76586a0"
},
"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba": {
"balance": "0x0",
"nonce": "0x1"
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"balance": "0xde0b6b3a75be550",
"nonce": "0x1"
}
},
"result": {
"stateRoot": "0xe8010ce590f401c9d61fef8ab05bea9bcec24281b795e5868809bc4e515aa530",
"txRoot": "0xf91abed7e00f88cadedc98279f8fe12e181da598fdf28c61aa18908e2e32d531",
"receiptsRoot": "0x06f890d54ec65d8650b6c73eefd1fbc39f78b5b25f4e1ec10885c9f29f84ee98",
"logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"receipts": [
{
"root": "0x",
"status": "0x1",
"cumulativeGasUsed": "0xa868",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null,
"transactionHash": "0xeda4d6763740fbccc99cc8873ff09b8504d192e83f73bd16ccf5feb053a4e3cd",
"contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0xa868",
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transactionIndex": "0x0"
}
],
"currentDifficulty": "0x20000",
"gasUsed": "0xa868",
"currentBaseFee": "0xa"
}
}
Loading