Skip to content

Commit c97619e

Browse files
authored
Merge pull request #594 from rocket-pool/master-into-v2-jul
Merge master into v2
2 parents b0e8e4c + a97ee90 commit c97619e

File tree

10 files changed

+115
-200
lines changed

10 files changed

+115
-200
lines changed

.github/workflows/commits.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v4
13-
- name: Block Fixup Commit Merge
14-
uses: 13rac1/[email protected]
12+
- uses: actions/checkout@v4
13+
- name: Block Fixup Commit Merge
14+
uses: 13rac1/[email protected]

CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Contributing to Smart Node
2+
Smart Node is an open-source project that welcomes community contributions.
3+
4+
## Roles
5+
Smart Node has three roles: Owner, Maintainers, and Contributors.
6+
7+
### Owner
8+
The Owner has final say in settling disputes and making executive decisions when consensus cannot be reached. Currently, the Owner is @0xfornax.
9+
10+
### Maintainers
11+
Maintainers are team or community members who contribute routinely. The Owner is also a Maintainer. Current Maintainers:
12+
- @0xfornax
13+
- @thomaspanf
14+
- @jshufro
15+
16+
Smart Node was previously maintained by @jclapis and @moles1
17+
18+
### Contributors
19+
Contributors are community members who have submitted merged pull requests with some regularity. They are too numerous to list individually.
20+
21+
## Good Practices
22+
- Adhere to golang best practices. See [Effective Go](https://golang.org/doc/effective_go.html) for a good starting point.
23+
- Adhere to broader coding practices, such as DRY, POLA, Avoid Deep Nesting, etc.
24+
- New code should be unit tested when possible.
25+
- Write self-documenting code when possible, and add comments when necessary.
26+
27+
## Pull Requests
28+
- Each PR should represent a single feature, bugfix, or non-functional change.
29+
- Owners and Maintainers may decide if a change is too small for peer review, but should still offer the opportunity for review by posting the PR for at least a day, unless urgent.
30+
- Larger changes require at least one Maintainer's review.
31+
- All Contributor PRs must be reviewed by a Maintainer.
32+
- Commits should be groomed: each commit should compile, pass tests, and represent logical atomic progressions.
33+
- History rewriting is permissible only while a PR is in DRAFT status, or after a Maintainer has approved the PR. Once a PR is approved, fixup commits should be rebased into the original commits.
34+
35+
## Licenses
36+
Smart Node is licensed under GNU GPLv3, and all contributions must be made under the same license. See [LICENSE](LICENSE) for details.

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ The following commands are available via the Smartnode client:
8888
- `rocketpool node deposit, d` - Make a deposit and create a minipool
8989
- `rocketpool node create-vacant-minipool, cvm` - Create an empty minipool, which can be used to migrate an existing solo staking validator as part of the 0x00 to 0x01 withdrawal credentials upgrade
9090
- `rocketpool node send, n` - Send ETH or tokens from the node account to an address. ENS names supported. <token> can be 'rpl', 'eth', 'fsrpl' (for the old RPL v1 token), 'reth', or the address of an arbitrary token you want to send (including the 0x prefix).
91-
- `rocketpool node set-voting-delegate, sv` - Set the address you want to use when voting on Rocket Pool governance proposals on Snapshot, or the address you want to delegate your voting power to.
92-
- `rocketpool node clear-voting-delegate, cv` - Remove the address you've set for voting on Rocket Pool governance proposals.
9391
- `rocketpool node initialize-fee-distributor, z` - Create the fee distributor contract for your node, so you can withdraw priority fees and MEV rewards after the merge
9492
- `rocketpool node distribute-fees, b` - Distribute the priority fee and MEV rewards from your fee distributor to your withdrawal address and the rETH contract (based on your node's average commission)
9593
- `rocketpool node join-smoothing-pool, js` - Opt your node into the Smoothing Pool

rocketpool-cli/commands/node/clear-voting-delegate.go

Lines changed: 0 additions & 41 deletions
This file was deleted.

rocketpool-cli/commands/node/commands.go

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package node
22

33
import (
4+
"fmt"
5+
46
"github.com/urfave/cli/v2"
57

68
"github.com/rocket-pool/node-manager-core/utils/input"
@@ -515,33 +517,26 @@ func RegisterCommands(app *cli.App, name string, aliases []string) {
515517
{
516518
Name: "set-voting-delegate",
517519
Aliases: []string{"sv"},
518-
Usage: "Set the address you want to use when voting on Rocket Pool Snapshot governance proposals, or the address you want to delegate your voting power to.",
520+
Usage: "(DEPRECATED) Use `rocketpool pdao set-signalling-address` instead",
519521
ArgsUsage: "address",
520-
Flags: []cli.Flag{
521-
cliutils.YesFlag,
522-
},
523522
Action: func(c *cli.Context) error {
524-
// Validate args
525-
utils.ValidateArgCount(c, 1)
526-
delegate := c.Args().Get(0)
527523

528524
// Run
529-
return nodeSetVotingDelegate(c, delegate)
525+
fmt.Println("(DEPRECATED) Use `rocketpool pdao set-signalling-address` instead.")
526+
fmt.Println("For more information, please refer to the Governance article on Medium (https://medium.com/rocket-pool/rocket-pool-protocol-dao-governance-a3c3e92904e0).")
527+
return nil
530528
},
531529
},
532530
{
533531
Name: "clear-voting-delegate",
534532
Aliases: []string{"cv"},
535-
Usage: "Remove the address you've set for voting on Rocket Pool governance proposals.",
536-
Flags: []cli.Flag{
537-
cliutils.YesFlag,
538-
},
533+
Usage: "(DEPRECATED) Use `rocketpool pdao clear-signalling-address` instead",
539534
Action: func(c *cli.Context) error {
540-
// Validate args
541-
utils.ValidateArgCount(c, 0)
542535

543536
// Run
544-
return nodeClearVotingDelegate(c)
537+
fmt.Println("(DEPRECATED) Use `rocketpool pdao clear-signalling-address` instead.")
538+
fmt.Println("For more information, please refer to the Governance article on Medium (https://medium.com/rocket-pool/rocket-pool-protocol-dao-governance-a3c3e92904e0).")
539+
return nil
545540
},
546541
},
547542

rocketpool-cli/commands/node/set-voting-delegate.go

Lines changed: 0 additions & 62 deletions
This file was deleted.

rocketpool-daemon/common/proposals/proposal-manager.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ func (m *ProposalManager) GetArtifactsForVoting(blockNumber uint32, nodeAddress
216216

217217
// Get the artifacts
218218
totalDelegatedVp := nodeTree.Nodes[0].Sum
219+
if totalDelegatedVp == nil {
220+
totalDelegatedVp = big.NewInt(0)
221+
}
219222
treeIndex := getTreeNodeIndexFromRPNodeIndex(snapshot, nodeIndex)
220223
proofPtrs := networkTree.generateMerkleProof(treeIndex)
221224

rocketpool-daemon/watchtower/submit-network-balances.go

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -107,56 +107,17 @@ func (t *SubmitNetworkBalances) Run(state *state.NetworkState) error {
107107
submissionIntervalInSeconds := int64(state.NetworkDetails.PricesSubmissionFrequency)
108108
eth2Config := state.BeaconConfig
109109

110-
// Get the time of the latest block
111-
latestEth1Block, err := t.rp.Client.HeaderByNumber(context.Background(), nil)
112-
if err != nil {
113-
return fmt.Errorf("Can't get the latest block time: %w", err)
114-
}
115-
latestBlockTimestamp := int64(latestEth1Block.Time)
116-
117-
// Calculate the next submission timestamp
118-
submissionTimestamp, err := utils.FindNextSubmissionTimestamp(latestBlockTimestamp, referenceTimestamp, submissionIntervalInSeconds)
119-
if err != nil {
120-
return err
121-
}
122-
123-
// Convert the submission timestamp to time.Time
124-
nextSubmissionTime := time.Unix(submissionTimestamp, 0)
125-
126-
// Get the Beacon block corresponding to this time
127-
genesisTime := time.Unix(int64(eth2Config.GenesisTime), 0)
128-
timeSinceGenesis := nextSubmissionTime.Sub(genesisTime)
129-
slotNumber := uint64(timeSinceGenesis.Seconds()) / eth2Config.SecondsPerSlot
130-
131-
// Search for the last existing EL block, going back up to 32 slots if the block is not found.
132-
targetBlock, err := utils.FindLastBlockWithExecutionPayload(t.ctx, t.bc, slotNumber)
110+
slotNumber, nextSubmissionTime, targetBlockHeader, err := utils.FindNextSubmissionTarget(t.ctx, t.rp, eth2Config, t.bc, t.ec, lastSubmissionBlock, referenceTimestamp, submissionIntervalInSeconds)
133111
if err != nil {
134112
return err
135113
}
136114

137-
targetBlockNumber := targetBlock.ExecutionBlockNumber
138-
if targetBlockNumber <= lastSubmissionBlock {
115+
targetBlockNumber := targetBlockHeader.Number.Uint64()
116+
if targetBlockNumber < lastSubmissionBlock {
139117
// No submission needed: target block older or equal to the last submission
140118
return nil
141119
}
142120

143-
targetBlockHeader, err := t.ec.HeaderByNumber(context.Background(), big.NewInt(int64(targetBlockNumber)))
144-
if err != nil {
145-
return err
146-
}
147-
148-
// Check if the required epoch is finalized yet
149-
requiredEpoch := slotNumber / eth2Config.SlotsPerEpoch
150-
beaconHead, err := t.bc.GetBeaconHead(t.ctx)
151-
if err != nil {
152-
return err
153-
}
154-
finalizedEpoch := beaconHead.FinalizedEpoch
155-
if requiredEpoch > finalizedEpoch {
156-
t.logger.Info("Balance report is due, waiting for target epoch to finalize.", slog.Uint64(keys.BlockKey, targetBlockNumber), slog.Uint64(keys.TargetEpochKey, requiredEpoch), slog.Uint64(keys.FinalizedEpochKey, finalizedEpoch))
157-
return nil
158-
}
159-
160121
// Check if the process is already running
161122
t.lock.Lock()
162123
if t.isRunning {

rocketpool-daemon/watchtower/submit-rpl-price.go

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -94,47 +94,19 @@ func (t *SubmitRplPrice) Run(state *state.NetworkState) error {
9494
submissionIntervalInSeconds := int64(state.NetworkDetails.PricesSubmissionFrequency)
9595
eth2Config := state.BeaconConfig
9696

97-
// Get the time of the latest block
98-
latestEth1Block, err := t.rp.Client.HeaderByNumber(context.Background(), nil)
99-
if err != nil {
100-
return fmt.Errorf("Can't get the latest block time: %w", err)
101-
}
102-
latestBlockTimestamp := int64(latestEth1Block.Time)
103-
104-
// Calculate the next submission timestamp
105-
submissionTimestamp, err := utils.FindNextSubmissionTimestamp(latestBlockTimestamp, referenceTimestamp, submissionIntervalInSeconds)
97+
_, nextSubmissionTime, targetBlockHeader, err := utils.FindNextSubmissionTarget(t.ctx, t.rp, eth2Config, t.bc, t.ec, lastSubmissionBlock, referenceTimestamp, submissionIntervalInSeconds)
10698
if err != nil {
10799
return err
108100
}
109101

110-
// Get the Beacon slot corresponding to this time
111-
genesisTime := (int64(eth2Config.GenesisTime))
112-
timeSinceGenesis := submissionTimestamp - genesisTime
113-
slotNumber := uint64(timeSinceGenesis) / eth2Config.SecondsPerSlot
102+
submissionTimestamp := uint64(nextSubmissionTime.Unix())
114103

115-
// Search for the last existing EL block, going back up to 32 slots if the block is not found.
116-
targetBlock, err := utils.FindLastBlockWithExecutionPayload(t.ctx, t.bc, slotNumber)
117-
if err != nil {
118-
return err
119-
}
120-
targetBlockNumber := targetBlock.ExecutionBlockNumber
121-
if targetBlockNumber <= lastSubmissionBlock {
104+
targetBlockNumber := targetBlockHeader.Number.Uint64()
105+
if targetBlockNumber < lastSubmissionBlock {
122106
// No submission needed: target block older or equal to the last submission
123107
return nil
124108
}
125109

126-
// Check if the required epoch is finalized yet
127-
targetEpoch := slotNumber / eth2Config.SlotsPerEpoch
128-
beaconHead, err := t.bc.GetBeaconHead(t.ctx)
129-
if err != nil {
130-
return err
131-
}
132-
finalizedEpoch := beaconHead.FinalizedEpoch
133-
if targetEpoch > finalizedEpoch {
134-
t.logger.Info("Prices must be reported, waiting until target Epoch is finalized.", slog.Uint64(keys.BlockKey, targetBlockNumber), slog.Uint64(keys.TargetEpochKey, targetEpoch), slog.Uint64(keys.FinalizedEpochKey, finalizedEpoch))
135-
return nil
136-
}
137-
138110
// Check if the process is already running
139111
t.lock.Lock()
140112
if t.isRunning {
@@ -163,7 +135,7 @@ func (t *SubmitRplPrice) Run(state *state.NetworkState) error {
163135
t.logger.Info("Retrieved RPL price", slog.Uint64(keys.BlockKey, targetBlockNumber), slog.Float64(keys.PriceKey, math.RoundDown(eth.WeiToEth(rplPrice), 6)))
164136

165137
// Check if we have reported these specific values before
166-
hasSubmittedSpecific, err := t.hasSubmittedSpecificBlockPrices(nodeAddress, targetBlockNumber, uint64(submissionTimestamp), rplPrice, true)
138+
hasSubmittedSpecific, err := t.hasSubmittedSpecificBlockPrices(nodeAddress, targetBlockNumber, submissionTimestamp, rplPrice, true)
167139
if err != nil {
168140
t.handleError(err)
169141
return
@@ -176,7 +148,7 @@ func (t *SubmitRplPrice) Run(state *state.NetworkState) error {
176148
}
177149

178150
// We haven't submitted these values, check if we've submitted any for this block so we can log it
179-
hasSubmitted, err := t.hasSubmittedBlockPrices(nodeAddress, targetBlockNumber, uint64(submissionTimestamp), true)
151+
hasSubmitted, err := t.hasSubmittedBlockPrices(nodeAddress, targetBlockNumber, submissionTimestamp, true)
180152
if err != nil {
181153
t.handleError(err)
182154
return
@@ -189,7 +161,7 @@ func (t *SubmitRplPrice) Run(state *state.NetworkState) error {
189161
t.logger.Info("Submitting RPL price...")
190162

191163
// Submit RPL price
192-
if err := t.submitRplPrice(targetBlockNumber, uint64(submissionTimestamp), rplPrice, true); err != nil {
164+
if err := t.submitRplPrice(targetBlockNumber, submissionTimestamp, rplPrice, true); err != nil {
193165
t.handleError(fmt.Errorf("error submitting RPL price: %w", err))
194166
return
195167
}

0 commit comments

Comments
 (0)