Skip to content

Commit

Permalink
Merge branch 'main' into fix_devex_issues
Browse files Browse the repository at this point in the history
  • Loading branch information
renaynay authored Jul 2, 2024
2 parents 31f3543 + 0e5c61c commit c1e0076
Show file tree
Hide file tree
Showing 9 changed files with 277 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
env:
# upgrade go version throughout pipeline here
GO_VERSION: "1.22"
GO_VERSION: "1.22.4"
outputs:
go-version: ${{ steps.set-vars.outputs.go-version }}
branch: ${{ steps.trim_ref.outputs.branch }}
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM docker.io/golang:1.22-alpine3.18 as builder
FROM --platform=$BUILDPLATFORM docker.io/golang:1.22.4-alpine3.20 as builder

ARG TARGETPLATFORM
ARG BUILDPLATFORM
Expand All @@ -25,7 +25,7 @@ RUN uname -a &&\
CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
make build && make cel-key

FROM docker.io/alpine:3.20.0
FROM docker.io/alpine:3.20.1

# Read here why UID 10001: https://github.com/hexops/dockerfile/blob/main/README.md#do-not-use-a-uid-below-10000
ARG UID=10001
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Continue reading [here](https://blog.celestia.org/celestia-mvp-release-data-avai

| Requirement | Notes |
| ----------- |----------------|
| Go version | 1.22 or higher |
| Go version | 1.22.4 or higher |

## System Requirements

Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module github.com/celestiaorg/celestia-node

go 1.22.3
go 1.22.4

require (
cosmossdk.io/errors v1.0.1
cosmossdk.io/math v1.3.0
github.com/BurntSushi/toml v1.4.0
github.com/alecthomas/jsonschema v0.0.0-20220216202328-9eeeec9d044b
github.com/benbjohnson/clock v1.3.5
github.com/celestiaorg/celestia-app v1.11.0
github.com/celestiaorg/celestia-app v1.12.0
github.com/celestiaorg/go-fraud v0.2.1
github.com/celestiaorg/go-header v0.6.2
github.com/celestiaorg/go-libp2p-messenger v0.2.0
Expand Down Expand Up @@ -184,7 +184,7 @@ require (
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.7.4 // indirect
github.com/hashicorp/go-getter v1.7.5 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
Expand Down Expand Up @@ -356,5 +356,5 @@ replace (
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
// broken goleveldb needs to be replaced for the cosmos-sdk and celestia-app
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.36.1-tm-v0.34.29
github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.37.0-tm-v0.34.29
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,10 @@ github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/celestiaorg/celestia-app v1.11.0 h1:NV2nWR4r75qWY0reawrzoMnVRRbUgVtrgtFT9+ytmGQ=
github.com/celestiaorg/celestia-app v1.11.0/go.mod h1:aKJkApIZnGt/q5ZYtsf6UM21MJR+D62rwWn2mCHKBNE=
github.com/celestiaorg/celestia-core v1.36.1-tm-v0.34.29 h1:BuYworCMtFxAYyM5l1C0gx6PT/ViHosVRydvYd7vCqs=
github.com/celestiaorg/celestia-core v1.36.1-tm-v0.34.29/go.mod h1:AL7kotb6ucKF4bpKKhGIzGhGL7dwYj2nFstiFC6PGxM=
github.com/celestiaorg/celestia-app v1.12.0 h1:7SMTI/sB8jxp7QPJQRi/liAREnToAD5nOyA7M+naPIc=
github.com/celestiaorg/celestia-app v1.12.0/go.mod h1:O/idsViCLLFdcaE4cJ+iZctZLX0KWfRheKT2W18W2uM=
github.com/celestiaorg/celestia-core v1.37.0-tm-v0.34.29 h1:9nJDE37cTg/Cx+f4FS2g7yYeoLrsaNJg36XsQ47sS1A=
github.com/celestiaorg/celestia-core v1.37.0-tm-v0.34.29/go.mod h1:IIdMu9gnDtjUmZkFuBN4Bf11z/rBtlL2rtwbQxdbRAU=
github.com/celestiaorg/cosmos-sdk v1.23.0-sdk-v0.46.16 h1:N2uETI13szEKnGAdKhtTR0EsrpcW0AwRKYER74WLnuw=
github.com/celestiaorg/cosmos-sdk v1.23.0-sdk-v0.46.16/go.mod h1:Bpl1LSWiDpQumgOhhMTZBMopqa0j7fRasIhvTZB44P0=
github.com/celestiaorg/dagstore v0.0.0-20230824094345-537c012aa403 h1:Lj73O3S+KJx5/hgZ+IeOLEIoLsAveJN/7/ZtQQtPSVw=
Expand Down Expand Up @@ -950,8 +950,8 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-getter v1.7.4 h1:3yQjWuxICvSpYwqSayAdKRFcvBl1y/vogCxczWSmix0=
github.com/hashicorp/go-getter v1.7.4/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=
github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4=
github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
Expand Down
16 changes: 14 additions & 2 deletions nodebuilder/core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import (
"github.com/celestiaorg/celestia-node/libs/utils"
)

const (
DefaultRPCPort = "26657"
DefaultGRPCPort = "9090"
)

var MetricsEnabled bool

// Config combines all configuration fields for managing the relationship with a Core node.
Expand All @@ -21,8 +26,8 @@ type Config struct {
func DefaultConfig() Config {
return Config{
IP: "",
RPCPort: "26657",
GRPCPort: "9090",
RPCPort: DefaultRPCPort,
GRPCPort: DefaultGRPCPort,
}
}

Expand All @@ -32,6 +37,13 @@ func (cfg *Config) Validate() error {
return nil
}

if cfg.RPCPort == "" {
return fmt.Errorf("nodebuilder/core: rpc port is not set")
}
if cfg.GRPCPort == "" {
return fmt.Errorf("nodebuilder/core: grpc port is not set")
}

ip, err := utils.ValidateAddr(cfg.IP)
if err != nil {
return err
Expand Down
84 changes: 84 additions & 0 deletions nodebuilder/core/config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package core

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestValidate(t *testing.T) {
tests := []struct {
name string
cfg Config
expectErr bool
}{
{
name: "valid config",
cfg: Config{
IP: "127.0.0.1",
RPCPort: DefaultRPCPort,
GRPCPort: DefaultGRPCPort,
},
expectErr: false,
},
{
name: "empty config, no endpoint",
cfg: Config{},
expectErr: false,
},
{
name: "missing RPC port",
cfg: Config{
IP: "127.0.0.1",
GRPCPort: DefaultGRPCPort,
},
expectErr: true,
},
{
name: "missing GRPC port",
cfg: Config{
IP: "127.0.0.1",
RPCPort: DefaultRPCPort,
},
expectErr: true,
},
{
name: "invalid IP",
cfg: Config{
IP: "invalid-ip",
RPCPort: DefaultRPCPort,
GRPCPort: DefaultGRPCPort,
},
expectErr: true,
},
{
name: "invalid RPC port",
cfg: Config{
IP: "127.0.0.1",
RPCPort: "invalid-port",
GRPCPort: DefaultGRPCPort,
},
expectErr: true,
},
{
name: "invalid GRPC port",
cfg: Config{
IP: "127.0.0.1",
RPCPort: DefaultRPCPort,
GRPCPort: "invalid-port",
},
expectErr: true,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := tt.cfg.Validate()
if tt.expectErr {
require.Error(t, err)
} else {
require.NoError(t, err)
}
})
}
}
17 changes: 11 additions & 6 deletions nodebuilder/core/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ func Flags() *flag.FlagSet {
)
flags.String(
coreRPCFlag,
"26657",
DefaultRPCPort,
"Set a custom RPC port for the core node connection. The --core.ip flag must also be provided.",
)
flags.String(
coreGRPCFlag,
"9090",
DefaultGRPCPort,
"Set a custom gRPC port for the core node connection. The --core.ip flag must also be provided.",
)
return flags
Expand All @@ -50,11 +50,16 @@ func ParseFlags(
return nil
}

rpc := cmd.Flag(coreRPCFlag).Value.String()
grpc := cmd.Flag(coreGRPCFlag).Value.String()
if cmd.Flag(coreRPCFlag).Changed {
rpc := cmd.Flag(coreRPCFlag).Value.String()
cfg.RPCPort = rpc
}

if cmd.Flag(coreGRPCFlag).Changed {
grpc := cmd.Flag(coreGRPCFlag).Value.String()
cfg.GRPCPort = grpc
}

cfg.IP = coreIP
cfg.RPCPort = rpc
cfg.GRPCPort = grpc
return cfg.Validate()
}
Loading

0 comments on commit c1e0076

Please sign in to comment.