Skip to content

Conversation

@sebastianmontero
Copy link
Contributor

  • Mapped assets pallet DebitFlags struct is private to the crate, so the debitFlags parameter from the afloat_do_burn method was removed and the debitFlags created internally, finally updated the afloat pallet accordingly.
  • AssetId type is no longer Copy, so called the clone method where necessary.
  • CollectionId type is no longer Copy, so called the clone method where necessary.
  • JSON NumberValue struct has a new negative field, so this field was added as necesary.
  • GenesisBuild has been deprecated, so the BitcoinVaults and MappedAssets pallets to use the new BuildGenesisConfig trait.
  • Updated the block_number parameter type to be BlockNumberFor.
  • Added does_asset_exist method to the MappedAssets pallet. Updated the way of checking overflow in the MappedAssets pallet to use checked_add. Added back the Rbac type to the MappedAssets pallet.
  • The where clause of the enum when contructing a mock runtime has been deprecated, so this clause was removed for all pallet mocks.
  • Nonce and Block types have been added to the system::Config, and the Index, BlockNumber and Header types have been removed, so all pallet implementations for the Test runtime have been updated accordingly.
  • FreezeIdentifier, MaxFreezes, RuntimeHoldReason and MaxHolds types have been added for the balances pallet, so the test runtimes for pallets that use the balances pallet have been added accordingly.
  • The GenesisConfig is now generic over the runtime, so the test build_storage for all pallets have been updated accordingly, also this is now behind the BuildStorage trait so it has been imported where required.
  • The UnknownAsset error of the mapped assets pallet has been updated to be Unknown, so updated some of the tests accordingly.
  • The tokens BalanceConversion trait has been replaced by ConversionToAssetBalance, so updated the mapped assets test pallet accordingly.

…e debitFlags parameter from the afloat_do_burn method was removed and the debitFlags created internally, finally updated the afloat pallet accordingly. AssetId type is no longer Copy, so called the clone method where necessary. CollectionId type is no longer Copy, so called the clone method where necessary. JSON NumberValue struct has a new negative field, so this field was added as necesary. GenesisBuild has been deprecated, so the BitcoinVaults and MappedAssets pallets to use the new BuildGenesisConfig trait. Updated the block_number parameter type to be BlockNumberFor. Added does_asset_exist method to the MappedAssets pallet. Updated the way of checking overflow in the MappedAssets pallet to use checked_add. Added back the Rbac type to the MappedAssets pallet.
… deprecated, so this clause was removed for all pallet mocks.Nonce and Block types have been added to the system::Config, and the Index, BlockNumber and Header types have been removed, so all pallet implementations for the Test runtime have been updated accordingly. FreezeIdentifier, MaxFreezes, RuntimeHoldReason and MaxHolds types have been added for the balances pallet, so the test runtimes for pallets that use the balances pallet have been added accordingly. The GenesisConfig is now generic over the runtime, so the test build_storage for all pallets have been updated accordingly, also this is now behind the BuildStorage trait so it has been imported where required. The UnknownAsset error of the mapped assets pallet has been updated to be Unknown, so updated some of the tests accordingly. The tokens BalanceConversion trait has been replaced by ConversionToAssetBalance, so updated the mapped assets test pallet accordingly.
use pallet_fruniques::types::{Attributes, CollectionDescription, FruniqueRole, ParentInfo};
use pallet_gated_marketplace::types::{Marketplace, MarketplaceRole};
use sp_runtime::{traits::StaticLookup, Permill};
// use frame_support::traits::OriginTrait;

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:

  • Updated CreateAsset to accept either a new asset ID or an existing one.
  • Updated the set_afloat_balance function to take into account the user's current balance and adjust it accordingly.
  • Removed the DebitFlags parameter from the pallet_mapped_assets::Pallet::debit call.

@@ -1,13 +1,13 @@
use crate as pallet_afloat;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of afee51 - 513460:

  • Modified the pallets/afloat/src/mock.rs file, adding ConstU128 and BuildStorage to frame_support::traits and sp_runtime::traits respectively.
  • Changed the type of Balance from u64 to u128 in pallet_balances::Config.
  • Added ConstU128 to ExistentialDeposit and ConstU32 to MaxReserves in pallet_balances::Config.
  • Added FreezeIdentifier, MaxFreezes, RuntimeHoldReason, and MaxHolds to pallet_balances::Config.
  • Changed MaxReserves to ConstU32 in pallet_mapped_assets::Config.
  • Added ReserveIdentifier to pallet_mapped_assets::Config.
  • Added code to build genesis storage according to the mock runtime.

