mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Use function argument in error message instead of return value (#11244)
* Do not use return value in error handling * Revert changes to EpochFromString & SlotFromString Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: Nishant Das <nishdas93@gmail.com>
This commit is contained in:
@@ -88,7 +88,7 @@ func ExpandSingleEndpointIfFile(ctx *cli.Context, flag *cli.StringFlag) error {
|
||||
default:
|
||||
web3endpoint, err := file.ExpandPath(ctx.String(flag.Name))
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "could not expand path for %s", web3endpoint)
|
||||
return errors.Wrapf(err, "could not expand path for %s", ctx.String(flag.Name))
|
||||
}
|
||||
if err := ctx.Set(flag.Name, web3endpoint); err != nil {
|
||||
return errors.Wrapf(err, "could not set %s to %s", flag.Name, web3endpoint)
|
||||
|
||||
@@ -316,14 +316,14 @@ func transformSignedBlocks(_ context.Context, signedBlocks []*format.SignedBlock
|
||||
for i, proposal := range signedBlocks {
|
||||
slot, err := SlotFromString(proposal.Slot)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%d is not a valid slot: %w", slot, err)
|
||||
return nil, fmt.Errorf("%s is not a valid slot: %w", proposal.Slot, err)
|
||||
}
|
||||
var signingRoot [32]byte
|
||||
// Signing roots are optional in the standard JSON file.
|
||||
if proposal.SigningRoot != "" {
|
||||
signingRoot, err = RootFromHex(proposal.SigningRoot)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%#x is not a valid root: %w", signingRoot, err)
|
||||
return nil, fmt.Errorf("%s is not a valid root: %w", proposal.SigningRoot, err)
|
||||
}
|
||||
}
|
||||
proposals[i] = kv.Proposal{
|
||||
@@ -341,18 +341,18 @@ func transformSignedAttestations(pubKey [fieldparams.BLSPubkeyLength]byte, atts
|
||||
for _, attestation := range atts {
|
||||
target, err := EpochFromString(attestation.TargetEpoch)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%d is not a valid epoch: %w", target, err)
|
||||
return nil, fmt.Errorf("%s is not a valid epoch: %w", attestation.TargetEpoch, err)
|
||||
}
|
||||
source, err := EpochFromString(attestation.SourceEpoch)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%d is not a valid epoch: %w", source, err)
|
||||
return nil, fmt.Errorf("%s is not a valid epoch: %w", attestation.SourceEpoch, err)
|
||||
}
|
||||
var signingRoot [32]byte
|
||||
// Signing roots are optional in the standard JSON file.
|
||||
if attestation.SigningRoot != "" {
|
||||
signingRoot, err = RootFromHex(attestation.SigningRoot)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%#x is not a valid root: %w", signingRoot, err)
|
||||
return nil, fmt.Errorf("%s is not a valid root: %w", attestation.SigningRoot, err)
|
||||
}
|
||||
}
|
||||
historicalAtts = append(historicalAtts, &kv.AttestationRecord{
|
||||
|
||||
Reference in New Issue
Block a user