Skip to content

Conversation

@tlacloc
Copy link
Contributor

@tlacloc tlacloc commented Sep 26, 2023

  • Update format for all pallets using fmt
  • Refactor initial setup on afloat pallet to allow either initialize all pallets or just setup the roles (change needed for Chaos)

…prove code readability

✨ feat(types.rs): add InitialSetupArgs enum to handle initial setup arguments for asset creation and role assignment
…improve code cleanliness and readability

✨ feat(functions.rs): rename `do_setup_asset` function to `do_create_afloat_asset` for better naming consistency and clarity
✨ feat(lib.rs): refactor `InitialSetupArgs::All` match arm to call necessary setup functions in the correct order for initializing afloat pallet
…dd_account_to_afloat_frunique for better clarity and consistency

🐛 fix(lib.rs): rename add_to_afloat_collection function to do_add_account_to_afloat_frunique for better clarity and consistency
…`cargo fmt` before committing

🐛 fix(afloat): remove unnecessary commented out code in pallet module
… in Afloat pallet to explain its inputs and purpose

🔥 refactor(lib.rs): remove unnecessary empty line in Afloat pallet module
@@ -0,0 +1,13 @@
#!/bin/bash

Choose a reason for hiding this comment

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

GPT summary of None - 2914ba:

  • Added a pre-commit hook to check if code style is correct before commit
  • If code style is incorrect, an error message is printed and the commit is aborted

"Drawdowns",
"Frunique",
"fruniques",
"Permill"

Choose a reason for hiding this comment

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

GPT summary of b03b0e - 0038eb:

  • Changed the value of editor.tabSize from 2 to 4
  • Enabled editor.formatOnSave
  • Changed github.gitProtocol to ssh

@@ -1,894 +1,985 @@
use super::*;

Choose a reason for hiding this comment

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

GPT summary of 10b75e - ee955a:
Error: couldn't generate summary


mod functions;
pub mod types;

Choose a reason for hiding this comment

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

GPT summary of d1cb4c - 93b888:
Error: couldn't generate summary

@@ -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 55555a - afee51:
Error: couldn't generate summary

use super::*;
use crate::{mock::*, types::*, Error};
use frame_support::{assert_noop, assert_ok, traits::Currency, BoundedVec};
use frame_system::RawOrigin;

Choose a reason for hiding this comment

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

GPT summary of ccc7ac - 22adc7:
Error: couldn't generate summary

@@ -1,6 +1,5 @@
use super::*;

Choose a reason for hiding this comment

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

GPT summary of a77fb3 - d96b85:
Error: couldn't generate summary

@@ -1,18 +1,19 @@
use super::*;

Choose a reason for hiding this comment

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

GPT summary of 0a814a - a963f9:

  • Removed unnecessary imports and added imports for lite-json and sp_runtime
  • Added a new function do_remove_proof to remove a proof of reserves
  • Added a new function get_pending_vaults to get vaults with pending descriptors
  • Added a new function get_pending_proposals to get proposals with pending PSBTs
  • Added a new function get_finalizable_proposals to get proposals that can be finalized
  • Added a new function do_insert_descriptors to insert vault descriptors
  • Added a new function do_insert_proposal to insert a proposal
  • Added a new function do_finalize_proposal to finalize a proposal
  • Added a new function bdk_gen_finalized_proposal to generate a finalized proposal
  • Added a new function parse_vault_descriptors to parse vault descriptors
  • Added a new function http_post to make HTTP POST requests
  • Added a new function build_offchain_err to build an offchain error
  • Implemented BlockNumberProvider trait

#[frame_support::pallet]
pub mod pallet {
use frame_support::pallet_prelude::*;
//#[cfg(feature = "std")]

Choose a reason for hiding this comment

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

GPT summary of 015d6a - 632f22:
Error: couldn't generate summary

@@ -1,20 +1,22 @@
use crate as pallet_bitcoin_vaults;

Choose a reason for hiding this comment

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

GPT summary of 866e96 - 79c45d:

  • Imports were added to the top of the file
  • The EnsureRoot and pallet_balances traits were imported
  • The UncheckedExtrinsic and Block types were added
  • The test_pub function was added
  • The genesis storage was modified to include the balances vector with three entries

@@ -1,22 +1,21 @@
use super::*;

Choose a reason for hiding this comment

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

GPT summary of c3168f - 7eb20b:

  • Imports and constants were updated.
  • The crypto module was updated.
  • The Proposal struct was updated with a new method and changes to existing methods.
  • The ProposalStatus enum was updated with changes to existing variants.

@@ -1,6 +1,5 @@
use super::*;

Choose a reason for hiding this comment

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

GPT summary of dcb1ca - 1d239d:

  • Removed 'use frame_support::pallet_prelude::*'
  • Added 'frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256}'

#[pallet::constant]
type MaxMemberGroups: Get<u32>;
}

Choose a reason for hiding this comment

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

