Skip to content

Commit

Permalink
Merge branch 'main' into CNS-1008-score-store-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
oren-lava authored Dec 5, 2024
2 parents a0080ba + 34d7c4e commit ac2bccf
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions protocol/statetracker/state_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ type SpecUpdaterInf interface {
}

// Either register for spec updates or set spec for offline spec, used in both consumer and provider process
func RegisterForSpecUpdatesOrSetStaticSpec(ctx context.Context, chainParser chainlib.ChainParser, specPath string, rpcEndpoint lavasession.RPCEndpoint, specUpdaterInf SpecUpdaterInf) (err error) {
if specPath != "" {
// offline spec mode.
parsedOfflineSpec, loadError := specutils.GetSpecsFromPath(specPath, rpcEndpoint.ChainID, nil, nil)
if loadError != nil {
err = utils.LavaFormatError("failed loading offline spec", err, utils.LogAttr("spec_path", specPath), utils.LogAttr("spec_id", rpcEndpoint.ChainID))
}
utils.LavaFormatInfo("Loaded offline spec successfully", utils.LogAttr("spec_path", specPath), utils.LogAttr("chain_id", parsedOfflineSpec.Index))
chainParser.SetSpec(parsedOfflineSpec)
} else {
// register for spec updates
err = specUpdaterInf.RegisterForSpecUpdates(ctx, chainParser, rpcEndpoint)
func RegisterForSpecUpdatesOrSetStaticSpec(ctx context.Context, chainParser chainlib.ChainParser, specPath string, rpcEndpoint lavasession.RPCEndpoint, specUpdaterInf SpecUpdaterInf) error {
if specPath == "" {
return specUpdaterInf.RegisterForSpecUpdates(ctx, chainParser, rpcEndpoint)
}
return

// offline spec mode.
parsedOfflineSpec, err := specutils.GetSpecsFromPath(specPath, rpcEndpoint.ChainID, nil, nil)
if err != nil {
return utils.LavaFormatError("failed loading offline spec", err, utils.LogAttr("spec_path", specPath), utils.LogAttr("spec_id", rpcEndpoint.ChainID))
}
utils.LavaFormatInfo("Loaded offline spec successfully", utils.LogAttr("spec_path", specPath), utils.LogAttr("chain_id", parsedOfflineSpec.Index))
chainParser.SetSpec(parsedOfflineSpec)

return nil
}

func GetLavaSpecWithRetry(ctx context.Context, specQueryClient spectypes.QueryClient) (*spectypes.QueryGetSpecResponse, error) {
Expand Down

0 comments on commit ac2bccf

Please sign in to comment.