Merge pull request #1485 from ethereum/fixRecorder

Fix Recorder
pull/3094/head
yann300 6 years ago committed by GitHub
commit 3d4c0751b1
  1. 8
      .circleci/config.yml
  2. 1
      src/app/tabs/run-tab.js
  3. 6
      src/recorder.js
  4. 5
      test-browser/tests/units/testRecorder.js

@ -26,10 +26,10 @@ jobs:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- dep-bundle-20-{{ checksum "package.json" }} - dep-bundle-21-{{ checksum "package.json" }}
- run: npm install - run: npm install
- save_cache: - save_cache:
key: dep-bundle-20-{{ checksum "package.json" }} key: dep-bundle-21-{{ checksum "package.json" }}
paths: paths:
- ~/repo/node_modules - ~/repo/node_modules
- run: npm run lint && npm run test && npm run make-mock-compiler && npm run build - run: npm run lint && npm run test && npm run make-mock-compiler && npm run build
@ -46,10 +46,10 @@ jobs:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- dep-bundle-15-{{ checksum "package.json" }} - dep-bundle-16-{{ checksum "package.json" }}
- run: npm install - run: npm install
- save_cache: - save_cache:
key: dep-bundle-15-{{ checksum "package.json" }} key: dep-bundle-16-{{ checksum "package.json" }}
paths: paths:
- ~/repo/node_modules - ~/repo/node_modules
- run: npm run build_debugger - run: npm run build_debugger

@ -403,6 +403,7 @@ function contractDropdown (events, self) {
} else { } 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')}`) 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) => { 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) createInstanceCallback(error, selectedContract, data)
}) })
} }

@ -51,8 +51,8 @@ class Recorder {
record.to = `created{${creationTimestamp}}` record.to = `created{${creationTimestamp}}`
record.abi = this.data._contractABIReferences[creationTimestamp] record.abi = this.data._contractABIReferences[creationTimestamp]
} }
record.name = payLoad.funAbi.name record.name = payLoad.funAbi.name
record.inputs = txHelper.serializeInputs(payLoad.funAbi)
record.type = payLoad.funAbi.type record.type = payLoad.funAbi.type
udapp.getAccounts((error, accounts) => { udapp.getAccounts((error, accounts) => {
@ -201,8 +201,10 @@ class Recorder {
var fnABI var fnABI
if (tx.record.type === 'constructor') { if (tx.record.type === 'constructor') {
fnABI = txHelper.getConstructorInterface(abi) fnABI = txHelper.getConstructorInterface(abi)
} else if (tx.record.type === 'fallback') {
fnABI = txHelper.getFallbackInterface(abi)
} else { } else {
fnABI = txHelper.getFunction(abi, record.name) fnABI = txHelper.getFunction(abi, record.name + record.inputs)
} }
if (!fnABI) { if (!fnABI) {
modal.alert('cannot resolve abi of ' + JSON.stringify(record, null, '\t') + '. Execution stopped at ' + index) modal.alert('cannot resolve abi of ' + JSON.stringify(record, null, '\t') + '. Execution stopped at ' + index)

@ -87,6 +87,7 @@ var records = `{
"contractName": "testLib", "contractName": "testLib",
"bytecode": "60606040523415600e57600080fd5b60968061001c6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c146044575b600080fd5b604a6060565b6040518082815260200191505060405180910390f35b6000610d809050905600a165627a7a7230582022d123b15248b8176151f8d45c2dc132063bcc9bb8d5cd652aea7efae362c8050029", "bytecode": "60606040523415600e57600080fd5b60968061001c6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c146044575b600080fd5b604a6060565b6040518082815260200191505060405180910390f35b6000610d809050905600a165627a7a7230582022d123b15248b8176151f8d45c2dc132063bcc9bb8d5cd652aea7efae362c8050029",
"linkReferences": {}, "linkReferences": {},
"inputs": "()",
"type": "constructor", "type": "constructor",
"from": "account{0}" "from": "account{0}"
} }
@ -113,6 +114,7 @@ var records = `{
}, },
"name": "", "name": "",
"type": "constructor", "type": "constructor",
"inputs": "(uint256)",
"from": "account{0}" "from": "account{0}"
} }
}, },
@ -127,6 +129,7 @@ var records = `{
"to": "created{1512830015080}", "to": "created{1512830015080}",
"abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec", "abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec",
"name": "set", "name": "set",
"inputs": "(uint256,address)",
"type": "function", "type": "function",
"from": "account{0}" "from": "account{0}"
} }
@ -244,6 +247,7 @@ var scenario = {
'linkReferences': {}, 'linkReferences': {},
'name': '', 'name': '',
'type': 'constructor', 'type': 'constructor',
'inputs': '(uint256)',
'from': 'account{0}' 'from': 'account{0}'
} }
}, },
@ -257,6 +261,7 @@ var scenario = {
'to': 'created{1512912691086}', 'to': 'created{1512912691086}',
'abi': '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798', 'abi': '0x54a8c0ab653c15bfb48b47fd011ba2b9617af01cb45cab344acd57c924d56798',
'name': 'set', 'name': 'set',
'inputs': '(uint256)',
'type': 'function', 'type': 'function',
'from': 'account{0}' 'from': 'account{0}'
} }

Loading…
Cancel
Save