GPT summary of f10308 - 2bdae3:

  • Added the pallet storage version attribute to the Pallet struct.

assert_ok!(ConfidentialDocs::update_shared_document_metadata(
RuntimeOrigin::signed(to),
shared_doc1.clone()
));

Choose a reason for hiding this comment

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

GPT summary of 8ed742 - 6e4c07:

  • Updated the update_shared_document_metadata_works() test to remove a line
  • Updated the remove_group_member_works_for_admin_removing_member_he_added() test to add a line and update an existing line
  • Added a new test remove_group_member_should_fail_for_trying_to_remove_owner()
  • Updated the remove_group_member_should_fail_for_role_member_as_authorizer() test
  • Updated the remove_group_member_should_fail_for_admin_removing_member_he_did_not_add() test to remove a line

pub fn can_add_group_member(&self) -> bool {
self.role == GroupRole::Admin || self.role == GroupRole::Owner
}

Choose a reason for hiding this comment

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

GPT summary of 162cfd - 6735c9:

  • Changed the condition of the can_remove_group_member function to require that either the caller is an owner or the caller is an admin and the group member to be removed is authorized by the caller.


mod functions;
pub mod types;

Choose a reason for hiding this comment

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

GPT summary of 2367bd - 8444d0:
Error: couldn't generate summary

use crate as pallet_fruniques;
use frame_support::{construct_runtime, parameter_types, traits::AsEnsureOriginWithArg};
use frame_system::{EnsureRoot, EnsureSigned};
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 d6179f - a6d2bc:

  • Modified parameters for the pallet_fruniques, pallet_uniques, pallet_balances, and pallet_rbac pallets
  • Added a new_test_ext function to build genesis storage according to the mock runtime
  • Added a do_initial_setup function to configure initial setup

// ($( $x:tt )*) => {
// vec![$( $x )*].try_into().unwrap()
// }
// }

Choose a reason for hiding this comment

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

GPT summary of cd7eb5 - 774848:
Error: couldn't generate summary

pub type Percentage = u16;

#[derive(Encode, Decode, RuntimeDebugNoBound, Default, TypeInfo, MaxEncodedLen)]
#[scale_info(skip_type_params(T))]

Choose a reason for hiding this comment

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

GPT summary of d2866a - 93a2ea:
Error: couldn't generate summary

@github-actions
Copy link

GPT summary of cc39dd4:

  • Added arguments for Offer struct types.rs
  • Added CreateAsset enum types.rs
  • Added InitialSetupArgs enum types.rs
  • Removed CreateAsset enum from Transaction struct types.rs

@github-actions
Copy link

GPT summary of ec717fc:

Error: couldn't generate summary

@github-actions
Copy link

GPT summary of 04d6062:

Error: couldn't generate summary

@github-actions
Copy link

GPT summary of 48a7d51:

Error: couldn't generate summary

@github-actions
Copy link

GPT summary of 47e772c:

Error: couldn't generate summary

@github-actions
Copy link

GPT summary of c32c0dc:

Error: couldn't generate summary

@github-actions
Copy link

GPT summary of 2dbc165:

  • Removed frame_support::pallet_prelude::* and replaced it with frame_support::{pallet_prelude::*, sp_io::hashing::blake2_256} functions.rs
  • Removed empty line in lib.rs lib.rs
  • Updated update_shared_document_metadata_works test to not include an empty line tests.rs
  • Changed logic for remove_group_member_works_for_admin_removing_member_he_added test tests.rs
  • Added remove_group_member_should_fail_for_trying_to_remove_owner and remove_group_member_should_fail_for_role_member_as_authorizer tests tests.rs
  • Changed logic for remove_group_member_should_fail_for_admin_removing_member_he_did_not_add test tests.rs
  • Updated GroupMember::can_remove_group_member logic types.rs

@github-actions
Copy link

GPT summary of 1f7fd19:

Error: couldn't generate summary

@github-actions
Copy link

GPT summary of 83b7b5a:

Error: couldn't generate summary

@github-actions
Copy link

GPT summary of 1670518:

Error: couldn't generate summary

@github-actions
Copy link

GPT summary of dee30ef:

  • Replaced use pallet_gated_marketplace::types::Marketplace; with use pallet_gated_marketplace::types::{Marketplace, MarketplaceRole}; and use sp_runtime::{traits::StaticLookup, Permill}; functions.rs
  • Changed the signature of do_setup_asset to do_create_afloat_asset and added code for initial setup lib.rs

@github-actions
Copy link

GPT summary of 960f859:

  • Replaced add_to_afloat_collection with do_add_account_to_afloat_frunique in functions.rs and lib.rs functions.rs, lib.rs
  • Added do_add_account_to_afloat_frunique to functions.rs functions.rs

@github-actions
Copy link

GPT summary of a716dd9:

@github-actions
Copy link

GPT summary of 9e88a8d:

  • Added a pre-commit hook for code style checks pre-commit
  • Removed an unnecessary Ok(()) call from the pallet lib.rs

