Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add logging for signer & validator set #1723

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions consensus/istanbul/ibft/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ibftengine

import (
"bytes"
"fmt"
"math/big"
"time"

Expand All @@ -14,6 +15,7 @@ import (
"github.com/ethereum/go-ethereum/consensus/istanbul/validator"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
Expand Down Expand Up @@ -330,6 +332,8 @@ func (e *Engine) Seal(chain consensus.ChainHeaderReader, block *types.Block, val
number := header.Number.Uint64()

if _, v := validators.GetByAddress(e.signer); v == nil {
log.Debug("Engine signer (sealing) is not part of validator set", "signer", e.signer, "validators", fmt.Sprintf("%v", validators.List()))

return block, istanbulcommon.ErrUnauthorized
}

Expand Down
5 changes: 5 additions & 0 deletions consensus/istanbul/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package istanbul

import (
"fmt"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
Expand Down Expand Up @@ -65,5 +67,8 @@ func CheckValidatorSignature(valSet ValidatorSet, data []byte, sig []byte) (comm
return val.Address(), nil
}

// 3. Log signer that is missing in validator set
log.Debug("Signer is missing from validator set", "signer", signer, "valSet", fmt.Sprintf("%v", valSet.List()))

return common.Address{}, ErrUnauthorizedAddress
}