Skip to content

Conversation

@Riateche
Copy link
Contributor

@Riateche Riateche commented May 6, 2025

Summary

Add proto declarations describing payload of a governance transaction.

Rationale

We want to manage Lazer through Pyth governance.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

@vercel
Copy link

vercel bot commented May 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 1:03pm
component-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 1:03pm
entropy-debugger ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 1:03pm
entropy-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 1:03pm
insights ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 1:03pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 1:03pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 1:03pm

@Riateche Riateche force-pushed the lazer-governance-instructions branch from 4d1b0d3 to 846718b Compare May 6, 2025 10:55
@Riateche Riateche marked this pull request as ready for review May 9, 2025 15:46
SET_SHARD_GROUP = 105;
RESET_LAST_SEQUENCE_NO = 106;
ADD_PUBLISHER = 107;
ADD_FEED = 109;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

108?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are just the same numbers as in GovernanceDirective. There is gap because there is no UpdatePublisher = 108 here. I prefer to treat these values as opaque anyway.

Copy link
Contributor

@keyvankhademi keyvankhademi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but let's wait for someone else to approve this

Copy link
Contributor

@darunrs darunrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM too. Various questions.


// A dynamically typed value similar to `google.protobuf.Value`
// but supporting more types.
message DynamicValue {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's worth adding an impl on this in this crate to create a rust map from the type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some conversions to/from serde_value::Value.

// rejected (e.g. if instruction #3 has been successfully processed before instruction #2 was observed,
// #2 will always be rejected).
// Sequence numbers are assigned and tracked separately for each governance source.
optional uint32 governance_sequence_no = 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the source specified in this message? Or does Lazer determine it somehow, like from an access key? Seems we need to know the source and its previous seq. no. in Relayer to properly validate this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added source field to GovernanceInstruction.

optional ShardFilter shard_filter = 1;
// [required]
// Note: when adding a new variant here, update `Permissions` as well.
oneof action {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this mirroring existing governance structure? Was curious why remove was part of update, when add is separated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. I don't know how much sense there is in it, but my reasoning was as follows: I don't want to merge e.g. AddPublisher with UpdatePublisher because semantics of the publisher_id field is different: in one case it's a new id, in another case it has to be an existing id. I can merge UpdatePublisher and RemovePublisher though, because semantics of the publisher_id field for them is the same.

From the perspective of different permission groups, it also kind of makes sense. If I have UpdatePublisher permission, even if I don't have permission to remove a publisher, I can edit it instead so it becomes unusable. So there is no reason for a separate RemovePublisher permission. On the other hand, AddPublisher permission is clearly less powerful than Update or Remove because with Add permission you can only add new publishers, not modify existing ones. In practice it's mostly irrelevant though.

// strictly sequential (i.e. gaps are allowed). Each shard separately keeps track of the last executed
// governance instruction and will reject instructions with the same or smaller sequence no.
// Note that if instructions are received out of order, some of them may become permanently
// rejected (e.g. if instruction #3 has been successfully processed before instruction #2 was observed,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good callout. The seq. no. prevents accidental replays and such. Is it possible for governance to receive confirmations before sending the next instruction or are we just at the mercy of network latencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could create an endpoint the returns latest governance seq no for a source. This would allow the sender to verify that the previous message has been processed.

}
}

// Create a new shard. Shard name will be determined by the value of `GovernanceDirective.filter`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my understanding of a shard is still vague. This seems like a good spot to fully define what it actually is. Could you put a definition 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.

Added.

optional uint32 publisher_id = 1;
// [required]
// Note: when adding a new variant here, update `Permissions` as well.
oneof action {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also have a DeactivatePublisher too? We can theoretically do this by removing one/all public keys. But we would need to undo this afterward if it was temporary. Also, what about removing the publisher entirely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_publisher_active can be used to deactivate it. remove_publisher action removes the publisher entirely.

@darunrs
Copy link
Contributor

darunrs commented May 12, 2025

Seems the build is failing though. Could you also verify that publish.sh works as you would expect? You can make sure your working directory has no changes and run it. And then inspect the files to see it all looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants