From bffcaeacb922a2a1bf4c247b350fc76926bbdea2 Mon Sep 17 00:00:00 2001 From: Drygin Date: Wed, 16 Feb 2022 12:52:53 +0300 Subject: [PATCH] move to Alchemy node --- .env.example | 1 + .gitignore | 4 +++- README.md | 2 ++ hardhat.config.js | 2 +- test/instance.factory.proposal.test.js | 28 ++++++++++++++------------ test/instance.proposal.test.js | 24 +++++++++++----------- 6 files changed, 34 insertions(+), 27 deletions(-) diff --git a/.env.example b/.env.example index 48a8535..45366da 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ +ALCHEMY_KEY= etherscan_api_key= goerli_rpc_key= mainnet_rpc_key= diff --git a/.gitignore b/.gitignore index 376909a..02e59cc 100644 --- a/.gitignore +++ b/.gitignore @@ -106,4 +106,6 @@ dist artifacts cache coverage -coverage.json \ No newline at end of file +coverage.json + +.vscode \ No newline at end of file diff --git a/README.md b/README.md index 38b585e..217da7c 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,8 @@ yarn deploy:proposal:test The last step, or first depending on if you are simply proposing the proposal, is taking the address of the deployed proposal and calling: +// THIS IS ASSUMING YOU HAVE ENOUGH LOCKED TORN TO PROPOSE + ```bash yarn propose ``` diff --git a/hardhat.config.js b/hardhat.config.js index 0b39c3c..8cdeff9 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -37,7 +37,7 @@ module.exports = { networks: { hardhat: { forking: { - url: `https://mainnet.infura.io/v3/${process.env.mainnet_rpc_key}`, + url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`, blockNumber: process.env.use_latest_block == 'true' ? undefined : 13017436, }, loggingEnabled: false, diff --git a/test/instance.factory.proposal.test.js b/test/instance.factory.proposal.test.js index 9bfe6cb..94d6e3f 100644 --- a/test/instance.factory.proposal.test.js +++ b/test/instance.factory.proposal.test.js @@ -29,7 +29,7 @@ describe('Deployments test setup', () => { let TornadoInstanceFactoryContract - /// HARDCODED + /// HARDCODED // TODO take from config let denominations = [ '33333333333333333333', '333333333333333333333', @@ -145,13 +145,15 @@ describe('Deployments test setup', () => { gasLimit: BigNumber.from('30000000'), } await GovernanceContract.execute(id, overrides) + + expect(await GovernanceContract.state(id)).to.be.equal(ProposalState.Executed) }) it('Should set correct params for factory', async () => { expect(await TornadoInstanceFactoryContract.verifier()).to.equal(Verifier) expect(await TornadoInstanceFactoryContract.hasher()).to.equal(Hasher) expect(await TornadoInstanceFactoryContract.merkleTreeHeight()).to.equal(20) - clog(await TornadoInstanceFactoryContract.implementation()) + // clog(await TornadoInstanceFactoryContract.implementation()) }) it('Factory should be able to generate an instance without reverting', async () => { @@ -251,11 +253,11 @@ describe('Deployments test setup', () => { secret: rbigint(31), }) - const note = toHex(depo.preimage, 62) - const noteString = `tornado-RAI-33-1-${note}` - clog('Note: ', note) - clog('Note string: ', noteString) - clog('Commitment: ', toHex(depo.commitment)) + // const note = toHex(depo.preimage, 62) + // const noteString = `tornado-RAI-33-1-${note}` + // clog('Note: ', note) + // clog('Note string: ', noteString) + // clog('Commitment: ', toHex(depo.commitment)) await expect(RAIToken.approve(TornadoProxy.address, pE(5000000))).to.not.be.reverted TornadoInstance = await ethers.getContractAt( @@ -300,11 +302,11 @@ describe('Deployments test setup', () => { nullifier: rbigint(31), secret: rbigint(31), }) - const note = toHex(depo.preimage, 62) - const noteString = `tornado-RAI-33-1-${note}` - clog('Note: ', note) - clog('Note string: ', noteString) - clog('Commitment: ', toHex(depo.commitment)) + // const note = toHex(depo.preimage, 62) + // const noteString = `tornado-RAI-33-1-${note}` + // clog('Note: ', note) + // clog('Note string: ', noteString) + // clog('Commitment: ', toHex(depo.commitment)) const proxy = await TornadoProxy.connect(accounts[i]) await expect(() => @@ -337,7 +339,7 @@ describe('Deployments test setup', () => { await ethers.provider.send('hardhat_reset', [ { forking: { - jsonRpcUrl: `https://mainnet.infura.io/v3/${process.env.mainnet_rpc_key}`, + jsonRpcUrl: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`, blockNumber: process.env.use_latest_block == 'true' ? undefined : 13017436, }, }, diff --git a/test/instance.proposal.test.js b/test/instance.proposal.test.js index 12692b0..a643632 100644 --- a/test/instance.proposal.test.js +++ b/test/instance.proposal.test.js @@ -101,7 +101,7 @@ describe('Deployments test setup', () => { expect(await TornadoInstanceFactoryContract.verifier()).to.equal(Verifier) expect(await TornadoInstanceFactoryContract.hasher()).to.equal(Hasher) expect(await TornadoInstanceFactoryContract.merkleTreeHeight()).to.equal(20) - clog(await TornadoInstanceFactoryContract.implementation()) + // clog(await TornadoInstanceFactoryContract.implementation()) }) it('Factory should be able to generate an instance without reverting', async () => { @@ -260,11 +260,11 @@ describe('Deployments test setup', () => { secret: rbigint(31), }) - const note = toHex(depo.preimage, 62) - const noteString = `tornado-RAI-33-1-${note}` - clog('Note: ', note) - clog('Note string: ', noteString) - clog('Commitment: ', toHex(depo.commitment)) + // const note = toHex(depo.preimage, 62) + // const noteString = `tornado-RAI-33-1-${note}` + // clog('Note: ', note) + // clog('Note string: ', noteString) + // clog('Commitment: ', toHex(depo.commitment)) await expect(RAIToken.approve(TornadoProxy.address, pE(5000000))).to.not.be.reverted TornadoInstance = await ethers.getContractAt( @@ -309,11 +309,11 @@ describe('Deployments test setup', () => { nullifier: rbigint(31), secret: rbigint(31), }) - const note = toHex(depo.preimage, 62) - const noteString = `tornado-RAI-33-1-${note}` - clog('Note: ', note) - clog('Note string: ', noteString) - clog('Commitment: ', toHex(depo.commitment)) + // const note = toHex(depo.preimage, 62) + // const noteString = `tornado-RAI-33-1-${note}` + // clog('Note: ', note) + // clog('Note string: ', noteString) + // clog('Commitment: ', toHex(depo.commitment)) const proxy = await TornadoProxy.connect(accounts[i]) await expect(() => @@ -346,7 +346,7 @@ describe('Deployments test setup', () => { await ethers.provider.send('hardhat_reset', [ { forking: { - jsonRpcUrl: `https://mainnet.infura.io/v3/${process.env.mainnet_rpc_key}`, + jsonRpcUrl: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`, blockNumber: process.env.use_latest_block == 'true' ? undefined : 13017436, }, },