Skip to content

Commit 12f72e2

Browse files
authoredSep 5, 2024
Merge branch 'main' into main
2 parents d025485 + b7f138d commit 12f72e2

34 files changed

+197
-77
lines changed
 

‎.github/workflows/check-generated.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
steps:
4444
- uses: actions/setup-go@v4
4545
with:
46-
go-version: "1.22.4"
46+
go-version: "1.22.5"
4747

4848
- uses: actions/checkout@v3
4949
with:

‎.github/workflows/coverage.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v3
1313
- uses: actions/setup-go@v4
1414
with:
15-
go-version: "1.22.4"
15+
go-version: "1.22.5"
1616
- name: Create a file with all the pkgs
1717
run: go list ./... > pkgs.txt
1818
- name: Split pkgs into 4 files
@@ -48,7 +48,7 @@ jobs:
4848
steps:
4949
- uses: actions/setup-go@v4
5050
with:
51-
go-version: "1.22.4"
51+
go-version: "1.22.5"
5252
- uses: actions/checkout@v3
5353
- uses: technote-space/get-diff-action@v6
5454
with:
@@ -70,7 +70,7 @@ jobs:
7070
steps:
7171
- uses: actions/setup-go@v4
7272
with:
73-
go-version: "1.22.4"
73+
go-version: "1.22.5"
7474
- uses: actions/checkout@v3
7575
- uses: technote-space/get-diff-action@v6
7676
with:

‎.github/workflows/e2e-manual.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- uses: actions/setup-go@v4
1818
with:
19-
go-version: '1.22.4'
19+
go-version: '1.22.5'
2020

2121
- uses: actions/checkout@v3
2222

‎.github/workflows/e2e-nightly-34x.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424
- uses: actions/setup-go@v4
2525
with:
26-
go-version: '1.22.4'
26+
go-version: '1.22.5'
2727

2828
- uses: actions/checkout@v3
2929
with:

‎.github/workflows/e2e.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- uses: actions/setup-go@v4
1616
with:
17-
go-version: '1.22.4'
17+
go-version: '1.22.5'
1818
- uses: actions/checkout@v3
1919
- uses: technote-space/get-diff-action@v6
2020
with:

‎.github/workflows/fuzz-nightly.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/setup-go@v4
1313
with:
14-
go-version: '1.22.4'
14+
go-version: '1.22.5'
1515

1616
- uses: actions/checkout@v3
1717

‎.github/workflows/govulncheck.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- uses: actions/setup-go@v3
1818
with:
19-
go-version: "1.22.4"
19+
go-version: "1.22.5"
2020
- uses: actions/checkout@v3
2121
- uses: technote-space/get-diff-action@v6
2222
with:

‎.github/workflows/pre-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- uses: actions/setup-go@v4
2020
with:
21-
go-version: '1.22.4'
21+
go-version: '1.22.5'
2222

2323
# Similar check to ./release-version.yml, but enforces this when pushing
2424
# tags. The ./release-version.yml check can be bypassed and is mainly

‎.github/workflows/release-version.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
- uses: actions/setup-go@v4
1717
with:
18-
go-version: '1.22.4'
18+
go-version: '1.22.5'
1919

2020
- name: Check version
2121
run: |

‎.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
- uses: actions/setup-go@v4
1818
with:
19-
go-version: '1.22.4'
19+
go-version: '1.22.5'
2020

2121
- name: Generate release notes
2222
run: |

‎.github/workflows/tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
steps:
2626
- uses: actions/setup-go@v4
2727
with:
28-
go-version: "1.22.4"
28+
go-version: "1.22.5"
2929
- uses: actions/checkout@v3
3030
- uses: technote-space/get-diff-action@v6
3131
with:
@@ -58,7 +58,7 @@ jobs:
5858
# steps:
5959
# - uses: actions/setup-go@v3
6060
# with:
61-
# go-version: "1.22.4"
61+
# go-version: "1.22.5"
6262
# - uses: actions/checkout@v3
6363
# - uses: technote-space/get-diff-action@v6
6464
# with:

‎DOCKER/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Use a build arg to ensure that both stages use the same,
22
# hopefully current, go version.
3-
ARG GOLANG_BASE_IMAGE=golang:1.22.4-alpine
3+
ARG GOLANG_BASE_IMAGE=golang:1.22.5-alpine
44

