decred.org/dcrdex@v1.0.5/client/asset/eth/multirpc_live_test.go (about) 1 //go:build rpclive 2 3 package eth 4 5 import ( 6 "context" 7 "os" 8 "testing" 9 10 "decred.org/dcrdex/dex" 11 ) 12 13 const ( 14 alphaHTTPPort = "38556" 15 alphaWSPort = "38557" 16 ) 17 18 var mt *MRPCTest 19 20 func TestMain(m *testing.M) { 21 ctx, shutdown := context.WithCancel(context.Background()) 22 mt = NewMRPCTest(ctx, ChainConfig, NetworkCompatibilityData, "eth") 23 doIt := func() int { 24 defer shutdown() 25 return m.Run() 26 } 27 os.Exit(doIt()) 28 } 29 30 func TestHTTP(t *testing.T) { 31 mt.TestHTTP(t, alphaHTTPPort) 32 } 33 34 func TestWS(t *testing.T) { 35 mt.TestWS(t, alphaWSPort) 36 } 37 38 func TestWSTxLogs(t *testing.T) { 39 mt.TestWSTxLogs(t, alphaWSPort) 40 } 41 42 func TestSimnetMultiRPCClient(t *testing.T) { 43 mt.TestSimnetMultiRPCClient(t, alphaWSPort, alphaHTTPPort) 44 } 45 46 func TestMonitorTestnet(t *testing.T) { 47 mt.TestMonitorNet(t, dex.Testnet) 48 } 49 50 func TestMonitorMainnet(t *testing.T) { 51 mt.TestMonitorNet(t, dex.Mainnet) 52 } 53 54 func TestRPC(t *testing.T) { 55 mt.TestRPC(t, dex.Mainnet) 56 } 57 58 var freeServers = []string{ 59 // https://www.alchemy.com/chain-connect/chain/ethereum 60 // Passing 03-26-2024 61 "https://rpc.builder0x69.io", // Limits unknown 62 "https://eth.drpc.org", // 210 million Compute Units (CU) per 30-day period - 20 CU/req 63 "https://rpc.ankr.com/eth", // 30 req per second, no WebSockets (premium-only) 64 "https://ethereum.blockpi.network/v1/rpc/public", // 10 req per sec, no WebSockets (premium-only) 65 "https://rpc.flashbots.net", // Limits unknown 66 "wss://eth.llamarpc.com", // Limits unknown 67 "https://eth-mainnet.nodereal.io/v1/1659dfb40aa24bbb8153a677b98064d7", // Limits might be 100M compute units at 300 CU/s 68 // Failing 03-26-2024 69 "https://eth-mainnet.gateway.pokt.network/v1/5f3453978e354ab992c4da79", // connect error: failed to connect to even a single provider among: pokt.network 70 "https://ethereum.publicnode.com", // "TransactionReceipt" error: not found 71 "https://nodes.mewapi.io/rpc/eth", // connect error: failed to connect to even a single provider among: mewapi.io 72 "https://eth.api.onfinality.io/public", // connect error: failed to connect to even a single provider among: onfinality.io 73 "https://eth-mainnet-public.unifra.io", // connect error: failed to connect to even a single provider among: unifra.io 74 "https://cloudflare-eth.com/", // "SuggestGasTipCap" error: Method not found 75 76 } 77 78 func TestFreeServers(t *testing.T) { 79 mt.TestFreeServers(t, freeServers, dex.Mainnet) 80 } 81 82 var freeTestnetServers = []string{ 83 // Sepolia 84 // Passing 03-27-2024 85 "https://rpc.ankr.com/eth_sepolia", 86 "https://ethereum-sepolia.blockpi.network/v1/rpc/public", 87 "https://sepolia.drpc.org", 88 "https://endpoints.omniatech.io/v1/eth/sepolia/public", 89 "https://rpc-sepolia.rockx.com", 90 "https://rpc.sepolia.org", 91 "https://eth-sepolia-public.unifra.io", 92 // Failing 03-27-2024 93 "https://relay-sepolia.flashbots.net", // connect error: failed to connect to even a single provider among: flashbots.net 94 95 // 96 // Goerli 97 // // Passing 03-26-2024 98 // "https://goerli.blockpi.network/v1/rpc/public", 99 // "https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161", 100 // // Failing 03-26-2024 101 // "https://rpc.ankr.com/eth_goerli", 102 // "https://rpc.goerli.eth.gateway.fm", 103 // "https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161", 104 // "https://rpc.goerli.mudit.blog", 105 // "https://endpoints.omniatech.io/v1/eth/goerli/public", 106 // "https://eth-goerli.api.onfinality.io/public", 107 // "https://relay-goerli.flashbots.net", 108 } 109 110 func TestFreeTestnetServers(t *testing.T) { 111 mt.TestFreeServers(t, freeTestnetServers, dex.Testnet) 112 } 113 114 func TestMainnetCompliance(t *testing.T) { 115 mt.TestMainnetCompliance(t) 116 } 117 118 func TestReceiptsHaveEffectiveGasPrice(t *testing.T) { 119 mt.TestReceiptsHaveEffectiveGasPrice(t) 120 }