Skip to content

Commit 4e16951

Browse files
authored
Merge pull request #845 from rocket-pool/remove-initialize-voting-power
Remove initialize voting power functions and checks
2 parents 16d1321 + 1850b4e commit 4e16951

21 files changed

Lines changed: 14 additions & 863 deletions

bindings/network/voting.go

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -88,63 +88,6 @@ func GetNodeInfoSnapshotFast(rp *rocketpool.RocketPool, blockNumber uint32, mult
8888
return votingInfos, nil
8989
}
9090

91-
// Check whether or not on-chain voting has been initialized for the given node
92-
func GetVotingInitialized(rp *rocketpool.RocketPool, address common.Address, opts *bind.CallOpts) (bool, error) {
93-
rocketNetworkVoting, err := getRocketNetworkVoting(rp, nil)
94-
if err != nil {
95-
return false, err
96-
}
97-
value := new(bool)
98-
if err := rocketNetworkVoting.Call(opts, value, "getVotingInitialised", address); err != nil {
99-
return false, fmt.Errorf("error getting voting initialized status: %w", err)
100-
}
101-
return *value, nil
102-
}
103-
104-
// Estimate the gas of InitializeVoting
105-
func EstimateInitializeVotingGas(rp *rocketpool.RocketPool, opts *bind.TransactOpts) (rocketpool.GasInfo, error) {
106-
rocketNetworkVoting, err := getRocketNetworkVoting(rp, nil)
107-
if err != nil {
108-
return rocketpool.GasInfo{}, err
109-
}
110-
return rocketNetworkVoting.GetTransactionGasInfo(opts, "initialiseVoting")
111-
}
112-
113-
// Initialize on-chain voting for the node
114-
func InitializeVoting(rp *rocketpool.RocketPool, opts *bind.TransactOpts) (common.Hash, error) {
115-
rocketNetworkVoting, err := getRocketNetworkVoting(rp, nil)
116-
if err != nil {
117-
return common.Hash{}, err
118-
}
119-
tx, err := rocketNetworkVoting.Transact(opts, "initialiseVoting")
120-
if err != nil {
121-
return common.Hash{}, fmt.Errorf("error initializing voting: %w", err)
122-
}
123-
return tx.Hash(), nil
124-
}
125-
126-
// Estimate the gas of InitializeVotingWithDelegate
127-
func EstimateInitializeVotingWithDelegateGas(rp *rocketpool.RocketPool, delegateAddress common.Address, opts *bind.TransactOpts) (rocketpool.GasInfo, error) {
128-
rocketNetworkVoting, err := getRocketNetworkVoting(rp, nil)
129-
if err != nil {
130-
return rocketpool.GasInfo{}, err
131-
}
132-
return rocketNetworkVoting.GetTransactionGasInfo(opts, "initialiseVotingWithDelegate", delegateAddress)
133-
}
134-
135-
// Initialize on-chain voting for the node and delegate voting power at the same transaction
136-
func InitializeVotingWithDelegate(rp *rocketpool.RocketPool, delegateAddress common.Address, opts *bind.TransactOpts) (common.Hash, error) {
137-
rocketNetworkVoting, err := getRocketNetworkVoting(rp, nil)
138-
if err != nil {
139-
return common.Hash{}, err
140-
}
141-
tx, err := rocketNetworkVoting.Transact(opts, "initialiseVotingWithDelegate", delegateAddress)
142-
if err != nil {
143-
return common.Hash{}, fmt.Errorf("error initializing voting with delegate: %w", err)
144-
}
145-
return tx.Hash(), nil
146-
}
147-
14891
// Get the number of nodes that were present in the network at the provided block
14992
func GetVotingNodeCount(rp *rocketpool.RocketPool, blockNumber uint32, opts *bind.CallOpts) (*big.Int, error) {
15093
rocketNetworkVoting, err := getRocketNetworkVoting(rp, nil)

rocketpool-cli/network/dao-proposals.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,6 @@ func getActiveDAOProposals(c *cli.Context) error {
134134

135135
// Onchain Voting Status
136136
fmt.Printf("%s=== Onchain Voting ===%s\n", colorGreen, colorReset)
137-
if snapshotProposalsResponse.IsVotingInitialized {
138-
fmt.Printf("The node %s%s%s has been initialized for onchain voting.\n", colorBlue, snapshotProposalsResponse.AccountAddressFormatted, colorReset)
139-
} else {
140-
fmt.Printf("The node %s%s%s has NOT been initialized for onchain voting. You need to run `rocketpool pdao initialize-voting` to participate in onchain votes.\n", colorBlue, snapshotProposalsResponse.AccountAddressFormatted, colorReset)
141-
}
142137

143138
if snapshotProposalsResponse.OnchainVotingDelegate == blankAddress {
144139
fmt.Println("The node doesn't have a delegate, which means it can vote directly on onchain proposals after it initializes voting.")

rocketpool-cli/node/status.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,6 @@ func getStatus(c *cli.Context) error {
204204

205205
// Onchain voting status
206206
fmt.Printf("%s=== Onchain Voting ===%s\n", colorGreen, colorReset)
207-
if status.IsVotingInitialized {
208-
fmt.Println("The node has been initialized for onchain voting.")
209-
210-
} else {
211-
fmt.Println("The node has NOT been initialized for onchain voting. You need to run `rocketpool pdao initialize-voting` to participate in onchain votes.")
212-
}
213207

214208
if status.OnchainVotingDelegate == blankAddress {
215209
fmt.Println("The node doesn't have a delegate, which means it can vote directly on onchain proposals after it initializes voting.")

rocketpool-cli/pdao/commands.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,6 @@ func RegisterCommands(app *cli.App, name string, aliases []string) {
6767

6868
},
6969
},
70-
{
71-
Name: "initialize-voting",
72-
Aliases: []string{"iv"},
73-
Usage: "Unlocks a node operator's voting power (only required for node operators who registered before governance structure was in place)",
74-
UsageText: "rocketpool pdao initialize-voting",
75-
Action: func(c *cli.Context) error {
76-
77-
// Run
78-
return initializeVotingPrompt(c)
79-
80-
},
81-
},
8270
{
8371
Name: "set-signalling-address",
8472
Aliases: []string{"ssa"},

rocketpool-cli/pdao/initialize-voting-with-delegate.go

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

rocketpool-cli/pdao/initialize-voting.go

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

rocketpool-cli/pdao/status.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ func getStatus(c *cli.Context) error {
9898

9999
// Onchain Voting Status
100100
fmt.Printf("%s=== Onchain Voting ===%s\n", colorGreen, colorReset)
101-
if response.IsVotingInitialized {
102-
fmt.Printf("The node %s%s%s has been initialized for onchain voting.\n", colorBlue, response.AccountAddressFormatted, colorReset)
103-
} else {
104-
fmt.Printf("The node %s%s%s has NOT been initialized for onchain voting. You need to run `rocketpool pdao initialize-voting` to participate in onchain votes.\n", colorBlue, response.AccountAddressFormatted, colorReset)
105-
}
106101

107102
if response.OnchainVotingDelegate == blankAddress {
108103
fmt.Println("The node doesn't have a delegate, which means it can vote directly on onchain proposals after it initializes voting.")

rocketpool/api/network/dao-proposals.go

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package network
33
import (
44
"context"
55
"fmt"
6-
"math/big"
76

87
"github.com/ethereum/go-ethereum/accounts/abi/bind"
98
"github.com/ethereum/go-ethereum/common"
@@ -63,13 +62,6 @@ func getActiveDAOProposals(c *cli.Context) (*api.NetworkDAOProposalsResponse, er
6362
var wg errgroup.Group
6463
var blockNumber uint64
6564

66-
// Check if Voting is initialized and add to response
67-
wg.Go(func() error {
68-
var err error
69-
response.IsVotingInitialized, err = network.GetVotingInitialized(rp, nodeAccount.Address, nil)
70-
return err
71-
})
72-
7365
// Get the node onchain voting delegate
7466
wg.Go(func() error {
7567
var err error
@@ -142,15 +134,10 @@ func getActiveDAOProposals(c *cli.Context) (*api.NetworkDAOProposalsResponse, er
142134
return nil, err
143135
}
144136

145-
// Get the delegated voting power if voting is initialized
146-
if response.IsVotingInitialized {
147-
totalDelegatedVP, _, _, err := propMgr.GetArtifactsForVoting(response.BlockNumber, nodeAccount.Address)
148-
if err != nil {
149-
return nil, err
150-
}
151-
response.TotalDelegatedVp = totalDelegatedVP
152-
} else {
153-
response.TotalDelegatedVp = big.NewInt(0)
137+
// Get the delegated voting power
138+
response.TotalDelegatedVp, _, _, err = propMgr.GetArtifactsForVoting(response.BlockNumber, nodeAccount.Address)
139+
if err != nil {
140+
return nil, err
154141
}
155142

156143
// Get the local tree

rocketpool/api/node/status.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,6 @@ func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) {
276276
})
277277
}
278278

279-
// Check if Voting is Initialized
280-
wg.Go(func() error {
281-
var err error
282-
response.IsVotingInitialized, err = network.GetVotingInitialized(rp, nodeAccount.Address, nil)
283-
return err
284-
})
285-
286279
// Get the node onchain voting delegate
287280
wg.Go(func() error {
288281
var err error

0 commit comments

Comments
 (0)