.ok_or(Self::build_offchain_err(false, "Vault not found"))?;
let threshold = NumberValue {
integer: vault.threshold.clone().into(),
fraction: 0,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 52376e - 613af6:

  • Added a negative field to the NumberValue struct
  • Changed the type of the integer field in NumberValue from i64 to u64


const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);

/* --- Genesis Structs Section --- */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 5dfb66 - 5a3332:

  • Added _config field to GenesisConfig struct
  • Changed GenesisConfig to use generic Config type parameter
  • Changed GenesisBuild to BuildGenesisConfig
  • Changed offchain_worker parameter type to BlockNumberFor<T>

};
use frame_system::EnsureRoot;
//use frame_system as system;
use pallet_balances;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 79c45d - d9b909:

  • Added use sp_runtime::BuildStorage
  • Changed UncheckedExtrinsic to TestXt
  • Added type RuntimeEvent = RuntimeEvent and type Nonce = u64 to pallet_balances::Config
  • Changed type Index = u64 and type BlockNumber = u64 to type Nonce = u64 in frame_system::Config
  • Changed type Header = Header to type Block = Block in frame_system::Config
  • Added type RuntimeHoldReason = (), type FreezeIdentifier = (), type MaxHolds = () and type MaxFreezes = () to pallet_balances::Config
  • Added let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();

@@ -1,24 +1,19 @@
use crate as pallet_confidential_docs;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 0cd5c6 - ab7e11:

  • Imported construct_runtime from frame_support
  • Changed the type of UncheckedExtrinsic to MockUncheckedExtrinsic
  • Changed the type of Block to MockBlock
  • Added BuildStorage to sp_runtime
  • Changed the type of Index and BlockNumber to u64
  • Changed the type of Header to Block
  • Added Nonce to frame_system::Config
  • Changed the type of GenesisConfig in frame_system::GenesisConfig to Test
  • Added build_storage to frame_system::GenesisConfig

.expect("Error on converting the attribute to BoundedVec")
}
BoundedVec::<u8, T::ValueLimit>::default()
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 4c6fde - 843fd4:

  • Changed the signature of admin_of, collection_exists, instance_exists, set_attribute, burn, and add_parent to include a clone() on the class_id parameter.
  • Changed the signature of add_parent to include a clone() on the collection_id parameter.
  • Changed the assignment of collection_id in ParentInfo to include a clone().

@@ -1,23 +1,19 @@
use crate as pallet_fruniques;
use frame_support::{construct_runtime, parameter_types, traits::AsEnsureOriginWithArg};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of a6d2bc - 75f73b:

  • Imports updated: sp_core and frame_system
  • Test enum updated with additional pallets: Uniques, Balances, Fruniques, and Rbac
  • Config trait implementations updated for frame_system, Uniques, Balances, and Rbac
  • TestExternalities updated with GenesisConfig for Balances

@@ -1,9 +1,8 @@
use crate::{mock::*, Error};
use crate::{mock::*, types::ParentInfoCall, Error};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 774848 - f78281:

  • Added types::ParentInfoCall to imports
  • Added sp_runtime::BuildStorage to imports
  • Changed frame_system::GenesisConfig::default().build_storage::<Test>().unwrap(); to frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
  • Added a vector of (account, balance) tuples to pallet_balances::GenesisConfig::<Test>

@@ -1,24 +1,20 @@
use crate as pallet_fund_admin_records;
use frame_support::parameter_types;
use frame_system as system;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 0aff65 - 1d1d06:

  • Removed Header type from the Test enum
  • Added BuildStorage type to the Test enum
  • Changed Index and BlockNumber types to Nonce type
  • Changed Header type to Block type
  • Updated GenesisConfig to use BuildStorage instead of build_storage::<Test>

