Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ea52319
Support RPC `0.9.0`
ddoktorski Jul 11, 2025
bbfb650
Merge branch 'master' into rpc-0-9-0
ddoktorski Jul 17, 2025
d5b0302
Rename `preconfirmed` to `pre_confirmed`
ddoktorski Jul 17, 2025
a0d4f6a
Update version to `0.9` in node url
ddoktorski Jul 17, 2025
2c20aca
Restore ignored tests
ddoktorski Jul 17, 2025
2c599e1
Add backticks
ddoktorski Jul 17, 2025
3d1c5aa
Update changelog
ddoktorski Jul 17, 2025
802462b
Fix `test_happy_case_deployment_fee_message` test
ddoktorski Jul 17, 2025
764611e
Add dash to pre confirmed
ddoktorski Jul 17, 2025
7dc04ca
Bump devnet to rc.2
ddoktorski Jul 18, 2025
f0bbc6e
Resolve merge conflicts
ddoktorski Jul 21, 2025
808625a
Address PR comments
ddoktorski Jul 21, 2025
d1721df
Use always underscore for pre_confirmed input
ddoktorski Jul 21, 2025
38ce1d5
Revert refactor in `check_if_legacy_contract`
ddoktorski Jul 21, 2025
c8ad731
Resolve merge conflicts
ddoktorski Jul 31, 2025
35ab8a2
Bump starknet-rs to rc.2; bump devnet to rc.4
ddoktorski Jul 31, 2025
8b28a91
Fix changelog
ddoktorski Jul 31, 2025
34bbd0c
Fix e2e::forking::with_cache test
ddoktorski Jul 31, 2025
68329c7
Resolve merge conflicts
ddoktorski Aug 11, 2025
3a0a505
Remove rc from `EXPECTED_RPC_VERSION`
ddoktorski Aug 11, 2025
28915e5
Fix cache test
ddoktorski Aug 11, 2025
dfb1f53
Update free provider url
ddoktorski Aug 11, 2025
bf949ba
Add `--tip` flag
ddoktorski Aug 12, 2025
84e3000
Resolve merge conflicts
ddoktorski Aug 19, 2025
7724174
Resolve merge conflicts
ddoktorski Aug 19, 2025
c4cc818
Update account deploy appendix
ddoktorski Aug 19, 2025
0ef3194
Address PR comments
ddoktorski Aug 19, 2025
0c507d8
Update TODO comment
ddoktorski Aug 19, 2025
053b431
Resolve merge conflicts
ddoktorski Aug 21, 2025
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
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#### Added

- `--test-files` flag to `verify` command to include test files under src/ for verification (only applies to voyager)

### Cast
- `--tip` flag to `invoke`, `declare`, `deploy`, `multicall run` and `account deploy` commands to set the transaction tip

#### Changed

Expand Down
44 changes: 9 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ regex = "1.11.1"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
starknet = "0.17.0-rc.3"
starknet-crypto = { git = "https://github.com/xJonathanLEI/starknet-rs", rev = "a70f4ce" }
starknet-crypto = "0.7.4"
tempfile = "3.20.0"
thiserror = "2.0.12"
ctor = "0.4.1"
Expand Down
23 changes: 22 additions & 1 deletion crates/sncast/src/helpers/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ pub struct FeeArgs {
/// Max L1 data gas price in Fri. If not provided, will be automatically estimated.
#[arg(long)]
pub l1_data_gas_price: Option<u128>,

/// Tip for the transaction. If not provided, it will be set to 0.
#[arg(long)]
pub tip: Option<u64>,
}

impl From<ScriptFeeSettings> for FeeArgs {
Expand All @@ -54,6 +58,7 @@ impl From<ScriptFeeSettings> for FeeArgs {
l2_gas_price,
l1_data_gas,
l1_data_gas_price,
tip: Some(0),
}
}
}
Expand All @@ -75,7 +80,9 @@ impl FeeArgs {
);

let fee_settings = FeeSettings::try_from(fee_estimate.clone())
.expect("Failed to convert FeeEstimate to FeeSettings");
.expect("Failed to convert FeeEstimate to FeeSettings")
.update_tip(self.tip.unwrap_or(0)); // If a tip is not provided, set it to 0

