-
Notifications
You must be signed in to change notification settings - Fork 217
Consistent deployment gas price #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ee486f1
to
be87cf3
Compare
deployment/7_upgrade_1_6.js
Outdated
`Set ${deploymentWallet.address} as the manager of the TokenPriceProvider`); | ||
} | ||
const TokenPriceProviderSetKyberNetworkTx = await TokenPriceProviderWrapper.contract.setKyberNetwork("0x0000000000000000000000000000000000000000"); | ||
const TokenPriceProviderAddManagerTx = await TokenPriceProviderWrapper.contract.addManager(deploymentWallet.address, { gasPrice }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that you left out my if (!await TokenPriceProviderWrapper.contract.managers(deploymentWallet.address)) {
but I think it's ok. Not really needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I dropped it by mistake when doing the rebase. I will add it again.
@@ -32,7 +33,7 @@ class MultisigExecutor { | |||
signature = ethers.utils.joinSignature(split); | |||
|
|||
// Call "execute" on the Multisig wallet with data and signatures | |||
const executeTransaction = await this._multisigWrapper.contract.execute(contractAddress, 0, data, signature, { gasLimit: 2000000 }); | |||
const executeTransaction = await this._multisigWrapper.contract.execute(contractAddress, 0, data, signature, this._overrides); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a multisig transaction that made the deployment script (silently) fail on CI: https://app.circleci.com/pipelines/github/argentlabs/argent-contracts/451/workflows/5f21b4a6-2bfe-491f-8113-527c50ddf6f0/jobs/485
I wonder if this could be because you have reduced the gasLimit from 2M to 300k here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I did not see any fail transactions when running the deployment scripts. I guess we set it to 2M for a reason but it feels a bit too much. I've set it to 1M and confirmed that the deployment scripts work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general we should avoid using the .contract
on etherlime contract wrappers as that points to the underlying ethers.js contract which for gasPrice handling differs in behaviour, in that it doesn't use the etherlime provider set default option. All .contract
references in deployment scripts and otherwise can be replaced by direct calls on the wrapper, with the exception of encoding call data we use in some tests.
I am not in favour of passing gasPrice
explicitly as it will be forgotten in some calls and we have no way of verifying it apart from trawling through the deployment test to watch for 2 GWei transactions.
This again raises the question of migrating to truffle
which has a much clearer gasPrice
handling than this.
const TokenPriceProviderSetKyberNetworkTx = await TokenPriceProviderWrapper.contract.setKyberNetwork("0x0000000000000000000000000000000000000000"); | ||
|
||
const TokenPriceProviderSetKyberNetworkTx = await TokenPriceProviderWrapper.contract.setKyberNetwork("0x0000000000000000000000000000000000000000", | ||
{ gasPrice }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this script further up, there need to be updates to the MakerRegistryWrapper
to use gasPrice
explicitly as well, atm it uses 2 Gwei if you look in the deployment scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the TokenPriceProviderWrapper.contract.revokeManager
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I forgot those 2 when rebasing my PR. Done.
|
||
const defaultConfigs = { | ||
gasPrice: 20000000000, // 20 Gwei | ||
gasPrice: utils.bigNumberify(process.env.DEPLOYER_GAS_PRICE || 20000000000), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be in config rather than env vars? We have settings->deployer configuration in there already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because the value to use depends on the network status (typically the fast
value on https://ethgasstation.info/) and we want to set it at the beginning of a deployment.
const KyberWrapper = await deployer.deploy(Kyber); | ||
const ERC20Wrapper = await deployer.deploy(ERC20, {}, [KyberWrapper.contractAddress], TEST_ERC20_SUPPLY, TEST_ERC20_DECIMALS); | ||
|
||
const addToken = await KyberWrapper.contract.addToken(ERC20Wrapper.contractAddress, TEST_ERC20_RATE, TEST_ERC20_DECIMALS); | ||
const addToken = await KyberWrapper.contract.addToken(ERC20Wrapper.contractAddress, TEST_ERC20_RATE, TEST_ERC20_DECIMALS, { gasPrice }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initializing UniswapFactory
step is also missing gasPrice
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I considered both approaches and decided to use the By the way I explained these 2 options on the call last week and thought we had agreed to use the contract object instead of the wrapper. I probably should have explained the tradeoff better.
If that's the case and we endup rewriting all the scripts for truffle anyway then maybe which option we choose (the contract or the wrapper) doesn't really matter as long as we are consistent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I can't remember hearing about the etherlime wrapper object passing a bad gasLimit on transactions. Happy as I can be for now.
Making
gasPrice
consistent across all deployment scripts. The gas price can be set in the .env file asDEPLOYER_GAS_PRICE
. If not present the value of 20 Gwei will be used by default.