forked from flashbots/mev-boost-relay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmock_multi_beacon_client.go
69 lines (55 loc) · 2.02 KB
/
mock_multi_beacon_client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package beaconclient
import (
"github.com/attestantio/go-eth2-client/spec/capella"
"github.com/flashbots/mev-boost-relay/common"
)
type MockMultiBeaconClient struct{}
func NewMockMultiBeaconClient() *MockMultiBeaconClient {
return &MockMultiBeaconClient{}
}
func (*MockMultiBeaconClient) BestSyncStatus() (*SyncStatusPayloadData, error) {
return &SyncStatusPayloadData{HeadSlot: 1}, nil //nolint:exhaustruct
}
func (*MockMultiBeaconClient) SubscribeToHeadEvents(slotC chan HeadEventData) {}
func (*MockMultiBeaconClient) SubscribeToPayloadAttributesEvents(payloadAttrC chan PayloadAttributesEvent) {
}
func (*MockMultiBeaconClient) GetStateValidators(stateID string) (*GetStateValidatorsResponse, error) {
return nil, nil
}
func (*MockMultiBeaconClient) GetProposerDuties(epoch uint64) (*ProposerDutiesResponse, error) {
return nil, nil
}
func (*MockMultiBeaconClient) PublishBlock(block *common.VersionedSignedProposal) (code int, err error) {
return 0, nil
}
func (*MockMultiBeaconClient) GetGenesis() (*GetGenesisResponse, error) {
resp := &GetGenesisResponse{} //nolint:exhaustruct
resp.Data.GenesisTime = 0
return resp, nil
}
func (*MockMultiBeaconClient) GetSpec() (spec *GetSpecResponse, err error) {
return nil, nil
}
func (*MockMultiBeaconClient) GetForkSchedule() (spec *GetForkScheduleResponse, err error) {
resp := &GetForkScheduleResponse{
Data: []struct {
PreviousVersion string `json:"previous_version"`
CurrentVersion string `json:"current_version"`
Epoch uint64 `json:"epoch,string"`
}{
{
CurrentVersion: "",
Epoch: 1,
},
},
}
return resp, nil
}
func (*MockMultiBeaconClient) GetRandao(slot uint64) (spec *GetRandaoResponse, err error) {
return nil, nil
}
func (*MockMultiBeaconClient) GetWithdrawals(slot uint64) (spec *GetWithdrawalsResponse, err error) {
resp := &GetWithdrawalsResponse{} //nolint:exhaustruct
resp.Data.Withdrawals = append(resp.Data.Withdrawals, &capella.Withdrawal{}) //nolint:exhaustruct
return resp, nil
}