Ok(fee_settings)
} else {
let fee_settings = FeeSettings::from(self.clone());
Expand Down Expand Up @@ -105,6 +112,17 @@ pub struct FeeSettings {
pub l2_gas_price: Option<u128>,
pub l1_data_gas: Option<u64>,
pub l1_data_gas_price: Option<u128>,
pub tip: Option<u64>,
}

impl FeeSettings {
#[must_use]
pub fn update_tip(&self, tip: u64) -> FeeSettings {
FeeSettings {
tip: Some(tip),
..*self
}
}
}

impl TryFrom<FeeEstimate> for FeeSettings {
Expand All @@ -117,6 +135,7 @@ impl TryFrom<FeeEstimate> for FeeSettings {
l2_gas_price: Some(fee_estimate.l2_gas_price),
l1_data_gas: Some(fee_estimate.l1_data_gas_consumed),
l1_data_gas_price: Some(fee_estimate.l1_data_gas_price),
tip: None,
})
}
}
Expand All @@ -130,6 +149,7 @@ impl From<FeeArgs> for FeeSettings {
l2_gas_price: fee_args.l2_gas_price,
l1_data_gas: fee_args.l1_data_gas,
l1_data_gas_price: fee_args.l1_data_gas_price,
tip: Some(fee_args.tip.unwrap_or(0)),
}
}
}
Expand Down Expand Up @@ -168,6 +188,7 @@ mod tests {
l2_gas_price: Some(4),
l1_data_gas: Some(5),
l1_data_gas_price: Some(6),
tip: None,
}
);
}
Expand Down
4 changes: 3 additions & 1 deletion crates/sncast/src/starknet_commands/account/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ where
l2_gas_price,
l1_data_gas,
l1_data_gas_price,
tip,
} = fee_settings.expect("Failed to convert to fee settings");

let deployment = apply_optional_fields!(
Expand All @@ -313,7 +314,8 @@ where
l2_gas => AccountDeploymentV3::l2_gas,
l2_gas_price => AccountDeploymentV3::l2_gas_price,
l1_data_gas => AccountDeploymentV3::l1_data_gas,
l1_data_gas_price => AccountDeploymentV3::l1_data_gas_price
l1_data_gas_price => AccountDeploymentV3::l1_data_gas_price,
tip => AccountDeploymentV3::tip
);
let result = deployment.send().await;

Expand Down
2 changes: 2 additions & 0 deletions crates/sncast/src/starknet_commands/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ pub async fn declare(
l2_gas_price,
l1_data_gas,
l1_data_gas_price,
tip,
} = fee_settings.expect("Failed to convert to fee settings");

