-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 815a4d9
Showing
60 changed files
with
2,895 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
target-branch: "main" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Lint | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.21" | ||
- uses: actions/checkout@v3 | ||
- name: GolangCI Lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.55.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Test | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: self-hosted | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.21" | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Test | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
### Visual Studio Code | ||
.vscode/* | ||
|
||
|
||
### JetBrains | ||
.idea/* | ||
|
||
!.idea/icon.svg | ||
|
||
### Linux | ||
|
||
### Go template | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
### macOS | ||
.DS_Store | ||
|
||
### Project | ||
/build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
run: | ||
timeout: 10m | ||
|
||
linters: | ||
enable: | ||
# Enabled by default | ||
- errcheck | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- unused | ||
# Disabled by default | ||
- asasalint | ||
- asciicheck | ||
- bodyclose | ||
- errorlint | ||
- gci | ||
- gocyclo | ||
- gosec | ||
- makezero | ||
- noctx | ||
- paralleltest | ||
- prealloc | ||
- reassign | ||
- revive | ||
- whitespace | ||
- wsl | ||
|
||
issues: | ||
max-issues-per-linter: 0 # Unlimited | ||
max-same-issues: 0 # Unlimited |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/golangci/golangci-lint | ||
rev: v1.55.2 | ||
hooks: | ||
- id: golangci-lint | ||
- repo: https://github.com/commitizen-tools/commitizen | ||
rev: v2.42.1 | ||
hooks: | ||
- id: commitizen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="build" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile"> | ||
<makefile filename="$PROJECT_DIR$/Makefile" target="build" workingDirectory="" arguments=""> | ||
<envs /> | ||
</makefile> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="image" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile"> | ||
<makefile filename="$PROJECT_DIR$/Makefile" target="image" workingDirectory="" arguments=""> | ||
<envs /> | ||
</makefile> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="lint" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile"> | ||
<makefile filename="$PROJECT_DIR$/Makefile" target="lint" workingDirectory="" arguments=""> | ||
<envs /> | ||
</makefile> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="run" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile"> | ||
<makefile filename="$PROJECT_DIR$/Makefile" target="run" workingDirectory="" arguments=""> | ||
<envs /> | ||
</makefile> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="test" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile"> | ||
<makefile filename="$PROJECT_DIR$/Makefile" target="test" workingDirectory="" arguments=""> | ||
<envs /> | ||
</makefile> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @polebug @kallydev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM golang:1.21.3-alpine AS builder | ||
|
||
WORKDIR /root/rss3-node | ||
|
||
COPY . . | ||
|
||
RUN apk add --no-cache git make gcc libc-dev | ||
|
||
RUN CGO_ENABLED=1 make build | ||
|
||
FROM alpine:3.18.4 AS runner | ||
|
||
WORKDIR /root/rss3-node | ||
|
||
RUN apk add --no-cache ca-certificates tzdata | ||
|
||
COPY --from=builder /root/rss3-node/build/rss3-node . | ||
|
||
ENTRYPOINT ["./rss3-node"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
VERSION=$(shell git describe --tags --abbrev=0) | ||
COMMIT=$(shell git rev-parse --short HEAD) | ||
|
||
ifeq ($(VERSION),) | ||
VERSION="0.0.0" | ||
endif | ||
|
||
generate: | ||
go generate ./... | ||
|
||
lint: generate | ||
go mod tidy | ||
go run github.com/golangci/golangci-lint/cmd/[email protected] run | ||
|
||
test: | ||
go test -cover -v ./... | ||
|
||
.PHONY: build | ||
build: generate | ||
mkdir -p ./build | ||
go build \ | ||
-ldflags "-X github.com/naturalselectionlabs/rss3-node/internal/constant.Version=$(VERSION) -X github.com/naturalselectionlabs/rss3-node/internal/constant.Commit=$(COMMIT)" \ | ||
-o ./build/rss3-node ./cmd | ||
|
||
image: generate | ||
docker build \ | ||
--tag naturalselectionlabs/rss3-node:$(VERSION) \ | ||
. | ||
|
||
run: generate | ||
ENVIRONMENT=development go run ./cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# RSS3 Node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/naturalselectionlabs/rss3-node/internal/config" | ||
"github.com/naturalselectionlabs/rss3-node/internal/config/flag" | ||
"github.com/naturalselectionlabs/rss3-node/internal/constant" | ||
"github.com/naturalselectionlabs/rss3-node/internal/node" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
"go.uber.org/zap" | ||
) | ||
|
||
var command = cobra.Command{ | ||
Use: constant.Name, | ||
Version: constant.BuildVersion(), | ||
SilenceUsage: true, | ||
SilenceErrors: true, | ||
PreRunE: func(cmd *cobra.Command, args []string) error { | ||
return viper.BindPFlags(cmd.Flags()) | ||
}, | ||
RunE: func(cmd *cobra.Command, _ []string) error { | ||
config, err := config.Setup(viper.GetString(flag.KeyConfig)) | ||
if err != nil { | ||
return fmt.Errorf("setup config file: %w", err) | ||
} | ||
|
||
server, err := node.NewServer(config.Node) | ||
if err != nil { | ||
return fmt.Errorf("build node server: %w", err) | ||
} | ||
|
||
return server.Run(cmd.Context()) | ||
}, | ||
} | ||
|
||
func initializeLogger() { | ||
if viper.GetString(config.Environment) == config.EnvironmentDevelopment { | ||
zap.ReplaceGlobals(zap.Must(zap.NewDevelopment())) | ||
} else { | ||
zap.ReplaceGlobals(zap.Must(zap.NewProduction())) | ||
} | ||
} | ||
|
||
func init() { | ||
initializeLogger() | ||
|
||
command.PersistentFlags().String(flag.KeyConfig, "./deploy/config.development.yaml", "config file path") | ||
} | ||
|
||
func main() { | ||
if err := command.ExecuteContext(context.Background()); err != nil { | ||
zap.L().Fatal("execute command", zap.Error(err)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
environment: development | ||
node: | ||
network: arweave | ||
chain: mainnet | ||
endpoint: https://ethereum.blockpi.network/v1/rpc/public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
module github.com/naturalselectionlabs/rss3-node | ||
|
||
go 1.21 | ||
|
||
require ( | ||
github.com/ethereum/go-ethereum v1.13.5 | ||
github.com/samber/lo v1.38.1 | ||
github.com/shopspring/decimal v1.3.1 | ||
github.com/sourcegraph/conc v0.3.0 | ||
github.com/spf13/cobra v1.8.0 | ||
github.com/spf13/viper v1.17.0 | ||
github.com/stretchr/testify v1.8.4 | ||
go.uber.org/zap v1.26.0 | ||
) | ||
|
||
require ( | ||
github.com/Microsoft/go-winio v0.6.1 // indirect | ||
github.com/StackExchange/wmi v1.2.1 // indirect | ||
github.com/bits-and-blooms/bitset v1.7.0 // indirect | ||
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect | ||
github.com/consensys/bavard v0.1.13 // indirect | ||
github.com/consensys/gnark-crypto v0.12.1 // indirect | ||
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect | ||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect | ||
github.com/deckarep/golang-set/v2 v2.1.0 // indirect | ||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect | ||
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect | ||
github.com/fsnotify/fsnotify v1.7.0 // indirect | ||
github.com/go-ole/go-ole v1.2.5 // indirect | ||
github.com/go-stack/stack v1.8.1 // indirect | ||
github.com/gorilla/websocket v1.4.2 // indirect | ||
github.com/hashicorp/hcl v1.0.0 // indirect | ||
github.com/holiman/uint256 v1.2.3 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/magiconair/properties v1.8.7 // indirect | ||
github.com/mattn/go-isatty v0.0.19 // indirect | ||
github.com/mitchellh/mapstructure v1.5.0 // indirect | ||
github.com/mmcloughlin/addchain v0.4.0 // indirect | ||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect | ||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect | ||
github.com/sagikazarmark/locafero v0.3.0 // indirect | ||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect | ||
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect | ||
github.com/spf13/afero v1.10.0 // indirect | ||
github.com/spf13/cast v1.5.1 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/subosito/gotenv v1.6.0 // indirect | ||
github.com/supranational/blst v0.3.11 // indirect | ||
github.com/tklauser/go-sysconf v0.3.12 // indirect | ||
github.com/tklauser/numcpus v0.6.1 // indirect | ||
go.uber.org/multierr v1.11.0 // indirect | ||
golang.org/x/crypto v0.15.0 // indirect | ||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect | ||
golang.org/x/mod v0.14.0 // indirect | ||
golang.org/x/sync v0.5.0 // indirect | ||
golang.org/x/sys v0.14.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
golang.org/x/tools v0.15.0 // indirect | ||
gopkg.in/ini.v1 v1.67.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
rsc.io/tmplfunc v0.0.3 // indirect | ||
) |
Oops, something went wrong.