diff --git a/Cargo.lock b/Cargo.lock index cb740f91e..ecd4a3ec1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4384,7 +4384,7 @@ dependencies = [ [[package]] name = "frost-core" -version = "1.0.1" +version = "1.0.2" dependencies = [ "byteorder", "debugless-unwrap", @@ -4401,7 +4401,7 @@ dependencies = [ [[package]] name = "frost-ed25519" -version = "1.0.1" +version = "1.0.2" dependencies = [ "curve25519-dalek 4.1.2", "frost-core", @@ -4413,7 +4413,7 @@ dependencies = [ [[package]] name = "frost-ed448" -version = "1.0.1" +version = "1.0.2" dependencies = [ "ed448-goldilocks-plus", "frost-core", @@ -4425,7 +4425,7 @@ dependencies = [ [[package]] name = "frost-p256" -version = "1.0.1" +version = "1.0.2" dependencies = [ "frost-core", "p256", @@ -4437,7 +4437,7 @@ dependencies = [ [[package]] name = "frost-p384" -version = "1.0.1" +version = "1.0.2" dependencies = [ "frost-core", "p384", @@ -4449,7 +4449,7 @@ dependencies = [ [[package]] name = "frost-redjubjub" -version = "1.0.1" +version = "1.0.2" dependencies = [ "blake2 0.10.6", "frost-core", @@ -4463,7 +4463,7 @@ dependencies = [ [[package]] name = "frost-ristretto255" -version = "1.0.1" +version = "1.0.2" dependencies = [ "curve25519-dalek 4.1.2", "frost-core", @@ -4475,7 +4475,7 @@ dependencies = [ [[package]] name = "frost-secp256k1" -version = "1.0.1" +version = "1.0.2" dependencies = [ "frost-core", "k256", @@ -4487,7 +4487,7 @@ dependencies = [ [[package]] name = "frost-taproot" -version = "1.0.1" +version = "1.0.2" dependencies = [ "frost-core", "k256", @@ -7509,7 +7509,7 @@ dependencies = [ [[package]] name = "pallet-airdrop-claims" -version = "1.0.1" +version = "1.0.2" dependencies = [ "frame-benchmarking", "frame-support", @@ -7696,7 +7696,7 @@ dependencies = [ [[package]] name = "pallet-dkg" -version = "1.0.1" +version = "1.0.2" dependencies = [ "cggmp21", "derivation-path", @@ -8368,7 +8368,7 @@ dependencies = [ [[package]] name = "pallet-jobs" -version = "1.0.1" +version = "1.0.2" dependencies = [ "ethereum", "ethers", @@ -8414,7 +8414,7 @@ dependencies = [ [[package]] name = "pallet-jobs-rpc" -version = "1.0.1" +version = "1.0.2" dependencies = [ "jsonrpsee 0.20.3", "pallet-jobs-rpc-runtime-api", @@ -8430,7 +8430,7 @@ dependencies = [ [[package]] name = "pallet-jobs-rpc-runtime-api" -version = "1.0.1" +version = "1.0.2" dependencies = [ "parity-scale-codec 3.6.9", "sp-api", @@ -8525,7 +8525,7 @@ dependencies = [ [[package]] name = "pallet-roles" -version = "1.0.1" +version = "1.0.2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8784,7 +8784,7 @@ dependencies = [ [[package]] name = "pallet-zksaas" -version = "1.0.1" +version = "1.0.2" dependencies = [ "ark-bn254", "ark-crypto-primitives", @@ -14342,7 +14342,7 @@ dependencies = [ [[package]] name = "tangle" -version = "1.0.1" +version = "1.0.2" dependencies = [ "clap", "fc-api", @@ -14443,7 +14443,7 @@ dependencies = [ [[package]] name = "tangle-crypto-primitives" -version = "1.0.1" +version = "1.0.2" dependencies = [ "parity-scale-codec 3.6.9", "scale-info", @@ -14452,7 +14452,7 @@ dependencies = [ [[package]] name = "tangle-primitives" -version = "1.0.1" +version = "1.0.2" dependencies = [ "ark-bn254", "ark-crypto-primitives", @@ -14480,7 +14480,7 @@ dependencies = [ [[package]] name = "tangle-runtime" -version = "1.0.1" +version = "1.0.2" dependencies = [ "evm-tracer", "fp-account", @@ -14586,7 +14586,7 @@ dependencies = [ [[package]] name = "tangle-subxt" -version = "1.0.1" +version = "1.0.2" dependencies = [ "hex", "parity-scale-codec 3.6.9", @@ -14601,7 +14601,7 @@ dependencies = [ [[package]] name = "tangle-testnet-runtime" -version = "1.0.1" +version = "1.0.2" dependencies = [ "evm-tracer", "fp-account", @@ -14708,7 +14708,7 @@ dependencies = [ [[package]] name = "tangle-voter" -version = "1.0.1" +version = "1.0.2" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 0e00bff8c..ea386f64c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "1.0.1" +version = "1.0.2" authors = ["Webb Technologies Inc."] edition = "2021" license = "Unlicense" diff --git a/pallets/claims/src/lib.rs b/pallets/claims/src/lib.rs index 76a8772b9..aca76b626 100644 --- a/pallets/claims/src/lib.rs +++ b/pallets/claims/src/lib.rs @@ -51,7 +51,7 @@ use sp_io::{ use sp_runtime::{ traits::{CheckedSub, Zero}, transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction}, - RuntimeDebug, + AccountId32, RuntimeDebug, }; use sp_std::{convert::TryInto, prelude::*, vec}; use utils::Sr25519Signature; @@ -420,6 +420,19 @@ pub mod pallet { ExpiryConfig::::set(Some((expiry_block, dest))); Ok(()) } + + /// Claim from signed origin + #[pallet::weight(T::WeightInfo::claim())] + #[pallet::call_index(6)] + pub fn claim_signed(origin: OriginFor, dest: Option) -> DispatchResult { + let origin = ensure_signed(origin)?; + let account_id_32 = AccountId32::decode(&mut origin.encode().as_ref()) + .map_err(|_| Error::::InvalidNativeAccount)?; + let signer = MultiAddress::Native(account_id_32); + ensure!(Signing::::get(&signer).is_none(), Error::::InvalidStatement); + Self::process_claim(signer, dest)?; + Ok(()) + } } #[pallet::validate_unsigned] diff --git a/pallets/claims/src/tests.rs b/pallets/claims/src/tests.rs index 34c2da968..a2ac9b063 100644 --- a/pallets/claims/src/tests.rs +++ b/pallets/claims/src/tests.rs @@ -6,6 +6,7 @@ use hex_literal::hex; use parity_scale_codec::Encode; use secp_utils::*; use sp_core::ConstU32; +use sp_core::Pair; use sp_runtime::{BoundedVec, TokenError::Frozen}; // The testing primitives are very useful for avoiding having to work with signatures @@ -898,6 +899,21 @@ fn test_claim_from_substrate_address_to_evm() { }); } +#[test] +fn test_claim_alice_signed_extrinsic() { + new_test_ext().execute_with(|| { + let original_total_claims = Total::::get(); + let claim_of_alice = 500; + let alice_account_id_32 = AccountId32::from(alice_sr25519().public()); + assert_ok!(ClaimsPallet::claim_signed( + RuntimeOrigin::signed(alice_account_id_32.clone()), + None, + )); + assert_eq!(Total::::get(), original_total_claims - claim_of_alice); + assert_eq!(Balances::free_balance(alice_account_id_32), 500); + }); +} + #[test] fn test_double_claim_fails_for_substrate_account() { new_test_ext().execute_with(|| { diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 3472d29df..e50572c90 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -90,7 +90,7 @@ pub mod currency { /// Lets assume 100 TNT = 1USD /// This assumption forms the base of all fee calculations, revisit this /// if the assumption is no longer true. - pub const DOLLAR: Balance = UNIT * 100; + pub const DOLLAR: Balance = UNIT * 10; pub const CENT: Balance = DOLLAR / 100; pub const MILLICENT: Balance = CENT / 1000; /// The existential deposit. diff --git a/runtime/mainnet/src/lib.rs b/runtime/mainnet/src/lib.rs index b0758e031..3952ea149 100644 --- a/runtime/mainnet/src/lib.rs +++ b/runtime/mainnet/src/lib.rs @@ -171,7 +171,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("tangle"), impl_name: create_runtime_str!("tangle"), authoring_version: 1, - spec_version: 1001, // v1.0.1 + spec_version: 1002, // v1.0.2 impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -1043,10 +1043,9 @@ impl pallet_tx_pause::Config for Runtime { } parameter_types! { - pub const BasicDeposit: Balance = deposit(0, 200); - pub const ByteDeposit: Balance = deposit(0, 50); - pub const FieldDeposit: Balance = deposit(0, 33); - pub const SubAccountDeposit: Balance = deposit(1, 53); + pub const BasicDeposit: Balance = deposit(0, 100); + pub const ByteDeposit: Balance = deposit(0, 100); + pub const SubAccountDeposit: Balance = deposit(1, 1); pub const MaxSubAccounts: u32 = 100; #[derive(Serialize, Deserialize)] pub const MaxAdditionalFields: u32 = 100; diff --git a/runtime/testnet/src/lib.rs b/runtime/testnet/src/lib.rs index fdc040ecd..55efdcd54 100644 --- a/runtime/testnet/src/lib.rs +++ b/runtime/testnet/src/lib.rs @@ -173,7 +173,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("tangle-testnet"), impl_name: create_runtime_str!("tangle-testnet"), authoring_version: 1, - spec_version: 1001, // v1.0.1 + spec_version: 1002, // v1.0.2 impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -1041,9 +1041,9 @@ impl pallet_tx_pause::Config for Runtime { } parameter_types! { - pub const BasicDeposit: Balance = deposit(0, 100); // purposely set low, do not copy for mainnet - pub const ByteDeposit: Balance = deposit(0, 100); // purposely set low, do not copy for mainnet - pub const SubAccountDeposit: Balance = deposit(1, 1); // purposely set low, do not copy for mainnet + pub const BasicDeposit: Balance = deposit(0, 100); + pub const ByteDeposit: Balance = deposit(0, 100); + pub const SubAccountDeposit: Balance = deposit(1, 1); pub const MaxSubAccounts: u32 = 100; #[derive(Serialize, Deserialize)] pub const MaxAdditionalFields: u32 = 100;