diff --git a/package.json b/package.json index 2c37a30b8..e6acf82f7 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "dependencies": { "@across-protocol/constants-v2": "1.0.7", "@across-protocol/contracts-v2": "2.4.7", - "@across-protocol/sdk-v2": "0.17.17", + "@across-protocol/sdk-v2": "0.18.0", "@arbitrum/sdk": "^3.1.3", "@defi-wonderland/smock": "^2.3.5", "@eth-optimism/sdk": "^3.1.0", diff --git a/src/clients/BundleDataClient.ts b/src/clients/BundleDataClient.ts index 57fa8ad04..1aa7ac8bd 100644 --- a/src/clients/BundleDataClient.ts +++ b/src/clients/BundleDataClient.ts @@ -70,11 +70,11 @@ export class BundleDataClient { async getPendingRefundsFromValidBundles(bundleLookback: number): Promise { const refunds = []; - if (!this.clients.hubPoolClient.isUpdated || this.clients.hubPoolClient.latestBlockNumber === undefined) { + if (!this.clients.hubPoolClient.isUpdated) { throw new Error("BundleDataClient::getPendingRefundsFromValidBundles HubPoolClient not updated."); } - let latestBlock = this.clients.hubPoolClient.latestBlockNumber; + let latestBlock = this.clients.hubPoolClient.latestBlockSearched; for (let i = 0; i < bundleLookback; i++) { const bundle = this.clients.hubPoolClient.getLatestFullyExecutedRootBundle(latestBlock); if (bundle !== undefined) { @@ -114,8 +114,8 @@ export class BundleDataClient { this.spokePoolClients, getEndBlockBuffers(this.chainIdListForBundleEvaluationBlockNumbers, this.blockRangeEndBlockBuffer), this.clients, - this.clients.hubPoolClient.latestBlockNumber, - this.clients.configStoreClient.getEnabledChains(this.clients.hubPoolClient.latestBlockNumber) + this.clients.hubPoolClient.latestBlockSearched, + this.clients.configStoreClient.getEnabledChains(this.clients.hubPoolClient.latestBlockSearched) ); // Refunds that will be processed in the next bundle that will be proposed after the current pending bundle // (if any) has been fully executed. diff --git a/src/clients/ConfigStoreClient.ts b/src/clients/ConfigStoreClient.ts index 8ea0b50c1..a54499f56 100644 --- a/src/clients/ConfigStoreClient.ts +++ b/src/clients/ConfigStoreClient.ts @@ -67,10 +67,10 @@ export class ConfigStoreClient extends clients.AcrossConfigStoreClient { if (isDefined(this.injectedChain)) { const { chainId: injectedChainId, blockNumber: injectedBlockNumber } = this.injectedChain; // Sanity check to ensure that this event doesn't happen in the future - if (injectedBlockNumber > this.latestBlockNumber) { + if (injectedBlockNumber > this.latestBlockSearched) { this.logger.debug({ at: "ConfigStore[Relayer]#update", - message: `Injected block number ${injectedBlockNumber} is greater than the latest block number ${this.latestBlockNumber}`, + message: `Injected block number ${injectedBlockNumber} is greater than the latest block number ${this.latestBlockSearched}`, }); return; } diff --git a/src/clients/bridges/BaseAdapter.ts b/src/clients/bridges/BaseAdapter.ts index e79d03007..2aae93b19 100644 --- a/src/clients/bridges/BaseAdapter.ts +++ b/src/clients/bridges/BaseAdapter.ts @@ -87,8 +87,8 @@ export abstract class BaseAdapter { // Note: this must be called after the SpokePoolClients are updated. getUpdatedSearchConfigs(): { l1SearchConfig: EventSearchConfig; l2SearchConfig: EventSearchConfig } { - const l1LatestBlock = this.spokePoolClients[this.hubChainId].latestBlockNumber; - const l2LatestBlock = this.spokePoolClients[this.chainId].latestBlockNumber; + const l1LatestBlock = this.spokePoolClients[this.hubChainId].latestBlockSearched; + const l2LatestBlock = this.spokePoolClients[this.chainId].latestBlockSearched; if (l1LatestBlock === 0 || l2LatestBlock === 0) { throw new Error("One or more SpokePoolClients have not been updated"); } diff --git a/src/dataworker/Dataworker.ts b/src/dataworker/Dataworker.ts index 1e45ccac6..403aa5adb 100644 --- a/src/dataworker/Dataworker.ts +++ b/src/dataworker/Dataworker.ts @@ -203,7 +203,7 @@ export class Dataworker { // are executed so we want to make sure that these are all older than the mainnet bundle end block which is // sometimes treated as the "latest" mainnet block. const mostRecentProposedRootBundle = this.clients.hubPoolClient.getLatestFullyExecutedRootBundle( - this.clients.hubPoolClient.latestBlockNumber + this.clients.hubPoolClient.latestBlockSearched ); // If there has never been a validated root bundle, then we can always propose a new one: @@ -270,7 +270,7 @@ export class Dataworker { const { configStoreClient, hubPoolClient } = this.clients; // Check if a bundle is pending. - if (!hubPoolClient.isUpdated || !hubPoolClient.latestBlockNumber) { + if (!hubPoolClient.isUpdated) { throw new Error("HubPoolClient not updated"); } if (!this.forceProposal && hubPoolClient.hasPendingProposal()) { @@ -295,7 +295,7 @@ export class Dataworker { // list, and the order of chain ID's is hardcoded in the ConfigStore client. const nextBundleMainnetStartBlock = hubPoolClient.getNextBundleStartBlockNumber( this.chainIdListForBundleEvaluationBlockNumbers, - hubPoolClient.latestBlockNumber, + hubPoolClient.latestBlockSearched, hubPoolClient.chainId ); const blockRangesForProposal = this._getWidestPossibleBlockRangeForNextBundle( @@ -350,7 +350,7 @@ export class Dataworker { return; } - const { chainId: hubPoolChainId, latestBlockNumber } = this.clients.hubPoolClient; + const { chainId: hubPoolChainId, latestBlockSearched } = this.clients.hubPoolClient; const [mainnetBundleStartBlock, mainnetBundleEndBlock] = getBlockRangeForChain( blockRangesForProposal, hubPoolChainId, @@ -365,7 +365,7 @@ export class Dataworker { const rootBundleDataProducer = isUBA ? this.UBA_proposeRootBundle(blockRangesForProposal, ubaClient, spokePoolClients, true) - : this.Legacy_proposeRootBundle(blockRangesForProposal, spokePoolClients, latestBlockNumber, true); + : this.Legacy_proposeRootBundle(blockRangesForProposal, spokePoolClients, latestBlockSearched, true); this.logger.debug({ at: "Dataworker#propose", @@ -810,11 +810,7 @@ export class Dataworker { earliestBlocksInSpokePoolClients: { [chainId: number]: number } = {}, ubaClient?: UBAClient ): Promise { - if ( - !this.clients.hubPoolClient.isUpdated || - this.clients.hubPoolClient.currentTime === undefined || - this.clients.hubPoolClient.latestBlockNumber === undefined - ) { + if (!this.clients.hubPoolClient.isUpdated || this.clients.hubPoolClient.currentTime === undefined) { throw new Error("HubPoolClient not updated"); } const hubPoolChainId = this.clients.hubPoolClient.chainId; @@ -847,7 +843,7 @@ export class Dataworker { const nextBundleMainnetStartBlock = this.clients.hubPoolClient.getNextBundleStartBlockNumber( this.chainIdListForBundleEvaluationBlockNumbers, - this.clients.hubPoolClient.latestBlockNumber, + this.clients.hubPoolClient.latestBlockSearched, this.clients.hubPoolClient.chainId ); const widestPossibleExpectedBlockRange = this._getWidestPossibleBlockRangeForNextBundle( @@ -1281,7 +1277,7 @@ export class Dataworker { const followingBlockNumber = this.clients.hubPoolClient.getFollowingRootBundle(bundle)?.blockNumber || - this.clients.hubPoolClient.latestBlockNumber; + this.clients.hubPoolClient.latestBlockSearched; if (!followingBlockNumber) { return false; @@ -1587,11 +1583,7 @@ export class Dataworker { message: "Executing pool rebalance leaves", }); - if ( - !this.clients.hubPoolClient.isUpdated || - this.clients.hubPoolClient.currentTime === undefined || - this.clients.hubPoolClient.latestBlockNumber === undefined - ) { + if (!this.clients.hubPoolClient.isUpdated || this.clients.hubPoolClient.currentTime === undefined) { throw new Error("HubPoolClient not updated"); } const hubPoolChainId = this.clients.hubPoolClient.chainId; @@ -1614,7 +1606,7 @@ export class Dataworker { const nextBundleMainnetStartBlock = this.clients.hubPoolClient.getNextBundleStartBlockNumber( this.chainIdListForBundleEvaluationBlockNumbers, - this.clients.hubPoolClient.latestBlockNumber, + this.clients.hubPoolClient.latestBlockSearched, this.clients.hubPoolClient.chainId ); const widestPossibleExpectedBlockRange = this._getWidestPossibleBlockRangeForNextBundle( @@ -1681,7 +1673,7 @@ export class Dataworker { const executedLeaves = this.clients.hubPoolClient.getExecutedLeavesForRootBundle( this.clients.hubPoolClient.getLatestProposedRootBundle(), - this.clients.hubPoolClient.latestBlockNumber + this.clients.hubPoolClient.latestBlockSearched ); // Filter out previously executed leaves. @@ -1940,7 +1932,7 @@ export class Dataworker { return false; } const followingBlockNumber = - hubPoolClient.getFollowingRootBundle(bundle)?.blockNumber || hubPoolClient.latestBlockNumber; + hubPoolClient.getFollowingRootBundle(bundle)?.blockNumber || hubPoolClient.latestBlockSearched; if (followingBlockNumber === undefined) { return false; @@ -2297,7 +2289,7 @@ export class Dataworker { spokePoolClients, getEndBlockBuffers(this.chainIdListForBundleEvaluationBlockNumbers, this.blockRangeEndBlockBuffer), this.clients, - this.clients.hubPoolClient.latestBlockNumber, + this.clients.hubPoolClient.latestBlockSearched, // We only want to count enabled chains at the same time that we are loading chain ID indices. this.clients.configStoreClient.getEnabledChains(mainnetBundleStartBlock) ); diff --git a/src/dataworker/DataworkerUtils.ts b/src/dataworker/DataworkerUtils.ts index 6a0148b7b..1bb339346 100644 --- a/src/dataworker/DataworkerUtils.ts +++ b/src/dataworker/DataworkerUtils.ts @@ -88,8 +88,7 @@ export function blockRangesAreInvalidForSpokeClients( return true; } - const clientLastBlockQueried = - spokePoolClients[chainId].eventSearchConfig.toBlock ?? spokePoolClients[chainId].latestBlockNumber; + const clientLastBlockQueried = spokePoolClients[chainId].latestBlockSearched; // Note: Math.max the from block with the deployment block of the spoke pool to handle the edge case for the first // bundle that set its start blocks equal 0. diff --git a/src/dataworker/PoolRebalanceUtils.ts b/src/dataworker/PoolRebalanceUtils.ts index c59c19fd0..63b177a0c 100644 --- a/src/dataworker/PoolRebalanceUtils.ts +++ b/src/dataworker/PoolRebalanceUtils.ts @@ -95,7 +95,7 @@ export function updateRunningBalanceForEarlyDeposit( // TODO: this must be handled s.t. it doesn't depend on when this is run. // For now, tokens do not change their mappings often, so this will work, but // to keep the system resilient, this must be updated. - hubPoolClient.latestBlockNumber + hubPoolClient.latestBlockSearched ); updateRunningBalance(runningBalances, originChainId, l1TokenCounterpart, updateAmount); @@ -234,7 +234,7 @@ export async function subtractExcessFromPreviousSlowFillsFromRunningBalances( .map(async (fill: interfaces.FillWithBlock) => { const { lastMatchingFillInSameBundle, rootBundleEndBlockContainingFirstFill } = await getFillDataForSlowFillFromPreviousRootBundle( - hubPoolClient.latestBlockNumber, + hubPoolClient.latestBlockSearched, fill, allValidFills, hubPoolClient, @@ -257,7 +257,7 @@ export async function subtractExcessFromPreviousSlowFillsFromRunningBalances( // first fill for this deposit. If it is the same as the ProposeRootBundle event containing the // current fill, then the first fill is in the current bundle and we can exit early. const rootBundleEndBlockContainingFullFill = hubPoolClient.getRootBundleEvalBlockNumberContainingBlock( - hubPoolClient.latestBlockNumber, + hubPoolClient.latestBlockSearched, fill.blockNumber, fill.destinationChainId ); diff --git a/src/finalizer/utils/arbitrum.ts b/src/finalizer/utils/arbitrum.ts index 1526d8d15..c39b3e1a2 100644 --- a/src/finalizer/utils/arbitrum.ts +++ b/src/finalizer/utils/arbitrum.ts @@ -50,7 +50,7 @@ async function multicallArbitrumFinalizations( const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( CHAIN_ID, message.info.l2TokenAddress, - hubPoolClient.latestBlockNumber + hubPoolClient.latestBlockSearched ); const l1TokenInfo = hubPoolClient.getTokenInfo(1, l1TokenCounterpart); const amountFromWei = convertFromWei(message.info.amountToReturn.toString(), l1TokenInfo.decimals); diff --git a/src/finalizer/utils/polygon.ts b/src/finalizer/utils/polygon.ts index af09760b8..c33b8ecaa 100644 --- a/src/finalizer/utils/polygon.ts +++ b/src/finalizer/utils/polygon.ts @@ -181,7 +181,7 @@ async function multicallPolygonFinalizations( const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( CHAIN_ID, message.l2TokenAddress, - hubPoolClient.latestBlockNumber + hubPoolClient.latestBlockSearched ); const l1TokenInfo = hubPoolClient.getTokenInfo(1, l1TokenCounterpart); const amountFromWei = convertFromWei(message.amountToReturn.toString(), l1TokenInfo.decimals); @@ -208,7 +208,7 @@ async function retrieveTokenFromMainnetTokenBridger( mainnetSigner: Signer, hubPoolClient: HubPoolClient ): Promise { - const l1Token = hubPoolClient.getL1TokenCounterpartAtBlock(CHAIN_ID, l2Token, hubPoolClient.latestBlockNumber); + const l1Token = hubPoolClient.getL1TokenCounterpartAtBlock(CHAIN_ID, l2Token, hubPoolClient.latestBlockSearched); const mainnetTokenBridger = getMainnetTokenBridger(mainnetSigner); const callData = await mainnetTokenBridger.populateTransaction.retrieve(l1Token); return { diff --git a/src/finalizer/utils/zkSync.ts b/src/finalizer/utils/zkSync.ts index b290030d1..13d52ac3f 100644 --- a/src/finalizer/utils/zkSync.ts +++ b/src/finalizer/utils/zkSync.ts @@ -50,7 +50,7 @@ export async function zkSyncFinalizer( const l1TokenCounterpart = hubPoolClient.getL1TokenCounterpartAtBlock( l2ChainId, l2TokenAddress, - hubPoolClient.latestBlockNumber + hubPoolClient.latestBlockSearched ); const { decimals, symbol: l1TokenSymbol } = hubPoolClient.getTokenInfo(l1ChainId, l1TokenCounterpart); const amountFromWei = convertFromWei(amountToReturn.toString(), decimals); diff --git a/src/monitor/Monitor.ts b/src/monitor/Monitor.ts index 95779f381..632fdcebe 100644 --- a/src/monitor/Monitor.ts +++ b/src/monitor/Monitor.ts @@ -512,7 +512,7 @@ export class Monitor { // should stay unstuck for longer than one bundle. async checkStuckRebalances(): Promise { const hubPoolClient = this.clients.hubPoolClient; - const lastFullyExecutedBundle = hubPoolClient.getLatestFullyExecutedRootBundle(hubPoolClient.latestBlockNumber); + const lastFullyExecutedBundle = hubPoolClient.getLatestFullyExecutedRootBundle(hubPoolClient.latestBlockSearched); // This case shouldn't happen outside of tests as Across V2 has already launched. if (lastFullyExecutedBundle === undefined) { return; @@ -940,7 +940,7 @@ export class Monitor { // is now aware of those executions. await new Contract(token, ERC20.abi, this.clients.spokePoolClients[chainId].spokePool.provider).balanceOf( account, - { blockTag: this.clients.spokePoolClients[chainId].latestBlockNumber } + { blockTag: this.clients.spokePoolClients[chainId].latestBlockSearched } ); if (!this.balanceCache[chainId]) { this.balanceCache[chainId] = {}; diff --git a/src/relayer/Relayer.ts b/src/relayer/Relayer.ts index 64f3a5e75..d2d865d85 100644 --- a/src/relayer/Relayer.ts +++ b/src/relayer/Relayer.ts @@ -230,7 +230,7 @@ export class Relayer { .filter((x) => { return ( x.deposit.blockNumber <= - spokePoolClients[x.deposit.originChainId].latestBlockNumber - mdcPerChain[x.deposit.originChainId] + spokePoolClients[x.deposit.originChainId].latestBlockSearched - mdcPerChain[x.deposit.originChainId] ); }) .sort((a, b) => @@ -522,8 +522,8 @@ export class Relayer { const message = `${nRefunds === 0 ? "No" : nRefunds} outstanding fills with eligible cross-chain refunds found.`; const blockRanges = Object.fromEntries( - spokePoolClients.map(({ chainId, deploymentBlock, latestBlockNumber }) => { - return [chainId, [fromBlocks[chainId] ?? deploymentBlock, latestBlockNumber]]; + spokePoolClients.map(({ chainId, deploymentBlock, latestBlockSearched }) => { + return [chainId, [fromBlocks[chainId] ?? deploymentBlock, latestBlockSearched]]; }) ); this.logger.info({ at: "Relayer::requestRefunds", message, blockRanges }); diff --git a/src/scripts/validateRunningBalances.ts b/src/scripts/validateRunningBalances.ts index 6e7708784..e3e622a6c 100644 --- a/src/scripts/validateRunningBalances.ts +++ b/src/scripts/validateRunningBalances.ts @@ -89,7 +89,7 @@ export async function runScript(_logger: winston.Logger, baseSigner: Signer): Pr mrkdwn += `Bundle proposed at ${mostRecentValidatedBundle.transactionHash}`; const followingBlockNumber = clients.hubPoolClient.getFollowingRootBundle(mostRecentValidatedBundle)?.blockNumber || - clients.hubPoolClient.latestBlockNumber; + clients.hubPoolClient.latestBlockSearched; const poolRebalanceLeaves = clients.hubPoolClient.getExecutedLeavesForRootBundle( mostRecentValidatedBundle, followingBlockNumber @@ -167,7 +167,7 @@ export async function runScript(_logger: winston.Logger, baseSigner: Signer): Pr if (leaf.chainId !== clients.hubPoolClient.chainId) { const _followingBlockNumber = clients.hubPoolClient.getFollowingRootBundle(previousValidatedBundle)?.blockNumber || - clients.hubPoolClient.latestBlockNumber; + clients.hubPoolClient.latestBlockSearched; const previousBundlePoolRebalanceLeaves = clients.hubPoolClient.getExecutedLeavesForRootBundle( previousValidatedBundle, _followingBlockNumber diff --git a/test/AdapterManager.getOutstandingCrossChainTokenTransferAmount.ts b/test/AdapterManager.getOutstandingCrossChainTokenTransferAmount.ts index 095963200..29f7fe49f 100644 --- a/test/AdapterManager.getOutstandingCrossChainTokenTransferAmount.ts +++ b/test/AdapterManager.getOutstandingCrossChainTokenTransferAmount.ts @@ -8,7 +8,7 @@ class TestAdapter extends BaseAdapter { constructor() { super( { - 1: { latestBlockNumber: 123 } as unknown as SpokePoolClient, + 1: { latestBlockSearched: 123 } as unknown as SpokePoolClient, }, 1, ["0xmonitored"], diff --git a/test/Dataworker.blockRangeUtils.ts b/test/Dataworker.blockRangeUtils.ts index 7053df6e3..313000a61 100644 --- a/test/Dataworker.blockRangeUtils.ts +++ b/test/Dataworker.blockRangeUtils.ts @@ -45,10 +45,7 @@ describe("Dataworker block range-related utility methods", async function () { ) ) ); - const latestMainnetBlock = hubPoolClient.latestBlockNumber; - if (latestMainnetBlock === undefined) { - throw new Error("hubPoolClient.latestBlockNumber is undefined"); - } + const latestMainnetBlock = hubPoolClient.latestBlockSearched; const startingWidestBlocks = getWidestPossibleExpectedBlockRange( chainIdListForBundleEvaluationBlockNumbers, spokePoolClients, @@ -107,7 +104,7 @@ describe("Dataworker block range-related utility methods", async function () { // - Buffers are 0: let defaultEndBlockBuffers = Array(chainIdListForBundleEvaluationBlockNumbers.length).fill(0); chainIdListForBundleEvaluationBlockNumbers.forEach((_chainId) => { - mockHubPoolClient.setLatestBundleEndBlockForChain(_chainId, spokePoolClients[_chainId].latestBlockNumber); + mockHubPoolClient.setLatestBundleEndBlockForChain(_chainId, spokePoolClients[_chainId].latestBlockSearched); }); expect( getWidestPossibleExpectedBlockRange( @@ -123,8 +120,8 @@ describe("Dataworker block range-related utility methods", async function () { ) ).to.deep.equal( chainIdListForBundleEvaluationBlockNumbers.map((_chainId) => [ - spokePoolClients[_chainId].latestBlockNumber, - spokePoolClients[_chainId].latestBlockNumber, + spokePoolClients[_chainId].latestBlockSearched, + spokePoolClients[_chainId].latestBlockSearched, ]) ); @@ -144,8 +141,8 @@ describe("Dataworker block range-related utility methods", async function () { ) ).to.deep.equal( chainIdListForBundleEvaluationBlockNumbers.map((_chainId) => [ - spokePoolClients[_chainId].latestBlockNumber, - spokePoolClients[_chainId].latestBlockNumber, + spokePoolClients[_chainId].latestBlockSearched, + spokePoolClients[_chainId].latestBlockSearched, ]) ); }); @@ -164,9 +161,9 @@ describe("Dataworker block range-related utility methods", async function () { if (mainnetDeploymentBlock === 0) { throw new Error("Mainnet SpokePoolClient has not been updated"); } - if (spokePoolClients[chainId].latestBlockNumber === 0) { + if (spokePoolClients[chainId].latestBlockSearched === 0) { throw new Error(`Chain ${spokePoolClients[1].chainId} SpokePoolClient has not been updated`); - } else if (spokePoolClients[originChainId].latestBlockNumber === 0) { + } else if (spokePoolClients[originChainId].latestBlockSearched === 0) { throw new Error(`Chain ${originChainId} SpokePoolClient has not been updated`); } @@ -182,7 +179,7 @@ describe("Dataworker block range-related utility methods", async function () { expect( blockRangesAreInvalidForSpokeClients( _spokePoolClients, - [[mainnetDeploymentBlock + 3, spokePoolClients[chainId].latestBlockNumber]], + [[mainnetDeploymentBlock + 3, spokePoolClients[chainId].latestBlockSearched]], chainIds, { [chainId]: mainnetDeploymentBlock + 2 } ) @@ -191,7 +188,7 @@ describe("Dataworker block range-related utility methods", async function () { expect( blockRangesAreInvalidForSpokeClients( _spokePoolClients, - [[mainnetDeploymentBlock + 3, spokePoolClients[chainId].latestBlockNumber + 3]], + [[mainnetDeploymentBlock + 3, spokePoolClients[chainId].latestBlockSearched + 3]], chainIds, { [chainId]: mainnetDeploymentBlock + 2 } ) @@ -201,7 +198,7 @@ describe("Dataworker block range-related utility methods", async function () { expect( blockRangesAreInvalidForSpokeClients( _spokePoolClients, - [[mainnetDeploymentBlock + 1, spokePoolClients[chainId].latestBlockNumber]], + [[mainnetDeploymentBlock + 1, spokePoolClients[chainId].latestBlockSearched]], chainIds, { [chainId]: mainnetDeploymentBlock + 2 } ) @@ -212,8 +209,8 @@ describe("Dataworker block range-related utility methods", async function () { blockRangesAreInvalidForSpokeClients( { [chainId]: spokePoolClients[chainId], [10]: spokePoolClients[originChainId] }, [ - [mainnetDeploymentBlock + 1, spokePoolClients[chainId].latestBlockNumber], - [optimismDeploymentBlock + 3, spokePoolClients[originChainId].latestBlockNumber], + [mainnetDeploymentBlock + 1, spokePoolClients[chainId].latestBlockSearched], + [optimismDeploymentBlock + 3, spokePoolClients[originChainId].latestBlockSearched], ], [chainId, 10], { [chainId]: mainnetDeploymentBlock + 2, [10]: optimismDeploymentBlock + 2 } @@ -223,8 +220,8 @@ describe("Dataworker block range-related utility methods", async function () { blockRangesAreInvalidForSpokeClients( { [chainId]: spokePoolClients[chainId], [10]: spokePoolClients[originChainId] }, [ - [mainnetDeploymentBlock + 3, spokePoolClients[chainId].latestBlockNumber], - [optimismDeploymentBlock + 3, spokePoolClients[originChainId].latestBlockNumber], + [mainnetDeploymentBlock + 3, spokePoolClients[chainId].latestBlockSearched], + [optimismDeploymentBlock + 3, spokePoolClients[originChainId].latestBlockSearched], ], [chainId, 10], { [chainId]: mainnetDeploymentBlock + 2, [10]: optimismDeploymentBlock + 2 } @@ -237,7 +234,7 @@ describe("Dataworker block range-related utility methods", async function () { expect( blockRangesAreInvalidForSpokeClients( _spokePoolClients, - [[0, spokePoolClients[chainId].latestBlockNumber]], + [[0, spokePoolClients[chainId].latestBlockSearched]], chainIds, { [chainId]: mainnetDeploymentBlock + 2, @@ -247,7 +244,7 @@ describe("Dataworker block range-related utility methods", async function () { expect( blockRangesAreInvalidForSpokeClients( _spokePoolClients, - [[0, spokePoolClients[chainId].latestBlockNumber]], + [[0, spokePoolClients[chainId].latestBlockSearched]], chainIds, { [chainId]: mainnetDeploymentBlock - 1, diff --git a/test/Dataworker.validateRootBundle.ts b/test/Dataworker.validateRootBundle.ts index 81c5f611a..9447d0d09 100644 --- a/test/Dataworker.validateRootBundle.ts +++ b/test/Dataworker.validateRootBundle.ts @@ -189,7 +189,7 @@ describe("Dataworker: Validate pending root bundle", async function () { await hubPool.proposeRootBundle( // Since the dataworker sets the end block to latest minus buffer, setting the bundle end blocks to HEAD // should fall within buffer. - Object.keys(spokePoolClients).map((chainId) => spokePoolClients[chainId].latestBlockNumber), + Object.keys(spokePoolClients).map((chainId) => spokePoolClients[chainId].latestBlockSearched), expectedPoolRebalanceRoot4.leaves.length, expectedPoolRebalanceRoot4.tree.getHexRoot(), expectedRelayerRefundRoot4.tree.getHexRoot(), @@ -210,7 +210,7 @@ describe("Dataworker: Validate pending root bundle", async function () { await updateAllClients(); await hubPool.proposeRootBundle( Object.keys(spokePoolClients).map( - (chainId) => spokePoolClients[chainId].latestBlockNumber + BUNDLE_END_BLOCK_BUFFER + 1 + (chainId) => spokePoolClients[chainId].latestBlockSearched + BUNDLE_END_BLOCK_BUFFER + 1 ), expectedPoolRebalanceRoot4.leaves.length, expectedPoolRebalanceRoot4.tree.getHexRoot(), diff --git a/test/Relayer.RefundRequests.ts b/test/Relayer.RefundRequests.ts index add3cb65a..89b7fcd0f 100644 --- a/test/Relayer.RefundRequests.ts +++ b/test/Relayer.RefundRequests.ts @@ -68,7 +68,7 @@ async function waitOnBlock(spokePoolClient: SpokePoolClient): Promise { let loop = 0; let latest = await provider.getBlockNumber(); - while (latest <= spokePoolClient.latestBlockNumber) { + while (latest <= spokePoolClient.latestBlockSearched) { if (loop++ % 5 === 0) { await hre.network.provider.send("evm_mine"); } diff --git a/yarn.lock b/yarn.lock index 9c608b2e1..0284671f8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -48,10 +48,10 @@ "@openzeppelin/contracts" "4.1.0" "@uma/core" "^2.18.0" -"@across-protocol/sdk-v2@0.17.17": - version "0.17.17" - resolved "https://registry.yarnpkg.com/@across-protocol/sdk-v2/-/sdk-v2-0.17.17.tgz#1cd191dd835b7546419d31b64c5195bb973639e4" - integrity sha512-N5EkPOJIOoUkO4/JNeRlQw7h9GRHrTQQ+ptua2cjF9i+cicukNLKrLPUTWrBXIgjsr5nXEAZl17KyeOqvXNafg== +"@across-protocol/sdk-v2@0.18.0": + version "0.18.0" + resolved "https://registry.yarnpkg.com/@across-protocol/sdk-v2/-/sdk-v2-0.18.0.tgz#4ca377e88f7e43eb3c2aa7ea26b9d0687294b750" + integrity sha512-4ibLbcJmSasG9l6efVuYoQva9tUo/07iECan7j8fRqJrUkB+5K8NEPl37P/BrBgjqOyeOmzYdscImaAlH397qw== dependencies: "@across-protocol/across-token" "^1.0.0" "@across-protocol/constants-v2" "^1.0.7"