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)
|
sendC := make(chan []byte)
|
||||||
|
|
||||||
// Inbound observations
|
// Inbound observations
|
||||||
obsvC := make(chan *gossipv1.LockupObservation, 50)
|
obsvC := make(chan *gossipv1.SignedObservation, 50)
|
||||||
|
|
||||||
// VAAs to submit to Solana
|
// VAAs to submit to Solana
|
||||||
solanaVaaC := make(chan *vaa.VAA)
|
solanaVaaC := make(chan *vaa.VAA)
|
||||||
|
|
|
@ -26,7 +26,7 @@ import (
|
||||||
"github.com/certusone/wormhole/bridge/pkg/supervisor"
|
"github.com/certusone/wormhole/bridge/pkg/supervisor"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Run(obsvC chan *gossipv1.LockupObservation,
|
func Run(obsvC chan *gossipv1.SignedObservation,
|
||||||
sendC chan []byte,
|
sendC chan []byte,
|
||||||
priv crypto.PrivKey,
|
priv crypto.PrivKey,
|
||||||
port uint,
|
port uint,
|
||||||
|
@ -228,8 +228,8 @@ func Run(obsvC chan *gossipv1.LockupObservation,
|
||||||
logger.Debug("heartbeat received",
|
logger.Debug("heartbeat received",
|
||||||
zap.Any("value", m.Heartbeat),
|
zap.Any("value", m.Heartbeat),
|
||||||
zap.String("from", envelope.GetFrom().String()))
|
zap.String("from", envelope.GetFrom().String()))
|
||||||
case *gossipv1.GossipMessage_LockupObservation:
|
case *gossipv1.GossipMessage_SignedObservation:
|
||||||
obsvC <- m.LockupObservation
|
obsvC <- m.SignedObservation
|
||||||
default:
|
default:
|
||||||
logger.Warn("received unknown message type (running outdated software?)",
|
logger.Warn("received unknown message type (running outdated software?)",
|
||||||
zap.Any("payload", msg.Message),
|
zap.Any("payload", msg.Message),
|
||||||
|
|
|
@ -18,13 +18,13 @@ func (p *Processor) broadcastSignature(v *vaa.VAA, signature []byte) {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
obsv := gossipv1.LockupObservation{
|
obsv := gossipv1.SignedObservation{
|
||||||
Addr: crypto.PubkeyToAddress(p.gk.PublicKey).Bytes(),
|
Addr: crypto.PubkeyToAddress(p.gk.PublicKey).Bytes(),
|
||||||
Hash: digest.Bytes(),
|
Hash: digest.Bytes(),
|
||||||
Signature: signature,
|
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)
|
msg, err := proto.Marshal(&w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
|
|
||||||
// handleObservation processes a remote VAA observation, verifies it, checks whether the VAA has met quorum,
|
// handleObservation processes a remote VAA observation, verifies it, checks whether the VAA has met quorum,
|
||||||
// and assembles and submits a valid VAA if possible.
|
// 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!)
|
// 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
|
// 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
|
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
|
// 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.
|
// 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 is a channel of outbound messages to broadcast on p2p
|
||||||
sendC chan []byte
|
sendC chan []byte
|
||||||
// obsvC is a channel of inbound decoded observations from p2p
|
// 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 is a channel of VAAs to submit to store on Solana (either as target, or for data availability)
|
||||||
vaaC chan *vaa.VAA
|
vaaC chan *vaa.VAA
|
||||||
|
@ -86,7 +86,7 @@ func NewProcessor(
|
||||||
lockC chan *common.ChainLock,
|
lockC chan *common.ChainLock,
|
||||||
setC chan *common.GuardianSet,
|
setC chan *common.GuardianSet,
|
||||||
sendC chan []byte,
|
sendC chan []byte,
|
||||||
obsvC chan *gossipv1.LockupObservation,
|
obsvC chan *gossipv1.SignedObservation,
|
||||||
vaaC chan *vaa.VAA,
|
vaaC chan *vaa.VAA,
|
||||||
injectC chan *vaa.VAA,
|
injectC chan *vaa.VAA,
|
||||||
gk *ecdsa.PrivateKey,
|
gk *ecdsa.PrivateKey,
|
||||||
|
|
|
@ -7,7 +7,7 @@ option go_package = "proto/gossip/v1;gossipv1";
|
||||||
message GossipMessage {
|
message GossipMessage {
|
||||||
oneof message {
|
oneof message {
|
||||||
Heartbeat heartbeat = 1;
|
Heartbeat heartbeat = 1;
|
||||||
LockupObservation lockup_observation = 2;
|
SignedObservation signed_observation = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,18 +31,20 @@ message Heartbeat {
|
||||||
// TODO: software version/release
|
// TODO: software version/release
|
||||||
}
|
}
|
||||||
|
|
||||||
// A LockupObservation is a signed statement by a given guardian node
|
// A SignedObservation is a signed statement by a given guardian node
|
||||||
// that they observed a finalized lockup on a chain.
|
// 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
|
// 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.
|
// guardians submitting valid signatures for a given hash, they can be assembled into a VAA.
|
||||||
//
|
//
|
||||||
// Messages without valid signature are dropped unceremoniously.
|
// Messages without valid signature are dropped unceremoniously.
|
||||||
//
|
message SignedObservation {
|
||||||
// TODO: rename? we also use it for governance VAAs
|
|
||||||
message LockupObservation {
|
|
||||||
// Guardian pubkey as truncated eth address.
|
// Guardian pubkey as truncated eth address.
|
||||||
bytes addr = 1;
|
bytes addr = 1;
|
||||||
// The lockup's deterministic, unique hash.
|
// The lockup's deterministic, unique hash.
|
||||||
|
|
Loading…
Reference in New Issue