Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use errors.New to replace fmt.Errorf with no parameters #3519

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: use errors.New to replace fmt.Errorf with no parameters
Signed-off-by: ChengenH <hce19970702@gmail.com>
  • Loading branch information
ChengenH committed Dec 8, 2024
commit dbd4a1729a2a2622f6b7d06ccb9e5a396bcac7f2
2 changes: 1 addition & 1 deletion packages/chain/WaspChainConsensus.tla
Original file line number Diff line number Diff line change
@@ -315,7 +315,7 @@ The committee has to handle rejects and reorgs in L1, agree on the next
log entry by choosing an alias output to use as an input for the next TX.

The main idea is that if the nodes consider different alias outputs to use,
after some time they will get synchronized, because L1 here the the source
after some time they will get synchronized, because L1 here the source
of this information, and it will be synchronized to all the correct nodes
after some time.
*)
2 changes: 1 addition & 1 deletion packages/chain/statemanager/sm_gpa/state_manager_gpa.go
Original file line number Diff line number Diff line change
@@ -756,7 +756,7 @@ func (smT *stateManagerGPA) updateChainOfBlocks(commitment *state.L1Commitment,
smT.chainOfBlocks = cob
} else if bi == nil { // origin block has been reached
smT.chainOfBlocks = cob
} else if bi.trieRoot.Equals(lastKnownBi.trieRoot) { // Here is the the place to merge newest blocks chain with currently known blocks chain
} else if bi.trieRoot.Equals(lastKnownBi.trieRoot) { // Here is the place to merge newest blocks chain with currently known blocks chain
// Normally newest blocks chain should contain only several (usually, 1)
// block infos and currently known blocks chain should contain at least
// `PruningMinStatesToKeep` block infos, but on a sudden enabling of pruning
2 changes: 1 addition & 1 deletion packages/nodeconn/nc_chain.go
Original file line number Diff line number Diff line change
@@ -320,7 +320,7 @@ func (ncc *ncChain) postTxLoop(ctx context.Context) {
postTransaction := func(pendingTx *pendingTransaction, isReattachment bool) error {
debugInfoChaining := ""

// check if the the transaction should be chained with another pending transaction
// check if the transaction should be chained with another pending transaction
chainedTxBlockIDs := iotago.BlockIDs{}
if pendingTx.lastPendingTx != nil {
// check if the chained pending transaction is still being tracked.
4 changes: 2 additions & 2 deletions packages/util/generics.go
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ type Cloneable[T any] interface {
Clone() T
}

// CloneSlice clones every element in the the slice into cloned and returns the cloned slice.
// CloneSlice clones every element in the slice into cloned and returns the cloned slice.
func CloneSlice[T Cloneable[T]](base []T) []T {
cloned := make([]T, len(base))

@@ -15,7 +15,7 @@ func CloneSlice[T Cloneable[T]](base []T) []T {
return cloned
}

// CloneMap clones every element in the the map into cloned and returns the cloned map.
// CloneMap clones every element in the map into cloned and returns the cloned map.
func CloneMap[K comparable, T Cloneable[T]](base map[K]T) map[K]T {
cloned := make(map[K]T, len(base))

2 changes: 1 addition & 1 deletion packages/vm/vmexceptions/exceptions.go
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ var (

// not a protocol limit error, but something went wrong after request execution
var (
ErrPostExecutionPanic = fmt.Errorf("post execution error")
ErrPostExecutionPanic = errors.New("post execution error")
)

var SkipRequestErrors = []error{
2 changes: 1 addition & 1 deletion packages/wasmvm/wasmlib/as/wasmlib/exports.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ import {exportName} from './host';
// Note that we do not use the Wasm export symbol table on purpose
// because Wasm does not allow us to determine whether the symbols
// are meant as view or func, or meant as extra public callbacks
// generated by the compilation of the the Wasm code.
// generated by the compilation of the Wasm code.
// There are only 2 symbols the ISC host will actually look for
// in the export table:
// on_load (which must be defined by the SC code) and
2 changes: 1 addition & 1 deletion packages/wasmvm/wasmlib/src/exports.rs
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ use crate::host::*;
// Note that we do not use the Wasm export symbol table on purpose
// because Wasm does not allow us to determine whether the symbols
// are meant as view or func, or meant as extra public callbacks
// generated by the compilation of the the Wasm code.
// generated by the compilation of the Wasm code.
// There are only 2 symbols the ISC host will actually look for
// in the export table:
// on_load (which must be defined by the SC code) and
2 changes: 1 addition & 1 deletion packages/wasmvm/wasmlib/ts/wasmlib/exports.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ import {exportName} from './host';
// Note that we do not use the Wasm export symbol table on purpose
// because Wasm does not allow us to determine whether the symbols
// are meant as view or func, or meant as extra public callbacks
// generated by the compilation of the the Wasm code.
// generated by the compilation of the Wasm code.
// There are only 2 symbols the ISC host will actually look for
// in the export table:
// on_load (which must be defined by the SC code) and
3 changes: 2 additions & 1 deletion tools/cluster/chain.go
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ package cluster
import (
"bytes"
"context"
"errors"
"fmt"
"time"

@@ -148,7 +149,7 @@ func (ch *Chain) DeployWasmContract(name string, progBinary []byte, initParams m
return hashing.NilHash, err
}
if !bytes.Equal(progBinary, progBinaryBack) {
return hashing.NilHash, fmt.Errorf("!bytes.Equal(progBinary, progBinaryBack)")
return hashing.NilHash, errors.New("!bytes.Equal(progBinary, progBinaryBack)")
}
fmt.Printf("---- blob installed correctly len = %d\n", len(progBinaryBack))

2 changes: 1 addition & 1 deletion tools/cluster/cluster.go
Original file line number Diff line number Diff line change
@@ -906,5 +906,5 @@ func (clu *Cluster) MintL1NFT(immutableMetadata []byte, target iotago.Address, i
}
}

return iotago.OutputID{}, nil, fmt.Errorf("inconsistency: couldn't find newly minted NFT in tx")
return iotago.OutputID{}, nil, errors.New("inconsistency: couldn't find newly minted NFT in tx")
}
2 changes: 1 addition & 1 deletion tools/schema/main.go
Original file line number Diff line number Diff line change
@@ -359,7 +359,7 @@ func runGenerator() error {
}
if !generated {
flag.Usage()
return fmt.Errorf("schema.yaml not found")
return errors.New("schema.yaml not found")
}
return nil
}
2 changes: 1 addition & 1 deletion tools/wasp-cli/cli/config/config.go
Original file line number Diff line number Diff line change
@@ -206,7 +206,7 @@ func GetChain(name string) isc.ChainID {
log.Check(err)

if networkPrefix != parameters.L1().Protocol.Bech32HRP {
err = fmt.Errorf("target network of the L1 node does not match the wasp-cli config")
err = errors.New("target network of the L1 node does not match the wasp-cli config")
}
log.Check(err)