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

Add a whitelist #18

Merged
merged 11 commits into from
Apr 22, 2024
Merged

Add a whitelist #18

merged 11 commits into from
Apr 22, 2024

Conversation

p-offtermatt
Copy link
Member

@p-offtermatt p-offtermatt commented Apr 22, 2024

Add two fields to storage, WHITELIST (which stores covenant params) and WHITELIST_ADMINS (a vector of addresses)

Change covenant_params to assume they hold the right information to filter the whitelist against.
I just assumed some dummy fields for now, e.g. pool_id, channel_id, and name.

WHITELIST_ADMINS are set at instantiation and can remove/add items to the whitelist

Tests for manipulating the whitelist are TODO

The whitelist might be too imperformant; query_top_n_proposals is O(N*M) now, where N is the number of proposals and M is the size of the whitelist.

If we think the core logic, other than performance, is ok, we should write tests for the current imperformant logic, and then adjust any performance issues and verify that the tests are ok.

Copy link
Contributor

@dusan-maksimovic dusan-maksimovic left a comment

Choose a reason for hiding this comment

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

I hope the basic concept on how to do the whitelisting is correct. The code looks good!

contracts/atom_wars/src/contract.rs Show resolved Hide resolved
contracts/atom_wars/src/contract.rs Outdated Show resolved Hide resolved
contracts/atom_wars/src/contract.rs Show resolved Hide resolved
@p-offtermatt p-offtermatt merged commit c70866e into main Apr 22, 2024
3 checks passed
@p-offtermatt p-offtermatt deleted the ph/whitelist-blacklist branch April 22, 2024 09:51
@p-offtermatt p-offtermatt linked an issue Apr 22, 2024 that may be closed by this pull request
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.

Add basic whitelist/blacklist functionality
2 participants