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

Support shared hold id to have constant number of hold id #3013

Merged
merged 8 commits into from
Sep 25, 2024
Merged

Conversation

NingLin-P
Copy link
Member

close #2674

This PR supports shared hold id that is used in staking, domain instantiation, and XDM channel, such that we can have a constant number of hold id variants and extrinsic that require creating hold won't fail due to the fixed hold id limit.

Because we also support the nomination of multiple different operators, opening multiple channel, and instantiating multiple domains so we have to add storage keep tracking of the hold balance.

Code contributor checklist:

Previously, we need to use withdraw_and_hold and then Currency::release

Signed-off-by: linning <linningde25@gmail.com>
Signed-off-by: linning <linningde25@gmail.com>
Signed-off-by: linning <linningde25@gmail.com>
NOTE: we still need to keep track of the domain instantiation deposit in the state in
case the DomainInstantiationDeposit change in the future

Signed-off-by: linning <linningde25@gmail.com>
@NingLin-P NingLin-P added the need to audit This change needs to be audited label Sep 11, 2024
NOTE: we still need to keep track of the channel reserve fee in the state in
case the ChannelReserveFee change in the future

Signed-off-by: linning <linningde25@gmail.com>
Signed-off-by: linning <linningde25@gmail.com>
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Looks good! I don’t have enough context to fully review, but here are some small things I wasn’t sure about.

crates/pallet-domains/src/staking_epoch.rs Outdated Show resolved Hide resolved
domains/primitives/messenger/src/messages.rs Outdated Show resolved Hide resolved
Signed-off-by: linning <linningde25@gmail.com>
Copy link
Contributor

@dastansam dastansam left a comment

Choose a reason for hiding this comment

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

also, lgtm and not 100% familiar with the code to approve

@NingLin-P
Copy link
Member Author

@dariolina perhaps also @nazar-pc please take a look, thanks!

nazar-pc
nazar-pc previously approved these changes Sep 25, 2024
Copy link
Member

@nazar-pc nazar-pc left a comment

Choose a reason for hiding this comment

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

Makes sense to me overall as well, but I don't have the invariants in my head either, just like everyone else 🤷

test/subspace-test-runtime/src/lib.rs Outdated Show resolved Hide resolved
Signed-off-by: linning <linningde25@gmail.com>
@NingLin-P NingLin-P added this pull request to the merge queue Sep 25, 2024
@nazar-pc
Copy link
Member

Had to stop CI due to test_xdm_false_invalid_fraud_proof hanging

Merged via the queue into main with commit 700113c Sep 25, 2024
9 checks passed
@NingLin-P NingLin-P deleted the shared-hold branch September 25, 2024 12:40
@NingLin-P NingLin-P added the audit-P1 High audit priority label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audit-P1 High audit priority need to audit This change needs to be audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proper value for the HoldIdentifier::VARIANT_COUNT
4 participants