[RFC] Make adding and deleting pubs idempotent#373
Open
Conversation
jayantk
reviewed
May 30, 2023
Contributor
jayantk
left a comment
There was a problem hiding this comment.
I think this change is fine, though the case where you hit the 32 pub limit is weird. I get why you're doing that though, and it is technically idempotent so fine. I think my one ask is to document the semantics of both the add and delete operations so it's clear to the reader why the functions return Ok() in these cases where you might expect an error.
| let mut price_data = load_checked::<PriceAccount>(price_account, cmd_args.header.version)?; | ||
|
|
||
| if price_data.num_ >= PC_COMP_SIZE { | ||
| return Err(ProgramError::InvalidArgument); |
Contributor
There was a problem hiding this comment.
this means that if you try to exceed the 32 pub limit, the tx succeeds ? that seems questionable.
| instruction_data | ||
| ), | ||
| Err(ProgramError::InvalidArgument) | ||
| Ok(()) |
Contributor
There was a problem hiding this comment.
maybe check here that the pub array is unchanged after this operation?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We have a way of proposing to add a publisher to all symbols that will make a proposal where the publisher gets added to all symbols where it is not already permissioned and the symbol has less than 32 pubs.
However, this doesn't always work. For example, if one raises a proposal to add publisher A to all symbols and then a proposal to add publisher B to all symbols; once they are both approved only one of the two will be executed without errors.
An alternative to this PR would be a "add many publishers to all symbols" button in the UI.