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

fix(contracts): fix a deploy error in the hardhat task #1702

Merged
merged 2 commits into from
Jul 27, 2024

Conversation

baumstern
Copy link
Member

Description

This PR fixes the issue where the hardhat task in maci-contracts is unable to deploy the MACI contract due to it being outdated with the changes introduced in #1695 (see 'Additional Notes' below for the detailed error log).

Additionally, I added a CI job that executes the hardhat task so we can detect deployment errors earlier (see this detaction example of the new CI job).

Additional Notes

issue analysis

the error message: ERROR: TypeError: Do not know how to serialize a BigInt

cause of the error: emptyBallotRoots is bigint[] but JSON.stringify() can not handle bigint[] type

solution: casting bigint[] into string[]

detailed error log:

$ pnpm deploy:localhost

....

======================================================================
08 Deploy MACI contract
======================================================================

*** MACI ***

Network: localhost
contract address: 0xf204a4Ef082f5c04bB89F7D5E6568B796096735a
tx: 0xa2c6cdecc58c351e5db8b22942caa58d197d702f60e1468ea96c60cea8f4fbba
deployer address: 0x627306090abaB3A6e1400e9345bC60c78a8BEf57
gas price: 1000000397
gas used: 30000000

******


=========================================================
ERROR: TypeError: Do not know how to serialize a BigInt
    at JSON.stringify (<anonymous>)
    at ContractStorage.register (/home/runner/work/maci/maci/contracts/tasks/helpers/ContractStorage.ts:96:20)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SimpleTaskDefinition.action (/home/runner/work/maci/maci/contracts/tasks/deploy/maci/08-maci.ts:112:5)
    at async Environment._runTaskDefinition (/home/runner/work/maci/maci/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected][email protected]/node_modules/hardhat/src/internal/core/runtime-environment.ts:359:14)
    at async Environment.run (/home/runner/work/maci/maci/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected][email protected]/node_modules/hardhat/src/internal/core/runtime-environment.ts:192:14)
    at async Deployment.runSteps (/home/runner/work/maci/maci/contracts/tasks/helpers/Deployment.ts:142:9)
    at async SimpleTaskDefinition.action (/home/runner/work/maci/maci/contracts/tasks/runner/deployFull.ts:29:7)
    at async Environment._runTaskDefinition (/home/runner/work/maci/maci/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected][email protected]/node_modules/hardhat/src/internal/core/runtime-environment.ts:359:14)
    at async Environment.run (/home/runner/work/maci/maci/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected][email protected]/node_modules/hardhat/src/internal/core/runtime-environment.ts:192:14) 

======================================================================
Deployer end balance:  9999.975515
Deploy expenses:  0.024484
======================================================================

Deployment has failed
 ELIFECYCLE  Command failed with exit code 1.

Related issue(s)

Confirmation

Copy link

vercel bot commented Jul 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
maci-website ✅ Ready (Inspect) Visit Preview Jul 26, 2024 9:59pm

Copy link
Collaborator

@ctrlc03 ctrlc03 left a comment

Choose a reason for hiding this comment

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

Nice, thanks for this!!

@ctrlc03 ctrlc03 merged commit 0c01532 into privacy-scaling-explorations:dev Jul 27, 2024
23 checks passed
@baumstern baumstern deleted the fix/contracts branch July 29, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants