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
44 changes: 0 additions & 44 deletions bindings/dao/security/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,50 +34,6 @@ func Join(rp *rocketpool.RocketPool, opts *bind.TransactOpts) (common.Hash, erro
return tx.Hash(), nil
}

// Estimate the gas of Kick
func EstimateKickGas(rp *rocketpool.RocketPool, address common.Address, opts *bind.TransactOpts) (gaslimit.Limits, error) {
rocketDAOSecurityActions, err := getRocketDAOSecurityActions(rp, nil)
if err != nil {
return gaslimit.Limits{}, err
}
return rocketDAOSecurityActions.GetTransactionGasInfo(opts, "actionKick", address)
}

// Removes a member from the security DAO
func Kick(rp *rocketpool.RocketPool, address common.Address, opts *bind.TransactOpts) (common.Hash, error) {
rocketDAOSecurityActions, err := getRocketDAOSecurityActions(rp, nil)
if err != nil {
return common.Hash{}, err
}
tx, err := rocketDAOSecurityActions.Transact(opts, "actionKick", address)
if err != nil {
return common.Hash{}, fmt.Errorf("error kicking %s from the security DAO: %w", address.Hex(), err)
}
return tx.Hash(), nil
}

// Estimate the gas of KickMulti
func EstimateKickMultiGas(rp *rocketpool.RocketPool, addresses []common.Address, opts *bind.TransactOpts) (gaslimit.Limits, error) {
rocketDAOSecurityActions, err := getRocketDAOSecurityActions(rp, nil)
if err != nil {
return gaslimit.Limits{}, err
}
return rocketDAOSecurityActions.GetTransactionGasInfo(opts, "actionKickMulti", addresses)
}

// Removes multiple members from the security DAO
func KickMulti(rp *rocketpool.RocketPool, addresses []common.Address, opts *bind.TransactOpts) (common.Hash, error) {
rocketDAOSecurityActions, err := getRocketDAOSecurityActions(rp, nil)
if err != nil {
return common.Hash{}, err
}
tx, err := rocketDAOSecurityActions.Transact(opts, "actionKickMulti", addresses)
if err != nil {
return common.Hash{}, fmt.Errorf("error kicking members from the security DAO: %w", err)
}
return tx.Hash(), nil
}

