This commit is contained in:
Guillaume Ballet 2026-05-21 21:11:54 +02:00 committed by GitHub
commit b0599c3797
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 86 additions and 86 deletions

View file

@ -329,7 +329,7 @@ func TestContractLinking(t *testing.T) {
map[rune]struct{}{}, map[rune]struct{}{},
}, },
// two contracts ('a' and 'f') share some dependencies. contract 'a' is marked as an override. expect that any of // two contracts ('a' and 'f') share some dependencies. contract 'a' is marked as an override. expect that any of
// its depdencies that aren't shared with 'f' are not deployed. // its dependencies that aren't shared with 'f' are not deployed.
linkTestCaseInput{map[rune][]rune{ linkTestCaseInput{map[rune][]rune{
'a': {'b', 'c', 'd', 'e'}, 'a': {'b', 'c', 'd', 'e'},
'f': {'g', 'c', 'd', 'h'}}, 'f': {'g', 'c', 'd', 'h'}},

View file

@ -852,9 +852,9 @@ func doDockerBuildx(cmdline []string) {
pass := getenvBase64("DOCKER_HUB_PASSWORD") pass := getenvBase64("DOCKER_HUB_PASSWORD")
if len(user) > 0 && len(pass) > 0 { if len(user) > 0 && len(pass) > 0 {
auther := exec.Command("docker", "login", "-u", string(user), "--password-stdin") author := exec.Command("docker", "login", "-u", string(user), "--password-stdin")
auther.Stdin = bytes.NewReader(pass) author.Stdin = bytes.NewReader(pass)
build.MustRun(auther) build.MustRun(author)
} }
// Retrieve the version infos to build and push to the following paths: // Retrieve the version infos to build and push to the following paths:
// - ethereum/client-go:latest - Pushes to the master branch, Geth only // - ethereum/client-go:latest - Pushes to the master branch, Geth only

View file

@ -338,7 +338,7 @@ func (s *Suite) checkHeadersAgainstChain(req *eth.GetBlockHeadersPacket, resp *e
} }
// collectResponses waits for n messages of type T on the given connection. // collectResponses waits for n messages of type T on the given connection.
// The messsages are collected according to the 'identity' function. // The messages are collected according to the 'identity' function.
// //
// This function is written in a generic way to handle // This function is written in a generic way to handle
func collectHeaderResponses(conn *Conn, n int, identity func(*eth.BlockHeadersPacket) uint64) (map[uint64]*eth.BlockHeadersPacket, error) { func collectHeaderResponses(conn *Conn, n int, identity func(*eth.BlockHeadersPacket) uint64) (map[uint64]*eth.BlockHeadersPacket, error) {
@ -665,7 +665,7 @@ func (s *Suite) TestBlockRangeUpdateInvalid(t *utesting.T) {
func (s *Suite) TestBlockRangeUpdateFuture(t *utesting.T) { func (s *Suite) TestBlockRangeUpdateFuture(t *utesting.T) {
t.Log(`This test sends a BlockRangeUpdate that is beyond the chain head. t.Log(`This test sends a BlockRangeUpdate that is beyond the chain head.
The node should accept the update and should not disonnect.`) The node should accept the update and should not disconnect.`)
conn, err := s.dialAndPeer(nil) conn, err := s.dialAndPeer(nil)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@ -701,7 +701,7 @@ The node should accept the update and should not disonnect.`)
func (s *Suite) TestBlockRangeUpdateHistoryExp(t *utesting.T) { func (s *Suite) TestBlockRangeUpdateHistoryExp(t *utesting.T) {
t.Log(`This test sends a BlockRangeUpdate announcing incomplete (expired) history. t.Log(`This test sends a BlockRangeUpdate announcing incomplete (expired) history.
The node should accept the update and should not disonnect.`) The node should accept the update and should not disconnect.`)
conn, err := s.dialAndPeer(nil) conn, err := s.dialAndPeer(nil)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View file

@ -4412,9 +4412,9 @@ func testInsertChainWithCutoff(t *testing.T, cutoff uint64, ancientLimit uint64,
if receipts == nil || len(receipts) != 1 { if receipts == nil || len(receipts) != 1 {
t.Fatalf("Missed block receipts: %d, cutoff: %d", num, cutoffBlock.NumberU64()) t.Fatalf("Missed block receipts: %d, cutoff: %d", num, cutoffBlock.NumberU64())
} }
for indx, receipt := range receipts { for index, receipt := range receipts {
receiptByLookup, err := chain.GetCanonicalReceipt(body.Transactions[indx], receipt.BlockHash, receiptByLookup, err := chain.GetCanonicalReceipt(body.Transactions[index], receipt.BlockHash,
receipt.BlockNumber.Uint64(), uint64(indx)) receipt.BlockNumber.Uint64(), uint64(index))
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, receipt, receiptByLookup) assert.Equal(t, receipt, receiptByLookup)
} }

View file

@ -119,7 +119,7 @@ func TestDAOForkRangeExtradata(t *testing.T) {
t.Fatalf("pro-fork chain didn't accepted pro-fork block: %v", err) t.Fatalf("pro-fork chain didn't accepted pro-fork block: %v", err)
} }
} }
// Verify that contra-forkers accept pro-fork extra-datas after forking finishes // Verify that contra-forkers accept pro-fork extra-data after forking finishes
bc, _ := NewBlockChain(rawdb.NewMemoryDatabase(), congspec, ethash.NewFaker(), nil) bc, _ := NewBlockChain(rawdb.NewMemoryDatabase(), congspec, ethash.NewFaker(), nil)
defer bc.Stop() defer bc.Stop()
@ -137,7 +137,7 @@ func TestDAOForkRangeExtradata(t *testing.T) {
if _, err := conBc.InsertChain(blocks); err != nil { if _, err := conBc.InsertChain(blocks); err != nil {
t.Fatalf("contra-fork chain didn't accept pro-fork block post-fork: %v", err) t.Fatalf("contra-fork chain didn't accept pro-fork block post-fork: %v", err)
} }
// Verify that pro-forkers accept contra-fork extra-datas after forking finishes // Verify that pro-forkers accept contra-fork extra-data after forking finishes
bc, _ = NewBlockChain(rawdb.NewMemoryDatabase(), progspec, ethash.NewFaker(), nil) bc, _ = NewBlockChain(rawdb.NewMemoryDatabase(), progspec, ethash.NewFaker(), nil)
defer bc.Stop() defer bc.Stop()

View file

@ -445,7 +445,7 @@ func (m *singleMatcherInstance) cleanMapIndices() {
m.mapIndices = m.mapIndices[:j] m.mapIndices = m.mapIndices[:j]
} }
// matchAny combinines a set of matchers and returns a match for every position // matchAny combines a set of matchers and returns a match for every position
// where any of the underlying matchers signaled a match. A zero-length matchAny // where any of the underlying matchers signaled a match. A zero-length matchAny
// acts as a "wild card" that signals a potential match at every position. // acts as a "wild card" that signals a potential match at every position.
type matchAny []matcher type matchAny []matcher

View file

@ -563,7 +563,7 @@ func DeleteBlockLvPointers(db ethdb.KeyValueStore, blocks common.Range[uint64],
} }
// FilterMapsRange is a storage representation of the block range covered by the // FilterMapsRange is a storage representation of the block range covered by the
// filter maps structure and the corresponting log value index range. // filter maps structure and the corresponding log value index range.
type FilterMapsRange struct { type FilterMapsRange struct {
Version uint32 Version uint32
HeadIndexed bool HeadIndexed bool

View file

@ -746,7 +746,7 @@ func ReadChainMetadata(db ethdb.KeyValueStore) [][]string {
// is periodically called and if it returns an error then SafeDeleteRange // is periodically called and if it returns an error then SafeDeleteRange
// stops and also returns that error. The callback is not called if native // stops and also returns that error. The callback is not called if native
// range delete is used or there are a small number of keys only. The bool // range delete is used or there are a small number of keys only. The bool
// argument passed to the callback is true if enrties have actually been // argument passed to the callback is true if entries have actually been
// deleted already. // deleted already.
func SafeDeleteRange(db ethdb.KeyValueStore, start, end []byte, hashScheme bool, stopCallback func(bool) bool) error { func SafeDeleteRange(db ethdb.KeyValueStore, start, end []byte, hashScheme bool, stopCallback func(bool) bool) error {
if !hashScheme { if !hashScheme {

View file

@ -280,7 +280,7 @@ func (dl *diffLayer) accountRLP(hash common.Hash, depth int) ([]byte, error) {
if n := len(data); n > 0 { if n := len(data); n > 0 {
snapshotDirtyAccountReadMeter.Mark(int64(n)) snapshotDirtyAccountReadMeter.Mark(int64(n))
} else { } else {
snapshotDirtyAccountInexMeter.Mark(1) snapshotDirtyAccountIndexMeter.Mark(1)
} }
snapshotBloomAccountTrueHitMeter.Mark(1) snapshotBloomAccountTrueHitMeter.Mark(1)
return data, nil return data, nil
@ -345,7 +345,7 @@ func (dl *diffLayer) storage(accountHash, storageHash common.Hash, depth int) ([
if n := len(data); n > 0 { if n := len(data); n > 0 {
snapshotDirtyStorageReadMeter.Mark(int64(n)) snapshotDirtyStorageReadMeter.Mark(int64(n))
} else { } else {
snapshotDirtyStorageInexMeter.Mark(1) snapshotDirtyStorageIndexMeter.Mark(1)
} }
snapshotBloomStorageTrueHitMeter.Mark(1) snapshotBloomStorageTrueHitMeter.Mark(1)
return data, nil return data, nil

View file

@ -132,7 +132,7 @@ func (dl *diskLayer) AccountRLP(hash common.Hash) ([]byte, error) {
if n := len(blob); n > 0 { if n := len(blob); n > 0 {
snapshotCleanAccountWriteMeter.Mark(int64(n)) snapshotCleanAccountWriteMeter.Mark(int64(n))
} else { } else {
snapshotCleanAccountInexMeter.Mark(1) snapshotCleanAccountIndexMeter.Mark(1)
} }
return blob, nil return blob, nil
} }
@ -172,7 +172,7 @@ func (dl *diskLayer) Storage(accountHash, storageHash common.Hash) ([]byte, erro
if n := len(blob); n > 0 { if n := len(blob); n > 0 {
snapshotCleanStorageWriteMeter.Mark(int64(n)) snapshotCleanStorageWriteMeter.Mark(int64(n))
} else { } else {
snapshotCleanStorageInexMeter.Mark(1) snapshotCleanStorageIndexMeter.Mark(1)
} }
return blob, nil return blob, nil
} }

View file

@ -721,7 +721,7 @@ func testGenerateWithExtraBeforeAndAfter(t *testing.T, scheme string) {
<-stop <-stop
} }
// TestGenerateWithMalformedSnapdata tests what happes if we have some junk // TestGenerateWithMalformedSnapdata tests what happens if we have some junk
// in the snapshot database, which cannot be parsed back to an account // in the snapshot database, which cannot be parsed back to an account
func TestGenerateWithMalformedSnapdata(t *testing.T) { func TestGenerateWithMalformedSnapdata(t *testing.T) {
testGenerateWithMalformedSnapdata(t, rawdb.HashScheme) testGenerateWithMalformedSnapdata(t, rawdb.HashScheme)

View file

@ -89,7 +89,7 @@ func (dl *diffLayer) AccountIterator(seek common.Hash) AccountIterator {
index := sort.Search(len(hashes), func(i int) bool { index := sort.Search(len(hashes), func(i int) bool {
return bytes.Compare(seek[:], hashes[i][:]) <= 0 return bytes.Compare(seek[:], hashes[i][:]) <= 0
}) })
// Assemble and returned the already seeked iterator // Assemble and returned the already sought iterator
return &diffAccountIterator{ return &diffAccountIterator{
layer: dl, layer: dl,
keys: hashes[index:], keys: hashes[index:],
@ -252,7 +252,7 @@ func (dl *diffLayer) StorageIterator(account common.Hash, seek common.Hash) Stor
index := sort.Search(len(hashes), func(i int) bool { index := sort.Search(len(hashes), func(i int) bool {
return bytes.Compare(seek[:], hashes[i][:]) <= 0 return bytes.Compare(seek[:], hashes[i][:]) <= 0
}) })
// Assemble and returned the already seeked iterator // Assemble and returned the already sought iterator
return &diffStorageIterator{ return &diffStorageIterator{
layer: dl, layer: dl,
account: account, account: account,

View file

@ -36,25 +36,25 @@ import (
var ( var (
snapshotCleanAccountHitMeter = metrics.NewRegisteredMeter("state/snapshot/clean/account/hit", nil) snapshotCleanAccountHitMeter = metrics.NewRegisteredMeter("state/snapshot/clean/account/hit", nil)
snapshotCleanAccountMissMeter = metrics.NewRegisteredMeter("state/snapshot/clean/account/miss", nil) snapshotCleanAccountMissMeter = metrics.NewRegisteredMeter("state/snapshot/clean/account/miss", nil)
snapshotCleanAccountInexMeter = metrics.NewRegisteredMeter("state/snapshot/clean/account/inex", nil) snapshotCleanAccountIndexMeter = metrics.NewRegisteredMeter("state/snapshot/clean/account/inex", nil)
snapshotCleanAccountReadMeter = metrics.NewRegisteredMeter("state/snapshot/clean/account/read", nil) snapshotCleanAccountReadMeter = metrics.NewRegisteredMeter("state/snapshot/clean/account/read", nil)
snapshotCleanAccountWriteMeter = metrics.NewRegisteredMeter("state/snapshot/clean/account/write", nil) snapshotCleanAccountWriteMeter = metrics.NewRegisteredMeter("state/snapshot/clean/account/write", nil)
snapshotCleanStorageHitMeter = metrics.NewRegisteredMeter("state/snapshot/clean/storage/hit", nil) snapshotCleanStorageHitMeter = metrics.NewRegisteredMeter("state/snapshot/clean/storage/hit", nil)
snapshotCleanStorageMissMeter = metrics.NewRegisteredMeter("state/snapshot/clean/storage/miss", nil) snapshotCleanStorageMissMeter = metrics.NewRegisteredMeter("state/snapshot/clean/storage/miss", nil)
snapshotCleanStorageInexMeter = metrics.NewRegisteredMeter("state/snapshot/clean/storage/inex", nil) snapshotCleanStorageIndexMeter = metrics.NewRegisteredMeter("state/snapshot/clean/storage/inex", nil)
snapshotCleanStorageReadMeter = metrics.NewRegisteredMeter("state/snapshot/clean/storage/read", nil) snapshotCleanStorageReadMeter = metrics.NewRegisteredMeter("state/snapshot/clean/storage/read", nil)
snapshotCleanStorageWriteMeter = metrics.NewRegisteredMeter("state/snapshot/clean/storage/write", nil) snapshotCleanStorageWriteMeter = metrics.NewRegisteredMeter("state/snapshot/clean/storage/write", nil)
snapshotDirtyAccountHitMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/account/hit", nil) snapshotDirtyAccountHitMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/account/hit", nil)
snapshotDirtyAccountMissMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/account/miss", nil) snapshotDirtyAccountMissMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/account/miss", nil)
snapshotDirtyAccountInexMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/account/inex", nil) snapshotDirtyAccountIndexMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/account/inex", nil)
snapshotDirtyAccountReadMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/account/read", nil) snapshotDirtyAccountReadMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/account/read", nil)
snapshotDirtyAccountWriteMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/account/write", nil) snapshotDirtyAccountWriteMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/account/write", nil)
snapshotDirtyStorageHitMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/storage/hit", nil) snapshotDirtyStorageHitMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/storage/hit", nil)
snapshotDirtyStorageMissMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/storage/miss", nil) snapshotDirtyStorageMissMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/storage/miss", nil)
snapshotDirtyStorageInexMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/storage/inex", nil) snapshotDirtyStorageIndexMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/storage/inex", nil)
snapshotDirtyStorageReadMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/storage/read", nil) snapshotDirtyStorageReadMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/storage/read", nil)
snapshotDirtyStorageWriteMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/storage/write", nil) snapshotDirtyStorageWriteMeter = metrics.NewRegisteredMeter("state/snapshot/dirty/storage/write", nil)

View file

@ -728,7 +728,7 @@ func (st *stateTransition) validateAuthorization(auth *types.SetCodeAuthorizatio
return authority, fmt.Errorf("%w: %v", ErrAuthorizationInvalidSignature, err) return authority, fmt.Errorf("%w: %v", ErrAuthorizationInvalidSignature, err)
} }
// Check the authority account // Check the authority account
// 1) doesn't have code or has exisiting delegation // 1) doesn't have code or has existing delegation
// 2) matches the auth's nonce // 2) matches the auth's nonce
// //
// Note it is added to the access list even if the authorization is invalid. // Note it is added to the access list even if the authorization is invalid.

View file

@ -38,7 +38,7 @@ import (
// need the other side to explicitly check. // need the other side to explicitly check.
// //
// This method is a bit of a sore thumb here, but: // This method is a bit of a sore thumb here, but:
// - It cannot be placed in core/stateless, because state.New prodces a circular dep // - It cannot be placed in core/stateless, because state.New produces a circular dep
// - It cannot be placed outside of core, because it needs to construct a dud headerchain // - It cannot be placed outside of core, because it needs to construct a dud headerchain
// //
// TODO(karalabe): Would be nice to resolve both issues above somehow and move it. // TODO(karalabe): Would be nice to resolve both issues above somehow and move it.

View file

@ -107,7 +107,7 @@ const (
// notifyThreshold is the eviction priority threshold above which a transaction // notifyThreshold is the eviction priority threshold above which a transaction
// is considered close enough to being includable to be announced to peers. // is considered close enough to being includable to be announced to peers.
// Setting this to zero will disable announcements for anyting not immediately // Setting this to zero will disable announcements for anything not immediately
// includable. Setting it to -1 allows transactions that are close to being // includable. Setting it to -1 allows transactions that are close to being
// includable, maybe already in the next block if fees go down, to be announced. // includable, maybe already in the next block if fees go down, to be announced.
@ -1909,7 +1909,7 @@ func (p *BlobPool) addLocked(tx *types.Transaction, checkGapped bool) (err error
addValidMeter.Mark(1) addValidMeter.Mark(1)
// Transaction was addded successfully, but we only announce if it is (close to being) // Transaction was added successfully, but we only announce if it is (close to being)
// includable and the previous one was already announced. // includable and the previous one was already announced.
if p.isAnnouncable(meta) && (meta.nonce == next || (len(txs) > 1 && txs[offset-1].announced)) { if p.isAnnouncable(meta) && (meta.nonce == next || (len(txs) > 1 && txs[offset-1].announced)) {
meta.announced = true meta.announced = true

View file

@ -241,7 +241,7 @@ func encodeForPool(tx *types.Transaction) []byte {
return blob return blob
} }
// makeMultiBlobTx is a utility method to construct a ramdom blob tx with // makeMultiBlobTx is a utility method to construct a random blob tx with
// certain number of blobs in its sidecar. // certain number of blobs in its sidecar.
func makeMultiBlobTx(nonce uint64, gasTipCap uint64, gasFeeCap uint64, blobFeeCap uint64, blobCount int, blobOffset int, key *ecdsa.PrivateKey, version byte) *types.Transaction { func makeMultiBlobTx(nonce uint64, gasTipCap uint64, gasFeeCap uint64, blobFeeCap uint64, blobCount int, blobOffset int, key *ecdsa.PrivateKey, version byte) *types.Transaction {
var ( var (
@ -558,7 +558,7 @@ func TestOpenDrops(t *testing.T) {
id, _ := store.Put(blob) id, _ := store.Put(blob)
dangling[id] = struct{}{} dangling[id] = struct{}{}
} }
// Insert a sequence of transactions with already passed nonces to veirfy // Insert a sequence of transactions with already passed nonces to verify
// that the entire set will get dropped (case 4). // that the entire set will get dropped (case 4).
var ( var (
filler, _ = crypto.GenerateKey() filler, _ = crypto.GenerateKey()

View file

@ -21,7 +21,7 @@ import (
) )
type txMetadata struct { type txMetadata struct {
id uint64 // the billy id of transction id uint64 // the billy id of transaction
size uint64 // the RLP encoded size of transaction (blobs are included) size uint64 // the RLP encoded size of transaction (blobs are included)
} }

View file

@ -2428,7 +2428,7 @@ func TestSetCodeTransactions(t *testing.T) {
if err := pool.addRemoteSync(pricedSetCodeTx(0, 250000, uint256.NewInt(3000), uint256.NewInt(300), keyA, []unsignedAuth{{0, keyC}})); err != nil { if err := pool.addRemoteSync(pricedSetCodeTx(0, 250000, uint256.NewInt(3000), uint256.NewInt(300), keyA, []unsignedAuth{{0, keyC}})); err != nil {
t.Fatalf("%s: failed to add with remote setcode transaction: %v", name, err) t.Fatalf("%s: failed to add with remote setcode transaction: %v", name, err)
} }
// B should not be considred as having an in-flight delegation, so // B should not be considered as having an in-flight delegation, so
// should allow more than one pooled transaction. // should allow more than one pooled transaction.
if err := pool.addRemoteSync(pricedTransaction(0, 100000, big.NewInt(10), keyB)); err != nil { if err := pool.addRemoteSync(pricedTransaction(0, 100000, big.NewInt(10), keyB)); err != nil {
t.Fatalf("%s: failed to replace with remote transaction: %v", name, err) t.Fatalf("%s: failed to replace with remote transaction: %v", name, err)

View file

@ -475,7 +475,7 @@ func BenchmarkSimpleLoop(b *testing.B) {
Op(vm.POP).Jump(lbl).Bytes() // pop return value and jump to label Op(vm.POP).Jump(lbl).Bytes() // pop return value and jump to label
p, lbl = program.New().Jumpdest() p, lbl = program.New().Jumpdest()
callInexistant := p. callInexistent := p.
Call(nil, 0xff, 0, 0, 0, 0, 0). Call(nil, 0xff, 0, 0, 0, 0, 0).
Op(vm.POP).Jump(lbl).Bytes() // pop return value and jump to label Op(vm.POP).Jump(lbl).Bytes() // pop return value and jump to label
@ -515,7 +515,7 @@ func BenchmarkSimpleLoop(b *testing.B) {
benchmarkNonModifyingCode(100000000, callIdentity, "call-identity-100M", "", b) benchmarkNonModifyingCode(100000000, callIdentity, "call-identity-100M", "", b)
benchmarkNonModifyingCode(100000000, loopingCode, "loop-100M", "", b) benchmarkNonModifyingCode(100000000, loopingCode, "loop-100M", "", b)
benchmarkNonModifyingCode(100000000, loopingCode2, "loop2-100M", "", b) benchmarkNonModifyingCode(100000000, loopingCode2, "loop2-100M", "", b)
benchmarkNonModifyingCode(100000000, callInexistant, "call-nonexist-100M", "", b) benchmarkNonModifyingCode(100000000, callInexistent, "call-nonexist-100M", "", b)
benchmarkNonModifyingCode(100000000, callEOA, "call-EOA-100M", "", b) benchmarkNonModifyingCode(100000000, callEOA, "call-EOA-100M", "", b)
benchmarkNonModifyingCode(100000000, callRevertingContractWithInput, "call-reverting-100M", "", b) benchmarkNonModifyingCode(100000000, callRevertingContractWithInput, "call-reverting-100M", "", b)

View file

@ -53,7 +53,7 @@ var (
// - during sync the Downloader handles peer connections, so dropper is disabled // - during sync the Downloader handles peer connections, so dropper is disabled
// - if not syncing and the peer count is close to the limit, it drops peers // - if not syncing and the peer count is close to the limit, it drops peers
// randomly every peerDropInterval to make space for new peers // randomly every peerDropInterval to make space for new peers
// - peers are dropped separately from the inboud pool and from the dialed pool // - peers are dropped separately from the inbound pool and from the dialed pool
type dropper struct { type dropper struct {
maxDialPeers int // maximum number of dialed peers maxDialPeers int // maximum number of dialed peers
maxInboundPeers int // maximum number of inbound peers maxInboundPeers int // maximum number of inbound peers

View file

@ -82,7 +82,7 @@ const (
minTrienodeHealThrottle = 1 minTrienodeHealThrottle = 1
// maxTrienodeHealThrottle is the maximum divisor for throttling trie node // maxTrienodeHealThrottle is the maximum divisor for throttling trie node
// heal requests to avoid overloading the local node and exessively expanding // heal requests to avoid overloading the local node and excessively expanding
// the state trie bedth wise. // the state trie bedth wise.
maxTrienodeHealThrottle = maxTrieRequestCount maxTrienodeHealThrottle = maxTrieRequestCount

View file

@ -1473,7 +1473,7 @@ func TestStandardTraceBlockToFile(t *testing.T) {
}, },
}, },
} }
txHashs := make([]common.Hash, 0, 2) txHashes := make([]common.Hash, 0, 2)
backend := newTestBackend(t, 1, genesis, func(i int, b *core.BlockGen) { backend := newTestBackend(t, 1, genesis, func(i int, b *core.BlockGen) {
b.SetCoinbase(common.Address{1}) b.SetCoinbase(common.Address{1})
// first tx to aa // first tx to aa
@ -1486,7 +1486,7 @@ func TestStandardTraceBlockToFile(t *testing.T) {
Data: nil, Data: nil,
}), types.HomesteadSigner{}, key) }), types.HomesteadSigner{}, key)
b.AddTx(tx) b.AddTx(tx)
txHashs = append(txHashs, tx.Hash()) txHashes = append(txHashes, tx.Hash())
// second tx to bb // second tx to bb
tx, _ = types.SignTx(types.NewTx(&types.LegacyTx{ tx, _ = types.SignTx(types.NewTx(&types.LegacyTx{
Nonce: 1, Nonce: 1,
@ -1497,7 +1497,7 @@ func TestStandardTraceBlockToFile(t *testing.T) {
Data: nil, Data: nil,
}), types.HomesteadSigner{}, key) }), types.HomesteadSigner{}, key)
b.AddTx(tx) b.AddTx(tx)
txHashs = append(txHashs, tx.Hash()) txHashes = append(txHashes, tx.Hash())
}) })
defer backend.teardown() defer backend.teardown()
@ -1526,7 +1526,7 @@ func TestStandardTraceBlockToFile(t *testing.T) {
{ {
// test that only a specific tx is traced if specified // test that only a specific tx is traced if specified
blockNumber: rpc.LatestBlockNumber, blockNumber: rpc.LatestBlockNumber,
config: &StdTraceConfig{TxHash: txHashs[1]}, config: &StdTraceConfig{TxHash: txHashes[1]},
want: []string{ want: []string{
`{"pc":0,"op":97,"gas":"0x13498","gasCost":"0x3","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH2"} `{"pc":0,"op":97,"gas":"0x13498","gasCost":"0x3","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH2"}
{"pc":3,"op":80,"gas":"0x13495","gasCost":"0x2","memSize":0,"stack":["0x1"],"depth":1,"refund":0,"opName":"POP"} {"pc":3,"op":80,"gas":"0x13495","gasCost":"0x2","memSize":0,"stack":["0x1"],"depth":1,"refund":0,"opName":"POP"}
@ -1563,7 +1563,7 @@ func TestTraceBadBlock(t *testing.T) {
accounts = newAccounts(2) accounts = newAccounts(2)
storageContract = common.HexToAddress("0x00000000000000000000000000000000deadbeef") storageContract = common.HexToAddress("0x00000000000000000000000000000000deadbeef")
signer = types.HomesteadSigner{} signer = types.HomesteadSigner{}
txHashs = make([]common.Hash, 0, 2) txHashes = make([]common.Hash, 0, 2)
genesis = &core.Genesis{ genesis = &core.Genesis{
Config: params.TestChainConfig, Config: params.TestChainConfig,
Alloc: types.GenesisAlloc{ Alloc: types.GenesisAlloc{
@ -1593,7 +1593,7 @@ func TestTraceBadBlock(t *testing.T) {
Data: nil}), Data: nil}),
signer, accounts[0].key) signer, accounts[0].key)
b.AddTx(tx) b.AddTx(tx)
txHashs = append(txHashs, tx.Hash()) txHashes = append(txHashes, tx.Hash())
// tx 1: call storage contract (executes PUSH1, PUSH1, SSTORE, STOP) // tx 1: call storage contract (executes PUSH1, PUSH1, SSTORE, STOP)
tx, _ = types.SignTx(types.NewTx(&types.LegacyTx{ tx, _ = types.SignTx(types.NewTx(&types.LegacyTx{
@ -1605,7 +1605,7 @@ func TestTraceBadBlock(t *testing.T) {
Data: nil}), Data: nil}),
signer, accounts[0].key) signer, accounts[0].key)
b.AddTx(tx) b.AddTx(tx)
txHashs = append(txHashs, tx.Hash()) txHashes = append(txHashes, tx.Hash())
}) })
defer backend.teardown() defer backend.teardown()
@ -1635,8 +1635,8 @@ func TestTraceBadBlock(t *testing.T) {
if err := json.Unmarshal(have, &traces); err != nil { if err := json.Unmarshal(have, &traces); err != nil {
t.Fatalf("failed to unmarshal traces: %v", err) t.Fatalf("failed to unmarshal traces: %v", err)
} }
if traces[0].TxHash != txHashs[0] { if traces[0].TxHash != txHashes[0] {
t.Errorf("tx 0: hash mismatch, have %v, want %v", traces[0].TxHash, txHashs[0]) t.Errorf("tx 0: hash mismatch, have %v, want %v", traces[0].TxHash, txHashes[0])
} }
if traces[0].Result.Gas != params.TxGas { if traces[0].Result.Gas != params.TxGas {
t.Errorf("tx 0: gas mismatch, have %d, want %d", traces[0].Result.Gas, params.TxGas) t.Errorf("tx 0: gas mismatch, have %d, want %d", traces[0].Result.Gas, params.TxGas)
@ -1646,8 +1646,8 @@ func TestTraceBadBlock(t *testing.T) {
} }
// Second tx: contract call // Second tx: contract call
if traces[1].TxHash != txHashs[1] { if traces[1].TxHash != txHashes[1] {
t.Errorf("tx 1: hash mismatch, have %v, want %v", traces[1].TxHash, txHashs[1]) t.Errorf("tx 1: hash mismatch, have %v, want %v", traces[1].TxHash, txHashes[1])
} }
if traces[1].Result.Failed { if traces[1].Result.Failed {
t.Error("tx 1: expected success, got failed") t.Error("tx 1: expected success, got failed")
@ -1811,7 +1811,7 @@ func TestStandardTraceBadBlockToFile(t *testing.T) {
}, },
}, },
} }
txHashs := make([]common.Hash, 0, 2) txHashes := make([]common.Hash, 0, 2)
backend := newTestBackend(t, 1, genesis, func(i int, b *core.BlockGen) { backend := newTestBackend(t, 1, genesis, func(i int, b *core.BlockGen) {
b.SetCoinbase(common.Address{1}) b.SetCoinbase(common.Address{1})
tx, _ := types.SignTx(types.NewTx(&types.LegacyTx{ tx, _ := types.SignTx(types.NewTx(&types.LegacyTx{
@ -1823,7 +1823,7 @@ func TestStandardTraceBadBlockToFile(t *testing.T) {
Data: nil, Data: nil,
}), types.HomesteadSigner{}, key) }), types.HomesteadSigner{}, key)
b.AddTx(tx) b.AddTx(tx)
txHashs = append(txHashs, tx.Hash()) txHashes = append(txHashes, tx.Hash())
tx, _ = types.SignTx(types.NewTx(&types.LegacyTx{ tx, _ = types.SignTx(types.NewTx(&types.LegacyTx{
Nonce: 1, Nonce: 1,
@ -1834,7 +1834,7 @@ func TestStandardTraceBadBlockToFile(t *testing.T) {
Data: nil, Data: nil,
}), types.HomesteadSigner{}, key) }), types.HomesteadSigner{}, key)
b.AddTx(tx) b.AddTx(tx)
txHashs = append(txHashs, tx.Hash()) txHashes = append(txHashes, tx.Hash())
}) })
defer backend.teardown() defer backend.teardown()
@ -1864,7 +1864,7 @@ func TestStandardTraceBadBlockToFile(t *testing.T) {
}, },
{ {
// Specific tx traced // Specific tx traced
config: &StdTraceConfig{TxHash: txHashs[1]}, config: &StdTraceConfig{TxHash: txHashes[1]},
want: []string{ want: []string{
`{"pc":0,"op":97,"gas":"0x13498","gasCost":"0x3","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH2"} `{"pc":0,"op":97,"gas":"0x13498","gasCost":"0x3","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH2"}
{"pc":3,"op":80,"gas":"0x13495","gasCost":"0x2","memSize":0,"stack":["0x1"],"depth":1,"refund":0,"opName":"POP"} {"pc":3,"op":80,"gas":"0x13495","gasCost":"0x2","memSize":0,"stack":["0x1"],"depth":1,"refund":0,"opName":"POP"}

View file

@ -272,7 +272,7 @@ func extractFile(arpath string, armode os.FileMode, data io.Reader, dest string)
return fmt.Errorf("path %q escapes archive destination", target) return fmt.Errorf("path %q escapes archive destination", target)
} }
// Remove the preivously-extracted file if it exists // Remove the previously-extracted file if it exists
if err := os.RemoveAll(target); err != nil { if err := os.RemoveAll(target); err != nil {
return err return err
} }

View file

@ -46,7 +46,7 @@ func (ui *CommandlineUI) RegisterUIServer(api *UIServerAPI) {
} }
// readString reads a single line from stdin, trimming if from spaces, enforcing // readString reads a single line from stdin, trimming if from spaces, enforcing
// non-emptyness. // non-emptiness.
func (ui *CommandlineUI) readString() string { func (ui *CommandlineUI) readString() string {
for { for {
fmt.Printf("> ") fmt.Printf("> ")

View file

@ -184,7 +184,7 @@ func fuzzUnmarshalG1(input []byte) int {
} }
return 1 return 1
} else { } else {
panic(fmt.Sprintf("error missmatch: cf: %v g: %v gn: %v", errC, errG, errS)) panic(fmt.Sprintf("error mismatch: cf: %v g: %v gn: %v", errC, errG, errS))
} }
} }
@ -211,7 +211,7 @@ func fuzzUnmarshalG2(input []byte) int {
} }
return 1 return 1
} else { } else {
panic(fmt.Sprintf("error missmatch: cf: %v g: %v gn: %v", errC, errG, errS)) panic(fmt.Sprintf("error mismatch: cf: %v g: %v gn: %v", errC, errG, errS))
} }
} }

View file

@ -1128,7 +1128,7 @@ func TestPrefixIteratorWithDescend(t *testing.T) {
// Count nodes at each level // Count nodes at each level
nodesVisited := 0 nodesVisited := 0
leafsFound := make(map[string]bool) leavesFound := make(map[string]bool)
// First call with descend=true to enter the "a" subtree // First call with descend=true to enter the "a" subtree
if !iter.Next(true) { if !iter.Next(true) {
@ -1141,20 +1141,20 @@ func TestPrefixIteratorWithDescend(t *testing.T) {
for i := 0; iter.Next(descendPattern[i%len(descendPattern)]); i++ { for i := 0; iter.Next(descendPattern[i%len(descendPattern)]); i++ {
nodesVisited++ nodesVisited++
if iter.Leaf() { if iter.Leaf() {
leafsFound[string(iter.LeafKey())] = true leavesFound[string(iter.LeafKey())] = true
} }
} }
// We should still respect the prefix boundary even when skipping // We should still respect the prefix boundary even when skipping
prefix := []byte("a") prefix := []byte("a")
for key := range leafsFound { for key := range leavesFound {
if !bytes.HasPrefix([]byte(key), prefix) { if !bytes.HasPrefix([]byte(key), prefix) {
t.Errorf("Found key outside prefix when using descend=false: %s", key) t.Errorf("Found key outside prefix when using descend=false: %s", key)
} }
} }
// Should not have found "b" even if we skip some subtrees // Should not have found "b" even if we skip some subtrees
if leafsFound["b"] { if leavesFound["b"] {
t.Error("Iterator leaked outside prefix boundary with descend=false") t.Error("Iterator leaked outside prefix boundary with descend=false")
} }
}) })

View file

@ -283,7 +283,7 @@ func TestNodeDifference(t *testing.T) {
t.Fatalf("Expect error, got nil %d", i) t.Fatalf("Expect error, got nil %d", i)
} }
if !test.expErr && err != nil { if !test.expErr && err != nil {
t.Fatalf("Unexpect error, %v", err) t.Fatalf("Unexpected error, %v", err)
} }
if err == nil { if err == nil {
if !slices.Equal(indices, test.expIndices) { if !slices.Equal(indices, test.expIndices) {
@ -342,7 +342,7 @@ func TestReassembleFullNode(t *testing.T) {
fn.encode(buf2) fn.encode(buf2)
enc2 := buf2.ToBytes() enc2 := buf2.ToBytes()
if !reflect.DeepEqual(enc2, reassembled) { if !reflect.DeepEqual(enc2, reassembled) {
t.Fatalf("Unexpeted reassembled node") t.Fatalf("Unexpected reassembled node")
} }
} }
@ -374,7 +374,7 @@ func TestReassembleShortNode(t *testing.T) {
ln.encode(buf2) ln.encode(buf2)
enc2 := buf2.ToBytes() enc2 := buf2.ToBytes()
if !reflect.DeepEqual(enc2, reassembled) { if !reflect.DeepEqual(enc2, reassembled) {
t.Fatalf("Unexpeted reassembled node") t.Fatalf("Unexpected reassembled node")
} }
} }

View file

@ -113,7 +113,7 @@ func (dl *diffLayer) account(hash common.Hash, depth int) ([]byte, error) {
dirtyStateReadMeter.Mark(int64(len(blob))) dirtyStateReadMeter.Mark(int64(len(blob)))
if len(blob) == 0 { if len(blob) == 0 {
stateAccountInexMeter.Mark(1) stateAccountIndexMeter.Mark(1)
} else { } else {
stateAccountExistMeter.Mark(1) stateAccountExistMeter.Mark(1)
} }
@ -139,7 +139,7 @@ func (dl *diffLayer) storage(accountHash, storageHash common.Hash, depth int) ([
dirtyStateReadMeter.Mark(int64(len(blob))) dirtyStateReadMeter.Mark(int64(len(blob)))
if len(blob) == 0 { if len(blob) == 0 {
stateStorageInexMeter.Mark(1) stateStorageIndexMeter.Mark(1)
} else { } else {
stateStorageExistMeter.Mark(1) stateStorageExistMeter.Mark(1)
} }

View file

@ -187,7 +187,7 @@ func (dl *diskLayer) account(hash common.Hash, depth int) ([]byte, error) {
dirtyStateHitDepthHist.Update(int64(depth)) dirtyStateHitDepthHist.Update(int64(depth))
if len(blob) == 0 { if len(blob) == 0 {
stateAccountInexMeter.Mark(1) stateAccountIndexMeter.Mark(1)
} else { } else {
stateAccountExistMeter.Mark(1) stateAccountExistMeter.Mark(1)
} }
@ -210,7 +210,7 @@ func (dl *diskLayer) account(hash common.Hash, depth int) ([]byte, error) {
cleanStateReadMeter.Mark(int64(len(blob))) cleanStateReadMeter.Mark(int64(len(blob)))
if len(blob) == 0 { if len(blob) == 0 {
stateAccountInexMeter.Mark(1) stateAccountIndexMeter.Mark(1)
} else { } else {
stateAccountExistMeter.Mark(1) stateAccountExistMeter.Mark(1)
} }
@ -231,8 +231,8 @@ func (dl *diskLayer) account(hash common.Hash, depth int) ([]byte, error) {
cleanStateWriteMeter.Mark(int64(len(blob))) cleanStateWriteMeter.Mark(int64(len(blob)))
} }
if len(blob) == 0 { if len(blob) == 0 {
stateAccountInexMeter.Mark(1) stateAccountIndexMeter.Mark(1)
stateAccountInexDiskMeter.Mark(1) stateAccountIndexDiskMeter.Mark(1)
} else { } else {
stateAccountExistMeter.Mark(1) stateAccountExistMeter.Mark(1)
stateAccountExistDiskMeter.Mark(1) stateAccountExistDiskMeter.Mark(1)
@ -264,7 +264,7 @@ func (dl *diskLayer) storage(accountHash, storageHash common.Hash, depth int) ([
dirtyStateHitDepthHist.Update(int64(depth)) dirtyStateHitDepthHist.Update(int64(depth))
if len(blob) == 0 { if len(blob) == 0 {
stateStorageInexMeter.Mark(1) stateStorageIndexMeter.Mark(1)
} else { } else {
stateStorageExistMeter.Mark(1) stateStorageExistMeter.Mark(1)
} }
@ -288,7 +288,7 @@ func (dl *diskLayer) storage(accountHash, storageHash common.Hash, depth int) ([
cleanStateReadMeter.Mark(int64(len(blob))) cleanStateReadMeter.Mark(int64(len(blob)))
if len(blob) == 0 { if len(blob) == 0 {
stateStorageInexMeter.Mark(1) stateStorageIndexMeter.Mark(1)
} else { } else {
stateStorageExistMeter.Mark(1) stateStorageExistMeter.Mark(1)
} }
@ -309,8 +309,8 @@ func (dl *diskLayer) storage(accountHash, storageHash common.Hash, depth int) ([
cleanStateWriteMeter.Mark(int64(len(blob))) cleanStateWriteMeter.Mark(int64(len(blob)))
} }
if len(blob) == 0 { if len(blob) == 0 {
stateStorageInexMeter.Mark(1) stateStorageIndexMeter.Mark(1)
stateStorageInexDiskMeter.Mark(1) stateStorageIndexDiskMeter.Mark(1)
} else { } else {
stateStorageExistMeter.Mark(1) stateStorageExistMeter.Mark(1)
stateStorageExistDiskMeter.Mark(1) stateStorageExistDiskMeter.Mark(1)

View file

@ -222,18 +222,18 @@ func testBlockWriterDelete(t *testing.T, bitmapSize int) {
} }
newMax := uint64(i - 1) newMax := uint64(i - 1)
if bw.desc.max != newMax { if bw.desc.max != newMax {
t.Fatalf("Maxmium element is not matched, want: %d, got: %d", newMax, bw.desc.max) t.Fatalf("Maximum element is not matched, want: %d, got: %d", newMax, bw.desc.max)
} }
} }
} }
func TestBlcokWriterDeleteWithData(t *testing.T) { func TestBlockWriterDeleteWithData(t *testing.T) {
testBlcokWriterDeleteWithData(t, 0) testBlockWriterDeleteWithData(t, 0)
testBlcokWriterDeleteWithData(t, 2) testBlockWriterDeleteWithData(t, 2)
testBlcokWriterDeleteWithData(t, 34) testBlockWriterDeleteWithData(t, 34)
} }
func testBlcokWriterDeleteWithData(t *testing.T, bitmapSize int) { func testBlockWriterDeleteWithData(t *testing.T, bitmapSize int) {
elements := []uint64{ elements := []uint64{
1, 5, 10, 11, 20, 1, 5, 10, 11, 20,
} }

View file

@ -63,7 +63,7 @@ func newDiffAccountIterator(seek common.Hash, accountList []common.Hash, fn load
index := sort.Search(len(accountList), func(i int) bool { index := sort.Search(len(accountList), func(i int) bool {
return bytes.Compare(seek[:], accountList[i][:]) <= 0 return bytes.Compare(seek[:], accountList[i][:]) <= 0
}) })
// Assemble and returned the already seeked iterator // Assemble and returned the already sought iterator
return &diffAccountIterator{ return &diffAccountIterator{
keys: accountList[index:], keys: accountList[index:],
loadFn: fn, loadFn: fn,
@ -206,7 +206,7 @@ func newDiffStorageIterator(account common.Hash, seek common.Hash, storageList [
index := sort.Search(len(storageList), func(i int) bool { index := sort.Search(len(storageList), func(i int) bool {
return bytes.Compare(seek[:], storageList[i][:]) <= 0 return bytes.Compare(seek[:], storageList[i][:]) <= 0
}) })
// Assemble and returned the already seeked iterator // Assemble and returned the already sought iterator
return &diffStorageIterator{ return &diffStorageIterator{
account: account, account: account,
keys: storageList[index:], keys: storageList[index:],

View file

@ -35,10 +35,10 @@ var (
dirtyNodeWriteMeter = metrics.NewRegisteredMeter("pathdb/dirty/node/write", nil) dirtyNodeWriteMeter = metrics.NewRegisteredMeter("pathdb/dirty/node/write", nil)
dirtyNodeHitDepthHist = metrics.NewRegisteredHistogram("pathdb/dirty/node/depth", nil, metrics.NewExpDecaySample(1028, 0.015)) dirtyNodeHitDepthHist = metrics.NewRegisteredHistogram("pathdb/dirty/node/depth", nil, metrics.NewExpDecaySample(1028, 0.015))
stateAccountInexMeter = metrics.NewRegisteredMeter("pathdb/state/account/inex/total", nil) stateAccountIndexMeter = metrics.NewRegisteredMeter("pathdb/state/account/inex/total", nil)
stateStorageInexMeter = metrics.NewRegisteredMeter("pathdb/state/storage/inex/total", nil) stateStorageIndexMeter = metrics.NewRegisteredMeter("pathdb/state/storage/inex/total", nil)
stateAccountInexDiskMeter = metrics.NewRegisteredMeter("pathdb/state/account/inex/disk", nil) stateAccountIndexDiskMeter = metrics.NewRegisteredMeter("pathdb/state/account/inex/disk", nil)
stateStorageInexDiskMeter = metrics.NewRegisteredMeter("pathdb/state/storage/inex/disk", nil) stateStorageIndexDiskMeter = metrics.NewRegisteredMeter("pathdb/state/storage/inex/disk", nil)
stateAccountExistMeter = metrics.NewRegisteredMeter("pathdb/state/account/exist/total", nil) stateAccountExistMeter = metrics.NewRegisteredMeter("pathdb/state/account/exist/total", nil)
stateStorageExistMeter = metrics.NewRegisteredMeter("pathdb/state/storage/exist/total", nil) stateStorageExistMeter = metrics.NewRegisteredMeter("pathdb/state/storage/exist/total", nil)