Skip to content

Commit

Permalink
Update hardhat/ethers/waffle (#49)
Browse files Browse the repository at this point in the history
Updates remaining outdated packages that are tightly coupled together
and need to be updated in parallel.

Note that Ethers has been updated to the latest minor version for v5, an
upgrade to v6 requires many changes and will trigger a new major release
of this project.

Also note that I only updated Tenderly to v1.1 and froze it at that
minor version. Using the latest version would require a few code
changes, importing an extra package, increase the number of network
request on _any_ invocation of `hardhat` and would annoyingly increase
the amount of logs that are printed every time `hardhat` is called (the
extra logs might be reduced but not configured away as the logging level
is hardcoded in the plugin). Issue #32 is related.

The changes to the proxy code appear to be caused by a change in
behavior in `hardhat-deploy`, the new code should have the same effect
(this is confirmed by our tests). I found a related issue
[here](wighawag/hardhat-deploy#294) and the
new behavior appears to be intended behavior.

### Test Plan

Test a few commands and verify that everything works as usual, notably
`yarn deploy` and `yarn bench:trace`.
  • Loading branch information
fedgiac authored May 4, 2023
1 parent b593e53 commit 5e5c288
Show file tree
Hide file tree
Showing 4 changed files with 2,248 additions and 2,541 deletions.
16 changes: 7 additions & 9 deletions bench/trace/gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ export interface GasTrace {
children: GasTrace[];
}

type BN = CallMessageTrace["gasUsed"];

function num(value: BigNumberish | BN): BigNumber {
function num(value: BigNumberish): BigNumber {
return BigNumber.from(value.toString());
}

interface GasTraceish {
name: string;
cumulativeGas: BigNumberish | BN;
gasUsed?: BigNumberish | BN;
gasRefund?: BigNumberish | BN;
cumulativeGas: BigNumberish;
gasUsed?: BigNumberish;
gasRefund?: BigNumberish;
children?: GasTrace[];
}

Expand Down Expand Up @@ -73,7 +71,7 @@ export function decodeGasTrace(
}),
node({
name: "<entrypoint>",
cumulativeGas: trace.gasUsed.addn(transactionGas),
cumulativeGas: trace.gasUsed + BigInt(transactionGas),
gasUsed: trace.gasUsed,
children: computeGasTrace(trace, transactionGas),
}),
Expand Down Expand Up @@ -156,8 +154,8 @@ function precompileName({ precompile }: PrecompileMessageTrace): string {
}

interface GasExtension {
gasLeft: BN;
gasRefund?: BN;
gasLeft: bigint;
gasRefund?: bigint;
}

function computeGasTrace(
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@
"devDependencies": {
"@0x/contract-artifacts-v2": "npm:@0x/contract-artifacts@^2.2.2",
"@gnosis.pm/safe-contracts": "^1.3.0",
"@nomiclabs/hardhat-ethers": "^2.0.3",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-waffle": "^2.0.5",
"@openzeppelin/contracts": "=3.4.0-solc-0.7",
"@tenderly/hardhat-tenderly": "^1.0.13",
"@tenderly/hardhat-tenderly": "~1.1.6",
"@types/chai": "^4.3.4",
"@types/chai-as-promised": "^7.1.5",
"@types/debug": "^4.1.7",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.11",
"@types/sinon": "^10.0.13",
"@types/yargs": "^17.0.24",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
Expand All @@ -61,18 +62,18 @@
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^4.2.1",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.5.2",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.7.2",
"globby": "^11.0.4",
"hardhat": "^2.8.3",
"hardhat-deploy": "^0.7.3",
"hardhat": "^2.13.1",
"hardhat-deploy": "^0.11.26",
"hardhat-gas-reporter": "^1.0.9",
"prettier": "^2.8.7",
"prettier-plugin-solidity": "^1.1.3",
"sinon": "^15.0.3",
"solhint": "^3.4.1",
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.7.17",
"solidity-coverage": "^0.8.2",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"yargs": "^17.7.1"
Expand Down
8 changes: 6 additions & 2 deletions src/deploy/001_authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ const deployAuthenticator: DeployFunction = async function ({
log: true,
proxy: {
owner,
methodName: "initializeManager",
execute: {
init: {
methodName: "initializeManager",
args: [manager],
},
},
},
args: [manager],
});
};

Expand Down
Loading

0 comments on commit 5e5c288

Please sign in to comment.