Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into client-version-in-diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
dimpar committed Sep 12, 2022
2 parents 7ab8b8d + 7cd8811 commit 015e726
Show file tree
Hide file tree
Showing 164 changed files with 19,473 additions and 15,883 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,8 @@ jobs:
with:
go-version-file: "go.mod"
- name: gofmt
run: gofmt -d -e .
run: |
if [ $(gofmt -l . | wc -l) -gt 0 ]; then
gofmt -d -e .
exit 1
fi
49 changes: 0 additions & 49 deletions .github/workflows/contracts-ecdsa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,55 +274,6 @@ jobs:
upstream_ref: ${{ github.event.inputs.upstream_ref }}
version: ${{ steps.npm-version-bump.outputs.version }}

- name: Upload files needed for etherscan verification
uses: actions/upload-artifact@v3
with:
name: Artifacts for etherscan verifcation
path: |
./solidity/ecdsa/deployments
./solidity/ecdsa/package.json
./solidity/ecdsa/yarn.lock
contracts-etherscan-verification:
needs: [contracts-deployment-testnet]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./solidity/ecdsa
steps:
- uses: actions/checkout@v3

- name: Download files needed for etherscan verification
uses: actions/download-artifact@v3
with:
name: Artifacts for etherscan verifcation
path: ./solidity/ecdsa

- uses: actions/setup-node@v3
with:
node-version: "14.x"
cache: "yarn"
cache-dependency-path: solidity/ecdsa/yarn.lock

- name: Install needed dependencies
run: yarn install --frozen-lockfile

# If we don't remove the artifacts from `node-modules`, the
# `etherscan-verify` plugins tries to verify them, which is not desired.
- name: Prepare for verification on Etherscan
run: |
rm -rf ./node_modules/@keep-network/random-beacon/artifacts
rm -rf ./node_modules/@threshold-network/solidity-contracts/artifacts
rm -rf ./external/npm
- name: Verify contracts on Etherscan
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
run: |
yarn run hardhat --network ${{ github.event.inputs.environment }} \
etherscan-verify
# This job is responsible for publishing packackes with slightly modified
# contracts. The modifications are there to help with the process of testing
# some features on the T Token Dashboard. The job starts only if workflow
Expand Down
48 changes: 0 additions & 48 deletions .github/workflows/contracts-random-beacon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,54 +270,6 @@ jobs:
upstream_ref: ${{ github.event.inputs.upstream_ref }}
version: ${{ steps.npm-version-bump.outputs.version }}

- name: Upload files needed for etherscan verification
uses: actions/upload-artifact@v3
with:
name: Artifacts for etherscan verifcation
path: |
./solidity/random-beacon/deployments
./solidity/random-beacon/package.json
./solidity/random-beacon/yarn.lock
contracts-etherscan-verification:
needs: [contracts-deployment-testnet]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./solidity/random-beacon
steps:
- uses: actions/checkout@v3

- name: Download files needed for etherscan verification
uses: actions/download-artifact@v3
with:
name: Artifacts for etherscan verifcation
path: ./solidity/random-beacon

- uses: actions/setup-node@v3
with:
node-version: "14.x"
cache: "yarn"
cache-dependency-path: solidity/random-beacon/yarn.lock

- name: Install needed dependencies
run: yarn install --frozen-lockfile

# If we don't remove the artifacts from `node-modules`, the
# `etherscan-verify` plugins tries to verify them, which is not desired.
- name: Prepare for verification on Etherscan
run: |
rm -rf ./node_modules/@threshold-network/solidity-contracts/artifacts
rm -rf ./external/npm
- name: Verify contracts on Etherscan
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
run: |
yarn run hardhat --network ${{ github.event.inputs.environment }} \
etherscan-verify
# This job is responsible for publishing packackes with slightly modified
# contracts. The modifications are there to help with the process of testing
# some features on the T Token Dashboard. The job starts only if workflow
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,15 @@ jobs:
bucket-name: docs.keep.network
bucket-path: ${{ github.head_ref }}
build-folder: ${{ steps.html.outputs.asciidoctor-artifacts }}/docs

