Skip to content
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

feat: bump ethers to v6.7.1 #141

Merged
merged 9 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x
- run: npm ci --ignore-scripts
- run: npm run lint

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
release:
name: Publish Release
runs-on: ubuntu-latest
needs: [ tests, linters ]
needs: [tests, linters]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x
- run: npm ci
- run: npm run build
- uses: codfish/semantic-release-action@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x
- run: npm ci
- run: npm run test

Expand All @@ -25,6 +25,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x
- run: npm ci --ignore-scripts
- run: npm run build
29 changes: 19 additions & 10 deletions benchmark/GasCostBenchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ const getCumulativeGasUsed = async (tx) => {

if (tx.deployTransaction) {
receipt = await tx.deployTransaction.wait();
cumulativeGasUsed = receipt.cumulativeGasUsed.toNumber();
cumulativeGasUsed = Number(receipt.cumulativeGasUsed);
} else {
receipt = await tx.wait();
cumulativeGasUsed = await receipt.cumulativeGasUsed.toNumber();
cumulativeGasUsed = Number(receipt.cumulativeGasUsed);
}

return cumulativeGasUsed;
Expand All @@ -61,12 +61,20 @@ describe("Gas Cost Benchmarks", () => {
});
};

const benchmarkTransfer = async (contractName, contractInstance, accounts) => {
const tx = await contractInstance.transferOwnership(accounts[2].address);
recordGasCost(contractName, "transferOwnership", await getCumulativeGasUsed(tx));
const benchmarkGrantRole = async (contractName, contractInstance, accounts) => {
const tx = await contractInstance.grantRole(ethers.ZeroHash, accounts[2].address);
recordGasCost(contractName, "grantRole", await getCumulativeGasUsed(tx));

// Revert the owner by transferring back
await contractInstance.connect(accounts[2]).transferOwnership(accounts[0].address);
// Revert the change by revoking role
await contractInstance.connect(accounts[0]).revokeRole(ethers.ZeroHash, accounts[2].address);
};

const benchmarkRevokeRole = async (contractName, contractInstance, accounts) => {
// Setup by granting role
await contractInstance.connect(accounts[0]).grantRole(ethers.ZeroHash, accounts[2].address);

const tx = await contractInstance.revokeRole(ethers.ZeroHash, accounts[2].address);
recordGasCost(contractName, "revokeRole", await getCumulativeGasUsed(tx));
};

const benchmarkIssue = async (contractName, contractInstance) => {
Expand Down Expand Up @@ -152,7 +160,7 @@ describe("Gas Cost Benchmarks", () => {
it("runs benchmark", async () => {
// Deploy & initialize document store contract
const documentStoreInstance = await DocumentStore.deploy(contractName, Accounts[0].address);
const tx = await documentStoreInstance.deployed();
const tx = await documentStoreInstance.deploymentTransaction();
recordGasCost(contractName, "deployment", await getCumulativeGasUsed(tx));

// const documentStoreInstance = await UpgradableDocumentStore.deploy();
Expand All @@ -163,7 +171,8 @@ describe("Gas Cost Benchmarks", () => {
// (await getCumulativeGasUsed(documentStoreInstance)) + (await getCumulativeGasUsed(initializeTx))
// );

await benchmarkTransfer(contractName, documentStoreInstance, Accounts);
await benchmarkGrantRole(contractName, documentStoreInstance, Accounts);
await benchmarkRevokeRole(contractName, documentStoreInstance, Accounts);
await benchmarkIssue(contractName, documentStoreInstance);
await benchmarkBulkIssue(contractName, documentStoreInstance);
await benchmarkRevoke(contractName, documentStoreInstance);
Expand All @@ -174,7 +183,7 @@ describe("Gas Cost Benchmarks", () => {
describe("DocumentStoreCreator", () => {
it("runs benchmark", async () => {
const documentStoreCreatorInstance = await DocumentStoreCreator.deploy();
const tx = await documentStoreCreatorInstance.deployed();
const tx = await documentStoreCreatorInstance.deploymentTransaction();
recordGasCost("DocumentStoreCreator", "deployment", await getCumulativeGasUsed(tx));
});
});
Expand Down
5 changes: 3 additions & 2 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/no-extraneous-dependencies */

require("@nomiclabs/hardhat-waffle");
require("hardhat-typechain");
require("@nomicfoundation/hardhat-toolbox");
require("@typechain/hardhat");

/**
* @type import('hardhat/config').HardhatUserConfig
Expand All @@ -19,5 +19,6 @@ module.exports = {
},
typechain: {
outDir: "src/contracts",
dontOverrideCompile: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node_modules/@nomicfoundation/hardhat-toolbox/src/index.ts

  // We don't generate types for js projects
  if (userConfig?.typechain?.dontOverrideCompile === undefined) {
    config.typechain.dontOverrideCompile =
      config.paths.configFile.endsWith(".js") ||
      config.paths.configFile.endsWith(".cjs");
  }

},
};
Loading
Loading