Commit e2b0bc2fe56ea4ae83d0bf5783132b8cdaa7a460
Merge pull request #27 from ewasm/fix-calldatacopy
Fix callDataCopywanderer authored on 8/17/2016, 6:18:35 PM
GitHub committed on 8/17/2016, 6:18:35 PM
Parent: d39de3e772adfb891056fd28b873a362f305e36d
Parent: d42548aec13093f0e30edf69632e67ad56a0cec2
Files changed
interface.js | changed |
tests/interface/callDataCopy.json | added |
tests/interface/callDataCopy.wast | added |
interface.js | ||
---|---|---|
@@ -143,9 +143,9 @@ | ||
143 | 143 | * @param {integer} dataOffset the offset in the input data |
144 | 144 | * @param {integer} length the length of data to copy |
145 | 145 | */ |
146 | 146 | callDataCopy (offset, dataOffset, length) { |
147 | - const callData = Buffer.from(this.environment.callData.slice(dataOffset, dataOffset + length)).reverse() | |
147 | + const callData = this.environment.callData.slice(dataOffset, dataOffset + length) | |
148 | 148 | this.setMemory(offset, length, callData) |
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
tests/interface/callDataCopy.json | ||
---|---|---|
@@ -1,0 +1,3 @@ | ||
1 | +{ | |
2 | + "callData": "596f75206172652077616974696e6720666f7220746865207265766f6c7574696f6e3f204c657420697420626521204d79206f776e20626567616e2061206c6f6e672074696d652061676f21205768656e20796f752077696c6c2062652072656164792e2e2e4920776f6ee2809974206d696e6420676f696e6720616c6f6e67207769746820796f7520666f722061207768696c652e20427574207768656e20796f75e280996c6c2073746f702c2049207368616c6c20636f6e74696e7565206f6e206d7920696e73616e6520616e6420747269756d7068616e742077617920746f776172642074686520677265617420616e64207375626c696d6520636f6e7175657374206f6620746865206e6f7468696e6721" | |
3 | +} |
tests/interface/callDataCopy.wast | ||
---|---|---|
@@ -1,0 +1,18 @@ | ||
1 | +;; calldata is "596f75206172652077616974...", but i64.load works in LSB mode | |
2 | +(module | |
3 | + (memory 1) | |
4 | + (import $callDataCopy "ethereum" "callDataCopy" (param i32 i32 i32)) | |
5 | + | |
6 | + (export "memory" memory) | |
7 | + (export "test" 0) | |
8 | + (func | |
9 | + (block | |
10 | + (call_import $callDataCopy (i32.const 0) (i32.const 0) (i32.const 8)) | |
11 | + | |
12 | + (if (i64.eq (i64.load (i32.const 0)) (i64.const 0x2065726120756f59)) | |
13 | + (return) | |
14 | + ) | |
15 | + (unreachable) | |
16 | + ) | |
17 | + ) | |
18 | +) |
Built with git-ssb-web