Skip to content

Commit

Permalink
flat trace - swap and dup ordering (#336)
Browse files Browse the repository at this point in the history
Swap and dup were getting out of order on the flat trace

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
  • Loading branch information
shemnon committed Jan 29, 2020
1 parent 0b9b68f commit 570299c
Show file tree
Hide file tree
Showing 5 changed files with 402 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public List<String> getPush() {
}

public void addPush(final String value) {
push.add(value);
push.add(0, value);
}

public void singlePush(final String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
{
"number": 5,
"transactions": [
{
{
"comment": "Clear contract storage keys 1 and 2",
"secretKey": "0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63",
"gasLimit": "0xFFFFF2",
Expand Down Expand Up @@ -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"
}
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -113,4 +118,4 @@
"balance": "0xf0000000000000000000000"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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
}
Loading

0 comments on commit 570299c

Please sign in to comment.