55
# stage 1 Generate CometBFT Binary
66
FROM --platform=$BUILDPLATFORM $GOLANG_BASE_IMAGE as builder

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ This repo intends on preserving the minimal possible diff with [cometbft/cometbf
4848
- **specific to Celestia**: consider if [celestia-app](https://github.com/celestiaorg/celestia-app) is a better target
4949
- **not specific to Celestia**: consider making the contribution upstream in CometBFT
5050

51-
1. [Install Go](https://go.dev/doc/install) 1.22.4+
51+
1. [Install Go](https://go.dev/doc/install) 1.22.5+
5252
2. Fork this repo
5353
3. Clone your fork
5454
4. Find an issue to work on (see [good first issues](https://github.com/celestiaorg/celestia-core/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22))

‎cmd/cometbft/commands/root.go

+4
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ var RootCmd = &cobra.Command{
8787
}
8888

8989
logger = logger.With("module", "main")
90+
91+
for _, possibleMisconfiguration := range config.PossibleMisconfigurations() {
92+
logger.Warn(possibleMisconfiguration)
93+
}
9094
return nil
9195
},
9296
}

‎config/config.go

+19
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ func (cfg *Config) ValidateBasic() error {
161161
return nil
162162
}
163163

164+
// PossibleMisconfigurations returns a list of possible conflicting entries that
165+
// may lead to unexpected behavior
166+
func (cfg *Config) PossibleMisconfigurations() []string {
167+
res := []string{}
168+
for _, elem := range cfg.StateSync.PossibleMisconfigurations() {
169+
res = append(res, fmt.Sprintf("[statesync] section: %s", elem))
170+
}
171+
return res
172+
}
173+
164174
//-----------------------------------------------------------------------------
165175
// BaseConfig
166176

@@ -857,6 +867,15 @@ func TestStateSyncConfig() *StateSyncConfig {
857867
return DefaultStateSyncConfig()
858868
}
859869

870+
// PossibleMisconfigurations returns a list of possible conflicting entries that
871+
// may lead to unexpected behavior
872+
func (cfg *StateSyncConfig) PossibleMisconfigurations() []string {
873+
if !cfg.Enable && len(cfg.RPCServers) != 0 {
874+
return []string{"rpc_servers specified but enable = false"}
875+
}
876+
return []string{}
877+
}
878+
860879
// ValidateBasic performs basic validation.
861880
func (cfg *StateSyncConfig) ValidateBasic() error {
862881
if cfg.Enable {

‎config/config_test.go

+22
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ func TestConfigValidateBasic(t *testing.T) {
3838
assert.Error(t, cfg.ValidateBasic())
3939
}
4040

41+
func TestConfigPossibleMisconfigurations(t *testing.T) {
42+
cfg := DefaultConfig()
43+
require.Len(t, cfg.PossibleMisconfigurations(), 0)
44+
// providing rpc_servers while enable = false is a possible misconfiguration
45+
cfg.StateSync.RPCServers = []string{"first_rpc"}
46+
require.Equal(t, []string{"[statesync] section: rpc_servers specified but enable = false"}, cfg.PossibleMisconfigurations())
47+
// enabling statesync deletes possible misconfiguration
48+
cfg.StateSync.Enable = true
49+
require.Len(t, cfg.PossibleMisconfigurations(), 0)
50+
}
51+
4152
func TestTLSConfiguration(t *testing.T) {
4253
assert := assert.New(t)
4354
cfg := DefaultConfig()
@@ -127,6 +138,17 @@ func TestStateSyncConfigValidateBasic(t *testing.T) {
127138
require.NoError(t, cfg.ValidateBasic())
128139
}
129140

141+
func TestStateSyncPossibleMisconfigurations(t *testing.T) {
142+
cfg := DefaultStateSyncConfig()
143+
require.Len(t, cfg.PossibleMisconfigurations(), 0)
144+
// providing rpc_servers while enable = false is a possible misconfiguration
145+
cfg.RPCServers = []string{"first_rpc"}
146+
require.Equal(t, []string{"rpc_servers specified but enable = false"}, cfg.PossibleMisconfigurations())
147+
// enabling statesync deletes possible misconfiguration
148+
cfg.Enable = true
149+
require.Len(t, cfg.PossibleMisconfigurations(), 0)
150+
}
151+
130152
func TestFastSyncConfigValidateBasic(t *testing.T) {
131153
cfg := TestFastSyncConfig()
132154
assert.NoError(t, cfg.ValidateBasic())

‎docs/celestia-architecture/adr-001-block-propagation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ When a user requests a block from the LL node, the request will be set to the IP
102102

103103
![user request flow](./assets/user-request.png)
104104

105-
The goal is to not change the public interface for RPC's. It is yet to be seen if this possible. This means that CIDs will need to be set and loaded from the store in order to get all the related block information an user requires.
105+
The goal is to not change the public interface for RPC's. It is yet to be seen if this is possible. This means that CIDs will need to be set and loaded from the store in order to get all the related block information a user requires.
106106

107107
## Status
108108

‎docs/celestia-architecture/adr-002-ipld-da-sampling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ and [`NodeAdder`](https://github.com/ipfs/go-ipld-format/blob/d2e09424ddee0d7e69
4747
As an optimization, we can also use a [`Batch`](https://github.com/ipfs/go-ipld-format/blob/d2e09424ddee0d7e696d01143318d32d0fb1ae63/batch.go#L29)
4848
to batch adding and removing nodes.
4949
This will be achieved by passing around a [CoreAPI](https://github.com/ipfs/interface-go-ipfs-core/blob/b935dfe5375eac7ea3c65b14b3f9a0242861d0b3/coreapi.go#L15)
50-
object, which derive from the IPFS node which is created along a with a tendermint node (see [#152]).
50+
object, which derive from the IPFS node which is created along with a tendermint node (see [#152]).
5151
This code snippet does exactly that (see the [go-ipfs documentation] for more examples):
5252
```go
5353
// This constructs an IPFS node instance

‎docs/celestia-architecture/adr-003-application-data-retrieval.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## Context
88

99
This ADR builds on top of [ADR 002](adr-002-ipld-da-sampling.md) and will use the implemented APIs described there.
10-
The reader should familiarize themselves at least with the high-level concepts the as well as in the [specs](https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#2d-reed-solomon-encoding-scheme).
10+
The reader should familiarize themselves at least with the high-level concepts as well as in the [specs](https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#2d-reed-solomon-encoding-scheme).
1111

1212
The academic [paper](https://arxiv.org/abs/1905.09274) describes the motivation and context for this API.
1313
The main motivation can be quoted from section 3.3 of that paper:

‎go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/cometbft/cometbft
22

3-
go 1.22.4
3+
go 1.22.5
44

55
require (
66
github.com/BurntSushi/toml v1.2.1
@@ -12,7 +12,7 @@ require (
1212
github.com/btcsuite/btcd/btcec/v2 v2.2.1
1313
github.com/btcsuite/btcd/btcutil v1.1.2
1414
github.com/bufbuild/buf v1.9.0
15-
github.com/celestiaorg/nmt v0.21.0
15+
github.com/celestiaorg/nmt v0.22.0
1616
github.com/cometbft/cometbft-db v0.7.0
1717
github.com/creachadair/taskgroup v0.3.2
1818
github.com/fortytw2/leaktest v1.3.0

‎go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ github.com/bufbuild/protocompile v0.1.0/go.mod h1:ix/MMMdsT3fzxfw91dvbfzKW3fRRnu
157157
github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY=
158158
github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc=
159159
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
160-
github.com/celestiaorg/nmt v0.21.0 h1:81MBqxNn3orByoiCtdNVjwi5WsLgMkzHwP02ZMhTBHM=
161-
github.com/celestiaorg/nmt v0.21.0/go.mod h1:ia/EpCk0enD5yO5frcxoNoFToz2Ghtk2i+blmCRjIY8=
160+
github.com/celestiaorg/nmt v0.22.0 h1:AGtfmBiVgreR1KkIV5R7XFNeMp/H4IUDLlBbLjZZ3zk=
161+
github.com/celestiaorg/nmt v0.22.0/go.mod h1:ia/EpCk0enD5yO5frcxoNoFToz2Ghtk2i+blmCRjIY8=
162162
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
163163
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
164164
github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4=

‎libs/log/filter.go

+30-7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type level byte
77
const (
88
levelDebug level = 1 << iota
99
levelInfo
10+
levelWarn
1011
levelError
1112
)
1213

@@ -54,6 +55,14 @@ func (l *filter) Debug(msg string, keyvals ...interface{}) {
5455
l.next.Debug(msg, keyvals...)
5556
}
5657

58+
func (l *filter) Warn(msg string, keyvals ...interface{}) {
59+
levelAllowed := l.allowed&levelWarn != 0
60+
if !levelAllowed {
61+
return
62+
}
63+
l.next.Warn(msg, keyvals...)
64+
}
65+
5766
func (l *filter) Error(msg string, keyvals ...interface{}) {
5867
levelAllowed := l.allowed&levelError != 0
5968
if !levelAllowed {
@@ -137,12 +146,14 @@ func AllowLevel(lvl string) (Option, error) {
137146
return AllowDebug(), nil
138147
case "info":
139148
return AllowInfo(), nil
149+
case "warn":
150+
return AllowWarn(), nil
140151
case "error":
141152
return AllowError(), nil
142153
case "none":
143154
return AllowNone(), nil
144155
default:
145-
return nil, fmt.Errorf("expected either \"info\", \"debug\", \"error\" or \"none\" level, given %s", lvl)
156+
return nil, fmt.Errorf("expected either \"info\", \"debug\", \"warn\", \"error\" or \"none\" level, given %s", lvl)
146157
}
147158
}
148159

@@ -153,12 +164,17 @@ func AllowAll() Option {
153164

154165
// AllowDebug allows error, info and debug level log events to pass.
155166
func AllowDebug() Option {
156-
return allowed(levelError | levelInfo | levelDebug)
167+
return allowed(levelError | levelWarn | levelInfo | levelDebug)
157168
}
158169

159170
// AllowInfo allows error and info level log events to pass.
160171
func AllowInfo() Option {
161-
return allowed(levelError | levelInfo)
172+
return allowed(levelError | levelWarn | levelInfo)
173+
}
174+
175+
// AllowWarn allows error and warn level log events to pass.
176+
func AllowWarn() Option {
177+
return allowed(levelError | levelWarn)
162178
}
163179

164180
// AllowError allows only error level log events to pass.
@@ -175,14 +191,21 @@ func allowed(allowed level) Option {
175191
return func(l *filter) { l.allowed = allowed }
176192
}
177193

178-
// AllowDebugWith allows error, info and debug level log events to pass for a specific key value pair.
194+
// AllowDebugWith allows error, warn, info and debug level log events to pass for a specific key value pair.
179195
func AllowDebugWith(key interface{}, value interface{}) Option {
180-
return func(l *filter) { l.allowedKeyvals[keyval{key, value}] = levelError | levelInfo | levelDebug }
196+
return func(l *filter) {
197+
l.allowedKeyvals[keyval{key, value}] = levelError | levelWarn | levelInfo | levelDebug
198+
}
181199
}
182200

183-
// AllowInfoWith allows error and info level log events to pass for a specific key value pair.
201+
// AllowInfoWith allows error, warn, and info level log events to pass for a specific key value pair.
184202
func AllowInfoWith(key interface{}, value interface{}) Option {
185-
return func(l *filter) { l.allowedKeyvals[keyval{key, value}] = levelError | levelInfo }
203+
return func(l *filter) { l.allowedKeyvals[keyval{key, value}] = levelError | levelWarn | levelInfo }
204+
}
205+
206+
// AllowWarnWith allows only error and warn log events to pass for a specific key value pair.
207+
func AllowWarnWith(key interface{}, value interface{}) Option {
208+
return func(l *filter) { l.allowedKeyvals[keyval{key, value}] = levelError | levelWarn }
186209
}
187210

188211
// AllowErrorWith allows only error level log events to pass for a specific key value pair.

‎libs/log/filter_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func TestVariousLevels(t *testing.T) {
2020
strings.Join([]string{
2121
`{"_msg":"here","level":"debug","this is":"debug log"}`,
2222
`{"_msg":"here","level":"info","this is":"info log"}`,
23+
`{"_msg":"here","level":"warn","this is":"warn log"}`,
2324
`{"_msg":"here","level":"error","this is":"error log"}`,
2425
}, "\n"),
2526
},
@@ -29,6 +30,7 @@ func TestVariousLevels(t *testing.T) {
2930
strings.Join([]string{
3031
`{"_msg":"here","level":"debug","this is":"debug log"}`,
3132
`{"_msg":"here","level":"info","this is":"info log"}`,
33+
`{"_msg":"here","level":"warn","this is":"warn log"}`,
3234
`{"_msg":"here","level":"error","this is":"error log"}`,
3335
}, "\n"),
3436
},
@@ -37,6 +39,15 @@ func TestVariousLevels(t *testing.T) {
3739
log.AllowInfo(),
3840
strings.Join([]string{
3941
`{"_msg":"here","level":"info","this is":"info log"}`,
42+
`{"_msg":"here","level":"warn","this is":"warn log"}`,
43+
`{"_msg":"here","level":"error","this is":"error log"}`,
44+
}, "\n"),
45+
},
46+
{
47+
"AllowWarn",
48+
log.AllowWarn(),
49+
strings.Join([]string{
50+
`{"_msg":"here","level":"warn","this is":"warn log"}`,
4051
`{"_msg":"here","level":"error","this is":"error log"}`,
4152
}, "\n"),
4253
},
@@ -62,6 +73,7 @@ func TestVariousLevels(t *testing.T) {
6273

6374
logger.Debug("here", "this is", "debug log")
6475
logger.Info("here", "this is", "info log")
76+
logger.Warn("here", "this is", "warn log")
6577
logger.Error("here", "this is", "error log")
6678

6779
if want, have := tc.want, strings.TrimSpace(buf.String()); want != have {

‎libs/log/logger.go

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
type Logger interface {
1111
Debug(msg string, keyvals ...interface{})
1212
Info(msg string, keyvals ...interface{})
13+
Warn(msg string, keyvals ...interface{})
1314
Error(msg string, keyvals ...interface{})
1415

1516
With(keyvals ...interface{}) Logger

‎libs/log/nop_logger.go

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ func NewNopLogger() Logger { return &nopLogger{} }
1010

1111
func (nopLogger) Info(string, ...interface{}) {}
1212
func (nopLogger) Debug(string, ...interface{}) {}
13+
func (nopLogger) Warn(string, ...interface{}) {}
1314
func (nopLogger) Error(string, ...interface{}) {}
1415

1516
func (l *nopLogger) With(...interface{}) Logger {

‎libs/log/tm_logger.go

+12
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ func NewTMLogger(w io.Writer) Logger {
3333
switch keyvals[1].(kitlevel.Value).String() {
3434
case "debug":
3535
return term.FgBgColor{Fg: term.DarkGray}
36+
case "warn":
37+
return term.FgBgColor{Fg: term.Yellow}
3638
case "error":
3739
return term.FgBgColor{Fg: term.Red}
3840
default:
@@ -79,6 +81,16 @@ func (l *tmLogger) Error(msg string, keyvals ...interface{}) {
7981
}
8082
}
8183

84+
// Warn logs a message at level Warn.
85+
func (l *tmLogger) Warn(msg string, keyvals ...interface{}) {
86+
lWithLevel := kitlevel.Warn(l.srcLogger)
87+
88+
lWithMsg := kitlog.With(lWithLevel, msgKey, msg)
89+
if err := lWithMsg.Log(keyvals...); err != nil {
90+
lWithMsg.Log("err", err) //nolint:errcheck // no need to check error again
91+
}
92+
}
93+
8294
// With returns a new contextual logger with keyvals prepended to those passed
8395
// to calls to Info, Debug or Error.
8496
func (l *tmLogger) With(keyvals ...interface{}) Logger {

‎libs/log/tm_logger_test.go

+23
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,29 @@ func TestDebug(t *testing.T) {
6666
}
6767
}
6868

69+
func TestWarn(t *testing.T) {
70+
var bufWarn bytes.Buffer
71+
72+
ld := log.NewTMLogger(&bufWarn)
73+
ld.Warn("Client initialized with old header (trusted is more recent)",
74+
"old", 42,
75+
"trustedHeight", "forty two",
76+
"trustedHash", []byte("test me"))
77+
78+
msg := strings.TrimSpace(bufWarn.String())
79+
80+
// Remove the timestamp information to allow
81+
// us to test against the expected message.
82+
receivedmsg := strings.Split(msg, "] ")[1]
83+
84+
const expectedmsg = `Client initialized with old header
85+
(trusted is more recent) old=42 trustedHeight="forty two"
86+
trustedHash=74657374206D65`
87+
if strings.EqualFold(receivedmsg, expectedmsg) {
88+
t.Fatalf("received %s, expected %s", receivedmsg, expectedmsg)
89+
}
90+
}
91+
6992
func TestError(t *testing.T) {
7093
var bufErr bytes.Buffer
7194

‎libs/log/tracing_logger.go

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ func (l *tracingLogger) Debug(msg string, keyvals ...interface{}) {
3636
l.next.Debug(msg, formatErrors(keyvals)...)
3737
}
3838

39+
func (l *tracingLogger) Warn(msg string, keyvals ...interface{}) {
40+
l.next.Warn(msg, formatErrors(keyvals)...)
41+
}
42+
3943
func (l *tracingLogger) Error(msg string, keyvals ...interface{}) {
4044
l.next.Error(msg, formatErrors(keyvals)...)
4145
}

‎pkg/trace/fileserver.go

+28-44
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,7 @@ func (lt *LocalTracer) PushAll() error {
259259

260260
// S3Download downloads files that match some prefix from an S3 bucket to a
261261
// local directory dst.
262-
// fileNames is a list of traced jsonl file names to download. If it is empty, all traces are downloaded.
263-
// fileNames should not have .jsonl suffix.
264-
func S3Download(dst, prefix string, fileNames []string, cfg S3Config) error {
262+
func S3Download(dst, prefix string, cfg S3Config) error {
265263
// Ensure local directory structure exists
266264
err := os.MkdirAll(dst, os.ModePerm)
267265
if err != nil {
@@ -290,51 +288,37 @@ func S3Download(dst, prefix string, fileNames []string, cfg S3Config) error {
290288

291289
err = s3Svc.ListObjectsV2Pages(input, func(page *s3.ListObjectsV2Output, lastPage bool) bool {
292290
for _, content := range page.Contents {
293-
key := *content.Key
291+
localFilePath := filepath.Join(dst, prefix, strings.TrimPrefix(*content.Key, prefix))
292+
fmt.Printf("Downloading %s to %s\n", *content.Key, localFilePath)
294293

295-
// If no fileNames are specified, download all files
296-
if len(fileNames) == 0 {
297-
fileNames = append(fileNames, strings.TrimPrefix(key, prefix))
294+
// Create the directories in the path
295+
if err := os.MkdirAll(filepath.Dir(localFilePath), os.ModePerm); err != nil {
296+
return false
298297
}
299298

300-
for _, filename := range fileNames {
301-
// Add .jsonl suffix to the fileNames
302-
fullFilename := filename + ".jsonl"
303-
if strings.HasSuffix(key, fullFilename) {
304-
localFilePath := filepath.Join(dst, prefix, strings.TrimPrefix(key, prefix))
305-
fmt.Printf("Downloading %s to %s\n", key, localFilePath)
306-
307-
// Create the directories in the path
308-
if err := os.MkdirAll(filepath.Dir(localFilePath), os.ModePerm); err != nil {
309-
return false
310-
}
311-
312-
// Create a file to write the S3 Object contents to.
313-
f, err := os.Create(localFilePath)
314-
if err != nil {
315-
return false
316-
}
317-
318-
resp, err := s3Svc.GetObject(&s3.GetObjectInput{
319-
Bucket: aws.String(cfg.BucketName),
320-
Key: aws.String(key),
321-
})
322-
if err != nil {
323-
f.Close()
324-
continue
325-
}
326-
defer resp.Body.Close()
327-
328-
// Copy the contents of the S3 object to the local file
329-
if _, err := io.Copy(f, resp.Body); err != nil {
330-
f.Close()
331-
return false
332-
}
333-
334-
fmt.Printf("Successfully downloaded %s to %s\n", key, localFilePath)
335-
f.Close()
336-
}
299+
// Create a file to write the S3 Object contents to.
300+
f, err := os.Create(localFilePath)
301+
if err != nil {
302+
return false
303+
}
304+
305+
resp, err := s3Svc.GetObject(&s3.GetObjectInput{
306+
Bucket: aws.String(cfg.BucketName),
307+
Key: aws.String(*content.Key),
308+
})
309+
if err != nil {
310+
f.Close()
311+
continue
337312
}
313+
defer resp.Body.Close()
314+
315+
// Copy the contents of the S3 object to the local file
316+
if _, err := io.Copy(f, resp.Body); err != nil {
317+
return false
318+
}
319+
320+
fmt.Printf("Successfully downloaded %s to %s\n", *content.Key, localFilePath)
321+
f.Close()
338322
}
339323
return !lastPage // continue paging
340324
})

‎scripts/proto-gen.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cd "$(git rev-parse --show-toplevel)"
1010

1111
# Run inside Docker to install the correct versions of the required tools
1212
# without polluting the local system.
13-
docker run --rm -i -v "$PWD":/w --workdir=/w golang:1.22.4-alpine sh <<"EOF"
13+
docker run --rm -i -v "$PWD":/w --workdir=/w golang:1.22.5-alpine sh <<"EOF"
1414
apk add git make
1515
1616
go install github.com/bufbuild/buf/cmd/buf

‎state/execution.go

+6
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ func (blockExec *BlockExecutor) CreateProposalBlock(
153153
panic(fmt.Sprintf("state machine returned an invalid prepare proposal response: expected last transaction to be a hash, got %d bytes", len(rpp.Txs[len(rpp.Txs)-2])))
154154
}
155155

156+
// don't count the last tx in rpp.Txs which is data root back from app
157+
rejectedTxs := len(block.Txs) - (len(rpp.Txs) - 1)
158+
if rejectedTxs > 0 {
159+
blockExec.metrics.RejectedTransactions.Add(float64(rejectedTxs))
160+
}
161+
156162
// update the block with the response from PrepareProposal
157163
block.Data.Txs = types.ToTxs(rpp.Txs[:len(rpp.Txs)-1])
158164
// update the data hash with the one passed back by celestia-app

‎state/metrics.go

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ type Metrics struct {
1919
BlockProcessingTime metrics.Histogram
2020
// Count of times a block was rejected via ProcessProposal
2121
ProcessProposalRejected metrics.Counter
22+
// Count of transactions rejected by application.
23+
RejectedTransactions metrics.Counter
2224
}
2325

2426
// PrometheusMetrics returns Metrics build using Prometheus client library.
@@ -43,6 +45,12 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
4345
Name: "process_proposal_rejected",
4446
Help: "Count of times a block was rejected via ProcessProposal",
4547
}, labels).With(labelsAndValues...),
48+
RejectedTransactions: prometheus.NewCounterFrom(stdprometheus.CounterOpts{
49+
Namespace: namespace,
50+
Subsystem: MetricsSubsystem,
51+
Name: "rejected_transactions",
52+
Help: "Count of transactions rejected by application",
53+
}, labels).With(labelsAndValues...),
4654
}
4755
}
4856

@@ -51,5 +59,6 @@ func NopMetrics() *Metrics {
5159
return &Metrics{
5260
BlockProcessingTime: discard.NewHistogram(),
5361
ProcessProposalRejected: discard.NewCounter(),
62+
RejectedTransactions: discard.NewCounter(),
5463
}
5564
}

‎test/docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.22.4
1+
FROM golang:1.22.5
22

33
# Grab deps (jq, hexdump, xxd, killall)
44
RUN apt-get update && \

‎test/e2e/docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# We need to build in a Linux environment to support C libraries, e.g. RocksDB.
22
# We use Debian instead of Alpine, so that we can use binary database packages
33
# instead of spending time compiling them.
4-
FROM golang:1.22.4-bullseye
4+
FROM golang:1.22.5-bullseye
55

66
RUN apt-get -qq update -y && apt-get -qq upgrade -y >/dev/null
77
RUN apt-get -qq install -y libleveldb-dev librocksdb-dev >/dev/null

0 commit comments

Comments
 (0)
Please sign in to comment.