@across-protocol/sdk 4.4.11 → 4.4.13
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/dist/cjs/src/arch/svm/eventsClient.js +5 -0
- package/dist/cjs/src/arch/svm/eventsClient.js.map +1 -1
- package/dist/cjs/src/clients/BundleDataClient/BundleDataClient.js +6 -0
- package/dist/cjs/src/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/src/clients/BundleDataClient/utils/FillUtils.d.ts +2 -1
- package/dist/cjs/src/clients/BundleDataClient/utils/FillUtils.js +8 -0
- package/dist/cjs/src/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/src/providers/retryProvider.js +9 -7
- package/dist/cjs/src/providers/retryProvider.js.map +1 -1
- package/dist/cjs/src/providers/solana/utils.js +2 -1
- package/dist/cjs/src/providers/solana/utils.js.map +1 -1
- package/dist/cjs/src/providers/utils.d.ts +1 -0
- package/dist/cjs/src/providers/utils.js +27 -0
- package/dist/cjs/src/providers/utils.js.map +1 -1
- package/dist/esm/src/arch/svm/eventsClient.js +22 -1
- package/dist/esm/src/arch/svm/eventsClient.js.map +1 -1
- package/dist/esm/src/clients/BundleDataClient/BundleDataClient.js +10 -1
- package/dist/esm/src/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/src/clients/BundleDataClient/utils/FillUtils.d.ts +7 -2
- package/dist/esm/src/clients/BundleDataClient/utils/FillUtils.js +14 -2
- package/dist/esm/src/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/src/providers/retryProvider.js +15 -10
- package/dist/esm/src/providers/retryProvider.js.map +1 -1
- package/dist/esm/src/providers/solana/utils.d.ts +2 -1
- package/dist/esm/src/providers/solana/utils.js +4 -3
- package/dist/esm/src/providers/solana/utils.js.map +1 -1
- package/dist/esm/src/providers/utils.d.ts +12 -0
- package/dist/esm/src/providers/utils.js +43 -0
- package/dist/esm/src/providers/utils.js.map +1 -1
- package/dist/types/src/arch/svm/eventsClient.d.ts.map +1 -1
- package/dist/types/src/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
- package/dist/types/src/clients/BundleDataClient/utils/FillUtils.d.ts +7 -2
- package/dist/types/src/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
- package/dist/types/src/providers/retryProvider.d.ts.map +1 -1
- package/dist/types/src/providers/solana/utils.d.ts +2 -1
- package/dist/types/src/providers/solana/utils.d.ts.map +1 -1
- package/dist/types/src/providers/utils.d.ts +12 -0
- package/dist/types/src/providers/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/arch/svm/eventsClient.ts +25 -1
- package/src/clients/BundleDataClient/BundleDataClient.ts +12 -0
- package/src/clients/BundleDataClient/utils/FillUtils.ts +24 -2
- package/src/providers/retryProvider.ts +27 -10
- package/src/providers/solana/utils.ts +4 -3
- package/src/providers/utils.ts +49 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FillUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/clients/BundleDataClient/utils/FillUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,
|
|
1
|
+
{"version":3,"file":"FillUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/clients/BundleDataClient/utils/FillUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAKL,OAAO,EACP,UAAU,EAEX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAAU,EAGE,CAAC;AAE7C;;;GAGG;AACH,KAAK,wBAAwB,GAAG,IAAI,GAAG;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAAC;AAElE;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,wBAAwB,EACnC,aAAa,EAAE,aAAa,EAC5B,wBAAwB,EAAE,MAAM,GAC/B;IACD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;CACzB,CA+BA;AACD;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,aAAa,EACpB,wBAAwB,EAAE,SAAS,CAAC,QAAQ,GAAG,WAAW,EAC1D,cAAc,EAAE,gBAAgB,EAChC,aAAa,EAAE,aAAa,EAC5B,wBAAwB,EAAE,MAAM,GAC/B,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CA0EpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryProvider.d.ts","sourceRoot":"","sources":["../../../../src/providers/retryProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"retryProvider.d.ts","sourceRoot":"","sources":["../../../../src/providers/retryProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAa1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,qBAAa,aAAc,SAAQ,MAAM,CAAC,SAAS,CAAC,qBAAqB;IAKrE,QAAQ,CAAC,mBAAmB,EAAE,MAAM;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,KAAK,EAAE,MAA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,CAAC;IAiBnB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,MAAM;CAqB3D"}
|
|
@@ -65,7 +65,8 @@ export interface JitoInterface extends SolanaRpcApi {
|
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Render an RPC error for log/wrap messages. For SolanaErrors, includes the numeric JSON-RPC
|
|
68
|
-
* code alongside the server message; otherwise falls back to
|
|
68
|
+
* code alongside the server message; otherwise falls back to a short, log-safe summary
|
|
69
|
+
* (`error.stack` / `error.toString()` can embed the failed RPC URL, including its API key).
|
|
69
70
|
*/
|
|
70
71
|
export declare function formatRpcError(error: unknown): string;
|
|
71
72
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/providers/solana/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/providers/solana/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAS3C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAElC,OAAO,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAIlC,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAChC;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACpB,qBAAqB,EAAE,iBAAiB,EAAE,CAAC;IAC3C,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,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC;CAChG,CAAC;AAGF,MAAM,WAAW,aAAc,SAAQ,YAAY;IAEjD,cAAc,CAAC,YAAY,EAAE;QAAE,mBAAmB,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,sBAAsB,CAAC;CAChH;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOrD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAkB3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAe1E"}
|
|
@@ -33,6 +33,18 @@ export interface RateLimitTask {
|
|
|
33
33
|
*/
|
|
34
34
|
export declare function formatProviderError(provider: providers.StaticJsonRpcProvider, rawErrorText: string): string;
|
|
35
35
|
export declare function createSendErrorWithMessage(message: string, sendError: unknown): Error;
|
|
36
|
+
/**
|
|
37
|
+
* Render a single-line, log-safe summary of a provider error.
|
|
38
|
+
*
|
|
39
|
+
* Prefers the parsed JSON-RPC error message (e.g. `execution reverted: …`),
|
|
40
|
+
* falling back to ethers' short `.reason` and `.code` fields. Avoids
|
|
41
|
+
* `err.message` / `err.stack` for ethers-shaped errors because, at the
|
|
42
|
+
* transport layer, they embed the failed RPC URL with its API key.
|
|
43
|
+
*
|
|
44
|
+
* The original error remains reachable via `error.cause` on the aggregate
|
|
45
|
+
* thrown error, so callers that want full forensic detail still have it.
|
|
46
|
+
*/
|
|
47
|
+
export declare function summarizeProviderError(err: unknown): string;
|
|
36
48
|
/**
|
|
37
49
|
* Validate and parse a possible JSON-RPC error response.
|
|
38
50
|
* @param error An unknown error object received in response to a JSON-RPC request.
|
|
@@ -1 +1 @@
|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from "../../interfaces";
|
|
|
17
17
|
import { unwrapEventData } from "./";
|
|
18
18
|
import assert from "assert";
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Anchor emits CPI events (`emit_cpi!`) as a *self*-invocation of the program that targets its
|
|
22
|
+
* `__event_authority` PDA and prefixes the instruction data with this fixed 8-byte discriminator,
|
|
23
|
+
* followed by the 8-byte event discriminator and the Borsh event payload. The wire bytes are the
|
|
24
|
+
* little-endian encoding of Anchor's `EVENT_IX_TAG: u64 = 0x1d9acb512ea545e4` (the first 8 bytes of
|
|
25
|
+
* `sha256("anchor:event")` read as a big-endian u64) — i.e. the digest prefix in *reversed* byte
|
|
26
|
+
* order. Checking this prefix is what proves an inner instruction is a genuine emitted event and
|
|
27
|
+
* not just some other instruction that happens to touch the program. Without it, any program can
|
|
28
|
+
* forge an event by CPI-ing into the SpokePool with the event authority passed as the sole account
|
|
29
|
+
* and attacker-controlled trailing data (e.g. via the read-only `GetUnsafeDepositId` instruction),
|
|
30
|
+
* which the client would otherwise decode as a real FundsDeposited/FilledRelay event.
|
|
31
|
+
*/
|
|
32
|
+
const ANCHOR_CPI_EVENT_DISCRIMINATOR = Buffer.from([0xe4, 0x45, 0xa5, 0x2e, 0x51, 0xcb, 0x9a, 0x1d]);
|
|
33
|
+
|
|
20
34
|
// Utility type to extract the return type for the JSON encoding overload. We only care about the overload where the
|
|
21
35
|
// configuration parameter (C) has the optional property 'encoding' set to 'json'.
|
|
22
36
|
type ExtractJsonOverload<T> = T extends (signature: infer _S, config: infer C) => infer R
|
|
@@ -213,7 +227,17 @@ export class SvmCpiEventsClient {
|
|
|
213
227
|
this.programEventAuthority === singleIxAccount
|
|
214
228
|
) {
|
|
215
229
|
const ixData = bs58.decode(ix.data);
|
|
216
|
-
//
|
|
230
|
+
// Only decode genuine Anchor CPI events. The instruction data of an emitted event is
|
|
231
|
+
// prefixed with the Anchor event discriminator; requiring it prevents an arbitrary CPI
|
|
232
|
+
// into the program (with the event authority as its sole account and crafted trailing
|
|
233
|
+
// bytes) from being decoded as a forged event.
|
|
234
|
+
if (
|
|
235
|
+
ixData.length < ANCHOR_CPI_EVENT_DISCRIMINATOR.length ||
|
|
236
|
+
!ANCHOR_CPI_EVENT_DISCRIMINATOR.equals(Buffer.from(ixData.slice(0, ANCHOR_CPI_EVENT_DISCRIMINATOR.length)))
|
|
237
|
+
) {
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
// Skip the 8-byte Anchor event discriminator and decode the remaining event payload.
|
|
217
241
|
const eventData = Buffer.from(ixData.slice(8)).toString("base64");
|
|
218
242
|
const { name, data } = decodeEvent(this.idl, eventData);
|
|
219
243
|
events.push({ program: this.programAddress, name, data });
|
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
} from "../../utils";
|
|
50
50
|
import winston from "winston";
|
|
51
51
|
import {
|
|
52
|
+
BLOCKED_ADDRESSES,
|
|
52
53
|
BundleDataSS,
|
|
53
54
|
BundleData as PersistedArweaveBundleData,
|
|
54
55
|
getRefundInformationFromFill,
|
|
@@ -71,6 +72,11 @@ function updateExpiredDepositsV3(dict: ExpiredDepositsToRefundV3, deposit: V3Dep
|
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
// Protocol rule: never refund deposits from blocked depositors.
|
|
76
|
+
if (BLOCKED_ADDRESSES.some((blockedAddress) => blockedAddress.eq(deposit.depositor))) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
74
80
|
const { originChainId, inputToken } = deposit;
|
|
75
81
|
dict[originChainId] ??= {};
|
|
76
82
|
dict[originChainId][inputToken.toBytes32()] ??= [];
|
|
@@ -149,6 +155,12 @@ function updateBundleSlowFills(dict: BundleSlowFills, deposit: V3DepositWithBloc
|
|
|
149
155
|
return;
|
|
150
156
|
}
|
|
151
157
|
|
|
158
|
+
// Protocol rule: never slow fill deposits with blocked recipients; the deposit instead expires and is
|
|
159
|
+
// refunded to the depositor.
|
|
160
|
+
if (BLOCKED_ADDRESSES.some((blockedAddress) => blockedAddress.eq(deposit.recipient))) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
152
164
|
const { destinationChainId, outputToken } = deposit;
|
|
153
165
|
dict[destinationChainId] ??= {};
|
|
154
166
|
dict[destinationChainId][outputToken.toBytes32()] ??= [];
|
|
@@ -2,10 +2,27 @@ import _ from "lodash";
|
|
|
2
2
|
import assert from "assert";
|
|
3
3
|
import { providers } from "ethers";
|
|
4
4
|
import { DepositWithBlock, Fill, FillWithBlock } from "../../../interfaces";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
isSlowFill,
|
|
7
|
+
isValidEvmAddress,
|
|
8
|
+
isDefined,
|
|
9
|
+
chainIsEvm,
|
|
10
|
+
Address,
|
|
11
|
+
EvmAddress,
|
|
12
|
+
toAddressType,
|
|
13
|
+
} from "../../../utils";
|
|
6
14
|
import { HubPoolClient } from "../../HubPoolClient";
|
|
7
15
|
import { SVMProvider } from "../../../arch/svm";
|
|
8
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @notice Addresses that must never be paid out of a root bundle (as repayment, deposit refund, or slow fill).
|
|
19
|
+
* Protocol rule: all proposers and validators must apply this list identically.
|
|
20
|
+
*/
|
|
21
|
+
export const BLOCKED_ADDRESSES: EvmAddress[] = [
|
|
22
|
+
"0xA6fb971F3B7a9b9F76EdA76bc89268fe26560189",
|
|
23
|
+
"0xa0c0e9f307b5a26ca3fb5891c19154fc7a02bef7",
|
|
24
|
+
].map((address) => EvmAddress.from(address));
|
|
25
|
+
|
|
9
26
|
/**
|
|
10
27
|
* @notice FillRepaymentInformation is a fill with additional properties required to determine where it can
|
|
11
28
|
* be repaid.
|
|
@@ -62,7 +79,7 @@ export function getRefundInformationFromFill(
|
|
|
62
79
|
* @notice Verifies that the fill can be repaid. If the repayment address is not
|
|
63
80
|
* valid for the requested repayment chain, then this function will attempt to change the fill's repayment chain
|
|
64
81
|
* to the destination chain and its repayment address to the msg.sender and if this is possible,
|
|
65
|
-
* return the fill. Otherwise, return undefined.
|
|
82
|
+
* return the fill. Otherwise, return undefined. Fills repaying a BLOCKED_ADDRESSES entry are always unrepayable.
|
|
66
83
|
* @param _fill Fill with a requested repayment chain and address
|
|
67
84
|
* @return Fill with the applied repayment chain (depends on the validity of the requested repayment address)
|
|
68
85
|
* and applied repayment address, or undefined if the applied repayment address is not valid for the
|
|
@@ -139,6 +156,11 @@ export async function verifyFillRepayment(
|
|
|
139
156
|
}
|
|
140
157
|
}
|
|
141
158
|
|
|
159
|
+
// Protocol rule: never repay blocked addresses (checked after any msg.sender overwrite above).
|
|
160
|
+
if (BLOCKED_ADDRESSES.some((blockedAddress) => blockedAddress.eq(fill.relayer))) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
|
|
142
164
|
// Repayment address is now valid and repayment chain is either origin chain for lite chain or the destination
|
|
143
165
|
// chain for cases where the repayment address was invalid. Fill should be valid now.
|
|
144
166
|
fill.repaymentChainId = repaymentChainId;
|
|
@@ -4,7 +4,13 @@ import { CHAIN_IDs } from "../constants";
|
|
|
4
4
|
import { delay, isDefined, isPromiseFulfilled, isPromiseRejected } from "../utils";
|
|
5
5
|
import { getOriginFromURL } from "../utils/NetworkUtils";
|
|
6
6
|
import { CacheProvider } from "./cachedProvider";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
compareRpcResults,
|
|
9
|
+
createSendErrorWithMessage,
|
|
10
|
+
formatProviderError,
|
|
11
|
+
parseJsonRpcError,
|
|
12
|
+
summarizeProviderError,
|
|
13
|
+
} from "./utils";
|
|
8
14
|
import { PROVIDER_CACHE_TTL } from "./constants";
|
|
9
15
|
import { Logger } from "winston";
|
|
10
16
|
|
|
@@ -82,9 +88,11 @@ export class RetryProvider extends ethers.providers.StaticJsonRpcProvider {
|
|
|
82
88
|
return this._trySend(provider, method, params)
|
|
83
89
|
.then((result): [ethers.providers.StaticJsonRpcProvider, unknown] => [provider, result])
|
|
84
90
|
.catch((err: unknown) => {
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
|
|
91
|
+
// Record a short, log-safe summary of the failure. We intentionally do not retain
|
|
92
|
+
// `err.stack` / `err.toString()` here: for ethers transport errors those embed the
|
|
93
|
+
// failed RPC URL (including its API key) and a multi-line stack trace, which then
|
|
94
|
+
// get concatenated into the aggregate error message and surfaced to logs.
|
|
95
|
+
errors.push([provider, summarizeProviderError(err)]);
|
|
88
96
|
|
|
89
97
|
// If there are no new fallback providers to use, terminate the recursion by throwing an error.
|
|
90
98
|
// Otherwise, we can try to call another provider.
|
|
@@ -128,7 +136,10 @@ export class RetryProvider extends ethers.providers.StaticJsonRpcProvider {
|
|
|
128
136
|
return values[0][1];
|
|
129
137
|
}
|
|
130
138
|
|
|
131
|
-
const getMismatchedProviders = (
|
|
139
|
+
const getMismatchedProviders = (
|
|
140
|
+
quorumResult: unknown,
|
|
141
|
+
values: [ethers.providers.StaticJsonRpcProvider, unknown][]
|
|
142
|
+
) => {
|
|
132
143
|
return values
|
|
133
144
|
.filter(([, result]) => !compareRpcResults(method, result, quorumResult))
|
|
134
145
|
.map(([provider]) => getOriginFromURL(provider.connection.url));
|
|
@@ -153,10 +164,16 @@ export class RetryProvider extends ethers.providers.StaticJsonRpcProvider {
|
|
|
153
164
|
});
|
|
154
165
|
};
|
|
155
166
|
|
|
156
|
-
const throwQuorumError = (
|
|
167
|
+
const throwQuorumError = (quorum?: {
|
|
168
|
+
quorumResult: unknown;
|
|
169
|
+
fallbackValues: [ethers.providers.StaticJsonRpcProvider, unknown][];
|
|
170
|
+
}) => {
|
|
157
171
|
const errorTexts = errors.map(([provider, errorText]) => formatProviderError(provider, errorText));
|
|
158
172
|
const successfulProviderUrls = values.map(([provider]) => getOriginFromURL(provider.connection.url));
|
|
159
|
-
|
|
173
|
+
// On the early-exit path (no fallback providers left) no quorum result exists to compare mismatches against.
|
|
174
|
+
const mismatchedProviders = quorum
|
|
175
|
+
? getMismatchedProviders(quorum.quorumResult, [...values, ...quorum.fallbackValues])
|
|
176
|
+
: [];
|
|
160
177
|
logQuorumMismatchOrFailureDetails(method, params, successfulProviderUrls, mismatchedProviders, errors);
|
|
161
178
|
throw new Error(
|
|
162
179
|
"Not enough providers agreed to meet quorum.\n" +
|
|
@@ -178,7 +195,7 @@ export class RetryProvider extends ethers.providers.StaticJsonRpcProvider {
|
|
|
178
195
|
this._trySend(provider, method, params)
|
|
179
196
|
.then((result): [ethers.providers.StaticJsonRpcProvider, unknown] => [provider, result])
|
|
180
197
|
.catch((err) => {
|
|
181
|
-
errors.push([provider, err
|
|
198
|
+
errors.push([provider, summarizeProviderError(err)]);
|
|
182
199
|
throw new Error("No fallbacks during quorum search");
|
|
183
200
|
})
|
|
184
201
|
)
|
|
@@ -216,11 +233,11 @@ export class RetryProvider extends ethers.providers.StaticJsonRpcProvider {
|
|
|
216
233
|
|
|
217
234
|
// If this count is less than we need for quorum, throw the quorum error.
|
|
218
235
|
if (count < quorumThreshold) {
|
|
219
|
-
throwQuorumError(fallbackValues);
|
|
236
|
+
throwQuorumError({ quorumResult, fallbackValues });
|
|
220
237
|
}
|
|
221
238
|
|
|
222
239
|
// If we've achieved quorum, then we should still log the providers that mismatched with the quorum result.
|
|
223
|
-
const mismatchedProviders = getMismatchedProviders([...values, ...fallbackValues]);
|
|
240
|
+
const mismatchedProviders = getMismatchedProviders(quorumResult, [...values, ...fallbackValues]);
|
|
224
241
|
const quorumProviders = [...values, ...fallbackValues]
|
|
225
242
|
.filter(([, result]) => compareRpcResults(method, result, quorumResult))
|
|
226
243
|
.map(([provider]) => getOriginFromURL(provider.connection.url));
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
SVM_LONG_TERM_STORAGE_SLOT_SKIPPED,
|
|
7
7
|
SVM_TRANSACTION_PREFLIGHT_FAILURE,
|
|
8
8
|
} from "../../arch/svm";
|
|
9
|
+
import { summarizeProviderError } from "../utils";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* This is the type we pass to define a Solana RPC request "task".
|
|
@@ -65,7 +66,8 @@ export interface JitoInterface extends SolanaRpcApi {
|
|
|
65
66
|
|
|
66
67
|
/**
|
|
67
68
|
* Render an RPC error for log/wrap messages. For SolanaErrors, includes the numeric JSON-RPC
|
|
68
|
-
* code alongside the server message; otherwise falls back to
|
|
69
|
+
* code alongside the server message; otherwise falls back to a short, log-safe summary
|
|
70
|
+
* (`error.stack` / `error.toString()` can embed the failed RPC URL, including its API key).
|
|
69
71
|
*/
|
|
70
72
|
export function formatRpcError(error: unknown): string {
|
|
71
73
|
if (isSolanaError(error)) {
|
|
@@ -73,8 +75,7 @@ export function formatRpcError(error: unknown): string {
|
|
|
73
75
|
const message = serverMessage ?? (error as { message?: string }).message ?? "";
|
|
74
76
|
return `SolanaError [${code}]: ${message}`;
|
|
75
77
|
}
|
|
76
|
-
|
|
77
|
-
return (error as any)?.stack || (error as any)?.toString?.() || String(error);
|
|
78
|
+
return summarizeProviderError(error);
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
/**
|
package/src/providers/utils.ts
CHANGED
|
@@ -147,6 +147,55 @@ export function createSendErrorWithMessage(message: string, sendError: unknown):
|
|
|
147
147
|
return new Error(message, { cause: sendError });
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Render a single-line, log-safe summary of a provider error.
|
|
152
|
+
*
|
|
153
|
+
* Prefers the parsed JSON-RPC error message (e.g. `execution reverted: …`),
|
|
154
|
+
* falling back to ethers' short `.reason` and `.code` fields. Avoids
|
|
155
|
+
* `err.message` / `err.stack` for ethers-shaped errors because, at the
|
|
156
|
+
* transport layer, they embed the failed RPC URL with its API key.
|
|
157
|
+
*
|
|
158
|
+
* The original error remains reachable via `error.cause` on the aggregate
|
|
159
|
+
* thrown error, so callers that want full forensic detail still have it.
|
|
160
|
+
*/
|
|
161
|
+
export function summarizeProviderError(err: unknown): string {
|
|
162
|
+
if (err === null || err === undefined) {
|
|
163
|
+
return "unknown error";
|
|
164
|
+
}
|
|
165
|
+
if (typeof err === "string") {
|
|
166
|
+
return err;
|
|
167
|
+
}
|
|
168
|
+
if (typeof err !== "object") {
|
|
169
|
+
return String(err);
|
|
170
|
+
}
|
|
171
|
+
const e = err as { error?: unknown; reason?: string; code?: string; message?: string };
|
|
172
|
+
|
|
173
|
+
// Ethers may carry the upstream JSON-RPC body either on the top-level error (SERVER_ERROR shape)
|
|
174
|
+
// or one level down on `err.error`. Surface its `message` if we can parse it.
|
|
175
|
+
const rpcError = parseJsonRpcError(err) ?? parseJsonRpcError(e.error);
|
|
176
|
+
if (rpcError?.message) {
|
|
177
|
+
return rpcError.message;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Ethers populates `.reason` with a short, URL-free description ("processing response error",
|
|
181
|
+
// "execution reverted", etc.) — safe to surface.
|
|
182
|
+
if (typeof e.reason === "string" && e.reason.length > 0) {
|
|
183
|
+
return e.reason;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Non-ethers errors (no `code` / no `reason`) — fall back to `.message`, which is safe here
|
|
187
|
+
// because there's no transport-layer URL to leak.
|
|
188
|
+
if (e.code === undefined && typeof e.message === "string" && e.message.length > 0) {
|
|
189
|
+
return e.message;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (typeof e.code === "string" && e.code.length > 0) {
|
|
193
|
+
return e.code;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return "unknown error";
|
|
197
|
+
}
|
|
198
|
+
|
|
150
199
|
/**
|
|
151
200
|
* Validate and parse a possible JSON-RPC error response.
|
|
152
201
|
* @param error An unknown error object received in response to a JSON-RPC request.
|