-
Notifications
You must be signed in to change notification settings - Fork 79
chore: Typechain generation with foundry & export foundry artifacts #1215
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
…isal/foundry-typechain
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
…isal/foundry-typechain
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
…isal/foundry-typechain
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
…isal/foundry-typechain
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
…isal/foundry-typechain
|
@claude explain the changes this pr is proposing |
|
Claude finished @fusmanii's task in 1m 50s —— View job PR Changes ExplanationThis PR migrates the TypeChain type generation process from Hardhat-based artifacts to Foundry-based artifacts. Here's what's changing: Key Changes1. TypeChain Generation Source MigrationBefore: TypeChain types were generated using the Hardhat TypeChain plugin ( After: TypeChain types are now generated manually from Foundry build artifacts using a custom deduplication script. 2. New TypeChain Generation WorkflowThe new process involves three steps:
3. Package Changes (package.json)Removed:
Changed:
4. GitHub Actions Updates (.github/actions/generate-evm-artifacts/action.yml)The CI workflow now:
5. Artifact Export (package.json - files field)The package now exports both Hardhat artifacts ( 6. .gitignore UpdatesAdded Why This Change?Based on the PR description and comments:
Current State & Discussion PointsFrom the review comments, there's ongoing discussion about:
|
| - name: Build EVM | ||
| - name: Build Hardhat | ||
| shell: bash | ||
| run: yarn build-evm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 questions:
- do we need this step here if we're using foundry exclusively?
- should we rename
build-evmintobuild-hardhat? Otherwise it's confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I am not removing this just yet because I dont want to force other repos to migrate. The plan is to still support hardhat artifacts and only remove once all other repos have migrated to foundry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on build-hardhat
| - name: Download EVM artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: evm-artifacts-${{ runner.os }}-node-${{ env.NODE_VERSION }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we not need this before? Is this just an optimization to not recompile?
Won't a different foundry profile force a recompile anyway (local). Esp. after Taylor's changes where we change a strip_strings settings between local and default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah my thinking was that this will re-use artifacts but you are right tests are run using a different profile. I think I can generate the artifacts in the same manner (with FOUNDRY_PROFILE=local) then it can be reused
| "PermissionedMulticallHandler": { | ||
| "address": "0x64a43393866dba0044879979faa7ad3d000622e9", | ||
| "block_number": 24021499, | ||
| "transaction_hash": "0x70b3edf99db66aac34338c3686cd708ddfc2b503c2f707f51ced67dc50e5022f" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these changing? I see, this is just reshuffling? Is our generation deterministic? If so, let's just update master with it, wdyt? To remove these changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typechain doesn't like deploy scripts having a leading number so I removed them which caused reshuffling. Yeah I can update master
| "address": "0x039d62c549f27ead0eb9b567d8776289e5020583", | ||
| "block_number": 21416410, | ||
| "transaction_hash": "0x9c7604f9254450f13b0941008f5272f68ec58db61f32e5ee6713e72b4b56de0b" | ||
| "transaction_hash": "0x6875ef9c89d6855fb5019ce5d20f1466ecdced640b3be009fe6de82932469664" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to https://github.com/across-protocol/contracts/pull/1215/changes#r2693003352, but it seems like DonationBox address actually changed here?
0x3d589d40312bf2d20f13cd0af26a11144a9ca844 -> 0x039d62c549f27ead0eb9b567d8776289e5020583
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah might be some local changes I had, going to revert this
hardhat.config.ts
Outdated
| const { subtask } = require("hardhat/config"); | ||
| const { TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS } = require("hardhat/builtin-tasks/task-names"); | ||
|
|
||
| const isTest = process.env.IS_TEST === "true" || process.env.CI === "true"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember there was a problem with defining isTest like this. It means that we don't export certain artifacts for consumers. With this PR we're moving to ONLY exporting foundry artifacts, so this is OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was with hardhat and typechian, but since we are moving away from hardhat we longer need this. But I will add this back and remove in future pr once everything is migrated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I worry about here is the custom dedupe logic we're using here. Is there analogous logic in hardhat that we can use as reference?
On the other hand, even if the dedupe doesn't 100% work as expected, what's our biggest risk?
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
…isal/foundry-typechain
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Removing hardhat typechain plugin and generating typechain types using foundry artifacts. Also exposing foundry artifacts that other repos (like sdk) can use instead of hardhat artifacts
Note: foundry and typechain wasn't playing nice with deploy script having leading number, so I renamed all deploy script
Closes: https://linear.app/uma/issue/ACP-22/export-foundry-artifacts