Skip to content

Commit

Permalink
fix: for "Nonce Has Already Been Used" Issue During Deployment on Cal…
Browse files Browse the repository at this point in the history
…ibrationnet (#1186)
  • Loading branch information
karlem authored Nov 11, 2024
1 parent 6cfb516 commit 0d44ac3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/contracts-deployment-test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Contracts: Smoke test deployment'
name: "Contracts: Smoke test deployment"

# This workflow is triggered from the main CI workflow.
on:
Expand All @@ -17,8 +17,8 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'pnpm'
node-version: "18.x"
cache: "pnpm"

- name: Install dependencies
run: cd contracts && make deps
Expand Down
8 changes: 2 additions & 6 deletions contracts/tasks/deploy-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,8 @@ task('deploy-registry')
creationPrivileges: Number(mode),
}

console.log(`Deploying SubnetRegistryDiamond...`)
const registry = await hre.deployments.deploy('SubnetRegistryDiamond', {
from: deployer,
Deployments.deploy(hre, deployer, {
name: 'SubnetRegistryDiamond',
args: [registryFacets.asFacetCuts(), registryConstructorParams],
log: true,
waitConfirmations: 1,
})
console.log(`SubnetRegistryDiamond deployed at ${registry.address}`)
})
6 changes: 6 additions & 0 deletions contracts/tasks/lib/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,22 @@ export class Deployments {
...(contract.libraries || []),
)

// Manually managed nonce due to a Filecoin update, which requires specifying 'pending' with
// getTransactionCount to retrieve the latest nonce.
const nonce = await hre.ethers.provider.getTransactionCount(deployer, "pending");

const result = await hre.deployments.deploy(contract.name, {
from: deployer,
log: true,
args: contract.args,
libraries: libraries.addresses,
nonce: nonce,
waitConfirmations: 1,
})
results[contract.name] = result
console.log(`${contract.name} deployed at ${result.address}`)
}

return new Deployments(
await Deployments.resolveContracts(hre, Object.keys(results)),
results,
Expand Down

0 comments on commit 0d44ac3

Please sign in to comment.