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

Commit e750e16

Browse files
committed
Merge remote-tracking branch 'origin/master' into eth-bonding
2 parents e699bbd + 1591d67 commit e750e16

File tree

72 files changed

+21513
-4769
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+21513
-4769
lines changed

.circleci/config.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,14 @@ workflows:
298298
tags:
299299
only: /^v.*/
300300
branches:
301-
ignore: /.*/
301+
only: /releases\/.*/
302302
- build_client_and_test_go:
303303
context: github-package-registry
304304
filters:
305305
tags:
306306
only: /^v.*/
307307
branches:
308-
ignore: /.*/
308+
only: /releases\/.*/
309309
requires:
310310
- keep_test_approval
311311
- migrate_contracts:
@@ -314,7 +314,7 @@ workflows:
314314
tags:
315315
only: /^v.*/
316316
branches:
317-
ignore: /.*/
317+
only: /releases\/.*/
318318
requires:
319319
- build_client_and_test_go
320320
- build_initcontainer:
@@ -323,7 +323,7 @@ workflows:
323323
tags:
324324
only: /^v.*/
325325
branches:
326-
ignore: /.*/
326+
only: /releases\/.*/
327327
requires:
328328
- migrate_contracts
329329
- publish_client:
@@ -332,7 +332,7 @@ workflows:
332332
tags:
333333
only: /^v.*/
334334
branches:
335-
ignore: /.*/
335+
only: /releases\/.*/
336336
requires:
337337
- build_client_and_test_go
338338
- build_initcontainer
@@ -343,7 +343,7 @@ workflows:
343343
tags:
344344
only: /^v.*/
345345
branches:
346-
ignore: /.*/
346+
only: /releases\/.*/
347347
requires:
348348
- build_client_and_test_go
349349
- build_initcontainer
@@ -354,7 +354,7 @@ workflows:
354354
tags:
355355
only: /^v.*/
356356
branches:
357-
ignore: /.*/
357+
only: /releases\/.*/
358358
requires:
359359
- migrate_contracts
360360
- publish_contract_data:
@@ -363,6 +363,6 @@ workflows:
363363
tags:
364364
only: /^v.*/
365365
branches:
366-
ignore: /.*/
366+
only: /releases\/.*/
367367
requires:
368368
- migrate_contracts

Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
FROM golang:1.13.8-alpine3.10 AS runtime
2-
3-
ENV APP_NAME=keep-ecdsa \
4-
BIN_PATH=/usr/local/bin
5-
6-
FROM runtime AS gobuild
1+
FROM golang:1.13.8-alpine3.10 AS gobuild
72

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

6964
# Configure runtime container.
70-
FROM runtime
65+
FROM alpine:3.10
66+
67+
ENV APP_NAME=keep-ecdsa \
68+
BIN_PATH=/usr/local/bin
7169

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

