Skip to content

Commit

Permalink
update deps & fix coverage viaIR
Browse files Browse the repository at this point in the history
  • Loading branch information
SevenSwen committed Feb 13, 2024
1 parent e7f3a19 commit 92a79ba
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 150 deletions.
23 changes: 0 additions & 23 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
module.exports = {
configureYulOptimizer: true,
solcOptimizerDetails: {
yul: true,
yulDetails: {
optimizerSteps:
'dhfoDgvlfnTUtnIf' + // None of these can make stack problems worse
'[' +
'xa[r]EscLM' + // Turn into SSA and simplify
'cCTUtTOntnfDIl' + // Perform structural simplification
'Lcl' + // Simplify again
'Vcl [j]' + // Reverse SSA

// should have good 'compilability' property here.

'Tpel' + // Run functional expression inliner
'xa[rl]' + // Prune a bit more in SSA
'xa[r]cL' + // Turn into SSA again and simplify
'gvf' + // Run full inliner
'CTUca[r]LSsTFOtfDnca[r]Ilc' + // SSA plus simplify
']' +
'jml[jl] VcTOcl jml : fDnTOcm', // Make source short and pretty
},
},
skipFiles: [
'mocks', 'tests', 'interfaces',
],
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,40 @@
"@metamask/eth-sig-util": "7.0.1",
"@nomicfoundation/hardhat-ethers": "3.0.5",
"@nomicfoundation/hardhat-network-helpers": "1.0.10",
"@nomicfoundation/hardhat-verify": "2.0.3",
"@nomicfoundation/hardhat-verify": "2.0.4",
"@openzeppelin/contracts": "5.0.1",
"@uniswap/permit2-sdk": "1.2.0",
"chai": "4.4.0",
"dotenv": "16.4.1",
"dotenv": "16.4.3",
"ethereumjs-util": "7.1.5",
"ethers": "6.10.0",
"hardhat": "2.19.4",
"ethers": "6.11.0",
"hardhat": "2.19.5",
"hardhat-deploy": "0.11.45",
"mocha-chai-jest-snapshot": "1.1.4"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "2.0.3",
"@nomicfoundation/hardhat-chai-matchers": "2.0.4",
"@typechain/ethers-v6": "0.5.1",
"@typechain/hardhat": "9.1.0",
"@types/mocha": "10.0.6",
"@typescript-eslint/eslint-plugin": "6.20.0",
"@typescript-eslint/parser": "6.20.0",
"@typescript-eslint/eslint-plugin": "7.0.1",
"@typescript-eslint/parser": "7.0.1",
"acquit": "1.3.0",
"commander": "11.1.0",
"commander": "12.0.0",
"create-ts-index": "1.14.0",
"cross-spawn": "7.0.3",
"eslint": "8.56.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-n": "16.6.2",
"eslint-plugin-promise": "6.1.1",
"hardhat-gas-reporter": "1.0.9",
"hardhat-gas-reporter": "1.0.10",
"hardhat-tracer": "2.7.0",
"prettier": "3.2.4",
"prettier": "3.2.5",
"prettier-plugin-solidity": "1.3.1",
"rimraf": "5.0.5",
"solhint": "4.1.1",
"solidity-coverage": "0.8.6",
"solidity-coverage": "0.8.7",
"ts-node": "10.9.2",
"typechain": "8.3.2",
"typescript": "5.3.3"
Expand Down
20 changes: 11 additions & 9 deletions test/contracts/SafestERC20.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,19 @@ describe('SafeERC20', function () {

describe('safeBalanceOf', function () {
it('should be cheaper than balanceOf', async function () {
const { wrapper } = await loadFixture(deployERC20WithSafeBalance);
if (hre.__SOLIDITY_COVERAGE_RUNNING === undefined) {
const { wrapper } = await loadFixture(deployERC20WithSafeBalance);

const tx = await wrapper.balanceOf.populateTransaction(owner);
const response = await owner.sendTransaction(tx);
const gasUsed = (await response.wait())!.gasUsed;
const safeTx = await wrapper.safeBalanceOf.populateTransaction(owner);
const safeRequest = await owner.sendTransaction(safeTx);
const safeGasUsed = (await safeRequest.wait())!.gasUsed;
const tx = await wrapper.balanceOf.populateTransaction(owner);
const response = await owner.sendTransaction(tx);
const gasUsed = (await response.wait())!.gasUsed;
const safeTx = await wrapper.safeBalanceOf.populateTransaction(owner);
const safeRequest = await owner.sendTransaction(safeTx);
const safeGasUsed = (await safeRequest.wait())!.gasUsed;

expect(gasUsed).gt(safeGasUsed);
console.log(`balanceOf:safeBalanceOf gasUsed - ${gasUsed.toString()}:${safeGasUsed.toString()}`);
expect(gasUsed).gt(safeGasUsed);
console.log(`balanceOf:safeBalanceOf gasUsed - ${gasUsed.toString()}:${safeGasUsed.toString()}`);
}
});
});

Expand Down
Loading

0 comments on commit 92a79ba

Please sign in to comment.