Skip to content

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Emit justification info #741

wants to merge 4 commits into from

Conversation

cam-schultz
Copy link
Contributor

@cam-schultz cam-schultz commented Mar 12, 2025

Why this should be merged

P-Chain validators attest that a validator is inactive and will never become active by signing a L1ValidatorRegistrationMessage with the registered field set to false. Since such validators are not held in the P-Chain's active state, P-Chain validators require an ACP-118 justification be provided along with the message to sign. At present, it's difficult to construct these justifications 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 the registerL1ValidatorMessage, and updates RegisteredInitialValidator to emit the subnet ID and validator's index in the ConvertSubnet message. These events can be queried by the indexed validationID to easily recover the information necessary to construct the justification for each case.

How this was tested

CI

How is this documented

NatSpec

bytes32 indexed validationID, bytes20 indexed nodeID, uint64 weight
bytes32 indexed validationID,
bytes20 indexed nodeID,
bytes32 indexed subnetID,
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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

@cam-schultz cam-schultz requested a review from geoff-vball March 19, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog 🗄️
Development

Successfully merging this pull request may close these issues.

2 participants