@github-actions
Copy link

GPT summary of 9b9f146:

  • Added a function to setup roles for the Afloat pallet functions.rs
  • Removed an unused function lib.rs

PR summary so far:

  • Added and changed functions, tests, and types for the Afloat, Bitcoin Vaults, Confidential Docs, and Fruniques pallets
  • Changed the tab size and enabled format on save in settings.json
  • Added a pre-commit hook for code style checks
  • Updated imports and constants in various files

🔧 chore(check.yml): add step to check Rust build using cargo check --release
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
rustup default stable
rustup update nightly

Choose a reason for hiding this comment

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

GPT summary of 0fead3 - 1eecd5:

  • Added a job to check the format of the code
  • Updated the nightly and stable toolchains
  • Added the wasm32-unknown-unknown target to the nightly toolchain
  • Added rustfmt component
  • Added a check for all code formatting
  • Added a check for the release build

}: _(RawOrigin::Signed(caller), s)
verify {
assert_eq!(Something::<T>::get(), Some(s));
}

Choose a reason for hiding this comment

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

GPT summary of 6d3709 - d496a9:

  • Modified the benchmarking module to implement the benchmark_test_suite macro.

@@ -1,64 +1,55 @@
use super::*;

Choose a reason for hiding this comment

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

GPT summary of 852ac5 - 716176:

  • Added a function do_add_record to add records to the storage
  • Validated the inputs of the function to check if the project ID and hashed info are not empty
  • Generated a unique record ID based on the inputs
  • Inserted the record into the storage
  • Emitted an event to notify that a record was added


mod functions;
mod types;

Choose a reason for hiding this comment

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

GPT summary of c6aced - 7a20e4:

  • Changed use frame_support::pallet_prelude::*; to use frame_support::{pallet_prelude::*, traits::Time};
  • Removed use frame_support::traits::Time;
  • Added MaxRecordsAtTime constant
  • Added SignerAccount storage
  • Added Records storage
  • Added RecordAdded event
  • Added MaxRegistrationsAtATimeReached error
  • Added set_signer_account extrinsic
  • Added add_record extrinsic
  • Added kill_storage extrinsic

type Timestamp = Timestamp;
type RemoveOrigin = EnsureRoot<Self::AccountId>;
type Moment = u64;
type MaxRecordsAtTime = MaxRecordsAtTime;

Choose a reason for hiding this comment

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

GPT summary of 8640f1 - 0aff65:

  • Removed some parameter types
  • Changed the type of Moment from u64 to u32

use crate::{mock::*, types::*, Records, Error};
use frame_support::{assert_ok, assert_noop, bounded_vec};

use crate::{mock::*, types::*, Error, Records};

Choose a reason for hiding this comment

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

GPT summary of e1cf0a - af1579:

  • Adjusted imports in the code
  • Added a function for setting the signer account
  • Added a test to check that a record cannot be added if the signer account is not set
  • Added a test to check that a drawdown record can be added

use frame_support::pallet_prelude::*;

pub type HashedInfo = BoundedVec<u8, ConstU32<400>>;
pub type Id = [u8; 32];

Choose a reason for hiding this comment

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

GPT summary of 8acf18 - 5335e9:

  • Removed some parameters from the RecordCollection type
  • Added Clone, Eq, PartialEq, and Copy traits to the TableType and RecordType enums
  • Added Confirm variant to the RecordType enum

//! Various pieces of common functionality.
use super::*;

const LOG_TARGET: &str = "\nFund Admin pallet migration ";

Choose a reason for hiding this comment

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

GPT summary of c727c0 - e08d68:
Error: couldn't generate summary

@github-actions
Copy link

GPT summary of 62494a9:

  • Added a check for formatting with rustfmt check.yml

PR summary so far:

  • Added arguments, enums, and functions to the Afloat, Bitcoin Vaults, Confidential Docs, and Fund Admin Records pallets
  • Implemented BlockNumberProvider trait for the Bitcoin Vaults pallet
  • Updated imports, constants, and functions for the Bitcoin Vaults and Confidential Docs pallets
  • Updated the genesis storage for the Bitcoin Vaults pallet
  • Changed the tab size from 2 to 4 and enabled format on save in the .vscode/settings.json file
  • Added a pre-commit hook for code style checks in the .githooks/pre-commit file
  • Added a check for formatting with rustfmt in the .github/workflows/check.yml file
  • Added a check for the release build in the .github/workflows/check.yml file
  • Added a function to setup roles for the Afloat pallet
  • Added a function to remove a proof of reserves for the Bitcoin Vaults pallet
  • Added functions to get pending vaults and proposals, insert descriptors and proposals, and finalize proposals for the Bitcoin Vaults pallet
  • Added a migration script for the Fund Admin pallet

@tlacloc tlacloc merged commit d806af2 into main Sep 27, 2023
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