Skip to content

Commit 14f2303

Browse files
authored
Merge pull request #8 from DeBankDeFi/merge_upstream
Merge upstream v0.5.3
2 parents b9937aa + e0c7f74 commit 14f2303

File tree

7 files changed

+704
-1965
lines changed

7 files changed

+704
-1965
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,14 @@ jobs:
2828
- name: Set env
2929
run: |
3030
echo "REVISION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
31-
3231
- name: Docker build and push
3332
run: |
3433
docker build --no-cache -t 294354037686.dkr.ecr.ap-northeast-1.amazonaws.com/nitro-das-celestia:${{ matrix.arch }}-${REVISION} -f Dockerfile .
3534
docker push 294354037686.dkr.ecr.ap-northeast-1.amazonaws.com/nitro-das-celestia:${{ matrix.arch }}-${REVISION}
36-
3735
- name: Lark Notification
3836
continue-on-error: true
3937
run: |
4038
notiv3 "Blockchain nitro image pushed 🎉" 294354037686.dkr.ecr.ap-northeast-1.amazonaws.com/nitro-das-celestia:${{ matrix.arch }}-${REVISION}
41-
4239
merge-docker-manifest:
4340
runs-on: [self-hosted, ops]
4441
needs: build-artifacts
@@ -51,7 +48,6 @@ jobs:
5148
- name: Set env
5249
run: |
5350
echo "REVISION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
54-
5551
- name: Merge manifest
5652
run: |
5753
docker pull --platform=linux/amd64 294354037686.dkr.ecr.ap-northeast-1.amazonaws.com/nitro-das-celestia:amd64-${REVISION}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Separating the builder and runtime image allows the runtime image to be
66
# considerably smaller because it doesn't need to have Golang installed.
7-
ARG BUILDER_IMAGE=docker.io/golang:1.23.6-alpine
7+
ARG BUILDER_IMAGE=docker.io/golang:1.24.6-alpine
88
ARG RUNTIME_IMAGE=docker.io/alpine:3.19.1
99
ARG TARGETOS
1010
ARG TARGETARCH

