feat: route gasless voting through governance vote-relay, drop gelato#3077
Open
JoaquinBattilana wants to merge 12 commits into
Open
feat: route gasless voting through governance vote-relay, drop gelato#3077JoaquinBattilana wants to merge 12 commits into
JoaquinBattilana wants to merge 12 commits into
Conversation
…melock into timeline
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
sammdec
previously approved these changes
Jul 22, 2026
| // The browser never holds the relay's api key: it calls this route, which attaches | ||
| // the server-side `x-api-key` and forwards to the relay, mirroring `rpc-proxy.ts`. | ||
| // See governance-v3-cache PR #126 for the relay contract. | ||
| const VOTE_RELAY_URL = process.env.VOTE_RELAY_URL; // e.g. https://governance-cache-api.aave.com/relay |
Contributor
There was a problem hiding this comment.
@JoaquinBattilana Do we need to add this to vercel?
Contributor
There was a problem hiding this comment.
nit: we should add typed env vars as we have in v4 (in a separated PR)
| // the server-side `x-api-key` and forwards to the relay, mirroring `rpc-proxy.ts`. | ||
| // See governance-v3-cache PR #126 for the relay contract. | ||
| const VOTE_RELAY_URL = process.env.VOTE_RELAY_URL; // e.g. https://governance-cache-api.aave.com/relay | ||
| const VOTE_RELAY_API_KEY = process.env.VOTE_RELAY_API_KEY; |
mgrabina
reviewed
Jul 22, 2026
Comment on lines
+78
to
+80
| const text = await relayResponse.text(); | ||
| res.status(relayResponse.status); | ||
| res.setHeader('Content-Type', 'application/json'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Routes gasless governance voting through the new governance vote-relay (governance-v3-cache PR #126) and removes the Gelato relayer, whose sponsor flow required calldata built in the browser and a key managed outside our infra.
The relay now encodes
submitVoteBySignatureserver-side, so the browser only sends the raw voting-balance proofs plus the EIP-712 signature. The browser never holds the relay API key — it calls a same-origin Next.js proxy that attaches the server-side key, mirroringpages/api/rpc-proxy.ts.Changes
pages/api/governance/vote-relay/[...path].ts— same-origin proxy. Attaches server-sidex-api-key, forwards the caller IP asx-forwarded-for(relay's per-IP rate limiter keys on it), and passes the relay's status/body straight through. Allowlists only the relay's vote routes (incl./v1/votes/representative) so it can't be used as an open proxy.src/components/transactions/GovVote/temporary/voteRelayClient.ts—submitRelayVote(POST raw proofs + signature) andpollVoteStatus(polls untilMINED/CONFIRMED; fails onFAILED|EXPIRED|CANCELLED|DROPPED; keeps waiting onPENDING|INMEMPOOL|REPLACED), plus a typedRelayError { code, retryable }.GovVoteActions.tsx— the gasless branch now signs (unchanged EIP-712) → POSTs to the proxy → polls status. OnRELAYER_UNAVAILABLEit falls back to the self-paidsubmitVote; any other relay error (bad signature, already voted, simulation reverted, vote in flight) surfaces to the user.VotingMachineService.ts— dropped the now-unusedgenerateSubmitVoteBySignatureTxData(the relay encodes calldata itself).pages/api/gelato/relay.tsand theGELATO_SPONSOR_KEYenv var.VOTE_RELAY_URL+VOTE_RELAY_API_KEY(server-side only) to.env.example.The
NEXT_PUBLIC_ENABLE_GASLESS_VOTINGgate is unchanged. When the relay is unconfigured, the proxy returnsRELAYER_UNAVAILABLEand voting falls back to self-paid, so nothing breaks before the relay is live.Notes / out of scope
/v1/votes/representative, but there is no client logic forSubmitVoteAsRepresentativesigning /proofOfRepresentation/ represented-voter selection yet — a separate follow-up.VOTE_RELAY_API_KEYand an in-window proposal). Verified by typecheck + lint; happy path is logic/types only.feat/governance-cache-sdk(the branch that introduced the Gelato flow this replaces).Testing
tsc --noEmitclean.