From 90776b470378be65323706a1ebf753384c8365a6 Mon Sep 17 00:00:00 2001 From: Lane Rettig Date: Sun, 7 Oct 2018 22:31:32 -0700 Subject: [PATCH 1/5] Adds initMalformedBytecodeInvalidMain test Call CREATE with bytecode with malformed main export --- .../initMalformedBytecodeInvalidMain.json | 63 +++++++++ ...initMalformedBytecodeInvalidMainFiller.yml | 126 ++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json create mode 100644 src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml diff --git a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json new file mode 100644 index 00000000000..32d0c727b9c --- /dev/null +++ b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json @@ -0,0 +1,63 @@ +{ + "initMalformedBytecodeInvalidMain" : { + "_info" : { + "comment" : "", + "filledwith" : "testeth 1.4.0", + "lllcversion" : "Version: 0.4.20-develop.2018.1.14+commit.0c20b6da.Darwin.appleclang", + "source" : "src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml", + "sourceHash" : "cd93196f2d14b03720c74e30b018d58e5360662ce16bf1704e4c1c0acfb025df" + }, + "env" : { + "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x020000", + "currentGasLimit" : "0x05500000", + "currentNumber" : "0x01", + "currentTimestamp" : "0x03e8", + "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "post" : { + "Byzantium" : [ + { + "hash" : "0x23966ce6a5f0987baa9fd747eb48e750d57dbf12a3df2c15bf55b15b85743c9a", + "indexes" : { + "data" : 0, + "gas" : 0, + "value" : 0 + }, + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + }, + "pre" : { + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174876e800", + "code" : "", + "nonce" : "0x00", + "storage" : { + } + }, + "0xabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd" : { + "balance" : "0x174876e800", + "code" : "0x0061736d0100000001110360047f7f7f7f017f60027f7f00600000022b0208657468657265756d06637265617465000008657468657265756d0c73746f7261676553746f72650001030201020503010001071102066d656d6f72790200046d61696e00020a41013f01077f410021004120210141c000210241e000210341800121044180022105413621062003200420052006200110003602002000200110012002200310010b0ba201030041000b2000000000000000000000000000000000000000000000000000000000000000000041c0000b200000000000000000000000000000000000000000000000000000000000000001004180020b500061736d0100000001090260027f7f0060000002130108657468657265756d0666696e6973680000030201010503010001071102066d656d6f72790200046d61696e00010a0a0108004100410010000b", + "nonce" : "0x00", + "storage" : { + } + } + }, + "transaction" : { + "data" : [ + "0x" + ], + "gasLimit" : [ + "0x5000001" + ], + "gasPrice" : "0x01", + "nonce" : "0x00", + "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "0xabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd", + "value" : [ + "0x00" + ] + } + } +} \ No newline at end of file diff --git a/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml b/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml new file mode 100644 index 00000000000..3c4ef0643fd --- /dev/null +++ b/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml @@ -0,0 +1,126 @@ +# Test malformed bytecode (has start) in init on create +initMalformedBytecodeInvalidMain: + env: + currentCoinbase: 2adc25665018aa1fe0e6bc666dac8fc2697ff9ba + currentDifficulty: '0x020000' + currentGasLimit: '89128960' + currentNumber: '1' + currentTimestamp: '1000' + previousHash: 5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6 + pre: + # tx sender + a94f5374fce5edbc8e2a8697c15331677e6ebf0b: + balance: '100000000000' + code: '' + nonce: '' + storage: {} + # WASM source for compiled code, below: + # a000000000000000000000000000000000000001: + # balance: '0' + # nonce: '' + # storage: {} + # code: | + # (module + # (import "ethereum" "finish" (func $finish (param i32 i32))) + # (memory 1) + # (export "memory" (memory 0)) + # (export "main" (func $main (param i32))) + # (func $main + # (call $finish + # (i32.const 0) + # (i32.const 0) + # ) + # ) + # ) + # main contract, tx receiver + abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd: + balance: '100000000000' + code: | + (module + (import "ethereum" "create" (func $create (param i32 i32 i32 i32) (result i32))) + (import "ethereum" "storageStore" (func $storageStore (param i32 i32))) + + (memory 1) + ;; the inner contract to create + ;; see WASM source for compiled code, above + (data (i32.const 0) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ;; key1 + (data (i32.const 64) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\01") ;; key2 + (data (i32.const 256) "\00\61\73\6d\01\00\00\00\01\09\02\60\02\7f\7f\00\60\00\00\02\13\01\08\65\74\68\65\72\65\75\6d\06\66\69\6e\69\73\68\00\00\03\02\01\01\05\03\01\00\01\07\11\02\06\6d\65\6d\6f\72\79\02\00\04\6d\61\69\6e\00\01\0a\0a\01\08\00\41\00\41\00\10\00\0b") ;; init code + (export "memory" (memory 0)) + (export "main" (func $main)) + + (func $main + ;; memory layout + (local $memStoragekey1 i32) + (local $memStorageval1 i32) + (local $memStoragekey2 i32) + (local $memStorageval2 i32) + (local $memValue i32) + (local $memCode i32) + (local $codeLen i32) + + (set_local $memStoragekey1 (i32.const 0)) + (set_local $memStorageval1 (i32.const 32)) + (set_local $memStoragekey2 (i32.const 64)) + (set_local $memStorageval2 (i32.const 96)) + (set_local $memValue (i32.const 128)) + (set_local $memCode (i32.const 256)) + (set_local $codeLen (i32.const 54)) + + ;; we expect this to fail + (i32.store + (get_local $memStorageval2) + (call $create + ;; value offset + (get_local $memValue) + ;; data offset + (get_local $memCode) + ;; data length + (get_local $codeLen) + ;; result offset (new contract address) + (get_local $memStorageval1) + ) + ) + + ;; store the result (new contract address) + (call $storageStore + (get_local $memStoragekey1) + (get_local $memStorageval1) + ) + + ;; store the result of the CREATE + (call $storageStore + (get_local $memStoragekey2) + (get_local $memStorageval2) + ) + ) + ) + nonce: '' + storage: {} + expect: + - indexes: + data: !!int -1 + gas: !!int -1 + value: !!int -1 + network: + - ALL + result: + a94f5374fce5edbc8e2a8697c15331677e6ebf0b: + balance: '99917398810' + abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd: + # expect CREATE to return 1 (failure), and no created contract address + storage: { + 0: '', + 1: '0x0100000000000000000000000000000000000000000000000000000000000000', + } + transaction: + data: + - '' + gasLimit: + - '0x5000001' + gasPrice: '0x01' + nonce: '0x00' + secretKey: 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8 + to: 'abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd' + value: + - '0' From ea0475077d36a371803a1492c19db6785fcbc3e5 Mon Sep 17 00:00:00 2001 From: Lane Rettig Date: Sun, 7 Oct 2018 23:00:35 -0700 Subject: [PATCH 2/5] Comment --- .../stEWASMTests/initMalformedBytecodeInvalidMain.json | 2 +- .../stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json index 32d0c727b9c..acca5865019 100644 --- a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json +++ b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json @@ -5,7 +5,7 @@ "filledwith" : "testeth 1.4.0", "lllcversion" : "Version: 0.4.20-develop.2018.1.14+commit.0c20b6da.Darwin.appleclang", "source" : "src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml", - "sourceHash" : "cd93196f2d14b03720c74e30b018d58e5360662ce16bf1704e4c1c0acfb025df" + "sourceHash" : "1c7c24323f11351d283853056a2e1930380df4a1a4c98edea2a258b2728a60e4" }, "env" : { "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", diff --git a/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml b/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml index 3c4ef0643fd..a815c97ea1a 100644 --- a/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml +++ b/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml @@ -24,6 +24,7 @@ initMalformedBytecodeInvalidMain: # (import "ethereum" "finish" (func $finish (param i32 i32))) # (memory 1) # (export "memory" (memory 0)) + # ;; signature does not match definition for $main # (export "main" (func $main (param i32))) # (func $main # (call $finish From ab7b9837fb4ad4d6e2e4710708da132767139782 Mon Sep 17 00:00:00 2001 From: Lane Rettig Date: Sun, 7 Oct 2018 23:01:53 -0700 Subject: [PATCH 3/5] Add initMalformedBytecodeInvalidMainFromTx test Attempt to create from tx with init code with invalid signature for main --- ...nitMalformedBytecodeInvalidMainFromTx.json | 79 +++++++++++++++++++ ...lformedBytecodeInvalidMainFromTxFiller.yml | 54 +++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json create mode 100644 src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFromTxFiller.yml diff --git a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json new file mode 100644 index 00000000000..5ed73c37164 --- /dev/null +++ b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json @@ -0,0 +1,79 @@ +{ + "initMalformedBytecodeInvalidMainFromTx" : { + "_info" : { + "comment" : "", + "filledwith" : "testeth 1.4.0", + "lllcversion" : "Version: 0.4.20-develop.2018.1.14+commit.0c20b6da.Darwin.appleclang", + "source" : "src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFromTxFiller.yml", + "sourceHash" : "0304c83d2d0ec956a069face52f49e0b07a1ff12fd3fe7e62872c351c62df6ea" + }, + "env" : { + "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x020000", + "currentGasLimit" : "0x05500000", + "currentNumber" : "0x01", + "currentTimestamp" : "0x03e8", + "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "post" : { + "Byzantium" : [ + { + "hash" : "0xb68c4f86df4814d2b034aa07649f48b6f6076c51df1328ba31a83af2cd4078cb", + "indexes" : { + "data" : 0, + "gas" : 0, + "value" : 0 + }, + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "postState" : { + "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "0xe048", + "code" : "", + "nonce" : "0x00", + "storage" : { + } + }, + "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { + "balance" : "0x00", + "code" : "", + "nonce" : "0x01", + "storage" : { + } + }, + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x17487607b8", + "code" : "", + "nonce" : "0x01", + "storage" : { + } + } + } + } + ] + }, + "pre" : { + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174876e800", + "code" : "", + "nonce" : "0x00", + "storage" : { + } + } + }, + "transaction" : { + "data" : [ + "0x0061736d0100000001090260027f7f0060000002130108657468657265756d0666696e6973680000030201010503010001071102066d656d6f72790200046d61696e00010a0a0108004100410010000b" + ], + "gasLimit" : [ + "0x5000001" + ], + "gasPrice" : "0x01", + "nonce" : "0x00", + "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : [ + "0x00" + ] + } + } +} \ No newline at end of file diff --git a/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFromTxFiller.yml b/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFromTxFiller.yml new file mode 100644 index 00000000000..1499982ad48 --- /dev/null +++ b/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFromTxFiller.yml @@ -0,0 +1,54 @@ +# Test malformed bytecode (has start) in init on create from tx +initMalformedBytecodeInvalidMainFromTx: + env: + currentCoinbase: 2adc25665018aa1fe0e6bc666dac8fc2697ff9ba + currentDifficulty: '0x020000' + currentGasLimit: '89128960' + currentNumber: '1' + currentTimestamp: '1000' + previousHash: 5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6 + pre: + # tx sender + a94f5374fce5edbc8e2a8697c15331677e6ebf0b: + balance: '100000000000' + code: '' + nonce: '' + storage: {} + expect: + - indexes: + data: !!int -1 + gas: !!int -1 + value: !!int -1 + network: + - ALL + result: + a94f5374fce5edbc8e2a8697c15331677e6ebf0b: + balance: '99916113919' + # newly-created contract + # expect code to be empty since create should fail + 6295ee1b4f6dd65047762f924ecd367c17eabf8f: + shouldnotexist: 1 + transaction: + data: + - | + (module + (import "ethereum" "finish" (func $finish (param i32 i32))) + (memory 1) + (export "memory" (memory 0)) + (export "main" (func $main (param i32))) + + (func $main + (call $finish + (i32.const 0) + (i32.const 0) + ) + ) + ) + gasLimit: + - '0x5000001' + gasPrice: '0x01' + nonce: '0x00' + secretKey: 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8 + to: '' + value: + - '0' From 6547d153b6a6dc98a42e14252a02d35262a6fdd5 Mon Sep 17 00:00:00 2001 From: Lane Rettig Date: Mon, 8 Oct 2018 18:40:02 -0700 Subject: [PATCH 4/5] Update bytecode for malformed main export --- .../initMalformedBytecodeInvalidMain.json | 31 ++++++++++++++++--- ...nitMalformedBytecodeInvalidMainFromTx.json | 10 +++--- ...initMalformedBytecodeInvalidMainFiller.yml | 8 ++--- ...lformedBytecodeInvalidMainFromTxFiller.yml | 5 +-- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json index acca5865019..de1f453003b 100644 --- a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json +++ b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json @@ -5,7 +5,7 @@ "filledwith" : "testeth 1.4.0", "lllcversion" : "Version: 0.4.20-develop.2018.1.14+commit.0c20b6da.Darwin.appleclang", "source" : "src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml", - "sourceHash" : "1c7c24323f11351d283853056a2e1930380df4a1a4c98edea2a258b2728a60e4" + "sourceHash" : "03f70fd9b4b4d8eb9e2433cec197661ad3ba4cddcecd8c0279c21c1e3a39fa55" }, "env" : { "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", @@ -18,13 +18,36 @@ "post" : { "Byzantium" : [ { - "hash" : "0x23966ce6a5f0987baa9fd747eb48e750d57dbf12a3df2c15bf55b15b85743c9a", + "hash" : "0xf235f315640a9e604f3aa5d1e659557d59e8b8f3d441b25df33dd01b85023f74", "indexes" : { "data" : 0, "gas" : 0, "value" : 0 }, - "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "postState" : { + "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "0x05000001", + "code" : "", + "nonce" : "0x00", + "storage" : { + } + }, + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174376e7ff", + "code" : "", + "nonce" : "0x01", + "storage" : { + } + }, + "0xabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd" : { + "balance" : "0x174876e800", + "code" : "0x0061736d0100000001110360047f7f7f7f017f60027f7f00600000022b0208657468657265756d06637265617465000008657468657265756d0c73746f7261676553746f72650001030201020503010001071102066d656d6f72790200046d61696e00020a42014001077f410021004120210141c000210241e00021034180012104418002210541d10021062003200420052006200110003602002000200110012002200310010b0ba301030041000b2000000000000000000000000000000000000000000000000000000000000000000041c0000b200000000000000000000000000000000000000000000000000000000000000001004180020b510061736d01000000010a0260027f7f0060017f0002130108657468657265756d0666696e6973680000030201010503010001071102066d656d6f72790200046d61696e00010a0a0108004100410010000b", + "nonce" : "0x00", + "storage" : { + } + } + } } ] }, @@ -38,7 +61,7 @@ }, "0xabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd" : { "balance" : "0x174876e800", - "code" : "0x0061736d0100000001110360047f7f7f7f017f60027f7f00600000022b0208657468657265756d06637265617465000008657468657265756d0c73746f7261676553746f72650001030201020503010001071102066d656d6f72790200046d61696e00020a41013f01077f410021004120210141c000210241e000210341800121044180022105413621062003200420052006200110003602002000200110012002200310010b0ba201030041000b2000000000000000000000000000000000000000000000000000000000000000000041c0000b200000000000000000000000000000000000000000000000000000000000000001004180020b500061736d0100000001090260027f7f0060000002130108657468657265756d0666696e6973680000030201010503010001071102066d656d6f72790200046d61696e00010a0a0108004100410010000b", + "code" : "0x0061736d0100000001110360047f7f7f7f017f60027f7f00600000022b0208657468657265756d06637265617465000008657468657265756d0c73746f7261676553746f72650001030201020503010001071102066d656d6f72790200046d61696e00020a42014001077f410021004120210141c000210241e00021034180012104418002210541d10021062003200420052006200110003602002000200110012002200310010b0ba301030041000b2000000000000000000000000000000000000000000000000000000000000000000041c0000b200000000000000000000000000000000000000000000000000000000000000001004180020b510061736d01000000010a0260027f7f0060017f0002130108657468657265756d0666696e6973680000030201010503010001071102066d656d6f72790200046d61696e00010a0a0108004100410010000b", "nonce" : "0x00", "storage" : { } diff --git a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json index 5ed73c37164..89c7952c55e 100644 --- a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json +++ b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json @@ -5,7 +5,7 @@ "filledwith" : "testeth 1.4.0", "lllcversion" : "Version: 0.4.20-develop.2018.1.14+commit.0c20b6da.Darwin.appleclang", "source" : "src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFromTxFiller.yml", - "sourceHash" : "0304c83d2d0ec956a069face52f49e0b07a1ff12fd3fe7e62872c351c62df6ea" + "sourceHash" : "1dec9ea5bedb9bf48b8ab3244d493f746702068a8dc97bc5e2715eb8e8442e3f" }, "env" : { "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", @@ -18,7 +18,7 @@ "post" : { "Byzantium" : [ { - "hash" : "0xb68c4f86df4814d2b034aa07649f48b6f6076c51df1328ba31a83af2cd4078cb", + "hash" : "0xe26615f8ea7db8cb51f9cf5b10d64c2bd5e8d34cae7b800be0c6109ee45c349a", "indexes" : { "data" : 0, "gas" : 0, @@ -27,7 +27,7 @@ "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "postState" : { "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { - "balance" : "0xe048", + "balance" : "0xe0cc", "code" : "", "nonce" : "0x00", "storage" : { @@ -41,7 +41,7 @@ } }, "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "0x17487607b8", + "balance" : "0x1748760734", "code" : "", "nonce" : "0x01", "storage" : { @@ -62,7 +62,7 @@ }, "transaction" : { "data" : [ - "0x0061736d0100000001090260027f7f0060000002130108657468657265756d0666696e6973680000030201010503010001071102066d656d6f72790200046d61696e00010a0a0108004100410010000b" + "0x0061736d01000000010a0260027f7f0060017f0002130108657468657265756d0666696e6973680000030201010503010001071102066d656d6f72790200046d61696e00010a0a0108004100410010000b" ], "gasLimit" : [ "0x5000001" diff --git a/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml b/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml index a815c97ea1a..1df1505819b 100644 --- a/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml +++ b/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFiller.yml @@ -25,8 +25,8 @@ initMalformedBytecodeInvalidMain: # (memory 1) # (export "memory" (memory 0)) # ;; signature does not match definition for $main - # (export "main" (func $main (param i32))) - # (func $main + # (export "main" (func $main)) + # (func $main (param i32) # (call $finish # (i32.const 0) # (i32.const 0) @@ -46,7 +46,7 @@ initMalformedBytecodeInvalidMain: ;; see WASM source for compiled code, above (data (i32.const 0) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ;; key1 (data (i32.const 64) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\01") ;; key2 - (data (i32.const 256) "\00\61\73\6d\01\00\00\00\01\09\02\60\02\7f\7f\00\60\00\00\02\13\01\08\65\74\68\65\72\65\75\6d\06\66\69\6e\69\73\68\00\00\03\02\01\01\05\03\01\00\01\07\11\02\06\6d\65\6d\6f\72\79\02\00\04\6d\61\69\6e\00\01\0a\0a\01\08\00\41\00\41\00\10\00\0b") ;; init code + (data (i32.const 256) "\00\61\73\6d\01\00\00\00\01\0a\02\60\02\7f\7f\00\60\01\7f\00\02\13\01\08\65\74\68\65\72\65\75\6d\06\66\69\6e\69\73\68\00\00\03\02\01\01\05\03\01\00\01\07\11\02\06\6d\65\6d\6f\72\79\02\00\04\6d\61\69\6e\00\01\0a\0a\01\08\00\41\00\41\00\10\00\0b") ;; init code (export "memory" (memory 0)) (export "main" (func $main)) @@ -66,7 +66,7 @@ initMalformedBytecodeInvalidMain: (set_local $memStorageval2 (i32.const 96)) (set_local $memValue (i32.const 128)) (set_local $memCode (i32.const 256)) - (set_local $codeLen (i32.const 54)) + (set_local $codeLen (i32.const 81)) ;; we expect this to fail (i32.store diff --git a/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFromTxFiller.yml b/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFromTxFiller.yml index 1499982ad48..655ee621521 100644 --- a/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFromTxFiller.yml +++ b/src/GeneralStateTestsFiller/stEWASMTests/initMalformedBytecodeInvalidMainFromTxFiller.yml @@ -35,9 +35,10 @@ initMalformedBytecodeInvalidMainFromTx: (import "ethereum" "finish" (func $finish (param i32 i32))) (memory 1) (export "memory" (memory 0)) - (export "main" (func $main (param i32))) + ;; signature does not match definition for $main + (export "main" (func $main)) - (func $main + (func $main (param i32) (call $finish (i32.const 0) (i32.const 0) From 346b339bc65ab3e08a2aaaa0c77baffa45dc0f3e Mon Sep 17 00:00:00 2001 From: Lane Rettig Date: Thu, 25 Oct 2018 23:10:10 +0200 Subject: [PATCH 5/5] Rebase and refill tests Since https://github.com/ewasm/hera/issues/442 was fixed --- .../initMalformedBytecodeInvalidMain.json | 27 ++----------------- ...nitMalformedBytecodeInvalidMainFromTx.json | 27 ++----------------- 2 files changed, 4 insertions(+), 50 deletions(-) diff --git a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json index de1f453003b..a78e8eaef34 100644 --- a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json +++ b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMain.json @@ -18,36 +18,13 @@ "post" : { "Byzantium" : [ { - "hash" : "0xf235f315640a9e604f3aa5d1e659557d59e8b8f3d441b25df33dd01b85023f74", + "hash" : "0xd92008e9f7ebf5eea7359e453c254b916060eb9786b5e807d252e436710e441a", "indexes" : { "data" : 0, "gas" : 0, "value" : 0 }, - "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "postState" : { - "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { - "balance" : "0x05000001", - "code" : "", - "nonce" : "0x00", - "storage" : { - } - }, - "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "0x174376e7ff", - "code" : "", - "nonce" : "0x01", - "storage" : { - } - }, - "0xabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd" : { - "balance" : "0x174876e800", - "code" : "0x0061736d0100000001110360047f7f7f7f017f60027f7f00600000022b0208657468657265756d06637265617465000008657468657265756d0c73746f7261676553746f72650001030201020503010001071102066d656d6f72790200046d61696e00020a42014001077f410021004120210141c000210241e00021034180012104418002210541d10021062003200420052006200110003602002000200110012002200310010b0ba301030041000b2000000000000000000000000000000000000000000000000000000000000000000041c0000b200000000000000000000000000000000000000000000000000000000000000001004180020b510061736d01000000010a0260027f7f0060017f0002130108657468657265756d0666696e6973680000030201010503010001071102066d656d6f72790200046d61696e00010a0a0108004100410010000b", - "nonce" : "0x00", - "storage" : { - } - } - } + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" } ] }, diff --git a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json index 89c7952c55e..d9fb8d0746a 100644 --- a/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json +++ b/GeneralStateTests/stEWASMTests/initMalformedBytecodeInvalidMainFromTx.json @@ -18,36 +18,13 @@ "post" : { "Byzantium" : [ { - "hash" : "0xe26615f8ea7db8cb51f9cf5b10d64c2bd5e8d34cae7b800be0c6109ee45c349a", + "hash" : "0x60f7870ae7c1fb1176a96382cbfe1c1dfc83cb08081728a7396e901a70832a36", "indexes" : { "data" : 0, "gas" : 0, "value" : 0 }, - "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", - "postState" : { - "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { - "balance" : "0xe0cc", - "code" : "", - "nonce" : "0x00", - "storage" : { - } - }, - "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { - "balance" : "0x00", - "code" : "", - "nonce" : "0x01", - "storage" : { - } - }, - "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "0x1748760734", - "code" : "", - "nonce" : "0x01", - "storage" : { - } - } - } + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" } ] },