-
Notifications
You must be signed in to change notification settings - Fork 0
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 33b2fdb
Showing
26 changed files
with
2,950 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,31 @@ | ||
# Tessellated Standard Build: | ||
# - run build, test, lint | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
check-weather-watch: | ||
strategy: | ||
matrix: | ||
make_action: ["build", "lint"] | ||
runs-on: ubuntu-latest | ||
name: "${{matrix.make_action}} restake-go" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.20' | ||
- name: Set up private repo access | ||
run: | | ||
git config --global url."https://${{ secrets.PERSONAL_ACCESS_TOKEN_FOR_GO_PACKAGES }}@github.com/".insteadOf "https://github.com/" | ||
- name: "${{matrix.make_action}} Code" | ||
run: make ${{matrix.make_action}} | ||
|
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,2 @@ | ||
config.yaml | ||
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,146 @@ | ||
run: | ||
tests: true | ||
timeout: 15m | ||
sort-results: true | ||
allow-parallel-runners: true | ||
exclude-dir: testutil/testdata | ||
skip-files: | ||
- server/grpc/gogoreflection/fix_registration.go | ||
- "fix_registration.go" | ||
- ".*\\.pb\\.go$" | ||
- ".*\\.pb\\.gw\\.go$" | ||
- ".*\\.pulsar\\.go$" | ||
- ".*\\_test.go" | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- errcheck | ||
- dogsled | ||
- exportloopref | ||
- goconst | ||
- gocritic | ||
- gci | ||
- gofumpt | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- nolintlint | ||
- staticcheck | ||
- revive | ||
- stylecheck | ||
- typecheck | ||
- thelper | ||
- unconvert | ||
- unused | ||
|
||
issues: | ||
exclude-rules: | ||
- text: "ST1003:" | ||
linters: | ||
- stylecheck | ||
# FIXME: Disabled until golangci-lint updates stylecheck with this fix: | ||
# https://github.com/dominikh/go-tools/issues/389 | ||
- text: "ST1016:" | ||
linters: | ||
- stylecheck | ||
- path: "migrations" | ||
text: "SA1019:" | ||
linters: | ||
- staticcheck | ||
- text: "SA1019: codec.NewAminoCodec is deprecated" | ||
linters: | ||
- staticcheck | ||
- text: "SA1019: legacybech32.MustMarshalPubKey" | ||
linters: | ||
- staticcheck | ||
- text: "SA1019: legacybech32.MarshalPubKey" | ||
linters: | ||
- staticcheck | ||
- text: "SA1019: legacybech32.UnmarshalPubKey" | ||
linters: | ||
- staticcheck | ||
- text: "SA1019: params.SendEnabled is deprecated" | ||
linters: | ||
- staticcheck | ||
- text: "leading space" | ||
linters: | ||
- nolintlint | ||
max-issues-per-linter: 10000 | ||
max-same-issues: 10000 | ||
|
||
linters-settings: | ||
gci: | ||
custom-order: true | ||
sections: | ||
- standard # Standard section: captures all standard packages. | ||
- default # Default section: contains all imports that could not be matched to another section type. | ||
- prefix(cosmossdk.io) | ||
- prefix(github.com/cosmos/cosmos-sdk) | ||
revive: | ||
rules: | ||
- name: redefines-builtin-id | ||
disabled: true | ||
|
||
gosec: | ||
# To select a subset of rules to run. | ||
# Available rules: https://github.com/securego/gosec#available-rules | ||
# Default: [] - means include all rules | ||
includes: | ||
- G101 # Look for hard coded credentials | ||
- G102 # Bind to all interfaces | ||
- G103 # Audit the use of unsafe block | ||
- G104 # Audit errors not checked | ||
- G106 # Audit the use of ssh.InsecureIgnoreHostKey | ||
# - G107 # Url provided to HTTP request as taint input | ||
- G108 # Profiling endpoint automatically exposed on /debug/pprof | ||
- G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32 | ||
- G110 # Potential DoS vulnerability via decompression bomb | ||
- G111 # Potential directory traversal | ||
- G112 # Potential slowloris attack | ||
- G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772) | ||
- G114 # Use of net/http serve function that has no support for setting timeouts | ||
- G201 # SQL query construction using format string | ||
- G202 # SQL query construction using string concatenation | ||
- G203 # Use of unescaped data in HTML templates | ||
- G204 # Audit use of command execution | ||
- G301 # Poor file permissions used when creating a directory | ||
- G302 # Poor file permissions used with chmod | ||
- G303 # Creating tempfile using a predictable path | ||
- G304 # File path provided as taint input | ||
- G305 # File traversal when extracting zip/tar archive | ||
- G306 # Poor file permissions used when writing to a new file | ||
- G307 # Deferring a method which returns an error | ||
- G401 # Detect the usage of DES, RC4, MD5 or SHA1 | ||
- G402 # Look for bad TLS connection settings | ||
- G403 # Ensure minimum RSA key length of 2048 bits | ||
- G404 # Insecure random number source (rand) | ||
- G501 # Import blocklist: crypto/md5 | ||
- G502 # Import blocklist: crypto/des | ||
- G503 # Import blocklist: crypto/rc4 | ||
- G504 # Import blocklist: net/http/cgi | ||
- G505 # Import blocklist: crypto/sha1 | ||
- G601 # Implicit memory aliasing of items from a range statement | ||
misspell: | ||
locale: US | ||
gofumpt: | ||
extra-rules: true | ||
dogsled: | ||
max-blank-identifiers: 6 | ||
maligned: | ||
suggest-new: true | ||
nolintlint: | ||
allow-unused: false | ||
allow-leading-space: true | ||
require-explanation: true | ||
require-specific: false | ||
gosimple: | ||
checks: ["all"] | ||
gocritic: | ||
disabled-checks: | ||
- regexpMust | ||
- appendAssign | ||
- ifElseChain |
Empty file.
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,103 @@ | ||
#!/usr/bin/make -f | ||
|
||
DOCKER := $(shell which docker) | ||
|
||
CURRENT_DIR = $(shell pwd) | ||
BUILDDIR ?= $(CURDIR)/build | ||
|
||
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)' | ||
# check for nostrip option | ||
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS))) | ||
BUILD_FLAGS += -trimpath | ||
endif | ||
|
||
# Check for debug option | ||
ifeq (debug,$(findstring debug,$(COSMOS_BUILD_OPTIONS))) | ||
BUILD_FLAGS += -gcflags "all=-N -l" | ||
endif | ||
|
||
############################################################################### | ||
### Protobuf ### | ||
############################################################################### | ||
|
||
protoImageName=proto-genc | ||
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace/proto $(protoImageName) | ||
|
||
proto-all: proto-build-docker proto-format proto-lint make proto-format proto-update-deps proto-gen | ||
|
||
proto-build-docker: | ||
@echo "Building Docker Container '$(protoImageName)' for Protobuf Compilation" | ||
@docker build -t $(protoImageName) -f ./proto/Dockerfile . | ||
|
||
proto-gen: | ||
@echo "Generating Protobuf Files" | ||
@$(protoImage) sh -c "cd .. && sh ./scripts/protocgen.sh" | ||
|
||
proto-format: | ||
@echo "Formatting Protobuf Files with Clang" | ||
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \; | ||
|
||
proto-lint: | ||
@echo "Linting Protobuf Files With Buf" | ||
@$(protoImage) buf lint | ||
|
||
proto-check-breaking: | ||
@$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=main | ||
|
||
proto-update-deps: | ||
@echo "Updating Protobuf dependencies" | ||
@$(protoImage) buf mod update | ||
|
||
.PHONY: proto-all proto-gen proto-format proto-lint proto-check-breaking proto-update-deps | ||
|
||
############################################################################### | ||
### Build ### | ||
############################################################################### | ||
|
||
BUILD_TARGETS := build | ||
|
||
build: BUILD_ARGS= | ||
|
||
build-linux-amd64: | ||
@GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build | ||
|
||
build-linux-arm64: | ||
@GOOS=linux GOARCH=arm64 LEDGER_ENABLED=false $(MAKE) build | ||
|
||
$(BUILD_TARGETS): go.sum $(BUILDDIR)/ | ||
@cd ${CURRENT_DIR} && go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./... | ||
|
||
$(BUILDDIR)/: | ||
@mkdir -p $(BUILDDIR)/ | ||
|
||
############################################################################### | ||
### Tools & Dependencies ### | ||
############################################################################### | ||
|
||
go.sum: go.mod | ||
@go mod verify | ||
@go mod tidy | ||
|
||
|
||
############################################################################### | ||
### Linting ### | ||
############################################################################### | ||
|
||
golangci_version=v1.53.3 | ||
|
||
lint-install: | ||
@echo "--> Installing golangci-lint $(golangci_version)" | ||
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version) | ||
|
||
lint: | ||
@echo "--> Running linter" | ||
$(MAKE) lint-install | ||
@golangci-lint run -c "./.golangci.yml" | ||
|
||
lint-fix: | ||
@echo "--> Running linter" | ||
$(MAKE) lint-install | ||
@golangci-lint run -c "./.golangci.yml" --fix | ||
|
||
|
||
.PHONY: lint lint-fix |
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,10 @@ | ||
# Restake-Go | ||
|
||
Restake-Go is an implementation of the Restake Daemon in native golang. Restake-Go runs over gRPC and is opinionated about retrying. | ||
|
||
Restake-Go is provided at a beta-level. Tessellated uses this software in production, and you may too, but we make no warranties or guarantees. | ||
|
||
```shell | ||
make install | ||
restake-go --help | ||
``` |
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,10 @@ | ||
- Periodically reconnect the clients?\ | ||
- Context with timeout | ||
|
||
- make makefile work | ||
- default gas price increase | ||
- pull blocks | ||
- what is with too many pings | ||
- consider grant sizes or limits and query them correctly | ||
|
||
- print out what the gas fee is |
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,38 @@ | ||
/* | ||
Copyright © 2023 Tessellated <tessellated.io> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// rootCmd represents the base command when called without any subcommands | ||
var rootCmd = &cobra.Command{ | ||
Use: "restake", | ||
Short: "Restake implements the Restake protocol.", | ||
Long: `Restake is an alternative implementation of the Restake protocol. See also: https://github.com/eco-stake/restake.`, | ||
} | ||
|
||
// Execute adds all child commands to the root command and sets flags appropriately. | ||
// This is called by main.main(). It only needs to happen once to the rootCmd. | ||
func Execute() { | ||
err := rootCmd.Execute() | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func init() { | ||
// Here you will define your flags and configuration settings. | ||
// Cobra supports persistent flags, which, if defined here, | ||
// will be global for your application. | ||
|
||
// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.restake-go.yaml)") | ||
|
||
// Cobra also supports local flags, which will only run | ||
// when this action is called directly. | ||
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") | ||
} |
Oops, something went wrong.