diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06dd54d1..811667f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,12 +17,14 @@ on: - "release/**" env: - GO_VERSION: 1.25 + GO_VERSION: 1.25 jobs: test: name: "Test" runs-on: ubuntu-latest + env: + GRPC_GO_RETRY: "on" steps: - uses: actions/checkout@v5 with: diff --git a/server/server.go b/server/server.go index 6e2ff6dd..10d33e27 100644 --- a/server/server.go +++ b/server/server.go @@ -287,7 +287,7 @@ func DetectRemoteChainID(url string) (flowgo.ChainID, error) { grpc.WithDefaultServiceConfig(utils.DefaultGRPCServiceConfig), ) if err != nil { - return "", err + return "",fmt.Errorf("could not connect to remote access node: %w", err) } defer func() { _ = conn.Close() }() client := flowaccess.NewAccessAPIClient(conn) diff --git a/utils/grpc.go b/utils/grpc.go index 3792ba55..1a4675e5 100644 --- a/utils/grpc.go +++ b/utils/grpc.go @@ -18,27 +18,18 @@ package utils -// DefaultGRPCServiceConfig provides automatic retry configuration for transient gRPC errors. -// This config is applied to all remote gRPC connections to handle network flakiness in CI -// and other environments. -// -// Retries on: -// - UNAVAILABLE: Service temporarily unavailable (e.g., node restarting) -// - RESOURCE_EXHAUSTED: Rate limiting from remote node -// - UNKNOWN: Connection failures, DNS issues, and other network errors -// -// Note: We only retry on clearly transient network/availability errors. -// We do NOT retry on INTERNAL (programming errors), ABORTED (conflicts), -// or DEADLINE_EXCEEDED (to avoid cascading failures on slow services). +// DefaultGRPCServiceConfig configures native gRPC retries for transient failures. +// The empty object wildcard [{}] matches all services and methods. const DefaultGRPCServiceConfig = `{ "methodConfig": [{ - "name": [{"service": ""}], + "name": [{}], "retryPolicy": { - "maxAttempts": 5, - "initialBackoff": "0.1s", + "maxAttempts": 8, + "initialBackoff": "1s", "maxBackoff": "30s", "backoffMultiplier": 2, "retryableStatusCodes": ["UNAVAILABLE", "RESOURCE_EXHAUSTED", "UNKNOWN"] } }] }` +