- name: Post preview URL to PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v5
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Documentation preview uploaded to https://docs.keep.network/${{ github.head_ref }}/index.html.'
})
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ _local/
# Executables
debug
debug.test
keep-core
keep-client
main
main.test

Expand Down
19 changes: 12 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,23 @@ COPY go.mod go.sum $APP_DIR/
RUN go mod download

# Install code generators.
RUN cd /go/pkg/mod/github.com/gogo/protobuf@v1.3.2/protoc-gen-gogoslick && go install .
RUN cd /go/pkg/mod/google.golang.org/protobuf@v1.28.1/cmd/protoc-gen-go/ && go install .

COPY ./pkg/net/gen $APP_DIR/pkg/net/gen
# Copy source code for generation.
COPY ./pkg/beacon/dkg/result/gen $APP_DIR/pkg/beacon/dkg/result/gen
COPY ./pkg/beacon/entry/gen $APP_DIR/pkg/beacon/entry/gen
COPY ./pkg/beacon/gjkr/gen $APP_DIR/pkg/beacon/gjkr/gen
COPY ./pkg/beacon/registry/gen $APP_DIR/pkg/beacon/registry/gen
COPY ./pkg/chain/ethereum/beacon/gen $APP_DIR/pkg/chain/ethereum/beacon/gen
COPY ./pkg/chain/ethereum/common/gen $APP_DIR/pkg/chain/ethereum/common/gen
COPY ./pkg/chain/ethereum/ecdsa/gen $APP_DIR/pkg/chain/ethereum/ecdsa/gen
COPY ./pkg/chain/ethereum/beacon/gen $APP_DIR/pkg/chain/ethereum/beacon/gen
COPY ./pkg/chain/ethereum/tbtc/gen $APP_DIR/pkg/chain/ethereum/tbtc/gen
COPY ./pkg/chain/ethereum/threshold/gen $APP_DIR/pkg/chain/ethereum/threshold/gen
COPY ./pkg/beacon/entry/gen $APP_DIR/pkg/beacon/entry/gen
COPY ./pkg/beacon/gjkr/gen $APP_DIR/pkg/beacon/gjkr/gen
COPY ./pkg/beacon/dkg/result/gen $APP_DIR/pkg/beacon/dkg/result/gen
COPY ./pkg/beacon/registry/gen $APP_DIR/pkg/beacon/registry/gen
COPY ./pkg/net/gen $APP_DIR/pkg/net/gen
COPY ./pkg/tbtc/gen $APP_DIR/pkg/tbtc/gen
COPY ./pkg/tecdsa/dkg/gen $APP_DIR/pkg/tecdsa/dkg/gen
COPY ./pkg/tecdsa/signing/gen $APP_DIR/pkg/tecdsa/signing/gen
COPY ./pkg/tecdsa/gen $APP_DIR/pkg/tecdsa/gen

# If ENVIRONMENT is not set it will download NPM packages versions
# published and tagged as `development`.
Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ else
$(foreach module,$(modules),$(call get_npm_package,$(module),$(environment)))
endif

generate:
proto_files := $(shell find ./pkg -name '*.proto')
proto_targets := $(proto_files:.proto=.pb.go)

gen_proto: ${proto_targets}

%.pb.go: %.proto go.mod go.sum
protoc --go_out=. --go_opt=paths=source_relative $*.proto

generate: gen_proto
$(info Running Go code generator)
go generate ./...

Expand All @@ -93,4 +101,4 @@ cmd-help: build
@echo '$$ keep-client start --help' > docs/resources/client-start-help
./keep-client start --help >> docs/resources/client-start-help

