Skip to content

Commit 466904a

Browse files
committed
feat(lazer/publisher_sdk): add wormhole governance source proto
1 parent 61d59da commit 466904a

File tree

4 files changed

+52
-16
lines changed

4 files changed

+52
-16
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: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ import "dynamic_value.proto";
1212
package pyth_lazer_transaction;
1313

1414
// Representation of a complete governance instruction. This value will be signed
15-
// by a governance source.
15+
// by a governance source. If the governance source is Wormhole emitter, the VAA payload will
16+
// be the encoded `GovernanceInstruction` message.
1617
message GovernanceInstruction {
17-
// [required] Governance source that signed this instruction.
18-
optional GovernanceSource source = 1;
1918
// Action requested by this instruction. For the instruction to be accepted, all directives
2019
// must be successfully applied. In case of any failure, the whole instruction is reverted.
2120
// However, note that if the instruction targets multiple (or all) shards, each shard will
@@ -29,14 +28,15 @@ message GovernanceInstruction {
2928
// is greater than the specified value. After `max_execution_timestamp` is in the past,
3029
// it will no longer be possible to execute this instruction.
3130
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.
31+
// [optional] Sequence number of this instruction. Required for SingleEd25519 governance source
32+
// and optional for WomrholeEmitter governance source (because Wormhole has its own sequence
33+
// numbers). If set, it must be greater than 0, and always be increasing, but not required to be
34+
// strictly sequential (i.e. gaps are allowed). Each shard separately keeps track of the last
35+
// executed governance instruction and will reject instructions with the same or smaller
36+
// sequence no. Note that if instructions are received out of order, some of them may become
37+
// permanently rejected (e.g. if instruction #3 has been successfully processed before
38+
// instruction #2 was observed, #2 will always be rejected). Sequence numbers are assigned and
39+
// tracked separately for each governance source.
4040
optional uint32 governance_sequence_no = 5;
4141
}
4242

@@ -155,10 +155,17 @@ message GovernanceSource {
155155
optional bytes public_key = 1;
156156
}
157157

158+
message WormholeEmitter {
159+
// [required] Wormhole emitter address.
160+
optional bytes address = 1;
161+
// [required] Wormhole emitter chain ID. Restricted to uint16.
162+
optional uint32 chain_id = 2;
163+
}
164+
158165
// [required]
159166
oneof source {
160167
SingleEd25519 single_ed25519 = 1;
161-
// TODO: wormhole source goes here.
168+
WormholeEmitter wormhole_emitter = 2;
162169
}
163170
}
164171

@@ -347,4 +354,3 @@ message DeactivateFeed {
347354
// governance instruction is processed.
348355
optional google.protobuf.Timestamp deactivation_timestamp = 1;
349356
}
350-

lazer/publisher_sdk/proto/pyth_lazer_transaction.proto

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ 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+
// If the signature data is a Ed25519SignatureData, the payload is the encoded
20+
// LazerTransaction protobuf message.
21+
// If the signature data is a WormholeMultiSigData, the payload is the encoded
22+
// Wormhole VAA body.
1923
optional bytes payload = 2;
2024
}
2125

@@ -27,9 +31,35 @@ message SignatureData {
2731
// [required] type of signature, which determines included data needed for verifying
2832
oneof data {
2933
Ed25519SignatureData ed25519 = 1;
34+
WormholeMultiSigData wormholeMultiSig = 2;
3035
};
3136
}
3237

38+
// Wormhole multisig data which is the proto encoding of the VAA
39+
// header taken from the following wire format:
40+
// https://github.com/wormhole-foundation/wormhole/blob/main/whitepapers/0001_generic_message_passing.md
41+
message WormholeMultiSigData {
42+
// [required] Protocol version of the entire VAA.
43+
optional int32 version = 1;
44+
45+
// [required] GuardianSetIndex is the index of the guardian set that signed
46+
// this VAA. Signatures are verified against the public keys in the
47+
// guardian set.
48+
optional int32 guardianSetIndex = 2;
49+
50+
// Signatures contain a list of signatures made by the guardian set.
51+
repeated WormholeGuardianSignature signatures = 3;
52+
}
53+
54+
// Wormhole multisig signature
55+
message WormholeGuardianSignature {
56+
// [required] Index of the guardian that signed the transaction
57+
optional int32 index = 1;
58+
59+
// [required] 65 byte eccdsa signature
60+
optional bytes signature = 2;
61+
}
62+
3363
// ED25519 style signature. Should include a single signature and a single public key
3464
// Signature will be verified using public key after determining public key is valid
3565
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)