-
Notifications
You must be signed in to change notification settings - Fork 52
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
solana: Add set_threshold
ix
#589
Conversation
solana/programs/example-native-token-transfers/src/instructions/admin.rs
Outdated
Show resolved
Hide resolved
solana/programs/example-native-token-transfers/src/instructions/admin.rs
Outdated
Show resolved
Hide resolved
solana/programs/example-native-token-transfers/src/instructions/admin.rs
Outdated
Show resolved
Hide resolved
I also now realize why I felt confused: The deregister function makes it seem like you just want to recoup rent, but really it's primarily about disabling the transceiver. |
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.
overall the changes look good, but a couple of comments:
- on the EVM side, we don't support deregistering transceivers, only disabling them. We should consider doing the same here. the rent saving is marginal here (given the frequency of this operation), and it might be good to be able to re-enable a transceiver (re-registering it will give it a new id).
- I think we shouldn't modify the threshold when disabling a transceiver. arguably the contract should be paused when modifying transceiver/threshold configurations, but if it's not, then as the admin modifies the config, there will be temporary scenarios where less than the intended threshold of transceivers can attest a message
Are you suggesting a Currently, |
This is what EVM does (decrement threshold if too high) so it is mostly just lifted from there. I agree that disabling could be limited to when contract is paused so could add a constraint for that. |
…rnance program id
746b5ff
to
c4cfbe0
Compare
Currently there is no way to update the NTT manager
threshold
(# of transceivers that must attest to a transfer before it is accepted) - it defaults to 1 - or deregister a transceiver. With multi-transceiver support, having a way to manage transceivers and their threshold is essential.This PR adds:
set_threshold
ix to update the threshold (0 < threshold <= # of enabled transceivers
)deregister_transceiver
ix to deregister (disable transceiver in enabled transceiver bitmap):register_transceiver
ix to also act as re-enable:RegisteredTransceiver
account is init for the first time, assign new idcreateSetThresholdInstruction
andcreateDeregisterTransceiverIx
TS helpers as a part of NTT namespace andSolanaNtt
class respectively