diff --git a/Cargo.lock b/Cargo.lock index 0a6790583d..555363ef3e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -573,7 +573,7 @@ dependencies = [ [[package]] name = "cardano-legacy-address" version = "0.1.1" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "cbor_event", "cryptoxide 0.4.4", @@ -655,7 +655,7 @@ dependencies = [ [[package]] name = "chain-addr" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "bech32 0.8.1", "chain-core 0.1.0 (git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold)", @@ -677,7 +677,7 @@ dependencies = [ [[package]] name = "chain-core" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "chain-ser 0.1.0 (git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold)", ] @@ -707,7 +707,7 @@ dependencies = [ [[package]] name = "chain-crypto" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "bech32 0.8.1", "cryptoxide 0.4.4", @@ -758,7 +758,7 @@ dependencies = [ [[package]] name = "chain-evm" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "aurora-bn", "base64 0.13.1", @@ -819,7 +819,7 @@ dependencies = [ [[package]] name = "chain-impl-mockchain" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "cardano-legacy-address 0.1.1 (git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold)", "chain-addr 0.1.0 (git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold)", @@ -851,7 +851,7 @@ dependencies = [ [[package]] name = "chain-network" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "async-trait", "chain-crypto 0.1.0 (git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold)", @@ -876,7 +876,7 @@ dependencies = [ [[package]] name = "chain-ser" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "thiserror", ] @@ -884,7 +884,7 @@ dependencies = [ [[package]] name = "chain-storage" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "criterion", "data-pile", @@ -909,7 +909,7 @@ dependencies = [ [[package]] name = "chain-time" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "chain-core 0.1.0 (git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold)", "chain-ser 0.1.0 (git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold)", @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "chain-vote" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "cfg-if 1.0.0", "chain-core 0.1.0 (git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold)", @@ -2442,7 +2442,7 @@ dependencies = [ [[package]] name = "imhamt" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" dependencies = [ "proptest", "rustc_version", @@ -4529,9 +4529,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.24" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ad981d6c340a49cdc40a1028d9c6084ec7e9fa33fcb839cab656a267071e234" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ "bitflags 2.4.1", "errno", @@ -4681,9 +4681,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] @@ -4700,9 +4700,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", @@ -4915,7 +4915,7 @@ source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst- [[package]] name = "sparse-array" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" [[package]] name = "spin" @@ -5133,7 +5133,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "redox_syscall 0.4.1", - "rustix 0.38.24", + "rustix 0.38.25", "windows-sys 0.48.0", ] @@ -5717,7 +5717,7 @@ source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst- [[package]] name = "typed-bytes" version = "0.1.0" -source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#07f5e289e051c6a6bca9d699061d42eb94f48480" +source = "git+https://github.com/input-output-hk/chain-libs.git?branch=catalyst-fund9-gold#dbdad860434efc4805a5d4ff1a3d6dfd1f8be0e6" [[package]] name = "typenum" @@ -6051,7 +6051,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.24", + "rustix 0.38.25", ] [[package]] diff --git a/explorer/src/db/indexing.rs b/explorer/src/db/indexing.rs index f4b9f53312..60bd9c1db4 100644 --- a/explorer/src/db/indexing.rs +++ b/explorer/src/db/indexing.rs @@ -378,7 +378,7 @@ impl ExplorerTransaction { .map(|i| i.to_enum()) .zip(witnesses) .filter_map(|input_with_witness| match input_with_witness { - (InputEnum::AccountInput(id, value), Witness::Account(_, _)) => { + (InputEnum::AccountInput(id, value), Witness::Account(_)) => { let kind = chain_addr::Kind::Account( id.to_single_account() .expect("the input to be validated") @@ -387,7 +387,7 @@ impl ExplorerTransaction { let address = ExplorerAddress::New(Address(context.discrimination, kind)); Some(ExplorerInput { address, value }) } - (InputEnum::AccountInput(id, value), Witness::Multisig(_, _)) => { + (InputEnum::AccountInput(id, value), Witness::Multisig(_)) => { let kind = chain_addr::Kind::Multisig( id.to_multi_account() .as_ref() diff --git a/jcli/src/jcli_lib/transaction/mk_witness.rs b/jcli/src/jcli_lib/transaction/mk_witness.rs index 8a7d0305aa..4d5195086a 100644 --- a/jcli/src/jcli_lib/transaction/mk_witness.rs +++ b/jcli/src/jcli_lib/transaction/mk_witness.rs @@ -6,8 +6,6 @@ use bech32::{self, ToBase32 as _}; use chain_core::property::Serialize as _; use chain_impl_mockchain::key::EitherEd25519SecretKey; use chain_impl_mockchain::{ - account::SpendingCounter, - accounting::account::spending::SpendingCounterIncreasing, header::HeaderId, transaction::{TransactionSignDataHash, Witness}, }; @@ -33,17 +31,6 @@ pub struct MkWitness { #[structopt(long = "genesis-block-hash", parse(try_from_str))] pub genesis_block_hash: HeaderId, - /// value is mandatory if `--type=account`. It is the counter value for - /// every time the account is being utilized. - #[structopt(long = "account-spending-counter")] - pub account_spending_counter: Option, - - /// lane to use for the spending counter. Each lane has an independent - /// spending counter value. - /// If unsure, leave blank and lane 0 will be used - #[structopt(long)] - pub account_spending_counter_lane: Option, - /// the file path to the file to read the signing key from. /// If omitted it will be read from the standard input. pub secret: Option, @@ -71,24 +58,11 @@ impl std::str::FromStr for WitnessType { impl MkWitness { pub fn exec(self) -> Result<(), Error> { let secret_key = read_ed25519_secret_key_from_file(&self.secret)?; - let sc = self - .account_spending_counter - .map(|counter| { - let lane = self.account_spending_counter_lane.unwrap_or_default(); - if lane > SpendingCounterIncreasing::LANES { - return Err(Error::MakeWitnessAccountInvalidCounterLane { - max: SpendingCounterIncreasing::LANES, - actual: lane, - }); - } - Ok(SpendingCounter::new(lane, counter)) - }) - .transpose()?; + let witness = make_witness( &self.witness_type, &self.genesis_block_hash, &self.sign_data_hash, - sc, &secret_key, )?; self.write_witness(&witness) @@ -117,7 +91,7 @@ pub fn make_witness( witness_type: &WitnessType, genesis_block_hash: &HeaderId, sign_data_hash: &TransactionSignDataHash, - account_spending_counter: Option, + secret_key: &EitherEd25519SecretKey, ) -> Result { let witness = match witness_type { @@ -130,12 +104,9 @@ pub fn make_witness( |d| (secret_key.to_public(), secret_key.sign(d)), &[0; 32], ), - WitnessType::Account => Witness::new_account( - genesis_block_hash, - sign_data_hash, - account_spending_counter.ok_or(Error::MakeWitnessAccountCounterMissing)?, - |d| secret_key.sign(d), - ), + WitnessType::Account => { + Witness::new_account(genesis_block_hash, sign_data_hash, |d| secret_key.sign(d)) + } }; Ok(witness) } diff --git a/jcli/src/jcli_lib/transaction/simplified.rs b/jcli/src/jcli_lib/transaction/simplified.rs index 40a07ce525..0fc2f399e5 100644 --- a/jcli/src/jcli_lib/transaction/simplified.rs +++ b/jcli/src/jcli_lib/transaction/simplified.rs @@ -8,7 +8,6 @@ use crate::{rest, transaction}; use chain_addr::Kind; use chain_core::property::FromStr; use chain_crypto::{Ed25519, Ed25519Extended, PublicKey, SecretKey}; -use chain_impl_mockchain::account::SpendingCounter; use chain_impl_mockchain::fee::FeeAlgorithm; use chain_impl_mockchain::key::EitherEd25519SecretKey; use chain_impl_mockchain::transaction::Output; @@ -204,7 +203,7 @@ pub fn make_transaction( let transaction_sign_data_hash = transaction.transaction_sign_data_hash()?; // get spending counter - let account_state = rest::v0::account::request_account_information( + let _account_state = rest::v0::account::request_account_information( rest_args, AccountId::try_from_str(&sender_account.to_string())?, )?; @@ -214,7 +213,6 @@ pub fn make_transaction( &WitnessType::Account, &block0_hash, &transaction_sign_data_hash, - Some(SpendingCounter::from(account_state.counters()[0])), &secret_key, )?; diff --git a/jormungandr-lib/src/interfaces/account_state.rs b/jormungandr-lib/src/interfaces/account_state.rs index 227bbfd1d1..95d0bab376 100644 --- a/jormungandr-lib/src/interfaces/account_state.rs +++ b/jormungandr-lib/src/interfaces/account_state.rs @@ -89,7 +89,6 @@ impl LastRewards { pub struct AccountState { delegation: DelegationType, value: Value, - counters: Vec, tokens: BTreeMap, last_rewards: LastRewards, } @@ -110,15 +109,6 @@ impl AccountState { &self.value } - /// The transaction counters for spending lanes. - /// A counter in one of the existing lanes is used as part of the parameter - /// when adding a new account input to a transaction. - /// - #[inline] - pub fn counters(&self) -> Vec { - self.counters.clone() - } - /// the last rewards transfered to account #[inline] pub fn last_rewards(&self) -> &LastRewards { @@ -157,12 +147,6 @@ impl From> for AccountState { AccountState { delegation: account.delegation().clone().into(), value: account.value().into(), - counters: account - .spending - .get_valid_counters() - .into_iter() - .map(Into::into) - .collect(), tokens: account .tokens .iter() @@ -183,12 +167,6 @@ impl<'a, E> From<&'a account::AccountState> for AccountState { AccountState { delegation: account.delegation().clone().into(), value: account.value().into(), - counters: account - .spending - .get_valid_counters() - .into_iter() - .map(Into::into) - .collect(), tokens: account .tokens .iter() diff --git a/jormungandr-lib/src/interfaces/transaction_witness.rs b/jormungandr-lib/src/interfaces/transaction_witness.rs index a54cdc24e7..b2be61bdcd 100644 --- a/jormungandr-lib/src/interfaces/transaction_witness.rs +++ b/jormungandr-lib/src/interfaces/transaction_witness.rs @@ -161,7 +161,7 @@ mod test { fn arbitrary(g: &mut G) -> Self { match u8::arbitrary(g) % 3 { 0 => Witness::Utxo(Arbitrary::arbitrary(g)).into(), - 1 => Witness::Account(Arbitrary::arbitrary(g), Arbitrary::arbitrary(g)).into(), + 1 => Witness::Account(Arbitrary::arbitrary(g)).into(), 2 => { use crate::crypto::key::KeyPair; use chain_crypto::Ed25519Bip32; diff --git a/testing/jormungandr-automation/src/jcli/api/transaction.rs b/testing/jormungandr-automation/src/jcli/api/transaction.rs index 9993de708d..3f93ff51ef 100644 --- a/testing/jormungandr-automation/src/jcli/api/transaction.rs +++ b/testing/jormungandr-automation/src/jcli/api/transaction.rs @@ -173,7 +173,6 @@ impl Transaction { &witness.block_hash.to_hex(), &witness.transaction_id.to_hex(), witness.addr_type, - witness.account_spending_counter, &witness.file, &witness.private_key_path, ) @@ -188,7 +187,6 @@ impl Transaction { &witness.block_hash.to_hex(), &witness.transaction_id.to_hex(), witness.addr_type, - witness.account_spending_counter, &witness.file, &witness.private_key_path, ) diff --git a/testing/jormungandr-automation/src/jcli/command/transaction.rs b/testing/jormungandr-automation/src/jcli/command/transaction.rs index ff758e9beb..ff7ad89bc5 100644 --- a/testing/jormungandr-automation/src/jcli/command/transaction.rs +++ b/testing/jormungandr-automation/src/jcli/command/transaction.rs @@ -1,5 +1,5 @@ use crate::jcli::WitnessType; -use chain_impl_mockchain::{account::SpendingCounter, fee::LinearFee}; +use chain_impl_mockchain::fee::LinearFee; use std::path::Path; use std::process::Command; @@ -109,11 +109,10 @@ impl TransactionCommand { block0_hash: &str, tx_id: &str, addr_type: WitnessType, - account_spending_counter: Option, + witness_file: P, witness_key: Q, ) -> Self { - let spending_counter = account_spending_counter.unwrap_or_else(SpendingCounter::zero); self.command .arg("make-witness") .arg("--genesis-block-hash") @@ -122,10 +121,6 @@ impl TransactionCommand { .arg(addr_type.to_string()) .arg(&tx_id) .arg(witness_file.as_ref()) - .arg("--account-spending-counter") - .arg(spending_counter.unlaned_counter().to_string()) - .arg("--account-spending-counter-lane") - .arg(spending_counter.lane().to_string()) .arg(witness_key.as_ref()); self } diff --git a/testing/jormungandr-automation/src/jcli/data/witness.rs b/testing/jormungandr-automation/src/jcli/data/witness.rs index 21f5697a41..2eccdbf0eb 100644 --- a/testing/jormungandr-automation/src/jcli/data/witness.rs +++ b/testing/jormungandr-automation/src/jcli/data/witness.rs @@ -1,7 +1,6 @@ use assert_fs::fixture::PathChild; use assert_fs::prelude::*; use assert_fs::TempDir; -use chain_impl_mockchain::account::SpendingCounter; use jormungandr_lib::crypto::hash::Hash; use std::fmt; use std::path::PathBuf; @@ -30,7 +29,6 @@ pub struct Witness { pub transaction_id: Hash, pub addr_type: WitnessType, pub private_key_path: PathBuf, - pub account_spending_counter: Option, pub file: PathBuf, } @@ -41,7 +39,6 @@ impl Witness { transaction_id: &Hash, addr_type: WitnessType, private_key: &str, - account_spending_counter: Option, ) -> Witness { Witness { block_hash: *block_hash, @@ -49,7 +46,6 @@ impl Witness { addr_type, private_key_path: write_witness_key(temp_dir, private_key), file: temp_dir.child("witness").path().into(), - account_spending_counter, } } } @@ -65,15 +61,13 @@ fn write_witness_key(temp_dir: &impl PathChild, witness_key: &str) -> PathBuf { pub struct WitnessData { pub secret_bech32: String, pub addr_type: WitnessType, - pub spending_counter: Option, } impl WitnessData { - pub fn new_account(signing_key: &str, spending_counter: SpendingCounter) -> Self { + pub fn new_account(signing_key: &str) -> Self { Self { secret_bech32: signing_key.to_owned(), addr_type: WitnessType::Account, - spending_counter: Some(spending_counter), } } @@ -81,14 +75,9 @@ impl WitnessData { Self { secret_bech32: signing_key.to_owned(), addr_type: WitnessType::UTxO, - spending_counter: None, } } - pub fn spending_counter(&self) -> Option { - self.spending_counter - } - pub fn into_witness( &self, staging_dir: &TempDir, @@ -101,7 +90,6 @@ impl WitnessData { transaction_id, self.addr_type, &self.secret_bech32, - self.spending_counter(), ) } } diff --git a/testing/jormungandr-automation/src/jcli/services/transaction_builder.rs b/testing/jormungandr-automation/src/jcli/services/transaction_builder.rs index 27ed2d0b88..279456dfa3 100644 --- a/testing/jormungandr-automation/src/jcli/services/transaction_builder.rs +++ b/testing/jormungandr-automation/src/jcli/services/transaction_builder.rs @@ -5,7 +5,7 @@ use assert_fs::fixture::ChildPath; use assert_fs::{prelude::*, TempDir}; use chain_core::packer::Codec; use chain_core::property::DeserializeFromSlice; -use chain_impl_mockchain::{account::SpendingCounter, fee::LinearFee, fragment::Fragment}; +use chain_impl_mockchain::{fee::LinearFee, fragment::Fragment}; use jormungandr_lib::interfaces::Address; use jormungandr_lib::{ crypto::hash::Hash, @@ -224,15 +224,10 @@ impl TransactionBuilder { witness_data.into_witness(&self.staging_dir, &self.genesis_hash, &transaction_id) } - pub fn create_witness_default( - &self, - addr_type: WitnessType, - spending_counter: Option, - ) -> Witness { + pub fn create_witness_default(&self, addr_type: WitnessType) -> Witness { self.create_witness(WitnessData { secret_bech32: self.jcli.key().generate_default(), addr_type: addr_type.to_owned(), - spending_counter, }) }