feat: route gasless voting through governance vote-relay, drop gelato - #3077
Conversation
…melock into timeline
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| // 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 |
There was a problem hiding this comment.
@JoaquinBattilana Do we need to add this to vercel?
There was a problem hiding this comment.
nit: we should add typed env vars as we have in v4 (in a separated PR)
There was a problem hiding this comment.
no need to be env var this one i think
| // 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; |
There was a problem hiding this comment.
added to staging, prod not available yet
| const text = await relayResponse.text(); | ||
| res.status(relayResponse.status); | ||
| res.setHeader('Content-Type', 'application/json'); |
# Conflicts: # .env.example # src/components/transactions/GovVote/GovVoteActions.tsx
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
| Page | Size (compressed) |
|---|---|
global |
1.32 MB (🟡 +10 B) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
Six Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
| Page | Size (compressed) | First Load |
|---|---|---|
/ |
96.01 KB (🟡 +2 B) |
1.42 MB |
/dashboard |
85.59 KB (🟡 +2 B) |
1.41 MB |
/markets |
54.89 KB (🟡 +2 B) |
1.38 MB |
/safety-module |
56.45 KB (🟡 +2 B) |
1.38 MB |
/sgho |
92.99 KB (🟡 +2 B) |
1.41 MB |
/v3-migration |
52.64 KB (🟡 +2 B) |
1.37 MB |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

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.