[libevmasm] Add support to import evm assembly json.

This commit is contained in:
Alexander Arlt
2023-07-12 17:48:48 +02:00
parent 69c034b1c0
commit 108490e630
57 changed files with 1099 additions and 63 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
--pretty-json --json-indent 4 --combined-json bin,bin-runtime,opcodes,asm,srcmap,srcmap-runtime --asm --bin --bin-runtime --asm-json --import-asm-json -
@@ -0,0 +1,91 @@
{
"contracts":
{
"<stdin>":
{
"asm":
{
".code":
[
{
"begin": 0,
"end": 0,
"name": "PUSH",
"source": -1,
"value": "0"
}
],
".data":
{
"0":
{
".code":
[
{
"begin": 0,
"end": 0,
"name": "PUSH",
"source": -1,
"value": "1"
}
]
}
},
"sourceList":
[
"contract.sol",
"#utility.yul"
]
},
"bin": "6000fe",
"bin-runtime": "6001",
"opcodes": "PUSH1 0x0 INVALID ",
"srcmap": "0:0::-:0",
"srcmap-runtime": "0:0::-:0"
}
},
"sourceList":
[
"contract.sol",
"#utility.yul"
],
"version": "<VERSION REMOVED>"
}
Binary:
6000fe
Binary of the runtime part:
6001
EVM assembly:
{
".code":
[
{
"begin": 0,
"end": 0,
"name": "PUSH",
"source": -1,
"value": "0"
}
],
".data":
{
"0":
{
".code":
[
{
"begin": 0,
"end": 0,
"name": "PUSH",
"source": -1,
"value": "1"
}
]
}
},
"sourceList":
[
"contract.sol",
"#utility.yul"
]
}
@@ -0,0 +1,22 @@
{
".code": [
{
"name": "PUSH",
"value": "0"
}
],
".data": {
"0": {
".code": [
{
"name": "PUSH",
"value": "1"
}
]
}
},
"sourceList": [
"contract.sol",
"#utility.yul"
]
}
@@ -0,0 +1 @@
--import-asm-json - --opcodes --asm
@@ -0,0 +1,6 @@
Opcodes:
PREVRANDAO PREVRANDAO
EVM assembly:
/* */
prevrandao
prevrandao
@@ -0,0 +1,6 @@
{
".code": [
{ "name": "DIFFICULTY" },
{ "name": "PREVRANDAO" }
]
}
@@ -0,0 +1 @@
--import-asm-json - --opcodes --asm
@@ -0,0 +1 @@
Assembly Import Error: Member '.data' contains a value for '0' that is not a valid hexadecimal string.
@@ -0,0 +1 @@
1
@@ -0,0 +1,11 @@
{
".code": [
{
"name": "PUSH",
"value": "0"
}
],
".data": {
"0": "no-hex-string"
}
}
@@ -0,0 +1 @@
--import-asm-json - --opcodes --asm
@@ -0,0 +1 @@
Assembly Import Error: Key inside '.data' '0' can only be a valid hex-string or an object.
@@ -0,0 +1 @@
1
@@ -0,0 +1,16 @@
{
".code": [
{
"name": "PUSH",
"value": "0"
}
],
".data": {
"0": [
0,
1,
2,
3
]
}
}
@@ -0,0 +1 @@
--import-asm-json - --opcodes --asm
@@ -0,0 +1 @@
Assembly Import Error: Member 'jumpType' set on instruction different from JUMP or JUMPI (was set on instruction 'PUSH')
@@ -0,0 +1,9 @@
{
".code": [
{
"name": "PUSH",
"value": "0",
"jumpType": "[in]"
}
]
}
@@ -0,0 +1 @@
--import-asm-json - --opcodes --asm
@@ -0,0 +1 @@
Assembly Import Error: Member 'value' defined for instruction 'DIFFICULTY', but the instruction does not need a value.
@@ -0,0 +1 @@
1
@@ -0,0 +1,8 @@
{
".code": [
{
"name": "DIFFICULTY",
"value": "0"
}
]
}
@@ -0,0 +1 @@
--optimize --import-asm-json - --opcodes --asm
@@ -0,0 +1 @@
Option --optimize is not supported with --import-asm-json.
@@ -0,0 +1 @@
1
@@ -0,0 +1,6 @@
{
".code": [
{ "name": "DIFFICULTY" },
{ "name": "PREVRANDAO" }
]
}
@@ -0,0 +1 @@
--import-asm-json - --opcodes --asm
@@ -0,0 +1 @@
Assembly Import Error: Member 'value' was not defined for instruction 'PUSH', but the instruction needs a value.
@@ -0,0 +1 @@
1
@@ -0,0 +1,5 @@
{
".code": [
{ "name": "PUSH" }
]
}
@@ -0,0 +1 @@
--import-asm-json - --opcodes --asm
@@ -0,0 +1 @@
Assembly Import Error: Unknown member '_name'. Valid members are begin, end, jumpType, modifierDepth, name, source, value.
@@ -0,0 +1 @@
1
@@ -0,0 +1,5 @@
{
".code": [
{ "_name": "DIFFICULTY" }
]
}
@@ -0,0 +1 @@
--import-asm-json - --opcodes --asm
@@ -0,0 +1 @@
Assembly Import Error: JUMPDEST instruction found that was not followed by tag.
@@ -0,0 +1 @@
1
@@ -0,0 +1,10 @@
{
".code": [
{
"name": "tag",
"value": "0x00"
},
{ "name": "JUMPDEST" },
{ "name": "JUMPDEST" }
]
}
@@ -1 +1 @@
The following outputs are not supported in assembler mode: --abi, --asm-json, --bin-runtime, --devdoc, --hashes, --ir, --metadata, --opcodes, --storage-layout, --userdoc.
The following outputs are not supported in assembler mode: --abi, --bin-runtime, --devdoc, --hashes, --ir, --metadata, --opcodes, --storage-layout, --userdoc.