Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration Testing setup #92

Closed
wants to merge 95 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
ba3cb79
WIP
batphonghan Jun 9, 2023
7001c89
Config testing
batphonghan Jun 13, 2023
4a87715
Fix path not corect
batphonghan Jun 13, 2023
85acd4e
Fix config path
batphonghan Jun 13, 2023
de669ea
Refactor
batphonghan Jun 13, 2023
500c589
Add action
batphonghan Jun 13, 2023
bf6fe53
Update steps
batphonghan Jun 13, 2023
59820dc
Update go download
batphonghan Jun 13, 2023
7965a80
Fix test failed
batphonghan Jun 13, 2023
0300f9f
Refactor
batphonghan Jun 13, 2023
caee1aa
Config local
batphonghan Jun 14, 2023
39df63d
Config native
batphonghan Jun 14, 2023
1c930ee
Assert node run
batphonghan Jun 14, 2023
d6ab0af
Update contract
batphonghan Jun 14, 2023
397bb22
Deploy staderconfig
batphonghan Jun 14, 2023
2f3cbc0
Update contract address
batphonghan Jun 14, 2023
e203f3c
Deploys contracts
batphonghan Jun 15, 2023
53c4d82
WIP
batphonghan Jun 16, 2023
f78f32f
WIP
batphonghan Jun 16, 2023
0534c2d
WIP
batphonghan Jun 17, 2023
fb321d6
Update contract code
batphonghan Jun 19, 2023
b303bd0
WIP
batphonghan Jun 19, 2023
0d6db0f
Update URL
batphonghan Jun 19, 2023
ed93106
Add http test server
batphonghan Jun 19, 2023
3e876ce
Update package
batphonghan Jun 19, 2023
503c871
Update API
batphonghan Jun 20, 2023
0e68462
Config anvil
batphonghan Jun 20, 2023
ff8a936
add scripts
batphonghan Jun 20, 2023
951bc36
Refactor
batphonghan Jun 20, 2023
6016f14
Update CLI
batphonghan Jun 20, 2023
0a529b7
Put back config
batphonghan Jun 20, 2023
88b7bfe
Fix build
batphonghan Jun 20, 2023
387c5a8
Refactor
batphonghan Jun 20, 2023
0acfc06
Update ec
batphonghan Jun 20, 2023
c6a1546
Refactor
batphonghan Jun 20, 2023
45c3a82
Refactor
batphonghan Jun 21, 2023
8239bda
Fix test failed
batphonghan Jun 21, 2023
501ce4d
Refactor
batphonghan Jun 21, 2023
be95fe8
Refactor
batphonghan Jun 22, 2023
081851f
Generate key
batphonghan Jun 22, 2023
4f23228
Fix encode in http-test
batphonghan Jun 22, 2023
d327733
Update kurtorsis
batphonghan Jun 22, 2023
cde28f4
Update deps
batphonghan Jun 22, 2023
5ce6889
Put some log
batphonghan Jun 22, 2023
f9fb6f9
Refactor
batphonghan Jun 22, 2023
ecece9c
Update IP
batphonghan Jun 22, 2023
d3a1a90
Run anvil as container test
batphonghan Jun 23, 2023
32ec495
Update CURL
batphonghan Jun 23, 2023
5fa3663
Update config
batphonghan Jun 23, 2023
2b790f2
Update gas params
batphonghan Jun 23, 2023
02c1612
Remove test not used
batphonghan Jun 25, 2023
d720814
Refactor
batphonghan Jun 25, 2023
8676a6d
Refactor
batphonghan Jun 25, 2023
b3360fe
Update time
batphonghan Jun 25, 2023
83736eb
Wait a bit
batphonghan Jun 25, 2023
cbb704e
Update
batphonghan Jun 25, 2023
8256de1
Merge remote-tracking branch 'origin/main' into testing
batphonghan Jun 25, 2023
96c16e2
Refactor
batphonghan Jun 25, 2023
930d002
Remove unused
batphonghan Jun 25, 2023
639c536
Remove salt
batphonghan Jun 25, 2023
2cb8706
Ingnore check in localtestnet
batphonghan Jun 25, 2023
54e498d
Run some more time
batphonghan Jun 25, 2023
a5a3463
Update resp type
batphonghan Jun 26, 2023
b820b8d
Update response map
batphonghan Jun 26, 2023
99f4487
Fix panic
batphonghan Jun 26, 2023
eb8ac28
Update data
batphonghan Jun 26, 2023
8d97cfb
Reduce runtime
batphonghan Jun 26, 2023
102dceb
Verify sig
batphonghan Jun 27, 2023
c7cf4b0
Get client
batphonghan Jun 27, 2023
5f361af
Inject client
batphonghan Jun 27, 2023
ad991a7
Fix build
batphonghan Jun 27, 2023
62da3b7
Put some logs
batphonghan Jun 27, 2023
d43df97
Update update localtestnet
batphonghan Jun 27, 2023
e9619d3
Fix verify
batphonghan Jun 27, 2023
40c9596
Merge remote-tracking branch 'origin/main' into testing
batphonghan Jun 28, 2023
c89f4fe
Update new flow
batphonghan Jun 28, 2023
485204c
Fix test failed
batphonghan Jun 28, 2023
24559d6
Remove hardcode
batphonghan Jun 28, 2023
959f60c
Fix test stall
batphonghan Jun 28, 2023
579b503
Refresh wallet index
batphonghan Jun 28, 2023
a1ba1b1
Fix test failed
batphonghan Jun 28, 2023
8b7e3b7
Update time
batphonghan Jun 28, 2023
6d92ca9
Ignore reload
batphonghan Jun 28, 2023
10c019c
WIP
batphonghan Jun 29, 2023
ba694dc
Config to sent presign mainnet message
batphonghan Jun 29, 2023
1f757f5
Merge remote-tracking branch 'origin/main' into testing
batphonghan Jun 29, 2023
ef4b4a2
Revert "Config to sent presign mainnet message"
batphonghan Jul 3, 2023
4c63d3c
Remove hardcode URL
batphonghan Jul 3, 2023
fb0cb89
Merge remote-tracking branch 'origin/main' into testing
batphonghan Jul 3, 2023
c5b8a4a
Refactor
batphonghan Jul 3, 2023
f2f517d
Add Golangci
batphonghan Jul 3, 2023
cd9579d
Revert "Add Golangci"
batphonghan Jul 3, 2023
d49cbd8
Merge remote-tracking branch 'upstream/main' into testing
batphonghan Jul 5, 2023
76728db
Fix test failed
batphonghan Jul 5, 2023
ae78d16
Refactor name
batphonghan Jul 5, 2023
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
28 changes: 28 additions & 0 deletions .github/workflows/go_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Go_test
on: [push]

