sharding: use small interfaces to fix nil pointer errors in tests

Former-commit-id: 61f93b839d44d63506441ebdd747c141efd6e472 [formerly 74e21cf43fa0ce38d410ca483274c4903562b49a]
Former-commit-id: eec8ee4e9a5a2b3d1c8f6d534ac716ecceab3b85
This commit is contained in:
Raul Jordan
2018-06-24 16:16:54 -05:00
committed by GitHub
parent f009381a83
commit 263cd71104
8 changed files with 67 additions and 259 deletions

View File

@@ -96,6 +96,14 @@ func (m *MockClient) FastForward(p int) {
}
}
func (m *MockClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) {
return nil, nil
}
func (m *MockClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) {
return types.NewBlockWithHeader(&types.Header{Number: big.NewInt(m.BlockNumber)}), nil
}
func TransactOpts() *bind.TransactOpts {
return bind.NewKeyedTransactor(key)
}

View File

@@ -263,7 +263,7 @@ func (s *ShardEthereum) registerSimulatorService(config *params.Config, shardID
ctx.RetrieveService(&p2p)
var smcClient *mainchain.SMCClient
ctx.RetrieveService(&smcClient)
return simulator.NewSimulator(config, smcClient, p2p, shardID, 15) // 15 second delay between simulator requests.
return simulator.NewSimulator(config, smcClient.ChainReader(), smcClient.SMCCaller(), p2p, shardID, 15) // 15 second delay between simulator requests.
})
}

View File

