Merge pull request #991 from ethereum/improverecorder

Recorder: resolve input parameters that might contains "created{address}"
pull/1/head
yann300 7 years ago committed by GitHub
commit 247bac875e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      src/recorder.js
  2. 4
      test-browser/tests/units/testRecorder.js

@ -212,6 +212,26 @@ class Recorder {
cb('cannot resolve abi')
return
}
if (tx.record.parameters) {
/* check if we have some params to resolve */
try {
tx.record.parameters.forEach((value, index) => {
var isString = true
if (typeof value !== 'string') {
isString = false
value = JSON.stringify(value)
}
for (var timestamp in self.data._createdContractsReverse) {
value = value.replace(new RegExp('created\\{' + timestamp + '\\}', 'g'), self.data._createdContractsReverse[timestamp])
}
if (!isString) value = JSON.parse(value)
tx.record.parameters[index] = value
})
} catch (e) {
modal.alert('cannot resolve input parameters ' + JSON.stringify(tx.record.parameters) + '. Execution stopped at ' + index)
return
}
}
var data = format.encodeData(fnABI, tx.record.parameters, tx.record.bytecode)
if (data.error) {
modal.alert(data.error + '. Record:' + JSON.stringify(record, null, '\t') + '. Execution stopped at ' + index)

@ -16,7 +16,7 @@ module.exports = {
.clickFunction('getFromLib - call')
.waitForElementPresent('div[class^="contractProperty"] div[class^="value"]')
.perform((client, done) => {
contractHelper.verifyCallReturnValue(browser, '0x35ef07393b57464e93deb59175ff72e6499450cf', ['0: uint256: 1', '0: uint256: 3456', '0: address: 0xca35b7d915458ef540ade6068dfe2f44e8fa733c'], () => {
contractHelper.verifyCallReturnValue(browser, '0x35ef07393b57464e93deb59175ff72e6499450cf', ['0: uint256: 1', '0: uint256: 3456', '0: address: 0x35ef07393b57464e93deb59175ff72e6499450cf'], () => {
done()
})
})
@ -115,7 +115,7 @@ var records = `{
"value": "1000000000000000000",
"parameters": [
1,
"0xca35b7d915458ef540ade6068dfe2f44e8fa733c"
"created{1512830015080}"
],
"to": "created{1512830015080}",
"abi": "0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec",

Loading…
Cancel
Save