Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
290a13e
Add v11 generate and tests as clones of v9_v10
jshufro Jul 22, 2025
65c5bee
Remove 32 slot limit for attestation inclusion
jshufro Jul 22, 2025
a64b7b2
Convert node data in minipool struct to backref, add megapool info
jshufro Jul 22, 2025
37379bb
calculate megapool scores
jshufro Jul 29, 2025
d62323b
Remove unused test mock function
jshufro Jul 29, 2025
98a26bd
Use legacy + megapool rpl stake for saturn
jshufro Jul 29, 2025
830d1e0
devectorize megapools per node
jshufro Jul 29, 2025
8da0ac1
Add pending voter share to the network details
jshufro Jul 29, 2025
a0f5116
Add active validators in megapools to epsilon
jshufro Jul 29, 2025
ab8de50
Correct megapool scoring
jshufro Jul 29, 2025
d51ecc6
Refactor calculateNodeRewards to return a struct instead of multiple …
jshufro Aug 1, 2025
ade5c84
Add a new ssz rewards type that supports voter share
jshufro Aug 1, 2025
4c8610f
Make commands aware of voter share vs smoothing pool eth
jshufro Aug 1, 2025
b991b48
Calculate voter share
jshufro Aug 1, 2025
e224a9b
Remove unused stub
jshufro Aug 1, 2025
8b256e5
Update sszfile_v2 to support new merkle tree format
jshufro Aug 12, 2025
8b92159
Copy legacy distributor bindings
jshufro Aug 12, 2025
bc58433
Copy rewards event to legacy
jshufro Aug 12, 2025
78d664f
Remove CID from rewards struct, switch to new claims system
jshufro Aug 12, 2025
46784f7
Fix tests
jshufro Aug 12, 2025
9a36d3c
Merge branch 'saturn' into jms/v11
jshufro Sep 2, 2025
aafc29e
Update test merkle root for v11- now includes separate voterShare
jshufro Sep 2, 2025
1358e3e
Fix bugs found under test, update tests
jshufro Sep 4, 2025
77f89a3
Test remaining megapool classes
jshufro Sep 5, 2025
b74ac5a
Add performance file type which includes megapool performance
jshufro Sep 5, 2025
255fea6
Use go 1.25.1
jshufro Sep 5, 2025
1c9da9b
Fix json marshal and test
jshufro Sep 8, 2025
df39ac0
Remove unused parameter
jshufro Sep 8, 2025
e33b5ad
Populate megapool performance
jshufro Sep 8, 2025
65ba8eb
Populate missing parts of performance file
jshufro Sep 8, 2025
5d8901b
Conditionally rename performance file
jshufro Sep 8, 2025
1b70660
Fix tests, don't use voter share to pay bonuses
jshufro Sep 8, 2025
7a88d90
Implement consensus bonus cut-off interval
jshufro Sep 8, 2025
7614e2c
Add devnet v11 interval
0xfornax Sep 15, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.24.5
go-version: 1.25.1
- run: make NO_DOCKER=true release
docker-build:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.24.5
go-version: 1.25.1
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v2.1
version: v2.4

# Optional: working directory, useful for monorepos
# working-directory: ${{ matrix.modules }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.24.5
go-version: 1.25.1
cache-dependency-path: go.work.sum
- run: make test
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ formatters:
- goimports
run:
relative-path-mode: cfg
go: '1.24.5'
go: '1.25.1'
output:
formats:
text:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ docker-prune:
.PHONY: lint
lint:
ifndef NO_DOCKER
docker run -e GOMODCACHE=/go/.cache/pkg/mod -e GOCACHE=/go/.cache/go-build -e GOLANGCI_LINT_CACHE=/go/.cache/golangci-lint --user $(shell id -u):$(shell id -g) --rm -v ~/.cache:/go/.cache -v .:/smartnode --workdir /smartnode/ golangci/golangci-lint:v2.1-alpine golangci-lint fmt --diff
docker run -e GOMODCACHE=/go/.cache/pkg/mod -e GOCACHE=/go/.cache/go-build -e GOLANGCI_LINT_CACHE=/go/.cache/golangci-lint --user $(shell id -u):$(shell id -g) --rm -v ~/.cache:/go/.cache -v .:/smartnode --workdir /smartnode/ golangci/golangci-lint:v2.4-alpine golangci-lint fmt --diff
endif

.PHONY: test
Expand Down
90 changes: 90 additions & 0 deletions bindings/legacy/v1.3.1/rewards/distributor-mainnet.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package rewards