@@ -4,144 +4,25 @@ import (
"context"
"math/big"
"testing"
"time"
ethereum "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/sharding"
"github.com/ethereum/go-ethereum/sharding/contracts"
"github.com/ethereum/go-ethereum/sharding/internal"
shardparams "github.com/ethereum/go-ethereum/sharding/params"
)
var (
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
addr = crypto.PubkeyToAddress(key.PublicKey)
accountBalance1001Eth, _ = new(big.Int).SetString("1001000000000000000000", 10)
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
addr = crypto.PubkeyToAddress(key.PublicKey)
)
// Verifies that Notary implements the Actor interface.
var _ = sharding.Actor(&Notary{})
// Mock client for testing notary. Should this go into sharding/client/testing?
type smcClient struct {
smc *contracts.SMC
depositFlag bool
t *testing.T
backend *backends.SimulatedBackend
blocknumber int64
}
func (s *smcClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) {
return nil, nil
}
func (s *smcClient) Account() *accounts.Account {
return &accounts.Account{Address: addr}
}
func (s *smcClient) SMCCaller() *contracts.SMCCaller {
return &s.smc.SMCCaller
}
func (s *smcClient) ChainReader() ethereum.ChainReader {
return nil
}
func (s *smcClient) SMCTransactor() *contracts.SMCTransactor {
return &s.smc.SMCTransactor
}
func (s *smcClient) SMCFilterer() *contracts.SMCFilterer {
return &s.smc.SMCFilterer
}
func (s *smcClient) WaitForTransaction(ctx context.Context, hash common.Hash, durationInSeconds time.Duration) error {
s.CommitWithBlock()
s.fastForward(1)
return nil
}
func (s *smcClient) TransactionReceipt(hash common.Hash) (*types.Receipt, error) {
return s.backend.TransactionReceipt(context.Background(), hash)
}
func (s *smcClient) CreateTXOpts(value *big.Int) (*bind.TransactOpts, error) {
txOpts := transactOpts()
txOpts.Value = value
return txOpts, nil
}
func (s *smcClient) DepositFlag() bool {
return s.depositFlag
}
func (s *smcClient) SetDepositFlag(deposit bool) {
s.depositFlag = deposit
}
func (s *smcClient) Sign(hash common.Hash) ([]byte, error) {
return nil, nil
}
// Unused mockClient methods.
func (s *smcClient) Start() error {
s.t.Fatal("Start called")
return nil
}
func (s *smcClient) Close() {
s.t.Fatal("Close called")
}
func (s *smcClient) DataDirPath() string {
return "/tmp/datadir"
}
func (s *smcClient) CommitWithBlock() {
s.backend.Commit()
s.blocknumber = s.blocknumber + 1
}
func (s *smcClient) GetShardCount() (int64, error) {
return 100, nil
}
func (s *smcClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) {
return types.NewBlockWithHeader(&types.Header{Number: big.NewInt(s.blocknumber)}), nil
}
// Helper/setup methods.
// TODO: consider moving these to common sharding testing package as the notary and smc tests
// use them.
func transactOpts() *bind.TransactOpts {
return bind.NewKeyedTransactor(key)
}
// fastForward is a helper function to skip through n period.
func (s *smcClient) fastForward(p int) {
for i := 0; i < p*int(shardparams.DefaultConfig.PeriodLength); i++ {
s.CommitWithBlock()
}
}
func setup() (*backends.SimulatedBackend, *contracts.SMC) {
backend := backends.NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: accountBalance1001Eth}})
_, _, smc, _ := contracts.DeploySMC(transactOpts(), backend)
backend.Commit()
return backend, smc
}
func TestHasAccountBeenDeregistered(t *testing.T) {
backend, smc := setup()
client := &smcClient{smc: smc, t: t, backend: backend, blocknumber: 1}
backend, smc := internal.SetupMockClient(t)
client := &internal.MockClient{SMC: smc, T: t, Backend: backend, BlockNumber: 1}
client.SetDepositFlag(true)
err := joinNotaryPool(client, client, nil)
@@ -164,12 +45,11 @@ func TestHasAccountBeenDeregistered(t *testing.T) {
if !dreg {
t.Error("account unable to be deregistered from notary pool")
}
}
func TestIsLockupOver(t *testing.T) {
backend, smc := setup()
client := &smcClient{smc: smc, t: t, backend: backend}
backend, smc := internal.SetupMockClient(t)
client := &internal.MockClient{SMC: smc, T: t, Backend: backend}
client.SetDepositFlag(true)
err := joinNotaryPool(client, client, shardparams.DefaultConfig)
@@ -183,7 +63,7 @@ func TestIsLockupOver(t *testing.T) {
t.Error(err)
}
client.fastForward(int(shardparams.DefaultConfig.NotaryLockupLength + 100))
client.FastForward(int(shardparams.DefaultConfig.NotaryLockupLength + 100))
err = releaseNotary(client, client, client)
if err != nil {
@@ -199,12 +79,11 @@ func TestIsLockupOver(t *testing.T) {
if !lockup {
t.Error("lockup period is not over despite account being relased from registry")
}
}
func TestIsAccountInNotaryPool(t *testing.T) {
backend, smc := setup()
client := &smcClient{smc: smc, t: t, backend: backend}
backend, smc := internal.SetupMockClient(t)
client := &internal.MockClient{SMC: smc, T: t, Backend: backend}
// address should not be in pool initially.
b, err := isAccountInNotaryPool(client, client.Account())
@@ -215,9 +94,7 @@ func TestIsAccountInNotaryPool(t *testing.T) {
t.Fatal("account unexpectedly in notary pool")
}
txOpts := transactOpts()
// deposit in notary pool, then it should return true.
txOpts.Value = shardparams.DefaultConfig.NotaryDeposit
txOpts, _ := client.CreateTXOpts(shardparams.DefaultConfig.NotaryDeposit)
if _, err := smc.RegisterNotary(txOpts); err != nil {
t.Fatalf("Failed to deposit: %v", err)
}
@@ -232,8 +109,9 @@ func TestIsAccountInNotaryPool(t *testing.T) {
}
func TestJoinNotaryPool(t *testing.T) {
backend, smc := setup()
client := &smcClient{smc: smc, depositFlag: false, t: t, backend: backend}
backend, smc := internal.SetupMockClient(t)
client := &internal.MockClient{SMC: smc, T: t, Backend: backend}
// There should be no notary initially.
numNotaries, err := smc.NotaryPoolLength(&bind.CallOpts{})
if err != nil {
@@ -264,7 +142,7 @@ func TestJoinNotaryPool(t *testing.T) {
t.Errorf("unexpected number of notaries. Got %d, wanted 1", numNotaries)
}
// Trying to join while deposited should do nothing
// Join while deposited should do nothing.
err = joinNotaryPool(client, client, shardparams.DefaultConfig)
if err != nil {
t.Error(err)
@@ -277,22 +155,20 @@ func TestJoinNotaryPool(t *testing.T) {
if big.NewInt(1).Cmp(numNotaries) != 0 {
t.Errorf("unexpected number of notaries. Got %d, wanted 1", numNotaries)
}
}
func TestLeaveNotaryPool(t *testing.T) {
backend, smc := setup()
client := &smcClient{smc: smc, t: t, depositFlag: true, backend: backend}
// Test Leaving Notary Pool Before Joining it
backend, smc := internal.SetupMockClient(t)
client := &internal.MockClient{SMC: smc, T: t, Backend: backend}
client.SetDepositFlag(true)
// Test leaving notary pool before joining it.
err := leaveNotaryPool(client, client)
if err == nil {
t.Error("able to leave notary pool despite having not joined it")
}
// Roundtrip Test , Join and leave pool
// Roundtrip test, join and leave pool.
err = joinNotaryPool(client, client, shardparams.DefaultConfig)
if err != nil {
t.Error(err)
@@ -321,22 +197,20 @@ func TestLeaveNotaryPool(t *testing.T) {
if big.NewInt(0).Cmp(numNotaries) != 0 {
t.Errorf("unexpected number of notaries. Got %d, wanted 0", numNotaries)
}
}
func TestReleaseNotary(t *testing.T) {
backend, smc := setup()
client := &smcClient{smc: smc, t: t, depositFlag: true, backend: backend}
// Test Release Notary Before Joining it
backend, smc := internal.SetupMockClient(t)
client := &internal.MockClient{SMC: smc, T: t, Backend: backend}
client.SetDepositFlag(true)
// Test release notary before joining it.
err := releaseNotary(client, client, client)
if err == nil {
t.Error("released From notary despite never joining pool")
}
// Roundtrip Test , Join and leave pool and release Notary
// Roundtrip test, join and leave pool.
err = joinNotaryPool(client, client, shardparams.DefaultConfig)
if err != nil {
t.Error(err)
@@ -351,7 +225,7 @@ func TestReleaseNotary(t *testing.T) {
if err != nil {
t.Error("unable to retrieve balance")
}
client.fastForward(int(shardparams.DefaultConfig.NotaryLockupLength + 10))
client.FastForward(int(shardparams.DefaultConfig.NotaryLockupLength + 10))
err = releaseNotary(client, client, client)
if err != nil {
@@ -366,7 +240,7 @@ func TestReleaseNotary(t *testing.T) {
t.Error("Unable to release Notary and deposit money back")
}
newbalance, err := client.backend.BalanceAt(context.Background(), addr, nil)
newbalance, err := client.Backend.BalanceAt(context.Background(), addr, nil)
if err != nil {
t.Error("unable to retrieve balance")
}
@@ -374,16 +248,15 @@ func TestReleaseNotary(t *testing.T) {
if balance.Cmp(newbalance) != -1 {
t.Errorf("Deposit was not returned, balance is currently: %v", newbalance)
}
}
func TestSubmitVote(t *testing.T) {
backend, smc := setup()
client := &smcClient{smc: smc, t: t, depositFlag: true, backend: backend}
backend, smc := internal.SetupMockClient(t)
client := &internal.MockClient{SMC: smc, T: t, Backend: backend}
client.SetDepositFlag(true)
err := joinNotaryPool(client, client, shardparams.DefaultConfig)
if err != nil {
t.Error(err)
}
}

View File

@@ -1,97 +1,26 @@
package proposer
import (
"context"
"crypto/rand"
"math/big"
"testing"
"time"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/sharding/contracts"
"github.com/ethereum/go-ethereum/sharding/internal"
"github.com/ethereum/go-ethereum/sharding/params"
)
var (
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
addr = crypto.PubkeyToAddress(key.PublicKey)
accountBalance, _ = new(big.Int).SetString("1001000000000000000000", 10)
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
addr = crypto.PubkeyToAddress(key.PublicKey)
)
// Mock client for testing proposer.
type mockNode struct {
smc *contracts.SMC
t *testing.T
depositFlag bool
backend *backends.SimulatedBackend
}
func (m *mockNode) Account() *accounts.Account {
return &accounts.Account{Address: addr}
}
func (m *mockNode) SMCCaller() *contracts.SMCCaller {
return &m.smc.SMCCaller
}
func (m *mockNode) ChainReader() ethereum.ChainReader {
return nil
}
func (m *mockNode) SMCTransactor() *contracts.SMCTransactor {
return &m.smc.SMCTransactor
}
func (m *mockNode) SMCFilterer() *contracts.SMCFilterer {
return &m.smc.SMCFilterer
}
func (m *mockNode) WaitForTransaction(ctx context.Context, hash common.Hash, durationInSeconds time.Duration) error {
return nil
}
func (m *mockNode) TransactionReceipt(hash common.Hash) (*types.Receipt, error) {
return nil, nil
}
func (m *mockNode) CreateTXOpts(value *big.Int) (*bind.TransactOpts, error) {
txOpts := transactOpts()
txOpts.Value = value
return txOpts, nil
}
func (m *mockNode) Sign(hash common.Hash) ([]byte, error) {
return nil, nil
}
func (m *mockNode) GetShardCount() (int64, error) {
return 100, nil
}
func transactOpts() *bind.TransactOpts {
return bind.NewKeyedTransactor(key)
}
func setup(t *testing.T) (*backends.SimulatedBackend, *contracts.SMC) {
backend := backends.NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: accountBalance}})
_, _, smc, err := contracts.DeploySMC(transactOpts(), backend)
if err != nil {
t.Fatalf("Failed to deploy SMC contract: %v", err)
}
backend.Commit()
return backend, smc
}
func TestCreateCollation(t *testing.T) {
backend, smc := setup(t)
node := &mockNode{smc: smc, t: t, backend: backend}
backend, smc := internal.SetupMockClient(t)
node := &internal.MockClient{SMC: smc, T: t, Backend: backend}
var txs []*types.Transaction
for i := 0; i < 10; i++ {
data := make([]byte, 1024)
@@ -148,8 +77,8 @@ func TestCreateCollation(t *testing.T) {
}
func TestAddCollation(t *testing.T) {
backend, smc := setup(t)
node := &mockNode{smc: smc, t: t, backend: backend}
backend, smc := internal.SetupMockClient(t)
node := &internal.MockClient{SMC: smc, T: t, Backend: backend}
var txs []*types.Transaction
for i := 0; i < 10; i++ {
data := make([]byte, 1024)
@@ -196,8 +125,8 @@ func TestAddCollation(t *testing.T) {
}
func TestCheckCollation(t *testing.T) {
backend, smc := setup(t)
node := &mockNode{smc: smc, t: t, backend: backend}
backend, smc := internal.SetupMockClient(t)
node := &internal.MockClient{SMC: smc, T: t, Backend: backend}
var txs []*types.Transaction
for i := 0; i < 10; i++ {
data := make([]byte, 1024)

View File

@@ -24,7 +24,8 @@ import (
// implemented.
type Simulator struct {
config *params.Config
client *mainchain.SMCClient
reader mainchain.Reader
fetcher mainchain.RecordFetcher
p2p *p2p.Server
shardID int
ctx context.Context
@@ -37,18 +38,18 @@ type Simulator struct {
// NewSimulator creates a struct instance of a simulator service.
// It will have access to config, a mainchain client, a p2p server,
// and a shardID.
func NewSimulator(config *params.Config, client *mainchain.SMCClient, p2p *p2p.Server, shardID int, delay time.Duration) (*Simulator, error) {
func NewSimulator(config *params.Config, reader mainchain.Reader, fetcher mainchain.RecordFetcher, p2p *p2p.Server, shardID int, delay time.Duration) (*Simulator, error) {
ctx, cancel := context.WithCancel(context.Background())
errChan := make(chan error)
requestSent := make(chan int)
return &Simulator{config, client, p2p, shardID, ctx, cancel, errChan, delay, requestSent}, nil
return &Simulator{config, reader, fetcher, p2p, shardID, ctx, cancel, errChan, delay, requestSent}, nil
}
// Start the main loop for simulating p2p requests.
func (s *Simulator) Start() {
log.Info("Starting simulator service")
feed := s.p2p.Feed(messages.CollationBodyRequest{})
go s.simulateNotaryRequests(s.client.SMCCaller(), s.client.ChainReader(), feed)
go s.simulateNotaryRequests(s.fetcher, s.reader, feed)
go s.handleServiceErrors()
}

View File

@@ -18,7 +18,6 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/sharding"
internal "github.com/ethereum/go-ethereum/sharding/internal"
"github.com/ethereum/go-ethereum/sharding/mainchain"
"github.com/ethereum/go-ethereum/sharding/p2p"
"github.com/ethereum/go-ethereum/sharding/params"
)
@@ -91,7 +90,7 @@ func TestStartStop(t *testing.T) {
t.Fatalf("Unable to setup p2p server: %v", err)
}
simulator, err := NewSimulator(params.DefaultConfig, &mainchain.SMCClient{}, server, shardID, 0)
simulator, err := NewSimulator(params.DefaultConfig, &goodReader{}, &goodSMCCaller{}, server, shardID, 0)
if err != nil {
t.Fatalf("Unable to setup simulator service: %v", err)
}
@@ -125,7 +124,7 @@ func TestSimulateNotaryRequests_FaultyReader(t *testing.T) {
t.Fatalf("Unable to setup p2p server: %v", err)
}
simulator, err := NewSimulator(params.DefaultConfig, &mainchain.SMCClient{}, server, shardID, 0)
simulator, err := NewSimulator(params.DefaultConfig, &faultyReader{}, &goodSMCCaller{}, server, shardID, 0)
if err != nil {
t.Fatalf("Unable to setup simulator service: %v", err)
}
@@ -164,7 +163,7 @@ func TestSimulateNotaryRequests_FaultyCaller(t *testing.T) {
t.Fatalf("Unable to setup p2p server: %v", err)
}
simulator, err := NewSimulator(params.DefaultConfig, &mainchain.SMCClient{}, server, shardID, 0)
simulator, err := NewSimulator(params.DefaultConfig, &goodReader{}, &faultySMCCaller{}, server, shardID, 0)
if err != nil {
t.Fatalf("Unable to setup simulator service: %v", err)
}
@@ -203,7 +202,7 @@ func TestSimulateNotaryRequests(t *testing.T) {
t.Fatalf("Unable to setup p2p server: %v", err)
}
simulator, err := NewSimulator(params.DefaultConfig, &mainchain.SMCClient{}, server, shardID, 0)
simulator, err := NewSimulator(params.DefaultConfig, &goodReader{}, &goodSMCCaller{}, server, shardID, 0)
if err != nil {
t.Fatalf("Unable to setup simulator service: %v", err)
}
@@ -225,7 +224,6 @@ func TestSimulateNotaryRequests(t *testing.T) {
// TODO: Move this to the utils package along with the handleServiceErrors
// function.
func TestHandleServiceErrors(t *testing.T) {
h := internal.NewLogHandler(t)
log.Root().SetHandler(h)
@@ -235,7 +233,7 @@ func TestHandleServiceErrors(t *testing.T) {
t.Fatalf("Unable to setup p2p server: %v", err)
}
simulator, err := NewSimulator(params.DefaultConfig, &mainchain.SMCClient{}, server, shardID, 0)
simulator, err := NewSimulator(params.DefaultConfig, &goodReader{}, &goodSMCCaller{}, server, shardID, 0)
if err != nil {
t.Fatalf("Unable to setup simulator service: %v", err)
}

View File

@@ -21,7 +21,7 @@ import (
// items such as transactions and in future sharding iterations: state.
type Syncer struct {
config *params.Config
client *mainchain.SMCClient
signer mainchain.Signer
shard *sharding.Shard
p2p *p2p.Server
ctx context.Context
@@ -31,20 +31,20 @@ type Syncer struct {
}
// NewSyncer creates a struct instance of a syncer service.
// It will have access to config, a mainchain client, a p2p server,
// It will have access to config, a signer, a p2p server,
// a shardChainDb, and a shardID.
func NewSyncer(config *params.Config, client *mainchain.SMCClient, p2p *p2p.Server, shardChainDB ethdb.Database, shardID int) (*Syncer, error) {
func NewSyncer(config *params.Config, signer mainchain.Signer, p2p *p2p.Server, shardChainDB ethdb.Database, shardID int) (*Syncer, error) {
ctx, cancel := context.WithCancel(context.Background())
shard := sharding.NewShard(big.NewInt(int64(shardID)), shardChainDB)
errChan := make(chan error)
responseSent := make(chan int)
return &Syncer{config, client, shard, p2p, ctx, cancel, errChan, responseSent}, nil
return &Syncer{config, signer, shard, p2p, ctx, cancel, errChan, responseSent}, nil
}
// Start the main loop for handling shard chain data requests.
func (s *Syncer) Start() {
log.Info("Starting sync service")
go s.handleCollationBodyRequests(s.client, s.p2p.Feed(messages.CollationBodyRequest{}))
go s.handleCollationBodyRequests(s.signer, s.p2p.Feed(messages.CollationBodyRequest{}))
go s.handleServiceErrors()
}

View File

@@ -10,7 +10,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/sharding/mainchain"
"github.com/ethereum/go-ethereum/sharding/p2p/messages"
@@ -36,7 +35,7 @@ func TestStartStop(t *testing.T) {
t.Fatalf("Unable to setup p2p server: %v", err)
}
syncer, err := NewSyncer(params.DefaultConfig, &mainchain.SMCClient{}, server, shardChainDB, shardID)
syncer, err := NewSyncer(params.DefaultConfig, &mockSigner{}, server, shardChainDB, shardID)
if err != nil {
t.Fatalf("Unable to setup sync service: %v", err)
}
@@ -71,7 +70,7 @@ func TestHandleCollationBodyRequests_FaultySigner(t *testing.T) {
t.Fatalf("Unable to setup p2p server: %v", err)
}
syncer, err := NewSyncer(params.DefaultConfig, &mainchain.SMCClient{}, server, shardChainDB, shardID)
syncer, err := NewSyncer(params.DefaultConfig, &mockSigner{}, server, shardChainDB, shardID)
if err != nil {
t.Fatalf("Unable to setup syncer service: %v", err)
}
@@ -145,7 +144,7 @@ func TestHandleCollationBodyRequests(t *testing.T) {
t.Fatalf("Could not store collation in shardChainDB: %v", err)
}
syncer, err := NewSyncer(params.DefaultConfig, &mainchain.SMCClient{}, server, shardChainDB, 0)
syncer, err := NewSyncer(params.DefaultConfig, &mockSigner{}, server, shardChainDB, 0)
if err != nil {
t.Fatalf("Unable to setup syncer service: %v", err)
}
@@ -198,7 +197,7 @@ func TestHandleServiceErrors(t *testing.T) {
t.Fatalf("Unable to setup p2p server: %v", err)
}
syncer, err := NewSyncer(params.DefaultConfig, &mainchain.SMCClient{}, server, shardChainDB, shardID)
syncer, err := NewSyncer(params.DefaultConfig, &mockSigner{}, server, shardChainDB, shardID)
if err != nil {
t.Fatalf("Unable to setup syncer service: %v", err)
}