Skip to content

Commit

Permalink
Bump snforge to v0.27.0 (#1107)
Browse files Browse the repository at this point in the history
* Bump sn-forge to v0.27.0

* Fix snforge function name changes

* Add CHANGELOG
  • Loading branch information
JhChoy authored Aug 22, 2024
1 parent 6c76108 commit 42ec58a
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 80 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- ERC2981 (NFT Royalty Standard) component (#1091)

### Changed

- Bump snforge to v0.27.0 (#1107)

### Changed (Breaking)

- Changed ABI suffix to Trait in dual case account and eth account modules (#1096).
Expand Down
4 changes: 2 additions & 2 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,5 @@ dependencies = [

[[package]]
name = "snforge_std"
version = "0.26.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.26.0#50eb589db65e113efe4f09241feb59b574228c7e"
version = "0.27.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de"
2 changes: 1 addition & 1 deletion Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ keywords = [

[workspace.dependencies]
starknet = "2.7.0"
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.26.0" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" }

[dependencies]
starknet.workspace = true
Expand Down
19 changes: 10 additions & 9 deletions packages/account/src/tests/test_account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ use openzeppelin_testing::constants::{
use openzeppelin_testing::signing::StarkKeyPair;
use openzeppelin_utils::selectors;
use snforge_std::{
cheat_signature_global, cheat_transaction_version_global, cheat_transaction_hash_global
start_cheat_signature_global, start_cheat_transaction_version_global,
start_cheat_transaction_hash_global
};
use snforge_std::{spy_events, declare, test_address, start_cheat_caller_address};
use starknet::account::Call;
Expand Down Expand Up @@ -54,9 +55,9 @@ fn setup_dispatcher(
let address = utils::deploy(contract_class, calldata);
let dispatcher = AccountABIDispatcher { contract_address: address };

cheat_signature_global(array![data.r, data.s].span());
cheat_transaction_hash_global(data.tx_hash);
cheat_transaction_version_global(MIN_TRANSACTION_VERSION);
start_cheat_signature_global(array![data.r, data.s].span());
start_cheat_transaction_hash_global(data.tx_hash);
start_cheat_transaction_version_global(MIN_TRANSACTION_VERSION);
start_cheat_caller_address(address, ZERO());

(dispatcher, contract_class.class_hash.into())
Expand Down Expand Up @@ -133,7 +134,7 @@ fn test_validate_deploy_invalid_signature_length() {
let key_pair = KEY_PAIR();
let (account, class_hash) = setup_dispatcher(key_pair, SIGNED_TX_DATA(key_pair));
let invalid_len_sig = array!['INVALID_LEN_SIG'];
cheat_signature_global(invalid_len_sig.span());
start_cheat_signature_global(invalid_len_sig.span());

account.__validate_deploy__(class_hash, SALT, key_pair.public_key);
}
Expand All @@ -145,7 +146,7 @@ fn test_validate_deploy_empty_signature() {
let (account, class_hash) = setup_dispatcher(key_pair, SIGNED_TX_DATA(key_pair));
let empty_sig = array![];

cheat_signature_global(empty_sig.span());
start_cheat_signature_global(empty_sig.span());
account.__validate_deploy__(class_hash, SALT, key_pair.public_key);
}

Expand Down Expand Up @@ -178,7 +179,7 @@ fn test_validate_declare_invalid_signature_length() {
let key_pair = KEY_PAIR();
let (account, class_hash) = setup_dispatcher(key_pair, SIGNED_TX_DATA(key_pair));
let invalid_len_sig = array!['INVALID_LEN_SIG'];
cheat_signature_global(invalid_len_sig.span());
start_cheat_signature_global(invalid_len_sig.span());

account.__validate_declare__(class_hash);
}
Expand All @@ -189,7 +190,7 @@ fn test_validate_declare_empty_signature() {
let key_pair = KEY_PAIR();
let (account, class_hash) = setup_dispatcher(key_pair, SIGNED_TX_DATA(key_pair));
let empty_sig = array![];
cheat_signature_global(empty_sig.span());
start_cheat_signature_global(empty_sig.span());

account.__validate_declare__(class_hash);
}
Expand All @@ -215,7 +216,7 @@ fn test_execute_with_version(version: Option<felt252>) {

// Handle version for test
if let Option::Some(version) = version {
cheat_transaction_version_global(version);
start_cheat_transaction_version_global(version);
}

// Execute
Expand Down
20 changes: 10 additions & 10 deletions packages/account/src/tests/test_eth_account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use openzeppelin_testing::signing::Secp256k1KeyPair;
use openzeppelin_utils::selectors;
use openzeppelin_utils::serde::SerializedAppend;
use snforge_std::{
cheat_signature_global, cheat_transaction_version_global, cheat_transaction_hash_global,
start_cheat_caller_address
start_cheat_signature_global, start_cheat_transaction_version_global,
start_cheat_transaction_hash_global, start_cheat_caller_address
};
use snforge_std::{spy_events, test_address};
use starknet::account::Call;
Expand Down Expand Up @@ -61,9 +61,9 @@ fn setup_dispatcher(

let mut serialized_signature = array![];
data.signature.serialize(ref serialized_signature);
cheat_signature_global(serialized_signature.span());
cheat_transaction_hash_global(data.tx_hash);
cheat_transaction_version_global(MIN_TRANSACTION_VERSION);
start_cheat_signature_global(serialized_signature.span());
start_cheat_transaction_hash_global(data.tx_hash);
start_cheat_transaction_version_global(MIN_TRANSACTION_VERSION);
start_cheat_caller_address(contract_address, ZERO());

(dispatcher, contract_class.class_hash.into())
Expand Down Expand Up @@ -156,7 +156,7 @@ fn test_validate_deploy_invalid_signature_length() {
let (account, class_hash) = setup_dispatcher(key_pair, SIGNED_TX_DATA(key_pair));

let invalid_len_sig = array!['INVALID_LEN'];
cheat_signature_global(invalid_len_sig.span());
start_cheat_signature_global(invalid_len_sig.span());

account.__validate_deploy__(class_hash, SALT, key_pair.public_key);
}
Expand All @@ -168,7 +168,7 @@ fn test_validate_deploy_empty_signature() {
let (account, class_hash) = setup_dispatcher(key_pair, SIGNED_TX_DATA(key_pair));
let empty_sig = array![];

cheat_signature_global(empty_sig.span());
start_cheat_signature_global(empty_sig.span());
account.__validate_deploy__(class_hash, SALT, key_pair.public_key);
}

Expand Down Expand Up @@ -202,7 +202,7 @@ fn test_validate_declare_invalid_signature_length() {
let (account, class_hash) = setup_dispatcher(key_pair, SIGNED_TX_DATA(key_pair));

let invalid_len_sig = array!['INVALID_LEN'];
cheat_signature_global(invalid_len_sig.span());
start_cheat_signature_global(invalid_len_sig.span());

account.__validate_declare__(class_hash);
}
Expand All @@ -214,7 +214,7 @@ fn test_validate_declare_empty_signature() {
let (account, class_hash) = setup_dispatcher(key_pair, SIGNED_TX_DATA(key_pair));
let empty_sig = array![];

cheat_signature_global(empty_sig.span());
start_cheat_signature_global(empty_sig.span());

account.__validate_declare__(class_hash);
}
Expand All @@ -241,7 +241,7 @@ fn test_execute_with_version(version: Option<felt252>) {

// Handle version for test
if let Option::Some(version) = version {
cheat_transaction_version_global(version);
start_cheat_transaction_version_global(version);
}

// Execute
Expand Down
Loading

0 comments on commit 42ec58a

Please sign in to comment.