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
47 changes: 0 additions & 47 deletions .github/workflows/golangci-lint.yml

This file was deleted.

32 changes: 29 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
go-version: 1.24.2
- uses: arduino/setup-protoc@v3
- run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.6
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
- run: |
make
# run the tests and create a coverage report
Expand All @@ -46,6 +46,32 @@ jobs:
if-no-files-found: error
include-hidden-files: true
id: html-upload-step
- name: golangci-lint
uses: golangci/golangci-lint-action@v7
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: latest

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true


outputs:
artifact-url: ${{ steps.html-upload-step.outputs.artifact-url }}

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ rescue-proxy

# Dependency directories (remove the comment below to include it)
# vendor/

executionlayer/dataprovider/abis/*_encoding.go
pb/
52 changes: 41 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,61 @@
VERSION = v2.1.1
VERSION = v3.0.0

ABIGEN_CMD := go run github.com/ethereum/go-ethereum/cmd/abigen@v1.16.1 --v2

SOURCEDIR := .
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
PROTO_IN := proto
PROTO_OUT := pb
PROTOS := $(PROTO_OUT)/api.pb.go $(PROTO_OUT)/api_grpc.pb.go
PROTO_DEPS := $(wildcard $(PROTO_IN)/*.proto)

MULTICALL_ABI_DIR := executionlayer/dataprovider/abis
MULTICALL_ABI_JSON_DIR := $(MULTICALL_ABI_DIR)/json
ABI_ENCODINGS = $(MULTICALL_ABI_DIR)/multicall_encoding.go \
$(MULTICALL_ABI_DIR)/rocketstorage_encoding.go \
$(MULTICALL_ABI_DIR)/rocketnodemanager_encoding.go \
$(MULTICALL_ABI_DIR)/rocketnodedistributorfactory_encoding.go \
$(MULTICALL_ABI_DIR)/rocketminipoolmanager_encoding.go \
$(MULTICALL_ABI_DIR)/rocketdaonodetrusted_encoding.go \
$(MULTICALL_ABI_DIR)/eip1271_encoding.go \
$(MULTICALL_ABI_DIR)/vaultsregistry_encoding.go \
$(MULTICALL_ABI_DIR)/ethprivvault_encoding.go

.PHONY: all
all: protos
all: $(PROTOS) $(ABI_ENCODINGS)
go build .

.PHONY: protos
protos: $(PROTO_DEPS)
executionlayer/dataprovider/abis/multicall_encoding.go: $(MULTICALL_ABI_JSON_DIR)/multicall_abi.json
$(ABIGEN_CMD) --abi $< --pkg abis --type Multicall3 --out $@
executionlayer/dataprovider/abis/rocketstorage_encoding.go: $(MULTICALL_ABI_JSON_DIR)/rocketstorage_abi.json
$(ABIGEN_CMD) --abi $< --pkg abis --type RocketStorage --out $@
executionlayer/dataprovider/abis/rocketnodemanager_encoding.go: $(MULTICALL_ABI_JSON_DIR)/rocketnodemanager_abi.json
$(ABIGEN_CMD) --abi $< --pkg abis --type RocketNodeManager --out $@
executionlayer/dataprovider/abis/rocketnodedistributorfactory_encoding.go: $(MULTICALL_ABI_JSON_DIR)/rocketnodedistributorfactory_abi.json
$(ABIGEN_CMD) --abi $< --pkg abis --type RocketNodeDistributorFactory --out $@
executionlayer/dataprovider/abis/rocketminipoolmanager_encoding.go: $(MULTICALL_ABI_JSON_DIR)/rocketminipoolmanager_abi.json
$(ABIGEN_CMD) --abi $< --pkg abis --type RocketMinipoolManager --out $@
executionlayer/dataprovider/abis/rocketdaonodetrusted_encoding.go: $(MULTICALL_ABI_JSON_DIR)/rocketdaonodetrusted_abi.json
$(ABIGEN_CMD) --abi $< --pkg abis --type RocketDaoNodeTrusted --out $@
executionlayer/dataprovider/abis/eip1271_encoding.go: $(MULTICALL_ABI_JSON_DIR)/eip1271_abi.json
$(ABIGEN_CMD) --abi $< --pkg abis --type EIP1271 --out $@
executionlayer/dataprovider/abis/vaultsregistry_encoding.go: $(MULTICALL_ABI_JSON_DIR)/vaults-registry.json
$(ABIGEN_CMD) --abi $< --pkg abis --type VaultsRegistry --out $@
executionlayer/dataprovider/abis/ethprivvault_encoding.go: $(MULTICALL_ABI_JSON_DIR)/eth-priv-vault.json
$(ABIGEN_CMD) --abi $< --pkg abis --type EthPrivVault --out $@

$(PROTO_OUT):
mkdir -p $@

$(PROTOS): $(PROTO_DEPS) $(PROTO_OUT)
protoc -I=./$(PROTO_IN) --go_out=paths=source_relative:$(PROTO_OUT) \
--go-grpc_out=paths=source_relative:$(PROTO_OUT) $(PROTO_DEPS)

SW_DIR := executionlayer/stakewise
ABI_DIR := $(SW_DIR)/abis
$(SW_DIR)/vaults-registry-encoding.go: $(ABI_DIR)/vaults-registry.json
go run github.com/ethereum/go-ethereum/cmd/abigen@v1.15.11 --v2 --abi $< --pkg stakewise --type vaultsRegistry --out $@
$(SW_DIR)/eth-priv-vault-encoding.go: $(ABI_DIR)/eth-priv-vault.json
go run github.com/ethereum/go-ethereum/cmd/abigen@v1.15.11 --v2 --abi $< --pkg stakewise --type ethPrivVault --out $@

.PHONY: clean
clean:
rm -f pb/*
rm -f api-client
rm -f $(ABI_ENCODINGS)

.PHONY: docker
docker: all
Expand Down
37 changes: 22 additions & 15 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import (
"net/url"
"os"
"strings"
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
)

Expand Down Expand Up @@ -38,22 +40,25 @@ func (c *CredentialSecrets) Set(arg string) error {
return nil
}

var Multicall3Address = common.HexToAddress("0xcA11bde05977b3631167028862bE2a173976CA11")

type Config struct {
BeaconURL *url.URL
ExecutionURL *url.URL
ListenAddr string
APIListenAddr string
AdminListenAddr string
GRPCListenAddr string
GRPCBeaconAddr string
GRPCTLSCertFile string
GRPCTLSKeyFile string
RocketStorageAddr string
SWVaultsRegistryAddr string
CredentialSecrets CredentialSecrets
EnableSoloValidators bool
Debug bool
ForceBNJSON bool
BeaconURL *url.URL
ExecutionURL *url.URL
ListenAddr string
APIListenAddr string
AdminListenAddr string
GRPCListenAddr string
GRPCBeaconAddr string
GRPCTLSCertFile string
GRPCTLSKeyFile string
RocketStorageAddr string
SWVaultsRegistryAddr string
CredentialSecrets CredentialSecrets
EnableSoloValidators bool
Debug bool
ForceBNJSON bool
ExecutionRefreshInterval time.Duration
}

func InitFlags() *Config {
Expand Down Expand Up @@ -81,6 +86,7 @@ Use 'dd if=/dev/urandom bs=4 count=8 | base64' if you need to generate a new sec
enableSoloValidatorsFlag := flag.Bool("enable-solo-validators", true, "Whether or not to allow solo validators access.")
forceBNJSONFlag := flag.Bool("force-bn-json", false, "Disables SSZ in the BN.")
swiseVaultsRegistryAddrFlag := flag.String("swise-vaults-registry-addr", "0x3a0008a588772446f6e656133C2D5029CC4FC20E", "Address of the Stakewise Vaults Registry contract. Defaults to mainnet. Pass empty string to disable.")
executionRefreshInterval := flag.Duration("execution-refresh-interval", 32*12*time.Second, "Interval at which to refresh the execution layer cache. Defaults to once per epoch.")

flag.Parse()

Expand Down Expand Up @@ -173,5 +179,6 @@ Use 'dd if=/dev/urandom bs=4 count=8 | base64' if you need to generate a new sec
config.Debug = *debug
config.ForceBNJSON = *forceBNJSONFlag
config.SWVaultsRegistryAddr = *swiseVaultsRegistryAddrFlag
config.ExecutionRefreshInterval = *executionRefreshInterval
return config
}
11 changes: 3 additions & 8 deletions executionlayer/cache.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package executionlayer

import (
"math/big"

"github.com/Rocket-Rescue-Node/rescue-proxy/executionlayer/dataprovider"
"github.com/ethereum/go-ethereum/common"
rptypes "github.com/rocket-pool/smartnode/bindings/types"
)
Expand All @@ -17,14 +16,10 @@ type Cache interface {
init() error
getMinipoolNode(rptypes.ValidatorPubkey) (common.Address, error)
addMinipoolNode(rptypes.ValidatorPubkey, common.Address) error
getNodeInfo(common.Address) (*nodeInfo, error)
addNodeInfo(common.Address, *nodeInfo) error
getNodeInfo(common.Address) (*dataprovider.NodeInfo, error)
addNodeInfo(common.Address, *dataprovider.NodeInfo) error
forEachNode(ForEachNodeClosure) error
addOdaoNode(common.Address) error
removeOdaoNode(common.Address) error
forEachOdaoNode(ForEachNodeClosure) error
setHighestBlock(*big.Int)
getHighestBlock() *big.Int
deinit() error
reset() error
}
22 changes: 22 additions & 0 deletions executionlayer/dataprovider/abis/json/eip1271_abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"inputs": [
{
"name": "_hash",
"type": "bytes32"
},
{
"name": "_signature",
"type": "bytes"
}
],
"name": "isValidSignature",
"outputs": [
{
"type": "bytes4"
}
],
"stateMutability": "view",
"type": "function"
}
]
Loading
Loading