@shroud-fi/self-host-relayer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +64 -0
- package/dist/cjs/dev-entry.d.ts +24 -0
- package/dist/cjs/dev-entry.d.ts.map +1 -0
- package/dist/cjs/dev-entry.js +75 -0
- package/dist/cjs/dev-entry.js.map +1 -0
- package/dist/cjs/errors.d.ts +41 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +63 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.d.ts +8 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +26 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/prod-entry.d.ts +33 -0
- package/dist/cjs/prod-entry.d.ts.map +1 -0
- package/dist/cjs/prod-entry.js +98 -0
- package/dist/cjs/prod-entry.js.map +1 -0
- package/dist/cjs/relay-eth.d.ts +43 -0
- package/dist/cjs/relay-eth.d.ts.map +1 -0
- package/dist/cjs/relay-eth.js +95 -0
- package/dist/cjs/relay-eth.js.map +1 -0
- package/dist/cjs/relay.d.ts +38 -0
- package/dist/cjs/relay.d.ts.map +1 -0
- package/dist/cjs/relay.js +83 -0
- package/dist/cjs/relay.js.map +1 -0
- package/dist/cjs/server.d.ts +18 -0
- package/dist/cjs/server.d.ts.map +1 -0
- package/dist/cjs/server.js +384 -0
- package/dist/cjs/server.js.map +1 -0
- package/dist/cjs/types.d.ts +83 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/dev-entry.d.ts +24 -0
- package/dist/esm/dev-entry.d.ts.map +1 -0
- package/dist/esm/dev-entry.js +73 -0
- package/dist/esm/dev-entry.js.map +1 -0
- package/dist/esm/errors.d.ts +41 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +53 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/prod-entry.d.ts +33 -0
- package/dist/esm/prod-entry.d.ts.map +1 -0
- package/dist/esm/prod-entry.js +96 -0
- package/dist/esm/prod-entry.js.map +1 -0
- package/dist/esm/relay-eth.d.ts +43 -0
- package/dist/esm/relay-eth.d.ts.map +1 -0
- package/dist/esm/relay-eth.js +91 -0
- package/dist/esm/relay-eth.js.map +1 -0
- package/dist/esm/relay.d.ts +38 -0
- package/dist/esm/relay.d.ts.map +1 -0
- package/dist/esm/relay.js +79 -0
- package/dist/esm/relay.js.map +1 -0
- package/dist/esm/server.d.ts +18 -0
- package/dist/esm/server.d.ts.map +1 -0
- package/dist/esm/server.js +377 -0
- package/dist/esm/server.js.map +1 -0
- package/dist/esm/types.d.ts +83 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core relay logic. Pure function — given a validated request + viem clients,
|
|
3
|
+
* encodes the ERC-2771 wrapped calldata and broadcasts via the relayer EOA.
|
|
4
|
+
*
|
|
5
|
+
* Privacy invariants:
|
|
6
|
+
* - The relayer EOA's private key is held in a viem account closure. It is
|
|
7
|
+
* never logged, serialized, or attached to thrown errors.
|
|
8
|
+
* - The stealth address is data, not key material.
|
|
9
|
+
* - The permit (v, r, s, deadline) is a one-time authorization for the
|
|
10
|
+
* specific (owner, spender, value, deadline) bound at signing time.
|
|
11
|
+
*/
|
|
12
|
+
import { encodeFunctionData, } from 'viem';
|
|
13
|
+
import { RelayBroadcastError } from './errors.js';
|
|
14
|
+
const SWEEP_ABI = [
|
|
15
|
+
{
|
|
16
|
+
type: 'function',
|
|
17
|
+
name: 'sweepERC20WithPermit',
|
|
18
|
+
stateMutability: 'nonpayable',
|
|
19
|
+
inputs: [
|
|
20
|
+
{ name: 'token', type: 'address' },
|
|
21
|
+
{ name: 'destination', type: 'address' },
|
|
22
|
+
{ name: 'deadline', type: 'uint256' },
|
|
23
|
+
{ name: 'v', type: 'uint8' },
|
|
24
|
+
{ name: 'r', type: 'bytes32' },
|
|
25
|
+
{ name: 's', type: 'bytes32' },
|
|
26
|
+
],
|
|
27
|
+
outputs: [],
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Build the ERC-2771-wrapped calldata: encoded sweepERC20WithPermit(...) with
|
|
32
|
+
* the 20-byte stealth address appended. ShroudFiRelayer's ERC2771Context
|
|
33
|
+
* reads _msgSender() as the appended address when msg.sender is the trusted
|
|
34
|
+
* forwarder (= the relayer EOA = `account` here).
|
|
35
|
+
*/
|
|
36
|
+
export function buildRelayCalldata(req) {
|
|
37
|
+
const inner = encodeFunctionData({
|
|
38
|
+
abi: SWEEP_ABI,
|
|
39
|
+
functionName: 'sweepERC20WithPermit',
|
|
40
|
+
args: [
|
|
41
|
+
req.token,
|
|
42
|
+
req.destination,
|
|
43
|
+
BigInt(req.deadline),
|
|
44
|
+
req.v,
|
|
45
|
+
req.r,
|
|
46
|
+
req.s,
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
const suffix = req.stealthAddress.slice(2).toLowerCase();
|
|
50
|
+
// Inner is `0x...`; concatenate stealth bytes (20 = 40 hex chars).
|
|
51
|
+
return (inner + suffix);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Broadcast the wrapped tx. Waits for the receipt before returning.
|
|
55
|
+
*
|
|
56
|
+
* Throws RelayBroadcastError on any underlying viem error. Errors are wrapped
|
|
57
|
+
* to strip out potentially key-bearing payloads from the visible message.
|
|
58
|
+
*/
|
|
59
|
+
export async function relayRequest(ctx, req) {
|
|
60
|
+
const data = buildRelayCalldata(req);
|
|
61
|
+
try {
|
|
62
|
+
const txHash = await ctx.walletClient.sendTransaction({
|
|
63
|
+
account: ctx.account,
|
|
64
|
+
chain: ctx.walletClient.chain ?? null,
|
|
65
|
+
to: ctx.relayerContract,
|
|
66
|
+
data,
|
|
67
|
+
value: 0n,
|
|
68
|
+
});
|
|
69
|
+
const receipt = await ctx.publicClient.waitForTransactionReceipt({
|
|
70
|
+
hash: txHash,
|
|
71
|
+
});
|
|
72
|
+
return { txHash, blockNumber: receipt.blockNumber };
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
const name = err instanceof Error ? err.name : 'UnknownError';
|
|
76
|
+
throw new RelayBroadcastError(name, { cause: err });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=relay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay.js","sourceRoot":"","sources":["../../src/relay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,kBAAkB,GAQnB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,MAAM,SAAS,GAAG;IAChB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,sBAAsB;QAC5B,eAAe,EAAE,YAAY;QAC7B,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YAClC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;YACxC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;YACrC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE;YAC5B,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE;YAC9B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E,CAAC;QACb,MAAM,IAAI,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC;QAC9D,MAAM,IAAI,mBAAmB,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fastify server for @shroud-fi/self-host-relayer.
|
|
3
|
+
*
|
|
4
|
+
* Endpoints:
|
|
5
|
+
* POST /relay - submit a permit-signed sweep request
|
|
6
|
+
* GET /health - liveness probe
|
|
7
|
+
*
|
|
8
|
+
* Privacy invariants:
|
|
9
|
+
* - Request body is validated then discarded — never logged.
|
|
10
|
+
* - Error responses carry only error class names, never inner messages.
|
|
11
|
+
* - The forwarder EOA's private key is read from config once, then held in
|
|
12
|
+
* a viem account closure. Never logged, never serialized to disk.
|
|
13
|
+
*/
|
|
14
|
+
import { type FastifyInstance } from 'fastify';
|
|
15
|
+
import type { ServiceConfig } from './types.js';
|
|
16
|
+
export declare function buildServer(cfg: ServiceConfig): Promise<FastifyInstance>;
|
|
17
|
+
export declare function startServer(cfg: ServiceConfig): Promise<FastifyInstance>;
|
|
18
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AA6BxD,OAAO,KAAK,EAIV,aAAa,EACd,MAAM,YAAY,CAAC;AAgFpB,wBAAsB,WAAW,CAC/B,GAAG,EAAE,aAAa,GACjB,OAAO,CAAC,eAAe,CAAC,CA+Q1B;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAI9E"}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fastify server for @shroud-fi/self-host-relayer.
|
|
3
|
+
*
|
|
4
|
+
* Endpoints:
|
|
5
|
+
* POST /relay - submit a permit-signed sweep request
|
|
6
|
+
* GET /health - liveness probe
|
|
7
|
+
*
|
|
8
|
+
* Privacy invariants:
|
|
9
|
+
* - Request body is validated then discarded — never logged.
|
|
10
|
+
* - Error responses carry only error class names, never inner messages.
|
|
11
|
+
* - The forwarder EOA's private key is read from config once, then held in
|
|
12
|
+
* a viem account closure. Never logged, never serialized to disk.
|
|
13
|
+
*/
|
|
14
|
+
import Fastify from 'fastify';
|
|
15
|
+
import cors from '@fastify/cors';
|
|
16
|
+
import rateLimit from '@fastify/rate-limit';
|
|
17
|
+
import { createPublicClient, createWalletClient, http, isAddress, recoverTypedDataAddress, serializeSignature, getAddress, } from 'viem';
|
|
18
|
+
import { base, baseSepolia } from 'viem/chains';
|
|
19
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
20
|
+
import { AuthorizationContractMismatchError, EthRelayerNotConfiguredError, InvalidRelayEthRequestError, InvalidRelayRequestError, } from './errors.js';
|
|
21
|
+
import { relayRequest } from './relay.js';
|
|
22
|
+
import { relayEthRequest } from './relay-eth.js';
|
|
23
|
+
const HEX32_RE = /^0x[0-9a-fA-F]{64}$/;
|
|
24
|
+
function isHex32(s) {
|
|
25
|
+
return typeof s === 'string' && HEX32_RE.test(s);
|
|
26
|
+
}
|
|
27
|
+
function validateRequest(body) {
|
|
28
|
+
if (typeof body !== 'object' || body === null) {
|
|
29
|
+
throw new InvalidRelayRequestError();
|
|
30
|
+
}
|
|
31
|
+
const b = body;
|
|
32
|
+
if (!isAddress(b.token))
|
|
33
|
+
throw new InvalidRelayRequestError();
|
|
34
|
+
if (!isAddress(b.destination))
|
|
35
|
+
throw new InvalidRelayRequestError();
|
|
36
|
+
if (!isAddress(b.stealthAddress))
|
|
37
|
+
throw new InvalidRelayRequestError();
|
|
38
|
+
if (typeof b.deadline !== 'string' || !/^\d+$/.test(b.deadline)) {
|
|
39
|
+
throw new InvalidRelayRequestError();
|
|
40
|
+
}
|
|
41
|
+
if (typeof b.v !== 'number' || b.v < 0 || b.v > 255) {
|
|
42
|
+
throw new InvalidRelayRequestError();
|
|
43
|
+
}
|
|
44
|
+
if (!isHex32(b.r))
|
|
45
|
+
throw new InvalidRelayRequestError();
|
|
46
|
+
if (!isHex32(b.s))
|
|
47
|
+
throw new InvalidRelayRequestError();
|
|
48
|
+
return {
|
|
49
|
+
token: b.token,
|
|
50
|
+
destination: b.destination,
|
|
51
|
+
stealthAddress: b.stealthAddress,
|
|
52
|
+
deadline: b.deadline,
|
|
53
|
+
v: b.v,
|
|
54
|
+
r: b.r,
|
|
55
|
+
s: b.s,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const HEX_PREFIXED_RE = /^0x[0-9a-fA-F]+$/;
|
|
59
|
+
function isHex(s) {
|
|
60
|
+
return typeof s === 'string' && HEX_PREFIXED_RE.test(s);
|
|
61
|
+
}
|
|
62
|
+
function validateEthRequest(body) {
|
|
63
|
+
if (typeof body !== 'object' || body === null) {
|
|
64
|
+
throw new InvalidRelayEthRequestError();
|
|
65
|
+
}
|
|
66
|
+
const b = body;
|
|
67
|
+
if (!isAddress(b.stealthAddress))
|
|
68
|
+
throw new InvalidRelayEthRequestError();
|
|
69
|
+
if (!isAddress(b.destination))
|
|
70
|
+
throw new InvalidRelayEthRequestError();
|
|
71
|
+
if (typeof b.chainId !== 'number')
|
|
72
|
+
throw new InvalidRelayEthRequestError();
|
|
73
|
+
if (typeof b.deadline !== 'string' || !/^\d+$/.test(b.deadline)) {
|
|
74
|
+
throw new InvalidRelayEthRequestError();
|
|
75
|
+
}
|
|
76
|
+
if (!isHex(b.signature))
|
|
77
|
+
throw new InvalidRelayEthRequestError();
|
|
78
|
+
const auth = b.authorization;
|
|
79
|
+
if (typeof auth !== 'object' || auth === null)
|
|
80
|
+
throw new InvalidRelayEthRequestError();
|
|
81
|
+
if (!isAddress(auth.address))
|
|
82
|
+
throw new InvalidRelayEthRequestError();
|
|
83
|
+
if (typeof auth.chainId !== 'number')
|
|
84
|
+
throw new InvalidRelayEthRequestError();
|
|
85
|
+
if (typeof auth.nonce !== 'number' || auth.nonce < 0) {
|
|
86
|
+
throw new InvalidRelayEthRequestError();
|
|
87
|
+
}
|
|
88
|
+
if (!isHex32(auth.r))
|
|
89
|
+
throw new InvalidRelayEthRequestError();
|
|
90
|
+
if (!isHex32(auth.s))
|
|
91
|
+
throw new InvalidRelayEthRequestError();
|
|
92
|
+
if (auth.yParity !== 0 && auth.yParity !== 1)
|
|
93
|
+
throw new InvalidRelayEthRequestError();
|
|
94
|
+
return {
|
|
95
|
+
stealthAddress: b.stealthAddress,
|
|
96
|
+
destination: b.destination,
|
|
97
|
+
chainId: b.chainId,
|
|
98
|
+
deadline: b.deadline,
|
|
99
|
+
signature: b.signature,
|
|
100
|
+
authorization: {
|
|
101
|
+
address: auth.address,
|
|
102
|
+
chainId: auth.chainId,
|
|
103
|
+
nonce: auth.nonce,
|
|
104
|
+
r: auth.r,
|
|
105
|
+
s: auth.s,
|
|
106
|
+
yParity: auth.yParity,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export async function buildServer(cfg) {
|
|
111
|
+
const fastify = Fastify({
|
|
112
|
+
// Logging stripped of body — only method, url, status, response time.
|
|
113
|
+
logger: { level: 'info' },
|
|
114
|
+
disableRequestLogging: true,
|
|
115
|
+
});
|
|
116
|
+
await fastify.register(cors, {
|
|
117
|
+
origin: (origin, cb) => {
|
|
118
|
+
// Allow same-host requests (no Origin header) for curl/healthchecks.
|
|
119
|
+
if (origin === undefined)
|
|
120
|
+
return cb(null, true);
|
|
121
|
+
if (cfg.allowedOrigins.includes(origin))
|
|
122
|
+
return cb(null, true);
|
|
123
|
+
return cb(new Error('Origin not allowed'), false);
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
await fastify.register(rateLimit, {
|
|
127
|
+
max: cfg.rateLimitPerMinute,
|
|
128
|
+
timeWindow: '1 minute',
|
|
129
|
+
});
|
|
130
|
+
const chain = cfg.chainId === 8453 ? base : baseSepolia;
|
|
131
|
+
const account = privateKeyToAccount(cfg.forwarderPrivateKey);
|
|
132
|
+
// Viem's OP-stack chain extension widens the tx type set. Our relayRequest
|
|
133
|
+
// signature uses a generic Chain; cast at the boundary so the OP extensions
|
|
134
|
+
// don't bleed into our public types.
|
|
135
|
+
const publicClient = createPublicClient({
|
|
136
|
+
chain,
|
|
137
|
+
transport: http(cfg.rpcUrl, { batch: false }),
|
|
138
|
+
});
|
|
139
|
+
const walletClient = createWalletClient({
|
|
140
|
+
chain,
|
|
141
|
+
account,
|
|
142
|
+
transport: http(cfg.rpcUrl, { batch: false }),
|
|
143
|
+
});
|
|
144
|
+
fastify.get('/health', async () => ({ ok: true, chainId: cfg.chainId }));
|
|
145
|
+
fastify.post('/relay', async (req, reply) => {
|
|
146
|
+
let validated;
|
|
147
|
+
try {
|
|
148
|
+
validated = validateRequest(req.body);
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
const name = err instanceof Error ? err.name : 'InvalidRelayRequestError';
|
|
152
|
+
reply.status(400);
|
|
153
|
+
const body = { ok: false, error: name };
|
|
154
|
+
return body;
|
|
155
|
+
}
|
|
156
|
+
// Diagnostic pre-flight: read on-chain state for the (stealth, token) pair
|
|
157
|
+
// before broadcasting. NOT key material — all four values (balance,
|
|
158
|
+
// allowance, nonce, name) are public reads. Off in prod by default; flip
|
|
159
|
+
// cfg.debugDiagnostics = true (DEBUG_DIAGNOSTICS=1 env) to enable when
|
|
160
|
+
// troubleshooting permit digest mismatches.
|
|
161
|
+
if (cfg.debugDiagnostics === true)
|
|
162
|
+
try {
|
|
163
|
+
const tokenAbi = [
|
|
164
|
+
{ type: 'function', name: 'balanceOf', stateMutability: 'view', inputs: [{ name: 'a', type: 'address' }], outputs: [{ type: 'uint256' }] },
|
|
165
|
+
{ type: 'function', name: 'allowance', stateMutability: 'view', inputs: [{ name: 'o', type: 'address' }, { name: 's', type: 'address' }], outputs: [{ type: 'uint256' }] },
|
|
166
|
+
{ type: 'function', name: 'nonces', stateMutability: 'view', inputs: [{ name: 'a', type: 'address' }], outputs: [{ type: 'uint256' }] },
|
|
167
|
+
{ type: 'function', name: 'name', stateMutability: 'view', inputs: [], outputs: [{ type: 'string' }] },
|
|
168
|
+
{ type: 'function', name: 'version', stateMutability: 'view', inputs: [], outputs: [{ type: 'string' }] },
|
|
169
|
+
];
|
|
170
|
+
const [bal, allow, nonce, name] = await Promise.all([
|
|
171
|
+
publicClient.readContract({ address: validated.token, abi: tokenAbi, functionName: 'balanceOf', args: [validated.stealthAddress] }),
|
|
172
|
+
publicClient.readContract({ address: validated.token, abi: tokenAbi, functionName: 'allowance', args: [validated.stealthAddress, cfg.relayerContract] }),
|
|
173
|
+
publicClient.readContract({ address: validated.token, abi: tokenAbi, functionName: 'nonces', args: [validated.stealthAddress] }),
|
|
174
|
+
publicClient.readContract({ address: validated.token, abi: tokenAbi, functionName: 'name' }),
|
|
175
|
+
]);
|
|
176
|
+
let probedVersion = 'unprobed';
|
|
177
|
+
try {
|
|
178
|
+
probedVersion = (await publicClient.readContract({
|
|
179
|
+
address: validated.token,
|
|
180
|
+
abi: tokenAbi,
|
|
181
|
+
functionName: 'version',
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
probedVersion = 'NOT_EXPOSED(fallback_to_1)';
|
|
186
|
+
}
|
|
187
|
+
const now = Math.floor(Date.now() / 1000);
|
|
188
|
+
fastify.log.info({
|
|
189
|
+
stealth: validated.stealthAddress,
|
|
190
|
+
token: validated.token,
|
|
191
|
+
balance: bal.toString(),
|
|
192
|
+
allowance: allow.toString(),
|
|
193
|
+
nonce: nonce.toString(),
|
|
194
|
+
tokenName: name,
|
|
195
|
+
probedVersion,
|
|
196
|
+
deadline: validated.deadline,
|
|
197
|
+
nowUnix: now,
|
|
198
|
+
deadlineDelta: Number(BigInt(validated.deadline) - BigInt(now)),
|
|
199
|
+
v: validated.v,
|
|
200
|
+
}, 'relay preflight state');
|
|
201
|
+
// Signature recovery: rebuild the same EIP-712 message the agent SHOULD
|
|
202
|
+
// have signed (under both "1" and probed version) and see which (if any)
|
|
203
|
+
// recovers to the stealth address. Whichever ONE matches tells us the
|
|
204
|
+
// exact domain used. If NEITHER matches, the failure is in value/nonce/
|
|
205
|
+
// chainId/spender — list those candidates too.
|
|
206
|
+
try {
|
|
207
|
+
const fullSig = serializeSignature({ r: validated.r, s: validated.s, v: BigInt(validated.v) });
|
|
208
|
+
const message = {
|
|
209
|
+
owner: validated.stealthAddress,
|
|
210
|
+
spender: cfg.relayerContract,
|
|
211
|
+
value: bal,
|
|
212
|
+
nonce,
|
|
213
|
+
deadline: BigInt(validated.deadline),
|
|
214
|
+
};
|
|
215
|
+
const types = {
|
|
216
|
+
Permit: [
|
|
217
|
+
{ name: 'owner', type: 'address' },
|
|
218
|
+
{ name: 'spender', type: 'address' },
|
|
219
|
+
{ name: 'value', type: 'uint256' },
|
|
220
|
+
{ name: 'nonce', type: 'uint256' },
|
|
221
|
+
{ name: 'deadline', type: 'uint256' },
|
|
222
|
+
],
|
|
223
|
+
};
|
|
224
|
+
const candidates = [
|
|
225
|
+
{ label: 'name=' + name + ',ver=1,chain=' + cfg.chainId,
|
|
226
|
+
domain: { name, version: '1', chainId: cfg.chainId, verifyingContract: validated.token } },
|
|
227
|
+
];
|
|
228
|
+
if (probedVersion !== 'unprobed' && probedVersion !== 'NOT_EXPOSED(fallback_to_1)') {
|
|
229
|
+
candidates.push({
|
|
230
|
+
label: 'name=' + name + ',ver=' + probedVersion + ',chain=' + cfg.chainId,
|
|
231
|
+
domain: { name, version: probedVersion, chainId: cfg.chainId, verifyingContract: validated.token },
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
const recoveries = [];
|
|
235
|
+
for (const c of candidates) {
|
|
236
|
+
const recovered = await recoverTypedDataAddress({
|
|
237
|
+
domain: c.domain,
|
|
238
|
+
types,
|
|
239
|
+
primaryType: 'Permit',
|
|
240
|
+
message,
|
|
241
|
+
signature: fullSig,
|
|
242
|
+
});
|
|
243
|
+
recoveries.push({
|
|
244
|
+
label: c.label,
|
|
245
|
+
recovered,
|
|
246
|
+
matches: recovered.toLowerCase() === validated.stealthAddress.toLowerCase(),
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
fastify.log.info({ recoveries, expectedStealth: validated.stealthAddress }, 'sig recovery probe');
|
|
250
|
+
}
|
|
251
|
+
catch (sigErr) {
|
|
252
|
+
fastify.log.warn({ name: sigErr instanceof Error ? sigErr.name : 'unknown', msg: sigErr instanceof Error ? sigErr.message.slice(0, 200) : '' }, 'sig recovery threw');
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
catch (probeErr) {
|
|
256
|
+
fastify.log.warn({ name: probeErr instanceof Error ? probeErr.name : 'unknown' }, 'preflight probe failed');
|
|
257
|
+
}
|
|
258
|
+
try {
|
|
259
|
+
const result = await relayRequest({
|
|
260
|
+
publicClient,
|
|
261
|
+
walletClient,
|
|
262
|
+
account,
|
|
263
|
+
relayerContract: cfg.relayerContract,
|
|
264
|
+
}, validated);
|
|
265
|
+
const body = {
|
|
266
|
+
ok: true,
|
|
267
|
+
txHash: result.txHash,
|
|
268
|
+
blockNumber: result.blockNumber.toString(),
|
|
269
|
+
};
|
|
270
|
+
return body;
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
const name = err instanceof Error ? err.name : 'RelayBroadcastError';
|
|
274
|
+
// Diagnostic: walk the cause chain and emit each viem error class +
|
|
275
|
+
// shortMessage (revert reason). These are public on-chain values, never
|
|
276
|
+
// key material. Logged via fastify.log.error so the operator can find
|
|
277
|
+
// the actual revert without surfacing it to clients.
|
|
278
|
+
const chain = [];
|
|
279
|
+
let cursor = err;
|
|
280
|
+
let depth = 0;
|
|
281
|
+
while (cursor instanceof Error && depth < 6) {
|
|
282
|
+
const sm = cursor.shortMessage;
|
|
283
|
+
const frame = { name: cursor.name };
|
|
284
|
+
if (sm !== undefined)
|
|
285
|
+
frame.shortMessage = sm;
|
|
286
|
+
chain.push(frame);
|
|
287
|
+
cursor = cursor.cause;
|
|
288
|
+
depth++;
|
|
289
|
+
}
|
|
290
|
+
fastify.log.error({ chain }, 'relay broadcast failed');
|
|
291
|
+
reply.status(502);
|
|
292
|
+
const body = { ok: false, error: name };
|
|
293
|
+
return body;
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
// ─── /relay-eth — P5.1 EIP-7702 ETH gasless sweep ─────────────────────
|
|
297
|
+
fastify.post('/relay-eth', async (req, reply) => {
|
|
298
|
+
// Refuse early if the operator hasn't pinned the deployed ETH relayer.
|
|
299
|
+
if (cfg.ethRelayerContract === undefined) {
|
|
300
|
+
reply.status(501);
|
|
301
|
+
const body = {
|
|
302
|
+
ok: false,
|
|
303
|
+
error: new EthRelayerNotConfiguredError().name,
|
|
304
|
+
};
|
|
305
|
+
return body;
|
|
306
|
+
}
|
|
307
|
+
let validated;
|
|
308
|
+
try {
|
|
309
|
+
validated = validateEthRequest(req.body);
|
|
310
|
+
}
|
|
311
|
+
catch (err) {
|
|
312
|
+
const name = err instanceof Error ? err.name : 'InvalidRelayEthRequestError';
|
|
313
|
+
reply.status(400);
|
|
314
|
+
const body = { ok: false, error: name };
|
|
315
|
+
return body;
|
|
316
|
+
}
|
|
317
|
+
// Defence in depth: the authorization MUST delegate to the configured
|
|
318
|
+
// ETH relayer contract. A mismatch means either (a) the SDK is talking
|
|
319
|
+
// to a different deployment, or (b) someone is trying to delegate to an
|
|
320
|
+
// attacker contract via this relayer. Either way, refuse.
|
|
321
|
+
if (getAddress(validated.authorization.address) !==
|
|
322
|
+
getAddress(cfg.ethRelayerContract)) {
|
|
323
|
+
reply.status(400);
|
|
324
|
+
const body = {
|
|
325
|
+
ok: false,
|
|
326
|
+
error: new AuthorizationContractMismatchError().name,
|
|
327
|
+
};
|
|
328
|
+
return body;
|
|
329
|
+
}
|
|
330
|
+
// Chain ID consistency: the SDK's chainId must match this service's chain.
|
|
331
|
+
if (validated.chainId !== cfg.chainId) {
|
|
332
|
+
reply.status(400);
|
|
333
|
+
const body = {
|
|
334
|
+
ok: false,
|
|
335
|
+
error: new InvalidRelayEthRequestError().name,
|
|
336
|
+
};
|
|
337
|
+
return body;
|
|
338
|
+
}
|
|
339
|
+
try {
|
|
340
|
+
const result = await relayEthRequest({ publicClient, walletClient, account }, validated);
|
|
341
|
+
const body = {
|
|
342
|
+
ok: true,
|
|
343
|
+
txHash: result.txHash,
|
|
344
|
+
blockNumber: result.blockNumber.toString(),
|
|
345
|
+
};
|
|
346
|
+
return body;
|
|
347
|
+
}
|
|
348
|
+
catch (err) {
|
|
349
|
+
const name = err instanceof Error ? err.name : 'RelayBroadcastError';
|
|
350
|
+
// Same cause-chain diagnostic as /relay. Public on-chain data only —
|
|
351
|
+
// never signatures or amounts.
|
|
352
|
+
const chain = [];
|
|
353
|
+
let cursor = err;
|
|
354
|
+
let depth = 0;
|
|
355
|
+
while (cursor instanceof Error && depth < 6) {
|
|
356
|
+
const sm = cursor.shortMessage;
|
|
357
|
+
const frame = { name: cursor.name };
|
|
358
|
+
if (sm !== undefined)
|
|
359
|
+
frame.shortMessage = sm;
|
|
360
|
+
chain.push(frame);
|
|
361
|
+
cursor = cursor.cause;
|
|
362
|
+
depth++;
|
|
363
|
+
}
|
|
364
|
+
fastify.log.error({ chain }, 'relay-eth broadcast failed');
|
|
365
|
+
reply.status(502);
|
|
366
|
+
const body = { ok: false, error: name };
|
|
367
|
+
return body;
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
return fastify;
|
|
371
|
+
}
|
|
372
|
+
export async function startServer(cfg) {
|
|
373
|
+
const fastify = await buildServer(cfg);
|
|
374
|
+
await fastify.listen({ port: cfg.port, host: '127.0.0.1' });
|
|
375
|
+
return fastify;
|
|
376
|
+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CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAkB;IAClD,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IAC5D,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* Inbound relay request from a browser/agent.
|
|
4
|
+
*
|
|
5
|
+
* Privacy invariants:
|
|
6
|
+
* - The stealth address's PRIVATE key NEVER appears here. Only the EIP-2612
|
|
7
|
+
* permit signature (v, r, s, deadline) + the public stealth address.
|
|
8
|
+
* - No `amount` field — the contract reads `balanceOf(stealth)` on-chain.
|
|
9
|
+
* - The relayer service NEVER logs the full body.
|
|
10
|
+
*/
|
|
11
|
+
export interface RelayRequest {
|
|
12
|
+
readonly token: Address;
|
|
13
|
+
readonly destination: Address;
|
|
14
|
+
readonly stealthAddress: Address;
|
|
15
|
+
readonly deadline: string;
|
|
16
|
+
readonly v: number;
|
|
17
|
+
readonly r: Hex;
|
|
18
|
+
readonly s: Hex;
|
|
19
|
+
}
|
|
20
|
+
export interface RelaySuccess {
|
|
21
|
+
readonly ok: true;
|
|
22
|
+
readonly txHash: Hex;
|
|
23
|
+
readonly blockNumber: string;
|
|
24
|
+
}
|
|
25
|
+
export interface RelayFailure {
|
|
26
|
+
readonly ok: false;
|
|
27
|
+
readonly error: string;
|
|
28
|
+
}
|
|
29
|
+
export type RelayResponse = RelaySuccess | RelayFailure;
|
|
30
|
+
export interface ServiceConfig {
|
|
31
|
+
readonly chainId: number;
|
|
32
|
+
readonly rpcUrl: string;
|
|
33
|
+
readonly relayerContract: Address;
|
|
34
|
+
readonly forwarderPrivateKey: Hex;
|
|
35
|
+
readonly allowedOrigins: readonly string[];
|
|
36
|
+
readonly port: number;
|
|
37
|
+
readonly rateLimitPerMinute: number;
|
|
38
|
+
/**
|
|
39
|
+
* When true, the /relay handler emits per-request preflight + EIP-712
|
|
40
|
+
* signature-recovery probe logs. These are valuable for debugging permit
|
|
41
|
+
* digest mismatches but produce one log line per request and surface
|
|
42
|
+
* (public) on-chain state. Off by default; enable only when troubleshooting.
|
|
43
|
+
*/
|
|
44
|
+
readonly debugDiagnostics?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Address of the ShroudFiEthRelayer contract for the P5.1 ETH gasless path.
|
|
47
|
+
* Used by /relay-eth as a defence-in-depth check that the inbound
|
|
48
|
+
* authorization's `address` field matches the deployed contract. When
|
|
49
|
+
* undefined, /relay-eth returns 501 Not Implemented.
|
|
50
|
+
*/
|
|
51
|
+
readonly ethRelayerContract?: Address;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Inbound /relay-eth request. The shape mirrors what
|
|
55
|
+
* @shroud-fi/relayer's relayedSweepETH serialises on the SDK side.
|
|
56
|
+
*
|
|
57
|
+
* Privacy invariants:
|
|
58
|
+
* - The stealth EOA's PRIVATE key NEVER appears here. Only the public
|
|
59
|
+
* stealth address + two signatures (EIP-7702 SET_CODE auth + EIP-712
|
|
60
|
+
* EthSweep).
|
|
61
|
+
* - The signature is a spending-authorisation credential bound to the
|
|
62
|
+
* specific (destination, deadline, chainId, stealthEOA) tuple. Never
|
|
63
|
+
* logged in full; only the class name of any error appears in server
|
|
64
|
+
* logs.
|
|
65
|
+
* - No `amount` field — the contract reads address(this).balance under
|
|
66
|
+
* EIP-7702 delegation.
|
|
67
|
+
*/
|
|
68
|
+
export interface RelayEthRequest {
|
|
69
|
+
readonly stealthAddress: Address;
|
|
70
|
+
readonly destination: Address;
|
|
71
|
+
readonly chainId: number;
|
|
72
|
+
readonly deadline: string;
|
|
73
|
+
readonly signature: Hex;
|
|
74
|
+
readonly authorization: {
|
|
75
|
+
readonly address: Address;
|
|
76
|
+
readonly chainId: number;
|
|
77
|
+
readonly nonce: number;
|
|
78
|
+
readonly r: Hex;
|
|
79
|
+
readonly s: Hex;
|
|
80
|
+
readonly yParity: 0 | 1;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;IAChB,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,YAAY,CAAC;AAExD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,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