node: remove VAA submission and channel
Change-Id: Iae82b6353852dc052a7e220f483e5557a0f157c4
This commit is contained in:
parent
584bfcba2d
commit
af31436915
|
@ -332,9 +332,6 @@ func runBridge(cmd *cobra.Command, args []string) {
|
||||||
// Inbound observations
|
// Inbound observations
|
||||||
obsvC := make(chan *gossipv1.SignedObservation, 50)
|
obsvC := make(chan *gossipv1.SignedObservation, 50)
|
||||||
|
|
||||||
// VAAs to submit to Solana
|
|
||||||
solanaVaaC := make(chan *vaa.VAA)
|
|
||||||
|
|
||||||
// Injected VAAs (manually generated rather than created via observation)
|
// Injected VAAs (manually generated rather than created via observation)
|
||||||
injectC := make(chan *vaa.VAA)
|
injectC := make(chan *vaa.VAA)
|
||||||
|
|
||||||
|
@ -391,7 +388,6 @@ func runBridge(cmd *cobra.Command, args []string) {
|
||||||
setC,
|
setC,
|
||||||
sendC,
|
sendC,
|
||||||
obsvC,
|
obsvC,
|
||||||
solanaVaaC,
|
|
||||||
injectC,
|
injectC,
|
||||||
gk,
|
gk,
|
||||||
*unsafeDevMode,
|
*unsafeDevMode,
|
||||||
|
|
|
@ -235,12 +235,12 @@ func (p *Processor) handleObservation(ctx context.Context, m *gossipv1.SignedObs
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit every VAA to Solana for data availability.
|
// Submit every VAA to Solana for data availability.
|
||||||
p.logger.Info("submitting signed VAA to Solana",
|
p.logger.Info("signed VAA with quorum",
|
||||||
zap.String("digest", hash),
|
zap.String("digest", hash),
|
||||||
zap.Any("vaa", signed),
|
zap.Any("vaa", signed),
|
||||||
zap.String("bytes", hex.EncodeToString(vaaBytes)))
|
zap.String("bytes", hex.EncodeToString(vaaBytes)))
|
||||||
p.vaaC <- signed
|
|
||||||
|
|
||||||
|
// TODO: broadcast on p2p and persist
|
||||||
p.state.vaaSignatures[hash].submitted = true
|
p.state.vaaSignatures[hash].submitted = true
|
||||||
} else {
|
} else {
|
||||||
p.logger.Info("quorum not met or already submitted, doing nothing",
|
p.logger.Info("quorum not met or already submitted, doing nothing",
|
||||||
|
|
|
@ -3,7 +3,6 @@ package processor
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"fmt"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
ethcommon "github.com/ethereum/go-ethereum/common"
|
ethcommon "github.com/ethereum/go-ethereum/common"
|
||||||
|
@ -11,7 +10,6 @@ import (
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"github.com/certusone/wormhole/bridge/pkg/common"
|
"github.com/certusone/wormhole/bridge/pkg/common"
|
||||||
"github.com/certusone/wormhole/bridge/pkg/devnet"
|
|
||||||
gossipv1 "github.com/certusone/wormhole/bridge/pkg/proto/gossip/v1"
|
gossipv1 "github.com/certusone/wormhole/bridge/pkg/proto/gossip/v1"
|
||||||
"github.com/certusone/wormhole/bridge/pkg/supervisor"
|
"github.com/certusone/wormhole/bridge/pkg/supervisor"
|
||||||
"github.com/certusone/wormhole/bridge/pkg/vaa"
|
"github.com/certusone/wormhole/bridge/pkg/vaa"
|
||||||
|
@ -60,9 +58,6 @@ type Processor struct {
|
||||||
// obsvC is a channel of inbound decoded observations from p2p
|
// obsvC is a channel of inbound decoded observations from p2p
|
||||||
obsvC chan *gossipv1.SignedObservation
|
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
|
|
||||||
|
|
||||||
// injectC is a channel of VAAs injected locally.
|
// injectC is a channel of VAAs injected locally.
|
||||||
injectC chan *vaa.VAA
|
injectC chan *vaa.VAA
|
||||||
|
|
||||||
|
@ -99,7 +94,6 @@ func NewProcessor(
|
||||||
setC chan *common.GuardianSet,
|
setC chan *common.GuardianSet,
|
||||||
sendC chan []byte,
|
sendC chan []byte,
|
||||||
obsvC chan *gossipv1.SignedObservation,
|
obsvC chan *gossipv1.SignedObservation,
|
||||||
vaaC chan *vaa.VAA,
|
|
||||||
injectC chan *vaa.VAA,
|
injectC chan *vaa.VAA,
|
||||||
gk *ecdsa.PrivateKey,
|
gk *ecdsa.PrivateKey,
|
||||||
devnetMode bool,
|
devnetMode bool,
|
||||||
|
@ -114,7 +108,6 @@ func NewProcessor(
|
||||||
setC: setC,
|
setC: setC,
|
||||||
sendC: sendC,
|
sendC: sendC,
|
||||||
obsvC: obsvC,
|
obsvC: obsvC,
|
||||||
vaaC: vaaC,
|
|
||||||
injectC: injectC,
|
injectC: injectC,
|
||||||
gk: gk,
|
gk: gk,
|
||||||
devnetMode: devnetMode,
|
devnetMode: devnetMode,
|
||||||
|
@ -142,12 +135,6 @@ func (p *Processor) Run(ctx context.Context) error {
|
||||||
p.logger.Info("guardian set updated",
|
p.logger.Info("guardian set updated",
|
||||||
zap.Strings("set", p.gs.KeysAsHexStrings()),
|
zap.Strings("set", p.gs.KeysAsHexStrings()),
|
||||||
zap.Uint32("index", p.gs.Index))
|
zap.Uint32("index", p.gs.Index))
|
||||||
|
|
||||||
// Dev mode guardian set update check (no-op in production)
|
|
||||||
err := p.checkDevModeGuardianSetUpdate(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
case k := <-p.lockC:
|
case k := <-p.lockC:
|
||||||
p.handleLockup(ctx, k)
|
p.handleLockup(ctx, k)
|
||||||
case v := <-p.injectC:
|
case v := <-p.injectC:
|
||||||
|
@ -159,32 +146,3 @@ func (p *Processor) Run(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Processor) checkDevModeGuardianSetUpdate(ctx context.Context) error {
|
|
||||||
if p.devnetMode {
|
|
||||||
if uint(len(p.gs.Keys)) != p.devnetNumGuardians {
|
|
||||||
v := devnet.DevnetGuardianSetVSS(p.devnetNumGuardians)
|
|
||||||
|
|
||||||
p.logger.Info(fmt.Sprintf("guardian set has %d members, expecting %d - submitting VAA",
|
|
||||||
len(p.gs.Keys), p.devnetNumGuardians),
|
|
||||||
zap.Any("v", v))
|
|
||||||
|
|
||||||
timeout, cancel := context.WithTimeout(ctx, 15*time.Second)
|
|
||||||
defer cancel()
|
|
||||||
trx, err := devnet.SubmitVAA(timeout, p.devnetEthRPC, v)
|
|
||||||
if err != nil {
|
|
||||||
// Either Ethereum is not yet up, or another node has already submitted - bail
|
|
||||||
// and let another node handle it. We only check the guardian set on Ethereum,
|
|
||||||
// so we use that to sequence devnet creation for Terra and Solana as well.
|
|
||||||
return fmt.Errorf("failed to submit Eth devnet guardian set change: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
p.logger.Info("devnet guardian set change submitted to Ethereum", zap.Any("trx", trx), zap.Any("vaa", v))
|
|
||||||
|
|
||||||
// Submit VAA to Solana as well. This is asynchronous and can fail, leading to inconsistent devnet state.
|
|
||||||
p.vaaC <- v
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue