-
Notifications
You must be signed in to change notification settings - Fork 3
Add Avalanche deployment for Passthrough Module #82
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
Conversation
WalkthroughA new Avalanche RPC environment variable has been added to both the GitHub Actions workflow and the example environment file. The Passthrough Module deployment metadata now includes an entry for Avalanche. A comprehensive test suite was introduced to verify module deployments and parameters on Avalanche using a local fork. Changes
Sequence Diagram(s)sequenceDiagram
participant Tester
participant Anvil (Avalanche Fork)
participant Viem Client
participant HatsModulesClient
participant Module Contract
Tester->>Anvil (Avalanche Fork): Start local Avalanche fork
Tester->>Viem Client: Initialize public and wallet clients
Tester->>HatsModulesClient: Prepare with bundled registry modules
loop For each eligible module
Tester->>HatsModulesClient: Create module instance with args
HatsModulesClient->>Module Contract: Deploy new instance
Module Contract-->>HatsModulesClient: Return instance address
HatsModulesClient-->>Tester: Instance address
Tester->>Module Contract: Read hatId
Module Contract-->>Tester: Return hatId
end
loop For each created instance
Tester->>HatsModulesClient: Retrieve module metadata
Tester->>HatsModulesClient: Fetch instance parameters
HatsModulesClient-->>Tester: Return parameters
end
Tester->>Anvil (Avalanche Fork): Stop local fork
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (3)
test/avalancheDeployments.test.ts (3)
69-71
: Consider making module exclusions configurable.The hardcoded module name exclusion could become outdated if the module is renamed. Consider using a more maintainable approach.
Consider defining exclusions at the top of the file:
+const EXCLUDED_MODULE_NAMES = ["JokeRace Eligibility"]; +const EXCLUDED_IMPLEMENTATION_ADDRESSES = [ + "0x4c7803041851f7a17Fc6b5Ff5c911FC748160637" // Unlock module with external dependencies +]; test("Test create all modules", async () => { const modules = hatsModulesClient.getModules(); // create new module instance for each module which is deployed on avalanche for (const [id, module] of Object.entries(modules)) { console.log(`Testing module: ${module.name}`); - if (module.name === "JokeRace Eligibility") { + if (EXCLUDED_MODULE_NAMES.includes(module.name)) { continue; }
74-79
: Add comment explaining the hardcoded address.The hardcoded implementation address lacks context about which module it represents.
Add a descriptive comment:
// the unlock module has dependencies on other external contracts if ( module.implementationAddress === - "0x4c7803041851f7a17Fc6b5Ff5c911FC748160637" + "0x4c7803041851f7a17Fc6b5Ff5c911FC748160637" // Unlock module implementation ) { continue; }
166-170
: Improve error message with more context.The error message could provide more debugging information when parameter reading fails.
Enhance the error message:
if (res === undefined || res.length !== module?.parameters.length) { throw new Error( - `Error: could not read all parameters from the instance of module ${module?.name}`, + `Error: could not read all parameters from the instance of module ${module?.name}. Expected ${module?.parameters.length} parameters, but got ${res?.length ?? 0}`, ); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/test.yml
(1 hunks)example.env
(1 hunks)modules/haberdasher-labs_passthrough-module_v0.1.0.json
(1 hunks)test/avalancheDeployments.test.ts
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
test/avalancheDeployments.test.ts (1)
bundler.ts (1)
bundleModules
(3-16)
🔇 Additional comments (2)
example.env (1)
10-10
: LGTM!The
AVALANCHE_RPC
environment variable follows the established naming convention and is correctly placed with other RPC endpoints.modules/haberdasher-labs_passthrough-module_v0.1.0.json (1)
73-77
: LGTM!The Avalanche deployment entry is correctly formatted with the appropriate chain ID (43114) for Avalanche C-Chain and follows the established structure.
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.
Looking good
Adds the Avalanche C-Chain deployment for the Passthrough Module
Summary by CodeRabbit
Chores
Tests