cmd/celestiadaserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var DefaultCelestiaDAServerConfig = CelestiaDAServerConfig{
5454
RPCPort: 9876,
5555
RPCServerTimeouts: genericconf.HTTPServerTimeoutConfigDefault,
5656
RPCServerBodyLimit: genericconf.HTTPServerBodyLimitDefault,
57-
FallbackEnabled: true,
57+
FallbackEnabled: false,
5858
LogLevel: "INFO",
5959
LogType: "plaintext",
6060
Metrics: false,

daserver/celestia.go

Lines changed: 72 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import (
1212
"sync"
1313
"time"
1414

15-
node "github.com/celestiaorg/celestia-node/api/rpc/client"
15+
txclient "github.com/celestiaorg/celestia-node/api/client"
1616
"github.com/celestiaorg/celestia-node/blob"
17+
"github.com/celestiaorg/celestia-node/nodebuilder/p2p"
1718
"github.com/celestiaorg/celestia-node/state"
1819
libshare "github.com/celestiaorg/go-square/v2/share"
1920
"github.com/celestiaorg/nitro-das-celestia/celestiagen"
@@ -38,7 +39,15 @@ type DAConfig struct {
3839
NamespaceId string `koanf:"namespace-id" `
3940
AuthToken string `koanf:"auth-token" reload:"hot"`
4041
ReadAuthToken string `koanf:"read-auth-token" reload:"hot"`
42+
CoreToken string `koanf:"core-token" reload:"hot"`
43+
CoreURL string `koanf:"core-url" reload:"hot"`
44+
CoreNetwork string `koanf:"core-network" reload:"hot"`
45+
KeyName string `koanf:"key-name" reload:"hot"`
46+
KeyPath string `koanf:"key-path" reload:"hot"`
47+
BackendName string `koanf:"backend-name" reload:"hot"`
4148
NoopWriter bool `koanf:"noop-writer" reload:"hot"`
49+
EnableDATLS bool `koanf:"enable-da-tls" reload:"hot"`
50+
EnableCoreTLS bool `koanf:"enable-core-tls" reload:"hot"`
4251
ValidatorConfig ValidatorConfig `koanf:"validator-config" reload:"hot"`
4352
ReorgOnReadFailure bool `koanf:"dangerous-reorg-on-read-failure"`
4453
CacheCleanupTime time.Duration `koanf:"cache-time"`
@@ -87,8 +96,8 @@ func IsCelestiaMessageHeaderByte(header byte) bool {
8796

8897
type CelestiaDA struct {
8998
Cfg *DAConfig
90-
Client *node.Client
91-
ReadClient *node.Client
99+
Client *txclient.Client
100+
ReadClient *txclient.Client
92101

93102
Namespace *libshare.Namespace
94103

@@ -104,6 +113,14 @@ func CelestiaDAConfigAddOptions(prefix string, f *pflag.FlagSet) {
104113
f.String(prefix+".namespace-id", "", "Celestia Namespace to post data to")
105114
f.String(prefix+".auth-token", "", "Auth token for Celestia Node")
106115
f.String(prefix+".read-auth-token", "", "Auth token for Celestia Node")
116+
f.String(prefix+".core-token", "", "Auth token for Core Celestia Node Endpoint")
117+
f.String(prefix+".core-url", "", "URL to Celestia Core endpoint")
118+
f.String(prefix+".core-network", "celestia", "Celestia Network to use")
119+
f.String(prefix+".key-name", "my_key", "key name to use")
120+
f.String(prefix+".key-path", "./keys", "key path to use")
121+
f.String(prefix+".backend-name", "test", "keyring backend to use")
122+
f.Bool(prefix+".enable-da-tls", false, "enable TLS for DA node")
123+
f.Bool(prefix+".enable-core-tls", false, "enable TLS for Core node")
107124
f.Bool(prefix+".noop-writer", false, "Noop writer (disable posting to celestia)")
108125
f.String(prefix+".validator-config"+".eth-rpc", "", "Parent chain connection, only used for validation")
109126
f.String(prefix+".validator-config"+".blobstream", "", "Blobstream address, only used for validation")
@@ -116,21 +133,62 @@ func NewCelestiaDA(cfg *DAConfig) (*CelestiaDA, error) {
116133
if cfg == nil {
117134
return nil, errors.New("celestia cfg cannot be blank")
118135
}
119-
daClient, err := node.NewClient(context.Background(), cfg.Rpc, cfg.AuthToken)
136+
137+
// Create a keyring
138+
_, err := txclient.KeyringWithNewKey(txclient.KeyringConfig{
139+
KeyName: cfg.KeyName,
140+
BackendName: cfg.BackendName,
141+
}, cfg.KeyPath)
120142
if err != nil {
121143
return nil, err
122144
}
123145

124-
var readClient *node.Client
125-
if cfg.ReadRpc != "" && cfg.ReadAuthToken != "" {
126-
readClient, err = node.NewClient(context.Background(), cfg.ReadRpc, cfg.ReadAuthToken)
127-
if err != nil {
128-
return nil, err
129-
}
130-
} else {
131-
readClient = daClient
146+
// Configure the client
147+
clientCfg := txclient.Config{
148+
ReadConfig: txclient.ReadConfig{
149+
BridgeDAAddr: cfg.Rpc,
150+
DAAuthToken: cfg.AuthToken,
151+
EnableDATLS: cfg.EnableDATLS,
152+
},
153+
SubmitConfig: txclient.SubmitConfig{
154+
DefaultKeyName: cfg.KeyName,
155+
Network: p2p.Network(cfg.CoreNetwork),
156+
CoreGRPCConfig: txclient.CoreGRPCConfig{
157+
Addr: cfg.CoreURL,
158+
TLSEnabled: cfg.EnableCoreTLS,
159+
AuthToken: cfg.CoreToken,
160+
},
161+
},
132162
}
133163

164+
readClient, err := txclient.NewReadClient(context.Background(), clientCfg.ReadConfig)
165+
if err != nil {
166+
log.Error("DEBUG: Failed to create celestia client", "err", err, "BridgeDAAddr", clientCfg.ReadConfig.BridgeDAAddr, "CoreAddr", clientCfg.SubmitConfig.CoreGRPCConfig.Addr)
167+
return nil, err
168+
}
169+
170+
celestiaClient := &txclient.Client{
171+
ReadClient: *readClient,
172+
}
173+
// if cfg.ReadRpc != "" && cfg.ReadAuthToken != "" {
174+
// log.Info("DEBUG: Configuring read client", "cfg.ReadRpc", cfg.ReadRpc)
175+
// readClientCfg := txclient.Config{
176+
// ReadConfig: txclient.ReadConfig{
177+
// BridgeDAAddr: cfg.ReadRpc,
178+
// DAAuthToken: cfg.ReadAuthToken,
179+
// EnableDATLS: cfg.EnableDATLS,
180+
// },
181+
// }
182+
// log.Info("DEBUG: About to create read client", "ReadBridgeDAAddr", readClientCfg.ReadConfig.BridgeDAAddr)
183+
// readClient, err = txclient.New(context.Background(), readClientCfg, kr)
184+
// if err != nil {
185+
// log.Error("DEBUG: Failed to create read client", "err", err, "ReadBridgeDAAddr", readClientCfg.ReadConfig.BridgeDAAddr)
186+
// return nil, err
187+
// }
188+
// } else {
189+
// readClient = celestiaClient
190+
// }
191+
134192
if cfg.NamespaceId == "" {
135193
return nil, errors.New("namespace id cannot be blank")
136194
}
@@ -146,8 +204,8 @@ func NewCelestiaDA(cfg *DAConfig) (*CelestiaDA, error) {
146204

147205
da := &CelestiaDA{
148206
Cfg: cfg,
149-
Client: daClient,
150-
ReadClient: readClient,
207+
Client: celestiaClient,
208+
ReadClient: celestiaClient,
151209
Namespace: &namespace,
152210
}
153211

daserver/proof.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"math/big"
55

66
"github.com/celestiaorg/celestia-node/nodebuilder/blobstream"
7-
"github.com/tendermint/tendermint/crypto/merkle"
7+
"github.com/cometbft/cometbft/crypto/merkle"
88
)
99

1010
type Namespace struct {

0 commit comments

Comments
 (0)