diff --git a/relayer/relays/beefy/ethereum-writer.go b/relayer/relays/beefy/ethereum-writer.go index f9d88c3572..4d953271bd 100644 --- a/relayer/relays/beefy/ethereum-writer.go +++ b/relayer/relays/beefy/ethereum-writer.go @@ -89,9 +89,13 @@ func (wr *EthereumWriter) submit(ctx context.Context, task Request) error { return err } if uint32(latestBeefyBlock) >= task.SignedCommitment.Commitment.BlockNumber { + log.WithFields(logrus.Fields{ + "blockNumber": task.SignedCommitment.Commitment.BlockNumber, + "IsHandover": task.IsHandover, + "ValidatorSetID": task.SignedCommitment.Commitment.ValidatorSetID, + }).Warn("Ignore outdated commitment") return nil } - currentValidatorSet, err := wr.contract.CurrentValidatorSet(&callOpts) if err != nil { return err @@ -103,6 +107,13 @@ func (wr *EthereumWriter) submit(ctx context.Context, task Request) error { task.ValidatorsRoot = currentValidatorSet.Root if task.IsHandover { task.ValidatorsRoot = nextValidatorSet.Root + if task.nextAuthoritiesRoot == task.ValidatorsRoot { + log.WithFields(logrus.Fields{ + "blockNumber": task.SignedCommitment.Commitment.BlockNumber, + "ValidatorSetID": task.SignedCommitment.Commitment.ValidatorSetID, + }).Warn("Ignore mandatory commitment authorities not change") + return nil + } } // Initial submission diff --git a/relayer/relays/beefy/polkadot-listener.go b/relayer/relays/beefy/polkadot-listener.go index da2c491e28..c49aaefebf 100644 --- a/relayer/relays/beefy/polkadot-listener.go +++ b/relayer/relays/beefy/polkadot-listener.go @@ -118,6 +118,7 @@ func (li *PolkadotListener) scanCommitments( continue } task.IsHandover = true + task.nextAuthoritiesRoot = nextAuthoritySet.Root select { case <-ctx.Done(): return ctx.Err() diff --git a/relayer/relays/beefy/task.go b/relayer/relays/beefy/task.go index 7bd8733c55..7fdbff2e4f 100644 --- a/relayer/relays/beefy/task.go +++ b/relayer/relays/beefy/task.go @@ -7,9 +7,10 @@ import ( ) type Request struct { - Validators []substrate.Authority - ValidatorsRoot [32]byte - SignedCommitment types.SignedCommitment - Proof merkle.SimplifiedMMRProof - IsHandover bool + Validators []substrate.Authority + ValidatorsRoot [32]byte + nextAuthoritiesRoot [32]byte + SignedCommitment types.SignedCommitment + Proof merkle.SimplifiedMMRProof + IsHandover bool }