jobs:
build:
runs-on: ubuntu-latest
services:
dind:
image: docker:23.0-rc-dind-rootless
ports:
- 2375:2375
steps:
- name: Install and start kurtosis
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli
kurtosis engine restart

- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.19.x"
- name: Install dependencies
run: go mod download all
- name: Test with the Go CLI
run: go test ./... -v
23 changes: 15 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,32 @@ module github.com/stader-labs/stader-node
go 1.16

require (
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/a8m/envsubst v1.3.0
github.com/alessio/shellescape v1.4.1
github.com/blang/semver/v4 v4.0.0
github.com/btcsuite/btcd v0.23.1
github.com/btcsuite/btcd/btcutil v1.1.2
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v23.0.3+incompatible
github.com/docker/go-connections v0.4.0 // indirect
github.com/dustin/go-humanize v1.0.0
github.com/ethereum/go-ethereum v1.10.26
github.com/fatih/color v1.13.0
github.com/ferranbt/fastssz v0.1.2
github.com/glendc/go-external-ip v0.1.0
github.com/google/uuid v1.3.0
github.com/herumi/bls-eth-go-binary v1.28.1 // indirect
github.com/herumi/bls-eth-go-binary v1.28.1
github.com/imdario/mergo v0.3.13
github.com/klauspost/cpuid/v2 v2.1.1
github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20230411133558-b983d9bebe4f // indirect
github.com/kurtosis-tech/kurtosis/api/golang v0.80.4
github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20230609162710-10b6b91dc9e8 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/ory/dockertest/v3 v3.10.0
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
github.com/prometheus/client_golang v1.13.0
github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7
Expand All @@ -35,19 +38,23 @@ require (
github.com/shirou/gopsutil/v3 v3.23.1
github.com/stader-labs/ethcli-ui/configuration v0.0.0-20230619122118-1d15353af546
github.com/stader-labs/ethcli-ui/wizard v0.0.0-20230619122118-1d15353af546
github.com/stretchr/testify v1.8.4
github.com/tyler-smith/go-bip39 v1.1.0
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/urfave/cli v1.22.10
github.com/wealdtech/go-eth2-types/v2 v2.7.0
github.com/wealdtech/go-eth2-util v1.7.0
github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.3.0
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.7.0
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.1.0
golang.org/x/term v0.9.0
golang.org/x/term v0.8.0
golang.org/x/text v0.10.0 // indirect
google.golang.org/grpc v1.49.0 // indirect
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
gopkg.in/yaml.v2 v2.4.0
gotest.tools/v3 v3.3.0 // indirect
)

replace github.com/rivo/tview => github.com/hamidraza/tview v1.0.0
1,140 changes: 1,105 additions & 35 deletions go.sum

Large diffs are not rendered by default.

21 changes: 20 additions & 1 deletion shared/services/bc-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ import (
)

// This is a proxy for multiple Beacon clients, providing natural fallback support if one of them fails.

type BeaconClientManager struct {
primaryBc beacon.Client
fallbackBc beacon.Client
logger log.ColorLogger
primaryReady bool
fallbackReady bool
ignoreSyncCheck bool

//SAFETY: This flag using in local test only, never set to true in prod
localTestnet bool
}

// This is a signature for a wrapped Beacon client function that only returns an error
Expand Down Expand Up @@ -201,7 +205,18 @@ func (m *BeaconClientManager) GetValidatorStatusByIndex(index string, opts *beac
}

// Get a validator's status by its pubkey
func (m *BeaconClientManager) GetValidatorStatus(pubkey types.ValidatorPubkey, opts *beacon.ValidatorStatusOptions) (beacon.ValidatorStatus, error) {
func (m *BeaconClientManager) GetValidatorStatus(
pubkey types.ValidatorPubkey,
opts *beacon.ValidatorStatusOptions,
) (beacon.ValidatorStatus, error) {
//SAFETY: This flag is true in local test only
if m.localTestnet {
return beacon.ValidatorStatus{
Exists: true,
Status: beacon.ValidatorState_PendingInitialized,
}, nil
}

result, err := m.runFunction1(func(client beacon.Client) (interface{}, error) {
return client.GetValidatorStatus(pubkey, opts)
})
Expand Down Expand Up @@ -304,6 +319,10 @@ func (m *BeaconClientManager) GetCommitteesForEpoch(epoch *uint64) ([]beacon.Com
return result.([]beacon.Committee), nil
}

func (m *BeaconClientManager) IsLocalTestnet() bool {
return m.localTestnet
}

/// ==================
/// Internal Functions
/// ==================
Expand Down
1 change: 1 addition & 0 deletions shared/services/config/besu-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func NewBesuConfig(cfg *StaderConfig) *BesuConfig {
config.Network_Prater: besuTagTest,
config.Network_Devnet: besuTagTest,
config.Network_Zhejiang: besuTagTest,
config.Network_Local: besuTagTest,
},
AffectsContainers: []config.ContainerID{config.ContainerID_Eth1},
EnvironmentVariables: []string{"EC_CONTAINER_TAG"},
Expand Down
4 changes: 4 additions & 0 deletions shared/services/config/external-configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ func NewExternalLighthouseConfig(cfg *StaderConfig) *ExternalLighthouseConfig {
config.Network_Prater: getLighthouseTagTest(),
config.Network_Devnet: getLighthouseTagTest(),
config.Network_Zhejiang: getLighthouseTagTest(),
config.Network_Local: getLighthouseTagTest(),
},
AffectsContainers: []config.ContainerID{config.ContainerID_Validator},
EnvironmentVariables: []string{"VC_CONTAINER_TAG"},
Expand Down Expand Up @@ -282,6 +283,7 @@ func NewExternalPrysmConfig(cfg *StaderConfig) *ExternalPrysmConfig {
config.Network_Prater: getPrysmVcTestTag(),
config.Network_Devnet: getPrysmVcTestTag(),
config.Network_Zhejiang: getLighthouseTagTest(),
config.Network_Local: getLighthouseTagTest(),
},
AffectsContainers: []config.ContainerID{config.ContainerID_Validator},
EnvironmentVariables: []string{"VC_CONTAINER_TAG"},
Expand Down Expand Up @@ -356,6 +358,7 @@ func NewExternalNimbusConfig(cfg *StaderConfig) *ExternalNimbusConfig {
config.Network_Prater: nimbusVcTagTest,
config.Network_Devnet: nimbusVcTagTest,
config.Network_Zhejiang: nimbusVcTagTest,
config.Network_Local: nimbusVcTagTest,
},
AffectsContainers: []config.ContainerID{config.ContainerID_Validator},
EnvironmentVariables: []string{"VC_CONTAINER_TAG"},
Expand Down Expand Up @@ -417,6 +420,7 @@ func NewExternalTekuConfig(cfg *StaderConfig) *ExternalTekuConfig {
config.Network_Prater: tekuTagTest,
config.Network_Devnet: tekuTagTest,
config.Network_Zhejiang: tekuTagTest,
config.Network_Local: tekuTagTest,
},
AffectsContainers: []config.ContainerID{config.ContainerID_Validator},
EnvironmentVariables: []string{"VC_CONTAINER_TAG"},
Expand Down
1 change: 1 addition & 0 deletions shared/services/config/geth-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func NewGethConfig(cfg *StaderConfig) *GethConfig {
config.Network_Prater: gethTagTest,
config.Network_Devnet: gethTagTest,
config.Network_Zhejiang: gethTagTest,
config.Network_Local: gethTagTest,
},
AffectsContainers: []config.ContainerID{config.ContainerID_Eth1},
EnvironmentVariables: []string{"EC_CONTAINER_TAG"},
Expand Down
1 change: 1 addition & 0 deletions shared/services/config/lighthouse-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func NewLighthouseConfig(cfg *StaderConfig) *LighthouseConfig {
config.Network_Prater: getLighthouseTagTest(),
config.Network_Devnet: getLighthouseTagTest(),
config.Network_Zhejiang: getLighthouseTagTest(),
config.Network_Local: getLighthouseTagTest(),
},
AffectsContainers: []config.ContainerID{config.ContainerID_Eth2, config.ContainerID_Validator},
EnvironmentVariables: []string{"BN_CONTAINER_TAG", "VC_CONTAINER_TAG"},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUNJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBZzhBTUlJQ0NnS0NBZ0VBdkJYVm5iWit0QWMzQy81eWpsQ2oKdnhXN3UwVEpTNjBPN3hjeHB1TEE0OUdhM0xYT0V4UG9wY1RhU3U1MTRkSkFYOC9Bdm5XZEtwQ29hL2x0V05wQgplNzk1eXRYNU53eGFiV3kvd2Y4ZG04ZEJBZ2lMUGhNdGZwTXd5eThNS1QwOXhkcU1oRENPQ3BwcG51a1Q5UU5KClVyMGlkV2tNU3FTQnM4Tm8yMjlCTG1CWVFTbWJlV3Y0QmRDK3lEL0ZicUVoSXdDL2ZrVy9Nc210dE9WU1RScksKMzhHcm85SmVWVGhBMUpyTXIzUWgyMzJOejhmNzRHbG5qb2ZUVmhjNzVOd00xcWgvV1lPb1N0ZjVobnJ5K1dvSgpieURpb2tpRm9YS1BPcy83NDNkdDJWQWllZTdFd0JDOTZzKzhoSnNLTW5hZzYyUFRtRDQwS212V1Z1aU9UTngxCmNhWG1RNzQ2eVJkaHVubU8wMjNJb3JaRGsrVTZTQStwcmpXaFE5c1oxWWw5NFA5NklBZzFvV2VtQmZLb3lHYWIKZG9ndTdRU0QyRit1cHJ0TEFOYks4TlhVL1pUT2l5MUtBd01tWjVYaWdDODRySUFaeEo2RUo5M0hheDZRM2hIagpBM0grUGdqTzFYSVdPL1hybmh0SWFoM2J6c2N6U2RJMkRMOHFyaWNnOThxY3FlbnVyYWh1dW5SVEFiKzR0M1B1CmNEclVXZVFYa3I1eFVESEQxTHpEeDlvSjI1TmdJVFA2dmtMei9xTjVpZ3BTMnQ1c285d24yWHdlZVZSWC9zRnYKNlpDc1ZOUkhGOS92UHpQcWRJR210OS9NZUZRd2xHSnNURENMLzExWjFQc01iNGpYZlpMNnMvb2xDekVtbVVjTwpTVXpncUNJSXF5UDhwVkJQQ0MwdzkzOENBd0VBQVE9PQotLS0tLUVORCBSU0EgUFVCTElDIEtFWS0tLS0tCg==
2 changes: 2 additions & 0 deletions shared/services/config/mev-boost-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ func createDefaultRelays() []config.MevRelay {
config.Network_Mainnet: "https://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@boost-relay.flashbots.net?id=staderlabs",
config.Network_Prater: "https://0xafa4c6985aa049fb79dd37010438cfebeb0f2bd42b115b89dd678dab0670c1de38da0c4e9138c9290a398ecd9a0b3110@builder-relay-goerli.flashbots.net?id=staderlabs",
config.Network_Devnet: "https://0xafa4c6985aa049fb79dd37010438cfebeb0f2bd42b115b89dd678dab0670c1de38da0c4e9138c9290a398ecd9a0b3110@builder-relay-goerli.flashbots.net?id=staderlabs",
config.Network_Local: "",
},
Regulated: true,
NoSandwiching: false,
Expand Down Expand Up @@ -568,6 +569,7 @@ func generateProfileParameter(id string, relays []config.MevRelay, regulated boo
DescriptionsByNetwork: map[config.Network]string{
config.Network_Mainnet: mainnetDescription,
config.Network_Prater: praterDescription,
config.Network_Local: praterDescription,
},
}
}
Expand Down
1 change: 1 addition & 0 deletions shared/services/config/nethermind-params.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ func NewNethermindConfig(cfg *StaderConfig) *NethermindConfig {
config.Network_Prater: nethermindTagTest,
config.Network_Devnet: nethermindTagTest,
config.Network_Zhejiang: nethermindTagTest,
config.Network_Local: nethermindTagTest,
},
AffectsContainers: []config.ContainerID{config.ContainerID_Eth1},
EnvironmentVariables: []string{"EC_CONTAINER_TAG"},
Expand Down
2 changes: 2 additions & 0 deletions shared/services/config/nimbus-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func NewNimbusConfig(cfg *StaderConfig) *NimbusConfig {
config.Network_Prater: nimbusBnTagTest,
config.Network_Devnet: nimbusBnTagTest,
config.Network_Zhejiang: nimbusBnTagTest,
config.Network_Local: nimbusBnTagTest,
},
AffectsContainers: []config.ContainerID{config.ContainerID_Eth2},
EnvironmentVariables: []string{"BN_CONTAINER_TAG"},
Expand All @@ -108,6 +109,7 @@ func NewNimbusConfig(cfg *StaderConfig) *NimbusConfig {
config.Network_Prater: nimbusVcTagTest,
config.Network_Devnet: nimbusVcTagTest,
config.Network_Zhejiang: nimbusVcTagTest,
config.Network_Local: nimbusVcTagTest,
},
AffectsContainers: []config.ContainerID{config.ContainerID_Validator},
EnvironmentVariables: []string{"VC_CONTAINER_TAG"},
Expand Down
2 changes: 2 additions & 0 deletions shared/services/config/prysm-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func NewPrysmConfig(cfg *StaderConfig) *PrysmConfig {
config.Network_Prater: getPrysmBnTestTag(),
config.Network_Devnet: getPrysmBnTestTag(),
config.Network_Zhejiang: getPrysmBnTestTag(),
config.Network_Local: getPrysmBnTestTag(),
},
AffectsContainers: []config.ContainerID{config.ContainerID_Eth2},
EnvironmentVariables: []string{"BN_CONTAINER_TAG"},
Expand All @@ -137,6 +138,7 @@ func NewPrysmConfig(cfg *StaderConfig) *PrysmConfig {
config.Network_Prater: getPrysmVcTestTag(),
config.Network_Devnet: getPrysmVcTestTag(),
config.Network_Zhejiang: getPrysmVcTestTag(),
config.Network_Local: getPrysmVcTestTag(),
},
AffectsContainers: []config.ContainerID{config.ContainerID_Validator},
EnvironmentVariables: []string{"VC_CONTAINER_TAG"},
Expand Down
14 changes: 13 additions & 1 deletion shared/services/config/stadernode-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ var stageEncryptionKey string
//go:embed dev-presign-public-key.txt
var devEncryptionKey string

// SAFETY: This file using in local test only.
//
//go:embed local-testnet-presign-public-key.txt
var localTestnetEncryptionKey string

// --ignore-sync-check
// Defaults
const defaultProjectName string = "stader"
Expand Down Expand Up @@ -235,6 +240,7 @@ func NewStadernodeConfig(cfg *StaderConfig) *StaderNodeConfig {
config.Network_Mainnet: "https://beaconcha.in",
config.Network_Prater: "https://prater.beaconcha.in",
config.Network_Devnet: "https://prater.beaconcha.in",
config.Network_Local: "https://prater.beaconcha.in",
},

txWatchUrl: map[config.Network]string{
Expand All @@ -248,34 +254,39 @@ func NewStadernodeConfig(cfg *StaderConfig) *StaderNodeConfig {
config.Network_Prater: 5, // Goerli
config.Network_Devnet: 5, // Also goerli
config.Network_Zhejiang: 1337803, // Zhejiang
config.Network_Local: 31337, // Local testnet
},

ethxTokenAddress: map[config.Network]string{
config.Network_Prater: "0x3338eCd3ab3d3503c55c931d759fA6d78d287236",
config.Network_Devnet: "0x38DE8Df722B4032Cc6987F00bCA0d9B37d9F9438",
config.Network_Mainnet: "0xA35b1B31Ce002FBF2058D22F30f95D405200A15b",
config.Network_Zhejiang: "0x90Da3CA75532A17ca38440a32595F036ecE46E85",
config.Network_Local: "0xA15BB66138824a1c7167f5E85b957d04Dd34E468",
},

staderConfigAddress: map[config.Network]string{
config.Network_Prater: "0x2aa6cEd8Cf0a93884216BaE5dbF4299932aB577B",
config.Network_Devnet: "0x749Ed651c4F41E0D705960e815A58815ffFd3afe",
config.Network_Mainnet: "0x4ABEF2263d5A5ED582FC9A9789a41D85b68d69DB",
config.Network_Zhejiang: "0x90Da3CA75532A17ca38440a32595F036ecE46E85",
config.Network_Local: "0x700b6A60ce7EaaEA56F065753d8dcB9653dbAD35",
},

baseStaderBackendUrl: map[config.Network]string{
config.Network_Prater: "https://ethx-offchain-preprod.staderlabs.com",
config.Network_Devnet: "https://stage-ethx-offchain.staderlabs.click",
config.Network_Mainnet: "https://ethx-offchain.staderlabs.com",
config.Network_Zhejiang: "0x90Da3CA75532A17ca38440a32595F036ecE46E85",
config.Network_Local: "http://localhost:9989",
},

preSignEncryptionKey: map[config.Network]string{
config.Network_Prater: stageEncryptionKey,
config.Network_Devnet: devEncryptionKey,
config.Network_Mainnet: prodEncryptionKey,
config.Network_Zhejiang: stageEncryptionKey,
config.Network_Local: localTestnetEncryptionKey,
},
}
}
Expand Down Expand Up @@ -454,11 +465,12 @@ func (cfg *StaderNodeConfig) GetSpRewardCyclePath(cycle int64, daemon bool) stri
}

