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

Commit

Permalink
Refactor from fmt.errorf into errors.New
Browse files Browse the repository at this point in the history
  • Loading branch information
Manav-Aggarwal committed Oct 20, 2022
1 parent 70a4684 commit d0136bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 6 additions & 1 deletion baseapp/fraudproof.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package baseapp
import (
"bytes"
"crypto/sha256"
"errors"
"fmt"

"github.com/cosmos/cosmos-sdk/store/types"
Expand All @@ -13,6 +14,10 @@ import (
tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto"
)

var (
ErrMoreThanOneBlockTypeUsed = errors.New("fraudProof has more than one type of fradulent state transitions marked nil")
)

// Represents a single-round fraudProof
type FraudProof struct {
// The block height to load state of
Expand Down Expand Up @@ -92,7 +97,7 @@ func (fraudProof *FraudProof) checkFraudulentStateTransition() bool {

func (fraudProof *FraudProof) verifyFraudProof() (bool, error) {
if !fraudProof.checkFraudulentStateTransition() {
return false, fmt.Errorf("fraudProof has more than one type of fradulent state transitions marked nil")
return false, ErrMoreThanOneBlockTypeUsed
}
for storeKey, stateWitness := range fraudProof.stateWitness {
proofOp := stateWitness.Proof
Expand Down
5 changes: 2 additions & 3 deletions store/tracekv/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"errors"
"io"

"github.com/chrispappas/golang-generics-set/set"
"github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/types/errors"
)

const (
Expand All @@ -21,7 +20,7 @@ const (
)

var (
ErrBufferEmpty = fmt.Errorf("provided buffer is empty")
ErrBufferEmpty = errors.New("provided buffer is empty")
)

type (
Expand Down

0 comments on commit d0136bc

Please sign in to comment.