-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Init web3.eth.createAccessList * Init e2e test for createAccessList * Add createAccessList method to method wrappers for contracts * Update failing tests to use dynamic address * Add check to not run tests if ENV not Geth * Add createAccessList to docs * Update CHANGELOG.md * Update docs/web3-eth-contract.rst * Update docs/web3-eth-contract.rst * Update docs/web3-eth-contract.rst * Update docs/web3-eth-contract.rst * Update docs/web3-eth-contract.rst * Update docs/web3-eth.rst * Remove duplicate line in CHANGELOG * Move CHANGELOG addition to 1.6.1
- Loading branch information
1 parent
dbb4350
commit 3a3cb32
Showing
7 changed files
with
286 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
var assert = require('assert'); | ||
var Basic = require('./sources/Basic'); | ||
var Misc = require('./sources/Misc'); | ||
var utils = require('./helpers/test.utils'); | ||
var Web3 = utils.getWeb3(); | ||
|
||
describe('method.call [ @E2E ]', function () { | ||
var web3; | ||
var accounts; | ||
var basic; | ||
var instance; | ||
var options; | ||
|
||
var basicOptions = { | ||
data: Basic.bytecode, | ||
gasPrice: 1000000000, // Default gasPrice set by Geth | ||
gas: 4000000 | ||
}; | ||
|
||
var miscOptions = { | ||
data: Misc.bytecode, | ||
gasPrice: 1000000000, // Default gasPrice set by Geth | ||
gas: 4000000 | ||
}; | ||
|
||
describe('http', function () { | ||
before(async function () { | ||
web3 = new Web3('http://localhost:8545'); | ||
accounts = await web3.eth.getAccounts(); | ||
|
||
basic = new web3.eth.Contract(Basic.abi, basicOptions); | ||
instance = await basic.deploy().send({from: accounts[0]}); | ||
}) | ||
|
||
it('returns expected access list for getValue', async function () { | ||
// Currently only Geth supports eth_createAccessList | ||
if (process.env.GANACHE || global.window ) return | ||
|
||
var expected = { | ||
accessList: [ | ||
{ | ||
address: instance.options.address.toLowerCase(), | ||
storageKeys: ["0x0000000000000000000000000000000000000000000000000000000000000000"] | ||
} | ||
], | ||
gasUsed: '0x644e' | ||
}; | ||
|
||
assert.deepEqual( | ||
await instance.methods.getValue().createAccessList({from: accounts[0]}), | ||
expected | ||
); | ||
}); | ||
|
||
it('returns expected access list for setValue', async function () { | ||
// Currently only Geth supports eth_createAccessList | ||
if (process.env.GANACHE || global.window ) return | ||
|
||
var expected = { | ||
accessList: [ | ||
{ | ||
address: instance.options.address.toLowerCase(), | ||
storageKeys: ["0x0000000000000000000000000000000000000000000000000000000000000000"] | ||
} | ||
], | ||
gasUsed: '0xb2f5' | ||
} | ||
|
||
|
||
assert.deepEqual( | ||
await instance.methods.setValue(1).createAccessList({from: accounts[0]}), | ||
expected | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
var testMethod = require('./helpers/test.method.js'); | ||
|
||
var method = 'createAccessList'; | ||
|
||
var tests = [{ | ||
args: [{ | ||
from: '0x3bc5885c2941c5cda454bdb4a8c88aa7f248e312', | ||
data: '0x20965255', | ||
gasPrice: '0x3b9aca00', | ||
gas: '0x3d0900', | ||
to: '0x00f5f5f3a25f142fafd0af24a754fafa340f32c7' | ||
}], | ||
formattedArgs: [ | ||
{ | ||
from: '0x3bc5885c2941c5cda454bdb4a8c88aa7f248e312', | ||
data: '0x20965255', | ||
gasPrice: '0x3b9aca00', | ||
gas: '0x3d0900', | ||
to: '0x00f5f5f3a25f142fafd0af24a754fafa340f32c7' | ||
}, | ||
'latest' | ||
], | ||
result: { | ||
"accessList": [ | ||
{ | ||
"address": "0x00f5f5f3a25f142fafd0af24a754fafa340f32c7", | ||
"storageKeys": [ | ||
"0x0000000000000000000000000000000000000000000000000000000000000000" | ||
] | ||
} | ||
], | ||
"gasUsed": "0x644e" | ||
}, | ||
formattedResult: { | ||
"accessList": [ | ||
{ | ||
"address": "0x00f5f5f3a25f142fafd0af24a754fafa340f32c7", | ||
"storageKeys": [ | ||
"0x0000000000000000000000000000000000000000000000000000000000000000" | ||
] | ||
} | ||
], | ||
"gasUsed": "0x644e" | ||
}, | ||
call: 'eth_'+ method | ||
}]; | ||
|
||
testMethod.runTests('eth', method, tests); | ||
|