Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into eth-bonding
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuba committed Aug 7, 2020
2 parents e699bbd + 1591d67 commit e750e16
Show file tree
Hide file tree
Showing 72 changed files with 21,513 additions and 4,769 deletions.
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,14 @@ workflows:
tags:
only: /^v.*/
branches:
ignore: /.*/
only: /releases\/.*/
- build_client_and_test_go:
context: github-package-registry
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
only: /releases\/.*/
requires:
- keep_test_approval
- migrate_contracts:
Expand All @@ -314,7 +314,7 @@ workflows:
tags:
only: /^v.*/
branches:
ignore: /.*/
only: /releases\/.*/
requires:
- build_client_and_test_go
- build_initcontainer:
Expand All @@ -323,7 +323,7 @@ workflows:
tags:
only: /^v.*/
branches:
ignore: /.*/
only: /releases\/.*/
requires:
- migrate_contracts
- publish_client:
Expand All @@ -332,7 +332,7 @@ workflows:
tags:
only: /^v.*/
branches:
ignore: /.*/
only: /releases\/.*/
requires:
- build_client_and_test_go
- build_initcontainer
Expand All @@ -343,7 +343,7 @@ workflows:
tags:
only: /^v.*/
branches:
ignore: /.*/
only: /releases\/.*/
requires:
- build_client_and_test_go
- build_initcontainer
Expand All @@ -354,7 +354,7 @@ workflows:
tags:
only: /^v.*/
branches:
ignore: /.*/
only: /releases\/.*/
requires:
- migrate_contracts
- publish_contract_data:
Expand All @@ -363,6 +363,6 @@ workflows:
tags:
only: /^v.*/
branches:
ignore: /.*/
only: /releases\/.*/
requires:
- migrate_contracts
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
FROM golang:1.13.8-alpine3.10 AS runtime

ENV APP_NAME=keep-ecdsa \
BIN_PATH=/usr/local/bin

FROM runtime AS gobuild
FROM golang:1.13.8-alpine3.10 AS gobuild

ENV GOPATH=/go \
GOBIN=/go/bin \
Expand Down Expand Up @@ -67,7 +62,10 @@ RUN GOOS=linux GOPRIVATE=$GOPRIVATE go build -a -o $APP_NAME ./ && \
mv $APP_NAME $BIN_PATH

# Configure runtime container.
FROM runtime
FROM alpine:3.10

ENV APP_NAME=keep-ecdsa \
BIN_PATH=/usr/local/bin

COPY --from=gobuild $BIN_PATH/$APP_NAME $BIN_PATH

