Skip to content

Commit 6e7a11a

Browse files
authored
Merge pull request #253 from SiaFoundation/nate/max-rpcs
Increase max RPCs
2 parents 8632a5f + 18443b3 commit 6e7a11a

File tree

8 files changed

+22
-17
lines changed

8 files changed

+22
-17
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
default: patch
3+
---
4+
5+
# Increase max inflight RPCs to handle Mainnet traffic.

cmd/explored/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,9 @@ func runRootCmd(ctx context.Context, log *zap.Logger) error {
256256
UniqueID: gateway.GenerateUniqueID(),
257257
NetAddress: syncerAddr,
258258
}
259-
s := syncer.New(syncerListener, cm, ps, header, syncer.WithLogger(log.Named("syncer")), syncer.WithMaxInboundPeers(256))
259+
s := syncer.New(syncerListener, cm, ps, header, syncer.WithLogger(log.Named("syncer")),
260+
syncer.WithMaxInboundPeers(256),
261+
syncer.WithMaxInflightRPCs(1024))
260262
defer s.Close()
261263
go s.Run()
262264

explorer/explorer.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ func (e *Explorer) syncStore(index types.ChainIndex, batchSize int) error {
146146
if err != nil {
147147
return fmt.Errorf("failed to subscribe to chain manager: %w", err)
148148
}
149-
150149
if err := e.s.UpdateChainState(crus, caus); err != nil {
151150
return fmt.Errorf("failed to process updates: %w", err)
152151
}

explorer/update.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"go.sia.tech/core/types"
77
"go.sia.tech/coreutils/chain"
8+
"go.uber.org/zap"
89
)
910

1011
type (
@@ -589,21 +590,25 @@ func updateMetrics(tx UpdateTx, s UpdateState, metrics Metrics) (Metrics, error)
589590
}
590591

