coinbase / mesh-sdk-go

Mesh Client Go SDK
Apache License 2.0
196 stars 135 forks source link

feat: grpc header forwarding #508

Closed potterbm-cb closed 3 weeks ago

potterbm-cb commented 1 month ago

Motivation

Some blockchain networks (looking at you, cosmos) use grpc to communicate with the blockchain node.

This PR makes updates to the headerforwarder package to make it easy to use with grpc clients

Additional Improvements: Outgoing header forwarding

This PR also introduces functionality to set outgoing headers on both grpc and http requests. Previously this was accomplished by individual clients (actually only mesh-geth-sdk was modified so far) defining context-creation behavior. Unfortunately, the request context plumbing was pretty ungainly and required each caller of this SDK to implement their own code for it.

Now the outgoing headers will be captured in the server middleware, stored by request ID, and set on outgoing http and grpc requests via the http.RoundTripper and grpc.UnaryClientInterceptor respectively

Upgrade go version to 1.19

In order to get a version of grpc with a metadata bugfix this PR upgrades the go version of this module


Notes to reviewers

All of the substantive changes here happen in the headerforwarder/ package.

Other changes fall into two categories:

cb-heimdall commented 1 month ago

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1