let declaration = apply_optional_fields!(
Expand All @@ -107,6 +108,7 @@ pub async fn declare(
l2_gas_price => DeclarationV3::l2_gas_price,
l1_data_gas => DeclarationV3::l1_data_gas,
l1_data_gas_price => DeclarationV3::l1_data_gas_price,
tip => DeclarationV3::tip,
declare.nonce => DeclarationV3::nonce
);

Expand Down
2 changes: 2 additions & 0 deletions crates/sncast/src/starknet_commands/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ pub async fn deploy(
l2_gas_price,
l1_data_gas,
l1_data_gas_price,
tip,
} = fee_settings.expect("Failed to convert to fee settings");

let deployment = apply_optional_fields!(
Expand All @@ -102,6 +103,7 @@ pub async fn deploy(
l2_gas_price => DeploymentV3::l2_gas_price,
l1_data_gas => DeploymentV3::l1_data_gas,
l1_data_gas_price => DeploymentV3::l1_data_gas_price,
tip => DeploymentV3::tip,
nonce => DeploymentV3::nonce
);
let result = deployment.send().await;
Expand Down
2 changes: 2 additions & 0 deletions crates/sncast/src/starknet_commands/invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub async fn execute_calls(
l2_gas_price,
l1_data_gas,
l1_data_gas_price,
tip,
} = fee_settings.expect("Failed to convert to fee settings");

let execution = apply_optional_fields!(
Expand All @@ -98,6 +99,7 @@ pub async fn execute_calls(
l2_gas_price => ExecutionV3::l2_gas_price,
l1_data_gas => ExecutionV3::l1_data_gas,
l1_data_gas_price => ExecutionV3::l1_data_gas_price,
tip => ExecutionV3::tip,
nonce => ExecutionV3::nonce
);
let result = execution.send().await;
Expand Down
1 change: 1 addition & 0 deletions crates/sncast/tests/e2e/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ async fn test_call_after_storage_changed() {
l2_gas_price: Some(100_000_000_000_000_000),
l1_data_gas: Some(100_000),
l1_data_gas_price: Some(10_000_000_000_000),
tip: Some(100_000),
};
invoke_contract(
"user2",
Expand Down
26 changes: 19 additions & 7 deletions crates/sncast/tests/e2e/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::helpers::constants::{CONTRACTS_DIR, DEVNET_OZ_CLASS_HASH_CAIRO_0, URL
use crate::helpers::fee::apply_test_resource_bounds_flags;
use crate::helpers::fixtures::{
copy_directory_to_tempdir, create_and_deploy_account, create_and_deploy_oz_account,
duplicate_contract_directory_with_salt, get_accounts_path, get_transaction_hash,
get_transaction_receipt, join_tempdirs,
duplicate_contract_directory_with_salt, get_accounts_path, get_transaction_by_hash,
get_transaction_hash, get_transaction_receipt, join_tempdirs,
};
use crate::helpers::runner::runner;
use configuration::CONFIG_FILENAME;
Expand All @@ -13,6 +13,7 @@ use sncast::AccountType;
use sncast::helpers::constants::{BRAAVOS_CLASS_HASH, OZ_CLASS_HASH, READY_CLASS_HASH};
use sncast::helpers::fee::FeeArgs;
use starknet::core::types::TransactionReceipt::Declare;
use starknet::core::types::{DeclareTransaction, Transaction, TransactionExecutionStatus};
use starknet_types_core::felt::{Felt, NonZeroFelt};
use std::fs;
use test_case::test_case;
Expand Down Expand Up @@ -105,6 +106,7 @@ async fn test_happy_case(class_hash: Felt, account_type: AccountType) {
l1_gas_price: None,
l2_gas: None,
l2_gas_price: None,
tip: Some(100_000),
}; "max_fee")]
#[test_case(FeeArgs{
max_fee: None,
Expand All @@ -114,6 +116,7 @@ async fn test_happy_case(class_hash: Felt, account_type: AccountType) {
l1_gas_price: Some(10_000_000_000_000),
l2_gas: Some(1_000_000_000),
l2_gas_price: Some(100_000_000_000_000_000_000),
tip: None,
}; "resource_bounds")]
#[tokio::test]
async fn test_happy_case_different_fees(fee_args: FeeArgs) {
Expand Down Expand Up @@ -166,6 +169,7 @@ async fn test_happy_case_different_fees(fee_args: FeeArgs) {
"--l2-gas-price",
fee_args.l2_gas_price.map(|x| x.to_string()),
),
("--tip", fee_args.tip.map(|x| x.to_string())),
];

for &(key, ref value) in &options {
Expand All @@ -176,14 +180,22 @@ async fn test_happy_case_different_fees(fee_args: FeeArgs) {
}

let snapbox = runner(&args).current_dir(tempdir.path());
let output = snapbox.assert().success();

let output = output.get_output().stdout.clone();
let output = snapbox.assert().success().get_output().stdout.clone();

let hash = get_transaction_hash(&output);
let receipt = get_transaction_receipt(hash).await;
let Declare(receipt) = get_transaction_receipt(hash).await else {
panic!("Should be Declare receipt");
};
assert_eq!(
receipt.execution_result.status(),
TransactionExecutionStatus::Succeeded
);

assert!(matches!(receipt, Declare(_)));
let Transaction::Declare(DeclareTransaction::V3(tx)) = get_transaction_by_hash(hash).await
else {
panic!("Expected Declare V3 transaction")
};
assert_eq!(tx.tip, fee_args.tip.unwrap_or(0));
}

#[tokio::test]
Expand Down
Loading
Loading