-
Notifications
You must be signed in to change notification settings - Fork 32
Emit justification info #741
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
base: main
Are you sure you want to change the base?
Conversation
bytes32 indexed validationID, bytes20 indexed nodeID, uint64 weight | ||
bytes32 indexed validationID, | ||
bytes20 indexed nodeID, | ||
bytes32 indexed subnetID, |
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.
Does indexing the subnetID make querying events easier? (not a rhetorical question, I'm actually curious).
Let's say we have two different ValidatorManager contracts on the C-chain that manage two different subnets. Is it easier to query on an indexed field than it is on the address that emitted the event?
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'm not sure. I added this here because there was an unused indexed
slot, and because searching by subnetID
seems like a common workflow.
bytes20 indexed nodeID, | ||
bytes32 indexed subnetID, | ||
uint64 weight, | ||
uint32 index |
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.
What's the eventual purpose of the index field here?
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.
It's used along with the subnetID
to create the preimage of the validationID
for initial validators. This is the justification
for P-Chain validators to sign the L1ValidatorRegistrationMessage
attesting that the validator has been removed. See here: https://github.com/ava-labs/avalanchego/blob/master/vms/platformvm/network/warp.go#L153
Why this should be merged
P-Chain validators attest that a validator is inactive and will never become active by signing a
L1ValidatorRegistrationMessage
with theregistered
field set to false. Since such validators are not held in the P-Chain's active state, P-Chain validators require an ACP-118justification
be provided along with the message to sign. At present, it's difficult to construct thesejustification
s on-demand, since that information is not exposes on-chain or emitted by any event. This effectively requires validator owners to independently track this information.This will require a PR to update the ACP-99 spec as well.
How this works
Updates
InitiatedValidatorRegistration
to emit the serialized bytes of theregisterL1ValidatorMessage
, and updatesRegisteredInitialValidator
to emit the subnet ID and validator's index in theConvertSubnet
message. These events can be queried by the indexedvalidationID
to easily recover the information necessary to construct thejustification
for each case.How this was tested
CI
How is this documented
NatSpec