add total gas calculation
Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
parent
9726f20e7b
commit
5a883117db
@ -54,9 +54,9 @@ function timeout(seconds) {
|
||||
const promptMessageBase = (middle) => `\n${middle}\n\nAre you sure you would like to continue? (y/n): `
|
||||
|
||||
async function deploy() {
|
||||
if (process.env.STAKING_PROXY_ADDRESS === "") throw Error('Missing STAKING_PROXY_ADDRESS.')
|
||||
if (process.env.STAKING_PROXY_ADDRESS === '') throw Error('Missing STAKING_PROXY_ADDRESS.')
|
||||
|
||||
if (process.env.REGISTRY_IMPL_ADDRESS === "") throw Error('Missing REGISTRY_IMPL_ADDRESS.')
|
||||
if (process.env.REGISTRY_IMPL_ADDRESS === '') throw Error('Missing REGISTRY_IMPL_ADDRESS.')
|
||||
|
||||
const signer = await ethers.getSigner()
|
||||
|
||||
|
@ -56,7 +56,7 @@ function timeout(seconds) {
|
||||
const promptMessageBase = (middle) => `\n${middle}\n\nAre you sure you would like to continue? (y/n): `
|
||||
|
||||
async function deploy() {
|
||||
if (process.env.STAKING_PROXY_ADDRESS === "") throw Error('Missing STAKING_PROXY_ADDRESS.')
|
||||
if (process.env.STAKING_PROXY_ADDRESS === '') throw Error('Missing STAKING_PROXY_ADDRESS.')
|
||||
|
||||
const signer = await ethers.getSigner()
|
||||
|
||||
|
@ -7,6 +7,9 @@
|
||||
"contracts/*"
|
||||
],
|
||||
"scripts": {
|
||||
"deploy:patch": "yarn hardhat --network mainnet run deploy/deployPatch.js",
|
||||
"deploy:staking": "yarn hardhat --network mainnet run deploy/deployStaking.js",
|
||||
"deploy:registry": "yarn hardhat --network mainnet run deploy/deployRegistryImplementation.js",
|
||||
"eslint": "eslint --ext .js --ignore-path .gitignore .",
|
||||
"prettier:check": "prettier --check . --config .prettierrc",
|
||||
"prettier:fix": "prettier --write . --config .prettierrc",
|
||||
|
@ -66,6 +66,8 @@ describe('Gov Exploit Patch Upgrade Tests', () => {
|
||||
let registryImplementation
|
||||
let staking
|
||||
|
||||
let totalGas = BigNumber.from(0)
|
||||
|
||||
let exploit = {
|
||||
hacker: undefined,
|
||||
salt: '00000000006578706c6f6974', // hex "exploit", hacker addrs must be prepended
|
||||
@ -158,8 +160,12 @@ describe('Gov Exploit Patch Upgrade Tests', () => {
|
||||
|
||||
staking = await stakingDeployer.deploy(config.governance, config.TORN, config.registry)
|
||||
|
||||
totalGas = totalGas.add((await staking.deployTransaction.wait()).cumulativeGasUsed)
|
||||
|
||||
staking = await proxyDeployer.deploy(staking.address, governance.address, [])
|
||||
|
||||
totalGas = totalGas.add((await staking.deployTransaction.wait()).cumulativeGasUsed)
|
||||
|
||||
registryImplementation = await registryDeployer.deploy(
|
||||
config.TORN,
|
||||
config.governance,
|
||||
@ -168,6 +174,8 @@ describe('Gov Exploit Patch Upgrade Tests', () => {
|
||||
config.feeManager,
|
||||
)
|
||||
|
||||
totalGas = totalGas.add((await registryImplementation.deployTransaction.wait()).cumulativeGasUsed)
|
||||
|
||||
exploit.address = await metamorphicFactory.findMetamorphicContractAddress(exploit.salt)
|
||||
|
||||
// Snapshot
|
||||
@ -175,6 +183,10 @@ describe('Gov Exploit Patch Upgrade Tests', () => {
|
||||
snapshotId = await takeSnapshot()
|
||||
})
|
||||
|
||||
after(() => {
|
||||
console.log('\n⛽ Total gas used => ', totalGas.toNumber())
|
||||
})
|
||||
|
||||
describe('Integrative: Patched Governance', () => {
|
||||
after(async () => {
|
||||
await revertSnapshot(snapshotId)
|
||||
@ -192,6 +204,8 @@ describe('Gov Exploit Patch Upgrade Tests', () => {
|
||||
|
||||
const proposal = await proposalDeployer.deploy(staking.address, registryImplementation.address)
|
||||
|
||||
totalGas = totalGas.add((await proposal.deployTransaction.wait()).cumulativeGasUsed)
|
||||
|
||||
// Propose
|
||||
|
||||
await governance.propose(proposal.address, 'PATCH')
|
||||
@ -216,7 +230,9 @@ describe('Gov Exploit Patch Upgrade Tests', () => {
|
||||
|
||||
await ethers.provider.send('evm_mine', [])
|
||||
|
||||
await governance.execute(proposalId)
|
||||
const response = await governance.execute(proposalId)
|
||||
|
||||
totalGas = totalGas.add((await response.wait()).cumulativeGasUsed)
|
||||
|
||||
expect(await torn.balanceOf(await governance.Staking())).to.equal(pE('94092'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user