From 97059d03026c3904aa56e52b2d3aa798138491a7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Aug 2018 16:58:02 +0200 Subject: [PATCH 1/6] inject contract name before creation --- src/app/tabs/run-tab.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index faf22a2556..60a40c3999 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -403,6 +403,7 @@ function contractDropdown (events, self) { } else { if (Object.keys(selectedContract.contract.object.evm.bytecode.linkReferences).length) self._deps.logCallback(`linking ${JSON.stringify(selectedContract.contract.object.evm.bytecode.linkReferences, null, '\t')} using ${JSON.stringify(contractMetadata.linkReferences, null, '\t')}`) txFormat.encodeConstructorCallAndLinkLibraries(selectedContract.contract.object, args, constructor, contractMetadata.linkReferences, selectedContract.contract.object.evm.bytecode.linkReferences, (error, data) => { + data.contractName = selectedContract.name createInstanceCallback(error, selectedContract, data) }) } From 1c898b8476f558bec38e4c4cce845acd65d0c3c9 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Aug 2018 16:58:51 +0200 Subject: [PATCH 2/6] save inputs list in record --- src/recorder.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/recorder.js b/src/recorder.js index 5bf6bd7863..12aedf769e 100644 --- a/src/recorder.js +++ b/src/recorder.js @@ -51,8 +51,8 @@ class Recorder { record.to = `created{${creationTimestamp}}` record.abi = this.data._contractABIReferences[creationTimestamp] } - record.name = payLoad.funAbi.name + record.inputs = txHelper.serializeInputs(payLoad.funAbi) record.type = payLoad.funAbi.type udapp.getAccounts((error, accounts) => { @@ -202,7 +202,7 @@ class Recorder { if (tx.record.type === 'constructor') { fnABI = txHelper.getConstructorInterface(abi) } else { - fnABI = txHelper.getFunction(abi, record.name) + fnABI = txHelper.getFunction(abi, record.name + record.inputs) } if (!fnABI) { modal.alert('cannot resolve abi of ' + JSON.stringify(record, null, '\t') + '. Execution stopped at ' + index) From c31726cec2e818cf5589035f9ce132ad94585db3 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Aug 2018 16:59:02 +0200 Subject: [PATCH 3/6] manage fallback function --- src/recorder.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/recorder.js b/src/recorder.js index 12aedf769e..1f14c472ca 100644 --- a/src/recorder.js +++ b/src/recorder.js @@ -201,6 +201,8 @@ class Recorder { var fnABI if (tx.record.type === 'constructor') { fnABI = txHelper.getConstructorInterface(abi) + } else if (tx.record.type === 'fallback') { + fnABI = txHelper.getFallbackInterface(abi) } else { fnABI = txHelper.getFunction(abi, record.name + record.inputs) } From 352bc0b15953565102d9550986e9205a8b964837 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Aug 2018 18:43:13 +0200 Subject: [PATCH 4/6] Update config.yml --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 74c3834eb4..61aba18604 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,10 +26,10 @@ jobs: - checkout - restore_cache: keys: - - dep-bundle-20-{{ checksum "package.json" }} + - dep-bundle-21-{{ checksum "package.json" }} - run: npm install - save_cache: - key: dep-bundle-20-{{ checksum "package.json" }} + key: dep-bundle-21-{{ checksum "package.json" }} paths: - ~/repo/node_modules - run: npm run lint && npm run test && npm run make-mock-compiler && npm run build @@ -46,10 +46,10 @@ jobs: - checkout - restore_cache: keys: - - dep-bundle-15-{{ checksum "package.json" }} + - dep-bundle-16-{{ checksum "package.json" }} - run: npm install - save_cache: - key: dep-bundle-15-{{ checksum "package.json" }} + key: dep-bundle-16-{{ checksum "package.json" }} paths: - ~/repo/node_modules - run: npm run build_debugger From 4f8df9b3b0bf71cefc1eb8c548c91ebd7281ff88 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Aug 2018 22:15:40 +0200 Subject: [PATCH 5/6] Fix tests --- test-browser/tests/units/testRecorder.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test-browser/tests/units/testRecorder.js b/test-browser/tests/units/testRecorder.js index 2258594352..398ca540e3 100644 --- a/test-browser/tests/units/testRecorder.js +++ b/test-browser/tests/units/testRecorder.js @@ -87,6 +87,7 @@ var records = `{ "contractName": "testLib", "bytecode": "60606040523415600e57600080fd5b60968061001c6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c146044575b600080fd5b604a6060565b6040518082815260200191505060405180910390f35b6000610d809050905600a165627a7a7230582022d123b15248b8176151f8d45c2dc132063bcc9bb8d5cd652aea7efae362c8050029", "linkReferences": {}, + "inputs": "()", "type": "constructor", "from": "account{0}" } @@ -113,6 +114,7 @@ var records = `{ }, "name": "", "type": "constructor", + "inputs": "(uint256)", "from": "account{0}" } }, @@ -127,6 +129,7 @@ var records = `{ "to": "created{1512830015080}", "abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec", "name": "set", + "inputs": "(uint256,address)" "type": "function", "from": "account{0}" } @@ -244,6 +247,7 @@ var scenario = { 'linkReferences': {}, 'name': '', 'type': 'constructor', + 'inputs': '(uint256)' 'from': 'account{0}' } }, @@ -257,6 +261,7 @@ var scenario = { 'to': 'created{1512912691086}', 'abi': '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798', 'name': 'set', + 'inputs': '(uint256)' 'type': 'function', 'from': 'account{0}' } From 5c69a751210d593607a525977852c0805fe76d98 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Aug 2018 22:20:35 +0200 Subject: [PATCH 6/6] Fix standard --- test-browser/tests/units/testRecorder.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test-browser/tests/units/testRecorder.js b/test-browser/tests/units/testRecorder.js index 398ca540e3..aca1892c48 100644 --- a/test-browser/tests/units/testRecorder.js +++ b/test-browser/tests/units/testRecorder.js @@ -129,7 +129,7 @@ var records = `{ "to": "created{1512830015080}", "abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec", "name": "set", - "inputs": "(uint256,address)" + "inputs": "(uint256,address)", "type": "function", "from": "account{0}" } @@ -247,7 +247,7 @@ var scenario = { 'linkReferences': {}, 'name': '', 'type': 'constructor', - 'inputs': '(uint256)' + 'inputs': '(uint256)', 'from': 'account{0}' } }, @@ -261,7 +261,7 @@ var scenario = { 'to': 'created{1512912691086}', 'abi': '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798', 'name': 'set', - 'inputs': '(uint256)' + 'inputs': '(uint256)', 'type': 'function', 'from': 'account{0}' }