@@ -1,46 +1,41 @@
use crate as pallet_fund_admin;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 0b699c - fe0f76:

  • Updated use statements to include ConstU64 and removed H256
  • Updated Test enum to use Config<T> and removed UncheckedExtrinsic
  • Added ExistentialDeposit type
  • Updated Balances config to include ConstU64<1> and removed ExistentialDeposit, MaxReserves, RuntimeHoldReason, FreezeIdentifier, MaxHolds, MaxFreezes
  • Updated System config to include Nonce and removed Index, BlockNumber, Header
  • Updated Hash type to H256
  • Updated Block type to MockBlock<Test>
  • Updated GenesisConfig to use <Test>
  • Added balances to GenesisConfig with 1 as the account ID and InitialAdminBalance::get() as the balance amount

) -> Result<[u8; 32], DispatchError> {
//This function is only called by the owner of the marketplace
//ensure the marketplace exists
ensure!(<Marketplaces<T>>::contains_key(marketplace_id), Error::<T>::MarketplaceNotFound);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of f6924d - a97da2:
Error: couldn't generate summary

@@ -1,37 +1,29 @@
use crate as pallet_gated_marketplace;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 788ebb - 0ae7a4:

  • Added support for RuntimeCall and Block in the Test runtime
  • Removed references to System::Header, UncheckedExtrinsic, DefaultCallback
  • Added EnsureSigned, AccountId32, MultiSignature, Percent, BuildStorage
  • Changed type of AccountId to u64
  • Changed type of Balance to u128
  • Changed type of ExistentialDeposit to ConstU64
  • Added type Nonce
  • Added type BlockHashCount
  • Added type Block
  • Added type MaxReserves
  • Added type ReserveIdentifier
  • Added type RuntimeHoldReason
  • Added type FreezeIdentifier
  • Added type MaxHolds
  • Added type MaxFreezes
  • Added type Rbac
  • Added AssetsCallbackHandle
  • Changed type of RemoveItemsLimit to ConstU32
  • Removed type MaxReserves
  • Removed type ReserveIdentifier

// See the License for the specific language governing permissions and
// limitations under the License.

//! Functions for the Assets pallet.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 9289dd - a86c51:

  • Added use codec::Encode
  • Added a function does_asset_exist to check if an asset exists
  • Added logic to adjust_extra to check if an account exists
  • Added logic to issue to check if the issuer has permission, and to prevent overflow
  • Added logic to issue_to to check if the issuer has permission, and to prevent overflow
  • Added logic to redeem to check if the admin has permission, and to prevent underflow
  • Added logic to burn to check if the admin has permission, and to prevent underflow

Currency, EnsureOriginWithArg, ReservableCurrency, StoredMap,
},
};
use frame_system::Config as SystemConfig;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of a9b40d - 2cdb2e:

  • Added use pallet_rbac::types::RoleBasedAccessControl;
  • Changed the type of Rbac to RoleBasedAccessControl<Self::AccountId>
  • Changed GenesisBuild to BuildGenesisConfig
  • Added an assertion to check if an asset ID is already in use

type WeightInfo = ();
type CallbackHandle = AssetsCallbackHandle;
type Extra = ();
type RemoveItemsLimit = ConstU32<5>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of a200dd - 090740:

  • Added type Rbac = RBAC to the Test configuration struct.

