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

Update new braavos class_hash and fix calldata in BraavosAccountDeriv… #407

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

devnet0x
Copy link
Contributor

@devnet0x devnet0x commented Oct 14, 2024

Update new braavos class_hash and fix calldata in BraavosAccountDerivation. Close issue #393

Summary by CodeRabbit

  • New Features

    • Updated account derivation process for improved functionality.
    • Simplified constructor calldata generation for Braavos accounts.
  • Bug Fixes

    • Adjusted hardcoded values to align with the latest specifications.
  • Documentation

    • Updated comments to reflect recent changes and clarify the need for runtime retrieval of certain values.

Copy link

docs-page bot commented Oct 14, 2024

To view this pull requests documentation preview, visit the following URL:

docs.page/focustree/starknet.dart~407

Documentation is deployed and generated using docs.page.

Copy link
Contributor

coderabbitai bot commented Oct 14, 2024

Walkthrough

The pull request introduces changes to the BraavosAccountDerivation class within the packages/starknet/lib/src/account.dart file. Key modifications include updates to the hardcoded values for classHash and implementationClassHash, which have been revised to new hexadecimal strings. Additionally, the constructorCalldata method has been simplified by removing the implementationClassHash and initializerSelector from its return list. The ArgentXAccountDerivation class remains largely unchanged but retains comments about hardcoded values.

Changes

File Path Change Summary
packages/starknet/lib/src/account.dart Updated classHash and implementationClassHash in BraavosAccountDerivation class. Removed implementationClassHash and initializerSelector from constructorCalldata method return list. Comments updated with recent timestamps.

Possibly related PRs

  • Update starknet counter example for Sepolia (devnet and testnet) #403: The changes in the BraavosAccountDerivation class regarding hardcoded values and the constructorCalldata method may relate to the updates in the signTransactions method in the signer_test.dart file, as both involve modifications to transaction handling and account derivation logic within the Starknet framework.

Poem

In the realm of code, where rabbits play,
New hashes dance in a bright array.
Constructors trimmed, neat and spry,
With each small change, we leap and fly!
A hop, a skip, to the next big feat,
In the world of Starknet, we can't be beat! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 14f513e and 2afe7f5.

📒 Files selected for processing (1)
  • packages/starknet/lib/src/account.dart (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/starknet/lib/src/account.dart

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between ffa4088 and 14f513e.

📒 Files selected for processing (1)
  • packages/starknet/lib/src/account.dart (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
packages/starknet/lib/src/account.dart (1)

Line range hint 632-634: Verify the simplification of constructorCalldata method

The constructorCalldata method has been simplified to only return [publicKey]. This change might affect the account deployment process.

  1. Please confirm that this simplification is intentional and aligns with the latest Braavos account specifications.
  2. Ensure that removing implementationClassHash and initializerSelector doesn't break any existing functionality or deployments.

To verify the impact of this change, please run the following script:

#!/bin/bash
# Description: Check for any references to the removed parameters in the codebase

# Test: Search for any usage of implementationClassHash in relation to Braavos accounts
rg --type dart "implementationClassHash.*Braavos"

# Test: Search for any usage of initializerSelector in relation to Braavos accounts
rg --type dart "initializerSelector.*Braavos"

# Test: Look for any recent changes related to Braavos account initialization
git log -n 10 --grep="Braavos" --grep="constructor" --grep="calldata" --pretty=format:"%h - %s" --author-date-order

Comment on lines +614 to +617
// FIXME: hardcoded value 2024-10-14
// As mentioned in Braavos repo https://github.com/myBraavos/braavos-account-cairo
final classHash = Felt.fromHexString(
"0x03131fa018d520a037686ce3efddeab8f28895662f019ca3ca18a626650f7d1e",
);

/// FIXME: implementation class hash should be retrieved at runtime
final implementationClassHash = Felt.fromHexString(
"0x5aa23d5bb71ddaa783da7ea79d405315bafa7cf0387a74f4593578c3e9e6570",
"0x013bfe114fb1cf405bfc3a7f8dbe2d91db146c17521d40dcf57e16d6b59fa8e6",
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 14, 2024

Choose a reason for hiding this comment

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

💡 Codebase verification

classHash Value Correctly Updated but Still Hardcoded

The classHash has been updated in commit 14f513e, aligning with the latest Braavos account implementation. However, the value remains hardcoded as indicated by the FIXME comment.

  • Action Required: Implement a dynamic retrieval mechanism for classHash to replace the hardcoded value.
🔗 Analysis chain

Update of classHash value needs verification

The classHash value has been updated, which is likely related to a new implementation of the Braavos account. However, the comment still indicates that this is a hardcoded value.

  1. Please verify that this new classHash value is correct and up-to-date with the latest Braavos account implementation.
  2. Consider implementing a mechanism to retrieve this value at runtime instead of hardcoding it, as suggested by the FIXME comment.

To ensure the classHash value is correct, please run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the Braavos account class hash

# Test: Check if the new class hash is mentioned in any documentation or recent commits
rg --type md --type git "013bfe114fb1cf405bfc3a7f8dbe2d91db146c17521d40dcf57e16d6b59fa8e6"

# Test: Look for any references to Braavos account updates in recent commits
git log -n 10 --grep="Braavos" --grep="account" --grep="class hash" --pretty=format:"%h - %s" --author-date-order

Length of output: 296

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this recommendation is out of scope for this fix

Copy link
Contributor

Choose a reason for hiding this comment

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

@devnet0x, understood. Thank you for clarifying.

╭( •_•)╮

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.

1 participant