Expand Down
56 changes: 56 additions & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import (
"fmt"
"time"

"github.com/keep-network/keep-core/pkg/chain"
"github.com/keep-network/keep-core/pkg/metrics"
"github.com/keep-network/keep-core/pkg/net"

"github.com/ipfs/go-log"

"github.com/keep-network/keep-common/pkg/chain/ethereum/ethutil"
Expand Down Expand Up @@ -158,10 +162,13 @@ func Start(c *cli.Context) error {
networkProvider,
persistence,
sanctionedApplications,
&config.Client,
&config.TSS,
)
logger.Debugf("initialized operator with address: [%s]", ethereumKey.Address.String())

initializeMetrics(ctx, config, networkProvider, stakeMonitor, ethereumKey.Address.Hex())

logger.Info("client started")

select {
Expand All @@ -173,3 +180,52 @@ func Start(c *cli.Context) error {
return fmt.Errorf("unexpected context cancellation")
}
}

func initializeMetrics(
ctx context.Context,
config *config.Config,
netProvider net.Provider,
stakeMonitor chain.StakeMonitor,
ethereumAddres string,
) {
registry, isConfigured := metrics.Initialize(
config.Metrics.Port,
)
if !isConfigured {
logger.Infof("metrics are not configured")
return
}

logger.Infof(
"enabled metrics on port [%v]",
config.Metrics.Port,
)

metrics.ObserveConnectedPeersCount(
ctx,
registry,
netProvider,
time.Duration(config.Metrics.NetworkMetricsTick)*time.Second,
)

metrics.ObserveConnectedBootstrapCount(
ctx,
registry,
netProvider,
config.LibP2P.Peers,
time.Duration(config.Metrics.NetworkMetricsTick)*time.Second,
)

metrics.ObserveEthConnectivity(
ctx,
registry,
stakeMonitor,
ethereumAddres,
time.Duration(config.Metrics.EthereumMetricsTick)*time.Second,
)

metrics.ExposeLibP2PInfo(
registry,
netProvider,
)
}
21 changes: 20 additions & 1 deletion configs/config.toml.SAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# allowed gas price is reached, no further resubmission attempts are
# performed.
#
# MaxGasPrice = 50000000000 # 50 gwei (default value)
# MaxGasPrice = 70000000000 # 70 gwei (default value)

[ethereum.account]
KeyFile = "/Users/someuser/ethereum/data/keystore/UTC--2018-03-11T01-37-33.202765887Z--AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAA"
Expand All @@ -43,9 +43,28 @@
# # Uncomment to override the node's default addresses announced in the network
# # AnnouncedAddresses = ["/dns4/example.com/tcp/3919", "/ip4/80.70.60.50/tcp/3919"]

[Client]
# Look-back period to check if existing, active keeps are awaiting signer generation.
# When the client starts, it goes through all keeps registered on-chain to check
# whether it's a member of one of them and to generate the signing key if needed.
# The client does not check keeps older than `AwaitingKeyGenerationLookback` to
# minimize the number of calls to the chain.
# AwaitingKeyGenerationLookback = "24h" # optional

# Timeouts for processes execution. Within these timeouts the process will keep
# retrying to generate a signer or calculate a signature. The values should be
# provided based on the sanctioned application requirements.
# KeyGenerationTimeout = "3h" # optional
# SigningTimeout = "2h" # optional

[TSS]
# Timeout for TSS protocol pre-parameters generation. The value
# should be provided based on resources available on the machine running the client.
# This is an optional parameter, if not provided timeout for TSS protocol
# pre-parameters generation will be set to `2 minutes`.
# PreParamsGenerationTimeout = "2m30s"

# [Metrics]
# Port = 8080
# NetworkMetricsTick = 60
# EthereumMetricsTick = 600
13 changes: 10 additions & 3 deletions docs/run-keep-ecdsa.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ docker run -d \
--volume $KEEP_ECDSA_CONFIG_DIR:/mnt/keep-ecdsa/config \
--env KEEP_ETHEREUM_PASSWORD=$KEEP_ECDSA_ETHEREUM_PASSWORD \
--env LOG_LEVEL=debug \
--log-opt max-size=100m \
--log-opt max-file=3 \
-p 3919:3919 \
keepnetwork/keep-ecdsa-client:<version> --config /mnt/keep-ecdsa/config/keep-ecdsa-config.toml start
----
Expand Down Expand Up @@ -391,9 +393,14 @@ Once you've got your KEEP token grant you can manage it with our https://dashboa

==== Bootstrap Peers

Bootstrap peers will come and go on testnet. As long as at least one of your configured peers is
up, there is no need to worry.

[.small]
```
"/dns4/bootstrap-1.ecdsa.keep.test.boar.network/tcp/4001/ipfs/16Uiu2HAmPFXDaeGWtnzd8s39NsaQguoWtKi77834A6xwYqeicq6N",
"/dns4/ecdsa-2.test.keep.network/tcp/3919/ipfs/16Uiu2HAmNNuCp45z5bgB8KiTHv1vHTNAVbBgxxtTFGAndageo9Dp",
"/dns4/ecdsa-3.test.keep.network/tcp/3919/ipfs/16Uiu2HAm8KJX32kr3eYUhDuzwTucSfAfspnjnXNf9veVhB12t6Vf",
```

==== Contracts
Expand All @@ -406,13 +413,13 @@ Contract addresses needed to boot a Keep ECDSA client:
|

|BondedECDSAKeepFactory
|`0x17caddf97a1d1123efb7b233cb16c76c31a96e02`
|`0xe7BF8421fBE80c3Bf67082370D86C8D81D1D77F4`

|Sanctioned Applications
|`0x2b70907b5c44897030ea1369591ddcd23c5d85d6` (tBTC's system contract)
|`0x14dC06F762E7f4a756825c1A1dA569b3180153cB` (tBTC's system contract)

|tBTC Sortition pool (for <<Authorizations,authorization>>)
|`0xf5bc2812344ecacdd45c0b53824168f522533fc5`
|`0x4BA599512761fA0F2ff2aa63a3fd4599D6c1F412`
|===


Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ require (
github.com/ethereum/go-ethereum v1.9.10
github.com/gogo/protobuf v1.3.1
github.com/google/gofuzz v1.1.0
github.com/ipfs/go-log v0.0.1
github.com/keep-network/keep-common v1.1.0
github.com/keep-network/keep-core v1.2.0
github.com/ipfs/go-log v1.0.4
github.com/keep-network/keep-common v1.1.1-0.20200703125023-d9872a19ebd1
github.com/keep-network/keep-core v1.2.4-rc.0.20200805110315-51be43db21f8
github.com/pkg/errors v0.9.1
github.com/urfave/cli v1.22.1
)
Loading

0 comments on commit e750e16

Please sign in to comment.