591592
// UpdateChainState applies the reverts and updates.
592-
func UpdateChainState(tx UpdateTx, crus []chain.RevertUpdate, caus []chain.ApplyUpdate) error {
593+
func UpdateChainState(tx UpdateTx, crus []chain.RevertUpdate, caus []chain.ApplyUpdate, log *zap.Logger) error {
593594
for _, cru := range crus {
594595
revertedIndex := types.ChainIndex{
595596
ID: cru.Block.ID(),
596597
Height: cru.State.Index.Height + 1,
597598
}
599+
log.Debug("reverting chain update", zap.Stringer("index", revertedIndex))
598600
if err := revertChainUpdate(tx, cru, revertedIndex); err != nil {
599601
return fmt.Errorf("failed to revert chain update %q: %w", revertedIndex, err)
600602
}
603+
log.Debug("reverted chain update", zap.Stringer("index", revertedIndex))
601604
}
602605

603606
for _, cau := range caus {
607+
log.Debug("applying chain update", zap.Stringer("index", cau.State.Index))
604608
if err := applyChainUpdate(tx, cau); err != nil {
605609
return fmt.Errorf("failed to apply chain update %q: %w", cau.State.Index, err)
606610
}
611+
log.Debug("applied chain update", zap.Stringer("index", cau.State.Index))
607612
}
608613
return nil
609614
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ require (
66
github.com/google/go-cmp v0.7.0
77
github.com/mattn/go-sqlite3 v1.14.28
88
github.com/oschwald/geoip2-golang v1.11.0
9-
go.sia.tech/core v0.13.2
10-
go.sia.tech/coreutils v0.16.2
9+
go.sia.tech/core v0.13.3-0.20250616154238-4c58987023c7
10+
go.sia.tech/coreutils v0.16.3-0.20250619115925-ab2381254465
1111
go.sia.tech/jape v0.14.0
1212
go.uber.org/zap v1.27.0
1313
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842

go.sum

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,12 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
4343
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
4444
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
4545
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
46-
go.etcd.io/bbolt v1.4.0 h1:TU77id3TnN/zKr7CO/uk+fBCwF2jGcMuw2B/FMAzYIk=
47-
go.etcd.io/bbolt v1.4.0/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk=
4846
go.etcd.io/bbolt v1.4.1 h1:5mOV+HWjIPLEAlUGMsveaUvK2+byZMFOzojoi7bh7uI=
4947
go.etcd.io/bbolt v1.4.1/go.mod h1:c8zu2BnXWTu2XM4XcICtbGSl9cFwsXtcf9zLt2OncM8=
50-
go.sia.tech/core v0.13.2 h1:66ZYzN2+AiHZmRayt4idSfoEoQZ5LV541+2E0luiizA=
51-
go.sia.tech/core v0.13.2/go.mod h1:bur1jeLA1JQbwzZkc2ijSTdpJYusG4h0pV9IwLOHT0g=
52-
go.sia.tech/coreutils v0.16.2-0.20250614154532-fc51637947af h1:s32mW2KWeE4/HTTE2h9GUqVmr3bH8rTA9Sa7iTBlWrk=
53-
go.sia.tech/coreutils v0.16.2-0.20250614154532-fc51637947af/go.mod h1:BPoX9f3/ViDi6STLMoeziZZKCJarVwGV3yXv5pl0opQ=
54-
go.sia.tech/coreutils v0.16.2-0.20250616161340-e162bc863b6d h1:2WxA3RDJltSyfSLmpaNmD02BQ928zWLouvWVTwj+jCA=
55-
go.sia.tech/coreutils v0.16.2-0.20250616161340-e162bc863b6d/go.mod h1:EWSwOvs9POy172NRn5CwgYVUH5TENcAODKaEanXgkmU=
56-
go.sia.tech/coreutils v0.16.2 h1:sAVwl7s9bBqBp9q1C93J9aY6ijdEtYHIhZkrde2GLsE=
57-
go.sia.tech/coreutils v0.16.2/go.mod h1:egAAlR7vju4nMppZiIEfHcwr84abuW9wg/ytcu4kSnA=
48+
go.sia.tech/core v0.13.3-0.20250616154238-4c58987023c7 h1:4KCpwSuMMZuiWcSOpQ9GFLpGhIxVdaqOnd4Bz2U590c=
49+
go.sia.tech/core v0.13.3-0.20250616154238-4c58987023c7/go.mod h1:bur1jeLA1JQbwzZkc2ijSTdpJYusG4h0pV9IwLOHT0g=
50+
go.sia.tech/coreutils v0.16.3-0.20250619115925-ab2381254465 h1:WrsOPXNWSNTu7EJ2URm1utTyes0Yc9779faYWRWm1lU=
51+
go.sia.tech/coreutils v0.16.3-0.20250619115925-ab2381254465/go.mod h1:tcO75XD7wSV+neJJiS036882NnWSfOXDcU9nlw1r6U8=
5852
go.sia.tech/jape v0.14.0 h1:hyocTKqvcji+rC1vDE1djINlpErQQVDS6zoLMmxW3Xs=
5953
go.sia.tech/jape v0.14.0/go.mod h1:tONxoKrNr0iQWzBCygwlTkGoGjuEhyVpLGInvGd2mGY=
6054
go.sia.tech/mux v1.4.0 h1:LgsLHtn7l+25MwrgaPaUCaS8f2W2/tfvHIdXps04sVo=

persist/sqlite/consensus.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ func (s *Store) UpdateChainState(reverted []chain.RevertUpdate, applied []chain.
11671167
tx: tx,
11681168
}
11691169

1170-
if err := explorer.UpdateChainState(utx, reverted, applied); err != nil {
1170+
if err := explorer.UpdateChainState(utx, reverted, applied, s.log.Named("UpdateChainState")); err != nil {
11711171
return fmt.Errorf("failed to update chain state: %w", err)
11721172
}
11731173
return nil

persist/sqlite/consensus_refactored_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3141,7 +3141,7 @@ func BenchmarkRevert(b *testing.B) {
31413141
}
31423142

31433143
b.StartTimer()
3144-
err := explorer.UpdateChainState(utx, crus, nil)
3144+
err := explorer.UpdateChainState(utx, crus, nil, n.db.log.Named("update"))
31453145
b.StopTimer()
31463146

31473147
if err != nil {

0 commit comments

Comments
 (0)