Merge pull request #1277 from ethereum/useEthersForAbiCoding

Use ethers for abi coding
pull/1/head
yann300 7 years ago committed by GitHub
commit 4a71d9d5c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .circleci/config.yml
  2. 2
      src/app/execution/txLogger.js
  3. 16
      test-browser/helpers/contracts.js
  4. 34
      test-browser/tests/compiling.js
  5. 2
      test-browser/tests/units/testRecorder.js

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

@ -264,7 +264,7 @@ function context (self, opts) {
var val = data.tx.value var val = data.tx.value
var hash = data.tx.hash ? helper.shortenHexData(data.tx.hash) : '' var hash = data.tx.hash ? helper.shortenHexData(data.tx.hash) : ''
var input = data.tx.input ? helper.shortenHexData(data.tx.input) : '' var input = data.tx.input ? helper.shortenHexData(data.tx.input) : ''
var logs = data.logs && data.logs.decoded ? data.logs.decoded.length : 0 var logs = data.logs && data.logs.decoded && data.logs.decoded.length ? data.logs.decoded.length : 0
var block = data.tx.blockNumber || '' var block = data.tx.blockNumber || ''
var i = data.tx.transactionIndex var i = data.tx.transactionIndex
var value = val ? typeConversion.toInt(val) : 0 var value = val ? typeConversion.toInt(val) : 0

@ -135,13 +135,25 @@ function testFunction (fnFullName, txHash, log, expectedInput, expectedReturn, e
.click('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] div[class^="log"]') .click('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] div[class^="log"]')
.perform(function (client, done) { .perform(function (client, done) {
if (expectedReturn) { if (expectedReturn) {
client.assert.containsText('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #decodedoutput', expectedReturn) client.getText('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #decodedoutput', (result) => {
console.log(result)
var equal = deepequal(JSON.parse(result.value), JSON.parse(expectedReturn))
if (!equal) {
client.assert.fail('expected ' + expectedReturn + ' got ' + result.value, 'info about error', '')
}
})
} }
done() done()
}) })
.perform(function (client, done) { .perform(function (client, done) {
if (expectedEvent) { if (expectedEvent) {
client.assert.containsText('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #logs', expectedEvent) client.getText('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #logs', (result) => {
console.log(result)
var equal = deepequal(JSON.parse(result.value), JSON.parse(expectedEvent))
if (!equal) {
client.assert.fail('expected ' + expectedEvent + ' got ' + result.value, 'info about error', '')
}
})
} }
done() done()
if (callback) callback() if (callback) callback()

@ -78,7 +78,7 @@ function testReturnValues (browser, callback) {
"0": "bool: _b true", "0": "bool: _b true",
"1": "uint256: _u 345", "1": "uint256: _u 345",
"2": "int256: _i -345", "2": "int256: _i -345",
"3": "address: _a 0xca35b7d915458ef540ade6068dfe2f44e8fa733c" "3": "address: _a 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c"
}`) }`)
.pause(500) .pause(500)
.testFunction('retunValues2 - transact (not payable)', .testFunction('retunValues2 - transact (not payable)',
@ -98,7 +98,7 @@ function testReturnValues (browser, callback) {
'0x7faab07aeaafc8afe6bf283bb83be70c000dff381dec04e779354e354da14aff', '0x7faab07aeaafc8afe6bf283bb83be70c000dff381dec04e779354e354da14aff',
'[vm]\nfrom:0xca3...a733c\nto:testReturnValues.retunValues3() 0x5e7...26e9f\nvalue:0 wei\ndata:0x033...e0a7d\nlogs:0\nhash:0x7fa...14aff', null, `{ '[vm]\nfrom:0xca3...a733c\nto:testReturnValues.retunValues3() 0x5e7...26e9f\nvalue:0 wei\ndata:0x033...e0a7d\nlogs:0\nhash:0x7fa...14aff', null, `{
"0": "uint8: _en 2", "0": "uint8: _en 2",
"1": "int256[5][]: _a1 1,-45,-78,56,60, -1,42,334,-45455,-446, 1,10,-5435,45,-7" "1": "int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7"
}`).click('i[class^="clearinstance"]').perform(() => { callback(null, browser) }) }`).click('i[class^="clearinstance"]').perform(() => { callback(null, browser) })
}) })
} }
@ -121,19 +121,31 @@ function testInputValues (browser, callback) {
`[vm]\nfrom:0xca3...a733c\nto:test.inputValue2(uint256[3],bytes8[4]) 0x8c1...401f5\nvalue:0 wei\ndata:0x1b7...00000\nlogs:1\nhash:0x487...6ef7f`, `[vm]\nfrom:0xca3...a733c\nto:test.inputValue2(uint256[3],bytes8[4]) 0x8c1...401f5\nvalue:0 wei\ndata:0x1b7...00000\nlogs:1\nhash:0x487...6ef7f`,
{types: 'uint256[3] _n, bytes8[4] _b8', values: '[1,2,3], ["0x1234", "0x1234","0x1234","0x1234"]'}, {types: 'uint256[3] _n, bytes8[4] _b8', values: '[1,2,3], ["0x1234", "0x1234","0x1234","0x1234"]'},
`{ `{
"0": "uint256[3]: _nret 1, 2, 3", "0": "uint256[3]: _nret 1,2,3",
"1": "bytes8[4]: _b8ret 0x1234000000000000, 0x1234000000000000, 0x1234000000000000, 0x1234000000000000" "1": "bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000"
}`, `[ }`, `[
{ {
"topic": "d30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f", "topic": "d30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f",
"event": "event1", "event": "event1",
"args": [ "args": {
"-123", "0": "-123",
"000000000000000000000000000000000000000000000000000000000000007b", "1": "123",
"9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658", "2": {
"0x00001234", "indexed": true,
"test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test " "hash": "0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658"
] },
"3": "0x00001234",
"4": "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ",
"_i": "-123",
"_u": "123",
"_str": {
"indexed": true,
"hash": "0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658"
},
"_b": "0x00001234",
"_notIndexed": "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ",
"length": 5
}
} }
]`) ]`)
.click('i[class^="clearinstance"]').perform(() => { callback(null, browser) }) .click('i[class^="clearinstance"]').perform(() => { callback(null, browser) })

@ -16,7 +16,7 @@ module.exports = {
.clickFunction('getFromLib - call') .clickFunction('getFromLib - call')
.waitForElementPresent('div[class^="contractActionsContainer"] div[class^="value"] ul') .waitForElementPresent('div[class^="contractActionsContainer"] div[class^="value"] ul')
.perform((client, done) => { .perform((client, done) => {
contractHelper.verifyCallReturnValue(browser, '0x35ef07393b57464e93deb59175ff72e6499450cf', ['0: uint256: 1', '0: uint256: 3456', '0: address: 0x35ef07393b57464e93deb59175ff72e6499450cf'], () => { contractHelper.verifyCallReturnValue(browser, '0x35ef07393b57464e93deb59175ff72e6499450cf', ['0: uint256: 1', '0: uint256: 3456', '0: address: 0x35eF07393b57464e93dEB59175fF72E6499450cF'], () => {
done() done()
}) })
}) })

Loading…
Cancel
Save