Skip to content
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

update pallets #12

Merged
merged 3 commits into from
Sep 22, 2023
Merged

update pallets #12

merged 3 commits into from
Sep 22, 2023

Conversation

tlacloc
Copy link
Contributor

@tlacloc tlacloc commented Sep 22, 2023

Added parameters to do_cancel_offer and kill_storage functions
Added KillStorageArgs enum
Added set_signer_account and add_record functions to fund-admin-records pallet
Added RemoveOrigin type to pallet_rbac::Config for Test
Updated weight annotations to use Weight::from_parts

didiermis and others added 2 commits September 21, 2023 16:31
#10)

* - Updated the Fund Admin Records' list of dependencies in Cargo.toml, bumping versions of 'frame support', 'frame system', 'frame benchmarking', 'sp runtime', 'pallet timestamp', 'sp core' and 'sp io' to be compatible with 'polkadot-v0.9.40' from 'polkadot-v0.9.38', aligning with the latest Substrate version. This ensures our pallets stay up-to-date with the latest turnkey infrastructure enabling efficient blockchain development.
- Amended the weight ranges for three different calls - 'set_signer_account', 'add_record', and 'kill_storage' - within the Fund Admin Records pallet. We've changed the implementation to 'from_parts', explicitly setting the 'compute' part of the weight to 10,000 and 'io' part to 0. This provides a more specific weight range, optimizing on-chain resource use when these calls are processed.

* DEVELOPMENT AND TROUBLESHOOTING
- Updated the `pallet` macro for the Fund Admin Records pallet, specifying `STORAGE_VERSION` for better versioning control of the storage data. This ensures proper migration handling in future updates.
- Commented out certain test function bodies in the Fund Admin Records pallet. This indicates an ongoing refactoring process and tests will be revisited to ensure they align with the new implementation specifics.
- Updated the `pallet_rbac` configuration in the mock file of the Fund Admin pallet, adding `RemoveOrigin` set to `EnsureRoot<Self::AccountId>` to ensure that function calls, specific to the RBAC functionality, are executed by verified roots.
- Carried out codebase clean-up in the Gated Marketplace pallet, removing unneeded imports and fixing an incorrect closing tag on the `Config` implementation block.
- Updated the test suite for the Gated Marketplace pallet. Ensured that the `mint` function placing assets in the marketplace is correctly unwrapped using `assert_ok`. Commented out certain test cases, indicating a significant refactoring process which the tests will be revisited to align with.
- Adjusted the properties order in the pallet-rbac dependency within the Mapped Assets pallet's Cargo.toml for consistency and readability.
- Set up RBAC pallet in the test environment for the Mapped Assets pallet, implementing specific parameter types and configuring RBAC pallet for the test setup.
- Updated the test suite for the RBAC pallet. Several test cases were commented out indicating an ongoing refactoring process which the tests will be revisited to align with.
* 🐛 fix(afloat): modify `kill_storage` function to accept `args` parameter for more granular control over storage deletion
✨ feat(afloat): add `KillStorageArgs` enum to specify different types of storage to be deleted in `kill_storage` function