cmd/start.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import (
55
"fmt"
66
"time"
77

8+
"github.com/keep-network/keep-core/pkg/chain"
9+
"github.com/keep-network/keep-core/pkg/metrics"
10+
"github.com/keep-network/keep-core/pkg/net"
11+
812
"github.com/ipfs/go-log"
913

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

170+
initializeMetrics(ctx, config, networkProvider, stakeMonitor, ethereumKey.Address.Hex())
171+
165172
logger.Info("client started")
166173

167174
select {
@@ -173,3 +180,52 @@ func Start(c *cli.Context) error {
173180
return fmt.Errorf("unexpected context cancellation")
174181
}
175182
}
183+
184+
func initializeMetrics(
185+
ctx context.Context,
186+
config *config.Config,
187+
netProvider net.Provider,
188+
stakeMonitor chain.StakeMonitor,
189+
ethereumAddres string,
190+
) {
191+
registry, isConfigured := metrics.Initialize(
192+
config.Metrics.Port,
193+
)
194+
if !isConfigured {
195+
logger.Infof("metrics are not configured")
196+
return
197+
}
198+
199+
logger.Infof(
200+
"enabled metrics on port [%v]",
201+
config.Metrics.Port,
202+
)
203+
204+
metrics.ObserveConnectedPeersCount(
205+
ctx,
206+
registry,
207+
netProvider,
208+
time.Duration(config.Metrics.NetworkMetricsTick)*time.Second,
209+
)
210+
211+
metrics.ObserveConnectedBootstrapCount(
212+
ctx,
213+
registry,
214+
netProvider,
215+
config.LibP2P.Peers,
216+
time.Duration(config.Metrics.NetworkMetricsTick)*time.Second,
217+
)
218+
219+
metrics.ObserveEthConnectivity(
220+
ctx,
221+
registry,
222+
stakeMonitor,
223+
ethereumAddres,
224+
time.Duration(config.Metrics.EthereumMetricsTick)*time.Second,
225+
)
226+
227+
metrics.ExposeLibP2PInfo(
228+
registry,
229+
netProvider,
230+
)
231+
}

configs/config.toml.SAMPLE

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# allowed gas price is reached, no further resubmission attempts are
1919
# performed.
2020
#
21-
# MaxGasPrice = 50000000000 # 50 gwei (default value)
21+
# MaxGasPrice = 70000000000 # 70 gwei (default value)
2222

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

46+
[Client]
47+
# Look-back period to check if existing, active keeps are awaiting signer generation.
48+
# When the client starts, it goes through all keeps registered on-chain to check
49+
# whether it's a member of one of them and to generate the signing key if needed.
50+
# The client does not check keeps older than `AwaitingKeyGenerationLookback` to
51+
# minimize the number of calls to the chain.
52+
# AwaitingKeyGenerationLookback = "24h" # optional
53+
54+
# Timeouts for processes execution. Within these timeouts the process will keep
55+
# retrying to generate a signer or calculate a signature. The values should be
56+
# provided based on the sanctioned application requirements.
57+
# KeyGenerationTimeout = "3h" # optional
58+
# SigningTimeout = "2h" # optional
59+
4660
[TSS]
4761
# Timeout for TSS protocol pre-parameters generation. The value
4862
# should be provided based on resources available on the machine running the client.
4963
# This is an optional parameter, if not provided timeout for TSS protocol
5064
# pre-parameters generation will be set to `2 minutes`.
5165
# PreParamsGenerationTimeout = "2m30s"
66+
67+
# [Metrics]
68+
# Port = 8080
69+
# NetworkMetricsTick = 60
70+
# EthereumMetricsTick = 600

docs/run-keep-ecdsa.adoc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ docker run -d \
262262
--volume $KEEP_ECDSA_CONFIG_DIR:/mnt/keep-ecdsa/config \
263263
--env KEEP_ETHEREUM_PASSWORD=$KEEP_ECDSA_ETHEREUM_PASSWORD \
264264
--env LOG_LEVEL=debug \
265+
--log-opt max-size=100m \
266+
--log-opt max-file=3 \
265267
-p 3919:3919 \
266268
keepnetwork/keep-ecdsa-client:<version> --config /mnt/keep-ecdsa/config/keep-ecdsa-config.toml start
267269
----
@@ -391,9 +393,14 @@ Once you've got your KEEP token grant you can manage it with our https://dashboa
391393

392394
==== Bootstrap Peers
393395

396+
Bootstrap peers will come and go on testnet. As long as at least one of your configured peers is
397+
up, there is no need to worry.
398+
394399
[.small]
395400
```
396401
"/dns4/bootstrap-1.ecdsa.keep.test.boar.network/tcp/4001/ipfs/16Uiu2HAmPFXDaeGWtnzd8s39NsaQguoWtKi77834A6xwYqeicq6N",
402+
"/dns4/ecdsa-2.test.keep.network/tcp/3919/ipfs/16Uiu2HAmNNuCp45z5bgB8KiTHv1vHTNAVbBgxxtTFGAndageo9Dp",
403+
"/dns4/ecdsa-3.test.keep.network/tcp/3919/ipfs/16Uiu2HAm8KJX32kr3eYUhDuzwTucSfAfspnjnXNf9veVhB12t6Vf",
397404
```
398405

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

408415
|BondedECDSAKeepFactory
409-
|`0x17caddf97a1d1123efb7b233cb16c76c31a96e02`
416+
|`0xe7BF8421fBE80c3Bf67082370D86C8D81D1D77F4`
410417

411418
|Sanctioned Applications
412-
|`0x2b70907b5c44897030ea1369591ddcd23c5d85d6` (tBTC's system contract)
419+
|`0x14dC06F762E7f4a756825c1A1dA569b3180153cB` (tBTC's system contract)
413420

414421
|tBTC Sortition pool (for <<Authorizations,authorization>>)
415-
|`0xf5bc2812344ecacdd45c0b53824168f522533fc5`
422+
|`0x4BA599512761fA0F2ff2aa63a3fd4599D6c1F412`
416423
|===
417424

418425

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ require (
1717
github.com/ethereum/go-ethereum v1.9.10
1818
github.com/gogo/protobuf v1.3.1
1919
github.com/google/gofuzz v1.1.0
20-
github.com/ipfs/go-log v0.0.1
21-
github.com/keep-network/keep-common v1.1.0
22-
github.com/keep-network/keep-core v1.2.0
20+
github.com/ipfs/go-log v1.0.4
21+
github.com/keep-network/keep-common v1.1.1-0.20200703125023-d9872a19ebd1
22+
github.com/keep-network/keep-core v1.2.4-rc.0.20200805110315-51be43db21f8
2323
github.com/pkg/errors v0.9.1
2424
github.com/urfave/cli v1.22.1
2525
)

0 commit comments

Comments
 (0)