Skip to content

Commit 72c6f93

Browse files
Remove check for old braavos accounts (#3558)
<!-- Reference any GitHub issues resolved by this PR --> Closes # ## Introduced changes Thanks to some adjustments, all braavos accounts (old and new) should work https://swmansion.slack.com/archives/C05U5MZ2RPE/p1752062824037899?thread_ts=1752062411.210489&cid=C05U5MZ2RPE ## Checklist <!-- Make sure all of these are complete --> - [ ] Linked relevant issue - [ ] Updated relevant documentation - [ ] Added relevant tests - [ ] Performed self-review of the code - [ ] Added changes to `CHANGELOG.md`
1 parent 3d76c5e commit 72c6f93

File tree

7 files changed

+5
-76
lines changed

7 files changed

+5
-76
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919

2020
- `ready` option for `--type` flag in `account create` and `account import` commands (Argent wallet has rebranded as Ready)
2121

22+
#### Changed
23+
24+
- Braavos accounts with all class hashes are now supported
25+
2226
#### Deprecated
2327

2428
- `argent` option for `--type` flag in `account create` and `account import` commands. Use `ready` instead

crates/sncast/src/helpers/braavos.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use anyhow::{Error, bail};
21
use async_trait::async_trait;
32
use starknet::{
43
accounts::{AccountFactory, PreparedAccountDeploymentV3, RawAccountDeploymentV3},
@@ -9,8 +8,6 @@ use starknet::{
98
use starknet_crypto::poseidon_hash_many;
109
use starknet_types_core::felt::Felt;
1110

12-
use super::constants::BRAAVOS_OLD_CLASS_HASHES;
13-
1411
// Adapted from strakli as there is currently no implementation of braavos account factory in starknet-rs
1512
pub struct BraavosAccountFactory<S, P> {
1613
class_hash: Felt,
@@ -143,13 +140,3 @@ where
143140
.is_interactive(SignerInteractivityContext::Other)
144141
}
145142
}
146-
147-
pub fn check_braavos_account_compatibility(class_hash: Felt) -> Result<(), Error> {
148-
let msg = "Using incompatible Braavos accounts is disabled because they don't work with starknet >= 0.13.4.
149-
Visit this link to read more: https://community.starknet.io/t/starknet-devtools-for-0-13-5/115495#p-2359168-braavos-compatibility-issues-3";
150-
151-
if BRAAVOS_OLD_CLASS_HASHES.contains(&class_hash) {
152-
bail!(msg)
153-
}
154-
Ok(())
155-
}

crates/sncast/src/helpers/constants.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ pub const BRAAVOS_CLASS_HASH: Felt =
2828
pub const BRAAVOS_BASE_ACCOUNT_CLASS_HASH: Felt =
2929
felt!("0x03d16c7a9a60b0593bd202f660a28c5d76e0403601d9ccc7e4fa253b6a70c201"); // v1.2.0
3030

31-
pub const BRAAVOS_OLD_CLASS_HASHES: &[Felt] = &[
32-
felt!("0x02c8c7e6fbcfb3e8e15a46648e8914c6aa1fc506fc1e7fb3d1e19630716174bc"),
33-
felt!("0x041bf1e71792aecb9df3e9d04e1540091c5e13122a731e02bec588f71dc1a5c3"),
34-
];
35-
3631
// used in wait_for_tx. Txs will be fetched every 5s with timeout of 300s - so 60 attempts
3732
pub const WAIT_TIMEOUT: u16 = 300;
3833
pub const WAIT_RETRY_INTERVAL: u8 = 5;

crates/sncast/src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use camino::Utf8PathBuf;
55
use clap::ValueEnum;
66
use conversions::serde::serialize::CairoSerialize;
77
use foundry_ui::UI;
8-
use helpers::braavos::check_braavos_account_compatibility;
98
use helpers::constants::{KEYSTORE_PASSWORD_ENV_VAR, UDC_ADDRESS};
109
use rand::RngCore;
1110
use rand::rngs::OsRng;
@@ -257,13 +256,6 @@ pub async fn get_account<'a>(
257256
} else {
258257
get_account_data_from_accounts_file(account, chain_id, accounts_file)?
259258
};
260-
261-
// Braavos accounts before v1.2.0 are not compatible with starknet >= 0.13.4
262-
// For more, read https://community.starknet.io/t/starknet-devtools-for-0-13-5/115495#p-2359168-braavos-compatibility-issues-3
263-
if let Some(class_hash) = account_data.class_hash {
264-
check_braavos_account_compatibility(class_hash)?;
265-
}
266-
267259
let account = build_account(account_data, chain_id, provider).await?;
268260

269261
Ok(account)

crates/sncast/src/starknet_commands/account/create.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use conversions::IntoConv;
1010
use foundry_ui::UI;
1111
use foundry_ui::components::warning::WarningMessage;
1212
use serde_json::json;
13-
use sncast::helpers::braavos::{BraavosAccountFactory, check_braavos_account_compatibility};
13+
use sncast::helpers::braavos::BraavosAccountFactory;
1414
use sncast::helpers::constants::{
1515
BRAAVOS_BASE_ACCOUNT_CLASS_HASH, BRAAVOS_CLASS_HASH, CREATE_KEYSTORE_PASSWORD_ENV_VAR,
1616
OZ_CLASS_HASH, READY_CLASS_HASH,
@@ -75,12 +75,6 @@ pub async fn create(
7575
ui.print_blank_line();
7676
}
7777

78-
// Braavos accounts before v1.2.0 are not compatible with starknet >= 0.13.4
79-
// For more, read https://community.starknet.io/t/starknet-devtools-for-0-13-5/115495#p-2359168-braavos-compatibility-issues-3
80-
if let Some(class_hash) = create.class_hash {
81-
check_braavos_account_compatibility(class_hash)?;
82-
}
83-
8478
let salt = extract_or_generate_salt(create.salt);
8579
let class_hash = create.class_hash.unwrap_or(match create.account_type {
8680
AccountType::OpenZeppelin => OZ_CLASS_HASH,

crates/sncast/src/starknet_commands/account/import.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use foundry_ui::UI;
1212
use foundry_ui::components::warning::WarningMessage;
1313
use sncast::check_if_legacy_contract;
1414
use sncast::helpers::account::generate_account_name;
15-
use sncast::helpers::braavos::check_braavos_account_compatibility;
1615
use sncast::helpers::rpc::RpcArgs;
1716
use sncast::response::account::import::AccountImportResponse;
1817
use sncast::{AccountType, check_class_hash_exists, get_chain_id, handle_rpc_error};
@@ -80,12 +79,6 @@ pub async fn import(
8079
ui.print_blank_line();
8180
}
8281

83-
// Braavos accounts before v1.2.0 are not compatible with Starknet >= 0.13.4
84-
// For more, read https://community.starknet.io/t/starknet-devtools-for-0-13-5/115495#p-2359168-braavos-compatibility-issues-3
85-
if let Some(class_hash) = import.class_hash {
86-
check_braavos_account_compatibility(class_hash)?;
87-
}
88-
8982
let private_key = if let Some(passed_private_key) = &import.private_key {
9083
passed_private_key
9184
} else if let Some(passed_private_key_file_path) = &import.private_key_file_path {

crates/sncast/tests/e2e/account/create.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -903,42 +903,6 @@ fn get_keystore_account_pattern(account_type: AccountType, class_hash: Option<&s
903903
to_string_pretty(&account_json).unwrap()
904904
}
905905

906-
#[test_case("0x02c8c7e6fbcfb3e8e15a46648e8914c6aa1fc506fc1e7fb3d1e19630716174bc"; "braavos_v1_1_0")]
907-
#[test_case("0x041bf1e71792aecb9df3e9d04e1540091c5e13122a731e02bec588f71dc1a5c3"; "braavos_v1_0_0")]
908-
fn test_old_braavos_class_hashes_disabled(class_hash: &str) {
909-
let temp_dir = tempdir().expect("Unable to create a temporary directory");
910-
let accounts_file = "accounts.json";
911-
912-
let args = vec![
913-
"--accounts-file",
914-
accounts_file,
915-
"account",
916-
"create",
917-
"--url",
918-
URL,
919-
"--name",
920-
"my_account",
921-
"--salt",
922-
"0x1",
923-
"--class-hash",
924-
class_hash,
925-
"--type",
926-
"braavos",
927-
];
928-
929-
let snapbox = runner(&args).current_dir(temp_dir.path());
930-
let output = snapbox.assert().success();
931-
932-
assert_stderr_contains(
933-
output,
934-
indoc! {r"
935-
Command: account create
936-
Error: Using incompatible Braavos accounts is disabled because they don't work with starknet >= 0.13.4.
937-
Visit this link to read more: https://community.starknet.io/t/starknet-devtools-for-0-13-5/115495#p-2359168-braavos-compatibility-issues-3
938-
"},
939-
);
940-
}
941-
942906
#[tokio::test]
943907
pub async fn test_happy_case_deployment_fee_message() {
944908
let tempdir = tempdir().expect("Failed to create a temporary directory");

0 commit comments

Comments
 (0)