aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-11-13 21:10:48 +0800
committerGitHub <noreply@github.com>2018-11-13 21:10:48 +0800
commitc237013911aa5bb6102e1262e6aa62178c0f02e0 (patch)
tree2827f17d04ed01a3e36a2fed83cbd9e8b2a2003b
parent82fadfd1a7c5715595ddbf6643ae494cdb6eca8c (diff)
parent90e4d244073c1d9ced47711a533cc8fe4ac217f2 (diff)
downloaddexon-solidity-c237013911aa5bb6102e1262e6aa62178c0f02e0.tar.gz
dexon-solidity-c237013911aa5bb6102e1262e6aa62178c0f02e0.tar.zst
dexon-solidity-c237013911aa5bb6102e1262e6aa62178c0f02e0.zip
Merge pull request #5020 from ethereum/lll-seq-fix
LLL: terminate sequences with a STOP
-rw-r--r--liblll/CodeFragment.cpp11
-rw-r--r--test/liblll/Compiler.cpp956
-rw-r--r--test/liblll/EndToEndTest.cpp14
3 files changed, 502 insertions, 479 deletions
diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp
index 85480119..f37cb8b9 100644
--- a/liblll/CodeFragment.cpp
+++ b/liblll/CodeFragment.cpp
@@ -45,6 +45,10 @@ using namespace dev::lll;
void CodeFragment::finalise(CompilerState const& _cs)
{
+ // NOTE: add this as a safeguard in case the user didn't issue an
+ // explicit stop at the end of the sequence
+ m_asm.append(Instruction::STOP);
+
if (_cs.usedAlloc && _cs.vars.size() && !m_finalised)
{
m_finalised = true;
@@ -232,7 +236,12 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
int c = 0;
for (auto const& i: _t)
if (c++)
- m_asm.append(CodeFragment(i, _s, m_readFile, true).m_asm);
+ {
+ auto fragment = CodeFragment(i, _s, m_readFile, true).m_asm;
+ if ((m_asm.deposit() + fragment.deposit()) < 0)
+ error<IncorrectParameterCount>("The assembly instruction resulted in stack underflow");
+ m_asm.append(fragment);
+ }
}
else if (us == "INCLUDE")
{
diff --git a/test/liblll/Compiler.cpp b/test/liblll/Compiler.cpp
index a4394f54..27db45a5 100644
--- a/test/liblll/Compiler.cpp
+++ b/test/liblll/Compiler.cpp
@@ -147,215 +147,215 @@ BOOST_AUTO_TEST_CASE(disallowed_functional_asm_instructions)
BOOST_AUTO_TEST_CASE(valid_opcodes_functional)
{
vector<string> opcodes_bytecode {
- "00",
- "6000600001",
- "6000600002",
- "6000600003",
- "6000600004",
- "6000600005",
- "6000600006",
- "6000600007",
- "60006000600008",
- "60006000600009",
- "600060000a",
- "600060000b",
- "6000600010",
- "6000600011",
- "6000600012",
- "6000600013",
- "6000600014",
- "600015",
- "6000600016",
- "6000600017",
- "6000600018",
- "600019",
- "600060001a",
- "6000600020",
- "30",
- "600031",
- "32",
- "33",
- "34",
- "600035",
- "36",
- "60006000600037",
- "38",
- "60006000600039",
- "3a",
- "60003b",
- "60006000600060003c",
- "3d",
- "6000600060003e",
- "60003f",
- "600040",
- "41",
- "42",
- "43",
- "44",
- "45",
- "600050",
- "600051",
- "6000600052",
- "6000600053",
- "600054",
- "6000600055",
- "600056",
- "6000600057",
- "58",
- "59",
- "5a",
- "60ff",
- "61ffff",
- "62ffffff",
- "63ffffffff",
- "64ffffffffff",
- "65ffffffffffff",
- "66ffffffffffffff",
- "67ffffffffffffffff",
- "68ffffffffffffffffff",
- "69ffffffffffffffffffff",
- "6affffffffffffffffffffff",
- "6bffffffffffffffffffffffff",
- "6cffffffffffffffffffffffffff",
- "6dffffffffffffffffffffffffffff",
- "6effffffffffffffffffffffffffffff",
- "6fffffffffffffffffffffffffffffffff",
- "70ffffffffffffffffffffffffffffffffff",
- "71ffffffffffffffffffffffffffffffffffff",
- "72ffffffffffffffffffffffffffffffffffffff",
- "73ffffffffffffffffffffffffffffffffffffffff",
- "74ffffffffffffffffffffffffffffffffffffffffff",
- "75ffffffffffffffffffffffffffffffffffffffffffff",
- "76ffffffffffffffffffffffffffffffffffffffffffffff",
- "77ffffffffffffffffffffffffffffffffffffffffffffffff",
- "78ffffffffffffffffffffffffffffffffffffffffffffffffff",
- "79ffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7affffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "60006000a0",
- "600060006000a1",
- "6000600060006000a2",
- "60006000600060006000a3",
- "600060006000600060006000a4",
- "600060006000f0",
- "6000600060006000600060006000f1",
- "6000600060006000600060006000f2",
- "60006000f3",
- "600060006000600060006000f4",
- "600060006000600060006000fa",
- "60006000fd",
- "fe",
- "6000ff"
+ "0000",
+ "600060000100",
+ "600060000200",
+ "600060000300",
+ "600060000400",
+ "600060000500",
+ "600060000600",
+ "600060000700",
+ "6000600060000800",
+ "6000600060000900",
+ "600060000a00",
+ "600060000b00",
+ "600060001000",
+ "600060001100",
+ "600060001200",
+ "600060001300",
+ "600060001400",
+ "60001500",
+ "600060001600",
+ "600060001700",
+ "600060001800",
+ "60001900",
+ "600060001a00",
+ "600060002000",
+ "3000",
+ "60003100",
+ "3200",
+ "3300",
+ "3400",
+ "60003500",
+ "3600",
+ "6000600060003700",
+ "3800",
+ "6000600060003900",
+ "3a00",
+ "60003b00",
+ "60006000600060003c00",
+ "3d00",
+ "6000600060003e00",
+ "60003f00",
+ "60004000",
+ "4100",
+ "4200",
+ "4300",
+ "4400",
+ "4500",
+ "60005000",
+ "60005100",
+ "600060005200",
+ "600060005300",
+ "60005400",
+ "600060005500",
+ "60005600",
+ "600060005700",
+ "5800",
+ "5900",
+ "5a00",
+ "60ff00",
+ "61ffff00",
+ "62ffffff00",
+ "63ffffffff00",
+ "64ffffffffff00",
+ "65ffffffffffff00",
+ "66ffffffffffffff00",
+ "67ffffffffffffffff00",
+ "68ffffffffffffffffff00",
+ "69ffffffffffffffffffff00",
+ "6affffffffffffffffffffff00",
+ "6bffffffffffffffffffffffff00",
+ "6cffffffffffffffffffffffffff00",
+ "6dffffffffffffffffffffffffffff00",
+ "6effffffffffffffffffffffffffffff00",
+ "6fffffffffffffffffffffffffffffffff00",
+ "70ffffffffffffffffffffffffffffffffff00",
+ "71ffffffffffffffffffffffffffffffffffff00",
+ "72ffffffffffffffffffffffffffffffffffffff00",
+ "73ffffffffffffffffffffffffffffffffffffffff00",
+ "74ffffffffffffffffffffffffffffffffffffffffff00",
+ "75ffffffffffffffffffffffffffffffffffffffffffff00",
+ "76ffffffffffffffffffffffffffffffffffffffffffffff00",
+ "77ffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "78ffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "79ffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7affffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "60006000a000",
+ "600060006000a100",
+ "6000600060006000a200",
+ "60006000600060006000a300",
+ "600060006000600060006000a400",
+ "600060006000f000",
+ "6000600060006000600060006000f100",
+ "6000600060006000600060006000f200",
+ "60006000f300",
+ "600060006000600060006000f400",
+ "600060006000600060006000fa00",
+ "60006000fd00",
+ "fe00",
+ "6000ff00"
};
vector<string> opcodes_lll {
- "{ (STOP) }",
- "{ (ADD 0 0) }",
- "{ (MUL 0 0) }",
- "{ (SUB 0 0) }",
- "{ (DIV 0 0) }",
- "{ (SDIV 0 0) }",
- "{ (MOD 0 0) }",
- "{ (SMOD 0 0) }",
- "{ (ADDMOD 0 0 0) }",
- "{ (MULMOD 0 0 0) }",
- "{ (EXP 0 0) }",
- "{ (SIGNEXTEND 0 0) }",
- "{ (LT 0 0) }",
- "{ (GT 0 0) }",
- "{ (SLT 0 0) }",
- "{ (SGT 0 0) }",
- "{ (EQ 0 0) }",
- "{ (ISZERO 0) }",
- "{ (AND 0 0) }",
- "{ (OR 0 0) }",
- "{ (XOR 0 0) }",
- "{ (NOT 0) }",
- "{ (BYTE 0 0) }",
- "{ (KECCAK256 0 0) }",
- "{ (ADDRESS) }",
- "{ (BALANCE 0) }",
- "{ (ORIGIN) }",
- "{ (CALLER) }",
- "{ (CALLVALUE) }",
- "{ (CALLDATALOAD 0) }",
- "{ (CALLDATASIZE) }",
- "{ (CALLDATACOPY 0 0 0) }",
- "{ (CODESIZE) }",
- "{ (CODECOPY 0 0 0) }",
- "{ (GASPRICE) }",
- "{ (EXTCODESIZE 0) }",
- "{ (EXTCODECOPY 0 0 0 0) }",
- "{ (RETURNDATASIZE) }",
- "{ (RETURNDATACOPY 0 0 0) }",
- "{ (EXTCODEHASH 0) }",
- "{ (BLOCKHASH 0) }",
- "{ (COINBASE) }",
- "{ (TIMESTAMP) }",
- "{ (NUMBER) }",
- "{ (DIFFICULTY) }",
- "{ (GASLIMIT) }",
- "{ (POP 0) }",
- "{ (MLOAD 0) }",
- "{ (MSTORE 0 0) }",
- "{ (MSTORE8 0 0) }",
- "{ (SLOAD 0) }",
- "{ (SSTORE 0 0) }",
- "{ (JUMP 0) }",
- "{ (JUMPI 0 0) }",
- "{ (PC) }",
- "{ (MSIZE) }",
- "{ (GAS) }",
- "{ 0xff }",
- "{ 0xffff }",
- "{ 0xffffff }",
- "{ 0xffffffff }",
- "{ 0xffffffffff }",
- "{ 0xffffffffffff }",
- "{ 0xffffffffffffff }",
- "{ 0xffffffffffffffff }",
- "{ 0xffffffffffffffffff }",
- "{ 0xffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff }",
- "{ 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff }",
- "{ (LOG0 0 0) }",
- "{ (LOG1 0 0 0) }",
- "{ (LOG2 0 0 0 0) }",
- "{ (LOG3 0 0 0 0 0) }",
- "{ (LOG4 0 0 0 0 0 0) }",
- "{ (CREATE 0 0 0) }",
- "{ (CALL 0 0 0 0 0 0 0) }",
- "{ (CALLCODE 0 0 0 0 0 0 0) }",
- "{ (RETURN 0 0) }",
- "{ (DELEGATECALL 0 0 0 0 0 0) }",
- "{ (STATICCALL 0 0 0 0 0 0) }",
- "{ (REVERT 0 0) }",
- "{ (INVALID) }",
- "{ (SELFDESTRUCT 0) }"
+ "(STOP)",
+ "(ADD 0 0)",
+ "(MUL 0 0)",
+ "(SUB 0 0)",
+ "(DIV 0 0)",
+ "(SDIV 0 0)",
+ "(MOD 0 0)",
+ "(SMOD 0 0)",
+ "(ADDMOD 0 0 0)",
+ "(MULMOD 0 0 0)",
+ "(EXP 0 0)",
+ "(SIGNEXTEND 0 0)",
+ "(LT 0 0)",
+ "(GT 0 0)",
+ "(SLT 0 0)",
+ "(SGT 0 0)",
+ "(EQ 0 0)",
+ "(ISZERO 0)",
+ "(AND 0 0)",
+ "(OR 0 0)",
+ "(XOR 0 0)",
+ "(NOT 0)",
+ "(BYTE 0 0)",
+ "(KECCAK256 0 0)",
+ "(ADDRESS)",
+ "(BALANCE 0)",
+ "(ORIGIN)",
+ "(CALLER)",
+ "(CALLVALUE)",
+ "(CALLDATALOAD 0)",
+ "(CALLDATASIZE)",
+ "(CALLDATACOPY 0 0 0)",
+ "(CODESIZE)",
+ "(CODECOPY 0 0 0)",
+ "(GASPRICE)",
+ "(EXTCODESIZE 0)",
+ "(EXTCODECOPY 0 0 0 0)",
+ "(RETURNDATASIZE)",
+ "(RETURNDATACOPY 0 0 0)",
+ "(EXTCODEHASH 0)",
+ "(BLOCKHASH 0)",
+ "(COINBASE)",
+ "(TIMESTAMP)",
+ "(NUMBER)",
+ "(DIFFICULTY)",
+ "(GASLIMIT)",
+ "(POP 0)",
+ "(MLOAD 0)",
+ "(MSTORE 0 0)",
+ "(MSTORE8 0 0)",
+ "(SLOAD 0)",
+ "(SSTORE 0 0)",
+ "(JUMP 0)",
+ "(JUMPI 0 0)",
+ "(PC)",
+ "(MSIZE)",
+ "(GAS)",
+ "0xff",
+ "0xffff",
+ "0xffffff",
+ "0xffffffff",
+ "0xffffffffff",
+ "0xffffffffffff",
+ "0xffffffffffffff",
+ "0xffffffffffffffff",
+ "0xffffffffffffffffff",
+ "0xffffffffffffffffffff",
+ "0xffffffffffffffffffffff",
+ "0xffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ "(LOG0 0 0)",
+ "(LOG1 0 0 0)",
+ "(LOG2 0 0 0 0)",
+ "(LOG3 0 0 0 0 0)",
+ "(LOG4 0 0 0 0 0 0)",
+ "(CREATE 0 0 0)",
+ "(CALL 0 0 0 0 0 0 0)",
+ "(CALLCODE 0 0 0 0 0 0 0)",
+ "(RETURN 0 0)",
+ "(DELEGATECALL 0 0 0 0 0 0)",
+ "(STATICCALL 0 0 0 0 0 0)",
+ "(REVERT 0 0)",
+ "(INVALID)",
+ "(SELFDESTRUCT 0)"
};
for (size_t i = 0; i < opcodes_bytecode.size(); i++)
@@ -372,281 +372,281 @@ BOOST_AUTO_TEST_CASE(valid_opcodes_functional)
BOOST_AUTO_TEST_CASE(valid_opcodes_asm)
{
vector<string> opcodes_bytecode {
- "00",
- "01",
- "02",
- "03",
- "04",
- "05",
- "06",
- "07",
- "08",
- "09",
- "0a",
- "0b",
- "10",
- "11",
- "12",
- "13",
- "14",
- "15",
- "16",
- "17",
- "18",
- "19",
- "1a",
- "20",
- "30",
- "31",
- "32",
- "33",
- "34",
- "35",
- "36",
- "37",
- "38",
- "39",
- "3a",
- "3b",
- "3c",
- "3d",
- "3e",
- "3f",
- "40",
- "41",
- "42",
- "43",
- "44",
- "45",
- "50",
- "51",
- "52",
- "53",
- "54",
- "55",
- "56",
- "57",
- "58",
- "59",
- "5a",
- "5b",
- "60ff",
- "61ffff",
- "62ffffff",
- "63ffffffff",
- "64ffffffffff",
- "65ffffffffffff",
- "66ffffffffffffff",
- "67ffffffffffffffff",
- "68ffffffffffffffffff",
- "69ffffffffffffffffffff",
- "6affffffffffffffffffffff",
- "6bffffffffffffffffffffffff",
- "6cffffffffffffffffffffffffff",
- "6dffffffffffffffffffffffffffff",
- "6effffffffffffffffffffffffffffff",
- "6fffffffffffffffffffffffffffffffff",
- "70ffffffffffffffffffffffffffffffffff",
- "71ffffffffffffffffffffffffffffffffffff",
- "72ffffffffffffffffffffffffffffffffffffff",
- "73ffffffffffffffffffffffffffffffffffffffff",
- "74ffffffffffffffffffffffffffffffffffffffffff",
- "75ffffffffffffffffffffffffffffffffffffffffffff",
- "76ffffffffffffffffffffffffffffffffffffffffffffff",
- "77ffffffffffffffffffffffffffffffffffffffffffffffff",
- "78ffffffffffffffffffffffffffffffffffffffffffffffffff",
- "79ffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7affffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
- "80",
- "81",
- "82",
- "83",
- "84",
- "85",
- "86",
- "87",
- "88",
- "89",
- "8a",
- "8b",
- "8c",
- "8d",
- "8e",
- "8f",
- "90",
- "91",
- "92",
- "93",
- "94",
- "95",
- "96",
- "97",
- "98",
- "99",
- "9a",
- "9b",
- "9c",
- "9d",
- "9e",
- "9f",
- "a0",
- "a1",
- "a2",
- "a3",
- "a4",
- "f0",
- "f1",
- "f2",
- "f3",
- "f4",
- "fa",
- "fd",
- "fe",
- "ff"
+ "0000",
+ "600060000100",
+ "600060000200",
+ "600060000300",
+ "600060000400",
+ "600060000500",
+ "600060000600",
+ "600060000700",
+ "6000600060000800",
+ "6000600060000900",
+ "600060000a00",
+ "600060000b00",
+ "600060001000",
+ "600060001100",
+ "600060001200",
+ "600060001300",
+ "600060001400",
+ "60001500",
+ "600060001600",
+ "600060001700",
+ "600060001800",
+ "60001900",
+ "600060001a00",
+ "600060002000",
+ "3000",
+ "60003100",
+ "3200",
+ "3300",
+ "3400",
+ "60003500",
+ "3600",
+ "6000600060003700",
+ "3800",
+ "6000600060003900",
+ "3a00",
+ "60003b00",
+ "60006000600060003c00",
+ "3d00",
+ "6000600060003e00",
+ "60003f00",
+ "4000",
+ "4100",
+ "4200",
+ "4300",
+ "4400",
+ "4500",
+ "60005000",
+ "60005100",
+ "600060005200",
+ "600060005300",
+ "60005400",
+ "600060005500",
+ "60005600",
+ "600060005700",
+ "5800",
+ "5900",
+ "5a00",
+ "5b00",
+ "60ff00",
+ "61ffff00",
+ "62ffffff00",
+ "63ffffffff00",
+ "64ffffffffff00",
+ "65ffffffffffff00",
+ "66ffffffffffffff00",
+ "67ffffffffffffffff00",
+ "68ffffffffffffffffff00",
+ "69ffffffffffffffffffff00",
+ "6affffffffffffffffffffff00",
+ "6bffffffffffffffffffffffff00",
+ "6cffffffffffffffffffffffffff00",
+ "6dffffffffffffffffffffffffffff00",
+ "6effffffffffffffffffffffffffffff00",
+ "6fffffffffffffffffffffffffffffffff00",
+ "70ffffffffffffffffffffffffffffffffff00",
+ "71ffffffffffffffffffffffffffffffffffff00",
+ "72ffffffffffffffffffffffffffffffffffffff00",
+ "73ffffffffffffffffffffffffffffffffffffffff00",
+ "74ffffffffffffffffffffffffffffffffffffffffff00",
+ "75ffffffffffffffffffffffffffffffffffffffffffff00",
+ "76ffffffffffffffffffffffffffffffffffffffffffffff00",
+ "77ffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "78ffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "79ffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7affffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00",
+ "60006000600060006000600060006000600060006000600060006000600060008000",
+ "60006000600060006000600060006000600060006000600060006000600060008100",
+ "60006000600060006000600060006000600060006000600060006000600060008200",
+ "60006000600060006000600060006000600060006000600060006000600060008300",
+ "60006000600060006000600060006000600060006000600060006000600060008400",
+ "60006000600060006000600060006000600060006000600060006000600060008500",
+ "60006000600060006000600060006000600060006000600060006000600060008600",
+ "60006000600060006000600060006000600060006000600060006000600060008700",
+ "60006000600060006000600060006000600060006000600060006000600060008800",
+ "60006000600060006000600060006000600060006000600060006000600060008900",
+ "60006000600060006000600060006000600060006000600060006000600060008a00",
+ "60006000600060006000600060006000600060006000600060006000600060008b00",
+ "60006000600060006000600060006000600060006000600060006000600060008c00",
+ "60006000600060006000600060006000600060006000600060006000600060008d00",
+ "60006000600060006000600060006000600060006000600060006000600060008e00",
+ "60006000600060006000600060006000600060006000600060006000600060008f00",
+ "60006000600060006000600060006000600060006000600060006000600060009000",
+ "60006000600060006000600060006000600060006000600060006000600060009100",
+ "60006000600060006000600060006000600060006000600060006000600060009200",
+ "60006000600060006000600060006000600060006000600060006000600060009300",
+ "60006000600060006000600060006000600060006000600060006000600060009400",
+ "60006000600060006000600060006000600060006000600060006000600060009500",
+ "60006000600060006000600060006000600060006000600060006000600060009600",
+ "60006000600060006000600060006000600060006000600060006000600060009700",
+ "60006000600060006000600060006000600060006000600060006000600060009800",
+ "60006000600060006000600060006000600060006000600060006000600060009900",
+ "60006000600060006000600060006000600060006000600060006000600060009a00",
+ "60006000600060006000600060006000600060006000600060006000600060009b00",
+ "60006000600060006000600060006000600060006000600060006000600060009c00",
+ "60006000600060006000600060006000600060006000600060006000600060009d00",
+ "60006000600060006000600060006000600060006000600060006000600060009e00",
+ "60006000600060006000600060006000600060006000600060006000600060009f00",
+ "60006000a000",
+ "600060006000a100",
+ "6000600060006000a200",
+ "60006000600060006000a300",
+ "600060006000600060006000a400",
+ "600060006000f000",
+ "600060006000600060006000f100",
+ "600060006000600060006000f200",
+ "60006000f300",
+ "60006000600060006000f400",
+ "60006000600060006000fa00",
+ "60006000fd00",
+ "fe00",
+ "6000ff00"
};
vector<string> opcodes_lll {
- "{ (asm STOP) }",
- "{ (asm ADD) }",
- "{ (asm MUL) }",
- "{ (asm SUB) }",
- "{ (asm DIV) }",
- "{ (asm SDIV ) }",
- "{ (asm MOD) }",
- "{ (asm SMOD) }",
- "{ (asm ADDMOD) }",
- "{ (asm MULMOD) }",
- "{ (asm EXP) }",
- "{ (asm SIGNEXTEND) }",
- "{ (asm LT) }",
- "{ (asm GT) }",
- "{ (asm SLT) }",
- "{ (asm SGT) }",
- "{ (asm EQ) }",
- "{ (asm ISZERO) }",
- "{ (asm AND) }",
- "{ (asm OR) }",
- "{ (asm XOR) }",
- "{ (asm NOT) }",
- "{ (asm BYTE) }",
- "{ (asm KECCAK256) }",
- "{ (asm ADDRESS) }",
- "{ (asm BALANCE) }",
- "{ (asm ORIGIN) }",
- "{ (asm CALLER) }",
- "{ (asm CALLVALUE) }",
- "{ (asm CALLDATALOAD) }",
- "{ (asm CALLDATASIZE) }",
- "{ (asm CALLDATACOPY) }",
- "{ (asm CODESIZE) }",
- "{ (asm CODECOPY) }",
- "{ (asm GASPRICE) }",
- "{ (asm EXTCODESIZE)}",
- "{ (asm EXTCODECOPY) }",
- "{ (asm RETURNDATASIZE) }",
- "{ (asm RETURNDATACOPY) }",
- "{ (asm EXTCODEHASH) }",
- "{ (asm BLOCKHASH) }",
- "{ (asm COINBASE) }",
- "{ (asm TIMESTAMP) }",
- "{ (asm NUMBER) }",
- "{ (asm DIFFICULTY) }",
- "{ (asm GASLIMIT) }",
- "{ (asm POP) }",
- "{ (asm MLOAD) }",
- "{ (asm MSTORE) }",
- "{ (asm MSTORE8) }",
- "{ (asm SLOAD) }",
- "{ (asm SSTORE) }",
- "{ (asm JUMP ) }",
- "{ (asm JUMPI ) }",
- "{ (asm PC) }",
- "{ (asm MSIZE) }",
- "{ (asm GAS) }",
- "{ (asm JUMPDEST) }",
- "{ (asm 0xff) }",
- "{ (asm 0xffff) }",
- "{ (asm 0xffffff) }",
- "{ (asm 0xffffffff) }",
- "{ (asm 0xffffffffff) }",
- "{ (asm 0xffffffffffff) }",
- "{ (asm 0xffffffffffffff) }",
- "{ (asm 0xffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }",
- "{ (asm DUP1) }",
- "{ (asm DUP2) }",
- "{ (asm DUP3) }",
- "{ (asm DUP4) }",
- "{ (asm DUP5) }",
- "{ (asm DUP6) }",
- "{ (asm DUP7) }",
- "{ (asm DUP8) }",
- "{ (asm DUP9) }",
- "{ (asm DUP10) }",
- "{ (asm DUP11) }",
- "{ (asm DUP12) }",
- "{ (asm DUP13) }",
- "{ (asm DUP14) }",
- "{ (asm DUP15) }",
- "{ (asm DUP16) }",
- "{ (asm SWAP1) }",
- "{ (asm SWAP2) }",
- "{ (asm SWAP3) }",
- "{ (asm SWAP4) }",
- "{ (asm SWAP5) }",
- "{ (asm SWAP6) }",
- "{ (asm SWAP7) }",
- "{ (asm SWAP8) }",
- "{ (asm SWAP9) }",
- "{ (asm SWAP10) }",
- "{ (asm SWAP11) }",
- "{ (asm SWAP12) }",
- "{ (asm SWAP13) }",
- "{ (asm SWAP14) }",
- "{ (asm SWAP15) }",
- "{ (asm SWAP16) }",
- "{ (asm LOG0) }",
- "{ (asm LOG1) }",
- "{ (asm LOG2) }",
- "{ (asm LOG3) }",
- "{ (asm LOG4) }",
- "{ (asm CREATE) }",
- "{ (asm CALL) }",
- "{ (asm CALLCODE) }",
- "{ (asm RETURN) }",
- "{ (asm DELEGATECALL) }",
- "{ (asm STATICCALL) }",
- "{ (asm REVERT) }",
- "{ (asm INVALID) }",
- "{ (asm SELFDESTRUCT) }"
+ "(asm STOP)",
+ "(asm 0 0 ADD)",
+ "(asm 0 0 MUL)",
+ "(asm 0 0 SUB)",
+ "(asm 0 0 DIV)",
+ "(asm 0 0 SDIV)",
+ "(asm 0 0 MOD)",
+ "(asm 0 0 SMOD)",
+ "(asm 0 0 0 ADDMOD)",
+ "(asm 0 0 0 MULMOD)",
+ "(asm 0 0 EXP)",
+ "(asm 0 0 SIGNEXTEND)",
+ "(asm 0 0 LT)",
+ "(asm 0 0 GT)",
+ "(asm 0 0 SLT)",
+ "(asm 0 0 SGT)",
+ "(asm 0 0 EQ)",
+ "(asm 0 ISZERO)",
+ "(asm 0 0 AND)",
+ "(asm 0 0 OR)",
+ "(asm 0 0 XOR)",
+ "(asm 0 NOT)",
+ "(asm 0 0 BYTE)",
+ "(asm 0 0 KECCAK256)",
+ "(asm ADDRESS)",
+ "(asm 0 BALANCE)",
+ "(asm ORIGIN)",
+ "(asm CALLER)",
+ "(asm CALLVALUE)",
+ "(asm 0 CALLDATALOAD)",
+ "(asm CALLDATASIZE)",
+ "(asm 0 0 0 CALLDATACOPY)",
+ "(asm CODESIZE)",
+ "(asm 0 0 0 CODECOPY)",
+ "(asm GASPRICE)",
+ "(asm 0 EXTCODESIZE)",
+ "(asm 0 0 0 0 EXTCODECOPY)",
+ "(asm RETURNDATASIZE)",
+ "(asm 0 0 0 RETURNDATACOPY)",
+ "(asm 0 EXTCODEHASH)",
+ "(asm BLOCKHASH)",
+ "(asm COINBASE)",
+ "(asm TIMESTAMP)",
+ "(asm NUMBER)",
+ "(asm DIFFICULTY)",
+ "(asm GASLIMIT)",
+ "(asm 0 POP)",
+ "(asm 0 MLOAD)",
+ "(asm 0 0 MSTORE)",
+ "(asm 0 0 MSTORE8)",
+ "(asm 0 SLOAD)",
+ "(asm 0 0 SSTORE)",
+ "(asm 0 JUMP)",
+ "(asm 0 0 JUMPI)",
+ "(asm PC)",
+ "(asm MSIZE)",
+ "(asm GAS)",
+ "(asm JUMPDEST)",
+ "(asm 0xff)",
+ "(asm 0xffff)",
+ "(asm 0xffffff)",
+ "(asm 0xffffffff)",
+ "(asm 0xffffffffff)",
+ "(asm 0xffffffffffff)",
+ "(asm 0xffffffffffffff)",
+ "(asm 0xffffffffffffffff)",
+ "(asm 0xffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP1)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP2)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP3)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP4)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP5)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP6)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP7)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP8)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP9)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP10)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP11)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP12)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP13)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP14)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP15)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DUP16)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP1)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP2)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP3)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP4)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP5)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP6)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP7)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP8)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP9)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP10)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP11)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP12)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP13)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP14)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP15)",
+ "(asm 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SWAP16)",
+ "(asm 0 0 LOG0)",
+ "(asm 0 0 0 LOG1)",
+ "(asm 0 0 0 0 LOG2)",
+ "(asm 0 0 0 0 0 LOG3)",
+ "(asm 0 0 0 0 0 0 LOG4)",
+ "(asm 0 0 0 CREATE)",
+ "(asm 0 0 0 0 0 0 CALL)",
+ "(asm 0 0 0 0 0 0 CALLCODE)",
+ "(asm 0 0 RETURN)",
+ "(asm 0 0 0 0 0 DELEGATECALL)",
+ "(asm 0 0 0 0 0 STATICCALL)",
+ "(asm 0 0 REVERT)",
+ "(asm INVALID)",
+ "(asm 0 SELFDESTRUCT)"
};
for (size_t i = 0; i < opcodes_bytecode.size(); i++)
diff --git a/test/liblll/EndToEndTest.cpp b/test/liblll/EndToEndTest.cpp
index ceaf450e..60aef7b0 100644
--- a/test/liblll/EndToEndTest.cpp
+++ b/test/liblll/EndToEndTest.cpp
@@ -986,6 +986,20 @@ BOOST_AUTO_TEST_CASE(shift_right)
BOOST_CHECK(callFallback() == encodeArgs(u256(256)));
}
+BOOST_AUTO_TEST_CASE(sub_assemblies)
+{
+ char const* sourceCode = R"(
+ (returnlll
+ (return (create 0 (returnlll (sstore 1 1)))))
+ )";
+ compileAndRun(sourceCode);
+ bytes ret = callFallback();
+ BOOST_REQUIRE(ret.size() == 32);
+ u256 rVal = u256(toHex(ret, 2, HexPrefix::Add));
+ BOOST_CHECK(rVal != 0);
+ BOOST_CHECK(rVal < u256("0x10000000000000000000000000000000000000000"));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}