Clean up various warnings (#10710)

* Clean up various warnings

* Update beacon-chain/rpc/prysm/v1alpha1/debug/state_test.go

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>

* Fix redundant casting genState

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
This commit is contained in:
terencechain
2022-05-18 21:38:04 -07:00
committed by GitHub
parent 1c51f6d1be
commit 092e9e1d19
32 changed files with 112 additions and 117 deletions

View File

@@ -170,12 +170,12 @@ func MapProposerSlashing(slashing *ethpb.ProposerSlashing) (*ProposerSlashing, e
return nil, errors.Wrap(err, "could not map signed header 2")
}
return &ProposerSlashing{
SignedHeader_1: signedHeader1,
SignedHeader_2: signedHeader2,
Signedheader1: signedHeader1,
Signedheader2: signedHeader2,
}, nil
}
// MapAttesterSlashing maps the eth2.AttesterSlashing proto to the Web3Signer spec.
// MapSignedBeaconBlockHeader maps the eth2.AttesterSlashing proto to the Web3Signer spec.
func MapSignedBeaconBlockHeader(signedHeader *ethpb.SignedBeaconBlockHeader) (*SignedBeaconBlockHeader, error) {
if signedHeader == nil {
return nil, fmt.Errorf("signed beacon block header is nil")
@@ -217,8 +217,8 @@ func MapAttesterSlashing(slashing *ethpb.AttesterSlashing) (*AttesterSlashing, e
return nil, errors.Wrap(err, "could not map attestation 2")
}
return &AttesterSlashing{
Attestation_1: attestation1,
Attestation_2: attestation2,
Attestation1: attestation1,
Attestation2: attestation2,
}, nil
}

View File

@@ -195,8 +195,8 @@ func TestMapAttesterSlashing(t *testing.T) {
},
},
want: &v1.AttesterSlashing{
Attestation_1: mock.MockIndexedAttestation(),
Attestation_2: mock.MockIndexedAttestation(),
Attestation1: mock.MockIndexedAttestation(),
Attestation2: mock.MockIndexedAttestation(),
},
wantErr: false,
},
@@ -208,8 +208,8 @@ func TestMapAttesterSlashing(t *testing.T) {
t.Errorf("MapAttesterSlashing() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got.Attestation_1, tt.want.Attestation_1) {
t.Errorf("MapAttesterSlashing() got = %v, want %v", got.Attestation_1, tt.want.Attestation_1)
if !reflect.DeepEqual(got.Attestation1, tt.want.Attestation1) {
t.Errorf("MapAttesterSlashing() got = %v, want %v", got.Attestation1, tt.want.Attestation1)
}
})
}

View File

@@ -633,7 +633,7 @@ func MockBeaconBlockAltair() *v1.BeaconBlockAltair {
Graffiti: hexutil.Encode(make([]byte, 32)),
ProposerSlashings: []*v1.ProposerSlashing{
{
SignedHeader_1: &v1.SignedBeaconBlockHeader{
Signedheader1: &v1.SignedBeaconBlockHeader{
Message: &v1.BeaconBlockHeader{
Slot: "0",
ProposerIndex: "0",
@@ -643,7 +643,7 @@ func MockBeaconBlockAltair() *v1.BeaconBlockAltair {
},
Signature: hexutil.Encode(make([]byte, fieldparams.BLSSignatureLength)),
},
SignedHeader_2: &v1.SignedBeaconBlockHeader{
Signedheader2: &v1.SignedBeaconBlockHeader{
Message: &v1.BeaconBlockHeader{
Slot: "0",
ProposerIndex: "0",
@@ -657,8 +657,8 @@ func MockBeaconBlockAltair() *v1.BeaconBlockAltair {
},
AttesterSlashings: []*v1.AttesterSlashing{
{
Attestation_1: MockIndexedAttestation(),
Attestation_2: MockIndexedAttestation(),
Attestation1: MockIndexedAttestation(),
Attestation2: MockIndexedAttestation(),
},
},
Attestations: []*v1.Attestation{
@@ -703,7 +703,7 @@ func MockBeaconBlockBody() *v1.BeaconBlockBody {
Graffiti: hexutil.Encode(make([]byte, 32)),
ProposerSlashings: []*v1.ProposerSlashing{
{
SignedHeader_1: &v1.SignedBeaconBlockHeader{
Signedheader1: &v1.SignedBeaconBlockHeader{
Message: &v1.BeaconBlockHeader{
Slot: "0",
ProposerIndex: "0",
@@ -713,7 +713,7 @@ func MockBeaconBlockBody() *v1.BeaconBlockBody {
},
Signature: hexutil.Encode(make([]byte, fieldparams.BLSSignatureLength)),
},
SignedHeader_2: &v1.SignedBeaconBlockHeader{
Signedheader2: &v1.SignedBeaconBlockHeader{
Message: &v1.BeaconBlockHeader{
Slot: "0",
ProposerIndex: "0",
@@ -727,8 +727,8 @@ func MockBeaconBlockBody() *v1.BeaconBlockBody {
},
AttesterSlashings: []*v1.AttesterSlashing{
{
Attestation_1: MockIndexedAttestation(),
Attestation_2: MockIndexedAttestation(),
Attestation1: MockIndexedAttestation(),
Attestation2: MockIndexedAttestation(),
},
},
Attestations: []*v1.Attestation{

View File

@@ -10,7 +10,7 @@ type AggregationSlotSignRequest struct {
AggregationSlot *AggregationSlot `json:"aggregation_slot" validate:"required"`
}
// AggregationSlotSignRequest is a request object for web3signer sign api.
// AggregateAndProofSignRequest is a request object for web3signer sign api.
type AggregateAndProofSignRequest struct {
Type string `json:"type" validate:"required"`
ForkInfo *ForkInfo `json:"fork_info" validate:"required"`
@@ -183,9 +183,9 @@ type Eth1Data struct {
// ProposerSlashing a sub property of BeaconBlockBody.
type ProposerSlashing struct {
// Prysm uses Header_1 but web3signer uses signed_header_1.
SignedHeader_1 *SignedBeaconBlockHeader `json:"signed_header_1"`
Signedheader1 *SignedBeaconBlockHeader `json:"signed_header_1"`
// Prysm uses Header_2 but web3signer uses signed_header_2.
SignedHeader_2 *SignedBeaconBlockHeader `json:"signed_header_2"`
Signedheader2 *SignedBeaconBlockHeader `json:"signed_header_2"`
}
// SignedBeaconBlockHeader is a sub property of ProposerSlashing.
@@ -205,8 +205,8 @@ type BeaconBlockHeader struct {
// AttesterSlashing a sub property of BeaconBlockBody.
type AttesterSlashing struct {
Attestation_1 *IndexedAttestation `json:"attestation_1"`
Attestation_2 *IndexedAttestation `json:"attestation_2"`
Attestation1 *IndexedAttestation `json:"attestation_1"`
Attestation2 *IndexedAttestation `json:"attestation_2"`
}
// IndexedAttestation a sub property of AttesterSlashing.