Skip to content

Commit 538bcaf

Browse files
authored
chore(cli/lib): revert to await on chain function use (#994)
Deprecate `CheckOnChain` and use noop logger for CLI call task: none
1 parent e420db4 commit 538bcaf

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

cli/cmd/devnet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func loadDevnetNetwork(ctx context.Context) (netconf.Network, xchain.RPCEndpoint
215215
return netconf.Network{}, nil, errors.Wrap(err, "make portal registry")
216216
}
217217

218-
network, err := netconf.CheckOnChain(ctx, netID, portalReg, endpoints.Keys())
218+
network, err := netconf.AwaitOnChain(log.WithNoopLogger(ctx), netID, portalReg, endpoints.Keys())
219219
if err != nil {
220220
return netconf.Network{}, nil, &cliError{
221221
Msg: "failed to check on-chain registry",

lib/netconf/provider.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,6 @@ func AwaitOnChain(ctx context.Context, netID ID, portalRegistry *bindings.Portal
8181
}
8282
}
8383

84-
// CheckOnChain returns the network configuration if all expected chains are registered in the on-chain registry.
85-
// It returns an error if the context is canceled or if any of the expected chains are missing.
86-
func CheckOnChain(ctx context.Context, netID ID, portalRegistry *bindings.PortalRegistry, expected []string) (Network, error) {
87-
portals, err := portalRegistry.List(&bind.CallOpts{Context: ctx})
88-
if err != nil {
89-
return Network{}, errors.Wrap(err, "failed fetching xchain registry from omni_evm")
90-
}
91-
92-
network := networkFromPortals(netID, portals)
93-
if !containsAll(network, expected) {
94-
return Network{}, errors.New("xchain registry doesn't contain all expected chains")
95-
}
96-
97-
log.Info(ctx, "XChain network configuration initialized from on-chain registry", "chains", network.ChainNamesByIDs())
98-
99-
return network, nil
100-
}
101-
10284
// containsAll returns true if the network contains the all expected chains (by name or ID).
10385
func containsAll(network Network, expected []string) bool {
10486
want := make(map[string]struct{}, len(expected))

0 commit comments

Comments
 (0)