* 🐛 fix(functions.rs): add authorization check in do_cancel_offer function to ensure only admin or offer creator can cancel the offer
🐛 fix(lib.rs): remove redundant authorization check in cancel_offer function
@@ -390,15 +390,6 @@ dependencies = [
"libc",

Choose a reason for hiding this comment

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

GPT summary of 67b01d - 077f81:
Error: couldn't generate summary

@@ -859,11 +859,14 @@ impl<T: Config> Pallet<T> {
Ok(())

Choose a reason for hiding this comment

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

GPT summary of c00078 - 10b75e:

  • Changed the signature of do_cancel_offer() to include an AccountId argument
  • Added a check to ensure that the caller is either an admin or the owner of the offer
  • Added a check to ensure that the offer exists
  • Added a check to ensure that the offer status is CREATED before attempting to cancel

@@ -255,11 +255,40 @@ pub mod pallet {

Choose a reason for hiding this comment

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

GPT summary of ea5b04 - d1cb4c:

  • Added an argument to the kill_storage function, allowing for more granular control over what is deleted from storage
  • Added a check to ensure that only an admin or owner can cancel an offer

@@ -161,6 +161,17 @@ pub enum CreateOfferArgs<T: Config> {
},

Choose a reason for hiding this comment

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

GPT summary of bafac0 - a77fb3:

  • Added new KillStorageArgs enum with 8 variants.
  • Updated CreateOfferArgs struct.

@@ -20,15 +20,15 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
scale-info = { version = "2.0.1", default-features = false, features = [

Choose a reason for hiding this comment

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

GPT summary of c61877 - 5a11db:

  • Updated the version of codec, scale-info, frame-support, frame-system, frame-benchmarking, sp-runtime, pallet-timestamp, sp-core, and sp-io to polkadot-v0.9.40.

@@ -22,6 +22,7 @@ pub mod pallet {
use frame_support::traits::Time;

Choose a reason for hiding this comment

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

GPT summary of 937974 - c6aced:

  • Added a constant STORAGE_VERSION
  • Updated pallet annotation to include storage_version
  • Updated weight annotations to use Weight::from_parts
  • Added a function set_signer_account to set the account id of the signer
  • Added a function add_record to add a record to the storage
  • Added a function kill_storage to clear the storage

@@ -1,5 +1,5 @@
use crate::{mock::*, types::*, Records, Error};

Choose a reason for hiding this comment

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

GPT summary of b54509 - e1cf0a:

  • Imported frame_support and removed BoundedVec and ConstU32 traits from it
  • Commented out make_default_record_collection() and make_array_record_collection() functions

@@ -148,6 +148,7 @@ parameter_types! {
}

Choose a reason for hiding this comment

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

GPT summary of c0f871 - d9ec11:

  • Added a new type RemoveOrigin to the pallet_rbac::Config implementation for Test
  • RemoveOrigin is set to EnsureRoot<Self::AccountId>

@@ -1,6 +1,6 @@
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 4a9270 - 89fc58:

  • Updated the use statements in the beginning of the file
  • Updated the type statements at the end of the file

@@ -756,7 +756,7 @@ fn add_authority_admin_works() {
600,

Choose a reason for hiding this comment

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

GPT summary of 4ad774 - 3f114b:
Error: couldn't generate summary

@@ -25,7 +25,7 @@ frame-support = { git = "https://github.com/paritytech/substrate", branch = "pol
# `system` module provides us with all sorts of useful stuff and macros depend on it being around.

Choose a reason for hiding this comment

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

GPT summary of f2d2cb - 7f06d8:

  • Updated frame-support, frame-system, and frame-benchmarking to use polkadot-v0.9.40 branch of substrate
  • Reordered pallet-rbac fields to be in alphabetical order
  • Added sp-core dev-dependency with polkadot-v0.9.40 branch of substrate

@@ -31,6 +31,7 @@ use sp_runtime::{
testing::Header,

Choose a reason for hiding this comment

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

GPT summary of 62d02a - 0168a3:

  • Added EnsureRoot to frame_system
  • Added RBAC pallet
  • Added parameters for MaxScopesPerPallet, MaxRolesPerPallet, RoleMaxLen, PermissionMaxLen, MaxPermissionsPerRole, MaxRolesPerUser, and MaxUsersPerRole
  • Added Rbac type to Config

@@ -838,16 +838,6 @@ fn tx_create_and_set_roles_should_work() {
});

Choose a reason for hiding this comment

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

GPT summary of 9745a3 - a73e8c:

  • Removed tests for tx_create_and_set_roles_while_not_root_should_fail() and tx_remove_role_from_user_while_not_root_should_fail()
  • Updated tests for tx_create_and_set_permissions_while_not_root_should_fail(), tx_assing_role_to_user_while_not_root_should_fail(), and tx_remove_role_from_user_should_work()
  • Added tests for tx_create_and_set_roles_should_work() and tx_assing_role_to_user_should_work()

@github-actions
Copy link

GPT summary of a8d1072:

Error: couldn't generate summary

@github-actions
Copy link

GPT summary of 2a16ce2:

  • Added parameter who to do_cancel_offer functions.rs
  • Added additional checks to cancel_offer to make sure the caller is the offer creator or an admin functions.rs
  • Added KillStorageArgs enum types.rs
  • Added additional checks to kill_storage to accept KillStorageArgs lib.rs

PR summary so far:

  • Added parameters to do_cancel_offer and kill_storage functions
  • Added KillStorageArgs enum
  • Added set_signer_account and add_record functions to fund-admin-records pallet
  • Added RemoveOrigin type to pallet_rbac::Config for Test
  • Updated weight annotations to use Weight::from_parts

* 🐛 fix(afloat): modify `kill_storage` function to accept `args` parameter for more granular control over storage deletion
✨ feat(afloat): add `KillStorageArgs` enum to specify different types of storage to be deleted in `kill_storage` function

* 🐛 fix(functions.rs): add authorization check in do_cancel_offer function to ensure only admin or offer creator can cancel the offer
🐛 fix(lib.rs): remove redundant authorization check in cancel_offer function
@github-actions
Copy link

GPT summary of aa5f5ab:

  • No changes.

PR summary so far:

  • Added parameter who to do_cancel_offer to ensure caller is the offer creator or an admin
  • Added KillStorageArgs enum with 8 variants for granular control over storage
  • Updated CreateOfferArgs struct
  • Updated versions of codec, scale-info, frame-support, frame-system, frame-benchmarking, sp-runtime, pallet-timestamp, sp-core, and sp-io to polkadot-v0.9.40
  • Added constants and functions to pallets/fund-admin-records
  • Added RemoveOrigin to pallet_rbac::Config implementation for Test
  • Updated use and type statements in pallets/gated-marketplace/src/mock.rs
  • Updated frame-support, frame-system, and frame-benchmarking to use polkadot-v0.9.40 branch of substrate
  • Added EnsureRoot to frame_system and RBAC pallet to pallets/mapped-assets/src/mock.rs
  • Removed and updated tests in pallets/rbac/src/tests.rs

@tlacloc tlacloc merged commit e498e78 into main Sep 22, 2023
4 checks passed
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.

2 participants