From e28d56ead210f7d31819c6ad8b9be104ffab4f95 Mon Sep 17 00:00:00 2001 From: Joe Clapis Date: Fri, 18 Nov 2022 23:46:17 -0500 Subject: [PATCH] Updated Smartnode, added a bigger MaxConcurrentEth1Requests buffer --- go.mod | 2 +- go.sum | 8 ++------ tree-gen.go | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index bc94b80..4827162 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/ethereum/go-ethereum v1.10.25 github.com/fatih/color v1.13.0 github.com/rocket-pool/rocketpool-go v1.10.1-0.20221107074643-c7bbb1946848 - github.com/rocket-pool/smartnode v1.7.1-0.20221108051433-199b03a781ec + github.com/rocket-pool/smartnode v1.7.1-0.20221119044341-133db7b548d6 github.com/urfave/cli/v2 v2.23.0 ) diff --git a/go.sum b/go.sum index 460ef1c..e7058a6 100644 --- a/go.sum +++ b/go.sum @@ -1709,12 +1709,8 @@ github.com/rocket-pool/go-merkletree v1.0.1-0.20220406020931-c262d9b976dd h1:p9K github.com/rocket-pool/go-merkletree v1.0.1-0.20220406020931-c262d9b976dd/go.mod h1:UE9fof8P7iESVtLn1K9CTSkNRYVFHZHlf96RKbU33kA= github.com/rocket-pool/rocketpool-go v1.10.1-0.20221107074643-c7bbb1946848 h1:Iny1IgKEv3/0eUyPoExnXlyXNzUtGda+JAa2m0KlVrQ= github.com/rocket-pool/rocketpool-go v1.10.1-0.20221107074643-c7bbb1946848/go.mod h1:+7kSXEvMUCEqstio3PBVTnaGoI2lSTwNUJ8/D4D91gM= -github.com/rocket-pool/smartnode v1.7.1-0.20221108031637-a1192d4790c9 h1:aMKBhdkrA9CT812b4CJ9VI6NQhpK31dfkqHhZfZtjn0= -github.com/rocket-pool/smartnode v1.7.1-0.20221108031637-a1192d4790c9/go.mod h1:22NUpU97G9Oz7O4sD5yPYbiUnaQu7eun1SAHHL7SdMY= -github.com/rocket-pool/smartnode v1.7.1-0.20221108044127-fca9776b91a2 h1:wQ1Jl+SKbMawF7q7QmzkfiliyqYKBYATfUMHz8C2zfA= -github.com/rocket-pool/smartnode v1.7.1-0.20221108044127-fca9776b91a2/go.mod h1:22NUpU97G9Oz7O4sD5yPYbiUnaQu7eun1SAHHL7SdMY= -github.com/rocket-pool/smartnode v1.7.1-0.20221108051433-199b03a781ec h1:WHhbLQTtNTgg0xtgoOePhiE+6u65pd7mLlQvyjXyUPA= -github.com/rocket-pool/smartnode v1.7.1-0.20221108051433-199b03a781ec/go.mod h1:22NUpU97G9Oz7O4sD5yPYbiUnaQu7eun1SAHHL7SdMY= +github.com/rocket-pool/smartnode v1.7.1-0.20221119044341-133db7b548d6 h1:RMjEEpeBHIJZxlSDgAVLP7ozhQnst4en1YM8YecNlHo= +github.com/rocket-pool/smartnode v1.7.1-0.20221119044341-133db7b548d6/go.mod h1:22NUpU97G9Oz7O4sD5yPYbiUnaQu7eun1SAHHL7SdMY= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= diff --git a/tree-gen.go b/tree-gen.go index 4b89a37..cbde679 100644 --- a/tree-gen.go +++ b/tree-gen.go @@ -6,6 +6,7 @@ import ( "fmt" "io/ioutil" "math/big" + "net/http" "path/filepath" "time" @@ -24,8 +25,15 @@ import ( "github.com/urfave/cli/v2" ) +const ( + MaxConcurrentEth1Requests = 200 +) + func GenerateTree(c *cli.Context) error { + // Configure + configureHTTP() + // Initialization currentIndex := c.Int64("interval") log := log.NewColorLogger(color.FgHiWhite) @@ -317,3 +325,13 @@ func getLatestFinalizedSlot(log log.ColorLogger, bn beacon.Client) (uint64, uint } } + +// Configure HTTP transport settings +func configureHTTP() { + + // The watchtower daemon makes a large number of concurrent RPC requests to the Eth1 client + // The HTTP transport is set to cache connections for future re-use equal to the maximum expected number of concurrent requests + // This prevents issues related to memory consumption and address allowance from repeatedly opening and closing connections + http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = MaxConcurrentEth1Requests + +}