Skip to content

Commit 37106d3

Browse files
authored
Merge pull request #2699 from CortexFoundation/dev
Dev
2 parents dc9a803 + b45f41f commit 37106d3

326 files changed

Lines changed: 291635 additions & 212348 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/txpool/txpool.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,8 @@ func (pool *TxPool) stats() (int, int) {
488488
// Content retrieves the data content of the transaction pool, returning all the
489489
// pending as well as queued transactions, grouped by account and sorted by nonce.
490490
func (pool *TxPool) Content() (map[common.Address][]*types.Transaction, map[common.Address][]*types.Transaction) {
491-
pool.mu.Lock()
492-
defer pool.mu.Unlock()
491+
pool.mu.RLock()
492+
defer pool.mu.RUnlock()
493493

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

523523
pending := make(map[common.Address]types.Transactions, len(pool.pending))
524524
for addr, list := range pool.pending {

ctxc/downloader/queue.go

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ package downloader
2121

2222
import (
2323
"errors"
24-
"fmt"
2524
"sync"
2625
"sync/atomic"
2726
"time"
@@ -849,10 +848,10 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
849848
}
850849
// Assemble each of the results with their headers and retrieved data parts
851850
var (
852-
accepted int
853-
failure error
854-
i int
855-
hashes []common.Hash
851+
accepted int
852+
failure error
853+
i int
854+
foundStale bool
856855
)
857856
for _, header := range request.Headers {
858857
// Short circuit assembly if no more fetch results are found
@@ -864,40 +863,39 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
864863
failure = err
865864
break
866865
}
867-
hashes = append(hashes, header.Hash())
868866
i++
869867
}
870868

871869
for _, header := range request.Headers[:i] {
872870
if res, stale, err := q.resultCache.GetDeliverySlot(header.Number.Uint64()); err == nil && !stale {
873871
reconstruct(accepted, res)
872+
accepted++
874873
} else {
875874
// else: betweeen here and above, some other peer filled this result,
876875
// or it was indeed a no-op. This should not happen, but if it does it's
877876
// not something to panic about
878877
log.Error("Delivery stale", "stale", stale, "number", header.Number.Uint64(), "err", err)
879-
failure = errStaleDelivery
878+
foundStale = true
880879
}
881880
// Clean up a successful fetch
882-
delete(taskPool, hashes[accepted])
883-
accepted++
881+
delete(taskPool, header.Hash())
884882
}
885883
// Return all failed or missing fetches to the queue
886-
for _, header := range request.Headers[accepted:] {
884+
for _, header := range request.Headers[i:] {
887885
taskQueue.Push(header, -int64(header.Number.Uint64()))
888886
}
889887
// Wake up WaitResults
890888
if accepted > 0 {
891889
q.active.Signal()
892890
}
893-
if failure == nil {
894-
return accepted, nil
891+
if failure != nil {
892+
return accepted, failure
895893
}
896894
// If none of the data was good, it's a stale delivery
897-
if accepted > 0 {
898-
return accepted, fmt.Errorf("partial failure: %v", failure)
895+
if foundStale {
896+
return accepted, errStaleDelivery
899897
}
900-
return accepted, fmt.Errorf("%w: %v", failure, errStaleDelivery)
898+
return accepted, nil
901899
}
902900

903901
// Prepare configures the result cache to allow accepting and caching inbound

go.mod

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ require (
1111
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20260416073033-7c2071eaa8d4
1212
github.com/VictoriaMetrics/fastcache v1.13.3
1313
github.com/arsham/figurine v1.3.0
14-
github.com/aws/aws-sdk-go-v2 v1.41.5
15-
github.com/aws/aws-sdk-go-v2/config v1.32.14
16-
github.com/aws/aws-sdk-go-v2/credentials v1.19.14
17-
github.com/aws/aws-sdk-go-v2/service/route53 v1.62.5
14+
github.com/aws/aws-sdk-go-v2 v1.41.7
15+
github.com/aws/aws-sdk-go-v2/config v1.32.17
16+
github.com/aws/aws-sdk-go-v2/credentials v1.19.16
17+
github.com/aws/aws-sdk-go-v2/service/route53 v1.62.7
1818
github.com/cespare/cp v1.1.1
1919
github.com/charmbracelet/bubbletea v1.3.10
2020
github.com/cloudflare/cloudflare-go v0.116.0
@@ -23,7 +23,7 @@ require (
2323
github.com/crate-crypto/go-eth-kzg v1.5.0
2424
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
2525
github.com/dchest/siphash v1.2.3
26-
github.com/deckarep/golang-set/v2 v2.8.0
26+
github.com/deckarep/golang-set/v2 v2.9.0
2727
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1
2828
github.com/dop251/goja v0.0.0-20260311135729-065cd970411c
2929
github.com/ethereum/c-kzg-4844 v1.0.3
@@ -32,7 +32,7 @@ require (
3232
github.com/ferranbt/fastssz v1.0.0
3333
github.com/fjl/gencodec v0.1.0
3434
github.com/fogleman/ease v0.0.0-20170301025033-8da417bf1776
35-
github.com/fsnotify/fsnotify v1.9.0
35+
github.com/fsnotify/fsnotify v1.10.1
3636
github.com/gballet/go-libpcsclite v0.0.0-20250918194357-1ec6f2e601c6
3737
github.com/gofrs/flock v0.13.0
3838
github.com/golang/snappy v1.0.0
@@ -49,7 +49,7 @@ require (
4949
github.com/jedisct1/go-minisign v0.0.0-20241212093149-d2f9f49435c7
5050
github.com/lucasb-eyer/go-colorful v1.4.0
5151
github.com/mattn/go-colorable v0.1.14
52-
github.com/mattn/go-isatty v0.0.21
52+
github.com/mattn/go-isatty v0.0.22
5353
github.com/muesli/reflow v0.3.0
5454
github.com/muesli/termenv v0.16.0
5555
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416
@@ -77,7 +77,7 @@ require (
7777
)
7878

7979
require (
80-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 // indirect
80+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 // indirect
8181
github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 // indirect
8282
github.com/CortexFoundation/compress v0.0.0-20240218153512-9074bdc2397c // indirect
8383
github.com/CortexFoundation/cvm-runtime v0.0.0-20221117094012-b5a251885572 // indirect
@@ -108,17 +108,17 @@ require (
108108
github.com/antlabs/timer v0.1.4 // indirect
109109
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
110110
github.com/arsham/rainbow v1.2.1 // indirect
111-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 // indirect
112-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect
113-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect
114-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect
115-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect
116-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 // indirect
117-
github.com/aws/aws-sdk-go-v2/service/signin v1.0.9 // indirect
118-
github.com/aws/aws-sdk-go-v2/service/sso v1.30.15 // indirect
119-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 // indirect
120-
github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 // indirect
121-
github.com/aws/smithy-go v1.25.0 // indirect
111+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23 // indirect
112+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23 // indirect
113+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.23 // indirect
114+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24 // indirect
115+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.9 // indirect
116+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.23 // indirect
117+
github.com/aws/aws-sdk-go-v2/service/signin v1.0.11 // indirect
118+
github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 // indirect
119+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 // indirect
120+
github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 // indirect
121+
github.com/aws/smithy-go v1.25.1 // indirect
122122
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
123123
github.com/bahlo/generic-list-go v0.2.0 // indirect
124124
github.com/benbjohnson/immutable v0.4.3 // indirect
@@ -135,7 +135,7 @@ require (
135135
github.com/charmbracelet/x/term v0.2.2 // indirect
136136
github.com/clipperhouse/displaywidth v0.11.0 // indirect
137137
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
138-
github.com/cockroachdb/errors v1.12.0 // indirect
138+
github.com/cockroachdb/errors v1.13.0 // indirect
139139
github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect
140140
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 // indirect
141141
github.com/cockroachdb/redact v1.1.8 // indirect
@@ -145,15 +145,15 @@ require (
145145
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
146146
github.com/dgraph-io/badger/v4 v4.9.1 // indirect
147147
github.com/dgraph-io/ristretto/v2 v2.4.0 // indirect
148-
github.com/dlclark/regexp2 v1.11.5 // indirect
148+
github.com/dlclark/regexp2 v1.12.0 // indirect
149149
github.com/dustin/go-humanize v1.0.1 // indirect
150150
github.com/edsrzf/mmap-go v1.2.0 // indirect
151151
github.com/elliotchance/orderedmap v1.8.0 // indirect
152152
github.com/emicklei/dot v1.11.0 // indirect
153153
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
154154
github.com/felixge/fgprof v0.9.5 // indirect
155155
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 // indirect
156-
github.com/getsentry/sentry-go v0.45.1 // indirect
156+
github.com/getsentry/sentry-go v0.46.2 // indirect
157157
github.com/go-llsqlite/adapter v0.2.0 // indirect
158158
github.com/go-llsqlite/crawshaw v0.6.0 // indirect
159159
github.com/go-logr/logr v1.4.3 // indirect
@@ -171,8 +171,8 @@ require (
171171
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
172172
github.com/huandu/xstrings v1.5.0 // indirect
173173
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf // indirect
174-
github.com/jedib0t/go-pretty/v6 v6.7.9 // indirect
175-
github.com/klauspost/compress v1.18.5 // indirect
174+
github.com/jedib0t/go-pretty/v6 v6.7.10 // indirect
175+
github.com/klauspost/compress v1.18.6 // indirect
176176
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
177177
github.com/kr/pretty v0.3.1 // indirect
178178
github.com/kr/text v0.2.0 // indirect
@@ -196,22 +196,22 @@ require (
196196
github.com/pion/datachannel v1.6.0 // indirect
197197
github.com/pion/dtls/v2 v2.2.12 // indirect
198198
github.com/pion/dtls/v3 v3.1.2 // indirect
199-
github.com/pion/ice/v4 v4.2.4 // indirect
200-
github.com/pion/interceptor v0.1.44 // indirect
199+
github.com/pion/ice/v4 v4.2.5 // indirect
200+
github.com/pion/interceptor v0.1.45 // indirect
201201
github.com/pion/logging v0.2.4 // indirect
202202
github.com/pion/mdns/v2 v2.1.0 // indirect
203203
github.com/pion/randutil v0.1.0 // indirect
204204
github.com/pion/rtcp v1.2.16 // indirect
205-
github.com/pion/rtp v1.10.1 // indirect
206-
github.com/pion/sctp v1.9.4 // indirect
205+
github.com/pion/rtp v1.10.2 // indirect
206+
github.com/pion/sctp v1.9.5 // indirect
207207
github.com/pion/sdp/v3 v3.0.18 // indirect
208208
github.com/pion/srtp/v3 v3.0.10 // indirect
209209
github.com/pion/stun/v3 v3.1.2 // indirect
210210
github.com/pion/transport/v2 v2.2.10 // indirect
211211
github.com/pion/transport/v3 v3.1.1 // indirect
212212
github.com/pion/transport/v4 v4.0.1 // indirect
213-
github.com/pion/turn/v4 v4.1.4 // indirect
214-
github.com/pion/webrtc/v4 v4.2.11 // indirect
213+
github.com/pion/turn/v5 v5.0.3 // indirect
214+
github.com/pion/webrtc/v4 v4.2.12 // indirect
215215
github.com/pkg/errors v0.9.1 // indirect
216216
github.com/pmezard/go-difflib v1.0.0 // indirect
217217
github.com/prometheus/client_golang v1.23.2 // indirect
@@ -243,6 +243,7 @@ require (
243243
github.com/yusufpapurcu/wmi v1.2.4 // indirect
244244
github.com/zeebo/xxh3 v1.1.0 // indirect
245245
go.etcd.io/bbolt v1.4.3 // indirect
246+
go.mongodb.org/mongo-driver v1.17.9 // indirect
246247
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
247248
go.opentelemetry.io/otel v1.43.0 // indirect
248249
go.opentelemetry.io/otel/metric v1.43.0 // indirect
@@ -255,9 +256,9 @@ require (
255256
gopkg.in/yaml.v2 v2.4.0 // indirect
256257
gopkg.in/yaml.v3 v3.0.1 // indirect
257258
lukechampine.com/blake3 v1.4.1 // indirect
258-
modernc.org/libc v1.72.0 // indirect
259+
modernc.org/libc v1.72.2 // indirect
259260
modernc.org/mathutil v1.7.1 // indirect
260261
modernc.org/memory v1.11.0 // indirect
261-
modernc.org/sqlite v1.48.2 // indirect
262+
modernc.org/sqlite v1.50.0 // indirect
262263
zombiezen.com/go/sqlite v1.4.2 // indirect
263264
)

0 commit comments

Comments
 (0)