diff --git a/.gitignore b/.gitignore index ef3881b..25bdc84 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ target/ # Ignore state machine binary ic-test-state-machine + +.vscode \ No newline at end of file diff --git a/cycles-ledger/src/storage.rs b/cycles-ledger/src/storage.rs index aeccb33..1b07a59 100644 --- a/cycles-ledger/src/storage.rs +++ b/cycles-ledger/src/storage.rs @@ -741,7 +741,9 @@ pub fn transfer( // if `amount` + `fee` overflows then the user doesn't have enough funds let Some(amount_with_fee) = amount.checked_add(config::FEE) else { - return Err(InsufficientFunds { balance: balance_of(&from).into() }); + return Err(InsufficientFunds { + balance: balance_of(&from).into(), + }); }; // check allowance @@ -1315,7 +1317,9 @@ pub fn validate_created_at_time( created_at_time: &Option, now: u64, ) -> Result<(), CreatedAtTimeValidationError> { - let Some(created_at_time) = created_at_time else { return Ok(())}; + let Some(created_at_time) = created_at_time else { + return Ok(()); + }; if created_at_time .saturating_add(config::TRANSACTION_WINDOW.as_nanos() as u64) .saturating_add(config::PERMITTED_DRIFT.as_nanos() as u64) @@ -1414,7 +1418,9 @@ pub async fn send( // if `amount` + `fee` overflows then the user doesn't have enough funds let Some(amount_with_fee) = amount.checked_add(config::FEE) else { - return Err(InsufficientFunds { balance: balance_of(&from).into() }); + return Err(InsufficientFunds { + balance: balance_of(&from).into(), + }); }; // check that the `from` account has enough funds @@ -1521,7 +1527,9 @@ pub async fn create_canister( // if `amount` + `fee` overflows then the user doesn't have enough funds let Some(amount_with_fee) = amount.checked_add(config::FEE) else { - return Err(InsufficientFunds { balance: balance_of(&from).into() }); + return Err(InsufficientFunds { + balance: balance_of(&from).into(), + }); }; // check that the `from` account has enough funds @@ -1856,7 +1864,8 @@ fn prune_transactions(now: u64, s: &mut State, limit: usize) { pruned += 1; let Some(block) = s.blocks.get(block_idx) else { - log!(P0, + log!( + P0, "Cannot find block with id: {}. The block id was associated \ with the timestamp: {} and was selected for pruning from \ the timestamp and hashes pools", diff --git a/cycles-ledger/tests/tests.rs b/cycles-ledger/tests/tests.rs index aa7aa65..3724f23 100644 --- a/cycles-ledger/tests/tests.rs +++ b/cycles-ledger/tests/tests.rs @@ -69,7 +69,7 @@ fn new_state_machine() -> StateMachine { let platform: &str = "darwin"; #[cfg(target_os = "linux")] let platform: &str = "linux"; - let suggested_ic_commit = "a17247bd86c7aa4e87742bf74d108614580f216d"; + let suggested_ic_commit = "072b2a6586c409efa88f2244d658307ff3a645d8"; // not run automatically because parallel test execution screws this up panic!("state machine binary does not exist. Please run the following command and try again: ./download-state-machine.sh {suggested_ic_commit} {platform}"); @@ -128,7 +128,10 @@ fn install_fake_cmc(env: &StateMachine) { }) .unwrap(), ) - .unwrap() else {panic!("Failed to create CMC")}; + .unwrap() + else { + panic!("Failed to create CMC") + }; let response = Decode!(&response, ProvisionalCreateResponse).unwrap(); assert_eq!(response.canister_id, CMC_PRINCIPAL); env.add_cycles(CMC_PRINCIPAL, u128::MAX / 2); @@ -1685,6 +1688,7 @@ fn test_icrc1_test_suite() { assert_eq!(deposit_res.balance, 1_000_000_000_000_000_u128); assert_eq!(1_000_000_000_000_000, balance_of(&env, ledger_id, user)); + #[allow(clippy::arc_with_non_send_sync)] let ledger_env = icrc1_test_env_state_machine::SMLedger::new(Arc::new(env), ledger_id, user.owner); let tests = icrc1_test_suite::test_suite(ledger_env) @@ -2006,10 +2010,12 @@ fn test_create_canister() { "No duplicate reported" ); let CreateCanisterError::Duplicate { - canister_id: Some(duplicate_canister_id), - .. - } - = duplicate else {panic!("No duplicate canister reported")}; + canister_id: Some(duplicate_canister_id), + .. + } = duplicate + else { + panic!("No duplicate canister reported") + }; assert_eq!( canister, duplicate_canister_id, "Different canister id returned" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index cb3cd68..781cb34 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.71.1" +channel = "1.72.0" targets = ["wasm32-unknown-unknown"] components = ["rustfmt", "clippy"]