all: rename LockupObservation to SignedObservation
We observe things other than lockups, account for it.
This commit is contained in:
parent
50807037a5
commit
0152a00114
|
@ -282,7 +282,7 @@ func runBridge(cmd *cobra.Command, args []string) {
|
|||
sendC := make(chan []byte)
|
||||
|
||||
// Inbound observations
|
||||
obsvC := make(chan *gossipv1.LockupObservation, 50)
|
||||
obsvC := make(chan *gossipv1.SignedObservation, 50)
|
||||
|
||||
// VAAs to submit to Solana
|
||||
solanaVaaC := make(chan *vaa.VAA)
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
"github.com/certusone/wormhole/bridge/pkg/supervisor"
|
||||
)
|
||||
|
||||
func Run(obsvC chan *gossipv1.LockupObservation,
|
||||
func Run(obsvC chan *gossipv1.SignedObservation,
|
||||
sendC chan []byte,
|
||||
priv crypto.PrivKey,
|
||||
port uint,
|
||||
|
@ -228,8 +228,8 @@ func Run(obsvC chan *gossipv1.LockupObservation,
|
|||
logger.Debug("heartbeat received",
|
||||
zap.Any("value", m.Heartbeat),
|
||||
zap.String("from", envelope.GetFrom().String()))
|
||||
case *gossipv1.GossipMessage_LockupObservation:
|
||||
obsvC <- m.LockupObservation
|
||||
case *gossipv1.GossipMessage_SignedObservation:
|
||||
obsvC <- m.SignedObservation
|
||||
default:
|
||||
logger.Warn("received unknown message type (running outdated software?)",
|
||||
zap.Any("payload", msg.Message),
|
||||
|
|
|
@ -18,13 +18,13 @@ func (p *Processor) broadcastSignature(v *vaa.VAA, signature []byte) {
|
|||
panic(err)
|
||||
}
|
||||
|
||||
obsv := gossipv1.LockupObservation{
|
||||
obsv := gossipv1.SignedObservation{
|
||||
Addr: crypto.PubkeyToAddress(p.gk.PublicKey).Bytes(),
|
||||
Hash: digest.Bytes(),
|
||||
Signature: signature,
|
||||
}
|
||||
|
||||
w := gossipv1.GossipMessage{Message: &gossipv1.GossipMessage_LockupObservation{LockupObservation: &obsv}}
|
||||
w := gossipv1.GossipMessage{Message: &gossipv1.GossipMessage_SignedObservation{SignedObservation: &obsv}}
|
||||
|
||||
msg, err := proto.Marshal(&w)
|
||||
if err != nil {
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
|
||||
// handleObservation processes a remote VAA observation, verifies it, checks whether the VAA has met quorum,
|
||||
// and assembles and submits a valid VAA if possible.
|
||||
func (p *Processor) handleObservation(ctx context.Context, m *gossipv1.LockupObservation) {
|
||||
func (p *Processor) handleObservation(ctx context.Context, m *gossipv1.SignedObservation) {
|
||||
// SECURITY: at this point, observations received from the p2p network are fully untrusted (all fields!)
|
||||
//
|
||||
// Note that observations are never tied to the (verified) p2p identity key - the p2p network
|
||||
|
@ -66,7 +66,7 @@ func (p *Processor) handleObservation(ctx context.Context, m *gossipv1.LockupObs
|
|||
return
|
||||
}
|
||||
|
||||
// Hooray! Now, we have verified all fields on LockupObservation and know that it includes
|
||||
// Hooray! Now, we have verified all fields on SignedObservation and know that it includes
|
||||
// a valid signature by an active guardian. We still don't fully trust them, as they may be
|
||||
// byzantine, but now we know who we're dealing with.
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ type Processor struct {
|
|||
// sendC is a channel of outbound messages to broadcast on p2p
|
||||
sendC chan []byte
|
||||
// obsvC is a channel of inbound decoded observations from p2p
|
||||
obsvC chan *gossipv1.LockupObservation
|
||||
obsvC chan *gossipv1.SignedObservation
|
||||
|
||||
// vaaC is a channel of VAAs to submit to store on Solana (either as target, or for data availability)
|
||||
vaaC chan *vaa.VAA
|
||||
|
@ -86,7 +86,7 @@ func NewProcessor(
|
|||
lockC chan *common.ChainLock,
|
||||
setC chan *common.GuardianSet,
|
||||
sendC chan []byte,
|
||||
obsvC chan *gossipv1.LockupObservation,
|
||||
obsvC chan *gossipv1.SignedObservation,
|
||||
vaaC chan *vaa.VAA,
|
||||
injectC chan *vaa.VAA,
|
||||
gk *ecdsa.PrivateKey,
|
||||
|
|
|
@ -7,7 +7,7 @@ option go_package = "proto/gossip/v1;gossipv1";
|
|||
message GossipMessage {
|
||||
oneof message {
|
||||
Heartbeat heartbeat = 1;
|
||||
LockupObservation lockup_observation = 2;
|
||||
SignedObservation signed_observation = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,18 +31,20 @@ message Heartbeat {
|
|||
// TODO: software version/release
|
||||
}
|
||||
|
||||
// A LockupObservation is a signed statement by a given guardian node
|
||||
// that they observed a finalized lockup on a chain.
|
||||
// A SignedObservation is a signed statement by a given guardian node
|
||||
// that they observed a given event.
|
||||
//
|
||||
// The lockup is uniquely identified by its hashed (tx_hash, nonce, values...) tuple.
|
||||
// Observations always result from an external, final event being observed.
|
||||
// Examples are lockups in finalized blocks on a block or guardian set changes
|
||||
// injected by node operators after reaching off-chain consensus.
|
||||
//
|
||||
// The event is uniquely identified by its hashed (tx_hash, nonce, values...) tuple.
|
||||
//
|
||||
// Other nodes will verify the signature. Once any node has observed a quorum of
|
||||
// guardians submitting valid signatures for a given hash, they can be assembled into a VAA.
|
||||
//
|
||||
// Messages without valid signature are dropped unceremoniously.
|
||||
//
|
||||
// TODO: rename? we also use it for governance VAAs
|
||||
message LockupObservation {
|
||||
message SignedObservation {
|
||||
// Guardian pubkey as truncated eth address.
|
||||
bytes addr = 1;
|
||||
// The lockup's deterministic, unique hash.
|
||||
|
|
Loading…
Reference in New Issue