mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[WASM] Add keccak256, balance, extcodecopy, blockhash, coinbase, log's, call, callcode, delegatecall, staticcall
This commit is contained in:
parent
8de05a4a9e
commit
b8c59c56e0
@ -214,7 +214,10 @@ function cmp(a, b) -> r {
|
||||
r := i64.ne(a, b)
|
||||
}
|
||||
}
|
||||
|
||||
)"
|
||||
// Split long string to make it compilable on msvc
|
||||
// https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2026?view=vs-2019
|
||||
R"(
|
||||
function lt(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 {
|
||||
switch cmp(x1, y1)
|
||||
case 0 {
|
||||
@ -335,6 +338,11 @@ function signextend(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
}
|
||||
function u256_to_u128(x1, x2, x3, x4) -> v1, v2 {
|
||||
if i64.ne(0, i64.or(x1, x2)) { invalid() }
|
||||
v2 := x4
|
||||
v1 := x3
|
||||
}
|
||||
|
||||
function u256_to_i64(x1, x2, x3, x4) -> v {
|
||||
if i64.ne(0, i64.or(i64.or(x1, x2), x3)) { invalid() }
|
||||
@ -347,10 +355,30 @@ function u256_to_i32(x1, x2, x3, x4) -> v {
|
||||
v := x4
|
||||
}
|
||||
|
||||
function u256_to_byte(x1, x2, x3, x4) -> v {
|
||||
if i64.ne(0, i64.or(i64.or(x1, x2), x3)) { invalid() }
|
||||
if i64.gt_u(x4, 255) { invalid() }
|
||||
v := x4
|
||||
}
|
||||
|
||||
function u256_to_i32ptr(x1, x2, x3, x4) -> v {
|
||||
v := u256_to_i32(x1, x2, x3, x4)
|
||||
}
|
||||
|
||||
function to_internal_i32ptr(x1, x2, x3, x4) -> r {
|
||||
let p := u256_to_i32ptr(x1, x2, x3, x4)
|
||||
r := i64.add(p, 64)
|
||||
if i64.lt_u(r, p) { invalid() }
|
||||
}
|
||||
|
||||
function u256_to_address(x1, x2, x3, x4) -> r1, r2, r3 {
|
||||
if i64.ne(0, x1) { invalid() }
|
||||
if i64.ne(0, i64.shr_u(x2, 32)) { invalid() }
|
||||
r1 := x2
|
||||
r2 := x3
|
||||
r3 := x4
|
||||
}
|
||||
|
||||
function keccak256(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
@ -361,8 +389,9 @@ function address() -> z1, z2, z3, z4 {
|
||||
z1, z2, z3, z4 := mload_internal(0)
|
||||
}
|
||||
function balance(x1, x2, x3, x4) -> z1, z2, z3, z4 {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
mstore_address(0, x1, x2, x3, x4)
|
||||
eth.getExternalBalance(12, 48)
|
||||
z1, z2, z3, z4 := mload_internal(32)
|
||||
}
|
||||
function selfbalance() -> z1, z2, z3, z4 {
|
||||
// TODO: not part of current Ewasm spec
|
||||
@ -393,8 +422,7 @@ function calldatasize() -> z1, z2, z3, z4 {
|
||||
}
|
||||
function calldatacopy(x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4) {
|
||||
eth.callDataCopy(
|
||||
// scratch - TODO: overflow check
|
||||
i64.add(u256_to_i32ptr(x1, x2, x3, x4), 64),
|
||||
to_internal_i32ptr(x1, x2, x3, x4),
|
||||
u256_to_i32(y1, y2, y3, y4),
|
||||
u256_to_i32(z1, z2, z3, z4)
|
||||
)
|
||||
@ -406,8 +434,7 @@ function codesize() -> z1, z2, z3, z4 {
|
||||
}
|
||||
function codecopy(x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4) {
|
||||
eth.codeCopy(
|
||||
// scratch - TODO: overflow check
|
||||
i64.add(u256_to_i32ptr(x1, x2, x3, x4), 64),
|
||||
to_internal_i32ptr(x1, x2, x3, x4),
|
||||
u256_to_i32(y1, y2, y3, y4),
|
||||
u256_to_i32(z1, z2, z3, z4)
|
||||
)
|
||||
@ -421,17 +448,22 @@ function gasprice() -> z1, z2, z3, z4 {
|
||||
eth.getTxGasPrice(0)
|
||||
z1, z2, z3, z4 := mload_internal(0)
|
||||
}
|
||||
function extcodesize_internal(x1, x2, x3, x4) -> r {
|
||||
mstore_address(0, x1, x2, x3, x4)
|
||||
r := eth.getExternalCodeSize(12)
|
||||
}
|
||||
function extcodesize(x1, x2, x3, x4) -> z1, z2, z3, z4 {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
z4 := extcodesize_internal(x1, x2, x3, x4)
|
||||
}
|
||||
function extcodehash(x1, x2, x3, x4) -> z1, z2, z3, z4 {
|
||||
// TODO: not part of current Ewasm spec
|
||||
unreachable()
|
||||
}
|
||||
function extcodecopy(v1, v2, v3, v4, x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4) {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
function extcodecopy(a1, a2, a3, a4, p1, p2, p3, p4, o1, o2, o3, o4, l1, l2, l3, l4) {
|
||||
mstore_address(0, a1, a2, a3, a4)
|
||||
let codeOffset := u256_to_i32(o1, o2, o3, o4)
|
||||
let codeLength := u256_to_i32(l1, l2, l3, l4)
|
||||
eth.externalCodeCopy(12, to_internal_i32ptr(p1, p2, p3, p4), codeOffset, codeLength)
|
||||
}
|
||||
|
||||
function returndatasize() -> z1, z2, z3, z4 {
|
||||
@ -439,20 +471,21 @@ function returndatasize() -> z1, z2, z3, z4 {
|
||||
}
|
||||
function returndatacopy(x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4) {
|
||||
eth.returnDataCopy(
|
||||
// scratch - TODO: overflow check
|
||||
i64.add(u256_to_i32ptr(x1, x2, x3, x4), 64),
|
||||
to_internal_i32ptr(x1, x2, x3, x4),
|
||||
u256_to_i32(y1, y2, y3, y4),
|
||||
u256_to_i32(z1, z2, z3, z4)
|
||||
)
|
||||
}
|
||||
|
||||
function blockhash(x1, x2, x3, x4) -> z1, z2, z3, z4 {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
let r := eth.getBlockHash(u256_to_i64(x1, x2, x3, x4), 0)
|
||||
if i64.eqz(r) {
|
||||
z1, z2, z3, z4 := mload_internal(0)
|
||||
}
|
||||
}
|
||||
function coinbase() -> z1, z2, z3, z4 {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
eth.getBlockCoinbase(0)
|
||||
z1, z2, z3, z4 := mload_internal(0)
|
||||
}
|
||||
function timestamp() -> z1, z2, z3, z4 {
|
||||
z4 := eth.getBlockTimestamp()
|
||||
@ -522,11 +555,7 @@ function restore_temp_mem_64(t1, t2, t3, t4, t5, t6, t7, t8) {
|
||||
i64.store(54, t8)
|
||||
}
|
||||
function mload(x1, x2, x3, x4) -> z1, z2, z3, z4 {
|
||||
let pos := u256_to_i32ptr(x1, x2, x3, x4)
|
||||
// Make room for the scratch space
|
||||
// TODO do we need to check for overflow?
|
||||
pos := i64.add(pos, 64)
|
||||
z1, z2, z3, z4 := mload_internal(pos)
|
||||
z1, z2, z3, z4 := mload_internal(to_internal_i32ptr(x1, x2, x3, x4))
|
||||
}
|
||||
function mload_internal(pos) -> z1, z2, z3, z4 {
|
||||
z1 := endian_swap(i64.load(pos))
|
||||
@ -535,11 +564,7 @@ function mload_internal(pos) -> z1, z2, z3, z4 {
|
||||
z4 := endian_swap(i64.load(i64.add(pos, 24)))
|
||||
}
|
||||
function mstore(x1, x2, x3, x4, y1, y2, y3, y4) {
|
||||
let pos := u256_to_i32ptr(x1, x2, x3, x4)
|
||||
// Make room for the scratch space
|
||||
// TODO do we need to check for overflow?
|
||||
pos := i64.add(pos, 64)
|
||||
mstore_internal(pos, y1, y2, y3, y4)
|
||||
mstore_internal(to_internal_i32ptr(x1, x2, x3, x4), y1, y2, y3, y4)
|
||||
}
|
||||
function mstore_internal(pos, y1, y2, y3, y4) {
|
||||
i64.store(pos, endian_swap(y1))
|
||||
@ -547,6 +572,10 @@ function mstore_internal(pos, y1, y2, y3, y4) {
|
||||
i64.store(i64.add(pos, 16), endian_swap(y3))
|
||||
i64.store(i64.add(pos, 24), endian_swap(y4))
|
||||
}
|
||||
function mstore_address(pos, a1, a2, a3, a4) {
|
||||
a1, a2, a3 := u256_to_address(a1, a2, a3, a4)
|
||||
mstore_internal(pos, 0, a1, a2, a3)
|
||||
}
|
||||
function mstore8(x1, x2, x3, x4, y1, y2, y3, y4) {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
@ -578,47 +607,84 @@ function gas() -> z1, z2, z3, z4 {
|
||||
}
|
||||
|
||||
function log0(p1, p2, p3, p4, s1, s2, s3, s4) {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
eth.log(
|
||||
to_internal_i32ptr(p1, p2, p3, p4),
|
||||
u256_to_i32(s1, s2, s3, s4),
|
||||
0, 0, 0, 0, 0
|
||||
)
|
||||
}
|
||||
function log1(
|
||||
p1, p2, p3, p4, s1, s2, s3, s4,
|
||||
t11, t12, t13, t14
|
||||
t1_1, t1_2, t1_3, t1_4
|
||||
) {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
eth.log(
|
||||
to_internal_i32ptr(p1, p2, p3, p4),
|
||||
u256_to_i32(s1, s2, s3, s4),
|
||||
1,
|
||||
to_internal_i32ptr(t1_1, t1_2, t1_3, t1_4),
|
||||
0, 0, 0
|
||||
)
|
||||
}
|
||||
function log2(
|
||||
p1, p2, p3, p4, s1, s2, s3, s4,
|
||||
t11, t12, t13, t14,
|
||||
t21, t22, t23, t24
|
||||
t1_1, t1_2, t1_3, t1_4,
|
||||
t2_1, t2_2, t2_3, t2_4
|
||||
) {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
eth.log(
|
||||
to_internal_i32ptr(p1, p2, p3, p4),
|
||||
u256_to_i32(s1, s2, s3, s4),
|
||||
2,
|
||||
to_internal_i32ptr(t1_1, t1_2, t1_3, t1_4),
|
||||
to_internal_i32ptr(t2_1, t2_2, t2_3, t2_4),
|
||||
0, 0
|
||||
)
|
||||
}
|
||||
function log3(
|
||||
p1, p2, p3, p4, s1, s2, s3, s4,
|
||||
t11, t12, t13, t14,
|
||||
t21, t22, t23, t24,
|
||||
t31, t32, t33, t34
|
||||
t1_1, t1_2, t1_3, t1_4,
|
||||
t2_1, t2_2, t2_3, t2_4,
|
||||
t3_1, t3_2, t3_3, t3_4
|
||||
) {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
eth.log(
|
||||
to_internal_i32ptr(p1, p2, p3, p4),
|
||||
u256_to_i32(s1, s2, s3, s4),
|
||||
3,
|
||||
to_internal_i32ptr(t1_1, t1_2, t1_3, t1_4),
|
||||
to_internal_i32ptr(t2_1, t2_2, t2_3, t2_4),
|
||||
to_internal_i32ptr(t3_1, t3_2, t3_3, t3_4),
|
||||
0
|
||||
)
|
||||
}
|
||||
function log4(
|
||||
p1, p2, p3, p4, s1, s2, s3, s4,
|
||||
t11, t12, t13, t14,
|
||||
t21, t22, t23, t24,
|
||||
t31, t32, t33, t34,
|
||||
t41, t42, t43, t44,
|
||||
t1_1, t1_2, t1_3, t1_4,
|
||||
t2_1, t2_2, t2_3, t2_4,
|
||||
t3_1, t3_2, t3_3, t3_4,
|
||||
t4_1, t4_2, t4_3, t4_4,
|
||||
) {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
eth.log(
|
||||
to_internal_i32ptr(p1, p2, p3, p4),
|
||||
u256_to_i32(s1, s2, s3, s4),
|
||||
4,
|
||||
to_internal_i32ptr(t1_1, t1_2, t1_3, t1_4),
|
||||
to_internal_i32ptr(t2_1, t2_2, t2_3, t2_4),
|
||||
to_internal_i32ptr(t3_1, t3_2, t3_3, t3_4),
|
||||
to_internal_i32ptr(t4_1, t4_2, t4_3, t4_4)
|
||||
)
|
||||
}
|
||||
|
||||
function create(x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4) -> a1, a2, a3, a4 {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
function create(
|
||||
x1, x2, x3, x4,
|
||||
y1, y2, y3, y4,
|
||||
z1, z2, z3, z4
|
||||
) -> a1, a2, a3, a4 {
|
||||
let v1, v2 := u256_to_u128(x1, x2, x3, x4)
|
||||
mstore_internal(0, 0, 0, v1, v2)
|
||||
|
||||
let r := eth.create(0, to_internal_i32ptr(y1, y2, y3, y4), u256_to_i32(z1, z2, z3, z4), 32)
|
||||
if i64.eqz(r) {
|
||||
a1, a2, a3, a4 := mload_internal(32)
|
||||
}
|
||||
}
|
||||
function call(
|
||||
a1, a2, a3, a4,
|
||||
@ -629,8 +695,13 @@ function call(
|
||||
f1, f2, f3, f4,
|
||||
g1, g2, g3, g4
|
||||
) -> x1, x2, x3, x4 {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
let g := u256_to_i64(a1, a2, a3, a4)
|
||||
mstore_address(0, b1, b2, b3, b4)
|
||||
|
||||
let v1, v2 := u256_to_u128(c1, c2, c3, c4)
|
||||
mstore_internal(32, 0, 0, v1, v2)
|
||||
|
||||
x4 := eth.call(g, 12, 32, to_internal_i32ptr(d1, d2, d3, d4), u256_to_i32(e1, e2, e3, e4))
|
||||
}
|
||||
function callcode(
|
||||
a1, a2, a3, a4,
|
||||
@ -641,8 +712,18 @@ function callcode(
|
||||
f1, f2, f3, f4,
|
||||
g1, g2, g3, g4
|
||||
) -> x1, x2, x3, x4 {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
mstore_address(0, b1, b2, b3, b4)
|
||||
|
||||
let v1, v2 := u256_to_u128(c1, c2, c3, c4)
|
||||
mstore_internal(32, 0, 0, v1, v2)
|
||||
|
||||
x4 := eth.callCode(
|
||||
u256_to_i64(a1, a2, a3, a4),
|
||||
12,
|
||||
32,
|
||||
to_internal_i32ptr(d1, d2, d3, d4),
|
||||
u256_to_i32(e1, e2, e3, e4)
|
||||
)
|
||||
}
|
||||
function delegatecall(
|
||||
a1, a2, a3, a4,
|
||||
@ -652,8 +733,14 @@ function delegatecall(
|
||||
e1, e2, e3, e4,
|
||||
f1, f2, f3, f4
|
||||
) -> x1, x2, x3, x4 {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
mstore_address(0, b1, b2, b3, b4)
|
||||
|
||||
x4 := eth.callDelegate(
|
||||
u256_to_i64(a1, a2, a3, a4),
|
||||
12,
|
||||
to_internal_i32ptr(c1, c2, c3, c4),
|
||||
u256_to_i32(d1, d2, d3, d4)
|
||||
)
|
||||
}
|
||||
function staticcall(
|
||||
a1, a2, a3, a4,
|
||||
@ -663,8 +750,14 @@ function staticcall(
|
||||
e1, e2, e3, e4,
|
||||
f1, f2, f3, f4
|
||||
) -> x1, x2, x3, x4 {
|
||||
// TODO implement
|
||||
unreachable()
|
||||
mstore_address(0, b1, b2, b3, b4)
|
||||
|
||||
x4 := eth.callStatic(
|
||||
u256_to_i64(a1, a2, a3, a4),
|
||||
12,
|
||||
to_internal_i32ptr(c1, c2, c3, c4),
|
||||
u256_to_i32(d1, d2, d3, d4)
|
||||
)
|
||||
}
|
||||
function create2(
|
||||
a1, a2, a3, a4,
|
||||
@ -676,22 +769,20 @@ function create2(
|
||||
unreachable()
|
||||
}
|
||||
function selfdestruct(a1, a2, a3, a4) {
|
||||
mstore(0, 0, 0, 0, a1, a2, a3, a4)
|
||||
mstore_address(0, a1, a2, a3, a4)
|
||||
// In EVM, addresses are padded to 32 bytes, so discard the first 12.
|
||||
eth.selfDestruct(12)
|
||||
}
|
||||
|
||||
function return(x1, x2, x3, x4, y1, y2, y3, y4) {
|
||||
eth.finish(
|
||||
// scratch - TODO: overflow check
|
||||
i64.add(u256_to_i32ptr(x1, x2, x3, x4), 64),
|
||||
to_internal_i32ptr(x1, x2, x3, x4),
|
||||
u256_to_i32(y1, y2, y3, y4)
|
||||
)
|
||||
}
|
||||
function revert(x1, x2, x3, x4, y1, y2, y3, y4) {
|
||||
eth.revert(
|
||||
// scratch - TODO: overflow check
|
||||
i64.add(u256_to_i32ptr(x1, x2, x3, x4), 64),
|
||||
to_internal_i32ptr(x1, x2, x3, x4),
|
||||
u256_to_i32(y1, y2, y3, y4)
|
||||
)
|
||||
}
|
||||
@ -768,4 +859,3 @@ void EVMToEwasmTranslator::parsePolyfill()
|
||||
for (auto const& statement: m_polyfill->statements)
|
||||
m_polyfillFunctions.insert(std::get<FunctionDefinition>(statement).name);
|
||||
}
|
||||
|
||||
|
@ -7,23 +7,29 @@
|
||||
|
||||
(func $main
|
||||
(local $_1 i64)
|
||||
(local $_2 i64)
|
||||
(local $p i64)
|
||||
(local $r i64)
|
||||
(local $hi i64)
|
||||
(local $y i64)
|
||||
(local $hi_1 i64)
|
||||
(local $_3 i64)
|
||||
(local $y i64)
|
||||
(local $hi_2 i64)
|
||||
(local $_2 i64)
|
||||
(local.set $_1 (i64.const 0))
|
||||
(local.set $_2 (i64.add (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 64)) (i64.const 64)))
|
||||
(local.set $hi (i64.shl (i64.or (i64.shl (i64.or (i64.and (i64.shl (local.get $_1) (i64.const 8)) (i64.const 65280)) (i64.and (i64.shr_u (local.get $_1) (i64.const 8)) (i64.const 255))) (i64.const 16)) (call $endian_swap_16 (i64.shr_u (local.get $_1) (i64.const 16)))) (i64.const 32)))
|
||||
(local.set $y (i64.or (local.get $hi) (call $endian_swap_32 (i64.shr_u (local.get $_1) (i64.const 32)))))
|
||||
(i64.store (i32.wrap_i64 (local.get $_2)) (local.get $y))
|
||||
(i64.store (i32.wrap_i64 (i64.add (local.get $_2) (i64.const 8))) (local.get $y))
|
||||
(i64.store (i32.wrap_i64 (i64.add (local.get $_2) (i64.const 16))) (local.get $y))
|
||||
(local.set $hi_1 (i64.shl (call $endian_swap_32 (i64.const 128)) (i64.const 32)))
|
||||
(i64.store (i32.wrap_i64 (i64.add (local.get $_2) (i64.const 24))) (i64.or (local.get $hi_1) (call $endian_swap_32 (i64.shr_u (i64.const 128) (i64.const 32)))))
|
||||
(local.set $_3 (datasize \"C_2_deployed\"))
|
||||
(call $eth.codeCopy (i32.wrap_i64 (i64.add (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)) (i64.const 64))) (i32.wrap_i64 (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (dataoffset \"C_2_deployed\"))) (i32.wrap_i64 (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3))))
|
||||
(call $eth.finish (i32.wrap_i64 (i64.add (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)) (i64.const 64))) (i32.wrap_i64 (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3))))
|
||||
(local.set $p (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 64)))
|
||||
(local.set $r (i64.add (local.get $p) (i64.const 64)))
|
||||
(if (i64.ne (i64.extend_i32_u (i64.lt_u (local.get $r) (local.get $p))) (i64.const 0)) (then
|
||||
(unreachable)))
|
||||
(local.set $hi (i64.shl (call $endian_swap_16 (local.get $_1)) (i64.const 16)))
|
||||
(local.set $hi_1 (i64.shl (i64.or (local.get $hi) (call $endian_swap_16 (i64.shr_u (local.get $_1) (i64.const 16)))) (i64.const 32)))
|
||||
(local.set $y (i64.or (local.get $hi_1) (call $endian_swap_32 (i64.shr_u (local.get $_1) (i64.const 32)))))
|
||||
(i64.store (i32.wrap_i64 (local.get $r)) (local.get $y))
|
||||
(i64.store (i32.wrap_i64 (i64.add (local.get $r) (i64.const 8))) (local.get $y))
|
||||
(i64.store (i32.wrap_i64 (i64.add (local.get $r) (i64.const 16))) (local.get $y))
|
||||
(local.set $hi_2 (i64.shl (call $endian_swap_32 (i64.const 128)) (i64.const 32)))
|
||||
(i64.store (i32.wrap_i64 (i64.add (local.get $r) (i64.const 24))) (i64.or (local.get $hi_2) (call $endian_swap_32 (i64.shr_u (i64.const 128) (i64.const 32)))))
|
||||
(local.set $_2 (datasize \"C_2_deployed\"))
|
||||
(call $eth.codeCopy (i32.wrap_i64 (call $to_internal_i32ptr (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1))) (i32.wrap_i64 (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (dataoffset \"C_2_deployed\"))) (i32.wrap_i64 (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_2))))
|
||||
(call $eth.finish (i32.wrap_i64 (call $to_internal_i32ptr (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1))) (i32.wrap_i64 (call $u256_to_i32 (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_2))))
|
||||
)
|
||||
|
||||
(func $u256_to_i32
|
||||
@ -41,6 +47,21 @@
|
||||
(local.get $v)
|
||||
)
|
||||
|
||||
(func $to_internal_i32ptr
|
||||
(param $x1 i64)
|
||||
(param $x2 i64)
|
||||
(param $x3 i64)
|
||||
(param $x4 i64)
|
||||
(result i64)
|
||||
(local $r i64)
|
||||
(local $p i64)
|
||||
(local.set $p (call $u256_to_i32 (local.get $x1) (local.get $x2) (local.get $x3) (local.get $x4)))
|
||||
(local.set $r (i64.add (local.get $p) (i64.const 64)))
|
||||
(if (i64.ne (i64.extend_i32_u (i64.lt_u (local.get $r) (local.get $p))) (i64.const 0)) (then
|
||||
(unreachable)))
|
||||
(local.get $r)
|
||||
)
|
||||
|
||||
(func $endian_swap_16
|
||||
(param $x i64)
|
||||
(result i64)
|
||||
|
@ -4,7 +4,9 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000011111111000000000000000000000000
|
||||
// 0: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// 20: 0000000000000000000000000000000000000000000000000000000022222222
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000022222222
|
||||
// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000022222222
|
||||
|
@ -1,8 +1,9 @@
|
||||
{
|
||||
sstore(0, blockhash(1))
|
||||
sstore(0, blockhash(1023))
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// Memory dump:
|
||||
// 20: 00000000000000000000000000000000000000000000000000000000aaaaa9a9
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 00000000000000000000000000000000000000000000000000000000aaaaa9a9
|
||||
|
@ -3,6 +3,7 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// Memory dump:
|
||||
// 20: 0000000000000000000000000000000077777777000000000000000000000000
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000077777777000000000000000000000000
|
||||
|
@ -4,7 +4,8 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000011111111000000000000000000000000
|
||||
// 20: 636f6465636f6465636f6465636f6465636f6465000000000000000000000000
|
||||
// 140: 636f6465636f6465636f6465636f6465636f6465000000000000000000000000
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 636f6465636f6465636f6465636f6465636f6465000000000000000000000000
|
||||
|
@ -3,7 +3,7 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000011111111000000000000000000000000
|
||||
// 20: 000000000000000000000000000000000000000000000000000000000000077b
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 000000000000000000000000000000000000000000000000000000000000077b
|
||||
|
@ -3,6 +3,6 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// LOG0()
|
||||
// Memory dump:
|
||||
// Storage dump:
|
||||
|
@ -3,6 +3,6 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// LOG1()
|
||||
// Memory dump:
|
||||
// Storage dump:
|
||||
|
@ -3,6 +3,6 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// LOG2()
|
||||
// Memory dump:
|
||||
// Storage dump:
|
||||
|
@ -3,6 +3,6 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// LOG3()
|
||||
// Memory dump:
|
||||
// Storage dump:
|
||||
|
@ -3,6 +3,6 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// LOG4()
|
||||
// Memory dump:
|
||||
// Storage dump:
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
selfdestruct(not(0))
|
||||
selfdestruct(0xffffffffffffffffffffffffffffffffffffffff)
|
||||
invalid()
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// SELFDESTRUCT()
|
||||
// Memory dump:
|
||||
// 40: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
// 0: 000000000000000000000000ffffffffffffffffffffffffffffffffffffffff
|
||||
// Storage dump:
|
||||
|
@ -3,7 +3,8 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// CALL()
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000011111111000000000000000000000000
|
||||
// 20: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
|
@ -3,7 +3,8 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// CALLCODE()
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000011111111000000000000000000000000
|
||||
// 20: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
|
@ -5,7 +5,7 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// CREATE()
|
||||
// Memory dump:
|
||||
// 40: 636f6465636f6465636f6465636f6465636f6465000000000000000000000000
|
||||
// Storage dump:
|
||||
|
@ -3,7 +3,8 @@
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// DELEGATECALL()
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000011111111000000000000000000000000
|
||||
// 20: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
|
@ -5,7 +5,8 @@
|
||||
// EVMVersion: >=byzantium
|
||||
// ----
|
||||
// Trace:
|
||||
// INVALID()
|
||||
// STATICCALL()
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000011111111000000000000000000000000
|
||||
// 20: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// Storage dump:
|
||||
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
|
Loading…
Reference in New Issue
Block a user