Skip to content
Merged

Dev #2699

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions core/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ func (pool *TxPool) stats() (int, int) {
// Content retrieves the data content of the transaction pool, returning all the
// pending as well as queued transactions, grouped by account and sorted by nonce.
func (pool *TxPool) Content() (map[common.Address][]*types.Transaction, map[common.Address][]*types.Transaction) {
pool.mu.Lock()
defer pool.mu.Unlock()
pool.mu.RLock()
defer pool.mu.RUnlock()

pending := make(map[common.Address][]*types.Transaction, len(pool.pending))
for addr, list := range pool.pending {
Expand Down Expand Up @@ -517,8 +517,8 @@ func (pool *TxPool) ContentFrom(addr common.Address) (types.Transactions, types.
// account and sorted by nonce. The returned transaction set is a copy and can be
// freely modified by calling code.
func (pool *TxPool) Pending(filter PendingFilter) map[common.Address]types.Transactions {
pool.mu.Lock()
defer pool.mu.Unlock()
pool.mu.RLock()
defer pool.mu.RUnlock()

pending := make(map[common.Address]types.Transactions, len(pool.pending))
for addr, list := range pool.pending {
Expand Down
28 changes: 13 additions & 15 deletions ctxc/downloader/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package downloader

import (
"errors"
"fmt"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -849,10 +848,10 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
}
// Assemble each of the results with their headers and retrieved data parts
var (
accepted int
failure error
i int
hashes []common.Hash
accepted int
failure error
i int
foundStale bool
)
for _, header := range request.Headers {
// Short circuit assembly if no more fetch results are found
Expand All @@ -864,40 +863,39 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
failure = err
break
}
hashes = append(hashes, header.Hash())
i++
}

for _, header := range request.Headers[:i] {
if res, stale, err := q.resultCache.GetDeliverySlot(header.Number.Uint64()); err == nil && !stale {
reconstruct(accepted, res)
accepted++
} else {
// else: betweeen here and above, some other peer filled this result,
// or it was indeed a no-op. This should not happen, but if it does it's
// not something to panic about
log.Error("Delivery stale", "stale", stale, "number", header.Number.Uint64(), "err", err)
failure = errStaleDelivery
foundStale = true
}
// Clean up a successful fetch
delete(taskPool, hashes[accepted])
accepted++
delete(taskPool, header.Hash())
}
// Return all failed or missing fetches to the queue
for _, header := range request.Headers[accepted:] {
for _, header := range request.Headers[i:] {
taskQueue.Push(header, -int64(header.Number.Uint64()))
}
// Wake up WaitResults
if accepted > 0 {
q.active.Signal()
}
if failure == nil {
return accepted, nil
if failure != nil {
return accepted, failure
}
// If none of the data was good, it's a stale delivery
if accepted > 0 {
return accepted, fmt.Errorf("partial failure: %v", failure)
if foundStale {
return accepted, errStaleDelivery
}
return accepted, fmt.Errorf("%w: %v", failure, errStaleDelivery)
return accepted, nil
}

// Prepare configures the result cache to allow accepting and caching inbound
Expand Down
65 changes: 33 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ require (
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20260416073033-7c2071eaa8d4
github.com/VictoriaMetrics/fastcache v1.13.3
github.com/arsham/figurine v1.3.0
github.com/aws/aws-sdk-go-v2 v1.41.5
github.com/aws/aws-sdk-go-v2/config v1.32.14
github.com/aws/aws-sdk-go-v2/credentials v1.19.14
github.com/aws/aws-sdk-go-v2/service/route53 v1.62.5
github.com/aws/aws-sdk-go-v2 v1.41.7
github.com/aws/aws-sdk-go-v2/config v1.32.17
github.com/aws/aws-sdk-go-v2/credentials v1.19.16
github.com/aws/aws-sdk-go-v2/service/route53 v1.62.7
github.com/cespare/cp v1.1.1
github.com/charmbracelet/bubbletea v1.3.10
github.com/cloudflare/cloudflare-go v0.116.0
Expand All @@ -23,7 +23,7 @@ require (
github.com/crate-crypto/go-eth-kzg v1.5.0
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/dchest/siphash v1.2.3
github.com/deckarep/golang-set/v2 v2.8.0
github.com/deckarep/golang-set/v2 v2.9.0
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1
github.com/dop251/goja v0.0.0-20260311135729-065cd970411c
github.com/ethereum/c-kzg-4844 v1.0.3
Expand All @@ -32,7 +32,7 @@ require (
github.com/ferranbt/fastssz v1.0.0
github.com/fjl/gencodec v0.1.0
github.com/fogleman/ease v0.0.0-20170301025033-8da417bf1776
github.com/fsnotify/fsnotify v1.9.0
github.com/fsnotify/fsnotify v1.10.1
github.com/gballet/go-libpcsclite v0.0.0-20250918194357-1ec6f2e601c6
github.com/gofrs/flock v0.13.0
github.com/golang/snappy v1.0.0
Expand All @@ -49,7 +49,7 @@ require (
github.com/jedisct1/go-minisign v0.0.0-20241212093149-d2f9f49435c7
github.com/lucasb-eyer/go-colorful v1.4.0
github.com/mattn/go-colorable v0.1.14
github.com/mattn/go-isatty v0.0.21
github.com/mattn/go-isatty v0.0.22
github.com/muesli/reflow v0.3.0
github.com/muesli/termenv v0.16.0
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416
Expand Down Expand Up @@ -77,7 +77,7 @@ require (
)

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 // indirect
github.com/CortexFoundation/compress v0.0.0-20240218153512-9074bdc2397c // indirect
github.com/CortexFoundation/cvm-runtime v0.0.0-20221117094012-b5a251885572 // indirect
Expand Down Expand Up @@ -108,17 +108,17 @@ require (
github.com/antlabs/timer v0.1.4 // indirect
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/arsham/rainbow v1.2.1 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.9 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.15 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 // indirect
github.com/aws/smithy-go v1.25.0 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.23 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.9 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.23 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.11 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 // indirect
github.com/aws/smithy-go v1.25.1 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/benbjohnson/immutable v0.4.3 // indirect
Expand All @@ -135,7 +135,7 @@ require (
github.com/charmbracelet/x/term v0.2.2 // indirect
github.com/clipperhouse/displaywidth v0.11.0 // indirect
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
github.com/cockroachdb/errors v1.12.0 // indirect
github.com/cockroachdb/errors v1.13.0 // indirect
github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 // indirect
github.com/cockroachdb/redact v1.1.8 // indirect
Expand All @@ -145,15 +145,15 @@ require (
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
github.com/dgraph-io/badger/v4 v4.9.1 // indirect
github.com/dgraph-io/ristretto/v2 v2.4.0 // indirect
github.com/dlclark/regexp2 v1.11.5 // indirect
github.com/dlclark/regexp2 v1.12.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/edsrzf/mmap-go v1.2.0 // indirect
github.com/elliotchance/orderedmap v1.8.0 // indirect
github.com/emicklei/dot v1.11.0 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/felixge/fgprof v0.9.5 // indirect
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 // indirect
github.com/getsentry/sentry-go v0.45.1 // indirect
github.com/getsentry/sentry-go v0.46.2 // indirect
github.com/go-llsqlite/adapter v0.2.0 // indirect
github.com/go-llsqlite/crawshaw v0.6.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
Expand All @@ -171,8 +171,8 @@ require (
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf // indirect
github.com/jedib0t/go-pretty/v6 v6.7.9 // indirect
github.com/klauspost/compress v1.18.5 // indirect
github.com/jedib0t/go-pretty/v6 v6.7.10 // indirect
github.com/klauspost/compress v1.18.6 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
Expand All @@ -196,22 +196,22 @@ require (
github.com/pion/datachannel v1.6.0 // indirect
github.com/pion/dtls/v2 v2.2.12 // indirect
github.com/pion/dtls/v3 v3.1.2 // indirect
github.com/pion/ice/v4 v4.2.4 // indirect
github.com/pion/interceptor v0.1.44 // indirect
github.com/pion/ice/v4 v4.2.5 // indirect
github.com/pion/interceptor v0.1.45 // indirect
github.com/pion/logging v0.2.4 // indirect
github.com/pion/mdns/v2 v2.1.0 // indirect
github.com/pion/randutil v0.1.0 // indirect
github.com/pion/rtcp v1.2.16 // indirect
github.com/pion/rtp v1.10.1 // indirect
github.com/pion/sctp v1.9.4 // indirect
github.com/pion/rtp v1.10.2 // indirect
github.com/pion/sctp v1.9.5 // indirect
github.com/pion/sdp/v3 v3.0.18 // indirect
github.com/pion/srtp/v3 v3.0.10 // indirect
github.com/pion/stun/v3 v3.1.2 // indirect
github.com/pion/transport/v2 v2.2.10 // indirect
github.com/pion/transport/v3 v3.1.1 // indirect
github.com/pion/transport/v4 v4.0.1 // indirect
github.com/pion/turn/v4 v4.1.4 // indirect
github.com/pion/webrtc/v4 v4.2.11 // indirect
github.com/pion/turn/v5 v5.0.3 // indirect
github.com/pion/webrtc/v4 v4.2.12 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
Expand Down Expand Up @@ -243,6 +243,7 @@ require (
github.com/yusufpapurcu/wmi v1.2.4 // indirect
github.com/zeebo/xxh3 v1.1.0 // indirect
go.etcd.io/bbolt v1.4.3 // indirect
go.mongodb.org/mongo-driver v1.17.9 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel v1.43.0 // indirect
go.opentelemetry.io/otel/metric v1.43.0 // indirect
Expand All @@ -255,9 +256,9 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.4.1 // indirect
modernc.org/libc v1.72.0 // indirect
modernc.org/libc v1.72.2 // indirect
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect
modernc.org/sqlite v1.48.2 // indirect
modernc.org/sqlite v1.50.0 // indirect
zombiezen.com/go/sqlite v1.4.2 // indirect
)
Loading
Loading