import (
"fmt"
"math/big"
"sync"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/rocket-pool/smartnode/bindings/rocketpool"
)

// Check if the given node has already claimed rewards for the given interval
func IsClaimed(rp *rocketpool.RocketPool, index *big.Int, claimerAddress common.Address, opts *bind.CallOpts) (bool, error) {
rocketDistributorMainnet, err := getRocketDistributorMainnet(rp, opts)
if err != nil {
return false, err
}
isClaimed := new(bool)
if err := rocketDistributorMainnet.Call(opts, isClaimed, "isClaimed", index, claimerAddress); err != nil {
return false, fmt.Errorf("error getting rewards claim status for interval %s, node %s: %w", index.String(), claimerAddress.Hex(), err)
}
return *isClaimed, nil
}

// Get the Merkle root for an interval
func MerkleRoots(rp *rocketpool.RocketPool, interval *big.Int, opts *bind.CallOpts) ([]byte, error) {
rocketDistributorMainnet, err := getRocketDistributorMainnet(rp, opts)
if err != nil {
return nil, err
}
bytes := new([32]byte)
if err := rocketDistributorMainnet.Call(opts, bytes, "merkleRoots", interval); err != nil {
return nil, fmt.Errorf("error getting Merkle root for interval %s: %w", interval.String(), err)
}
return (*bytes)[:], nil
}

// Estimate claim rewards gas
func EstimateClaimGas(rp *rocketpool.RocketPool, address common.Address, indices []*big.Int, amountRPL []*big.Int, amountETH []*big.Int, merkleProofs [][]common.Hash, opts *bind.TransactOpts) (rocketpool.GasInfo, error) {
rocketDistributorMainnet, err := getRocketDistributorMainnet(rp, nil)
if err != nil {
return rocketpool.GasInfo{}, err
}
return rocketDistributorMainnet.GetTransactionGasInfo(opts, "claim", address, indices, amountRPL, amountETH, merkleProofs)
}

// Claim rewards
func Claim(rp *rocketpool.RocketPool, address common.Address, indices []*big.Int, amountRPL []*big.Int, amountETH []*big.Int, merkleProofs [][]common.Hash, opts *bind.TransactOpts) (common.Hash, error) {
rocketDistributorMainnet, err := getRocketDistributorMainnet(rp, nil)
if err != nil {
return common.Hash{}, err
}
tx, err := rocketDistributorMainnet.Transact(opts, "claim", address, indices, amountRPL, amountETH, merkleProofs)
if err != nil {
return common.Hash{}, fmt.Errorf("error claiming rewards: %w", err)
}
return tx.Hash(), nil
}

// Estimate claim and restake rewards gas
func EstimateClaimAndStakeGas(rp *rocketpool.RocketPool, address common.Address, indices []*big.Int, amountRPL []*big.Int, amountETH []*big.Int, merkleProofs [][]common.Hash, stakeAmount *big.Int, opts *bind.TransactOpts) (rocketpool.GasInfo, error) {
rocketDistributorMainnet, err := getRocketDistributorMainnet(rp, nil)
if err != nil {
return rocketpool.GasInfo{}, err
}
return rocketDistributorMainnet.GetTransactionGasInfo(opts, "claimAndStake", address, indices, amountRPL, amountETH, merkleProofs, stakeAmount)
}

// Claim and restake rewards
func ClaimAndStake(rp *rocketpool.RocketPool, address common.Address, indices []*big.Int, amountRPL []*big.Int, amountETH []*big.Int, merkleProofs [][]common.Hash, stakeAmount *big.Int, opts *bind.TransactOpts) (common.Hash, error) {
rocketDistributorMainnet, err := getRocketDistributorMainnet(rp, nil)
if err != nil {
return common.Hash{}, err
}
tx, err := rocketDistributorMainnet.Transact(opts, "claimAndStake", address, indices, amountRPL, amountETH, merkleProofs, stakeAmount)
if err != nil {
return common.Hash{}, fmt.Errorf("error claiming rewards: %w", err)
}
return tx.Hash(), nil
}

// Get contracts
var rocketDistributorMainnetLock sync.Mutex

func getRocketDistributorMainnet(rp *rocketpool.RocketPool, opts *bind.CallOpts) (*rocketpool.Contract, error) {
rocketDistributorMainnetLock.Lock()
defer rocketDistributorMainnetLock.Unlock()
return rp.GetContract("rocketMerkleDistributorMainnet", opts)
}
Loading