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

tests: Valid tests for Lido mainnet setup #467

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion cli/lidoStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,13 @@ func buildLidoData(node *lidoData) map[string]struct {
var nodeOpDetailed, keysDetailed, queueDetailed, bondDetailed, rewardsDetailed string
var currentBond, requiredBond, excessBond, missedBond, rewards decimal.Decimal
rewardAddressLink := fmt.Sprintf(`https://etherscan.io/address/%s`, node.nodeInfo.RewardAddress)
claimRewardsLink := fmt.Sprintf(`https://%s.etherscan.io/address/%s#writeProxyContract#F10`, networkName, contracts.DeployedAddresses(contracts.CSModule)[networkName])
var prefix string
if networkName == "mainnet" {
prefix = ""
} else {
prefix = networkName + "."
}
claimRewardsLink := fmt.Sprintf(`https://%setherscan.io/address/%s#writeProxyContract#F10`, prefix, contracts.DeployedAddresses(contracts.CSModule)[networkName])

detailedDescriptions := map[string]string{
nodeOpInfo: `
Expand Down
38 changes: 19 additions & 19 deletions cli/lidoStatus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,25 +137,25 @@ func TestLidoStatusCmd(t *testing.T) {
},
isErr: true,
},
// {
// name: "Valid node ID, Mainnet",
// flags: flags{
// rewardAddress: "0xe6b5A31d8bb53D2C769864aC137fe25F4989f1fd", // rewardAddress should be ignored
// networkName: "mainnet",
// nodeIDInt: 1,
// },
// isErr: false,
// },
// {
// name: "Valid node ID with long description, Mainnet",
// flags: flags{
// rewardAddress: "0xe6b5A31d8bb53D2C769864aC137fe25F4989f1fd", // rewardAddress should be ignored
// networkName: "mainnet",
// nodeIDInt: 1,
// longDescriptions: true,
// },
// isErr: false,
// },
{
name: "Valid node ID, Mainnet",
flags: flags{
rewardAddress: "0xe6b5A31d8bb53D2C769864aC137fe25F4989f1fd", // rewardAddress should be ignored
networkName: "mainnet",
nodeIDInt: 1,
},
isErr: false,
},
{
name: "Valid node ID with long description, Mainnet",
flags: flags{
rewardAddress: "0xe6b5A31d8bb53D2C769864aC137fe25F4989f1fd", // rewardAddress should be ignored
networkName: "mainnet",
nodeIDInt: 1,
longDescriptions: true,
},
isErr: false,
},
{
name: "Invalid: negative node ID, Mainnet",
flags: flags{
Expand Down
2 changes: 2 additions & 0 deletions configs/public_rpcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ var networkRPCs = map[string]RPC{
"https://ethereum-holesky-rpc.publicnode.com",
"https://endpoints.omniatech.io/v1/eth/holesky/public",
"https://ethereum-holesky.blockpi.network/v1/rpc/public",
"https://1rpc.io/holesky",
"https://holesky.drpc.org",
},
PublicWSs: []string{
"wss://ethereum-holesky-rpc.publicnode.com",
Expand Down
56 changes: 28 additions & 28 deletions e2e/sedge/lidoStatus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestE2E_LidoStatus_InvalidRewardAddress(t *testing.T) {
e2eTest.run()
}

func TestE2E_LidoStatus_RewardAddressNotFound(t *testing.T) {
func TestE2E_LidoStatus_InvalidZeroRewardAddress(t *testing.T) {
// Test context
var (
runErr error
Expand All @@ -128,7 +128,7 @@ func TestE2E_LidoStatus_RewardAddressNotFound(t *testing.T) {
nil,
// Act
func(t *testing.T, binaryPath string, dataDirPath string) {
runErr = base.RunCommand(t, binaryPath, "sedge", "lido-status", "0xC870Fd7316956C1582A2c8Fd2c42552cCEC70C89", "--network", "holesky")
runErr = base.RunCommand(t, binaryPath, "sedge", "lido-status", "0x0000000000000000000000000000000000000000", "--network", "holesky")
},
// Assert
func(t *testing.T, dataDirPath string) {
Expand All @@ -139,7 +139,7 @@ func TestE2E_LidoStatus_RewardAddressNotFound(t *testing.T) {
e2eTest.run()
}

func TestE2E_LidoStatus_InvalidZeroRewardAddress(t *testing.T) {
func TestE2E_LidoStatus_ValidNodeID_Mainnet(t *testing.T) {
// Test context
var (
runErr error
Expand All @@ -151,40 +151,17 @@ func TestE2E_LidoStatus_InvalidZeroRewardAddress(t *testing.T) {
nil,
// Act
func(t *testing.T, binaryPath string, dataDirPath string) {
runErr = base.RunCommand(t, binaryPath, "sedge", "lido-status", "0x0000000000000000000000000000000000000000", "--network", "holesky")
runErr = base.RunCommand(t, binaryPath, "sedge", "lido-status", "--nodeID", "1", "--l", "--network", "mainnet")
},
// Assert
func(t *testing.T, dataDirPath string) {
assert.Error(t, runErr, "lido status command should fail")
assert.NoError(t, runErr, "lido status command should succeed with the given arguments")
},
)
// Run test case
e2eTest.run()
}

// func TestE2E_LidoStatus_ValidNodeID_Mainnet(t *testing.T) {
// // Test context
// var (
// runErr error
// )
// // Build test case
// e2eTest := newE2ESedgeTestCase(
// t,
// // Arrange
// nil,
// // Act
// func(t *testing.T, binaryPath string, dataDirPath string) {
// runErr = base.RunCommand(t, binaryPath, "sedge", "lido-status", "--nodeID", "1", "--l", "--network", "mainnet")
// },
// // Assert
// func(t *testing.T, dataDirPath string) {
// assert.NoError(t, runErr, "lido status command should succeed with the given arguments")
// },
// )
// // Run test case
// e2eTest.run()
// }

func TestE2E_LidoStatus_InvalidNodeID_Mainnet(t *testing.T) {
// Test context
var (
Expand Down Expand Up @@ -231,3 +208,26 @@ func TestE2E_LidoStatus_InvalidRewardAddress_Mainnet(t *testing.T) {
// Run test case
e2eTest.run()
}

func TestE2E_LidoStatus_RewardAddressNotFound_Mainnet(t *testing.T) {
// Test context
var (
runErr error
)
// Build test case
e2eTest := newE2ESedgeTestCase(
t,
// Arrange
nil,
// Act
func(t *testing.T, binaryPath string, dataDirPath string) {
runErr = base.RunCommand(t, binaryPath, "sedge", "lido-status", "0xC870Fd7316956C1582A2c8Fd2c42552cCEC70C89", "--network", "mainnet")
},
// Assert
func(t *testing.T, dataDirPath string) {
assert.Error(t, runErr, "lido status command should fail")
},
)
// Run test case
e2eTest.run()
}
12 changes: 6 additions & 6 deletions internal/lido/contracts/csfeedistributor/rewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ func TestRewards(t *testing.T) {
nodeID: big.NewInt(-15),
wantErr: true,
},
// {
// name: "Rewards for nodeID 1, Mainnet",
// network: "mainnet",
// nodeID: big.NewInt(1),
// wantErr: false,
// },
{
name: "Rewards for nodeID 1, Mainnet",
network: "mainnet",
nodeID: big.NewInt(1),
wantErr: false,
},
}
for _, tc := range tcs {
t.Run(tc.name, func(t *testing.T) {
Expand Down
22 changes: 14 additions & 8 deletions internal/lido/contracts/csmodule/nodeOperator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ func TestNodeOperatorInfo(t *testing.T) {
{
"Invalid Address, Mainnet", "mainnet", big.NewInt(4), "0xC870Fd7316956C1582A2c8Fd2c46752", true,
},
{
"Valid Address, Mainnet", "mainnet", big.NewInt(1), "0x556fedf2213A31c7Ab9F8bc8Db5B2254261A5B0b", false,
},
}

for _, tc := range tcs {
Expand All @@ -102,23 +105,23 @@ func TestNodeID(t *testing.T) {
wantErr bool
}{
{
"Valid NodeID, Holesky #1", "holesky", big.NewInt(13), false,
"Invalid NodeID, Mainnet", "mainnet", big.NewInt(-2), true,
},
{
"Valid NodeID, Holesky #2", "holesky", big.NewInt(4), false,
"Valid NodeID, Mainnet", "mainnet", big.NewInt(1), false,
},
{
"Invalid NodeID, Holesky #1", "holesky", big.NewInt(-4), true,
"Valid NodeID, Mainnet #2", "mainnet", big.NewInt(12), false,
},
{
"Invalid NodeID, Holesky #2", "holesky", big.NewInt(20000), true,
"Valid NodeID, Holesky", "holesky", big.NewInt(4), false,
},
{
"Invalid NodeID, Mainnet", "mainnet", big.NewInt(-2), true,
"Invalid NodeID, Holesky #1", "holesky", big.NewInt(-4), true,
},
{
"Invalid NodeID, Holesky #2", "holesky", big.NewInt(20000), true,
},
// {
// "Valid NodeID, Mainnet", "mainnet", big.NewInt(1), false,
// },
}

for _, tc := range tcs {
Expand Down Expand Up @@ -146,6 +149,9 @@ func FuzzTestNodeID(f *testing.F) {
{"holesky", big.NewInt(13)},
{"holesky", big.NewInt(-1)},
{"holesky", big.NewInt(40000)},
{"mainnet", big.NewInt(12)},
{"mainnet", big.NewInt(-5)},
{"mainnet", big.NewInt(500000)},
}

for _, tc := range testcases {
Expand Down
22 changes: 15 additions & 7 deletions internal/lido/contracts/mevboostrelaylist/relays.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,23 @@ holesky:
Operator: "Beaverbuild"
IsMandatory: false
Description: "Beaverbuild Relay Holesky"
- Uri: "https://0xb1d229d9c21298a87846c7022ebeef277dfc321fe674fa45312e20b5b6c400bfde9383f801848d7837ed5fc449083a12@relay-holesky.edennetwork.io"
Operator: "Eden"
- Uri: "https://0xafa4c6985aa049fb79dd37010438cfebeb0f2bd42b115b89dd678dab0670c1de38da0c4e9138c9290a398ecd9a0b3110@boost-relay-holesky.flashbots.net"
Operator: "Flashbots"
IsMandatory: true
Description: "Eden Relay Holesky - Filtering"
Description: "Flashbots Boost Holesky - filtering"
- Uri: "https://0xaa58208899c6105603b74396734a6263cc7d947f444f396a90f7b7d3e65d102aec7e5e5291b27e08d02c50a050825c2f@holesky.titanrelay.xyz/"
Operator: "Titan"
IsMandatory: true
Description: "Titan Relay Holesky - nonfiltering"
- Uri: "https://0xafa4c6985aa049fb79dd37010438cfebeb0f2bd42b115b89dd678dab0670c1de38da0c4e9138c9290a398ecd9a0b3110@boost-relay-holesky.flashbots.net"
Operator: "Flashbots"
IsMandatory: true
Description: "Flashbots Boost Holesky - filtering"
- Uri: "https://0xa55c1285d84ba83a5ad26420cd5ad3091e49c55a813eee651cd467db38a8c8e63192f47955e9376f6b42f6d190571cb5@relay-holesky.bolt.chainbound.io"
Operator: "Chainbound"
IsMandatory: false
Description: "Chainbound Preconf Holesky"
- Uri: "https://0x8d6ff9fdf3b8c05293f6c240f57034c6c5244d7ecb2b9a6e597de575b373610d6345f5060c150012d1cc42d38b8383ac@preconfs-holesky.aestus.live"
Operator: "Aestus"
IsMandatory: false
Description: "Aestus Preconf Holesky"
- Uri: "https://0xaa58208899c6105603b74396734a6263cc7d947f444f396a90f7b7d3e65d102aec7e5e5291b27e08d02c50a050825c2f@holesky-preconf.titanrelay.xyz"
Operator: "Titan"
IsMandatory: false
Description: "Titan Preconf Holesky"
Loading