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

Port CW3 to Secret #1

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

Port CW3 to Secret #1

wants to merge 28 commits into from

Conversation

apollo-bobby
Copy link

This commit contains a large refactor to the internals of the cw3-fixed-multisig implementation to work on Secret and without cw-storage-plus as a dependency.
It includes migrating from the usual Map to a similar Keymap, as well as introducing an implementation of a Binary Search Tree (based on the secret-toolkit Item implementation) to maintain ordering in state without massive, expensive sorting operations at any one time.

Signed-off-by: Bobby [email protected]

This commit contains a large refactor to the internals of the
cw3-fixed-multisig implementation to work on Secret and without
cw-storage-plus as a dependency.
It includes migrating from the usual Map to a similar Keymap,
as well as introducing an implementation of a Binary Search Tree
(based on the secret-toolkit Item implementation) to maintain
ordering in state without massive, expensive sorting operations
at any one time.

Signed-off-by: Bobby <[email protected]>
@apollo-bobby apollo-bobby self-assigned this Sep 19, 2022
@apollo-bobby apollo-bobby marked this pull request as draft September 20, 2022 13:49
Signed-off-by: Bobby <[email protected]>
This commit fixes a bug where floating point operations
were being introduced in the wasm binary, stemming from
the use of the Bincode2 serilization method as default
in secret-toolkit and the BST in state.
Overriding the default to JSON resolves this issue.

Signed-off-by: Bobby <[email protected]>
This commit contains large changes to enable
cw3-flex to work on Secret. This involves porting
(at least) cw4-group so that it may deployed in
conjunction with cw3-flex.
That in turn requires porting SnapshotMap from
cw-storage-plus to Secret.
Other notable changes:
 *  moving BinarySearchTree from cw3-fixed to this
    custom storage-plus package, which SnapshotMap
    is now dependent on.
 *  Adding a (optional) `code_hash` parameter to
    ExecuteMsg::UpdateMembers.

Signed-off-by: Bobby <[email protected]>
Signed-off-by: Bobby <[email protected]>
@apollo-bobby apollo-bobby marked this pull request as ready for review November 2, 2022 17:51
@apollo-bobby
Copy link
Author

Ready for review at this point I think. I have not ported cw4-stake, might do that later if I find the time.

Copy link

@dirtyshab dirtyshab left a comment

Choose a reason for hiding this comment

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

nice work @apollo-bobby! most of my comments are nitpicks / cleanup reminders but I also have some clarifying questions/suggestions, please review and lmk if you have any questions/thoughts. I also have some ideas for refactoring the storage to make it easier to work with, will raise a separate PR today with that and have you review.

contracts/cw3-fixed-multisig/Cargo.toml Outdated Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw3-fixed-multisig/src/state.rs Outdated Show resolved Hide resolved
contracts/cw3-flex-multisig/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw3-flex-multisig/src/contract.rs Show resolved Hide resolved
contracts/cw3-flex-multisig/src/contract.rs Show resolved Hide resolved
contracts/cw3-flex-multisig/src/contract.rs Outdated Show resolved Hide resolved
@apollo-bobby
Copy link
Author

Before merging we should also update the package metadata for all crates in this repo. They all currently say by Ethan Frey in 2018 or something similar. We might also want to put our own version on them. Not saying we should discredit Ethan Frey but we probably also shouldn't credit him solely with this work.

Adds functionality for checking if a user is a member
before allowing them to query anything in a cw3/cw4,
using `Permit` from `secret-toolkit`.
Contains lots of changes to dependencies due to having
to upgrade `secret-toolkit` from 0.7.0 to 0.8.0.
Also refactors some code in `cw3-flex-multisig and
cw4-group to reduce duplicated code. `cw4-group` is now
dependent on `cw3-fixed-multisig`.

Signed-off-by: Bobby <[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.

2 participants