waku-org/go-waku

View on GitHub
waku/v2/protocol/rln/group_manager/dynamic/membership_fetcher.go

Summary

Maintainability
A
1 hr
Test Coverage
D
68%

Method MembershipFetcher.HandleGroupUpdates has 5 return statements (exceeds 4 allowed).
Open

func (mf *MembershipFetcher) HandleGroupUpdates(ctx context.Context, handler RegistrationEventHandler) error {
    fromBlock := mf.web3Config.RLNContract.DeployedBlockNumber
    metadata, err := mf.GetMetadata()
    if err != nil {
        mf.log.Warn("could not load last processed block from metadata. Starting onchain sync from deployment block", zap.Error(err), zap.Uint64("deploymentBlock", mf.web3Config.RLNContract.DeployedBlockNumber))
Severity: Major
Found in waku/v2/protocol/rln/group_manager/dynamic/membership_fetcher.go - About 35 mins to fix

    Method MembershipFetcher.loadOldEvents has 5 return statements (exceeds 4 allowed).
    Open

    func (mf *MembershipFetcher) loadOldEvents(ctx context.Context, fromBlock, toBlock uint64, handler RegistrationEventHandler) error {
        for ; fromBlock+maxBatchSize < toBlock; fromBlock += maxBatchSize + 1 { // check if the end of the batch is within the toBlock range
            t1 := time.Now()
            events, err := mf.getEvents(ctx, fromBlock, fromBlock+maxBatchSize)
            if err != nil {
    Severity: Major
    Found in waku/v2/protocol/rln/group_manager/dynamic/membership_fetcher.go - About 35 mins to fix

      Method MembershipFetcher.getEvents has 5 return statements (exceeds 4 allowed).
      Open

      func (mf *MembershipFetcher) getEvents(ctx context.Context, fromBlock uint64, toBlock uint64) ([]*contracts.RLNMemberRegistered, error) {
          evts, err := mf.fetchEvents(ctx, fromBlock, toBlock)
          if err != nil {
              if tooMuchDataRequestedError(err) { // divide the range and try again
                  mid := (fromBlock + toBlock) / 2
      Severity: Major
      Found in waku/v2/protocol/rln/group_manager/dynamic/membership_fetcher.go - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status