flat trace - swap and dup ordering (#336)

Swap and dup were getting out of order on the flat trace

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
pull/345/head
Danno Ferrin 5 years ago
parent 0b9b68ffde
commit 570299cd78
  1. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/vm/VmOperationExecutionReport.java
  2. 16
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/blocks.json
  3. 7
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/genesis.json
  4. 234
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x10.json
  5. 147
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/specs/all/trace_replayBlockTransactions_all_0x11.json

@ -37,7 +37,7 @@ public class VmOperationExecutionReport {
}
public void addPush(final String value) {
push.add(value);
push.add(0, value);
}
public void singlePush(final String value) {

@ -62,7 +62,7 @@
{
"number": 5,
"transactions": [
{
{
"comment": "Clear contract storage keys 1 and 2",
"secretKey": "0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63",
"gasLimit": "0xFFFFF2",
@ -244,6 +244,18 @@
"to": "0x00E0000000000000000000000000000000000000"
}
]
},
{
"number": "0x11",
"transactions": [
{
"comment": "Pushes 1, 2, 3, then SWAP2 and SWAP1.",
"secretKey": "0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63",
"gasLimit": "0xFFFFF2",
"gasPrice": "0xEF",
"to": "0x00F0000000000000000000000000000000000000"
}
]
}
]
}
}

@ -97,6 +97,11 @@
"code": "0x60FF5660016002",
"balance": "0x0"
},
"00F0000000000000000000000000000000000000": {
"comment": "pushes 1, 2, 3, then SWAP2 and SWAP1",
"code": "0x6001600260039190",
"balance": "0x0"
},
"fe3b557e8fb62b89f4916b721be55ceb828dbd73": {
"secretKey": "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63",
"comment": "private key and this comment are ignored. In a real chain, the private key should NOT be stored",
@ -113,4 +118,4 @@
"balance": "0xf0000000000000000000000"
}
}
}
}

@ -0,0 +1,234 @@
{
"request": {
"jsonrpc": "2.0",
"method": "trace_replayBlockTransactions",
"params": [
"0x10",
[
"trace",
"vmTrace",
"stateDiff"
]
],
"id": 415
},
"response": {
"jsonrpc": "2.0",
"result": [
{
"output": "0x",
"stateDiff": {
"0x0000000000000000000000000000000000000000": {
"balance": {
"*": {
"from": "0x1a055690e93c2f67b",
"to": "0x1a055690f82c2e969"
}
},
"code": "=",
"nonce": "=",
"storage": {}
},
"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": {
"balance": {
"*": {
"from": "0xfffffffffffffffffffffffffffffffff0babcdea",
"to": "0xffffffffffffffffffffffffffffffffe1cabdafc"
}
},
"code": "=",
"nonce": {
"*": {
"from": "0xf",
"to": "0x10"
}
},
"storage": {}
}
},
"trace": [
{
"action": {
"callType": "call",
"from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
"gas": "0xffadea",
"input": "0x",
"to": "0x00c0000000000000000000000000000000000000",
"value": "0x0"
},
"error": "Bad instruction",
"subtraces": 0,
"traceAddress": [],
"type": "call"
}
],
"transactionHash": "0x6aed559a5dcf73efa132d8182585c40fdc6ef3b99a7629d80ffd4a62cb3db622",
"vmTrace": {
"code": "0x60011f",
"ops": [
{
"cost": 3,
"ex": {
"mem": null,
"push": [
"0x1"
],
"store": null,
"used": 16756199
},
"pc": 0,
"sub": null
}
]
}
},
{
"output": "0x",
"stateDiff": {
"0x0000000000000000000000000000000000000000": {
"balance": {
"*": {
"from": "0x1a055690f82c2e969",
"to": "0x1a055691071c2dc57"
}
},
"code": "=",
"nonce": "=",
"storage": {}
},
"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": {
"balance": {
"*": {
"from": "0xffffffffffffffffffffffffffffffffe1cabdafc",
"to": "0xffffffffffffffffffffffffffffffffd2dabe80e"
}
},
"code": "=",
"nonce": {
"*": {
"from": "0x10",
"to": "0x11"
}
},
"storage": {}
}
},
"trace": [
{
"action": {
"callType": "call",
"from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
"gas": "0xffadea",
"input": "0x",
"to": "0x00d0000000000000000000000000000000000000",
"value": "0x0"
},
"error": "Stack underflow",
"subtraces": 0,
"traceAddress": [],
"type": "call"
}
],
"transactionHash": "0xb39fa8a1cb1db4663dc3733bc014d524e90a862bf2607e028eeb3932d92574fe",
"vmTrace": {
"code": "0x600120",
"ops": [
{
"cost": 3,
"ex": {
"mem": null,
"push": [
"0x1"
],
"store": null,
"used": 16756199
},
"pc": 0,
"sub": null
}
]
}
},
{
"output": "0x",
"stateDiff": {
"0x0000000000000000000000000000000000000000": {
"balance": {
"*": {
"from": "0x1a055691071c2dc57",
"to": "0x1a055691160c2cf45"
}
},
"code": "=",
"nonce": "=",
"storage": {}
},
"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": {
"balance": {
"*": {
"from": "0xffffffffffffffffffffffffffffffffd2dabe80e",
"to": "0xffffffffffffffffffffffffffffffffc3eabf520"
}
},
"code": "=",
"nonce": {
"*": {
"from": "0x11",
"to": "0x12"
}
},
"storage": {}
}
},
"trace": [
{
"action": {
"callType": "call",
"from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
"gas": "0xffadea",
"input": "0x",
"to": "0x00e0000000000000000000000000000000000000",
"value": "0x0"
},
"error": "Bad jump destination",
"subtraces": 0,
"traceAddress": [],
"type": "call"
}
],
"transactionHash": "0x11a725053a6ece79d8de11cb75dd1f09c40dcd109a1c63573e847ad4f456a296",
"vmTrace": {
"code": "0x60ff5660016002",
"ops": [
{
"cost": 3,
"ex": {
"mem": null,
"push": [
"0xff"
],
"store": null,
"used": 16756199
},
"pc": 0,
"sub": null
},
{
"cost": 8,
"ex": {
"mem": null,
"push": [],
"store": null,
"used": 16756191
},
"pc": 2,
"sub": null
}
]
}
}
],
"id": 415
},
"statusCode": 200
}

