Skip to content

Commit 64f7a76

Browse files
committed
test: fix test cases
1 parent 80dc14a commit 64f7a76

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

eth/protocols/dbft/handler_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ func (t *testBC) BlockNumber() hexutil.Uint64 {
2424
return t.height
2525
}
2626

27+
func (t *testBC) IsAddressAllowed(addr common.Address) error {
28+
return nil
29+
}
30+
2731
func TestHandling(t *testing.T) {
2832
var (
2933
key, _ = crypto.GenerateKey()
3034
addr = crypto.PubkeyToAddress(key.PublicKey)
3135
bc = &testBC{height: 10}
32-
s1 = New(bc, nil, func(u uint64, address common.Address) error { return nil })
33-
s2 = New(bc, nil, func(u uint64, address common.Address) error { return nil })
34-
s3 = New(bc, nil, func(u uint64, address common.Address) error { return nil })
36+
s1 = New(bc, nil)
37+
s2 = New(bc, nil)
38+
s3 = New(bc, nil)
3539
p1 = p2p.NewPeer(enode.ID{1}, "peer1", nil)
3640
p2 = p2p.NewPeer(enode.ID{2}, "peer2", nil)
3741
p3 = p2p.NewPeer(enode.ID{3}, "peer3", nil)

eth/protocols/dbft/pool_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"testing"
1010

1111
"github.com/ethereum/go-ethereum/common"
12+
"github.com/ethereum/go-ethereum/common/hexutil"
1213
"github.com/ethereum/go-ethereum/crypto"
1314
"github.com/stretchr/testify/require"
1415
)
@@ -140,6 +141,8 @@ func (c *testChain) IsAddressAllowed(u common.Address) error {
140141
}
141142
func (c *testChain) BlockHeight() uint64 { return c.height }
142143

144+
func (c *testChain) BlockNumber() hexutil.Uint64 { return hexutil.Uint64(c.height) }
145+
143146
func (c *testChain) goodMessage(t *testing.T, height uint64) *Message {
144147
return someMessage(t, height, c.goodAddrs[0], c.goodKey)
145148
}

internal/ethapi/api_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,18 @@ func (b testBackend) BloomStatus() (uint64, uint64) { panic("implement me") }
631631
func (b testBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) {
632632
panic("implement me")
633633
}
634+
func (b testBackend) IsExtensibleAllowed(blockNum uint64, addr common.Address) error {
635+
return nil
636+
}
637+
func (b testBackend) GetValidatorsSortedByBlockNumber(blockNum uint64) ([]common.Address, error) {
638+
return nil, nil
639+
}
640+
func (b testBackend) GetValidatorsSortedByState(state *state.StateDB, header *types.Header) ([]common.Address, error) {
641+
return nil, nil
642+
}
643+
func (b testBackend) GetDKGIndex(blockNum uint64, validatorIndex int) (int, error) {
644+
return 0, nil
645+
}
634646

635647
func TestEstimateGas(t *testing.T) {
636648
t.Parallel()

internal/ethapi/transaction_args_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,3 +413,15 @@ func (b *backendMock) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent)
413413
}
414414

415415
func (b *backendMock) Engine() consensus.Engine { return nil }
416+
func (b *backendMock) IsExtensibleAllowed(blockNum uint64, addr common.Address) error {
417+
return nil
418+
}
419+
func (b *backendMock) GetValidatorsSortedByBlockNumber(blockNum uint64) ([]common.Address, error) {
420+
return nil, nil
421+
}
422+
func (b *backendMock) GetValidatorsSortedByState(state *state.StateDB, header *types.Header) ([]common.Address, error) {
423+
return nil, nil
424+
}
425+
func (b *backendMock) GetDKGIndex(blockNum uint64, validatorIndex int) (int, error) {
426+
return 0, nil
427+
}

0 commit comments

Comments
 (0)