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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions packages/starknet/lib/src/account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -611,16 +611,11 @@ class BraavosAccountDerivation extends AccountDerivation {
final Provider provider;
final Felt chainId;

// FIXME: hardcoded value for testnet 2023-02-24
// 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",
Comment on lines +614 to +617
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.

╭( •_•)╮

);
final initializerSelector = getSelectorByName("initializer");

BraavosAccountDerivation({
required this.provider,
Expand All @@ -636,12 +631,7 @@ class BraavosAccountDerivation extends AccountDerivation {

@override
List<Felt> constructorCalldata({required Felt publicKey}) {
return [
implementationClassHash,
initializerSelector,
Felt.fromInt(1),
publicKey
];
return [publicKey];
}

@override
Expand Down
Loading