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

build: Add contracts compile and deploy job #114

Merged
merged 3 commits into from
May 23, 2024
Merged

Conversation

bgins
Copy link
Contributor

@bgins bgins commented May 23, 2024

Review Type Requested (choose one):

  • Logic - thorough check (from everybody doing review)

Summary

This pull request adds a GH action job to compile and deploy smart contracts to devnet.

Task/Issue reference

Closes: #92

Details (optional)

This pull request implements the following changes:

  • Add job to deploy contracts to devnet
  • Reduce the use of private keys when deploying contracts (only the admin key is needed)
  • Read RPC endpoint from environment

Note that this version of the job will deploy every time. We will want to check if re-deployment is necessary in a future PR.

We'll test this on main when we merge in #111, but a test run on this branch can be seen here: https://github.com/Lilypad-Tech/lilypad/actions/runs/9212958660/job/25345761697

@bgins bgins force-pushed the bgins/chore-deploy-contracts branch 11 times, most recently from 5425fa7 to f06e431 Compare May 23, 2024 18:23
@bgins bgins force-pushed the bgins/chore-deploy-contracts branch from f06e431 to b3551c7 Compare May 23, 2024 18:27
@bgins bgins requested a review from AquiGorka May 23, 2024 18:27
@bgins bgins marked this pull request as ready for review May 23, 2024 18:31
echo "# TODO"
cd hardhat
npm ci
doppler run -- npx hardhat deploy --network geth
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deploy implicitly compiles the contracts.

@bgins bgins changed the title chore: Add contracts compile and deploy chore: Add contracts compile and deploy job May 23, 2024
@@ -27,16 +27,16 @@ const config: HardhatUserConfig = {
geth: {
url: 'http://localhost:8545',
chainId: 1337,
accounts: PRIVATE_KEYS,
accounts: [getAccount('admin').privateKey]
Copy link
Contributor

Choose a reason for hiding this comment

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

I have my suspicions that these may affect the development setup of the blockchain node.

Could you clear, run, fund and boot to verify this did not impact anything there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just checked and run, fund, and boot for the chain all work with this change in local development.

The reason I think this is safe is the deploy scripts (https://github.com/Lilypad-Tech/lilypad/tree/main/hardhat/deploy) only deploy and excute commands from admin.

The public addresses for the other users appear to be configured here:

namedAccounts: ACCOUNT_ADDRESSES,

And they are referenced, but admin does all the work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for verifying.

@@ -15,6 +15,7 @@ const ENV_FILE = process.env.DOTENV_CONFIG_PATH || '../.env'
dotenv.config({ path: ENV_FILE })

const NETWORK = process.env.NETWORK || "geth";
const NETWORK_URL = process.env.WEB3_RPC_URL || 'http://localhost:8545';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we give this a different name? From the way the env var WEB3_RPC_URL is used all around it points to the websocket endpoint (which for dev is localhost:8546), maybe WEB3_HTTP_URL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah good point. Updated it to WEB3_HTTP_URL.

@bgins bgins force-pushed the bgins/chore-deploy-contracts branch 2 times, most recently from fd76524 to 6860a24 Compare May 23, 2024 18:51
Copy link
Contributor

@AquiGorka AquiGorka left a comment

Choose a reason for hiding this comment

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

🎉 🎉 thank you @bgins !

@bgins bgins changed the title chore: Add contracts compile and deploy job build: Add contracts compile and deploy job May 23, 2024
@bgins bgins force-pushed the bgins/chore-deploy-contracts branch from 6860a24 to 340c32f Compare May 23, 2024 19:15
@bgins bgins merged commit dcd25f3 into main May 23, 2024
1 check passed
@bgins bgins deleted the bgins/chore-deploy-contracts branch May 23, 2024 19:19
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.

[core] Continuous deployment for smart contracts
2 participants