MCPcopy Create free account
hub / github.com/erpc/erpc / TestHttpServer_EvmGetLogs

Function TestHttpServer_EvmGetLogs

erpc/http_server_test.go:5093–5529  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5091}
5092
5093func TestHttpServer_EvmGetLogs(t *testing.T) {
5094 t.Run("SuccessfulSplitIfOneOfSubRequestsNeedsRetries", func(t *testing.T) {
5095 util.ResetGock()
5096 defer util.ResetGock()
5097 util.SetupMocksForEvmStatePoller()
5098 defer util.AssertNoPendingMocks(t, 0)
5099
5100 cfg := &common.Config{
5101 Server: &common.ServerConfig{
5102 MaxTimeout: common.Duration(5 * time.Second).Ptr(),
5103 },
5104 Projects: []*common.ProjectConfig{
5105 {
5106 Id: "test_project",
5107 Networks: []*common.NetworkConfig{
5108 {
5109 Architecture: "evm",
5110 Evm: &common.EvmNetworkConfig{
5111 ChainId: 123,
5112 Integrity: &common.EvmIntegrityConfig{
5113 EnforceGetLogsBlockRange: util.BoolPtr(false),
5114 },
5115 },
5116 },
5117 },
5118 Upstreams: []*common.UpstreamConfig{
5119 {
5120 Id: "rpc1",
5121 Endpoint: "http://rpc1.localhost",
5122 Type: common.UpstreamTypeEvm,
5123 Evm: &common.EvmUpstreamConfig{
5124 ChainId: 123,
5125 GetLogsAutoSplittingRangeThreshold: 0x100,
5126 },
5127 Failsafe: []*common.FailsafeConfig{
5128 {
5129 Retry: &common.RetryPolicyConfig{
5130 MaxAttempts: 2,
5131 },
5132 },
5133 },
5134 },
5135 },
5136 },
5137 },
5138 }
5139
5140 // Create the full request that will be split into three parts
5141 fullRangeRequest := `{
5142 "jsonrpc": "2.0",
5143 "method": "eth_getLogs",
5144 "params": [{
5145 "fromBlock": "0x11118000",
5146 "toBlock": "0x11118300",
5147 "address": "0x0000000000000000000000000000000000000000",
5148 "topics": ["0x1234567890123456789012345678901234567890123456789012345678901234"]
5149 }]
5150 }`

Callers

nothing calls this directly

Calls 9

ResetGockFunction · 0.92
AssertNoPendingMocksFunction · 0.92
DurationTypeAlias · 0.92
BoolPtrFunction · 0.92
SafeReadBodyFunction · 0.92
createServerTestFixturesFunction · 0.85
PtrMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected