diff --git a/node/staking.go b/node/staking.go index 43cea93b..f6713fcb 100644 --- a/node/staking.go +++ b/node/staking.go @@ -81,17 +81,17 @@ func GetNodeMinimumRPLStake(rp *rocketpool.RocketPool, nodeAddress common.Addres } -// Get the block a node last staked RPL at -func GetNodeRPLStakedBlock(rp *rocketpool.RocketPool, nodeAddress common.Address, opts *bind.CallOpts) (uint64, error) { +// Get the time a node last staked RPL +func GetNodeRPLStakedTime(rp *rocketpool.RocketPool, nodeAddress common.Address, opts *bind.CallOpts) (uint64, error) { rocketNodeStaking, err := getRocketNodeStaking(rp) if err != nil { return 0, err } - nodeRplStakedBlock := new(*big.Int) - if err := rocketNodeStaking.Call(opts, nodeRplStakedBlock, "getNodeRPLStakedBlock", nodeAddress); err != nil { - return 0, fmt.Errorf("Could not get node RPL staked block: %w", err) + nodeRplStakedTime := new(*big.Int) + if err := rocketNodeStaking.Call(opts, nodeRplStakedTime, "getNodeRPLStakedTime", nodeAddress); err != nil { + return 0, fmt.Errorf("Could not get node RPL staked time: %w", err) } - return (*nodeRplStakedBlock).Uint64(), nil + return (*nodeRplStakedTime).Uint64(), nil } diff --git a/settings/protocol/inflation.go b/settings/protocol/inflation.go index 8cef9b63..abf01901 100644 --- a/settings/protocol/inflation.go +++ b/settings/protocol/inflation.go @@ -34,36 +34,36 @@ func BootstrapInflationIntervalRate(rp *rocketpool.RocketPool, value float64, op } -// RPL inflation interval in blocks -func GetInflationIntervalBlocks(rp *rocketpool.RocketPool, opts *bind.CallOpts) (uint64, error) { +// RPL inflation interval time +func GetInflationIntervalTime(rp *rocketpool.RocketPool, opts *bind.CallOpts) (uint64, error) { inflationSettingsContract, err := getInflationSettingsContract(rp) if err != nil { return 0, err } value := new(*big.Int) - if err := inflationSettingsContract.Call(opts, value, "getInflationIntervalBlocks"); err != nil { + if err := inflationSettingsContract.Call(opts, value, "getInflationIntervalTime"); err != nil { return 0, fmt.Errorf("Could not get inflation interval: %w", err) } return (*value).Uint64(), nil } -func BootstrapInflationIntervalBlocks(rp *rocketpool.RocketPool, value uint64, opts *bind.TransactOpts) (common.Hash, error) { - return protocoldao.BootstrapUint(rp, InflationSettingsContractName, "rpl.inflation.interval.blocks", big.NewInt(int64(value)), opts) +func BootstrapInflationIntervalTime(rp *rocketpool.RocketPool, value uint64, opts *bind.TransactOpts) (common.Hash, error) { + return protocoldao.BootstrapUint(rp, InflationSettingsContractName, "rpl.inflation.interval.time", big.NewInt(int64(value)), opts) } -// RPL inflation start block -func GetInflationStartBlock(rp *rocketpool.RocketPool, opts *bind.CallOpts) (uint64, error) { +// RPL inflation start time +func GetInflationStartTime(rp *rocketpool.RocketPool, opts *bind.CallOpts) (uint64, error) { inflationSettingsContract, err := getInflationSettingsContract(rp) if err != nil { return 0, err } value := new(*big.Int) - if err := inflationSettingsContract.Call(opts, value, "getInflationIntervalStartBlock"); err != nil { - return 0, fmt.Errorf("Could not get inflation start block: %w", err) + if err := inflationSettingsContract.Call(opts, value, "getInflationIntervalStartTime"); err != nil { + return 0, fmt.Errorf("Could not get inflation start time: %w", err) } return (*value).Uint64(), nil } -func BootstrapInflationStartBlock(rp *rocketpool.RocketPool, value uint64, opts *bind.TransactOpts) (common.Hash, error) { +func BootstrapInflationStartTime(rp *rocketpool.RocketPool, value uint64, opts *bind.TransactOpts) (common.Hash, error) { return protocoldao.BootstrapUint(rp, InflationSettingsContractName, "rpl.inflation.interval.start", big.NewInt(int64(value)), opts) } diff --git a/settings/protocol/rewards.go b/settings/protocol/rewards.go index 508ec7c3..a0e06f29 100644 --- a/settings/protocol/rewards.go +++ b/settings/protocol/rewards.go @@ -31,15 +31,15 @@ func GetRewardsClaimerPerc(rp *rocketpool.RocketPool, contractName string, opts } -// The block that a claimer's share was last updated at -func GetRewardsClaimerPercBlockUpdated(rp *rocketpool.RocketPool, contractName string, opts *bind.CallOpts) (uint64, error) { +// The time that a claimer's share was last updated +func GetRewardsClaimerPercTimeUpdated(rp *rocketpool.RocketPool, contractName string, opts *bind.CallOpts) (uint64, error) { rewardsSettingsContract, err := getRewardsSettingsContract(rp) if err != nil { return 0, err } value := new(*big.Int) - if err := rewardsSettingsContract.Call(opts, value, "getRewardsClaimerPercBlockUpdated", contractName); err != nil { - return 0, fmt.Errorf("Could not get rewards claimer updated block: %w", err) + if err := rewardsSettingsContract.Call(opts, value, "getRewardsClaimerPercTimeUpdated", contractName); err != nil { + return 0, fmt.Errorf("Could not get rewards claimer updated time: %w", err) } return (*value).Uint64(), nil } @@ -59,20 +59,20 @@ func GetRewardsClaimersPercTotal(rp *rocketpool.RocketPool, opts *bind.CallOpts) } -// Rewards claim interval in blocks -func GetRewardsClaimIntervalBlocks(rp *rocketpool.RocketPool, opts *bind.CallOpts) (uint64, error) { +// Rewards claim interval time +func GetRewardsClaimIntervalTime(rp *rocketpool.RocketPool, opts *bind.CallOpts) (uint64, error) { rewardsSettingsContract, err := getRewardsSettingsContract(rp) if err != nil { return 0, err } value := new(*big.Int) - if err := rewardsSettingsContract.Call(opts, value, "getRewardsClaimIntervalBlocks"); err != nil { + if err := rewardsSettingsContract.Call(opts, value, "getRewardsClaimIntervalTime"); err != nil { return 0, fmt.Errorf("Could not get rewards claim interval: %w", err) } return (*value).Uint64(), nil } -func BootstrapRewardsClaimIntervalBlocks(rp *rocketpool.RocketPool, value uint64, opts *bind.TransactOpts) (common.Hash, error) { - return protocoldao.BootstrapUint(rp, RewardsSettingsContractName, "rpl.rewards.claim.period.blocks", big.NewInt(int64(value)), opts) +func BootstrapRewardsClaimIntervalTime(rp *rocketpool.RocketPool, value uint64, opts *bind.TransactOpts) (common.Hash, error) { + return protocoldao.BootstrapUint(rp, RewardsSettingsContractName, "rpl.rewards.claim.period.time", big.NewInt(int64(value)), opts) } diff --git a/tests/node/staking_test.go b/tests/node/staking_test.go index d1dd912d..7819556e 100644 --- a/tests/node/staking_test.go +++ b/tests/node/staking_test.go @@ -1,18 +1,18 @@ package node import ( - "math/big" - "testing" - - "github.com/rocket-pool/rocketpool-go/node" - "github.com/rocket-pool/rocketpool-go/settings/protocol" - "github.com/rocket-pool/rocketpool-go/tokens" - "github.com/rocket-pool/rocketpool-go/utils/eth" - - "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" - minipoolutils "github.com/rocket-pool/rocketpool-go/tests/testutils/minipool" - nodeutils "github.com/rocket-pool/rocketpool-go/tests/testutils/node" - rplutils "github.com/rocket-pool/rocketpool-go/tests/testutils/tokens/rpl" + "math/big" + "testing" + + "github.com/rocket-pool/rocketpool-go/node" + "github.com/rocket-pool/rocketpool-go/settings/protocol" + "github.com/rocket-pool/rocketpool-go/tokens" + "github.com/rocket-pool/rocketpool-go/utils/eth" + + "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" + minipoolutils "github.com/rocket-pool/rocketpool-go/tests/testutils/minipool" + nodeutils "github.com/rocket-pool/rocketpool-go/tests/testutils/node" + rplutils "github.com/rocket-pool/rocketpool-go/tests/testutils/tokens/rpl" ) @@ -65,10 +65,10 @@ func TestStakeRPL(t *testing.T) { } else if nodeMinimumRplStake.Cmp(big.NewInt(0)) != 0 { t.Errorf("Incorrect initial node minimum RPL stake %s", nodeMinimumRplStake.String()) } - if nodeRplStakedBlock, err := node.GetNodeRPLStakedBlock(rp, nodeAccount.Address, nil); err != nil { + if nodeRplStakedTime, err := node.GetNodeRPLStakedTime(rp, nodeAccount.Address, nil); err != nil { t.Error(err) - } else if nodeRplStakedBlock != 0 { - t.Errorf("Incorrect initial node RPL staked block %d", nodeRplStakedBlock) + } else if nodeRplStakedTime != 0 { + t.Errorf("Incorrect initial node RPL staked time %d", nodeRplStakedTime) } if nodeMinipoolLimit, err := node.GetNodeMinipoolLimit(rp, nodeAccount.Address, nil); err != nil { t.Error(err) @@ -107,10 +107,10 @@ func TestStakeRPL(t *testing.T) { } else if nodeMinimumRplStake.Cmp(big.NewInt(0)) != 0 { t.Errorf("Incorrect updated node minimum RPL stake 1 %s", nodeMinimumRplStake.String()) } - if nodeRplStakedBlock, err := node.GetNodeRPLStakedBlock(rp, nodeAccount.Address, nil); err != nil { + if nodeRplStakedTime, err := node.GetNodeRPLStakedTime(rp, nodeAccount.Address, nil); err != nil { t.Error(err) - } else if nodeRplStakedBlock == 0 { - t.Errorf("Incorrect updated node RPL staked block 1 %d", nodeRplStakedBlock) + } else if nodeRplStakedTime == 0 { + t.Errorf("Incorrect updated node RPL staked time 1 %d", nodeRplStakedTime) } if nodeMinipoolLimit, err := node.GetNodeMinipoolLimit(rp, nodeAccount.Address, nil); err != nil { t.Error(err) @@ -161,9 +161,9 @@ func TestWithdrawRPL(t *testing.T) { if err := nodeutils.StakeRPL(rp, ownerAccount, nodeAccount, rplAmount); err != nil { t.Fatal(err) } // Get & set rewards claim interval - rewardsClaimIntervalBlocks, err := protocol.GetRewardsClaimIntervalBlocks(rp, nil) + rewardsClaimIntervalTime, err := protocol.GetRewardsClaimIntervalTime(rp, nil) if err != nil { t.Fatal(err) } - if _, err := protocol.BootstrapRewardsClaimIntervalBlocks(rp, 0, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } + if _, err := protocol.BootstrapRewardsClaimIntervalTime(rp, 0, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } // Check initial staking details if totalRplStake, err := node.GetTotalRPLStake(rp, nil); err != nil { @@ -195,7 +195,7 @@ func TestWithdrawRPL(t *testing.T) { } // Reset rewards claim interval - if _, err := protocol.BootstrapRewardsClaimIntervalBlocks(rp, rewardsClaimIntervalBlocks, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } + if _, err := protocol.BootstrapRewardsClaimIntervalTime(rp, rewardsClaimIntervalTime, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } } diff --git a/tests/rewards/node_test.go b/tests/rewards/node_test.go index d1e1e0c2..b8f9885d 100644 --- a/tests/rewards/node_test.go +++ b/tests/rewards/node_test.go @@ -1,23 +1,25 @@ package rewards import ( - "context" - "math/big" - "testing" - - "github.com/rocket-pool/rocketpool-go/node" - "github.com/rocket-pool/rocketpool-go/rewards" - "github.com/rocket-pool/rocketpool-go/settings/protocol" - "github.com/rocket-pool/rocketpool-go/tokens" - "github.com/rocket-pool/rocketpool-go/utils/eth" - - "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" - minipoolutils "github.com/rocket-pool/rocketpool-go/tests/testutils/minipool" + "context" + "math/big" + "testing" + + "github.com/rocket-pool/rocketpool-go/node" + "github.com/rocket-pool/rocketpool-go/rewards" + "github.com/rocket-pool/rocketpool-go/settings/protocol" + "github.com/rocket-pool/rocketpool-go/tokens" + "github.com/rocket-pool/rocketpool-go/utils/eth" + + "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" + minipoolutils "github.com/rocket-pool/rocketpool-go/tests/testutils/minipool" ) func TestNodeRewards(t *testing.T) { + var secondsPerBlock uint64 = 12 + // State snapshotting if err := evm.TakeSnapshot(); err != nil { t.Fatal(err) } t.Cleanup(func() { if err := evm.RevertSnapshot(); err != nil { t.Fatal(err) } }) @@ -26,8 +28,8 @@ func TestNodeRewards(t *testing.T) { if _, err := node.RegisterNode(rp, "Australia/Brisbane", nodeAccount.GetTransactor()); err != nil { t.Fatal(err) } // Set network parameters - if _, err := protocol.BootstrapRewardsClaimIntervalBlocks(rp, 5, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } - if _, err := protocol.BootstrapInflationIntervalBlocks(rp, 5, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } + if _, err := protocol.BootstrapRewardsClaimIntervalTime(rp, 5 * secondsPerBlock, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } + if _, err := protocol.BootstrapInflationIntervalTime(rp, 5 * secondsPerBlock, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } // Get & check node claims enabled status if claimsEnabled, err := rewards.GetNodeClaimsEnabled(rp, nil); err != nil { @@ -44,7 +46,7 @@ func TestNodeRewards(t *testing.T) { } // Mine blocks until node claims are possible - if err := evm.MineBlocks(5); err != nil { t.Fatal(err) } + if err := evm.MineBlocks(10); err != nil { t.Fatal(err) } // Get & check updated node claim possible status if nodeClaimPossible, err := rewards.GetNodeClaimPossible(rp, nodeAccount.Address, nil); err != nil { @@ -80,7 +82,7 @@ func TestNodeRewards(t *testing.T) { // Start RPL inflation if header, err := rp.Client.HeaderByNumber(context.Background(), nil); err != nil { t.Fatal(err) - } else if _, err := protocol.BootstrapInflationStartBlock(rp, header.Number.Uint64() + 2, ownerAccount.GetTransactor()); err != nil { + } else if _, err := protocol.BootstrapInflationStartTime(rp, (header.Number.Uint64() + 2) * secondsPerBlock, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } diff --git a/tests/rewards/trusted_node_test.go b/tests/rewards/trusted_node_test.go index d2fb0dd5..2b0910b0 100644 --- a/tests/rewards/trusted_node_test.go +++ b/tests/rewards/trusted_node_test.go @@ -1,21 +1,23 @@ package rewards import ( - "context" - "math/big" - "testing" + "context" + "math/big" + "testing" - "github.com/rocket-pool/rocketpool-go/rewards" - "github.com/rocket-pool/rocketpool-go/settings/protocol" - "github.com/rocket-pool/rocketpool-go/tokens" + "github.com/rocket-pool/rocketpool-go/rewards" + "github.com/rocket-pool/rocketpool-go/settings/protocol" + "github.com/rocket-pool/rocketpool-go/tokens" - "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" - nodeutils "github.com/rocket-pool/rocketpool-go/tests/testutils/node" + "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" + nodeutils "github.com/rocket-pool/rocketpool-go/tests/testutils/node" ) func TestTrustedNodeRewards(t *testing.T) { + var secondsPerBlock uint64 = 12 + // State snapshotting if err := evm.TakeSnapshot(); err != nil { t.Fatal(err) } t.Cleanup(func() { if err := evm.RevertSnapshot(); err != nil { t.Fatal(err) } }) @@ -24,8 +26,8 @@ func TestTrustedNodeRewards(t *testing.T) { if err := nodeutils.RegisterTrustedNode(rp, ownerAccount, trustedNodeAccount); err != nil { t.Fatal(err) } // Set network parameters - if _, err := protocol.BootstrapRewardsClaimIntervalBlocks(rp, 5, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } - if _, err := protocol.BootstrapInflationIntervalBlocks(rp, 5, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } + if _, err := protocol.BootstrapRewardsClaimIntervalTime(rp, 5 * secondsPerBlock, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } + if _, err := protocol.BootstrapInflationIntervalTime(rp, 5 * secondsPerBlock, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } // Get & check trusted node claims enabled status if claimsEnabled, err := rewards.GetTrustedNodeClaimsEnabled(rp, nil); err != nil { @@ -68,7 +70,7 @@ func TestTrustedNodeRewards(t *testing.T) { // Start RPL inflation if header, err := rp.Client.HeaderByNumber(context.Background(), nil); err != nil { t.Fatal(err) - } else if _, err := protocol.BootstrapInflationStartBlock(rp, header.Number.Uint64() + 2, ownerAccount.GetTransactor()); err != nil { + } else if _, err := protocol.BootstrapInflationStartTime(rp, (header.Number.Uint64() + 2) * secondsPerBlock, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } diff --git a/tests/settings/protocol/inflation_test.go b/tests/settings/protocol/inflation_test.go index d2fad6b0..59fee7d3 100644 --- a/tests/settings/protocol/inflation_test.go +++ b/tests/settings/protocol/inflation_test.go @@ -1,16 +1,18 @@ package protocol import ( - "testing" + "testing" - "github.com/rocket-pool/rocketpool-go/settings/protocol" + "github.com/rocket-pool/rocketpool-go/settings/protocol" - "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" + "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" ) func TestInflationSettings(t *testing.T) { + var secondsPerBlock uint64 = 12 + // State snapshotting if err := evm.TakeSnapshot(); err != nil { t.Fatal(err) } t.Cleanup(func() { if err := evm.RevertSnapshot(); err != nil { t.Fatal(err) } }) @@ -25,24 +27,24 @@ func TestInflationSettings(t *testing.T) { t.Error("Incorrect inflation interval rate value") } - // Set & get inflation interval blocks - var inflationIntervalBlocks uint64 = 1 - if _, err := protocol.BootstrapInflationIntervalBlocks(rp, inflationIntervalBlocks, ownerAccount.GetTransactor()); err != nil { + // Set & get inflation interval time + var inflationIntervalTime uint64 = 1 * secondsPerBlock + if _, err := protocol.BootstrapInflationIntervalTime(rp, inflationIntervalTime, ownerAccount.GetTransactor()); err != nil { t.Error(err) - } else if value, err := protocol.GetInflationIntervalBlocks(rp, nil); err != nil { + } else if value, err := protocol.GetInflationIntervalTime(rp, nil); err != nil { t.Error(err) - } else if value != inflationIntervalBlocks { - t.Error("Incorrect inflation interval blocks value") + } else if value != inflationIntervalTime { + t.Error("Incorrect inflation interval time value") } // Set & get inflation start block - var inflationStartBlock uint64 = 1000000 - if _, err := protocol.BootstrapInflationStartBlock(rp, inflationStartBlock, ownerAccount.GetTransactor()); err != nil { + var inflationStartTime uint64 = 1000000 * secondsPerBlock + if _, err := protocol.BootstrapInflationStartTime(rp, inflationStartTime, ownerAccount.GetTransactor()); err != nil { t.Error(err) - } else if value, err := protocol.GetInflationStartBlock(rp, nil); err != nil { + } else if value, err := protocol.GetInflationStartTime(rp, nil); err != nil { t.Error(err) - } else if value != inflationStartBlock { - t.Error("Incorrect inflation start block value") + } else if value != inflationStartTime { + t.Error("Incorrect inflation start time value") } } diff --git a/tests/settings/protocol/rewards_test.go b/tests/settings/protocol/rewards_test.go index 2260c4df..2f3a8293 100644 --- a/tests/settings/protocol/rewards_test.go +++ b/tests/settings/protocol/rewards_test.go @@ -1,12 +1,12 @@ package protocol import ( - "testing" + "testing" - protocoldao "github.com/rocket-pool/rocketpool-go/dao/protocol" - protocolsettings "github.com/rocket-pool/rocketpool-go/settings/protocol" + protocoldao "github.com/rocket-pool/rocketpool-go/dao/protocol" + protocolsettings "github.com/rocket-pool/rocketpool-go/settings/protocol" - "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" + "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" ) @@ -26,10 +26,10 @@ func TestRewardsSettings(t *testing.T) { } else if value != claimerPerc { t.Errorf("Incorrect rewards claimer percent %f", value) } - if value, err := protocolsettings.GetRewardsClaimerPercBlockUpdated(rp, "rocketClaimNode", nil); err != nil { + if value, err := protocolsettings.GetRewardsClaimerPercTimeUpdated(rp, "rocketClaimNode", nil); err != nil { t.Error(err) } else if value == 0 { - t.Errorf("Incorrect rewards claimer percent block updated %d", value) + t.Errorf("Incorrect rewards claimer percent time updated %d", value) } if value, err := protocolsettings.GetRewardsClaimersPercTotal(rp, nil); err != nil { t.Error(err) @@ -38,14 +38,14 @@ func TestRewardsSettings(t *testing.T) { } } - // Set & get rewards claim interval blocks - var rewardsClaimIntervalBlocks uint64 = 1 - if _, err := protocolsettings.BootstrapRewardsClaimIntervalBlocks(rp, rewardsClaimIntervalBlocks, ownerAccount.GetTransactor()); err != nil { + // Set & get rewards claim interval time + var rewardsClaimIntervalTime uint64 = 1 + if _, err := protocolsettings.BootstrapRewardsClaimIntervalTime(rp, rewardsClaimIntervalTime, ownerAccount.GetTransactor()); err != nil { t.Error(err) - } else if value, err := protocolsettings.GetRewardsClaimIntervalBlocks(rp, nil); err != nil { + } else if value, err := protocolsettings.GetRewardsClaimIntervalTime(rp, nil); err != nil { t.Error(err) - } else if value != rewardsClaimIntervalBlocks { - t.Error("Incorrect rewards claim interval blocks value") + } else if value != rewardsClaimIntervalTime { + t.Error("Incorrect rewards claim interval time value") } } diff --git a/tests/tokens/rpl_test.go b/tests/tokens/rpl_test.go index c88a8acb..9b2445ca 100644 --- a/tests/tokens/rpl_test.go +++ b/tests/tokens/rpl_test.go @@ -1,17 +1,17 @@ package tokens import ( - "context" - "testing" + "context" + "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common" - "github.com/rocket-pool/rocketpool-go/settings/protocol" - "github.com/rocket-pool/rocketpool-go/tokens" - "github.com/rocket-pool/rocketpool-go/utils/eth" + "github.com/rocket-pool/rocketpool-go/settings/protocol" + "github.com/rocket-pool/rocketpool-go/tokens" + "github.com/rocket-pool/rocketpool-go/utils/eth" - "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" - rplutils "github.com/rocket-pool/rocketpool-go/tests/testutils/tokens/rpl" + "github.com/rocket-pool/rocketpool-go/tests/testutils/evm" + rplutils "github.com/rocket-pool/rocketpool-go/tests/testutils/tokens/rpl" ) @@ -111,17 +111,19 @@ func TestTransferFromRPL(t *testing.T) { func TestMintInflationRPL(t *testing.T) { + var secondsPerBlock uint64 = 12 + // State snapshotting if err := evm.TakeSnapshot(); err != nil { t.Fatal(err) } t.Cleanup(func() { if err := evm.RevertSnapshot(); err != nil { t.Fatal(err) } }) // Set network parameters - if _, err := protocol.BootstrapInflationIntervalBlocks(rp, 5, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } + if _, err := protocol.BootstrapInflationIntervalTime(rp, 5 * secondsPerBlock, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) } // Start RPL inflation if header, err := rp.Client.HeaderByNumber(context.Background(), nil); err != nil { t.Fatal(err) - } else if _, err := protocol.BootstrapInflationStartBlock(rp, header.Number.Uint64() + 2, ownerAccount.GetTransactor()); err != nil { + } else if _, err := protocol.BootstrapInflationStartTime(rp, (header.Number.Uint64() + 2) * secondsPerBlock, ownerAccount.GetTransactor()); err != nil { t.Fatal(err) }