-
Notifications
You must be signed in to change notification settings - Fork 0
Fix build issues polkadotv1 #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| use crate as pallet_afloat; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GPT summary of afee51 - 513460:
|
||
| use frame_support::{ | ||
| parameter_types, | ||
| traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, Currency}, | ||
| traits::{AsEnsureOriginWithArg, ConstU128, ConstU32, ConstU64, Currency}, | ||
| }; | ||
| use frame_system as system; | ||
| use sp_core::H256; | ||
| use sp_runtime::{ | ||
| testing::Header, | ||
| traits::{BlakeTwo256, IdentityLookup}, | ||
| BuildStorage, | ||
| }; | ||
| type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; | ||
| type Block = frame_system::mocking::MockBlock<Test>; | ||
|
|
@@ -25,12 +25,9 @@ parameter_types! { | |
|
|
||
| // Configure a mock runtime to test the pallet. | ||
| frame_support::construct_runtime!( | ||
| pub enum Test where | ||
| Block = Block, | ||
| NodeBlock = Block, | ||
| UncheckedExtrinsic = UncheckedExtrinsic, | ||
| pub enum Test | ||
| { | ||
| System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, | ||
| System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>}, | ||
| GatedMarketplace: pallet_gated_marketplace::{Pallet, Call, Storage, Event<T>}, | ||
| Uniques: pallet_uniques::{Pallet, Call, Storage, Event<T>}, | ||
| Fruniques: pallet_fruniques::{Pallet, Call, Storage, Event<T>}, | ||
|
|
@@ -49,13 +46,12 @@ impl system::Config for Test { | |
| type DbWeight = (); | ||
| type RuntimeOrigin = RuntimeOrigin; | ||
| type RuntimeCall = RuntimeCall; | ||
| type Index = u64; | ||
| type BlockNumber = u64; | ||
| type Nonce = u64; | ||
| type Hash = H256; | ||
| type Hashing = BlakeTwo256; | ||
| type AccountId = u64; | ||
| type Lookup = IdentityLookup<Self::AccountId>; | ||
| type Header = Header; | ||
| type Block = Block; | ||
| type RuntimeEvent = RuntimeEvent; | ||
| type BlockHashCount = BlockHashCount; | ||
| type Version = (); | ||
|
|
@@ -157,21 +153,20 @@ impl pallet_uniques::Config for Test { | |
| type Locker = (); | ||
| } | ||
|
|
||
| parameter_types! { | ||
| pub const ExistentialDeposit: u64 = 1; | ||
| pub const MaxReserves: u32 = 50; | ||
| } | ||
|
|
||
| impl pallet_balances::Config for Test { | ||
| type Balance = u64; | ||
| type Balance = u128; | ||
| type DustRemoval = (); | ||
| type RuntimeEvent = RuntimeEvent; | ||
| type ExistentialDeposit = ExistentialDeposit; | ||
| type ExistentialDeposit = ConstU128<100>; | ||
| type AccountStore = System; | ||
| type WeightInfo = (); | ||
| type MaxLocks = (); | ||
| type MaxReserves = MaxReserves; | ||
| type MaxReserves = ConstU32<50>; | ||
| type ReserveIdentifier = [u8; 8]; | ||
| type FreezeIdentifier = (); | ||
| type MaxFreezes = (); | ||
| type RuntimeHoldReason = (); | ||
| type MaxHolds = (); | ||
| } | ||
|
|
||
| parameter_types! { | ||
|
|
@@ -236,16 +231,14 @@ impl pallet_mapped_assets::Config for Test { | |
| type CallbackHandle = AssetsCallbackHandle; | ||
| type Extra = (); | ||
| type RemoveItemsLimit = ConstU32<5>; | ||
| type MaxReserves = MaxReserves; | ||
| type ReserveIdentifier = u32; | ||
| type Rbac = RBAC; | ||
| } | ||
|
|
||
| // Build genesis storage according to the mock runtime. | ||
| pub fn new_test_ext() -> sp_io::TestExternalities { | ||
| // TODO: get initial conf? | ||
| let mut t: sp_io::TestExternalities = | ||
| frame_system::GenesisConfig::default().build_storage::<Test>().unwrap().into(); | ||
| frame_system::GenesisConfig::<Test>::default().build_storage().unwrap().into(); | ||
| t.execute_with(|| { | ||
| Balances::make_free_balance_be(&1, 100); | ||
| Balances::make_free_balance_be(&2, 100); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -474,6 +474,7 @@ impl<T: Config> Pallet<T> { | |
| fraction: 0, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| fraction_length: 0, | ||
| exponent: 0, | ||
| negative: false, | ||
| }; | ||
| body.push(("threshold".chars().collect::<Vec<char>>(), JsonValue::Number(threshold))); | ||
| let vault_signers = vault.cosigners.clone().to_vec(); | ||
|
|
@@ -573,16 +574,18 @@ impl<T: Config> Pallet<T> { | |
| let vault = <Vaults<T>>::get(proposal.vault_id.clone()) | ||
| .ok_or(Self::build_offchain_err(false, "Vault not found"))?; | ||
| let amount = NumberValue { | ||
| integer: proposal.amount.clone() as i64, | ||
| integer: proposal.amount.clone() as u64, | ||
| fraction: 0, | ||
| fraction_length: 0, | ||
| exponent: 0, | ||
| negative: false, | ||
| }; | ||
| let fee = NumberValue { | ||
| integer: proposal.fee_sat_per_vb.clone().into(), | ||
| fraction: 0, | ||
| fraction_length: 0, | ||
| exponent: 0, | ||
| negative: false, | ||
| }; | ||
| let to_address = str::from_utf8(proposal.to_address.as_slice()) | ||
| .map_err(|_| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,20 +39,24 @@ pub mod pallet { | |
| /* --- Genesis Structs Section --- */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| #[pallet::genesis_config] | ||
| #[derive(Default)] | ||
| pub struct GenesisConfig { | ||
| pub struct GenesisConfig<T: Config> { | ||
| pub bdk_services_url: Vec<u8>, | ||
| #[serde(skip)] | ||
| pub _config: sp_std::marker::PhantomData<T>, | ||
| } | ||
|
|
||
| #[cfg(feature = "std")] | ||
| impl Default for GenesisConfig { | ||
| impl<T: Config> Default for GenesisConfig<T> { | ||
| fn default() -> Self { | ||
| Self { bdk_services_url: b"https://bdk.hashed.systems".encode() } | ||
| Self { | ||
| bdk_services_url: b"https://bdk.hashed.systems".encode(), | ||
| _config: Default::default(), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[pallet::genesis_build] | ||
| impl<T: Config> GenesisBuild<T> for GenesisConfig { | ||
| impl<T: Config> BuildGenesisConfig for GenesisConfig<T> { | ||
| fn build(&self) { | ||
| <BDKServicesURL<T>>::put( | ||
| BoundedVec::<u8, ConstU32<32>>::try_from(self.bdk_services_url.clone()) | ||
|
|
@@ -275,7 +279,7 @@ pub mod pallet { | |
| /// Note that it's not guaranteed for offchain workers to run on EVERY block, there might | ||
| /// be cases where some blocks are skipped, or for some the worker runs twice (re-orgs), | ||
| /// so the code should be able to handle that. | ||
| fn offchain_worker(_block_number: T::BlockNumber) { | ||
| fn offchain_worker(_block_number: BlockNumberFor<T>) { | ||
| // check if the node has an account available, the offchain worker can't submit | ||
| // transactions without it | ||
| let signer = Signer::<T, T::AuthorityId>::any_account(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,39 +8,40 @@ use frame_system::EnsureRoot; | |
| use pallet_balances; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GPT summary of 79c45d - d9b909:
|
||
| use sp_core::H256; | ||
| //use sp_keystore::{testing::KeyStore, KeystoreExt, SyncCryptoStore}; | ||
| use sp_runtime::BuildStorage; | ||
| use sp_runtime::{ | ||
| testing::{Header, TestXt}, | ||
| testing::TestXt, | ||
| traits::{BlakeTwo256, Extrinsic as ExtrinsicT, IdentifyAccount, IdentityLookup, Verify}, | ||
| //RuntimeAppPublic, | ||
| }; | ||
| type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; | ||
| type Block = frame_system::mocking::MockBlock<Test>; | ||
| //use sp_runtime::generic::SignedPayload; | ||
| use sp_core::sr25519::Signature; | ||
|
|
||
| // Configure a mock runtime to test the pallet. | ||
| frame_support::construct_runtime!( | ||
| pub enum Test where | ||
| Block = Block, | ||
| NodeBlock = Block, | ||
| UncheckedExtrinsic = UncheckedExtrinsic, | ||
| pub enum Test | ||
| { | ||
| System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, | ||
| System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>}, | ||
| BitcoinVaults: pallet_bitcoin_vaults::{Pallet, Call, Storage, Event<T>, ValidateUnsigned}, | ||
| Balances: pallet_balances::{Pallet, Call, Storage, Event<T>}, | ||
| } | ||
| ); | ||
|
|
||
| impl pallet_balances::Config for Test { | ||
| type MaxLocks = (); | ||
| type MaxReserves = (); | ||
| type ReserveIdentifier = [u8; 8]; | ||
| type Balance = u64; | ||
| type RuntimeEvent = RuntimeEvent; | ||
| type DustRemoval = (); | ||
| type RuntimeEvent = RuntimeEvent; | ||
| type ExistentialDeposit = ConstU64<1>; | ||
| type AccountStore = System; | ||
| type WeightInfo = (); | ||
| type MaxLocks = (); | ||
| type MaxReserves = (); | ||
| type ReserveIdentifier = [u8; 8]; | ||
| type RuntimeHoldReason = (); | ||
| type FreezeIdentifier = (); | ||
| type MaxHolds = (); | ||
| type MaxFreezes = (); | ||
| } | ||
|
|
||
| parameter_types! { | ||
|
|
@@ -106,14 +107,13 @@ impl frame_system::Config for Test { | |
| type BlockWeights = (); | ||
| type BlockLength = (); | ||
| type RuntimeOrigin = RuntimeOrigin; | ||
| type Index = u64; | ||
| type BlockNumber = u64; | ||
| type Hash = H256; | ||
| type RuntimeCall = RuntimeCall; | ||
| type Nonce = u64; | ||
| type Hashing = BlakeTwo256; | ||
| type AccountId = sp_core::sr25519::Public; | ||
| type Lookup = IdentityLookup<Self::AccountId>; | ||
| type Header = Header; | ||
| type Block = Block; | ||
| type RuntimeEvent = RuntimeEvent; | ||
| type BlockHashCount = ConstU64<250>; | ||
| type DbWeight = (); | ||
|
|
@@ -134,7 +134,7 @@ pub fn test_pub(n: u8) -> sp_core::sr25519::Public { | |
|
|
||
| // Build genesis storage according to the mock runtime. | ||
| pub fn new_test_ext() -> sp_io::TestExternalities { | ||
| let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap(); | ||
| let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap(); | ||
| pallet_balances::GenesisConfig::<Test> { | ||
| balances: vec![(test_pub(1), 10000), (test_pub(2), 1000), (test_pub(3), 1000)], | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,19 @@ | ||
| use crate as pallet_confidential_docs; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GPT summary of 0cd5c6 - ab7e11:
|
||
| use frame_support::parameter_types; | ||
| use frame_support::{construct_runtime, parameter_types}; | ||
| use frame_system as system; | ||
| use frame_system::EnsureRoot; | ||
| use sp_core::H256; | ||
| use sp_runtime::{ | ||
| testing::Header, | ||
| traits::{BlakeTwo256, IdentityLookup}, | ||
| BuildStorage, | ||
| }; | ||
|
|
||
| type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; | ||
| type Block = frame_system::mocking::MockBlock<Test>; | ||
|
|
||
| // Configure a mock runtime to test the pallet. | ||
| frame_support::construct_runtime!( | ||
| pub enum Test where | ||
| Block = Block, | ||
| NodeBlock = Block, | ||
| UncheckedExtrinsic = UncheckedExtrinsic, | ||
| construct_runtime!( | ||
| pub enum Test | ||
| { | ||
| System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, | ||
| System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>}, | ||
| ConfidentialDocs: pallet_confidential_docs::{Pallet, Call, Storage, Event<T>}, | ||
| } | ||
| ); | ||
|
|
@@ -35,13 +30,12 @@ impl system::Config for Test { | |
| type DbWeight = (); | ||
| type RuntimeOrigin = RuntimeOrigin; | ||
| type RuntimeCall = RuntimeCall; | ||
| type Index = u64; | ||
| type BlockNumber = u64; | ||
| type Nonce = u64; | ||
| type Hash = H256; | ||
| type Hashing = BlakeTwo256; | ||
| type AccountId = u64; | ||
| type Lookup = IdentityLookup<Self::AccountId>; | ||
| type Header = Header; | ||
| type Block = Block; | ||
| type RuntimeEvent = RuntimeEvent; | ||
| type BlockHashCount = BlockHashCount; | ||
| type Version = (); | ||
|
|
@@ -85,7 +79,7 @@ impl pallet_confidential_docs::Config for Test { | |
|
|
||
| // Build genesis storage according to the mock runtime. | ||
| pub fn new_test_ext() -> sp_io::TestExternalities { | ||
| let storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap(); | ||
| let storage = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap(); | ||
| let mut ext: sp_io::TestExternalities = storage.into(); | ||
| ext.execute_with(|| System::set_block_number(1)); | ||
| ext | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GPT summary of 4c39a1 - bf4ad3:
CreateAssetto accept either a new asset ID or an existing one.set_afloat_balancefunction to take into account the user's current balance and adjust it accordingly.DebitFlagsparameter from thepallet_mapped_assets::Pallet::debitcall.