Skip to content

Commit

Permalink
fix(e2e): relayer should use an archive node (#1615)
Browse files Browse the repository at this point in the history
The relayer has to use an archive node after #1612, else it might not be
able to fetch necessary attestations.

issue: none
  • Loading branch information
arajasek authored Jul 30, 2024
1 parent 1a1e406 commit 7976416
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
13 changes: 8 additions & 5 deletions e2e/app/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ func Setup(ctx context.Context, def Definition, depCfg DeployConfig) error {
}

logCfg := logConfig(def)
if def.Testnet.HasArchiveNode() {
if err := writeMonitorConfig(ctx, def, logCfg, valPrivKeys); err != nil {
return err
}
if err := writeMonitorConfig(ctx, def, logCfg, valPrivKeys); err != nil {
return err
}

if err := writeRelayerConfig(ctx, def, logCfg); err != nil {
Expand Down Expand Up @@ -489,10 +487,15 @@ func writeRelayerConfig(ctx context.Context, def Definition, logCfg log.Config)
return errors.Wrap(err, "write private key")
}

archiveNode, ok := def.Testnet.ArchiveNode()
if !ok {
return errors.New("archive node not found")
}

relayCfg := relayapp.DefaultConfig()
relayCfg.PrivateKey = privKeyFile
relayCfg.Network = def.Testnet.Network
relayCfg.HaloURL = def.Testnet.RandomHaloAddr()
relayCfg.HaloURL = archiveNode.AddressRPC()
relayCfg.RPCEndpoints = endpoints

if err := relayapp.WriteConfigTOML(relayCfg, logCfg, filepath.Join(confRoot, configFile)); err != nil {
Expand Down
5 changes: 1 addition & 4 deletions e2e/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,7 @@ func additionalServices(testnet types.Testnet) []string {
resp = append(resp, "prometheus")
}

// Monitor must connect to an archive node.
if testnet.HasArchiveNode() {
resp = append(resp, "monitor")
}
resp = append(resp, "monitor")

// In monitor only mode, we only start monitor and prometheus.
if testnet.OnlyMonitor {
Expand Down
5 changes: 4 additions & 1 deletion e2e/manifests/devnet0.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Devnet0 is a tiny devnet. Only a single validator and two anvils.
# Devnet0 is a tiny devnet. Only a single validator, an archive node (for the relayer), and two anvils.
# This is aimed at local dev environments.

network = "devnet"
anvil_chains = ["mock_op", "mock_arb"]

[node.validator01]

[node.fullnode01]
mode="archive"
11 changes: 0 additions & 11 deletions e2e/types/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,6 @@ func (t Testnet) BroadcastNode() *e2e.Node {
return t.Nodes[0]
}

// HasArchiveNode returns whether the Testnet has any nodes running in ModeArchive.
func (t Testnet) HasArchiveNode() bool {
for _, node := range t.Nodes {
if node.Mode == ModeArchive {
return true
}
}

return false
}

// ArchiveNode returns the first node running in ModeArchive.
// Note that this is different from the CometBFT Testnet.ArchiveNodes() method.
func (t Testnet) ArchiveNode() (*e2e.Node, bool) {
Expand Down

0 comments on commit 7976416

Please sign in to comment.