// Estimate the gas of RequestLeave
func EstimateRequestLeaveGas(rp *rocketpool.RocketPool, opts *bind.TransactOpts) (gaslimit.Limits, error) {
rocketDAOSecurityActions, err := getRocketDAOSecurityActions(rp, nil)
Expand Down
25 changes: 0 additions & 25 deletions bindings/deposit/deposit-pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,8 @@ import (
"github.com/ethereum/go-ethereum/common"

"github.com/rocket-pool/smartnode/bindings/rocketpool"
"github.com/rocket-pool/smartnode/bindings/transactions/gaslimit"
)

// Estimate the gas required to exit the validator queue
func EstimateExitQueueGas(rp *rocketpool.RocketPool, validatorIndex uint64, expressQueue bool, opts *bind.TransactOpts) (gaslimit.Limits, error) {
rocketDepositPool, err := getRocketDepositPool(rp, nil)
if err != nil {
return gaslimit.Limits{}, err
}
validatorIndexBig := big.NewInt(int64(validatorIndex))
return rocketDepositPool.GetTransactionGasInfo(opts, "exitQueue", validatorIndexBig, expressQueue)
}

// Exit the validator queue
func ExitQueue(rp *rocketpool.RocketPool, validatorIndex uint64, expressQueue bool, opts *bind.TransactOpts) (common.Hash, error) {
rocketDepositPool, err := getRocketDepositPool(rp, nil)
if err != nil {
return common.Hash{}, err
}
validatorIndexBig := big.NewInt(int64(validatorIndex))
tx, err := rocketDepositPool.Transact(opts, "exitQueue", validatorIndexBig, expressQueue)
if err != nil {
return common.Hash{}, fmt.Errorf("error exiting validator queue: %w", err)
}
return tx.Hash(), nil
}

// Struct to hold queue top (address of the validator at the top of the queue and a boolean indicating if the assignment is possible)
type QueueTop struct {
Receiver common.Address `abi:"receiver"`
Expand Down
21 changes: 1 addition & 20 deletions bindings/megapool/megapool-contract-v2.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
package megapool

import (
"fmt"
"math/big"

"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"

"github.com/rocket-pool/smartnode/bindings/rocketpool"
"github.com/rocket-pool/smartnode/bindings/transactions/gaslimit"
)

type MegapoolV2 interface {
Megapool
EstimateForceExitGas(validatorIds []uint32, feeLimit *big.Int, opts *bind.TransactOpts) (gaslimit.Limits, error)
ForceExit(validatorIds []uint32, feeLimit *big.Int, opts *bind.TransactOpts) (common.Hash, error)
}

// Megapool contract from delegate version 2, which adds support for EL-triggered forced exits
type megapoolV2 struct {
megapoolV1
// TODO keeping this while waiting for megapoolv2 details
}

const (
Expand Down Expand Up @@ -57,17 +52,3 @@ func NewMegaPoolV2(rp *rocketpool.RocketPool, address common.Address, opts *bind
},
}, nil
}

// Estimate the gas of ForceExit
func (mp *megapoolV2) EstimateForceExitGas(validatorIds []uint32, feeLimit *big.Int, opts *bind.TransactOpts) (gaslimit.Limits, error) {
return mp.Contract.GetTransactionGasInfo(opts, "forceExit", validatorIds, feeLimit)
}

// Force exit megapool validators that failed to exit within the cooperative exit phase
func (mp *megapoolV2) ForceExit(validatorIds []uint32, feeLimit *big.Int, opts *bind.TransactOpts) (common.Hash, error) {
tx, err := mp.Contract.Transact(opts, "forceExit", validatorIds, feeLimit)
if err != nil {
return common.Hash{}, fmt.Errorf("error force exiting megapool %s validators: %w", mp.Address.Hex(), err)
}
return tx.Hash(), nil
}
28 changes: 0 additions & 28 deletions bindings/megapool/megapool-contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,20 +400,6 @@ func (mp *megapoolV1) GetNodeAddress(opts *bind.CallOpts) (common.Address, error
return *nodeAddress, nil
}

// Estimate the gas required to create a new validator as part of a megapool
func (mp *megapoolV1) EstimateNewValidatorGas(validatorId uint32, validatorSignature rptypes.ValidatorSignature, depositDataRoot common.Hash, opts *bind.TransactOpts) (gaslimit.Limits, error) {
return mp.Contract.GetTransactionGasInfo(opts, "newValidator", validatorId, validatorSignature[:], depositDataRoot)
}

// Create a new validator as part of a megapool
func (mp *megapoolV1) NewValidator(bondAmount *big.Int, useExpressTicket bool, validatorPubkey rptypes.ValidatorPubkey, validatorSignature rptypes.ValidatorSignature, opts *bind.TransactOpts) (common.Hash, error) {
tx, err := mp.Contract.Transact(opts, "newValidator", bondAmount, useExpressTicket, validatorPubkey[:], validatorSignature[:])
if err != nil {
return common.Hash{}, fmt.Errorf("error creating new validator %s: %w", validatorPubkey.Hex(), err)
}
return tx.Hash(), nil
}

// Estimate the gas required to remove a validator from the deposit queue
func (mp *megapoolV1) EstimateDequeueGas(validatorId uint32, opts *bind.TransactOpts) (gaslimit.Limits, error) {
return mp.Contract.GetTransactionGasInfo(opts, "dequeue", validatorId)
Expand All @@ -428,20 +414,6 @@ func (mp *megapoolV1) Dequeue(validatorId uint32, opts *bind.TransactOpts) (comm
return tx.Hash(), nil
}

// Estimate the gas required to accept requested funds from the deposit pool
func (mp *megapoolV1) EstimateAssignFundsGas(validatorId uint32, opts *bind.TransactOpts) (gaslimit.Limits, error) {
return mp.Contract.GetTransactionGasInfo(opts, "assignFunds", validatorId)
}

// Accept requested funds from the deposit pool
func (mp *megapoolV1) AssignFunds(validatorId uint32, opts *bind.TransactOpts) (common.Hash, error) {
tx, err := mp.Contract.Transact(opts, "assignFunds", validatorId)
if err != nil {
return common.Hash{}, fmt.Errorf("error assigning funds to validator ID %d: %w", validatorId, err)
}
return tx.Hash(), nil
}

// Estimate the gas required to dissolve a validator that has not staked within the required period
func (mp *megapoolV1) EstimateDissolveValidatorGas(validatorId uint32, opts *bind.TransactOpts) (gaslimit.Limits, error) {
return mp.Contract.GetTransactionGasInfo(opts, "dissolveValidator", validatorId)
Expand Down
4 changes: 0 additions & 4 deletions bindings/megapool/megapool-interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@ type Megapool interface {
CalculateRewards(amount *big.Int, opts *bind.CallOpts) (RewardSplit, error)
GetPendingRewards(opts *bind.CallOpts) (*big.Int, error)
GetNodeAddress(opts *bind.CallOpts) (common.Address, error)
EstimateNewValidatorGas(validatorId uint32, validatorSignature rptypes.ValidatorSignature, depositDataRoot common.Hash, opts *bind.TransactOpts) (gaslimit.Limits, error)
NewValidator(bondAmount *big.Int, useExpressTicket bool, validatorPubkey rptypes.ValidatorPubkey, validatorSignature rptypes.ValidatorSignature, opts *bind.TransactOpts) (common.Hash, error)
EstimateDequeueGas(validatorId uint32, opts *bind.TransactOpts) (gaslimit.Limits, error)
Dequeue(validatorId uint32, opts *bind.TransactOpts) (common.Hash, error)
EstimateDistributeGas(opts *bind.TransactOpts) (gaslimit.Limits, error)
Distribute(opts *bind.TransactOpts) (common.Hash, error)
EstimateAssignFundsGas(validatorId uint32, opts *bind.TransactOpts) (gaslimit.Limits, error)
AssignFunds(validatorId uint32, opts *bind.TransactOpts) (common.Hash, error)
EstimateDissolveValidatorGas(validatorId uint32, opts *bind.TransactOpts) (gaslimit.Limits, error)
DissolveValidator(validatorId uint32, opts *bind.TransactOpts) (common.Hash, error)
EstimateClaimRefundGas(opts *bind.TransactOpts) (gaslimit.Limits, error)
Expand Down
20 changes: 2 additions & 18 deletions bindings/minipool/minipool-contract-v4.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ type MinipoolV4 interface {
EstimateDistributeBalanceGas(rewardsOnly bool, opts *bind.TransactOpts) (gaslimit.Limits, error)
DistributeBalance(rewardsOnly bool, opts *bind.TransactOpts) (common.Hash, error)
PrepareDistributeBalance(rewardsOnly bool, opts *bind.TransactOpts) (*types.Transaction, error)
ForceExit(opts *bind.TransactOpts) (common.Hash, error)
EstimateForceExitGas(opts *bind.TransactOpts) (gaslimit.Limits, error)
}

// Minipool contract
Expand Down Expand Up @@ -77,10 +75,10 @@ func newMinipool_v4(rp *rocketpool.RocketPool, address common.Address, opts *bin
}, nil
}

// Get the minipool as a v4 minipool if it implements the required methods
// Get the minipool as a v4 minipool if its version and methods support it.
func GetMinipoolAsV4(mp Minipool) (MinipoolV4, bool) {
castedMp, ok := mp.(MinipoolV4)
if ok {
if ok && mp.GetVersion() >= 4 {
return castedMp, true
}
return nil, false
Expand Down Expand Up @@ -651,17 +649,3 @@ func (mp *minipool_v4) GetPrestakeEvent(intervalSize *big.Int, opts *bind.CallOp
}
return prestakeData, nil
}

// Estimate the gas required to force exit a minipool
func (mp *minipool_v4) EstimateForceExitGas(opts *bind.TransactOpts) (gaslimit.Limits, error) {
return mp.Contract.GetTransactionGasInfo(opts, "forceExit")
}

// Force exit a minipool
func (mp *minipool_v4) ForceExit(opts *bind.TransactOpts) (common.Hash, error) {
tx, err := mp.Contract.Transact(opts, "forceExit")
if err != nil {
return common.Hash{}, fmt.Errorf("error forcing exit for minipool %s: %w", mp.Address.Hex(), err)
}
return tx.Hash(), nil
}
66 changes: 0 additions & 66 deletions bindings/network/exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,6 @@ func GetMinipoolLastExit(rp *rocketpool.RocketPool, minipoolAddress common.Addre
return time.Unix((*value).Int64(), 0), nil
}

// Estimate the gas of RequestMinipoolExit
func EstimateRequestMinipoolExitGas(rp *rocketpool.RocketPool, minipoolAddress common.Address, opts *bind.TransactOpts) (gaslimit.Limits, error) {
rocketNetworkExit, err := getRocketNetworkExit(rp, nil)
if err != nil {
return gaslimit.Limits{}, err
}
return rocketNetworkExit.GetTransactionGasInfo(opts, "requestMinipoolExit", minipoolAddress)
}

// Request a Minipool to exit cooperatively
func RequestMinipoolExit(rp *rocketpool.RocketPool, minipoolAddress common.Address, opts *bind.TransactOpts) (common.Hash, error) {
rocketNetworkExit, err := getRocketNetworkExit(rp, nil)
if err != nil {
return common.Hash{}, err
}
tx, err := rocketNetworkExit.Transact(opts, "requestMinipoolExit", minipoolAddress)
if err != nil {
return common.Hash{}, fmt.Errorf("error requesting minipool exit for %s: %w", minipoolAddress.Hex(), err)
}
return tx.Hash(), nil
}

// Estimate the gas of ForceMinipoolExit
func EstimateForceMinipoolExitGas(rp *rocketpool.RocketPool, minipoolAddress common.Address, opts *bind.TransactOpts) (gaslimit.Limits, error) {
rocketNetworkExit, err := getRocketNetworkExit(rp, nil)
Expand Down Expand Up @@ -165,28 +143,6 @@ func PenaliseMinipool(rp *rocketpool.RocketPool, minipoolAddress common.Address,
return tx.Hash(), nil
}

// Estimate the gas of RequestMegapoolExit
func EstimateRequestMegapoolExitGas(rp *rocketpool.RocketPool, megapoolAddress common.Address, validatorId uint32, opts *bind.TransactOpts) (gaslimit.Limits, error) {
rocketNetworkExit, err := getRocketNetworkExit(rp, nil)
if err != nil {
return gaslimit.Limits{}, err
}
return rocketNetworkExit.GetTransactionGasInfo(opts, "requestMegapoolExit", megapoolAddress, validatorId)
}

// Request a Megapool validator to exit cooperatively
func RequestMegapoolExit(rp *rocketpool.RocketPool, megapoolAddress common.Address, validatorId uint32, opts *bind.TransactOpts) (common.Hash, error) {
rocketNetworkExit, err := getRocketNetworkExit(rp, nil)
if err != nil {
return common.Hash{}, err
}
tx, err := rocketNetworkExit.Transact(opts, "requestMegapoolExit", megapoolAddress, validatorId)
if err != nil {
return common.Hash{}, fmt.Errorf("error requesting megapool exit for %s validator %d: %w", megapoolAddress.Hex(), validatorId, err)
}
return tx.Hash(), nil
}

// Estimate the gas of ForceMegapoolExit
func EstimateForceMegapoolExitGas(rp *rocketpool.RocketPool, megapoolAddress common.Address, validatorId uint32, opts *bind.TransactOpts) (gaslimit.Limits, error) {
rocketNetworkExit, err := getRocketNetworkExit(rp, nil)
Expand All @@ -209,28 +165,6 @@ func ForceMegapoolExit(rp *rocketpool.RocketPool, megapoolAddress common.Address
return tx.Hash(), nil
}

// Estimate the gas of PenaliseMegapoolValidator
func EstimatePenaliseMegapoolValidatorGas(rp *rocketpool.RocketPool, megapoolAddress common.Address, validatorId uint32, opts *bind.TransactOpts) (gaslimit.Limits, error) {
rocketNetworkExit, err := getRocketNetworkExit(rp, nil)
if err != nil {
return gaslimit.Limits{}, err
}
return rocketNetworkExit.GetTransactionGasInfo(opts, "penaliseMegapool", megapoolAddress, validatorId)
}

// Penalise a megapool validator that failed to exit within the cooperative exit phase
func PenaliseMegapoolValidator(rp *rocketpool.RocketPool, megapoolAddress common.Address, validatorId uint32, opts *bind.TransactOpts) (common.Hash, error) {
rocketNetworkExit, err := getRocketNetworkExit(rp, nil)
if err != nil {
return common.Hash{}, err
}
tx, err := rocketNetworkExit.Transact(opts, "penaliseMegapool", megapoolAddress, validatorId)
if err != nil {
return common.Hash{}, fmt.Errorf("error penalising megapool %s validator %d: %w", megapoolAddress.Hex(), validatorId, err)
}
return tx.Hash(), nil
}

// Get MinipoolExitRequested events emitted during the given block range
func GetMinipoolExitRequests(rp *rocketpool.RocketPool, intervalSize *big.Int, fromBlock *big.Int, toBlock *big.Int, opts *bind.CallOpts) ([]MinipoolExitRequest, error) {
rocketNetworkExit, err := getRocketNetworkExit(rp, opts)
Expand Down
14 changes: 0 additions & 14 deletions bindings/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,20 +722,6 @@ func GetExpressTicketCount(rp *rocketpool.RocketPool, nodeAddress common.Address
return (*expressTicketCount).Uint64(), nil
}

// Consume an express ticket for the given node operator
func UseExpressTicket(rp *rocketpool.RocketPool, nodeAddress common.Address, opts *bind.TransactOpts) (common.Hash, error) {
rocketNodeManager, err := getRocketNodeManager(rp, nil)
if err != nil {
return common.Hash{}, nil
}

tx, err := rocketNodeManager.Transact(opts, "useExpressTicket")
if err != nil {
return common.Hash{}, fmt.Errorf("error calling useExpressticket: %w", err)
}
return tx.Hash(), nil
}

// Get the megapool address for the given node operator
func GetMegapoolAddress(rp *rocketpool.RocketPool, nodeAddress common.Address, opts *bind.CallOpts) (common.Address, error) {
rocketNodeManager, err := getRocketNodeManager(rp, opts)
Expand Down
Loading
Loading