@ -0,0 +1,147 @@
{
"request": {
"jsonrpc": "2.0",
"method": "trace_replayBlockTransactions",
"params": [
"0x11",
[
"trace",
"vmTrace",
"stateDiff"
]
],
"id": 415
},
"response": {
"jsonrpc": "2.0",
"result": [
{
"output": "0x",
"stateDiff": {
"0x0000000000000000000000000000000000000000": {
"balance": {
"*": {
"from": "0x1bc16d678af8acf45",
"to": "0x1bc16d678afd772be"
}
},
"code": "=",
"nonce": "=",
"storage": {}
},
"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73": {
"balance": {
"*": {
"from": "0xffffffffffffffffffffffffffffffffc3eabf520",
"to": "0xffffffffffffffffffffffffffffffffc3e5f51a7"
}
},
"code": "=",
"nonce": {
"*": {
"from": "0x12",
"to": "0x13"
}
},
"storage": {}
}
},
"trace": [
{
"action": {
"callType": "call",
"from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
"gas": "0xffadea",
"input": "0x",
"to": "0x00f0000000000000000000000000000000000000",
"value": "0x0"
},
"result": {
"gasUsed": "0xf",
"output": "0x"
},
"subtraces": 0,
"traceAddress": [],
"type": "call"
}
],
"transactionHash": "0x93d974a14c784be231a7b580a6476a330e5d6f9ddfef70a6b5cacd9f91a1e495",
"vmTrace": {
"code": "0x6001600260039190",
"ops": [
{
"cost": 3,
"ex": {
"mem": null,
"push": [
"0x1"
],
"store": null,
"used": 16756199
},
"pc": 0,
"sub": null
},
{
"cost": 3,
"ex": {
"mem": null,
"push": [
"0x2"
],
"store": null,
"used": 16756196
},
"pc": 2,
"sub": null
},
{
"cost": 3,
"ex": {
"mem": null,
"push": [
"0x3"
],
"store": null,
"used": 16756193
},
"pc": 4,
"sub": null
},
{
"cost": 3,
"ex": {
"mem": null,
"push": [
"0x3",
"0x2",
"0x1"
],
"store": null,
"used": 16756190
},
"pc": 6,
"sub": null
},
{
"cost": 3,
"ex": {
"mem": null,
"push": [
"0x1",
"0x2"
],
"store": null,
"used": 16756187
},
"pc": 7,
"sub": null
}
]
}
}
],
"id": 415
},
"statusCode": 200
}
Loading…
Cancel
Save