Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
improve: use errors.New to replace fmt.Errorf with no parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengenH committed Apr 20, 2024
1 parent ea1e455 commit 8ec74fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions driver/state/l1_current.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package state

import (
"context"
"errors"
"fmt"
"math/big"

"github.com/ethereum/go-ethereum/common"
Expand All @@ -29,7 +29,7 @@ func (s *State) SetL1Current(h *types.Header) {
// BlockProposed event with given blockID / blockHash.
func (s *State) ResetL1Current(ctx context.Context, blockID *big.Int) error {
if blockID == nil {
return errors.New("empty block ID")
return fmt.Errorf("empty block ID")
}

log.Info("Reset L1 current cursor", "blockID", blockID)
Expand Down
8 changes: 4 additions & 4 deletions pkg/rpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,31 +638,31 @@ func (c *Client) getSyncedL1SnippetFromAnchor(
common.Hash{},
0,
0,
errors.New("failed to parse l1BlockHash from anchor transaction calldata")
fmt.Errorf("failed to parse l1BlockHash from anchor transaction calldata")
}
l1StateRoot, ok = args["_l1StateRoot"].([32]byte)
if !ok {
return common.Hash{},
common.Hash{},
0,
0,
errors.New("failed to parse l1StateRoot from anchor transaction calldata")
fmt.Errorf("failed to parse l1StateRoot from anchor transaction calldata")
}
l1Height, ok = args["_l1BlockId"].(uint64)
if !ok {
return common.Hash{},
common.Hash{},
0,
0,
errors.New("failed to parse l1Height from anchor transaction calldata")
fmt.Errorf("failed to parse l1Height from anchor transaction calldata")
}
parentGasUsed, ok = args["_parentGasUsed"].(uint32)
if !ok {
return common.Hash{},
common.Hash{},
0,
0,
errors.New("failed to parse parentGasUsed from anchor transaction calldata")
fmt.Errorf("failed to parse parentGasUsed from anchor transaction calldata")
}

return l1BlockHash, l1StateRoot, l1Height, parentGasUsed, nil
Expand Down

0 comments on commit 8ec74fa

Please sign in to comment.