Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ install() {
{ cp -r "$PACKAGE_FILES_PATH/override" "$RP_SHARE_PATH" || fail "Could not copy override folder to the Rocket Pool system directory."; } >&2
{ cp -r "$PACKAGE_FILES_PATH/scripts" "$RP_SHARE_PATH" || fail "Could not copy scripts folder to the Rocket Pool system directory."; } >&2
{ cp -r "$PACKAGE_FILES_PATH/templates" "$RP_SHARE_PATH" || fail "Could not copy templates folder to the Rocket Pool system directory."; } >&2
{ find "$HD_SHARE_PATH/scripts" -name "*.sh" -exec chmod +x {} \; 2>/dev/null || fail "Could not set executable permissions on package files."; } >&2
{ find "$RP_SHARE_PATH/scripts" -name "*.sh" -exec chmod +x {} \; 2>/dev/null || fail "Could not set executable permissions on package files."; } >&2


# Clean up unnecessary files from old installations
Expand Down
2 changes: 1 addition & 1 deletion src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/prometheus/client_golang v1.18.0
github.com/prysmaticlabs/prysm/v4 v4.2.1
github.com/rivo/tview v0.0.0-20230208211350-7dfff1ce7854
github.com/rocket-pool/node-manager-core v0.1.1-0.20240324201808-55b9188c549b
github.com/rocket-pool/node-manager-core v0.1.1-0.20240325035720-824357e2dad7
github.com/rocket-pool/rocketpool-go v1.8.3-0.20240324192746-e467edda77d1
github.com/shirou/gopsutil/v3 v3.24.2
github.com/tyler-smith/go-bip39 v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions src/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,8 @@ github.com/rocket-pool/batch-query v1.0.0 h1:5HejmT1n1fIdLIqUhTNwbkG2PGOPl3IVjCp
github.com/rocket-pool/batch-query v1.0.0/go.mod h1:d1CmxShzk0fioJ4yX0eFGhz2an1odnW/LZ2cp3eDGIQ=
github.com/rocket-pool/go-merkletree v1.0.1-0.20220406020931-c262d9b976dd h1:p9KuetSKB9nte9I/MkkiM3pwKFVQgqxxPTQ0y56Ff6s=
github.com/rocket-pool/go-merkletree v1.0.1-0.20220406020931-c262d9b976dd/go.mod h1:UE9fof8P7iESVtLn1K9CTSkNRYVFHZHlf96RKbU33kA=
github.com/rocket-pool/node-manager-core v0.1.1-0.20240324201808-55b9188c549b h1:YGc9XdzpxvmGPAF38wPdOZcZFhKHxGoP4Uq6M5+vh1A=
github.com/rocket-pool/node-manager-core v0.1.1-0.20240324201808-55b9188c549b/go.mod h1:mUIsrmHwbpBwYo1Gp8nPmQ6SeNGxxgXMssT83eicDso=
github.com/rocket-pool/node-manager-core v0.1.1-0.20240325035720-824357e2dad7 h1:u/SGtrPcGDKZmH+wS9XEP5+T/UrwtrwIwqTV7CXS/aE=
github.com/rocket-pool/node-manager-core v0.1.1-0.20240325035720-824357e2dad7/go.mod h1:mUIsrmHwbpBwYo1Gp8nPmQ6SeNGxxgXMssT83eicDso=
github.com/rocket-pool/rocketpool-go v1.8.3-0.20240324192746-e467edda77d1 h1:tl639aAfFraUVH33mCEth/oLyHiLGyW/sVm9NOb1FBs=
github.com/rocket-pool/rocketpool-go v1.8.3-0.20240324192746-e467edda77d1/go.mod h1:NOI4fBev5mMwZejmAWVOl/ysYLzfHne3b/sAXb2Dy1w=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
Expand Down
2 changes: 2 additions & 0 deletions src/rocketpool-cli/rocketpool-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ func validateFlags(c *cli.Context) error {
return fmt.Errorf("Invalid nonce: %s\n", customNonce)
}
snCtx.Nonce = nonce
} else {
snCtx.Nonce = big.NewInt(0)
}

// Make sure the config directory exists
Expand Down
23 changes: 13 additions & 10 deletions src/rocketpool-daemon/node/defend-pdao-props.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,29 @@ type DefendPdaoProps struct {
}

