mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[evmasm::Assembly] Fix createAssemblyItemFromJSON VERBATIM value check.
This commit is contained in:
parent
14304b7d75
commit
024f55165a
@ -269,7 +269,7 @@ AssemblyItem Assembly::createAssemblyItemFromJSON(Json::Value const& _json, std:
|
||||
}
|
||||
else if (name == "VERBATIM")
|
||||
{
|
||||
requireValueUndefinedForInstruction(name, value);
|
||||
requireValueDefinedForInstruction(name, value);
|
||||
AssemblyItem item(fromHex(value), 0, 0);
|
||||
result = item;
|
||||
}
|
||||
|
1
test/cmdlineTests/asm_json_export_yul_verbatim/args
Normal file
1
test/cmdlineTests/asm_json_export_yul_verbatim/args
Normal file
@ -0,0 +1 @@
|
||||
--strict-assembly - --asm-json
|
3
test/cmdlineTests/asm_json_export_yul_verbatim/output
Normal file
3
test/cmdlineTests/asm_json_export_yul_verbatim/output
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
======= <stdin> (EVM) =======
|
||||
{".code":[{"begin":28,"end":29,"name":"PUSH","source":0,"value":"0"},{"begin":15,"end":30,"name":"CALLDATALOAD","source":0},{"begin":44,"end":46,"name":"PUSH","source":0,"value":"14"},{"begin":61,"end":62,"name":"DUP1","source":0},{"begin":58,"end":59,"name":"DUP3","source":0},{"begin":51,"end":63,"name":"SSTORE","source":0},{"begin":84,"end":86,"name":"PUSH","source":0,"value":"20"},{"begin":71,"end":87,"name":"CALLDATALOAD","source":0},{"begin":68,"end":188,"name":"ISZERO","source":0},{"begin":68,"end":188,"name":"PUSH [tag]","source":0,"value":"1"},{"begin":68,"end":188,"name":"JUMPI","source":0},{"begin":108,"end":109,"name":"DUP1","source":0},{"begin":105,"end":106,"name":"DUP3","source":0},{"begin":98,"end":110,"name":"SSTORE","source":0},{"begin":149,"end":150,"name":"PUSH","source":0,"value":"0"},{"begin":146,"end":147,"name":"DUP1","source":0},{"begin":143,"end":144,"name":"PUSH","source":0,"value":"0"},{"begin":140,"end":141,"name":"DUP1","source":0},{"begin":137,"end":138,"name":"PUSH","source":0,"value":"0"},{"begin":134,"end":135,"name":"DUP1","source":0},{"begin":123,"end":151,"name":"STATICCALL","source":0},{"begin":119,"end":152,"name":"POP","source":0},{"begin":161,"end":182,"name":"VERBATIM","source":0,"value":"78797a"},{"begin":68,"end":188,"name":"tag","source":0,"value":"1"},{"begin":68,"end":188,"name":"JUMPDEST","source":0},{"begin":203,"end":204,"name":"DUP1","source":0},{"begin":200,"end":201,"name":"DUP3","source":0},{"begin":193,"end":205,"name":"SSTORE","source":0},{"begin":0,"end":207,"name":"POP","source":0},{"begin":0,"end":207,"name":"POP","source":0}],"sourceList":["<stdin>"]}
|
11
test/cmdlineTests/asm_json_export_yul_verbatim/stdin
Normal file
11
test/cmdlineTests/asm_json_export_yul_verbatim/stdin
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
let a := calldataload(0)
|
||||
let b := 20
|
||||
sstore(a, b)
|
||||
if calldataload(32) {
|
||||
sstore(a, b)
|
||||
pop(staticcall(0, 0, 0, 0, 0, 0))
|
||||
verbatim_0i_0o("xyz")
|
||||
}
|
||||
sstore(a, b)
|
||||
}
|
1
test/cmdlineTests/asm_json_import_verbatim/args
Normal file
1
test/cmdlineTests/asm_json_import_verbatim/args
Normal file
@ -0,0 +1 @@
|
||||
--import-asm-json - --opcodes --asm
|
58
test/cmdlineTests/asm_json_import_verbatim/output
Normal file
58
test/cmdlineTests/asm_json_import_verbatim/output
Normal file
@ -0,0 +1,58 @@
|
||||
Opcodes:
|
||||
PUSH1 0x0 CALLDATALOAD PUSH1 0x14 DUP1 DUP3 SSTORE PUSH1 0x20 CALLDATALOAD ISZERO PUSH1 0x20 JUMPI DUP1 DUP3 SSTORE PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 STATICCALL POP PUSH25 0x797A5B80825550500000000000000000000000000000000000
|
||||
EVM assembly:
|
||||
/* "<stdin>":28:29 b */
|
||||
0x00
|
||||
/* "<stdin>":15:30 {... */
|
||||
calldataload
|
||||
/* "<stdin>":44:46 */
|
||||
0x14
|
||||
/* "<stdin>":61:62 */
|
||||
dup1
|
||||
/* "<stdin>":58:59 */
|
||||
dup3
|
||||
/* "<stdin>":51:63 : 29,... */
|
||||
sstore
|
||||
/* "<stdin>":84:86 " */
|
||||
0x20
|
||||
/* "<stdin>":71:87 "PUSH",... */
|
||||
calldataload
|
||||
/* "<stdin>":68:188 ": "PUSH",... */
|
||||
iszero
|
||||
tag_1
|
||||
jumpi
|
||||
/* "<stdin>":108:109 u */
|
||||
dup1
|
||||
/* "<stdin>":105:106 v */
|
||||
dup3
|
||||
/* "<stdin>":98:110 "value */
|
||||
sstore
|
||||
/* "<stdin>":149:150 */
|
||||
0x00
|
||||
/* "<stdin>":146:147 5 */
|
||||
dup1
|
||||
/* "<stdin>":143:144 : */
|
||||
0x00
|
||||
/* "<stdin>":140:141 i */
|
||||
dup1
|
||||
/* "<stdin>":137:138 b */
|
||||
0x00
|
||||
/* "<stdin>":134:135 */
|
||||
dup1
|
||||
/* "<stdin>":123:151 ... */
|
||||
staticcall
|
||||
/* "<stdin>":119:152 },... */
|
||||
pop
|
||||
/* "<stdin>":161:182 30,... */
|
||||
verbatimbytecode_78797a
|
||||
/* "<stdin>":68:188 ": "PUSH",... */
|
||||
tag_1:
|
||||
/* "<stdin>":203:204 s */
|
||||
dup1
|
||||
/* "<stdin>":200:201 */
|
||||
dup3
|
||||
/* "<stdin>":193:205 ",... */
|
||||
sstore
|
||||
/* "<stdin>":0:207 {... */
|
||||
pop
|
||||
pop
|
196
test/cmdlineTests/asm_json_import_verbatim/stdin
Normal file
196
test/cmdlineTests/asm_json_import_verbatim/stdin
Normal file
@ -0,0 +1,196 @@
|
||||
{
|
||||
".code": [
|
||||
{
|
||||
"begin": 28,
|
||||
"end": 29,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"begin": 15,
|
||||
"end": 30,
|
||||
"name": "CALLDATALOAD",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 44,
|
||||
"end": 46,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "14"
|
||||
},
|
||||
{
|
||||
"begin": 61,
|
||||
"end": 62,
|
||||
"name": "DUP1",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 58,
|
||||
"end": 59,
|
||||
"name": "DUP3",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 51,
|
||||
"end": 63,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 84,
|
||||
"end": 86,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "20"
|
||||
},
|
||||
{
|
||||
"begin": 71,
|
||||
"end": 87,
|
||||
"name": "CALLDATALOAD",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 68,
|
||||
"end": 188,
|
||||
"name": "ISZERO",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 68,
|
||||
"end": 188,
|
||||
"name": "PUSH [tag]",
|
||||
"source": 0,
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"begin": 68,
|
||||
"end": 188,
|
||||
"name": "JUMPI",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 108,
|
||||
"end": 109,
|
||||
"name": "DUP1",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 105,
|
||||
"end": 106,
|
||||
"name": "DUP3",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 98,
|
||||
"end": 110,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 149,
|
||||
"end": 150,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"begin": 146,
|
||||
"end": 147,
|
||||
"name": "DUP1",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 143,
|
||||
"end": 144,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"begin": 140,
|
||||
"end": 141,
|
||||
"name": "DUP1",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 137,
|
||||
"end": 138,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"begin": 134,
|
||||
"end": 135,
|
||||
"name": "DUP1",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 123,
|
||||
"end": 151,
|
||||
"name": "STATICCALL",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 119,
|
||||
"end": 152,
|
||||
"name": "POP",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 161,
|
||||
"end": 182,
|
||||
"name": "VERBATIM",
|
||||
"source": 0,
|
||||
"value": "78797a"
|
||||
},
|
||||
{
|
||||
"begin": 68,
|
||||
"end": 188,
|
||||
"name": "tag",
|
||||
"source": 0,
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"begin": 68,
|
||||
"end": 188,
|
||||
"name": "JUMPDEST",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 203,
|
||||
"end": 204,
|
||||
"name": "DUP1",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 200,
|
||||
"end": 201,
|
||||
"name": "DUP3",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 193,
|
||||
"end": 205,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 0,
|
||||
"end": 207,
|
||||
"name": "POP",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 0,
|
||||
"end": 207,
|
||||
"name": "POP",
|
||||
"source": 0
|
||||
}
|
||||
],
|
||||
"sourceList": [
|
||||
"<stdin>"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user