-
Notifications
You must be signed in to change notification settings - Fork 193
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
feat(katana): check predeployed settlement contract is configured correctly #2971
Conversation
WalkthroughOhayo, sensei! The pull request introduces refinements to the contract deployment process in Katana's initialization module. The changes focus on improving type definitions, specifically updating the Changes
Possibly related PRs
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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
Documentation and Community
|
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: 0
🧹 Nitpick comments (2)
bin/katana/src/cli/init/mod.rs (1)
142-155
: Ohayo sensei! Great addition of contract verification.The verification logic ensures the settlement contract is properly configured before proceeding. However, we could enhance the error handling by providing more specific guidance.
Consider enhancing the error message to guide users on how to fix configuration issues:
- .context( - "Invalid settlement contract. The contract might have been configured \ - incorrectly", - )?; + .context( + "Invalid settlement contract configuration. Please ensure the contract was \ + deployed with correct program hash, config hash, and facts registry. \ + You may need to redeploy the contract.", + )?;bin/katana/src/cli/init/deployment.rs (1)
194-238
: Excellent implementation of contract verification logic!The function thoroughly validates all necessary components with clear error messages. Consider adding logging for debugging purposes.
Add debug logs to help with troubleshooting:
pub async fn check_program_info( chain_id: Felt, appchain_address: Felt, provider: &RpcProvider, ) -> Result<(), ContractInitError> { + tracing::debug!("Verifying program info for contract {appchain_address:#x}"); let appchain = AppchainContractReader::new(appchain_address, provider); // Compute the chain's config hash let config_hash = compute_config_hash( chain_id, felt!("0x2e7442625bab778683501c0eadbc1ea17b3535da040a12ac7d281066e915eea"), ); + tracing::debug!("Expected config hash: {config_hash:#x}"); // Assert that the values are correctly set let (program_info_res, facts_registry_res) = tokio::join!(appchain.get_program_info().call(), appchain.get_facts_registry().call()); let (actual_program_hash, actual_config_hash) = program_info_res?; let facts_registry = facts_registry_res?; + tracing::debug!("Actual values - program_hash: {actual_program_hash:#x}, config_hash: {actual_config_hash:#x}, facts_registry: {facts_registry:#x}");
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
bin/katana/src/cli/init/deployment.rs
(3 hunks)bin/katana/src/cli/init/mod.rs
(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: fmt
🔇 Additional comments (3)
bin/katana/src/cli/init/mod.rs (1)
23-23
: LGTM! Clear type alias.The rename to
AsyncRuntime
improves code clarity by explicitly indicating its asynchronous nature.bin/katana/src/cli/init/deployment.rs (2)
26-27
: Clean type organization, sensei!The introduction of
RpcProvider
type alias improves code readability and maintainability.
29-42
: Well-structured contract interface definition.The formatted
abigen!
macro improves code readability while maintaining functionality.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2971 +/- ##
==========================================
- Coverage 57.19% 57.18% -0.02%
==========================================
Files 423 423
Lines 56125 56147 +22
==========================================
+ Hits 32103 32108 +5
- Misses 24022 24039 +17 ☔ View full report in Codecov by Sentry. |
Add a check on the No branch of 'Deploy settlement contract' prompt. The program config hash has to be computed from the chain id, so this avoid providing arbitrary settlement contract.
Summary by CodeRabbit
New Features
Refactor
Bug Fixes