func NewDefendPdaoProps(ctx context.Context, sp *services.ServiceProvider, logger log.ColorLogger) *DefendPdaoProps {
cfg := sp.GetConfig()
log := &logger
maxFee, maxPriorityFee := getAutoTxInfo(cfg, log)
return &DefendPdaoProps{
ctx: ctx,
sp: sp,
log: &logger,
log: log,
cfg: cfg,
w: sp.GetWallet(),
rp: sp.GetRocketPool(),
bc: sp.GetBeaconClient(),
rs: cfg.GetRocketPoolResources(),
gasThreshold: cfg.AutoTxGasThreshold.Value,
maxFee: maxFee,
maxPriorityFee: maxPriorityFee,
lastScannedBlock: nil,
intervalSize: big.NewInt(int64(config.EventLogInterval)),
}
}

// Defend pDAO proposals
func (t *DefendPdaoProps) Run(state *state.NetworkState) error {
// Get services
t.cfg = t.sp.GetConfig()
t.w = t.sp.GetWallet()
t.rp = t.sp.GetRocketPool()
t.w = t.sp.GetWallet()
t.nodeAddress, _ = t.w.GetAddress()
t.maxFee, t.maxPriorityFee = getAutoTxInfo(t.cfg, t.log)
t.gasThreshold = t.cfg.AutoTxGasThreshold.Value
t.intervalSize = big.NewInt(int64(config.EventLogInterval))
t.rs = t.cfg.GetRocketPoolResources()

// Bindings
propMgr, err := proposals.NewProposalManager(t.ctx, t.log, t.cfg, t.rp, t.bc)
Expand Down
66 changes: 37 additions & 29 deletions src/rocketpool-daemon/node/distribute-minipools.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
// Distribute minipools task
type DistributeMinipools struct {
sp *services.ServiceProvider
log log.ColorLogger
log *log.ColorLogger
cfg *config.SmartNodeConfig
w *wallet.Wallet
rp *rocketpool.RocketPool
Expand All @@ -42,46 +42,54 @@ type DistributeMinipools struct {

// Create distribute minipools task
func NewDistributeMinipools(sp *services.ServiceProvider, logger log.ColorLogger) *DistributeMinipools {
cfg := sp.GetConfig()
log := &logger
maxFee, maxPriorityFee := getAutoTxInfo(cfg, log)
gasThreshold := cfg.AutoTxGasThreshold.Value

if gasThreshold == 0 {
log.Println("Automatic tx gas threshold is 0, disabling auto-distribute.")
}

distributeThresholdFloat := cfg.DistributeThreshold.Value
// Safety clamp
if distributeThresholdFloat >= 8 {
log.Printlnf("WARNING: Auto-distribute threshold is more than 8 ETH (%.6f ETH), reducing to 7.5 ETH for safety", distributeThresholdFloat)
distributeThresholdFloat = 7.5
} else if distributeThresholdFloat == 0 {
log.Println("Auto-distribute threshold is 0, disabling auto-distribute.")
return nil
}
distributeThreshold := eth.EthToWei(distributeThresholdFloat)

return &DistributeMinipools{
sp: sp,
log: logger,
eight: eth.EthToWei(8),
sp: sp,
log: log,
cfg: cfg,
w: sp.GetWallet(),
rp: sp.GetRocketPool(),
bc: sp.GetBeaconClient(),
d: sp.GetDocker(),
gasThreshold: gasThreshold,
distributeThreshold: distributeThreshold,
maxFee: maxFee,
maxPriorityFee: maxPriorityFee,
eight: eth.EthToWei(8),
}
}

// Distribute minipools
func (t *DistributeMinipools) Run(state *state.NetworkState) error {
// Get services
t.cfg = t.sp.GetConfig()
t.w = t.sp.GetWallet()
t.rp = t.sp.GetRocketPool()
t.bc = t.sp.GetBeaconClient()
t.d = t.sp.GetDocker()
t.w = t.sp.GetWallet()
nodeAddress, _ := t.w.GetAddress()
t.maxFee, t.maxPriorityFee = getAutoTxInfo(t.cfg, &t.log)
t.gasThreshold = t.cfg.AutoTxGasThreshold.Value

// Check if auto-distributing is disabled
if t.gasThreshold == 0 {
t.log.Println("Automatic tx gas threshold is 0, disabling auto-distribute.")
return nil
}
distributeThreshold := t.cfg.DistributeThreshold.Value
// Safety clamp
if distributeThreshold >= 8 {
t.log.Printlnf("WARNING: Auto-distribute threshold is more than 8 ETH (%.6f ETH), reducing to 7.5 ETH for safety", distributeThreshold)
distributeThreshold = 7.5
} else if distributeThreshold == 0 {
t.log.Println("Auto-distribute threshold is 0, disabling auto-distribute.")
return nil
}
t.distributeThreshold = eth.EthToWei(distributeThreshold)

// Log
t.log.Println("Checking for minipools to distribute...")

// Get prelaunch minipools
nodeAddress, _ := t.w.GetAddress()
minipools, err := t.getDistributableMinipools(nodeAddress, state)
if err != nil {
return err
Expand Down Expand Up @@ -191,7 +199,7 @@ func (t *DistributeMinipools) distributeMinipools(submissions []*eth.Transaction
// Get the max fee
maxFee := t.maxFee
if maxFee == nil || maxFee.Uint64() == 0 {
maxFee, err = gas.GetMaxFeeWeiForDaemon(&t.log)
maxFee, err = gas.GetMaxFeeWeiForDaemon(t.log)
if err != nil {
return err
}
Expand All @@ -200,7 +208,7 @@ func (t *DistributeMinipools) distributeMinipools(submissions []*eth.Transaction
opts.GasTipCap = t.maxPriorityFee

// Print the gas info
if !gas.PrintAndCheckGasInfoForBatch(submissions, true, t.gasThreshold, &t.log, maxFee) {
if !gas.PrintAndCheckGasInfoForBatch(submissions, true, t.gasThreshold, t.log, maxFee) {
return nil
}

Expand All @@ -213,7 +221,7 @@ func (t *DistributeMinipools) distributeMinipools(submissions []*eth.Transaction
}

// Print TX info and wait for them to be included in a block
err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.rp, &t.log, submissions, callbacks, opts)
err = tx.PrintAndWaitForTransactionBatch(t.cfg, t.rp, t.log, submissions, callbacks, opts)
if err != nil {
return err
}
Expand Down
23 changes: 12 additions & 11 deletions src/rocketpool-daemon/node/download-reward-trees.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"

"github.com/rocket-pool/node-manager-core/utils/log"
"github.com/rocket-pool/rocketpool-go/rocketpool"
rprewards "github.com/rocket-pool/smartnode/rocketpool-daemon/common/rewards"
"github.com/rocket-pool/smartnode/rocketpool-daemon/common/services"
"github.com/rocket-pool/smartnode/rocketpool-daemon/common/state"
Expand All @@ -14,26 +15,25 @@ import (
// Manage download rewards trees task
type DownloadRewardsTrees struct {
sp *services.ServiceProvider
log log.ColorLogger
log *log.ColorLogger
cfg *config.SmartNodeConfig
rp *rocketpool.RocketPool
}

// Create manage fee recipient task
func NewDownloadRewardsTrees(sp *services.ServiceProvider, logger log.ColorLogger) *DownloadRewardsTrees {
return &DownloadRewardsTrees{
sp: sp,
log: logger,
log: &logger,
cfg: sp.GetConfig(),
rp: sp.GetRocketPool(),
}
}

// Manage fee recipient
func (t *DownloadRewardsTrees) Run(state *state.NetworkState) error {
// Get services
cfg := t.sp.GetConfig()
rp := t.sp.GetRocketPool()
nodeAddress, _ := t.sp.GetWallet().GetAddress()

// Check if the user opted into downloading rewards files
if cfg.RewardsTreeMode.Value != config.RewardsMode_Download {
if t.cfg.RewardsTreeMode.Value != config.RewardsMode_Download {
return nil
}

Expand All @@ -42,12 +42,13 @@ func (t *DownloadRewardsTrees) Run(state *state.NetworkState) error {

// Get the current interval
currentIndex := state.NetworkDetails.RewardIndex
nodeAddress, _ := t.sp.GetWallet().GetAddress()

// Check for missing intervals
missingIntervals := []uint64{}
for i := uint64(0); i < currentIndex; i++ {
// Check if the tree file exists
treeFilePath := cfg.GetRewardsTreePath(i)
treeFilePath := t.cfg.GetRewardsTreePath(i)
_, err := os.Stat(treeFilePath)
if os.IsNotExist(err) {
t.log.Printlnf("You are missing the rewards tree file for interval %d.", i)
Expand All @@ -64,11 +65,11 @@ func (t *DownloadRewardsTrees) Run(state *state.NetworkState) error {
// Download missing intervals
for _, missingInterval := range missingIntervals {
fmt.Printf("Downloading interval %d file... ", missingInterval)
intervalInfo, err := rprewards.GetIntervalInfo(rp, cfg, nodeAddress, missingInterval, nil)
intervalInfo, err := rprewards.GetIntervalInfo(t.rp, t.cfg, nodeAddress, missingInterval, nil)
if err != nil {
return fmt.Errorf("error getting interval %d info: %w", missingInterval, err)
}
err = rprewards.DownloadRewardsFile(cfg, &intervalInfo)
err = rprewards.DownloadRewardsFile(t.cfg, &intervalInfo)
if err != nil {
fmt.Println()
return err
Expand Down
22 changes: 11 additions & 11 deletions src/rocketpool-daemon/node/manage-fee-recipient.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"time"

"github.com/docker/docker/client"
"github.com/ethereum/go-ethereum/common"

"github.com/rocket-pool/node-manager-core/beacon"
Expand All @@ -29,31 +30,30 @@ type ManageFeeRecipient struct {
ctx context.Context
sp *services.ServiceProvider
cfg *config.SmartNodeConfig
log log.ColorLogger
log *log.ColorLogger
bc beacon.IBeaconClient
d *client.Client
}

// Create manage fee recipient task
func NewManageFeeRecipient(ctx context.Context, sp *services.ServiceProvider, logger log.ColorLogger) *ManageFeeRecipient {
return &ManageFeeRecipient{
ctx: ctx,
sp: sp,
log: logger,
log: &logger,
cfg: sp.GetConfig(),
bc: sp.GetBeaconClient(),
d: sp.GetDocker(),
}
}

// Manage fee recipient
func (t *ManageFeeRecipient) Run(state *state.NetworkState) error {
// Get services
t.cfg = t.sp.GetConfig()
t.bc = t.sp.GetBeaconClient()
d := t.sp.GetDocker()
nodeAddress, _ := t.sp.GetWallet().GetAddress()

// Log
t.log.Println("Checking for correct fee recipient...")

// Get the fee recipient info for the node
nodeAddress, _ := t.sp.GetWallet().GetAddress()
feeRecipientInfo, err := t.getFeeRecipientInfo(nodeAddress, state)
if err != nil {
return fmt.Errorf("error getting fee recipient info: %w", err)
Expand Down Expand Up @@ -90,7 +90,7 @@ func (t *ManageFeeRecipient) Run(state *state.NetworkState) error {
t.log.Printlnf("Error updating fee recipient files: %s", err.Error())
t.log.Println("Shutting down the validator client for safety to prevent you from being penalized...")

err = validator.StopValidator(t.cfg, t.bc, &t.log, d, false)
err = validator.StopValidator(t.cfg, t.bc, t.log, t.d, false)
if err != nil {
return fmt.Errorf("error stopping validator client: %w", err)
}
Expand All @@ -99,7 +99,7 @@ func (t *ManageFeeRecipient) Run(state *state.NetworkState) error {

// Restart the VC
t.log.Println("Fee recipient files updated successfully! Restarting validator client...")
err = validator.StopValidator(t.cfg, t.bc, &t.log, d, true)
err = validator.StopValidator(t.cfg, t.bc, t.log, t.d, true)
if err != nil {
return fmt.Errorf("error restarting validator client: %w", err)
}
Expand Down Expand Up @@ -132,7 +132,7 @@ func (t *ManageFeeRecipient) getFeeRecipientInfo(nodeAddress common.Address, sta
beaconConfig := state.BeaconConfig
beaconHead, err := t.bc.GetBeaconHead(t.ctx)
if err != nil {
return nil, fmt.Errorf("Error getting Beacon head: %w", err)
return nil, fmt.Errorf("error getting Beacon head: %w", err)
}

// Check if the user just opted out
Expand Down
Loading