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

Geth v1.12.2 x #315

Closed
wants to merge 114 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
24ab727
params: begin v1.12.1 release cycle
holiman May 25, 2023
c7f4e88
core,console: replace noarg fmt.Errorf with errors.New (#27332)
jsvisa May 25, 2023
1109849
accounts: replace noarg fmt.Errorf with errors.New (#27331)
jsvisa May 25, 2023
e4ab9a4
eth/filters: retrieve logs in async (#27135)
jsvisa May 25, 2023
329101b
internal/ethapi: don't return header size from rpc (#27347)
jsvisa May 25, 2023
aaf7e30
eth: split api.go into namespace based files (#27263)
jsvisa May 29, 2023
febb687
internal/ethapi: add more testcases for block/header rpc (#27325)
jsvisa May 29, 2023
728dbdc
internal/ethapi: remove error return on RPCMarshalBlock (#27449)
hero5512 Jun 13, 2023
ee824ab
internal/ethapi, les: use slices package for sorting (#27492)
danlaine Jun 19, 2023
fb52282
internal/blocktest: add package for shared test code (#27270)
jsvisa Jul 11, 2023
e97e73a
internal/ethapi: add more testcase for GetTransactionReceipt (#27527)
jsvisa Jul 13, 2023
1049fd3
core/types: support yParity field in JSON transactions (#27744)
fjl Aug 4, 2023
1e9f84f
ethapi/internal: fix expecteds for coreth
darioush Aug 31, 2023
41b6650
eth: make debug_StorageRangeAt take a block hash or number (#27328)
jwasinger May 30, 2023
423faa7
les, eth: fix typo in comment (#27369)
ucwong May 30, 2023
82db92b
internal/ethapi: prevent unnecessary resource usage in eth_getProof i…
prestwich May 31, 2023
d180ce2
miner: suspend miner if node is syncing (#27218)
rjl493456442 May 31, 2023
f1d7a53
consensus, core, eth/downloader, params: 4844 chain validation (#27382)
karalabe May 31, 2023
a6e93a6
core, eth/downloader, params: validate blob tx bodies (#27392)
karalabe May 31, 2023
b160f72
core, eth/downloader: validate blobtx.To at serialization time (#27393)
karalabe May 31, 2023
d3024ed
core/state: move slot RLP encoding into the MPT implementation (#27000)
gballet Jun 1, 2023
a696fc7
core/state: mark account as dirty when resetObject occurs (#27339)
rjl493456442 Jun 1, 2023
d2ffb4c
core/state: clear out cached state data when reset occurs (#27376)
rjl493456442 Jun 5, 2023
f4a9962
fix issue in transaction_marshalling
darioush Aug 31, 2023
3d3b9d1
fix test
darioush Aug 31, 2023
bc3be38
core: 4844 opcode and precompile (#27356)
MariusVanDerWijden Jun 5, 2023
8c67578
go.mod: update kzg libraries to use big-endian (#27510)
MariusVanDerWijden Jun 19, 2023
71d5700
core/state/snapshot, core/types, eth: move account definition to type…
rjl493456442 Jun 6, 2023
000a9f0
core/txpool: fix minor flaw in isGapped check (#27404)
dkatzan Jun 6, 2023
0140726
core/txpool: make transaction validation reusable across packages (po…
karalabe Jun 6, 2023
0d00b8a
accounts/keystore: handle error for invalid key in DecryptKey (#27432)
ThreeAndTwo Jun 7, 2023
0b6902a
eth/filters: reuse handleLogs method for removed logs (#27438)
jsvisa Jun 8, 2023
ea51125
rpc: add limit for batch request items and response size (#26681)
mmsqe Jun 13, 2023
72f4813
core/types: add "chainID" field to legacy tx JSON encoding (#27452)
freeman-jiang Jun 13, 2023
d87f0e2
rpc: add method to test for subscription support (#25942)
zhiqiangxu Jun 14, 2023
e812a98
eth/tracers: refactor exporting js buffer (#27472)
s1na Jun 14, 2023
1c5f382
core: remove unnecessary log copy (#27475)
aaronbuchwald Jun 15, 2023
cdbf6ce
core/types: add support for BlobTxType receipts (#27470)
holiman Jun 15, 2023
06f4ed9
all: move main transaction pool into a subpool (#27463)
karalabe Jun 16, 2023
d8f60d9
core/txpool/legacypool: reheap the tx list if london fork not enabled…
lochjin Jun 18, 2023
17e554b
ethdb/dbtest: use slices package for sorting (#27491)
danlaine Jun 19, 2023
971e3e4
core/txpool/legacypool: remove redundant check for floatingRatio == 0…
hero5512 Jun 19, 2023
f37990b
core/txpool/legacypool: handle missing head in reset (#27479)
holiman Jun 19, 2023
3cb98db
accounts/keystore: use slices package for sorting (#27485)
danlaine Jun 19, 2023
9e8ff56
metrics: use slices package for sorting (#27493)
danlaine Jun 19, 2023
ad744bf
tests, trie: use slices package for sorting (#27496)
danlaine Jun 19, 2023
c603dbc
trie: remove parameter 'fromLevel' in Prove (#27512)
rjl493456442 Jun 19, 2023
b05dc35
core/txpool/legacypool: narrow down the scope of the variable (#27471)
hero5512 Jun 19, 2023
555604a
eth: use slices package for sorting (#27490)
danlaine Jun 19, 2023
3b2ee5e
core: use slices package for sorting (#27489)
danlaine Jun 20, 2023
810c01b
core/txpool: remove use of errors.Join function (#27523)
fjl Jun 20, 2023
2329c1d
internal/ethapi: use same state for each invocation within EstimateGa…
jwasinger Jun 20, 2023
cc4c4f8
all: update golang/x/ext and fix slice sorting fallout (#27909)
karalabe Aug 11, 2023
95dc9cc
fix
darioush Sep 1, 2023
fd5f916
cmd, core/state, eth, tests, trie: improve state reader (#27428)
rjl493456442 Jun 20, 2023
a2b7380
ethdb/pebble: fsync for batch writes (#27522)
holiman Jun 21, 2023
81f9629
internal/ethapi: quantity-encode storage keys in eth_getProof respons…
prestwich Jun 21, 2023
594788a
core/state, light, trie: add UpdateContractCode to the Trie interface…
gballet Jun 22, 2023
5e3cf47
ethdb/pebble: use sync mode for pebble writes (#27615)
rjl493456442 Jun 27, 2023
6242c7c
core/vm: move TSTORE,TLOAD to correct opcode nums (#27613)
MariusVanDerWijden Jun 27, 2023
2021bf3
core: log message if DeriveFields returns error (#27530)
aaronbuchwald Jun 27, 2023
6972d98
trie, core/state: revert error removal in (*state.Trie).Commit (#27544)
gballet Jun 27, 2023
c0e1b53
core/txpool/legacypool: fix typo (#27620)
hero5512 Jun 27, 2023
146c5fd
params, trie: add verkle fork management + upgrade go-verkle (#27464)
gballet Jun 28, 2023
eac0976
core/state, light, les: make signature of ContractCode hash-independe…
gballet Jun 28, 2023
440ae5e
node: fix listening on IPv6 address (#27628) (#27635)
oiooj Jul 2, 2023
e3e8806
ethdb/leveldb: update leveldb metrics collection (#27643)
Exca-DK Jul 5, 2023
6474ccb
core: remove outdated tests (#27662)
holiman Jul 6, 2023
8dffc0f
miner: remove unused commented code (#27664)
jwasinger Jul 7, 2023
4254aca
core/vm: define cancun + enable 1153 (tstore/tload) in cancun (#27663)
holiman Jul 10, 2023
cb384ec
core/vm: implement EIP-5656, mcopy instruction (#26181)
charles-cooper Jul 11, 2023
a77c1f4
core/state: value diff tracking in StateDB (#27349)
rjl493456442 Jul 11, 2023
06c91da
accounts, cmd/evm: fix docstrings (#27703)
cuishuang Jul 12, 2023
9d4c696
eth, miner: rm redundant type declare (#27713)
jsvisa Jul 13, 2023
15d15d2
internal: early exit if tx for getTxReceipt not found (#27712)
jsvisa Jul 13, 2023
59922e2
eth/tracers: add ReturnData in the tracer's response (#27704)
jsvisa Jul 13, 2023
bdca8eb
eth/tracers/native: panic on memory read in prestateTracer (#27691)
ryanschneider Jul 13, 2023
6387024
go.sum: go mod tidy (#27717)
ucwong Jul 13, 2023
a5c5a9c
metrics: NilTimer should still run the function to be timed (#27723)
omerfirmak Jul 14, 2023
8a251cb
metrics: NilResettingTimer.Time should execute the timed function (#2…
omerfirmak Jul 14, 2023
526b581
accounts/abi/bind/backends: fix goroutine leak in unit test (#27705)
yuriechan Jul 15, 2023
ddfbfd1
core: replace instances of 'suicide' with 'selfdestruct' to improve c…
jwasinger Jul 15, 2023
a95b03c
core/vm: use types.EmptyCodeHash (#27729)
ucwong Jul 15, 2023
e0e898e
core, tests: EIP-4844 transaction processing logic (#27721)
holiman Jul 15, 2023
39d8bef
core/state, core/vm: implement EIP 6780 (#27189)
jwasinger Jul 17, 2023
27e517d
all: expose block number information to statedb (#27753)
rjl493456442 Jul 24, 2023
4c73be5
core/types: deepcopy ExcessDataGas, DataGasUsed (#27767)
darioush Jul 27, 2023
b2b733b
core/types: add 4844 data gas fields in Receipt (#27743)
fjl Jul 27, 2023
99213b2
all: rename dataGas to blobGas (#27789)
karalabe Jul 27, 2023
0187299
core/types: put header fields in correct order (#27791)
MariusVanDerWijden Jul 27, 2023
fe5fd8e
core/types: fix receipt blob fields marshaling (#27793)
marioevz Jul 28, 2023
55ceeae
core: remove pointless check for excessBlobGas nilness (#27797)
jsvisa Jul 31, 2023
84cf073
core, trie: track state change set with account address (#27815)
rjl493456442 Jul 31, 2023
6b551a3
all: replace data gas to blob gas in comments (#27825)
jsvisa Aug 1, 2023
0a544c0
all: implement path-based state scheme (#25963)
rjl493456442 Aug 1, 2023
1120aaf
unused
darioush Sep 6, 2023
58a536c
core/types: fix immutability guarantees in Block (#27844)
fjl Aug 4, 2023
7cf75fc
all: remove trailing whitespace (#27741)
darioush Aug 4, 2023
50a1f4e
accounts: use atomic type (#27857)
ucwong Aug 7, 2023
c12947e
internal/ethapi: add state override to estimateGas (#27845)
amintalebi Aug 7, 2023
26b939d
core/vm: update 4844 - point evaluation precompile address (#27874)
holiman Aug 8, 2023
fb8cdb7
core/state: move UpdateContractCode before the trie hash is computed …
gballet Aug 9, 2023
dc852f4
params: release go-ethereum v1.12.1
fjl Aug 10, 2023
f02b77e
params: begin v1.12.2 release cycle
fjl Aug 10, 2023
210c4e7
ethdb/leveldb: support more than 7 levels in metrics (#27904)
jsvisa Aug 11, 2023
d4fa9fe
params: release go-ethereum v1.12.2
fjl Aug 12, 2023
df617bd
temporary workaround to fix flaky test for CI
darioush Sep 7, 2023
90dc48d
debugging CI
darioush Sep 7, 2023
481f258
txpool: ensure sub is started during init
darioush Sep 7, 2023
1b71b68
remove .rej, undo timeout change
darioush Sep 7, 2023
3f21c13
add headers
darioush Sep 7, 2023
858e275
add missing commit 0e5d2c7c534a2abe9db55a0323451282749b101c
darioush Sep 13, 2023
e83bb98
core/state/snapshot, core/types, eth: move account definition to type…
darioush Sep 13, 2023
e08788d
workaround for async sub txpool
darioush Sep 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion accounts/abi/bind/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
var (
// ErrNoCode is returned by call and transact operations for which the requested
// recipient contract to operate on does not exist in the state db or does not
// have any code associated with it (i.e. suicided).
// have any code associated with it (i.e. self-destructed).
ErrNoCode = errors.New("no contract code at given address")

// ErrNoAcceptedState is raised when attempting to perform a accepted state action
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ func (b *SimulatedBackend) AdjustTime(adjustment time.Duration) error {
}
block := b.blockchain.GetBlockByHash(b.acceptedBlock.ParentHash())
if block == nil {
return fmt.Errorf("could not find parent")
return errors.New("could not find parent")
}

blocks, _, _ := core.GenerateChain(b.config, block, dummy.NewFaker(), b.database, 1, 10, func(number int, block *core.BlockGen) {
Expand Down
1 change: 1 addition & 0 deletions accounts/abi/bind/backends/simulated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func TestAdjustTime(t *testing.T) {
func TestNewAdjustTimeFail(t *testing.T) {
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
sim := simTestBackend(testAddr)
defer sim.blockchain.Stop()

// Create tx and send
head, _ := sim.HeaderByNumber(context.Background(), nil) // Should be child's, good enough
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type Error struct {
str string

// Sig contains the string signature according to the ABI spec.
// e.g. error foo(uint32 a, int b) = "foo(uint32,int256)"
// e.g. error foo(uint32 a, int b) = "foo(uint32,int256)"
// Please note that "int" is substitute for its canonical representation "int256"
Sig string

Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func mapArgNamesToStructFields(argNames []string, value reflect.Value) (map[stri
structFieldName := ToCamelCase(argName)

if structFieldName == "" {
return nil, fmt.Errorf("abi: purely underscored output cannot unpack to struct")
return nil, errors.New("abi: purely underscored output cannot unpack to struct")
}

// this abi has already been paired, skip it... unless there exists another, yet unassigned
Expand Down
6 changes: 3 additions & 3 deletions accounts/abi/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var (
func NewType(t string, internalType string, components []ArgumentMarshaling) (typ Type, err error) {
// check that array brackets are equal if they exist
if strings.Count(t, "[") != strings.Count(t, "]") {
return Type{}, fmt.Errorf("invalid arg type in abi")
return Type{}, errors.New("invalid arg type in abi")
}
typ.stringKind = t

Expand Down Expand Up @@ -119,7 +119,7 @@ func NewType(t string, internalType string, components []ArgumentMarshaling) (ty
}
typ.stringKind = embeddedType.stringKind + sliced
} else {
return Type{}, fmt.Errorf("invalid formatting of array type")
return Type{}, errors.New("invalid formatting of array type")
}
return typ, err
}
Expand Down Expand Up @@ -358,7 +358,7 @@ func (t Type) pack(v reflect.Value) ([]byte, error) {
}
}

// requireLengthPrefix returns whether the type requires any sort of length
// requiresLengthPrefix returns whether the type requires any sort of length
// prefixing.
func (t Type) requiresLengthPrefix() bool {
return t.T == StringTy || t.T == BytesTy || t.T == SliceTy
Expand Down
7 changes: 4 additions & 3 deletions accounts/abi/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ package abi

import (
"encoding/binary"
"errors"
"fmt"
"math"
"math/big"
Expand Down Expand Up @@ -135,7 +136,7 @@ func readBool(word []byte) (bool, error) {
// readFunctionType enforces that standard by always presenting it as a 24-array (address + sig = 24 bytes)
func readFunctionType(t Type, word []byte) (funcTy [24]byte, err error) {
if t.T != FunctionTy {
return [24]byte{}, fmt.Errorf("abi: invalid type in call to make function type byte array")
return [24]byte{}, errors.New("abi: invalid type in call to make function type byte array")
}
if garbage := binary.BigEndian.Uint64(word[24:32]); garbage != 0 {
err = fmt.Errorf("abi: got improperly encoded function type, got %v", word)
Expand All @@ -148,7 +149,7 @@ func readFunctionType(t Type, word []byte) (funcTy [24]byte, err error) {
// ReadFixedBytes uses reflection to create a fixed array to be read from.
func ReadFixedBytes(t Type, word []byte) (interface{}, error) {
if t.T != FixedBytesTy {
return nil, fmt.Errorf("abi: invalid type in call to make fixed byte array")
return nil, errors.New("abi: invalid type in call to make fixed byte array")
}
// convert
array := reflect.New(t.GetType()).Elem()
Expand Down Expand Up @@ -176,7 +177,7 @@ func forEachUnpack(t Type, output []byte, start, size int) (interface{}, error)
// declare our array
refSlice = reflect.New(t.GetType()).Elem()
} else {
return nil, fmt.Errorf("abi: invalid type in array/slice unpacking stage")
return nil, errors.New("abi: invalid type in array/slice unpacking stage")
}

// Arrays have packed elements, resulting in longer unpack steps.
Expand Down
13 changes: 7 additions & 6 deletions accounts/external/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
package external

import (
"errors"
"fmt"
"math/big"
"sync"
Expand Down Expand Up @@ -108,11 +109,11 @@ func (api *ExternalSigner) Status() (string, error) {
}

func (api *ExternalSigner) Open(passphrase string) error {
return fmt.Errorf("operation not supported on external signers")
return errors.New("operation not supported on external signers")
}

func (api *ExternalSigner) Close() error {
return fmt.Errorf("operation not supported on external signers")
return errors.New("operation not supported on external signers")
}

func (api *ExternalSigner) Accounts() []accounts.Account {
Expand Down Expand Up @@ -155,7 +156,7 @@ func (api *ExternalSigner) Contains(account accounts.Account) bool {
}

func (api *ExternalSigner) Derive(path accounts.DerivationPath, pin bool) (accounts.Account, error) {
return accounts.Account{}, fmt.Errorf("operation not supported on external signers")
return accounts.Account{}, errors.New("operation not supported on external signers")
}

func (api *ExternalSigner) SelfDerive(bases []accounts.DerivationPath, chain interfaces.ChainStateReader) {
Expand Down Expand Up @@ -252,14 +253,14 @@ func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transactio
}

func (api *ExternalSigner) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) {
return []byte{}, fmt.Errorf("password-operations not supported on external signers")
return []byte{}, errors.New("password-operations not supported on external signers")
}

func (api *ExternalSigner) SignTxWithPassphrase(account accounts.Account, passphrase string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
return nil, fmt.Errorf("password-operations not supported on external signers")
return nil, errors.New("password-operations not supported on external signers")
}
func (api *ExternalSigner) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error) {
return nil, fmt.Errorf("password-operations not supported on external signers")
return nil, errors.New("password-operations not supported on external signers")
}

func (api *ExternalSigner) listAccounts() ([]common.Address, error) {
Expand Down
14 changes: 7 additions & 7 deletions accounts/keystore/account_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ import (
mapset "github.com/deckarep/golang-set/v2"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"golang.org/x/exp/slices"
)

// Minimum amount of time between cache reloads. This limit applies if the platform does
// not support change notifications. It also applies if the keystore directory does not
// exist yet, the code will attempt to create a watcher at most this often.
const minReloadInterval = 2 * time.Second

type accountsByURL []accounts.Account

func (s accountsByURL) Len() int { return len(s) }
func (s accountsByURL) Less(i, j int) bool { return s[i].URL.Cmp(s[j].URL) < 0 }
func (s accountsByURL) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
// byURL defines the sorting order for accounts.
func byURL(a, b accounts.Account) int {
return a.URL.Cmp(b.URL)
}

// AmbiguousAddrError is returned when attempting to unlock
// an address for which more than one file exists.
Expand All @@ -77,7 +77,7 @@ type accountCache struct {
keydir string
watcher *watcher
mu sync.Mutex
all accountsByURL
all []accounts.Account
byAddr map[common.Address][]accounts.Account
throttle *time.Timer
notify chan struct{}
Expand Down Expand Up @@ -204,7 +204,7 @@ func (ac *accountCache) find(a accounts.Account) (accounts.Account, error) {
default:
err := &AmbiguousAddrError{Addr: a.Address, Matches: make([]accounts.Account, len(matches))}
copy(err.Matches, matches)
sort.Sort(accountsByURL(err.Matches))
slices.SortFunc(err.Matches, byURL)
return accounts.Account{}, err
}
}
Expand Down
7 changes: 4 additions & 3 deletions accounts/keystore/account_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@
package keystore

import (
"errors"
"fmt"
"math/rand"
"os"
"path/filepath"
"reflect"
"sort"
"testing"
"time"

"github.com/ava-labs/coreth/accounts"
"github.com/cespare/cp"
"github.com/davecgh/go-spew/spew"
"github.com/ethereum/go-ethereum/common"
"golang.org/x/exp/slices"
)

var (
Expand Down Expand Up @@ -84,7 +85,7 @@ func waitForAccounts(wantAccounts []accounts.Account, ks *KeyStore) error {
select {
case <-ks.changes:
default:
return fmt.Errorf("wasn't notified of new accounts")
return errors.New("wasn't notified of new accounts")
}
return nil
}
Expand Down Expand Up @@ -212,7 +213,7 @@ func TestCacheAddDeleteOrder(t *testing.T) {
// Check that the account list is sorted by filename.
wantAccounts := make([]accounts.Account, len(accs))
copy(wantAccounts, accs)
sort.Sort(accountsByURL(wantAccounts))
slices.SortFunc(wantAccounts, byURL)
list := cache.accounts()
if !reflect.DeepEqual(list, wantAccounts) {
t.Fatalf("got accounts: %s\nwant %s", spew.Sdump(accs), spew.Sdump(wantAccounts))
Expand Down
10 changes: 5 additions & 5 deletions accounts/keystore/keystore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"math/rand"
"os"
"runtime"
"sort"
"strings"
"sync"
"sync/atomic"
Expand All @@ -41,6 +40,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/event"
"golang.org/x/exp/slices"
)

var testSigData = make([]byte, 32)
Expand Down Expand Up @@ -410,19 +410,19 @@ func TestImportRace(t *testing.T) {
t.Fatalf("failed to export account: %v", acc)
}
_, ks2 := tmpKeyStore(t, true)
var atom uint32
var atom atomic.Uint32
var wg sync.WaitGroup
wg.Add(2)
for i := 0; i < 2; i++ {
go func() {
defer wg.Done()
if _, err := ks2.Import(json, "new", "new"); err != nil {
atomic.AddUint32(&atom, 1)
atom.Add(1)
}
}()
}
wg.Wait()
if atom != 1 {
if atom.Load() != 1 {
t.Errorf("Import is racy")
}
}
Expand All @@ -437,7 +437,7 @@ func checkAccounts(t *testing.T, live map[common.Address]accounts.Account, walle
for _, account := range live {
liveList = append(liveList, account)
}
sort.Sort(accountsByURL(liveList))
slices.SortFunc(liveList, byURL)
for j, wallet := range wallets {
if accs := wallet.Accounts(); len(accs) != 1 {
t.Errorf("wallet %d: contains invalid number of accounts: have %d, want 1", j, len(accs))
Expand Down
7 changes: 5 additions & 2 deletions accounts/keystore/passphrase.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,13 @@ func DecryptKey(keyjson []byte, auth string) (*Key, error) {
if err != nil {
return nil, err
}
key := crypto.ToECDSAUnsafe(keyBytes)
key, err := crypto.ToECDSA(keyBytes)
if err != nil {
return nil, fmt.Errorf("invalid key: %w", err)
}
id, err := uuid.FromBytes(keyId)
if err != nil {
return nil, err
return nil, fmt.Errorf("invalid UUID: %w", err)
}
return &Key{
Id: id,
Expand Down
11 changes: 6 additions & 5 deletions accounts/scwallet/securechannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"crypto/rand"
"crypto/sha256"
"crypto/sha512"
"errors"
"fmt"

"github.com/ethereum/go-ethereum/crypto"
Expand Down Expand Up @@ -135,7 +136,7 @@ func (s *SecureChannelSession) Pair(pairingPassword []byte) error {
// Unpair disestablishes an existing pairing.
func (s *SecureChannelSession) Unpair() error {
if s.PairingKey == nil {
return fmt.Errorf("cannot unpair: not paired")
return errors.New("cannot unpair: not paired")
}

_, err := s.transmitEncrypted(claSCWallet, insUnpair, s.PairingIndex, 0, []byte{})
Expand All @@ -151,7 +152,7 @@ func (s *SecureChannelSession) Unpair() error {
// Open initializes the secure channel.
func (s *SecureChannelSession) Open() error {
if s.iv != nil {
return fmt.Errorf("session already opened")
return errors.New("session already opened")
}

response, err := s.open()
Expand Down Expand Up @@ -225,7 +226,7 @@ func (s *SecureChannelSession) pair(p1 uint8, data []byte) (*responseAPDU, error
// transmitEncrypted sends an encrypted message, and decrypts and returns the response.
func (s *SecureChannelSession) transmitEncrypted(cla, ins, p1, p2 byte, data []byte) (*responseAPDU, error) {
if s.iv == nil {
return nil, fmt.Errorf("channel not open")
return nil, errors.New("channel not open")
}

data, err := s.encryptAPDU(data)
Expand Down Expand Up @@ -264,7 +265,7 @@ func (s *SecureChannelSession) transmitEncrypted(cla, ins, p1, p2 byte, data []b
return nil, err
}
if !bytes.Equal(s.iv, rmac) {
return nil, fmt.Errorf("invalid MAC in response")
return nil, errors.New("invalid MAC in response")
}

rapdu := &responseAPDU{}
Expand Down Expand Up @@ -329,7 +330,7 @@ func unpad(data []byte, terminator byte) ([]byte, error) {
return nil, fmt.Errorf("expected end of padding, got %d", data[len(data)-i])
}
}
return nil, fmt.Errorf("expected end of padding, got 0")
return nil, errors.New("expected end of padding, got 0")
}

// updateIV is an internal method that updates the initialization vector after
Expand Down
6 changes: 3 additions & 3 deletions accounts/scwallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (w *Wallet) release() error {
// with the wallet.
func (w *Wallet) pair(puk []byte) error {
if w.session.paired() {
return fmt.Errorf("wallet already paired")
return errors.New("wallet already paired")
}
pairing, err := w.session.pair(puk)
if err != nil {
Expand Down Expand Up @@ -823,7 +823,7 @@ func (s *Session) pair(secret []byte) (smartcardPairing, error) {
// unpair deletes an existing pairing.
func (s *Session) unpair() error {
if !s.verified {
return fmt.Errorf("unpair requires that the PIN be verified")
return errors.New("unpair requires that the PIN be verified")
}
return s.Channel.Unpair()
}
Expand Down Expand Up @@ -917,7 +917,7 @@ func (s *Session) initialize(seed []byte) error {
return err
}
if status == "Online" {
return fmt.Errorf("card is already initialized, cowardly refusing to proceed")
return errors.New("card is already initialized, cowardly refusing to proceed")
}

s.Wallet.lock.Lock()
Expand Down