.PHONY: all development goerli download_artifacts generate build cmd-help
.PHONY: all development goerli download_artifacts generate gen_proto build cmd-help
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ A good place to start is the link:docs/[the docs directory].

=== Running a Node

To run your own node in the Keep network, follow the
link:docs/run-random-beacon.adoc[run Random Beacon doc]. Feedback on
To run your own node in the Keep Network, follow the
link:https://docs.keep.network/run-keep-node.html[Run Keep Node] doc. Feedback on
this process and the documentation
https://github.com/keep-network/keep-core/issues[is appreciated!]

Expand Down
12 changes: 10 additions & 2 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func initMetricsFlags(cmd *cobra.Command, cfg *config.Config) {
cmd.Flags().IntVar(
&cfg.Metrics.Port,
"metrics.port",
8080,
9601,
"Metrics HTTP server listening port.",
)

Expand All @@ -223,7 +223,7 @@ func initDiagnosticsFlags(cmd *cobra.Command, cfg *config.Config) {
cmd.Flags().IntVar(
&cfg.Diagnostics.Port,
"diagnostics.port",
8081,
9701,
"Diagnostics HTTP server listening port.",
)
}
Expand Down Expand Up @@ -256,6 +256,13 @@ func initTbtcFlags(cmd *cobra.Command, cfg *config.Config) {
tbtc.DefaultPreParamsGenerationConcurrency,
"tECDSA pre-parameters generation concurrency.",
)

cmd.Flags().IntVar(
&cfg.Tbtc.KeyGenerationConcurrency,
"tbtc.keyGenerationConcurrency",
tbtc.DefaultKeyGenerationConcurrency,
"tECDSA key generation concurrency.",
)
}

// Initialize flags for Developer configuration.
Expand All @@ -271,6 +278,7 @@ func initDeveloperFlags(command *cobra.Command) {
)
}

initContractAddressFlag(chainEthereum.BridgeContractName)
initContractAddressFlag(chainEthereum.RandomBeaconContractName)
initContractAddressFlag(chainEthereum.TokenStakingContractName)
initContractAddressFlag(chainEthereum.WalletRegistryContractName)
Expand Down
25 changes: 22 additions & 3 deletions cmd/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"math/big"
"os"
"reflect"
"runtime"
"strings"
"testing"
"time"
Expand All @@ -18,6 +19,7 @@ import (
chainEthereum "github.com/keep-network/keep-core/pkg/chain/ethereum"
ethereumBeacon "github.com/keep-network/keep-core/pkg/chain/ethereum/beacon/gen"
ethereumEcdsa "github.com/keep-network/keep-core/pkg/chain/ethereum/ecdsa/gen"
ethereumTbtc "github.com/keep-network/keep-core/pkg/chain/ethereum/tbtc/gen"
ethereumThreshold "github.com/keep-network/keep-core/pkg/chain/ethereum/threshold/gen"
)

