Skip to content

Commit

Permalink
remove skip check
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair-singh committed Jan 31, 2024
1 parent c22d4e0 commit 1e0c7e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
5 changes: 0 additions & 5 deletions relayer/relays/beefy/polkadot-listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ func (li *PolkadotListener) scanCommitments(
Proof: result.MMRProof,
}

if !result.MandatoryCommitment {
logEntry.Info("Skipped due to not mandatory commitment.")
continue
}

if validatorSetID == currentValidatorSet+1 && validatorSetID == nextValidatorSetID-1 {
task.IsHandover = true
select {
Expand Down
20 changes: 10 additions & 10 deletions relayer/relays/beefy/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ func scanBlocks(ctx context.Context, api *gsrpc.SubstrateAPI, startBlock uint64,
}

type ScanCommitmentsResult struct {
SignedCommitment types.SignedCommitment
BlockNumber uint64
BlockHash types.Hash
Depth uint64
MandatoryCommitment bool
Error error
SignedCommitment types.SignedCommitment
BlockNumber uint64
BlockHash types.Hash
Depth uint64
IsMandatory bool
Error error
}

func ScanCommitments(ctx context.Context, api *gsrpc.SubstrateAPI, startBlock uint64) (<-chan ScanCommitmentsResult, error) {
Expand Down Expand Up @@ -131,7 +131,7 @@ func scanCommitments(ctx context.Context, api *gsrpc.SubstrateAPI, startBlock ui
return
}

mandatoryCommitment := false
isMandatory := false
for _, digest := range block.Block.Header.Digest {
if !digest.IsConsensus {
continue
Expand All @@ -141,7 +141,7 @@ func scanCommitments(ctx context.Context, api *gsrpc.SubstrateAPI, startBlock ui
// which signifies the the change of session authorities.
// https://github.com/paritytech/polkadot-sdk/blob/6a168ad57ad13ea0896f7684120f4fa15bfef474/substrate/primitives/consensus/beefy/src/lib.rs#L254C2-L254C19
if decodeEngineId(uint32(consensus.ConsensusEngineID)) == "BEEF" && consensus.Bytes[0] == 0x01 {
mandatoryCommitment = true
isMandatory = true
break
}
}
Expand Down Expand Up @@ -173,7 +173,7 @@ func scanCommitments(ctx context.Context, api *gsrpc.SubstrateAPI, startBlock ui
select {
case <-ctx.Done():
return
case out <- ScanCommitmentsResult{BlockNumber: result.BlockNumber, BlockHash: result.BlockHash, SignedCommitment: *commitment, Depth: result.Depth, MandatoryCommitment: mandatoryCommitment}:
case out <- ScanCommitmentsResult{BlockNumber: result.BlockNumber, BlockHash: result.BlockHash, SignedCommitment: *commitment, Depth: result.Depth, IsMandatory: isMandatory}:
}
}
}
Expand Down Expand Up @@ -249,7 +249,7 @@ func scanSafeCommitments(ctx context.Context, meta *types.Metadata, api *gsrpc.S
select {
case <-ctx.Done():
return
case out <- ScanSafeCommitmentsResult{result.SignedCommitment, proof, blockHash, result.Depth, result.MandatoryCommitment, nil}:
case out <- ScanSafeCommitmentsResult{result.SignedCommitment, proof, blockHash, result.Depth, result.IsMandatory, nil}:
}

}
Expand Down

0 comments on commit 1e0c7e7

Please sign in to comment.