Skip to content

chore: Bump SDK #2191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"node": ">=20.18.0"
},
"dependencies": {
"@across-protocol/constants": "^3.1.52",
"@across-protocol/constants": "^3.1.61",
"@across-protocol/contracts": "^4.0.5",
"@across-protocol/sdk": "4.1.46",
"@across-protocol/sdk": "4.1.52",
"@arbitrum/sdk": "^4.0.2",
"@consensys/linea-sdk": "^0.2.1",
"@defi-wonderland/smock": "^2.3.5",
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/BaseChainAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export class BaseChainAdapter {
const _totalAmount = outstandingInitiatedEvents.reduce((acc, event) => acc.add(event.amount), finalizedSum);
assign(outstandingTransfers, [monitoredAddress.toAddress(), l1Token.toAddress(), l2Token], {
totalAmount: _totalAmount.gt(bnZero) ? _totalAmount : bnZero,
depositTxHashes: outstandingInitiatedEvents.map((event) => event.transactionHash),
depositTxHashes: outstandingInitiatedEvents.map((event) => event.txnRef),
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/adapter/bridges/LineaWethBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ export class LineaWethBridge extends BaseBridgeAdapter {
? {
...processEvent(queryEvent, "_value"),
blockNumber: finalized.blockNumber,
transactionIndex: finalized.transactionIndex,
txnIndex: finalized.transactionIndex,
logIndex: finalized.logIndex,
transactionHash: finalized.transactionHash,
txnRef: finalized.transactionHash,
}
: undefined;
})
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function approveTokens(
let internalMrkdwn =
` - Approved canonical ${spokeNetwork} token bridge ${blockExplorerLink(bridge.toAddress(), hubChainId)} ` +
`to spend ${await l1Token.symbol()} ${blockExplorerLink(l1Token.address, hubChainId)} on ${hubNetwork}.` +
`tx: ${blockExplorerLink(receipts[receipts.length - 1].transactionHash, hubChainId)}`;
`tx: ${blockExplorerLink(receipts.at(-1).transactionHash, hubChainId)}`;
if (receipts.length > 1) {
internalMrkdwn += ` tx (to zero approval first): ${blockExplorerLink(receipts[0].transactionHash, hubChainId)}`;
}
Expand Down
4 changes: 2 additions & 2 deletions src/clients/ConfigStoreClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ export class ConfigStoreClient extends clients.AcrossConfigStoreClient {
// Partially create the meta-data information regarding the injected chain id inclusion
const partialChainIdIndicesUpdate = {
blockNumber: injectedBlockNumber,
transactionIndex: 0,
txnIndex: 0,
logIndex: 0,
transactionHash: "",
txnRef: "",
};

// We need to now resolve the last chain id indices update
Expand Down
6 changes: 3 additions & 3 deletions src/clients/InventoryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ export class InventoryClient {
upcomingDeposits: upcomingDepositsAfterLastValidatedBundle,
upcomingRefunds: upcomingRefundsAfterLastValidatedBundle,
bundleEndBlock: lastValidatedBundleEndBlock,
proposedRootBundle: proposedRootBundle?.transactionHash,
proposedRootBundle: proposedRootBundle?.txnRef,
},
];
})
Expand Down Expand Up @@ -1342,14 +1342,14 @@ export class InventoryClient {
const chainId = Number(_chainId);
txnReceipts[chainId] = [];
await sdkUtils.forEachAsync(withdrawalsRequired[chainId], async (withdrawal) => {
const txnHash = await this.adapterManager.withdrawTokenFromL2(
const txnRef = await this.adapterManager.withdrawTokenFromL2(
this.relayer,
chainId,
withdrawal.l2Token,
withdrawal.amountToWithdraw,
this.simMode
);
txnReceipts[chainId].push(...txnHash);
txnReceipts[chainId].push(...txnRef);
});
});
Object.keys(txnReceipts).forEach((chainId) => {
Expand Down
10 changes: 5 additions & 5 deletions src/clients/MultiCallerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class MultiCallerClient {
const results = await Promise.allSettled(chainIds.map((chainId) => this.executeTxnQueue(chainId, simulate)));

// Collate the results for each chain.
const txnHashes: Record<number, { result: string[]; isError: boolean }> = Object.fromEntries(
const txnRefes: Record<number, { result: string[]; isError: boolean }> = Object.fromEntries(
results.map((result, idx) => {
const chainId = chainIds[idx];
if (isPromiseFulfilled(result)) {
Expand All @@ -151,24 +151,24 @@ export class MultiCallerClient {
// We need to iterate over the results to determine if any of the transactions failed.
// If any of the transactions failed, we need to log the results and throw an error. However, we want to
// only log the results once, so we need to collate the results into a single object.
const failedChains = Object.entries(txnHashes)
const failedChains = Object.entries(txnRefes)
.filter(([, { isError }]) => isError)
.map(([chainId]) => chainId);
if (failedChains.length > 0) {
// Log the results.
this.logger.error({
at: "MultiCallerClient#executeTxnQueues",
message: `Failed to execute ${failedChains.length} transaction(s) on chain(s) ${failedChains.join(", ")}`,
error: failedChains.map((chainId) => txnHashes[chainId].result),
error: failedChains.map((chainId) => txnRefes[chainId].result),
});
throw new Error(
`Failed to execute ${failedChains.length} transaction(s) on chain(s) ${failedChains.join(
", "
)}: ${JSON.stringify(txnHashes)}`
)}: ${JSON.stringify(txnRefes)}`
);
}
// Recombine the results into a single object that match the legacy implementation.
return Object.fromEntries(Object.entries(txnHashes).map(([chainId, { result }]) => [chainId, result]));
return Object.fromEntries(Object.entries(txnRefes).map(([chainId, { result }]) => [chainId, result]));
}

// For a single chain, take any enqueued transactions and attempt to execute them.
Expand Down
4 changes: 2 additions & 2 deletions src/clients/bridges/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ export async function approveTokens(
let internalMrkdwn =
` - Approved canonical ${spokeNetwork} token bridge ${blockExplorerLink(bridge.toAddress(), hubChainId)} ` +
`to spend ${await l1Token.symbol()} ${blockExplorerLink(l1Token.address, hubChainId)} on ${hubNetwork}.` +
`tx: ${blockExplorerLink(receipts[receipts.length - 1].transactionHash, hubChainId)}`;
`tx: ${blockExplorerLink(receipts[receipts.length - 1].txnRef, hubChainId)}`;
if (receipts.length > 1) {
internalMrkdwn += ` tx (to zero approval first): ${blockExplorerLink(receipts[0].transactionHash, hubChainId)}`;
internalMrkdwn += ` tx (to zero approval first): ${blockExplorerLink(receipts[0].txnRef, hubChainId)}`;
}
return internalMrkdwn;
});
Expand Down
12 changes: 6 additions & 6 deletions src/dataworker/Dataworker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class Dataworker {
shouldWait: true,
poolRebalanceLeafExecutionBlocks,
mainnetBundleEndBlock,
mostRecentProposedRootBundle: mostRecentProposedRootBundle.transactionHash,
mostRecentProposedRootBundle: mostRecentProposedRootBundle.txnRef,
expectedPoolRebalanceLeaves,
executedPoolRebalanceLeaves: executedPoolRebalanceLeaves.length,
};
Expand All @@ -268,7 +268,7 @@ export class Dataworker {
poolRebalanceLeafExecutionBlocks,
mainnetBundleEndBlock,
minimumMainnetBundleEndBlockToPropose,
mostRecentProposedRootBundle: mostRecentProposedRootBundle.transactionHash,
mostRecentProposedRootBundle: mostRecentProposedRootBundle.txnRef,
};
}
}
Expand Down Expand Up @@ -1088,7 +1088,7 @@ export class Dataworker {
message:
"Cannot validate bundle with insufficient event data. Set a larger DATAWORKER_FAST_LOOKBACK_COUNT",
invalidBlockRanges,
bundleTxn: matchingRootBundle.transactionHash,
bundleTxn: matchingRootBundle.txnRef,
});
continue;
}
Expand All @@ -1108,7 +1108,7 @@ export class Dataworker {
chainId,
rootBundleRelay,
mainnetRootBundleBlock: matchingRootBundle.blockNumber,
mainnetRootBundleTxn: matchingRootBundle.transactionHash,
mainnetRootBundleTxn: matchingRootBundle.txnRef,
publishedSlowRelayRoot: rootBundleRelay.slowRelayRoot,
constructedSlowRelayRoot: tree.getHexRoot(),
});
Expand Down Expand Up @@ -2133,7 +2133,7 @@ export class Dataworker {
at: "Dataworke#executeRelayerRefundLeaves",
message: "Cannot validate bundle with insufficient event data. Set a larger DATAWORKER_FAST_LOOKBACK_COUNT",
invalidBlockRanges,
bundleTxn: matchingRootBundle.transactionHash,
bundleTxn: matchingRootBundle.txnRef,
});
continue;
}
Expand All @@ -2152,7 +2152,7 @@ export class Dataworker {
chainId,
rootBundleRelay,
mainnetRootBundleBlock: matchingRootBundle.blockNumber,
mainnetRootBundleTxn: matchingRootBundle.transactionHash,
mainnetRootBundleTxn: matchingRootBundle.txnRef,
publishedRelayerRefundRoot: rootBundleRelay.relayerRefundRoot,
constructedRelayerRefundRoot: tree.getHexRoot(),
});
Expand Down
4 changes: 2 additions & 2 deletions src/dataworker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ export async function runDataworker(_logger: winston.Logger, baseSigner: Signer)
dataworkerFastLookbackCount: config.dataworkerFastLookbackCount,
fromBlocks,
toBlocks,
fromBundleTxn: fromBundle?.transactionHash,
toBundleTxn: toBundle?.transactionHash,
fromBundleTxn: fromBundle?.txnRef,
toBundleTxn: toBundle?.txnRef,
});
const spokePoolClients = await constructSpokePoolClientsForFastDataworker(
logger,
Expand Down
12 changes: 4 additions & 8 deletions src/finalizer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export async function finalize(
// unpermissioned (i.e. msg.sender can be anyone). If this is not true for any chain then we'd need to use
// the TransactionClient.
const multicallerClient = new MultiCallerClient(logger);
let txnHashLookup: Record<number, string[]> = {};
let txnRefLookup: Record<number, string[]> = {};
try {
const finalizationsByChain = groupBy(
finalizations,
Expand All @@ -371,7 +371,7 @@ export async function finalize(
};
multicallerClient.enqueueTransaction(txnToSubmit);
}
txnHashLookup = await multicallerClient.executeTxnQueues(!submitFinalizationTransactions);
txnRefLookup = await multicallerClient.executeTxnQueues(!submitFinalizationTransactions);
} catch (_error) {
const error = _error as Error;
logger.warn({
Expand Down Expand Up @@ -406,9 +406,7 @@ export async function finalize(
at: "Finalizer",
message: `Submitted ${miscReason} on ${destinationNetwork}`,
infoLogMessage,
transactionHashList: txnHashLookup[destinationChainId]?.map((txnHash) =>
blockExplorerLink(txnHash, destinationChainId)
),
txnRefList: txnRefLookup[destinationChainId]?.map((txnRef) => blockExplorerLink(txnRef, destinationChainId)),
});
});
transfers.forEach(
Expand All @@ -418,9 +416,7 @@ export async function finalize(
logger.info({
at: "Finalizer",
message: `Finalized ${originationNetwork} ${type} on ${destinationNetwork} for ${amount} ${symbol} 🪃`,
transactionHashList: txnHashLookup[destinationChainId]?.map((txnHash) =>
blockExplorerLink(txnHash, destinationChainId)
),
txnRefList: txnRefLookup[destinationChainId]?.map((txnRef) => blockExplorerLink(txnRef, destinationChainId)),
});
}
);
Expand Down
9 changes: 5 additions & 4 deletions src/finalizer/utils/arbStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ export async function arbStackFinalizer(
),
{
...spokePoolClient.eventSearchConfig,

toBlock: latestBlockToFinalize,
}
);
Expand Down Expand Up @@ -195,14 +194,16 @@ export async function arbStackFinalizer(
];
// If there are any found withdrawal initiated events, then add them to the list of TokenBridged events we'll
// submit proofs and finalizations for.
_withdrawalEvents.forEach((event) => {
_withdrawalEvents.forEach(({ transactionHash, transactionIndex, ...event }) => {
try {
const tokenBridgedEvent: TokensBridged = {
...event,
amountToReturn: event.amount,
chainId,
leafId: 0,
l2TokenAddress: event.l2TokenAddress,
txnRef: transactionHash,
txnIndex: transactionIndex,
};
withdrawalEvents.push(tokenBridgedEvent);
} catch (err) {
Expand Down Expand Up @@ -342,14 +343,14 @@ async function getMessageOutboxStatusAndProof(
}> {
const networkName = getNetworkName(chainId);
const l2Provider = getCachedProvider(chainId, true);
const receipt = await l2Provider.getTransactionReceipt(event.transactionHash);
const receipt = await l2Provider.getTransactionReceipt(event.txnRef);
const l2Receipt = new ChildTransactionReceipt(receipt);

try {
const l2ToL1Messages = await l2Receipt.getChildToParentMessages(l1Signer);
if (l2ToL1Messages.length === 0 || l2ToL1Messages.length - 1 < logIndex) {
const error = new Error(
`No outgoing messages found in transaction:${event.transactionHash} for l2 token ${event.l2TokenAddress}`
`No outgoing messages found in transaction:${event.txnRef} for l2 token ${event.l2TokenAddress}`
);
logger.warn({
at: `Finalizer#${networkName}Finalizer`,
Expand Down
8 changes: 3 additions & 5 deletions src/finalizer/utils/linea/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ export async function findMessageFromTokenBridge(
);
const messageSent = messageServiceContract.contract.interface.getEventTopic("MessageSent");
const associatedMessages = await Promise.all(
bridgeEvents.map(async (event) => {
const { logs } = await bridgeContract.provider.getTransactionReceipt(event.transactionHash);
bridgeEvents.map(async ({ args, transactionHash }) => {
const { logs } = await bridgeContract.provider.getTransactionReceipt(transactionHash);
return logs
.filter((log) => log.topics[0] === messageSent)
.map((log) => ({
Expand All @@ -278,9 +278,7 @@ export async function findMessageFromTokenBridge(
// Start with the TokenBridge calldata format.
try {
const decoded = bridgeContract.interface.decodeFunctionData("completeBridging", log.args._calldata);
return (
compareAddressesSimple(decoded._recipient, event.args.recipient) && decoded._amount.eq(event.args.amount)
);
return compareAddressesSimple(decoded._recipient, args.recipient) && decoded._amount.eq(args.amount);
} catch (_e) {
// We don't care about this because we have more to check
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/finalizer/utils/linea/l2ToL1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export async function lineaL2ToL1Finalizer(
);

// Get Linea's MessageSent events for each src event
const uniqueTxHashes = Array.from(new Set(l2SrcEvents.map((event) => event.transactionHash)));
const uniqueTxHashes = Array.from(new Set(l2SrcEvents.map(({ txnRef }) => txnRef)));
const relevantMessages = (
await Promise.all(uniqueTxHashes.map((txHash) => getMessagesWithStatusByTxHash(txHash)))
).flat();
Expand Down Expand Up @@ -307,7 +307,7 @@ export async function lineaL2ToL1Finalizer(

function mergeMessagesWithTokensBridged(messages: MessageWithStatus[], allTokensBridgedEvents: TokensBridged[]) {
const messagesByTxHash = groupBy(messages, ({ txHash }) => txHash);
const tokensBridgedEventByTxHash = groupBy(allTokensBridgedEvents, ({ transactionHash }) => transactionHash);
const tokensBridgedEventByTxHash = groupBy(allTokensBridgedEvents, ({ txnRef }) => txnRef);

const merged: {
message: MessageWithStatus;
Expand Down
Loading