Skip to content

Commit 0a388dd

Browse files
authored
feat(lazer/publisher_sdk): add wormhole governance source proto (#2719)
* feat(lazer/publisher_sdk): add wormhole governance source proto * fix: address review comments
1 parent 61d59da commit 0a388dd

File tree

4 files changed

+68
-18
lines changed

4 files changed

+68
-18
lines changed

lazer/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lazer/publisher_sdk/proto/governance_instruction.proto

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ package pyth_lazer_transaction;
1313

1414
// Representation of a complete governance instruction. This value will be signed
1515
// by a governance source.
16+
//
17+
// If the governance source is SingleEd25519, this message will be the payload of LazerTransaction.
18+
//
19+
// If the governance source is Wormhole emitter, this message will be the body of the GovernancePayload which
20+
// is the VAA message Pyth governance sends to Wormhole. The GovernancePayload follows xc-admin spec
21+
// and looks like so:
22+
// <magic:u32><module:u8><action:u8><chain:u16><GovernanceInstruction:bytes>
23+
// You can find the xc-admin spec in: ../../../governance/xc_admin/packages/xc_admin_common/src/governance_payload
1624
message GovernanceInstruction {
17-
// [required] Governance source that signed this instruction.
18-
optional GovernanceSource source = 1;
1925
// Action requested by this instruction. For the instruction to be accepted, all directives
2026
// must be successfully applied. In case of any failure, the whole instruction is reverted.
2127
// However, note that if the instruction targets multiple (or all) shards, each shard will
@@ -29,14 +35,15 @@ message GovernanceInstruction {
2935
// is greater than the specified value. After `max_execution_timestamp` is in the past,
3036
// it will no longer be possible to execute this instruction.
3137
optional google.protobuf.Timestamp max_execution_timestamp = 4;
32-
// [required] Sequence number of this instruction. It must be greater than 0.
33-
// It must always be increasing, but not required to be
34-
// strictly sequential (i.e. gaps are allowed). Each shard separately keeps track of the last executed
35-
// governance instruction and will reject instructions with the same or smaller sequence no.
36-
// Note that if instructions are received out of order, some of them may become permanently
37-
// rejected (e.g. if instruction #3 has been successfully processed before instruction #2 was observed,
38-
// #2 will always be rejected).
39-
// Sequence numbers are assigned and tracked separately for each governance source.
38+
// [optional] Sequence number of this instruction. Required for SingleEd25519 governance source
39+
// and optional for WomrholeEmitter governance source (because Wormhole has its own sequence
40+
// numbers). If set, it must be greater than 0, and always be increasing, but not required to be
41+
// strictly sequential (i.e. gaps are allowed). Each shard separately keeps track of the last
42+
// executed governance instruction and will reject instructions with the same or smaller
43+
// sequence no. Note that if instructions are received out of order, some of them may become
44+
// permanently rejected (e.g. if instruction #3 has been successfully processed before
45+
// instruction #2 was observed, #2 will always be rejected). Sequence numbers are assigned and
46+
// tracked separately for each governance source.
4047
optional uint32 governance_sequence_no = 5;
4148
}
4249

@@ -155,10 +162,17 @@ message GovernanceSource {
155162
optional bytes public_key = 1;
156163
}
157164

165+
message WormholeEmitter {
166+
// [required] Wormhole emitter address.
167+
optional bytes address = 1;
168+
// [required] Wormhole emitter chain ID. Restricted to uint16.
169+
optional uint32 chain_id = 2;
170+
}
171+
158172
// [required]
159173
oneof source {
160174
SingleEd25519 single_ed25519 = 1;
161-
// TODO: wormhole source goes here.
175+
WormholeEmitter wormhole_emitter = 2;
162176
}
163177
}
164178

@@ -290,8 +304,8 @@ message SetPublisherActive {
290304

291305
// Feed is inactive when added, meaning that it will be available to publishers but not to consumers.
292306
message AddFeed {
293-
// [required] ID of the price feed. Must be unique (within the shard).
294-
optional uint32 price_feed_id = 1;
307+
// [required] ID of the feed. Must be unique (within the shard).
308+
optional uint32 feed_id = 1;
295309
// [required] Feed metadata. Some properties are required (name, exponent, etc.).
296310
// Known properties must have the expected type.
297311
// Additional arbitrary properties are allowed.
@@ -303,7 +317,7 @@ message AddFeed {
303317

304318
message UpdateFeed {
305319
// [required] ID of the feed that is being updated. Rejects if there is no such feed.
306-
optional uint32 price_feed_id = 1;
320+
optional uint32 feed_id = 1;
307321
// [required]
308322
// Note: when adding a new variant here, update `Permissions` as well.
309323
oneof action {
@@ -347,4 +361,3 @@ message DeactivateFeed {
347361
// governance instruction is processed.
348362
optional google.protobuf.Timestamp deactivation_timestamp = 1;
349363
}
350-

lazer/publisher_sdk/proto/pyth_lazer_transaction.proto

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@ message SignedLazerTransaction {
1515
// [required] signature with public key
1616
optional SignatureData signature_data = 1;
1717

18-
// [required] lazer transaction encoded as bytes through protobuf
18+
// [required] lazer transaction payload encoded as bytes.
19+
//
20+
// If the signature data is a Ed25519SignatureData, the payload is the encoded
21+
// LazerTransaction protobuf message.
22+
//
23+
// If the signature data is a WormholeMultiSigData, the payload is the encoded
24+
// Wormhole VAA body. The Wormhole VAA can be any of the following:
25+
// 1. A governance message from Pyth that updates Lazer state (e.g. a new feed) which
26+
// is an ecoded GovernancePayload according to xc-admin spec which contains the
27+
// encoded GovernanceInstruction protobuf message.
28+
// 2. A governance message from Wormhole that updates Wormhole guardian set which follows
29+
// the Wormhole specification.
1930
optional bytes payload = 2;
2031
}
2132

@@ -27,9 +38,35 @@ message SignatureData {
2738
// [required] type of signature, which determines included data needed for verifying
2839
oneof data {
2940
Ed25519SignatureData ed25519 = 1;
41+
WormholeMultiSigData wormholeMultiSig = 2;
3042
};
3143
}
3244

45+
// Wormhole multisig data which is the proto encoding of the VAA
46+
// header taken from the following wire format:
47+
// https://github.com/wormhole-foundation/wormhole/blob/main/whitepapers/0001_generic_message_passing.md
48+
message WormholeMultiSigData {
49+
// [required] Protocol version of the entire VAA.
50+
optional int32 version = 1;
51+
52+
// [required] GuardianSetIndex is the index of the guardian set that signed
53+
// this VAA. Signatures are verified against the public keys in the
54+
// guardian set.
55+
optional int32 guardianSetIndex = 2;
56+
57+
// Signatures contain a list of signatures made by the guardian set.
58+
repeated WormholeGuardianSignature signatures = 3;
59+
}
60+
61+
// Wormhole multisig signature
62+
message WormholeGuardianSignature {
63+
// [required] Index of the guardian that signed the transaction
64+
optional int32 index = 1;
65+
66+
// [required] 65 byte eccdsa signature
67+
optional bytes signature = 2;
68+
}
69+
3370
// ED25519 style signature. Should include a single signature and a single public key
3471
// Signature will be verified using public key after determining public key is valid
3572
message Ed25519SignatureData {

lazer/publisher_sdk/rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-lazer-publisher-sdk"
3-
version = "0.1.3"
3+
version = "0.1.4"
44
edition = "2021"
55
description = "Pyth Lazer Publisher SDK types."
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)