This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add extrinsic to improve position in a bag of bags-list #9829
Add extrinsic to improve position in a bag of bags-list #9829
Changes from 2 commits
c414583
331df1b
e7c016c
2401b2b
60743cc
6bb232f
45f4a73
f04a64c
ce0fcfb
aa0aaeb
fa1a33d
21aef98
7433cf6
1760815
fcc29d2
afff2a9
b75457f
fd1daeb
f5a854f
a12f094
d5f82ac
f3f992c
927a383
387ab0d
7d5a1ca
2add927
fe120d6
d135b8f
7530d1a
cd39dc9
fd751fc
f5b0224
91317bd
6af64ce
3382286
56ea8cc
a96e495
77fd777
aa4d896
944dc85
ae188ae
2eb86e5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given
I as a 3rd person can pay to make this
which is unfair to
heavy
node.given this I think this should not be permissionless, although it would be a pity. WDYT? the scenario above is def uncool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to think about this more - but one approach would be to heavily restrict usage and say heavy can only go in front of light if light is the head. Significantly less helpful since once a node with a weight equal to the bag threhsold is at the head we can no longer do anything
In the direction of having it as a permissioned extrinsic within the context of Polkadot I don't really see a justification for adding this as a permissioned extrinsic - do you ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, not a fan.
I def. do think there's a use case for the permissioned version as well. A user within a bag is incentivized to call this themselves if they have a better position in the bag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stating the obvious, but the fundamental issue here is we don't know relative position of any non-terminal nodes - not sure if there is any way of getting around that without adding more data to either the nodes or some storage item that keeps track of node index - both of which sound like too much added complexity at this stage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT sorry i was understanding this wrong - I thought you meant ROOT origin by permissioned . need to sleep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it should be permissioned and probably only callable by the heavy node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is going to be permissioned it will mean it is only callable by the stash address - so we should make sure this is callable through at least some proxy, or maybe work in a way to call it via the controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds better than having it permissionless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you are assuming that the lighter node could only ever be a head, and the heavier node could only ever be a tail, while I don't see that being guaranteed. Can you elaborate all the edge cases that you considered, and why you think this is enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here's an idea to break this down into smaller bite-size pieces:
fn remove()
. After all the checks, we immediately removeheavier
. The logic for this function should already update the Bag head/tail ifheavier.is_terminal()
.This will require the least amount of added logic, which helps with verifying the correctness of the PR (assuming that none of the old code was buggy).
If we keep the current code, here's a mental model to check it
and for any case that contains a non-terminal, we have to consider if they are adjacent or not (in case 5 it totally makes a different).
I'm going to now start thinking about each case and how it is handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My analysis shows case 5 is not handled correctly, when the non-terminal lighter is not adjacent to the heavier one.
I'd like to see the fix, but my gut feeling is that rewriting it using smaller functions is easier. This
if conditions_in_which_we_might_update_bags {}
is a bit hard to verify. If we first remove, then update everything, and then insert, and update everything again, there would probably be a few extra (IMO negligible) lookups to the overlay, but the (non-negligible) db access would be the same.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fa1a33d