Skip to content

Commit 4c4d2f9

Browse files
committed
WIP add propose allow listed controller addresses
1 parent 6e7b579 commit 4c4d2f9

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

bindings/settings/protocol/network.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const (
3232
NetworkPenaltyThresholdSettingPath string = "network.penalty.threshold"
3333
NetworkPenaltyPerRateSettingPath string = "network.penalty.per.rate"
3434
SubmitRewardsEnabledSettingPath string = "network.submit.rewards.enabled"
35+
NetworkAllowListedControllersPath string = "network.allow.listed.controllers"
3536
)
3637

3738
// The threshold of trusted nodes that must reach consensus on oracle data to commit it

rocketpool-cli/pdao/commands.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const (
1818
unboundedPercentUsage string = "specify a percentage that can go over 100% (e.g., '1.5' for 150%)"
1919
uintUsage string = "specify an integer (e.g., '50')"
2020
durationUsage string = "specify a duration using hours, minutes, and seconds (e.g., '20m' or '72h0m0s')"
21+
addressListUsage string = "specify a list of one or more addresses separated by commas (e.g., '0x1a2b3c4d5e6f7890abcdef1234567890abcdef12,0xabcdefabcdefabcdefabcdefabcdefabcdefabcd')"
2122
)
2223

2324
// Register commands
@@ -1549,6 +1550,34 @@ func RegisterCommands(app *cli.App, name string, aliases []string) {
15491550

15501551
},
15511552
},
1553+
1554+
{
1555+
Name: "allow-listed-controllers",
1556+
Aliases: []string{"alc"},
1557+
Usage: fmt.Sprintf("Propose updating the %s setting; %s", protocol.NetworkAllowListedControllersPath, addressListUsage),
1558+
UsageText: "rocketpool pdao propose setting network allow-listed-controllers value",
1559+
Flags: []cli.Flag{
1560+
cli.BoolFlag{
1561+
Name: "yes, y",
1562+
Usage: "Automatically confirm all interactive questions",
1563+
},
1564+
},
1565+
Action: func(c *cli.Context) error {
1566+
1567+
// Validate args
1568+
if err := cliutils.ValidateArgCount(c, 1); err != nil {
1569+
return err
1570+
}
1571+
value, err := cliutils.ValidateAddresses("value", c.Args().Get(0))
1572+
if err != nil {
1573+
return err
1574+
}
1575+
1576+
// Run
1577+
return proposeSettingNetworkAllowListedControllers(c, value)
1578+
1579+
},
1580+
},
15521581
},
15531582
},
15541583

rocketpool-cli/pdao/propose-settings.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ package pdao
33
import (
44
"fmt"
55
"math/big"
6+
"strings"
67
"time"
78

9+
"github.com/ethereum/go-ethereum/common"
810
"github.com/rocket-pool/smartnode/bindings/settings/protocol"
911
"github.com/rocket-pool/smartnode/bindings/utils/eth"
1012
"github.com/urfave/cli"
@@ -300,6 +302,15 @@ func proposeSettingSecurityProposalActionTime(c *cli.Context, value time.Duratio
300302
return proposeSetting(c, protocol.SecuritySettingsContractName, protocol.SecurityProposalActionTimeSettingPath, trueValue)
301303
}
302304

305+
func proposeSettingNetworkAllowListedControllers(c *cli.Context, value []common.Address) error {
306+
strs := make([]string, len(value))
307+
for i, addr := range value {
308+
strs[i] = addr.Hex()
309+
}
310+
trueValue := strings.Join(strs, "")
311+
return proposeSetting(c, protocol.NetworkSettingsContractName, protocol.NetworkAllowListedControllersPath, trueValue)
312+
}
313+
303314
// Master general proposal function
304315
func proposeSetting(c *cli.Context, contract string, setting string, value string) error {
305316
// Get RP client

0 commit comments

Comments
 (0)