Expand Down Expand Up @@ -122,7 +124,7 @@ var cmdFlagsTests = map[string]struct {
flagName: "--metrics.port",
flagValue: "9870",
expectedValueFromFlag: 9870,
defaultValue: 8080,
defaultValue: 9601,
},
"metrics.networkMetricsTick": {
readValueFunc: func(c *config.Config) interface{} { return c.Metrics.NetworkMetricsTick },
Expand All @@ -143,7 +145,7 @@ var cmdFlagsTests = map[string]struct {
flagName: "--diagnostics.port",
flagValue: "6089",
expectedValueFromFlag: 6089,
defaultValue: 8081,
defaultValue: 9701,
},
"tbtc.preParamsPoolSize": {
readValueFunc: func(c *config.Config) interface{} { return c.Tbtc.PreParamsPoolSize },
Expand Down Expand Up @@ -173,6 +175,13 @@ var cmdFlagsTests = map[string]struct {
expectedValueFromFlag: 2,
defaultValue: 1,
},
"tbtc.keyGenConcurrency": {
readValueFunc: func(c *config.Config) interface{} { return c.Tbtc.KeyGenerationConcurrency },
flagName: "--tbtc.keyGenerationConcurrency",
flagValue: "101",
expectedValueFromFlag: 101,
defaultValue: runtime.GOMAXPROCS(0),
},
"developer.randomBeaconAddress": {
readValueFunc: func(c *config.Config) interface{} {
address, _ := c.Ethereum.ContractAddress(chainEthereum.RandomBeaconContractName)
Expand All @@ -193,6 +202,16 @@ var cmdFlagsTests = map[string]struct {
expectedValueFromFlag: "0xB76707515C3f908411B5211863A7581589a1E31F",
defaultValue: ethereumEcdsa.WalletRegistryAddress,
},
"developer.bridgeAddress": {
readValueFunc: func(c *config.Config) interface{} {
address, _ := c.Ethereum.ContractAddress(chainEthereum.BridgeContractName)
return address.String()
},
flagName: "--developer.bridgeAddress",
flagValue: "0xd21DE06574811450E722a33D8093558E8c04eacc",
expectedValueFromFlag: "0xd21DE06574811450E722a33D8093558E8c04eacc",
defaultValue: ethereumTbtc.BridgeAddress,
},
"developer.tokenStakingAddress": {
readValueFunc: func(c *config.Config) interface{} {
address, _ := c.Ethereum.ContractAddress(chainEthereum.TokenStakingContractName)
Expand Down Expand Up @@ -304,7 +323,7 @@ func TestFlags_Mixed(t *testing.T) {
// Properties not provided in the config file nor set with flags. Use defaults.
"diagnostics.port": {
readValueFunc: func(c *config.Config) interface{} { return c.Diagnostics.Port },
expectedValue: 8081,
expectedValue: 9701,
},
}

Expand Down
4 changes: 3 additions & 1 deletion cmd/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
chainEthereum "github.com/keep-network/keep-core/pkg/chain/ethereum"
)

func nodeHeader(addrStrings []string, port int, ethereumConfig commonEthereum.Config) {
func nodeHeader(addrStrings []string, operator string, port int, ethereumConfig commonEthereum.Config) {
header := `
▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
Expand Down Expand Up @@ -45,6 +45,8 @@ Trust math, not hardware.
dashes,
buildLine(maxLineLength, prefix, suffix, "Keep Client Node"),
buildLine(maxLineLength, prefix, suffix, ""),
buildLine(maxLineLength, prefix, suffix, fmt.Sprintf("Operator: %s", operator)),
buildLine(maxLineLength, prefix, suffix, ""),
buildLine(maxLineLength, prefix, suffix, fmt.Sprintf("Port: %d", port)),
buildMultiLine(maxLineLength, prefix, suffix, "IPs : ", addrStrings),
buildLine(maxLineLength, prefix, suffix, ""),
Expand Down
1 change: 1 addition & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func start(cmd *cobra.Command) error {

nodeHeader(
netProvider.ConnectionManager().AddrStrings(),
beaconChain.Signing().Address().String(),
clientConfig.LibP2P.Port,
clientConfig.Ethereum,
)
Expand Down
1 change: 1 addition & 0 deletions config/_peers/goerli
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/dns4/bootstrap-0.test.keep.network/tcp/3919/ipfs/16Uiu2HAmCcfVpHwfBKNFbQuhvGuFXHVLQ65gB4sJm7HyrcZuLttH
/dns4/bootstrap-1.test.keep.network/tcp/3919/ipfs/16Uiu2HAm3eJtyFKAttzJ85NLMromHuRg4yyum3CREMf6CHBBV6KY
/dns4/bst-a01.test.keep.boar.network/tcp/4001/ipfs/16Uiu2HAmMosdpAuRSw1ahNhqFq8e3Y4d4c5WZkjW1FGQi5WJwWZ7
Loading

0 comments on commit 015e726

Please sign in to comment.