func (cfg *StaderNodeConfig) GetFeeRecipientFilePath() string {
if !cfg.parent.IsNativeMode {
if cfg.parent != nil && !cfg.parent.IsNativeMode {
return filepath.Join(DaemonDataPath, "validators", FeeRecipientFilename)
}

return filepath.Join(cfg.DataPath.Value.(string), "validators", NativeFeeRecipientFilename)

}

func (cfg *StaderNodeConfig) GetClaimData(cycles []*big.Int) ([]*big.Int, []*big.Int, [][][32]byte, error) {
Expand Down
1 change: 1 addition & 0 deletions shared/services/config/teku-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func NewTekuConfig(cfg *StaderConfig) *TekuConfig {
config.Network_Prater: tekuTagTest,
config.Network_Devnet: tekuTagTest,
config.Network_Zhejiang: tekuTagTest,
config.Network_Local: tekuTagTest,
},
AffectsContainers: []config.ContainerID{config.ContainerID_Eth2, config.ContainerID_Validator},
EnvironmentVariables: []string{"BN_CONTAINER_TAG", "VC_CONTAINER_TAG"},
Expand Down
4 changes: 2 additions & 2 deletions shared/services/gas/gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func handleEtherchainGasPrices(gasSuggestion etherchain.GasFeeSuggestion, gasInf

desiredPriceFloat, err := strconv.ParseFloat(desiredPrice, 64)
if err != nil {
fmt.Printf("Not a valid gas price (%s), try again.", err.Error())
fmt.Printf("Not a valid gas price (%+v), try again. \n", err.Error())
continue
}
if desiredPriceFloat <= 0 {
Expand Down Expand Up @@ -298,7 +298,7 @@ func handleEtherscanGasPrices(gasSuggestion etherscan.GasFeeSuggestion, gasInfo

desiredPriceFloat, err := strconv.ParseFloat(desiredPrice, 64)
if err != nil {
fmt.Println("Not a valid gas price (%s), try again.", err.Error())
fmt.Printf("Not a valid gas price (%s), try again.\n", err.Error())
continue
}
if desiredPriceFloat <= 0 {
Expand Down
10 changes: 8 additions & 2 deletions shared/services/requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ import (
"context"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/common"
"log"
"math/big"
"sync"
"time"

"github.com/ethereum/go-ethereum/common"

"github.com/stader-labs/stader-node/shared/services/config"
"github.com/stader-labs/stader-node/stader-lib/node"
"github.com/stader-labs/stader-node/stader-lib/stader"
Expand Down Expand Up @@ -175,8 +176,13 @@ func WaitNodeRegistered(c *cli.Context, operatorAddress common.Address, verbose
}
operatorId, err := node.GetOperatorId(pnr, operatorAddress, nil)
if err != nil {
if verbose {
log.Printf("The node is not registered with Stader, retrying in %s...\n", checkNodeRegisteredInterval.String())
}
time.Sleep(checkNodeRegisteredInterval)
return err
}

if operatorId.Cmp(big.NewInt(0)) != 0 {
return nil
}
Expand Down Expand Up @@ -498,7 +504,7 @@ func waitBeaconClientSynced(c *cli.Context, verbose bool, timeout int64) (bool,
// Check sync status
if syncStatus.Syncing {
if verbose {
log.Println("Eth 2.0 node syncing: %.2f%%\n", syncStatus.Progress*100)
log.Printf("Eth 2.0 node syncing: %.2f%% \n", syncStatus.Progress*100)
}
} else {
return true, nil
Expand Down
Loading
Loading