#[test]
fn approval_lifecycle_works() {
new_test_ext().execute_with(|| {
// can't approve non-existent token

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 10695b - 7567de:

  • Fixed an error in Assets::approve_transfer() and Assets::set_metadata() from Error::<Test>::UnknownAsset to Error::<Test>::Unknown
  • Added a new trait ConversionToAssetBalance to frame_support::traits::tokens
  • Added a test for Assets::balance_conversion()

use crate as pallet_rbac;
use frame_support::parameter_types;
use frame_system as system;
use frame_system::EnsureRoot;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 3815a6 - 18317b:

  • Removed Header type from Test enum
  • Added Nonce type to Test enum
  • Replaced Index and BlockNumber types with u64
  • Replaced Header type with Block type
  • Changed build_storage call to include generic type <Test>

@github-actions
Copy link

GPT summary of a15119d:

Error: couldn't generate summary

@github-actions
Copy link

GPT summary of 5b38c64:

Error: couldn't generate summary

PR summary so far:

  • Updated multiple pallets to use generic Config type parameter
  • Added support for RuntimeCall and Block in Test runtime
  • Added ConstU64, BuildStorage, Nonce, BlockHashCount, Block, MaxReserves, ReserveIdentifier, RuntimeHoldReason, FreezeIdentifier, MaxHolds, MaxFreezes, Rbac, AssetsCallbackHandle and RemoveItemsLimit to various pallets
  • Changed types of AccountId, Balance, ExistentialDeposit, Index, BlockNumber, Header, UncheckedExtrinsic, EnsureSigned, AccountId32, MultiSignature, Percent to various types
  • Added logic to various functions to check permissions and prevent overflow/underflow
  • Added tests for various functions

Copy link
Contributor

@tlacloc tlacloc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tlacloc tlacloc merged commit b05e7bf into fix-dependencies-polkadotv1 Oct 27, 2023
tlacloc added a commit that referenced this pull request Dec 7, 2023
* update format to match the one for polkadot

* 📦 chore(rust-toolchain.toml): add rust-toolchain.toml file to specify the Rust toolchain configuration

* 🔧 chore(Cargo.toml): update sp-runtime dependency to remove version constraint for better compatibility

* 🔄 chore(rust-toolchain.toml): update Rust toolchain to nightly-2023-05-22 channel
🔧 fix(rust-toolchain.toml): specify the exact nightly channel version to ensure consistent build environment

* 🔧 chore(lib.rs): update Scale trait implementation to use BlockNumberFor<Self> instead of Self::BlockNumber for better compatibility and flexibility

* 📦 chore(pallets): update dependency versions in Cargo.toml files

🔺 chore(pallets/afloat): update codec version to 3.6.1
🔺 chore(pallets/bitcoin-vaults): update codec version to 3.6.1
🔺 chore(pallets/confidential-docs): update codec version to 3.6.1
🔺 chore(pallets/fruniques): update codec version to 3.6.1
🔺 chore(pallets/fund-admin-records): update codec version to 3.6.1
🔺 chore(pallets/fund-admin): update codec version to 3.6.1
🔺 chore(pallets/gated-marketplace): update codec version to 3.6.1
🔺 chore(pallets/mapped-assets): update codec version to 3.6.1 and log version to 0.4.17
🔺 chore(pallets/rbac): update codec version to 3.6.1

🔺 chore(pallets/afloat): update scale-info version to 2.5.0
🔺 chore(pallets/bitcoin-vaults): update scale-info version to 2.5.0
🔺 chore(pallets/confidential-docs): update scale-info version to 2.5.0
🔺 chore(pallets/fruniques): update scale-info version to 2.5.0
🔺 chore(pallets/fund-admin-records): update scale-info version to 2.5.0
🔺 chore(pallets/fund-admin): update scale-info version to 2.5.0
🔺 chore(pallets/gated-marketplace): update scale-info version to 2.5.0
🔺 chore(pallets/mapped-assets): update scale-info version to 2.5.0
🔺 chore(pallets/rbac): update scale-info version to 2.5.0

📦 chore(Cargo.toml): update dependencies versions

🔺 deps(Cargo.toml): update codec to version 3.6.1
🔺 deps(Cargo.toml): update log to version 0.4.14
🔺 deps(Cargo.toml): update scale-info to version 2.5.0
🔺 deps(Cargo.toml): update frame-support to use polkadot-v1.0.0 branch

* wip update mapped assets

* 🚀 chore(mapped-assets): update dependencies in Cargo.toml to latest versions

🐛 fix(mapped-assets): import missing sp_io::hashing::blake2_256 in functions.rs

✨ feat(mapped-assets): add AfloatRole enum and related functions in types.rs

* update deps

* 🚀 chore(Cargo.toml): update dependencies versions to improve compatibility and performance
🐛 fix(functions.rs): fix cloning of class_id variable to prevent ownership issues
✨ feat(functions.rs): add support for creating frunique collections with configurable owner and admin roles
🐛 fix(functions.rs): fix cloning of collection variable to prevent ownership issues

* 🚀 chore(Cargo.toml): update dependencies versions for lite-json, frame-support, frame-system, sp-core, sp-io, sp-runtime, sp-std to improve compatibility and stability
🔧 fix(functions.rs): import BlockNumberFor from frame_system::pallet_prelude to fix compilation error
🔧 fix(lib.rs): update weight for ocw_insert_descriptors, ocw_insert_psbts, ocw_finalize_psbts to improve performance and resource usage

* 🔍 chore(.gitignore): add log files to be ignored by git
🔍 chore(.gitignore): add /pallets/fund-admin/scripts directory to be ignored by git

* 🔧 chore(lib.rs): add #[derive(Default)] to the GenesisConfig struct in order to enable default values for its fields

* Fix build issues polkadotv1 (#22)

* Mapped assets pallet DebitFlags struct is private to the crate, so the debitFlags parameter from the afloat_do_burn method was removed and the debitFlags created internally, finally updated the afloat pallet accordingly. AssetId type is no longer Copy, so called the clone method where necessary. CollectionId type is no longer Copy, so called the clone method where necessary. JSON NumberValue struct has a new negative field, so this field was added as necesary. GenesisBuild has been deprecated, so the BitcoinVaults and MappedAssets pallets to use the new BuildGenesisConfig trait. Updated the block_number parameter type to be BlockNumberFor. Added does_asset_exist method to the MappedAssets pallet. Updated the way of checking overflow in the MappedAssets pallet to use checked_add. Added back the Rbac type to the MappedAssets pallet.

* The where clause of the enum when contructing a mock runtime has been deprecated, so this clause was removed for all pallet mocks.Nonce and Block types have been added to the system::Config, and the Index, BlockNumber and Header types have been removed, so all pallet implementations for the Test runtime have been updated accordingly. FreezeIdentifier, MaxFreezes, RuntimeHoldReason and MaxHolds types have been added for the balances pallet, so the test runtimes for pallets that use the balances pallet have been added accordingly. The GenesisConfig is now generic over the runtime, so the test build_storage for all pallets have been updated accordingly, also this is now behind the BuildStorage trait so it has been imported where required. The UnknownAsset error of the mapped assets pallet has been updated to be Unknown, so updated some of the tests accordingly. The tokens BalanceConversion trait has been replaced by ConversionToAssetBalance, so updated the mapped assets test pallet accordingly.

* update deps

* 🐛 fix(mock.rs): change Balance type from u128 to u64 to reduce memory usage
🐛 fix(mock.rs): change ExistentialDeposit type from ConstU128<100> to ConstU64<1> to set a lower minimum balance requirement
🐛 fix(mock.rs): remove MaxReserves configuration to use default value
🐛 fix(mock.rs): remove MaxFreezes configuration to use default value
✨ feat(mock.rs): add Result return type to created and destroyed functions in AssetsCallback trait implementation

* 🔧 fix(tests.rs): update struct field names in sign_up_works, update_user_info_edit_works, update_other_user_info_by_not_admin_fails, update_other_user_info_by_admin_works, update_user_info_delete_works, set_afloat_balance_works, set_balance_by_other_than_owner_fails to match changes in the struct definition
✨ feat(tests.rs): add support for new struct field names in sign_up_works, update_user_info_edit_works, update_other_user_info_by_not_admin_fails, update_other_user_info_by_admin_works, update_user_info_delete_works, set_afloat_balance_works, set_balance_by_other_than_owner_fails to improve code readability and maintainability

🔨 refactor(tests.rs): update test functions to use new struct field names for SignUpArgs

* update tests

* 🐛 fix(functions.rs): remove unnecessary mutability of transaction variable to improve code readability

* 🔧 chore(lib.rs): remove unused code and comments for improved code readability
🔧 chore(lib.rs): refactor default value for bdk_services_url in GenesisConfig to use a hardcoded value instead of cloning the input value

* 🔀 chore(lib.rs): refactor BDKServicesURL initialization to use self.bdk_services_url.clone() for improved code readability and maintainability

* 🚀 feat(mock.rs): import InitialSetupArgs struct
The InitialSetupArgs struct is imported to be used in the mock.rs file. This struct is necessary for the implementation of the afloat pallet's initial setup functionality.

* 🔧 fix(tests.rs): rename create_sell_order to create_offer and take_sell_order to start_take_sell_order
🔒 chore(tests.rs): comment out take_buy_order_works test case
The test cases for creating sell orders and taking sell orders have been updated to use the new function names `create_offer` and `start_take_sell_order` respectively. This improves clarity and consistency in the codebase. Additionally, the test case for taking buy orders has been commented out for now.

* bump v1.3.0 (#23)

* Updated polkadot dependencies to v1.2.0. sp-io is no longer exported from frame support, so had to add it directly as a dependency on the pallets, and update all imports accordingly. sp-std is no longer exported from frame support, so had to add it directly as a dependency on the pallets, and update all imports accordingly. The balance transfer method is exposed through the token Mutate trait so had to import it, and update the call to transfer with the correct parameters. DispatchError is no longer exported from frame support so had to import it directly from sp_runtime. The https://github.com/paritytech/substrate repository has been archived, so updated all dependencies to use the new repo https://github.com/paritytech/substrate

* Fixed mock afloat assets callback handler.

* Updated polkadot version to 1.3

* Pallet balances added RuntimeFreezeReason type, added definition for it to mocks of all pallets.

* Updated confidential docs pallet storage version.

* Updated dependencies to use tag instead of branch

* Updated storage version for those pallets that dont have migrations to be 0. Removed the migration from the mapped assets pallet as the pallet was created after the migration code.

---------

Co-authored-by: Sebastian Montero <[email protected]>

* Fix/pallet tests (#24)

* Updated polkadot dependencies to v1.2.0. sp-io is no longer exported from frame support, so had to add it directly as a dependency on the pallets, and update all imports accordingly. sp-std is no longer exported from frame support, so had to add it directly as a dependency on the pallets, and update all imports accordingly. The balance transfer method is exposed through the token Mutate trait so had to import it, and update the call to transfer with the correct parameters. DispatchError is no longer exported from frame support so had to import it directly from sp_runtime. The https://github.com/paritytech/substrate repository has been archived, so updated all dependencies to use the new repo https://github.com/paritytech/substrate

* Fixed mock afloat assets callback handler.

* Updated polkadot version to 1.3

* Pallet balances added RuntimeFreezeReason type, added definition for it to mocks of all pallets.

* Updated confidential docs pallet storage version.

* 🔧 fix(tests.rs): remove unused test functions
🔥 chore(tests.rs): remove unused test functions
The unused test functions `kill_storage_works`, `kill_storage_fails_for_non_admin`, `take_buy_order_works`, and `take_sell_order_works` have been removed from the `tests.rs` file. These functions were not being used and were cluttering the codebase. Removing them improves code readability and maintainability.

* 🐛 fix(lib.rs): remove duplicate call to do_create_afloat_asset
The duplicate call to `do_create_afloat_asset` has been removed to avoid creating the same asset twice during the initial setup.

* 🐛 fix(lib.rs): fix missing clone() call for admin parameter in do_create_afloat_marketplace
✨ feat(lib.rs): add do_setup_roles function call in InitialSetupArgs::Roles branch
The missing clone() call for the admin parameter in the do_create_afloat_marketplace function has been fixed to ensure the correct value is passed. Additionally, the do_setup_roles function is now called in the InitialSetupArgs::Roles branch to set up the roles for the creator and admin.

* 🔧 chore(tests.rs): remove duplicate kill_storage tests
The duplicate `kill_storage_works` and `kill_storage_fails_for_non_admin` tests have been removed from the file. These tests were redundant and were already covered by the existing tests in the file. Removing the duplicate tests improves code readability and maintainability.

* 🐛 fix(functions.rs): change error message in remove_from_afloat_marketplace function
🐛 fix(lib.rs): change order of function calls in kill_storage function
🔥 test(tests.rs): remove kill_storage_works and kill_storage_fails_for_non_admin tests
🔥 test(tests.rs): remove take_sell_order_works test
The error message in the remove_from_afloat_marketplace function has been changed to "Marketplace not found" to provide a more descriptive error message when the marketplace ID is not found. In the kill_storage function, the order of function calls has been changed to ensure that <AfloatMarketPlaceId<T>>::kill() is called after clearing the <AfloatOffers<T>> and <AfloatTransactions<T>> storage items. The kill_storage_works and kill_storage_fails_for_non_admin tests have been removed as they are no longer relevant. The take_sell_order_works test has also been removed

* 🔧 chore(mock.rs): add missing imports
🔧 chore(mock.rs): force create asset in new_test_ext function
🔧 chore(tests.rs): comment out take_sell_offer_works test
The changes in `mock.rs` add missing imports for `RawOrigin` and `Lookup` from their respective modules. This ensures that the code compiles correctly and all necessary dependencies are included.

The change in `tests.rs` comments out the `take_sell_offer_works` test. This is done to temporarily disable the test as it is currently failing. The test will be fixed and re-enabled in a future commit.

* 🔥 refactor(mock.rs): remove unused import of types::InitialSetupArgs in pallet_afloat mock module

---------

Co-authored-by: Sebastian Montero <[email protected]>

* update cargo lock

* 🐛 fix(mock.rs): update MaxConsumers constant to 3 to allow for more consumers
🐛 fix(mock.rs): remove unused RuntimeFreezeReason type from pallet_balances::Config
🐛 fix(mock.rs): update comment link to correct issue in substrate repository

* 🔍 chore(check.yml): add a step to check tests in the CI workflow for better code quality assurance

---------

Co-authored-by: sebastianmontero <[email protected]>
tlacloc added a commit that referenced this pull request Dec 7, 2023
* update format to match the one for polkadot

* 📦 chore(rust-toolchain.toml): add rust-toolchain.toml file to specify the Rust toolchain configuration

* 🔧 chore(Cargo.toml): update sp-runtime dependency to remove version constraint for better compatibility

* 🔄 chore(rust-toolchain.toml): update Rust toolchain to nightly-2023-05-22 channel
🔧 fix(rust-toolchain.toml): specify the exact nightly channel version to ensure consistent build environment

* 🔧 chore(lib.rs): update Scale trait implementation to use BlockNumberFor<Self> instead of Self::BlockNumber for better compatibility and flexibility

* 📦 chore(pallets): update dependency versions in Cargo.toml files

🔺 chore(pallets/afloat): update codec version to 3.6.1
🔺 chore(pallets/bitcoin-vaults): update codec version to 3.6.1
🔺 chore(pallets/confidential-docs): update codec version to 3.6.1
🔺 chore(pallets/fruniques): update codec version to 3.6.1
🔺 chore(pallets/fund-admin-records): update codec version to 3.6.1
🔺 chore(pallets/fund-admin): update codec version to 3.6.1
🔺 chore(pallets/gated-marketplace): update codec version to 3.6.1
🔺 chore(pallets/mapped-assets): update codec version to 3.6.1 and log version to 0.4.17
🔺 chore(pallets/rbac): update codec version to 3.6.1

🔺 chore(pallets/afloat): update scale-info version to 2.5.0
🔺 chore(pallets/bitcoin-vaults): update scale-info version to 2.5.0
🔺 chore(pallets/confidential-docs): update scale-info version to 2.5.0
🔺 chore(pallets/fruniques): update scale-info version to 2.5.0
🔺 chore(pallets/fund-admin-records): update scale-info version to 2.5.0
🔺 chore(pallets/fund-admin): update scale-info version to 2.5.0
🔺 chore(pallets/gated-marketplace): update scale-info version to 2.5.0
🔺 chore(pallets/mapped-assets): update scale-info version to 2.5.0
🔺 chore(pallets/rbac): update scale-info version to 2.5.0

📦 chore(Cargo.toml): update dependencies versions

🔺 deps(Cargo.toml): update codec to version 3.6.1
🔺 deps(Cargo.toml): update log to version 0.4.14
🔺 deps(Cargo.toml): update scale-info to version 2.5.0
🔺 deps(Cargo.toml): update frame-support to use polkadot-v1.0.0 branch

* wip update mapped assets

* 🚀 chore(mapped-assets): update dependencies in Cargo.toml to latest versions

🐛 fix(mapped-assets): import missing sp_io::hashing::blake2_256 in functions.rs

✨ feat(mapped-assets): add AfloatRole enum and related functions in types.rs

* update deps

* 🚀 chore(Cargo.toml): update dependencies versions to improve compatibility and performance
🐛 fix(functions.rs): fix cloning of class_id variable to prevent ownership issues
✨ feat(functions.rs): add support for creating frunique collections with configurable owner and admin roles
🐛 fix(functions.rs): fix cloning of collection variable to prevent ownership issues

* 🚀 chore(Cargo.toml): update dependencies versions for lite-json, frame-support, frame-system, sp-core, sp-io, sp-runtime, sp-std to improve compatibility and stability
🔧 fix(functions.rs): import BlockNumberFor from frame_system::pallet_prelude to fix compilation error
🔧 fix(lib.rs): update weight for ocw_insert_descriptors, ocw_insert_psbts, ocw_finalize_psbts to improve performance and resource usage

* 🔍 chore(.gitignore): add log files to be ignored by git
🔍 chore(.gitignore): add /pallets/fund-admin/scripts directory to be ignored by git

* 🔧 chore(lib.rs): add #[derive(Default)] to the GenesisConfig struct in order to enable default values for its fields

* Fix build issues polkadotv1 (#22)

* Mapped assets pallet DebitFlags struct is private to the crate, so the debitFlags parameter from the afloat_do_burn method was removed and the debitFlags created internally, finally updated the afloat pallet accordingly. AssetId type is no longer Copy, so called the clone method where necessary. CollectionId type is no longer Copy, so called the clone method where necessary. JSON NumberValue struct has a new negative field, so this field was added as necesary. GenesisBuild has been deprecated, so the BitcoinVaults and MappedAssets pallets to use the new BuildGenesisConfig trait. Updated the block_number parameter type to be BlockNumberFor. Added does_asset_exist method to the MappedAssets pallet. Updated the way of checking overflow in the MappedAssets pallet to use checked_add. Added back the Rbac type to the MappedAssets pallet.

* The where clause of the enum when contructing a mock runtime has been deprecated, so this clause was removed for all pallet mocks.Nonce and Block types have been added to the system::Config, and the Index, BlockNumber and Header types have been removed, so all pallet implementations for the Test runtime have been updated accordingly. FreezeIdentifier, MaxFreezes, RuntimeHoldReason and MaxHolds types have been added for the balances pallet, so the test runtimes for pallets that use the balances pallet have been added accordingly. The GenesisConfig is now generic over the runtime, so the test build_storage for all pallets have been updated accordingly, also this is now behind the BuildStorage trait so it has been imported where required. The UnknownAsset error of the mapped assets pallet has been updated to be Unknown, so updated some of the tests accordingly. The tokens BalanceConversion trait has been replaced by ConversionToAssetBalance, so updated the mapped assets test pallet accordingly.

* update deps

* 🐛 fix(mock.rs): change Balance type from u128 to u64 to reduce memory usage
🐛 fix(mock.rs): change ExistentialDeposit type from ConstU128<100> to ConstU64<1> to set a lower minimum balance requirement
🐛 fix(mock.rs): remove MaxReserves configuration to use default value
🐛 fix(mock.rs): remove MaxFreezes configuration to use default value
✨ feat(mock.rs): add Result return type to created and destroyed functions in AssetsCallback trait implementation

* 🔧 fix(tests.rs): update struct field names in sign_up_works, update_user_info_edit_works, update_other_user_info_by_not_admin_fails, update_other_user_info_by_admin_works, update_user_info_delete_works, set_afloat_balance_works, set_balance_by_other_than_owner_fails to match changes in the struct definition
✨ feat(tests.rs): add support for new struct field names in sign_up_works, update_user_info_edit_works, update_other_user_info_by_not_admin_fails, update_other_user_info_by_admin_works, update_user_info_delete_works, set_afloat_balance_works, set_balance_by_other_than_owner_fails to improve code readability and maintainability

🔨 refactor(tests.rs): update test functions to use new struct field names for SignUpArgs

* update tests

* 🐛 fix(functions.rs): remove unnecessary mutability of transaction variable to improve code readability

* 🔧 chore(lib.rs): remove unused code and comments for improved code readability
🔧 chore(lib.rs): refactor default value for bdk_services_url in GenesisConfig to use a hardcoded value instead of cloning the input value

* 🔀 chore(lib.rs): refactor BDKServicesURL initialization to use self.bdk_services_url.clone() for improved code readability and maintainability

* Updated polkadot dependencies to v1.2.0. sp-io is no longer exported from frame support, so had to add it directly as a dependency on the pallets, and update all imports accordingly. sp-std is no longer exported from frame support, so had to add it directly as a dependency on the pallets, and update all imports accordingly. The balance transfer method is exposed through the token Mutate trait so had to import it, and update the call to transfer with the correct parameters. DispatchError is no longer exported from frame support so had to import it directly from sp_runtime. The https://github.com/paritytech/substrate repository has been archived, so updated all dependencies to use the new repo https://github.com/paritytech/substrate

* Fixed mock afloat assets callback handler.

* Updated polkadot version to 1.3

* Pallet balances added RuntimeFreezeReason type, added definition for it to mocks of all pallets.

* Updated confidential docs pallet storage version.

* Updated dependencies to use tag instead of branch

* Updated storage version for those pallets that dont have migrations to be 0. Removed the migration from the mapped assets pallet as the pallet was created after the migration code.

* Developed migration fro the fruniques pallet. Incremented fruniques pallet storage version.

* 🐛 fix(afloat): update pallet-timestamp dependency version to "4.0.0-dev" to resolve compatibility issue
🐛 fix(afloat): remove unused trait import UnixTime from functions.rs
🐛 fix(afloat): remove TimeProvider associated type from pallet configuration in lib.rs
🐛 fix(afloat): remove TimeProvider associated type from pallet configuration in mock.rs
✨ feat(afloat): add error event TimestampError to handle incorrect timestamp generation
✨ feat(afloat): update created_date and last_modified_date fields in UserInfo struct to use pallet_gated_marketplace::Pallet::get_timestamp_in_milliseconds() to ensure consistent timestamp generation
✨ feat(afloat): update creation_date and last_modified_date fields in create_offer and edit_offer functions to use T::Timestamp::now().into() to ensure consistent timestamp generation
✨ feat(afloat): update cancellation_date field in cancel_offer function to use pallet_gated_marketplace::Pallet::get_timestamp_in_milliseconds() to ensure consistent timestamp generation

* 🐛 fix(functions.rs): fix import statement formatting to follow conventions
✨ feat(functions.rs): add support for last_modified_date field to be set to current timestamp when creating or editing user info
🐛 fix(functions.rs): fix formatting of created_date field to follow conventions
🐛 fix(functions.rs): fix formatting of last_modified_date field to follow conventions
🐛 fix(functions.rs): fix formatting of created_date field to follow conventions
🐛 fix(functions.rs): fix formatting of last_modified_date field to follow conventions
🐛 fix(functions.rs): fix formatting of created_date field to follow conventions
🐛 fix(functions.rs): fix formatting of last_modified_date field to follow conventions
🐛 fix

* 🔧 chore(lib.rs): reorder import statements for better readability and consistency

* 🔒 chore(functions.rs): change visibility of get_timestamp_in_milliseconds function from private to public to allow external usage

* update dep

---------

Co-authored-by: sebastianmontero <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants