Skip to content

Commit

Permalink
fix: use consumerID for consumer chains if available
Browse files Browse the repository at this point in the history
  • Loading branch information
fastfadingviolets committed Sep 4, 2024
1 parent c9e34af commit b66a4c0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion chain/cosmos/ics.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,16 @@ func (c *CosmosChain) StartConsumer(testName string, ctx context.Context, additi
return err
}

consumerID := c.cfg.ChainID
consumerChains, _, err := c.Provider.GetNode().ExecQuery(ctx, "provider", "list-consumer-chains")
if err != nil {
return err
}
consumerChain := gjson.GetBytes(consumerChains, fmt.Sprintf("chains.#(chain_id=%q)", c.cfg.ChainID))
if consumerChain.Get("consumer_id").Exists() {
consumerID = consumerChain.Get("consumer_id").String()
}

// Copy provider priv val keys to these nodes
for i, val := range c.Provider.Validators {
i := i
Expand All @@ -265,7 +275,7 @@ func (c *CosmosChain) StartConsumer(testName string, ctx context.Context, additi
return fmt.Errorf("failed to get consumer validator pubkey: %w", err)
}
keyStr := strings.TrimSpace(string(key))
_, err = c.Provider.Validators[i].ExecTx(ctx, valKey, "provider", "assign-consensus-key", c.cfg.ChainID, keyStr)
_, err = c.Provider.Validators[i].ExecTx(ctx, valKey, "provider", "assign-consensus-key", consumerID, keyStr)
if err != nil {
return fmt.Errorf("failed to assign consumer validator pubkey: %w", err)
}
Expand Down

0 comments on commit b66a4c0

Please sign in to comment.