Skip to content

Commit

Permalink
standardize mock file name
Browse files Browse the repository at this point in the history
  • Loading branch information
domiwei committed Apr 24, 2024
1 parent faebc82 commit b036dc4
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 39 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cl/aggregation/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
)

//go:generate mockgen -destination=./mock_services/aggregation_pool_mock.go -package=mock_services . AggregationPool
type AggregationPool interface {
AddAttestation(att *solid.Attestation) error
//GetAggregatations(slot uint64, committeeIndex uint64) ([]*solid.Attestation, error)
Expand Down
2 changes: 1 addition & 1 deletion cl/beacon/handler/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

libcommon "github.com/ledgerwatch/erigon-lib/common"
mock_aggregation "github.com/ledgerwatch/erigon/cl/aggregation/mock"
mock_aggregation "github.com/ledgerwatch/erigon/cl/aggregation/mock_services"
"github.com/ledgerwatch/erigon/cl/beacon/beacon_router_configuration"
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
"github.com/ledgerwatch/erigon/cl/pool"
Expand Down
2 changes: 1 addition & 1 deletion cl/phase1/core/state/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import libcommon "github.com/ledgerwatch/erigon-lib/common"

// BeaconStateReader is an interface for reading the beacon state.
//
//go:generate mockgen -destination=./mock_services/beacon_state_reader.go -package=mock_services . BeaconStateReader
//go:generate mockgen -destination=./mock_services/beacon_state_reader_mock.go -package=mock_services . BeaconStateReader
type BeaconStateReader interface {
ValidatorPublicKey(index int) (libcommon.Bytes48, error)
GetDomain(domainType [4]byte, epoch uint64) ([]byte, error)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion cl/phase1/forkchoice/forkchoice_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/ledgerwatch/erigon/cl/pool"
"github.com/ledgerwatch/erigon/cl/transition/impl/eth2"
"github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool"
syncPoolMock "github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool/mock_services"
"go.uber.org/mock/gomock"
)

Expand Down Expand Up @@ -57,7 +58,7 @@ func makeSyncContributionPoolMock(t *testing.T) sync_contribution_pool.SyncContr
beaconBlockRoot common.Hash
}
u := map[syncContributionKey]*cltypes.Contribution{}
pool := sync_contribution_pool.NewMockSyncContributionPool(ctrl)
pool := syncPoolMock.NewMockSyncContributionPool(ctrl)
pool.EXPECT().AddSyncContribution(gomock.Any(), gomock.Any()).DoAndReturn(func(headState *state.CachingBeaconState, contribution *cltypes.Contribution) error {
key := syncContributionKey{
slot: contribution.Slot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/ledgerwatch/erigon/cl/cltypes"
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
"github.com/ledgerwatch/erigon/cl/utils/eth_clock"
"github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool"
syncPoolMock "github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool/mock_services"
"github.com/stretchr/testify/require"
gomock "go.uber.org/mock/gomock"
)
Expand All @@ -19,7 +19,7 @@ func setupSyncCommitteesServiceTest(t *testing.T, ctrl *gomock.Controller) (Sync
cfg := &clparams.MainnetBeaconConfig
syncedDataManager := synced_data.NewSyncedDataManager(true, cfg)
ethClock := eth_clock.NewMockEthereumClock(ctrl)
syncContributionPool := sync_contribution_pool.NewMockSyncContributionPool(ctrl)
syncContributionPool := syncPoolMock.NewMockSyncContributionPool(ctrl)
s := NewSyncCommitteeMessagesService(cfg, ethClock, syncedDataManager, syncContributionPool, true)
syncContributionPool.EXPECT().AddSyncCommitteeMessage(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
return s, syncedDataManager, ethClock
Expand Down
4 changes: 2 additions & 2 deletions cl/phase1/network/services/sync_contribution_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
"github.com/ledgerwatch/erigon/cl/utils/eth_clock"
"github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool"
syncPoolMock "github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool/mock_services"
"github.com/stretchr/testify/require"
gomock "go.uber.org/mock/gomock"
)
Expand All @@ -21,7 +21,7 @@ func setupSyncContributionServiceTest(t *testing.T, ctrl *gomock.Controller) (Sy
cfg := &clparams.MainnetBeaconConfig
syncedDataManager := synced_data.NewSyncedDataManager(true, cfg)
ethClock := eth_clock.NewMockEthereumClock(ctrl)
syncContributionPool := sync_contribution_pool.NewMockSyncContributionPool(ctrl)
syncContributionPool := syncPoolMock.NewMockSyncContributionPool(ctrl)
s := NewSyncContributionService(syncedDataManager, cfg, syncContributionPool, ethClock, beaconevents.NewEmitters(), true)
syncContributionPool.EXPECT().AddSyncContribution(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
return s, syncedDataManager, ethClock
Expand Down
2 changes: 1 addition & 1 deletion cl/validator/sync_contribution_pool/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// SyncContributionPool is an interface for managing sync committee contributions and messages.
// it keeps a store of sync committee contributions, if new messages are received they are aggregated with pre-existing contributions.

//go:generate mockgen -source=interface.go -destination=mock.go -package=sync_contribution_pool
//go:generate mockgen -destination=mock_services/sync_contribution_pool_mock.go -package=sync_contribution_pool . SyncContributionPool
type SyncContributionPool interface {
// AddSyncContribution adds a sync committee contribution to the pool.
AddSyncContribution(headState *state.CachingBeaconState, contribution *cltypes.Contribution) error
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b036dc4

Please sign in to comment.