Skip to content

Commit

Permalink
Update proverc tests script
Browse files Browse the repository at this point in the history
  • Loading branch information
ignasirv committed Oct 26, 2023
1 parent a3f051e commit 974fe3f
Show file tree
Hide file tree
Showing 27 changed files with 2,534 additions and 10 deletions.
15 changes: 10 additions & 5 deletions tools/full-tracer-tests/config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
[
{
"folderName": "stCallCodes",
"traceMethod": "defaultTracer",
"isEthereumTest": true
{
"testName": "erc20",
"testToDebug": 0,
"traceMethod": "defaultTracer"
},
{
"folderName": "calldata",
"traceMethod": "callTracer",
"isEthereumTest": false
},
{
"testName": "op-invalid",
Expand Down Expand Up @@ -45,4 +50,4 @@
"testToDebug": 25,
"traceMethod": "callTracer"
}
]
]
10 changes: 5 additions & 5 deletions tools/full-tracer-tests/full-tracer-tests-prover.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const chalk = require('chalk');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');
const { Scalar } = require('ffjavascript');
const zkasm = require('@0xpolygonhermez/zkasmcom');
const smMain = require('../../src/sm/sm_main/sm_main');

const CHAIN_ID = 1000;
Expand Down Expand Up @@ -308,7 +309,7 @@ function compareFullTracer(geth, fullTracer, i) {
const callData = [];
let ctx = 0;
let currentStep = 0;
for (const step of fullTracer.call_trace.steps) {
for (const step of fullTracer.full_trace.steps) {
// Previous step analysis
if (currentStep > 0) {
const previousStep = fullTracer.full_trace.steps[currentStep - 1];
Expand Down Expand Up @@ -484,8 +485,8 @@ function compareDefaultTracer(geth, fullTracer, i) {
for (const step of fullTracer.full_trace.steps) {
const newStep = {
pc: Number(step.pc),
op: step.op,
gas: Number(step.remaining_gas),
op: opcodes[step.op][0],
gas: Number(step.gas),
gasCost: Number(step.gas_cost),
memory: step.memory.toString('hex'),
stack: step.stack,
Expand Down Expand Up @@ -762,8 +763,7 @@ function formatInput(jsInput, txHash) {
disable_stack: 0,
enable_memory: 1,
enable_return_data: 1,
tx_hash_to_generate_execute_trace: Buffer.from(txHash.slice(2), 'hex'),
tx_hash_to_generate_call_trace: Buffer.from(txHash.slice(2), 'hex'),
tx_hash_to_generate_full_trace: Buffer.from(txHash.slice(2), 'hex'),
},
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"from": "0x4d5cf5032b2a844602278b01199ed191a86c93ff",
"gas": "0x1c9c380",
"gasUsed": "0xa861",
"to": "0x1000000000000000000000000000000000000000",
"input": "0x",
"value": "0x0",
"type": "CALL"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"gas": 43105,
"failed": false,
"returnValue": "",
"structLogs": [
{
"pc": 0,
"op": "CHAINID",
"gas": 29979000,
"gasCost": 2,
"depth": 1,
"stack": [],
"memory": []
},
{
"pc": 1,
"op": "PUSH1",
"gas": 29978998,
"gasCost": 3,
"depth": 1,
"stack": [
"0x3e8"
],
"memory": []
},
{
"pc": 3,
"op": "SSTORE",
"gas": 29978995,
"gasCost": 22100,
"depth": 1,
"stack": [
"0x3e8",
"0x1"
],
"memory": [],
"storage": {
"0000000000000000000000000000000000000000000000000000000000000001": "00000000000000000000000000000000000000000000000000000000000003e8"
}
},
{
"pc": 4,
"op": "STOP",
"gas": 29956895,
"gasCost": 0,
"depth": 1,
"stack": [],
"memory": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"from": "0x4d5cf5032b2a844602278b01199ed191a86c93ff",
"gas": "0x186a0",
"gasUsed": "0x5208",
"to": "0x3fab184622dc19b6109349b94811493bf2a45362",
"input": "0x",
"value": "0x2386f26fc10000",
"type": "CALL"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"from": "0x3fab184622dc19b6109349b94811493bf2a45362",
"gas": "0x186a0",
"gasUsed": "0x10a23",
"to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
"input": "0x604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3",
"output": "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3",
"value": "0x0",
"type": "CREATE"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"from": "0x4d5cf5032b2a844602278b01199ed191a86c93ff",
"gas": "0x186a0",
"gasUsed": "0x1412e",
"to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
"input": "0x00000000000000000000000000000000000000000000000000000000000000006080604052348015600f57600080fd5b5060848061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063c3cafc6f14602d575b600080fd5b6033604f565b604051808260ff1660ff16815260200191505060405180910390f35b6000602a90509056fea165627a7a72305820ab7651cb86b8c1487590004c2444f26ae30077a6b96c6bc62dda37f1328539250029",
"output": "0x115bcf08a650d194d410f1ca43a17ca41c8d88bc",
"calls": [
{
"from": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
"gas": "0xaa5b",
"gasUsed": "0x6771",
"to": "0x115bcf08a650d194d410f1ca43a17ca41c8d88bc",
"input": "0x6080604052348015600f57600080fd5b5060848061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063c3cafc6f14602d575b600080fd5b6033604f565b604051808260ff1660ff16815260200191505060405180910390f35b6000602a90509056fea165627a7a72305820ab7651cb86b8c1487590004c2444f26ae30077a6b96c6bc62dda37f1328539250029",
"output": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063c3cafc6f14602d575b600080fd5b6033604f565b604051808260ff1660ff16815260200191505060405180910390f35b6000602a90509056fea165627a7a72305820ab7651cb86b8c1487590004c2444f26ae30077a6b96c6bc62dda37f1328539250029",
"value": "0x0",
"type": "CREATE2"
}
],
"value": "0x0",
"type": "CALL"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"from": "0x4d5cf5032b2a844602278b01199ed191a86c93ff",
"gas": "0xf4240",
"gasUsed": "0xf08ba",
"to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
"input": "0x00000000000000000000000000000000000000000000000000000000000000006080604052348015600f57600080fd5b5060848061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063c3cafc6f14602d575b600080fd5b6033604f565b604051808260ff1660ff16815260200191505060405180910390f35b6000602a90509056fea165627a7a72305820ab7651cb86b8c1487590004c2444f26ae30077a6b96c6bc62dda37f1328539250029",
"error": "execution reverted",
"value": "0x0",
"type": "CALL"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"from": "0x4d5cf5032b2a844602278b01199ed191a86c93ff",
"gas": "0xf4240",
"gasUsed": "0x5313",
"to": "0x115bcf08a650d194d410f1ca43a17ca41c8d88bc",
"input": "0xc3cafc6f",
"output": "0x000000000000000000000000000000000000000000000000000000000000002a",
"value": "0x0",
"type": "CALL"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"gas": 21000,
"failed": false,
"returnValue": "",
"structLogs": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"gas": 68131,
"failed": false,
"returnValue": "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3",
"structLogs": [
{
"pc": 0,
"op": "PUSH1",
"gas": 45708,
"gasCost": 3,
"depth": 1,
"stack": [],
"memory": []
},
{
"pc": 2,
"op": "DUP1",
"gas": 45705,
"gasCost": 3,
"depth": 1,
"stack": [
"0x45"
],
"memory": []
},
{
"pc": 3,
"op": "PUSH1",
"gas": 45702,
"gasCost": 3,
"depth": 1,
"stack": [
"0x45",
"0x45"
],
"memory": []
},
{
"pc": 5,
"op": "PUSH1",
"gas": 45699,
"gasCost": 3,
"depth": 1,
"stack": [
"0x45",
"0x45",
"0xe"
],
"memory": []
},
{
"pc": 7,
"op": "CODECOPY",
"gas": 45696,
"gasCost": 21,
"depth": 1,
"stack": [
"0x45",
"0x45",
"0xe",
"0x0"
],
"memory": []
},
{
"pc": 8,
"op": "DUP1",
"gas": 45675,
"gasCost": 3,
"depth": 1,
"stack": [
"0x45"
],
"memory": [
"7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"e03601600081602082378035828234f58015156039578182fd5b808252505050",
"6014600cf3000000000000000000000000000000000000000000000000000000"
]
},
{
"pc": 9,
"op": "PUSH1",
"gas": 45672,
"gasCost": 3,
"depth": 1,
"stack": [
"0x45",
"0x45"
],
"memory": [
"7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"e03601600081602082378035828234f58015156039578182fd5b808252505050",
"6014600cf3000000000000000000000000000000000000000000000000000000"
]
},
{
"pc": 11,
"op": "RETURN",
"gas": 45669,
"gasCost": 0,
"depth": 1,
"stack": [
"0x45",
"0x45",
"0x0"
],
"memory": [
"7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"e03601600081602082378035828234f58015156039578182fd5b808252505050",
"6014600cf3000000000000000000000000000000000000000000000000000000"
]
}
]
}
Loading

0 comments on commit 974fe3f

Please sign in to comment.