mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 13:55:17 +00:00
evidence: improve amnesia evidence handling (#5003)
fix bug so that PotentialAmnesiaEvidence is being gossiped handle inbound amnesia evidence correctly add method to check if potential amnesia evidence is on trial fix a bug with the height when we upgrade to amnesia evidence change evidence to using just pointers. More logging in the evidence module Co-authored-by: Marko <marbar3778@yahoo.com>
This commit is contained in:
@@ -234,8 +234,8 @@ func (m *mockEvidencePool) IsPending(evidence types.Evidence) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
func (m *mockEvidencePool) AddPOLC(types.ProofOfLockChange) error { return nil }
|
||||
func (m *mockEvidencePool) Header(int64) *types.Header { return nil }
|
||||
func (m *mockEvidencePool) AddPOLC(*types.ProofOfLockChange) error { return nil }
|
||||
func (m *mockEvidencePool) Header(int64) *types.Header { return nil }
|
||||
|
||||
//------------------------------------
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ func (emptyEvidencePool) AddEvidence(types.Evidence) error { return nil }
|
||||
func (emptyEvidencePool) Update(*types.Block, sm.State) {}
|
||||
func (emptyEvidencePool) IsCommitted(types.Evidence) bool { return false }
|
||||
func (emptyEvidencePool) IsPending(types.Evidence) bool { return false }
|
||||
func (emptyEvidencePool) AddPOLC(types.ProofOfLockChange) error { return nil }
|
||||
func (emptyEvidencePool) AddPOLC(*types.ProofOfLockChange) error { return nil }
|
||||
func (emptyEvidencePool) Header(int64) *types.Header { return nil }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -70,7 +70,7 @@ type txNotifier interface {
|
||||
// interface to the evidence pool
|
||||
type evidencePool interface {
|
||||
AddEvidence(types.Evidence) error
|
||||
AddPOLC(types.ProofOfLockChange) error
|
||||
AddPOLC(*types.ProofOfLockChange) error
|
||||
}
|
||||
|
||||
// State handles execution of the consensus algorithm.
|
||||
@@ -1312,7 +1312,7 @@ func (cs *State) savePOLC(round int32, blockID types.BlockID) {
|
||||
cs.Logger.Error("Error on retrieval of pubkey", "err", err)
|
||||
return
|
||||
}
|
||||
polc, err := types.MakePOLCFromVoteSet(cs.Votes.Prevotes(round), pubKey, blockID)
|
||||
polc, err := types.NewPOLCFromVoteSet(cs.Votes.Prevotes(round), pubKey, blockID)
|
||||
if err != nil {
|
||||
cs.Logger.Error("Error on forming POLC", "err", err)
|
||||
return
|
||||
|
||||
@@ -710,13 +710,12 @@ func TestStateLockPOLUnlock(t *testing.T) {
|
||||
// polc should be in the evpool for round 1
|
||||
polc, err := evpool.RetrievePOLC(height, round)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, polc)
|
||||
assert.False(t, polc.IsAbsent())
|
||||
t.Log(polc.Address())
|
||||
// but not for round 0
|
||||
polc, err = evpool.RetrievePOLC(height, round-1)
|
||||
assert.Error(t, err)
|
||||
assert.True(t, polc.IsAbsent())
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Nil(t, polc)
|
||||
}
|
||||
|
||||
// 4 vals, v1 locks on proposed block in the first round but the other validators only prevote
|
||||
@@ -820,6 +819,7 @@ func TestStateLockPOLUnlockOnUnknownBlock(t *testing.T) {
|
||||
// polc should be in the evpool for round 1
|
||||
polc, err := evpool.RetrievePOLC(height, round)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, polc)
|
||||
assert.False(t, polc.IsAbsent())
|
||||
|
||||
incrementRound(vs2, vs3, vs4)
|
||||
|
||||
Reference in New Issue
Block a user