From 9b3a4129d2c4f096adc2dc4402bb427b233fb8ff Mon Sep 17 00:00:00 2001 From: Amine ElQaraoui Date: Wed, 7 Oct 2026 21:41:38 +0000 Subject: [PATCH] chore: migrate to Arch 0.12.0 --- .github/workflows/deploy-program.yml | 2 +- Cargo.lock | 148 +++++++++++++++++---------- Cargo.toml | 10 +- README.md | 11 +- src/commands/deploy.rs | 9 +- src/commands/deploy_tests.rs | 43 +++----- src/commands/init.rs | 4 +- src/commands/transfer_arch.rs | 1 - src/idl.rs | 8 +- src/idl_tests.rs | 41 +++----- src/token.rs | 1 - 11 files changed, 143 insertions(+), 135 deletions(-) diff --git a/.github/workflows/deploy-program.yml b/.github/workflows/deploy-program.yml index 24b753e..f343cdc 100644 --- a/.github/workflows/deploy-program.yml +++ b/.github/workflows/deploy-program.yml @@ -68,7 +68,7 @@ permissions: contents: read env: - ARCH_KIT_VERSION: 0.1.7 + ARCH_KIT_VERSION: 0.1.8 ANZA_VERSION: v3.1.9 CARGO_TERM_COLOR: always diff --git a/Cargo.lock b/Cargo.lock index 51ada13..8545027 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -110,34 +110,23 @@ checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] name = "apl-associated-token-account" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebf329a037532f8a68c97a22b744c12f69b4a4047a856a98d2bac1791df091ae" +checksum = "8f29cf6b3a3e7604120cfeed967a6097b371fdbf4321000c0f4ca7be1579d691" dependencies = [ "apl-token", "arch_program", - "arrayref", - "bitcoin", - "bitcoin-io", - "borsh", - "bytemuck", - "num-derive", - "num-traits", - "num_enum", - "thiserror 1.0.69", ] [[package]] name = "apl-token" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d8e571efc56872aa86207318e8815094a99c66e2c918563dd211e713904e75a" +checksum = "76e3cb1b8ce4323e3377af41718848b9d191b8074196836c23ed7abeaaaacf75" dependencies = [ "arch_program", "arrayref", "bitcoin", - "bitcoin-io", - "borsh", "bytemuck", "num-derive", "num-traits", @@ -147,7 +136,7 @@ dependencies = [ [[package]] name = "arch-kit" -version = "0.1.7" +version = "0.1.8" dependencies = [ "aes-gcm", "apl-associated-token-account", @@ -246,16 +235,14 @@ dependencies = [ [[package]] name = "arch_program" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd4e72bc998026212305285fc192aec473bcc03c4a90ae1bc7c4053c35d615d" +checksum = "d36c0fd05cbc8fe52059674b5f626139e361c586a2b5ffdda98ff40870206146" dependencies = [ "arch-titan-types-core", "base64 0.22.1", - "bincode", "bitcode", "bitcoin", - "bitcoin-io", "bitcoin_slices", "borsh", "bs58", @@ -275,13 +262,14 @@ dependencies = [ "sha3", "solana-sanitize", "thiserror 1.0.69", + "wincode", ] [[package]] name = "arch_sdk" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bbb906f2bf8f7c9e79314e11fce31f42feeef4316d66dbf56116dd787a4b70" +checksum = "f81040d8a2210560583381a7f315e48bfef6c2a4f49489363453b41ae276ce2a" dependencies = [ "arch-titan-client", "arch_program", @@ -304,6 +292,7 @@ dependencies = [ "tokio", "tokio-tungstenite", "tracing", + "url", "uuid", ] @@ -375,15 +364,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bip322" version = "0.0.11" @@ -708,15 +688,14 @@ checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] name = "console" -version = "0.15.11" +version = "0.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" +checksum = "e96a4956774c13c126a8b5af4daa79384f4d826534c95a02d76afb39e2ab64e3" dependencies = [ "encode_unicode", "libc", - "once_cell", "unicode-width", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -841,6 +820,40 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "darling" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.119", +] + [[package]] name = "data-encoding" version = "2.11.1" @@ -1389,6 +1402,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "1.1.0" @@ -1441,14 +1460,14 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.17.11" +version = "0.18.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" +checksum = "9433806cd6b4ec1aba79c021c7e4c58fb4c3b9977c085062e611ac929998fb0c" dependencies = [ "console", - "number_prefix", "portable-atomic", "unicode-width", + "unit-prefix", "web-time", ] @@ -1692,12 +1711,6 @@ dependencies = [ "syn 2.0.119", ] -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - [[package]] name = "once_cell" version = "1.21.4" @@ -1753,6 +1766,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "pastey" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" + [[package]] name = "percent-encoding" version = "2.3.2" @@ -2817,6 +2836,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +[[package]] +name = "unit-prefix" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" + [[package]] name = "universal-hash" version = "0.6.1" @@ -2843,6 +2868,7 @@ dependencies = [ "idna", "percent-encoding", "serde", + "serde_derive", ] [[package]] @@ -3003,6 +3029,31 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "wincode" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d4abae4bfc30e59d97d3ea4924e5c5e7fede946390bffbd52c076c081b87a6c" +dependencies = [ + "pastey", + "proc-macro2", + "quote", + "thiserror 2.0.20", + "wincode-derive", +] + +[[package]] +name = "wincode-derive" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d582d9fc9d813264407a9e16bfa16846ccf15ef032f9bbcd700741bdc00255" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "windows-link" version = "0.2.1" @@ -3047,15 +3098,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-sys" version = "0.61.2" diff --git a/Cargo.toml b/Cargo.toml index 5643abe..2c33fd6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "arch-kit" -version = "0.1.7" +version = "0.1.8" edition = "2024" -rust-version = "1.85" +rust-version = "1.89" description = "Command-line toolkit for developing, deploying, and interacting with Arch Network programs" repository = "https://github.com/Arch-Network/arch-kit" license = "MIT" @@ -20,9 +20,9 @@ include = [ [dependencies] aes-gcm = { version = "0.11.1", default-features = false, features = ["aes", "alloc"] } -apl-associated-token-account = { version = "=0.10.0", features = ["no-entrypoint"] } -apl-token = { version = "=0.10.0", features = ["no-entrypoint"] } -arch_sdk = "=0.10.0" +apl-associated-token-account = { version = "=0.12.0", features = ["no-entrypoint"] } +apl-token = { version = "=0.12.0", features = ["no-entrypoint"] } +arch_sdk = "=0.12.0" arch-satellite-lang-idl = { version = "=0.31.5", features = ["build"] } base64 = "0.22" bitcoin = "=0.32.7" diff --git a/README.md b/README.md index ebd7901..bc5be15 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,11 @@ `arch-kit` is a CLI for generating Arch keys, deploying programs, publishing canonical on-chain IDLs, and inspecting APL tokens. +arch-kit targets Arch Network 0.12 (`arch_sdk`, `apl-token`, and +`apl-associated-token-account` 0.12.0). Arch 0.12 reset the chain and removed +account UTXO anchoring and transaction rollback status from RPC responses, so +use arch-kit 0.1.7 or earlier only against pre-0.12 nodes. + ## Install Install the published crate with Cargo: @@ -40,7 +45,7 @@ with the reusable workflow: ```yaml jobs: deploy: - uses: Arch-Network/arch-kit/.github/workflows/deploy-program.yml@v0.1.7 + uses: Arch-Network/arch-kit/.github/workflows/deploy-program.yml@v0.1.8 with: program-path: program bitcoin-network: testnet @@ -185,7 +190,9 @@ The destination must not exist. The command creates a Satellite program whose declared ID is derived from the supplied program key. Its `say_hello` instruction requires a user signer and logs `Hello `; the signature constraint uses the custom error defined in `src/error.rs`. The -secret key is read only and is not copied into the project. +generated project depends on `arch-satellite-lang` 0.34.0, which builds on +`arch_program` 0.12.0. The secret key is read only and is not copied into the +project. Build the generated program from its project directory, or pass its manifest path explicitly: diff --git a/src/commands/deploy.rs b/src/commands/deploy.rs index 5181f45..5b4f381 100644 --- a/src/commands/deploy.rs +++ b/src/commands/deploy.rs @@ -209,7 +209,7 @@ pub(crate) fn run(config: &Config, args: Args) -> Result<()> { Ok(()) } -// SDK 0.10.0 skips account creation whenever the program account exists, even +// SDK 0.12.0 skips account creation whenever the program account exists, even // when it is an empty System account created by an earlier funding transfer. fn prepare_program_account( config: &Config, @@ -258,13 +258,10 @@ fn prepare_program_account( )?; let txid = client.send_transaction(transaction)?; let processed = client.wait_for_processed_transaction(&txid)?; - if processed.status != Status::Processed || !processed.rollback_status.is_applied() { + if processed.status != Status::Processed { return Err(CliError::TransactionFailed { action: format!("program account assignment ({txid})"), - status: format!( - "{:?}, rollback={:?}", - processed.status, processed.rollback_status - ), + status: format!("{:?}", processed.status), }); } let assigned = client.read_account_info(program)?; diff --git a/src/commands/deploy_tests.rs b/src/commands/deploy_tests.rs index c7bdf6a..9f7ec78 100644 --- a/src/commands/deploy_tests.rs +++ b/src/commands/deploy_tests.rs @@ -17,19 +17,18 @@ fn account(owner: Pubkey) -> AccountInfo { lamports: 500_000_000, owner, data: vec![], - utxo: format!("{}:0", "00".repeat(32)), is_executable: false, } } -fn processed(status: Value, rollback: Value) -> Value { +fn processed(status: Value) -> Value { json!({"result": { - "status": status, "rollback_status": rollback, + "status": status, "bitcoin_txid": null, "logs": [], "inner_instructions_list": [], }}) } -fn assignment_replies(status: Value, rollback: Value) -> Vec<(&'static str, Value)> { +fn assignment_replies(status: Value) -> Vec<(&'static str, Value)> { vec![ ( "read_account_info", @@ -40,7 +39,7 @@ fn assignment_replies(status: Value, rollback: Value) -> Vec<(&'static str, Valu json!({"result": "00".repeat(32)}), ), ("send_transaction", json!({"result": "11".repeat(32)})), - ("get_processed_transaction", processed(status, rollback)), + ("get_processed_transaction", processed(status)), ] } @@ -52,10 +51,7 @@ fn run_rpc(replies: Vec<(&'static str, Value)>) -> (Result<()>, Vec) { #[test] fn funded_system_account_is_assigned_with_both_mainnet_signatures() { - let mut replies = assignment_replies( - json!({"type": "processed"}), - json!({"type": "notRolledback"}), - ); + let mut replies = assignment_replies(json!({"type": "processed"})); replies.push(( "read_account_info", json!({"result": account(BPF_LOADER_ID)}), @@ -117,28 +113,16 @@ fn invalid_accounts_and_rpc_errors_stop_before_submission() { } #[test] -fn failed_or_rolled_back_assignment_stops_deployment() { - for (status, rollback) in [ - ( - json!({"type": "failed", "message": "Insufficient funds"}), - json!({"type": "notRolledback"}), - ), - ( - json!({"type": "processed"}), - json!({"type": "rolledback", "message": "Reverted"}), - ), - ] { - let (result, _) = run_rpc(assignment_replies(status, rollback)); - assert!(matches!(result, Err(CliError::TransactionFailed { .. }))); - } +fn failed_assignment_stops_deployment() { + let (result, _) = run_rpc(assignment_replies( + json!({"type": "failed", "message": "Insufficient funds"}), + )); + assert!(matches!(result, Err(CliError::TransactionFailed { .. }))); } #[test] fn unchanged_owner_after_processed_assignment_stops_deployment() { - let mut replies = assignment_replies( - json!({"type": "processed"}), - json!({"type": "notRolledback"}), - ); + let mut replies = assignment_replies(json!({"type": "processed"})); replies.push(( "read_account_info", json!({"result": account(system_program::SYSTEM_PROGRAM_ID)}), @@ -259,10 +243,7 @@ fn funding_scales_with_elf_size_and_skips_existing_funds() { funded.lamports = lamports; ("read_account_info", json!({"result": funded})) }; - let mut receipt = processed( - json!({"type": "processed"}), - json!({"type": "notRolledback"}), - ); + let mut receipt = processed(json!({"type": "processed"})); receipt["result"]["runtime_transaction"] = json!(RuntimeTransaction { version: 0, signatures: vec![], diff --git a/src/commands/init.rs b/src/commands/init.rs index 4fc049c..8e9a658 100644 --- a/src/commands/init.rs +++ b/src/commands/init.rs @@ -13,7 +13,7 @@ use crate::{ keys::{load_existing_key, pubkey_hex}, }; -const SATELLITE_VERSION: &str = "0.31.5"; +const SATELLITE_VERSION: &str = "0.34.0"; static SIMPLE_PROGRAM_TEMPLATE: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/simple_program"); @@ -356,7 +356,7 @@ mod tests { assert!(manifest.contains("name = \"hello-world\"")); assert!(manifest.contains("[workspace]")); - assert!(manifest.contains("arch-satellite-lang = \"=0.31.5\"")); + assert!(manifest.contains("arch-satellite-lang = \"=0.34.0\"")); assert!(manifest.contains("unicode-segmentation = \"=1.12.0\"")); assert!(source.contains( "declare_id!(\"1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f\")" diff --git a/src/commands/transfer_arch.rs b/src/commands/transfer_arch.rs index 03d888b..25cd332 100644 --- a/src/commands/transfer_arch.rs +++ b/src/commands/transfer_arch.rs @@ -184,7 +184,6 @@ mod tests { lamports: 100_005_000, owner: system_program::SYSTEM_PROGRAM_ID, data: Vec::new(), - utxo: String::new(), is_executable: false, }; assert!(validate_source_account(address, &valid, 100_005_000).is_ok()); diff --git a/src/idl.rs b/src/idl.rs index d21e5aa..3f5b076 100644 --- a/src/idl.rs +++ b/src/idl.rs @@ -556,13 +556,10 @@ fn send( let transaction = build_and_sign_transaction(message, signers, client.config.network)?; let transaction_id = client.send_transaction(transaction)?; let processed = client.wait_for_processed_transaction(&transaction_id)?; - if processed.status != Status::Processed || !processed.rollback_status.is_applied() { + if processed.status != Status::Processed { return Err(CliError::TransactionFailed { action, - status: format!( - "{:?}, rollback={:?}", - processed.status, processed.rollback_status - ), + status: format!("{:?}", processed.status), }); } println!(" {action}: {transaction_id}"); @@ -771,7 +768,6 @@ mod tests { lamports: 0, owner: program, data, - utxo: String::new(), is_executable: false, }; diff --git a/src/idl_tests.rs b/src/idl_tests.rs index fe90ae7..7dad464 100644 --- a/src/idl_tests.rs +++ b/src/idl_tests.rs @@ -40,7 +40,6 @@ fn account(prepared: &PreparedIdl, capacity: usize) -> AccountInfo { lamports: minimum_rent(capacity), owner: program(), data, - utxo: format!("{}:0", "00".repeat(32)), is_executable: false, } } @@ -49,7 +48,7 @@ fn read_reply(account: &AccountInfo) -> (&'static str, Value) { ("read_account_info", json!({"result": account})) } -fn transaction_replies(status: Value, rollback: Value) -> Vec<(&'static str, Value)> { +fn transaction_replies(status: Value) -> Vec<(&'static str, Value)> { vec![ ( "get_best_finalized_block_hash", @@ -59,7 +58,7 @@ fn transaction_replies(status: Value, rollback: Value) -> Vec<(&'static str, Val ( "get_processed_transaction", json!({"result": { - "status": status, "rollback_status": rollback, + "status": status, "bitcoin_txid": null, "logs": [], "inner_instructions_list": [], }}), ), @@ -67,10 +66,7 @@ fn transaction_replies(status: Value, rollback: Value) -> Vec<(&'static str, Val } fn successful_transaction() -> Vec<(&'static str, Value)> { - transaction_replies( - json!({"type": "processed"}), - json!({"type": "notRolledback"}), - ) + transaction_replies(json!({"type": "processed"})) } fn resize_setup(existing: &AccountInfo) -> Vec<(&'static str, Value)> { @@ -349,26 +345,17 @@ fn upgrades_that_fit_keep_existing_capacity_with_either_flag_value() { } #[test] -fn rejected_or_rolled_back_resize_stops_before_uploading_an_upgrade() { - for (status, rollback) in [ - ( - json!({"type": "failed", "message": "IdlAccountNotEmpty"}), - json!({"type": "notRolledback"}), - ), - ( - json!({"type": "processed"}), - json!({"type": "rolledback", "message": "Reverted"}), - ), - ] { - let old = prepared(None); - let existing = account(&old, required_space(old.compressed.len()).unwrap()); - let mut replies = vec![read_reply(&existing)]; - replies.extend(resize_setup(&existing)); - replies.extend(transaction_replies(status, rollback)); - let (result, transactions) = run_publish(replies, updated(), true); - assert!(matches!(result, Err(CliError::TransactionFailed { .. }))); - assert_eq!(transactions.len(), 3); - } +fn rejected_resize_stops_before_uploading_an_upgrade() { + let old = prepared(None); + let existing = account(&old, required_space(old.compressed.len()).unwrap()); + let mut replies = vec![read_reply(&existing)]; + replies.extend(resize_setup(&existing)); + replies.extend(transaction_replies( + json!({"type": "failed", "message": "IdlAccountNotEmpty"}), + )); + let (result, transactions) = run_publish(replies, updated(), true); + assert!(matches!(result, Err(CliError::TransactionFailed { .. }))); + assert_eq!(transactions.len(), 3); } #[test] diff --git a/src/token.rs b/src/token.rs index b36bde6..e7a2def 100644 --- a/src/token.rs +++ b/src/token.rs @@ -275,7 +275,6 @@ mod tests { lamports: 0, owner, data, - utxo: String::new(), is_executable: false, } }