mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
* WIP
* WIP
* Remove duplicate mock
* WIP
* Revert "WIP"
This reverts commit a8010057fe.
* Fix build break
* Remove unused variable
* Fix build break
* Rename validator_mock to validatormock
* Fix failing test
---------
Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
56 lines
2.0 KiB
Go
56 lines
2.0 KiB
Go
package beacon_api
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"time"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/v4/validator/client/iface"
|
|
)
|
|
|
|
type beaconApiSlasherClient struct {
|
|
fallbackClient iface.SlasherClient
|
|
jsonRestHandler jsonRestHandler
|
|
}
|
|
|
|
func (c beaconApiSlasherClient) IsSlashableAttestation(ctx context.Context, in *ethpb.IndexedAttestation) (*ethpb.AttesterSlashingResponse, error) {
|
|
if c.fallbackClient != nil {
|
|
return c.fallbackClient.IsSlashableAttestation(ctx, in)
|
|
}
|
|
|
|
// TODO: Implement me
|
|
panic("beaconApiSlasherClient.IsSlashableAttestation is not implemented. To use a fallback client, pass a fallback client as the last argument of NewBeaconApiSlasherClientWithFallback.")
|
|
}
|
|
|
|
func (c beaconApiSlasherClient) IsSlashableBlock(ctx context.Context, in *ethpb.SignedBeaconBlockHeader) (*ethpb.ProposerSlashingResponse, error) {
|
|
if c.fallbackClient != nil {
|
|
return c.fallbackClient.IsSlashableBlock(ctx, in)
|
|
}
|
|
|
|
// TODO: Implement me
|
|
panic("beaconApiSlasherClient.IsSlashableBlock is not implemented. To use a fallback client, pass a fallback client as the last argument of NewBeaconApiSlasherClientWithFallback.")
|
|
}
|
|
|
|
// Deprecated: Do not use.
|
|
func (c beaconApiSlasherClient) HighestAttestations(ctx context.Context, in *ethpb.HighestAttestationRequest) (*ethpb.HighestAttestationResponse, error) {
|
|
if c.fallbackClient != nil {
|
|
return c.fallbackClient.HighestAttestations(ctx, in)
|
|
}
|
|
|
|
// TODO: Implement me
|
|
panic("beaconApiSlasherClient.HighestAttestations is not implemented. To use a fallback client, pass a fallback client as the last argument of NewBeaconApiSlasherClientWithFallback.")
|
|
}
|
|
|
|
func NewSlasherClientWithFallback(host string, timeout time.Duration, fallbackClient iface.SlasherClient) iface.SlasherClient {
|
|
jsonRestHandler := beaconApiJsonRestHandler{
|
|
httpClient: http.Client{Timeout: timeout},
|
|
host: host,
|
|
}
|
|
|
|
return &beaconApiSlasherClient{
|
|
jsonRestHandler: jsonRestHandler,
|
|
fallbackClient: fallbackClient,
|
|
}
|
|
}
|