diff --git a/yarn-project/archiver/src/archiver/archiver.ts b/yarn-project/archiver/src/archiver/archiver.ts index 7d3a83b6b24..79169374591 100644 --- a/yarn-project/archiver/src/archiver/archiver.ts +++ b/yarn-project/archiver/src/archiver/archiver.ts @@ -258,13 +258,13 @@ export class Archiver implements L2BlockSource, L2LogsSource, ContractDataSource } /** - * Gets the `take` amount of L2 blocks starting from `from`. + * Gets up to `limit` amount of L2 blocks starting from `from`. * @param from - Number of the first block to return (inclusive). - * @param take - The number of blocks to return. + * @param limit - The number of blocks to return. * @returns The requested L2 blocks. */ - public getL2Blocks(from: number, take: number): Promise { - return this.store.getL2Blocks(from, take); + public getL2Blocks(from: number, limit: number): Promise { + return this.store.getL2Blocks(from, limit); } /** @@ -322,14 +322,14 @@ export class Archiver implements L2BlockSource, L2LogsSource, ContractDataSource } /** - * Gets the `take` amount of logs starting from `from`. + * Gets up to `limit` amount of logs starting from `from`. * @param from - Number of the L2 block to which corresponds the first logs to be returned. - * @param take - The number of logs to return. + * @param limit - The number of logs to return. * @param logType - Specifies whether to return encrypted or unencrypted logs. * @returns The requested logs. */ - public getLogs(from: number, take: number, logType: LogType): Promise { - return this.store.getLogs(from, take, logType); + public getLogs(from: number, limit: number, logType: LogType): Promise { + return this.store.getLogs(from, limit, logType); } /** @@ -341,12 +341,12 @@ export class Archiver implements L2BlockSource, L2LogsSource, ContractDataSource } /** - * Gets the `take` amount of pending L1 to L2 messages. - * @param take - The number of messages to return. + * Gets up to `limit` amount of pending L1 to L2 messages. + * @param limit - The number of messages to return. * @returns The requested L1 to L2 messages' keys. */ - getPendingL1ToL2Messages(take: number): Promise { - return this.store.getPendingL1ToL2MessageKeys(take); + getPendingL1ToL2Messages(limit: number): Promise { + return this.store.getPendingL1ToL2MessageKeys(limit); } /** diff --git a/yarn-project/archiver/src/archiver/archiver_store.ts b/yarn-project/archiver/src/archiver/archiver_store.ts index 942387ecd33..a4b8256e6be 100644 --- a/yarn-project/archiver/src/archiver/archiver_store.ts +++ b/yarn-project/archiver/src/archiver/archiver_store.ts @@ -25,12 +25,12 @@ export interface ArchiverDataStore { addL2Blocks(blocks: L2Block[]): Promise; /** - * Gets the `take` amount of L2 blocks starting from `from`. + * Gets up to `limit` amount of L2 blocks starting from `from`. * @param from - Number of the first block to return (inclusive). - * @param take - The number of blocks to return. + * @param limit - The number of blocks to return. * @returns The requested L2 blocks. */ - getL2Blocks(from: number, take: number): Promise; + getL2Blocks(from: number, limit: number): Promise; /** * Append new logs to the store's list. @@ -63,11 +63,11 @@ export interface ArchiverDataStore { confirmL1ToL2Messages(messageKeys: Fr[]): Promise; /** - * Gets the `take` amount of pending L1 to L2 messages, sorted by fee - * @param take - The number of messages to return (by default NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP). + * Gets up to `limit` amount of pending L1 to L2 messages, sorted by fee + * @param limit - The number of messages to return (by default NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP). * @returns The requested L1 to L2 message keys. */ - getPendingL1ToL2MessageKeys(take: number): Promise; + getPendingL1ToL2MessageKeys(limit: number): Promise; /** * Gets the confirmed L1 to L2 message corresponding to the given message key. @@ -77,13 +77,13 @@ export interface ArchiverDataStore { getConfirmedL1ToL2Message(messageKey: Fr): Promise; /** - * Gets the `take` amount of logs starting from `from`. + * Gets up to `limit` amount of logs starting from `from`. * @param from - Number of the L2 block to which corresponds the first logs to be returned. - * @param take - The number of logs to return. + * @param limit - The number of logs to return. * @param logType - Specifies whether to return encrypted or unencrypted logs. * @returns The requested logs. */ - getLogs(from: number, take: number, logType: LogType): Promise; + getLogs(from: number, limit: number, logType: LogType): Promise; /** * Store new Contract Public Data from an L2 block to the store's list. @@ -250,12 +250,12 @@ export class MemoryArchiverStore implements ArchiverDataStore { } /** - * Gets the `take` amount of L2 blocks starting from `from`. + * Gets up to `limit` amount of L2 blocks starting from `from`. * @param from - Number of the first block to return (inclusive). - * @param take - The number of blocks to return. + * @param limit - The number of blocks to return. * @returns The requested L2 blocks. */ - public getL2Blocks(from: number, take: number): Promise { + public getL2Blocks(from: number, limit: number): Promise { if (from < INITIAL_L2_BLOCK_NUM) { throw new Error(`Invalid block range ${from}`); } @@ -263,17 +263,17 @@ export class MemoryArchiverStore implements ArchiverDataStore { return Promise.resolve([]); } const startIndex = from - INITIAL_L2_BLOCK_NUM; - const endIndex = from + take; + const endIndex = from + limit; return Promise.resolve(this.l2Blocks.slice(startIndex, endIndex)); } /** - * Gets the `take` amount of pending L1 to L2 messages, sorted by fee - * @param take - The number of messages to return (by default NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP). + * Gets up to `limit` amount of pending L1 to L2 messages, sorted by fee + * @param limit - The number of messages to return (by default NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP). * @returns The requested L1 to L2 message keys. */ - public getPendingL1ToL2MessageKeys(take: number = NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP): Promise { - return Promise.resolve(this.pendingL1ToL2Messages.getMessageKeys(take)); + public getPendingL1ToL2MessageKeys(limit: number = NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP): Promise { + return Promise.resolve(this.pendingL1ToL2Messages.getMessageKeys(limit)); } /** @@ -290,13 +290,13 @@ export class MemoryArchiverStore implements ArchiverDataStore { } /** - * Gets the `take` amount of logs starting from `from`. + * Gets up to `limit` amount of logs starting from `from`. * @param from - Number of the L2 block to which corresponds the first logs to be returned. - * @param take - The number of logs to return. + * @param limit - The number of logs to return. * @param logType - Specifies whether to return encrypted or unencrypted logs. * @returns The requested logs. */ - getLogs(from: number, take: number, logType: LogType): Promise { + getLogs(from: number, limit: number, logType: LogType): Promise { if (from < INITIAL_L2_BLOCK_NUM) { throw new Error(`Invalid block range ${from}`); } @@ -305,7 +305,7 @@ export class MemoryArchiverStore implements ArchiverDataStore { return Promise.resolve([]); } const startIndex = from - INITIAL_L2_BLOCK_NUM; - const endIndex = from + take; + const endIndex = from + limit; return Promise.resolve(logs.slice(startIndex, endIndex)); } diff --git a/yarn-project/archiver/src/archiver/l1_to_l2_message_store.test.ts b/yarn-project/archiver/src/archiver/l1_to_l2_message_store.test.ts index aabf40f2cc7..095bc0eb639 100644 --- a/yarn-project/archiver/src/archiver/l1_to_l2_message_store.test.ts +++ b/yarn-project/archiver/src/archiver/l1_to_l2_message_store.test.ts @@ -63,12 +63,12 @@ describe('pending_l1_to_l2_message_store', () => { expect(store.getMessageKeys(10)).toEqual([]); }); - it('getMessageKeys returns an empty array if take is 0', () => { + it('getMessageKeys returns an empty array if limit is 0', () => { store.addMessage(entryKey, msg); expect(store.getMessageKeys(0)).toEqual([]); }); - it('get messages for a non-empty store when take > number of messages in store', () => { + it('get messages for a non-empty store when limit > number of messages in store', () => { const entryKeys = [1, 2, 3, 4, 5].map(x => new Fr(x)); entryKeys.forEach(entryKey => { store.addMessage(entryKey, L1ToL2Message.random()); diff --git a/yarn-project/archiver/src/archiver/l1_to_l2_message_store.ts b/yarn-project/archiver/src/archiver/l1_to_l2_message_store.ts index 2f63487f6c6..28fab82865a 100644 --- a/yarn-project/archiver/src/archiver/l1_to_l2_message_store.ts +++ b/yarn-project/archiver/src/archiver/l1_to_l2_message_store.ts @@ -38,18 +38,18 @@ export class L1ToL2MessageStore { * for removing messages or fetching multiple messages. */ export class PendingL1ToL2MessageStore extends L1ToL2MessageStore { - getMessageKeys(take: number): Fr[] { - if (take < 1) { + getMessageKeys(limit: number): Fr[] { + if (limit < 1) { return []; } - // fetch `take` number of messages from the store with the highest fee. + // fetch `limit` number of messages from the store with the highest fee. // Note the store has multiple of the same message. So if a message has count 2, include both of them in the result: const messages: Fr[] = []; const sortedMessages = Array.from(this.store.values()).sort((a, b) => b.message.fee - a.message.fee); for (const messageAndCount of sortedMessages) { for (let i = 0; i < messageAndCount.count; i++) { messages.push(messageAndCount.message.entryKey!); - if (messages.length === take) { + if (messages.length === limit) { return messages; } } diff --git a/yarn-project/aztec-cli/README.md b/yarn-project/aztec-cli/README.md index a9e97bcfb47..d6493cf2b2e 100644 --- a/yarn-project/aztec-cli/README.md +++ b/yarn-project/aztec-cli/README.md @@ -363,11 +363,11 @@ Gets all the unencrypted logs from L2 blocks in the specified range. Syntax: ```shell -aztec-cli get-logs [options] +aztec-cli get-logs [options] ``` - `from`: Block number to start fetching logs from. -- `take`: Number of block logs to fetch. +- `limit`: Maximum number of block logs to obtain. Options: diff --git a/yarn-project/aztec-cli/src/index.ts b/yarn-project/aztec-cli/src/index.ts index eca51331f69..942da3dde12 100644 --- a/yarn-project/aztec-cli/src/index.ts +++ b/yarn-project/aztec-cli/src/index.ts @@ -216,22 +216,22 @@ async function main() { .command('get-logs') .description('Gets all the unencrypted logs from L2 blocks in the range specified.') .argument('', 'Block num start for getting logs.') - .argument('', 'How many block logs to fetch.') + .argument('', 'How many block logs to fetch.') .option('-u, --rpc-url ', 'URL of the Aztec RPC', AZTEC_RPC_HOST || 'http://localhost:8080') .action(async (_from, _take, options) => { let from: number; - let take: number; + let limit: number; try { from = parseInt(_from); - take = parseInt(_take); + limit = parseInt(_take); } catch { log(`Invalid integer value(s) passed: ${_from}, ${_take}`); return; } const client = createAztecRpcClient(options.rpcUrl); - const logs = await client.getUnencryptedLogs(from, take); + const logs = await client.getUnencryptedLogs(from, limit); if (!logs.length) { - log(`No logs found in blocks ${from} to ${from + take}`); + log(`No logs found in blocks ${from} to ${from + limit}`); } else { log('Logs found: \n'); L2BlockL2Logs.unrollLogs(logs).forEach(fnLog => log(`${fnLog.toString('ascii')}\n`)); diff --git a/yarn-project/aztec-node/src/aztec-node/http-node.test.ts b/yarn-project/aztec-node/src/aztec-node/http-node.test.ts index 5e720d4d334..91a73868176 100644 --- a/yarn-project/aztec-node/src/aztec-node/http-node.test.ts +++ b/yarn-project/aztec-node/src/aztec-node/http-node.test.ts @@ -69,7 +69,7 @@ describe('HttpNode', () => { const result = await httpNode.getBlocks(0, 3); - expect(fetch).toHaveBeenCalledWith(`${TEST_URL}get-blocks?from=0&take=3`); + expect(fetch).toHaveBeenCalledWith(`${TEST_URL}get-blocks?from=0&limit=3`); expect(result).toEqual([block1, block2]); }); @@ -79,7 +79,7 @@ describe('HttpNode', () => { const result = await httpNode.getBlocks(0, 2); - expect(fetch).toHaveBeenCalledWith(`${TEST_URL}get-blocks?from=0&take=2`); + expect(fetch).toHaveBeenCalledWith(`${TEST_URL}get-blocks?from=0&limit=2`); expect(result).toEqual([]); }); }); @@ -157,7 +157,7 @@ describe('HttpNode', () => { const processedLogType = logType === 'encrypted' ? LogType.ENCRYPTED : LogType.UNENCRYPTED; const from = 0; - const take = 3; + const limit = 3; const log1 = L2BlockL2Logs.random(2, 3, 4); const log2 = L2BlockL2Logs.random(1, 5, 2); const response = { @@ -165,9 +165,9 @@ describe('HttpNode', () => { }; setFetchMock(response); - const result = await httpNode.getLogs(from, take, processedLogType); + const result = await httpNode.getLogs(from, limit, processedLogType); - expect(fetch).toHaveBeenCalledWith(`${TEST_URL}get-logs?from=${from}&take=${take}&logType=${processedLogType}`); + expect(fetch).toHaveBeenCalledWith(`${TEST_URL}get-logs?from=${from}&limit=${limit}&logType=${processedLogType}`); expect(result).toEqual([log1, log2]); }); @@ -177,13 +177,15 @@ describe('HttpNode', () => { const processedLogType = logType === 'encrypted' ? LogType.ENCRYPTED : LogType.UNENCRYPTED; const from = 0; - const take = 2; + const limit = 2; const response = {}; setFetchMock(response); - const result = await httpNode.getLogs(from, take, processedLogType); + const result = await httpNode.getLogs(from, limit, processedLogType); - expect(fetch).toHaveBeenCalledWith(`${TEST_URL}get-logs?from=${from}&take=${take}&logType=${processedLogType}`); + expect(fetch).toHaveBeenCalledWith( + `${TEST_URL}get-logs?from=${from}&limit=${limit}&logType=${processedLogType}`, + ); expect(result).toEqual([]); }, ); diff --git a/yarn-project/aztec-node/src/aztec-node/http-node.ts b/yarn-project/aztec-node/src/aztec-node/http-node.ts index 8a306d7f6a4..0264828de1f 100644 --- a/yarn-project/aztec-node/src/aztec-node/http-node.ts +++ b/yarn-project/aztec-node/src/aztec-node/http-node.ts @@ -46,14 +46,14 @@ export class HttpNode implements AztecNode { /** * Method to request blocks. Will attempt to return all requested blocks but will return only those available. * @param from - The start of the range of blocks to return. - * @param take - The number of blocks desired. + * @param limit - Maximum number of blocks to obtain. * @returns The blocks requested. */ - async getBlocks(from: number, take: number): Promise { + async getBlocks(from: number, limit: number): Promise { const url = new URL(`${this.baseUrl}/get-blocks`); url.searchParams.append('from', from.toString()); - if (take !== undefined) { - url.searchParams.append('take', take.toString()); + if (limit !== undefined) { + url.searchParams.append('limit', limit.toString()); } const response = await (await fetch(url.toString())).json(); const blocks = response.blocks as string[]; @@ -114,17 +114,17 @@ export class HttpNode implements AztecNode { } /** - * Gets the `take` amount of logs starting from `from`. + * Gets up to `limit` amount of logs starting from `from`. * @param from - Number of the L2 block to which corresponds the first logs to be returned. - * @param take - The number of logs to return. + * @param limit - The maximum number of logs to return. * @param logType - Specifies whether to return encrypted or unencrypted logs. * @returns The requested logs. */ - public async getLogs(from: number, take: number, logType: LogType): Promise { + public async getLogs(from: number, limit: number, logType: LogType): Promise { const url = new URL(`${this.baseUrl}/get-logs`); url.searchParams.append('from', from.toString()); - url.searchParams.append('take', take.toString()); + url.searchParams.append('limit', limit.toString()); url.searchParams.append('logType', logType.toString()); const response = await (await fetch(url.toString())).json(); diff --git a/yarn-project/aztec-node/src/aztec-node/server.ts b/yarn-project/aztec-node/src/aztec-node/server.ts index c99d278571d..f6bf19bc260 100644 --- a/yarn-project/aztec-node/src/aztec-node/server.ts +++ b/yarn-project/aztec-node/src/aztec-node/server.ts @@ -118,11 +118,11 @@ export class AztecNodeService implements AztecNode { /** * Method to request blocks. Will attempt to return all requested blocks but will return only those available. * @param from - The start of the range of blocks to return. - * @param take - The number of blocks desired. + * @param limit - The maximum number of blocks to obtain. * @returns The blocks requested. */ - public async getBlocks(from: number, take: number): Promise { - return (await this.blockSource.getL2Blocks(from, take)) ?? []; + public async getBlocks(from: number, limit: number): Promise { + return (await this.blockSource.getL2Blocks(from, limit)) ?? []; } /** @@ -170,15 +170,15 @@ export class AztecNodeService implements AztecNode { } /** - * Gets the `take` amount of logs starting from `from`. + * Gets up to `limit` amount of logs starting from `from`. * @param from - Number of the L2 block to which corresponds the first logs to be returned. - * @param take - The number of logs to return. + * @param limit - The maximum number of logs to return. * @param logType - Specifies whether to return encrypted or unencrypted logs. * @returns The requested logs. */ - public getLogs(from: number, take: number, logType: LogType): Promise { + public getLogs(from: number, limit: number, logType: LogType): Promise { const logSource = logType === LogType.ENCRYPTED ? this.encryptedLogsSource : this.unencryptedLogsSource; - return logSource.getLogs(from, take, logType); + return logSource.getLogs(from, limit, logType); } /** diff --git a/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts b/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts index 5a02b94fb85..cc28f44a278 100644 --- a/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts +++ b/yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts @@ -250,8 +250,8 @@ export class AztecRPCServer implements AztecRPC { return await this.node.getContractInfo(contractAddress); } - public async getUnencryptedLogs(from: number, take: number): Promise { - return await this.node.getLogs(from, take, LogType.UNENCRYPTED); + public async getUnencryptedLogs(from: number, limit: number): Promise { + return await this.node.getLogs(from, limit, LogType.UNENCRYPTED); } async #getExecutionRequest( diff --git a/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts b/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts index 2f09285ec78..6a5cc776112 100644 --- a/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts +++ b/yarn-project/aztec-rpc/src/synchroniser/synchroniser.ts @@ -34,10 +34,10 @@ export class Synchroniser { * available, it retries after a specified interval. * * @param from - The starting position for fetching encrypted logs and blocks. - * @param take - The number of encrypted logs and blocks to fetch in each iteration. + * @param limit - The maximum number of encrypted, unencrypted logs and blocks to fetch in each iteration. * @param retryInterval - The time interval (in ms) to wait before retrying if no data is available. */ - public async start(from = 1, take = 1, retryInterval = 1000) { + public async start(from = 1, limit = 1, retryInterval = 1000) { if (this.running) return; this.running = true; @@ -45,7 +45,7 @@ export class Synchroniser { const run = async () => { while (this.running) { - from = await this.work(from, take, retryInterval); + from = await this.work(from, limit, retryInterval); } }; @@ -63,21 +63,21 @@ export class Synchroniser { await this.db.setTreeRoots(treeRoots); } - protected async work(from = 1, take = 1, retryInterval = 1000): Promise { + protected async work(from = 1, limit = 1, retryInterval = 1000): Promise { try { - let encryptedLogs = await this.node.getLogs(from, take, LogType.ENCRYPTED); + let encryptedLogs = await this.node.getLogs(from, limit, LogType.ENCRYPTED); if (!encryptedLogs.length) { await this.interruptableSleep.sleep(retryInterval); return from; } - let unencryptedLogs = await this.node.getLogs(from, take, LogType.UNENCRYPTED); + let unencryptedLogs = await this.node.getLogs(from, limit, LogType.UNENCRYPTED); if (!unencryptedLogs.length) { await this.interruptableSleep.sleep(retryInterval); return from; } - // Note: If less than `take` encrypted logs is returned, then we fetch only that number of blocks. + // Note: If less than `limit` encrypted logs is returned, then we fetch only that number of blocks. const blocks = await this.node.getBlocks(from, encryptedLogs.length); if (!blocks.length) { await this.interruptableSleep.sleep(retryInterval); diff --git a/yarn-project/aztec.js/src/aztec_rpc_client/wallet.ts b/yarn-project/aztec.js/src/aztec_rpc_client/wallet.ts index b88d2a4b423..a2dc7ff0d27 100644 --- a/yarn-project/aztec.js/src/aztec_rpc_client/wallet.ts +++ b/yarn-project/aztec.js/src/aztec_rpc_client/wallet.ts @@ -76,8 +76,8 @@ export abstract class BaseWallet implements Wallet { getContractInfo(contractAddress: AztecAddress): Promise { return this.rpc.getContractInfo(contractAddress); } - getUnencryptedLogs(from: number, take: number): Promise { - return this.rpc.getUnencryptedLogs(from, take); + getUnencryptedLogs(from: number, limit: number): Promise { + return this.rpc.getUnencryptedLogs(from, limit); } getBlockNum(): Promise { return this.rpc.getBlockNum(); diff --git a/yarn-project/p2p/src/client/mocks.ts b/yarn-project/p2p/src/client/mocks.ts index 54f86d86b25..752bbd8e2e9 100644 --- a/yarn-project/p2p/src/client/mocks.ts +++ b/yarn-project/p2p/src/client/mocks.ts @@ -22,13 +22,13 @@ export class MockBlockSource implements L2BlockSource { } /** - * Gets the `take` amount of L2 blocks starting from `from`. + * Gets up to `limit` amount of L2 blocks starting from `from`. * @param from - Number of the first block to return (inclusive). - * @param take - The number of blocks to return. + * @param limit - The maximum number of blocks to return. * @returns The requested mocked L2 blocks. */ - public getL2Blocks(from: number, take: number) { - return Promise.resolve(this.l2Blocks.slice(from, from + take)); + public getL2Blocks(from: number, limit: number) { + return Promise.resolve(this.l2Blocks.slice(from, from + limit)); } /** diff --git a/yarn-project/rollup-provider/src/app.ts b/yarn-project/rollup-provider/src/app.ts index 1415ef5a5a0..98e3f321e78 100644 --- a/yarn-project/rollup-provider/src/app.ts +++ b/yarn-project/rollup-provider/src/app.ts @@ -48,8 +48,8 @@ export function appFactory(node: AztecNode, prefix: string) { router.get('/get-blocks', async (ctx: Koa.Context) => { const from = +ctx.query.from!; - const take = +ctx.query.take!; - const blocks = await node.getBlocks(from, take); + const limit = +ctx.query.limit!; + const blocks = await node.getBlocks(from, limit); const strs = blocks.map(x => x.encode().toString('hex')); ctx.set('content-type', 'application/json'); ctx.body = { @@ -114,13 +114,13 @@ export function appFactory(node: AztecNode, prefix: string) { router.get('/get-logs', async (ctx: Koa.Context) => { const from = +ctx.query.from!; - const take = +ctx.query.take!; + const limit = +ctx.query.limit!; const logType = Number(ctx.query.logType); if (logType !== 0 && logType !== 1) { throw new Error('Invalid log type: ' + ctx.query.logType); } - const logs = await node.getLogs(from, take, logType); + const logs = await node.getLogs(from, limit, logType); const strs = logs.map(x => x.toBuffer().toString('hex')); ctx.set('content-type', 'application/json'); ctx.body = { diff --git a/yarn-project/types/src/interfaces/aztec-node.ts b/yarn-project/types/src/interfaces/aztec-node.ts index f2e91687b9a..44773c41f43 100644 --- a/yarn-project/types/src/interfaces/aztec-node.ts +++ b/yarn-project/types/src/interfaces/aztec-node.ts @@ -29,10 +29,10 @@ export interface AztecNode extends DataCommitmentProvider, L1ToL2MessageProvider /** * Method to request blocks. Will attempt to return all requested blocks but will return only those available. * @param from - The start of the range of blocks to return. - * @param take - The number of blocks desired. + * @param limit - The maximum number of blocks to return. * @returns The blocks requested. */ - getBlocks(from: number, take: number): Promise; + getBlocks(from: number, limit: number): Promise; /** * Method to fetch the current block height. @@ -69,13 +69,13 @@ export interface AztecNode extends DataCommitmentProvider, L1ToL2MessageProvider getContractInfo(contractAddress: AztecAddress): Promise; /** - * Gets the `take` amount of logs starting from `from`. + * Gets up to `limit` amount of logs starting from `from`. * @param from - Number of the L2 block to which corresponds the first logs to be returned. - * @param take - The number of logs to return. + * @param limit - The maximum number of logs to return. * @param logType - Specifies whether to return encrypted or unencrypted logs. * @returns The requested logs. */ - getLogs(from: number, take: number, logType: LogType): Promise; + getLogs(from: number, limit: number, logType: LogType): Promise; /** * Method to submit a transaction to the p2p pool. diff --git a/yarn-project/types/src/interfaces/aztec_rpc.ts b/yarn-project/types/src/interfaces/aztec_rpc.ts index 8e0c2d039ee..8e8ca3d4d67 100644 --- a/yarn-project/types/src/interfaces/aztec_rpc.ts +++ b/yarn-project/types/src/interfaces/aztec_rpc.ts @@ -174,10 +174,10 @@ export interface AztecRPC { /** * Gets L2 block unencrypted logs. * @param from - Number of the L2 block to which corresponds the first unencrypted logs to be returned. - * @param take - The number of unencrypted logs to return. + * @param limit - The maximum number of unencrypted logs to return. * @returns The requested unencrypted logs. */ - getUnencryptedLogs(from: number, take: number): Promise; + getUnencryptedLogs(from: number, limit: number): Promise; /** * Get latest L2 block number. diff --git a/yarn-project/types/src/l1_to_l2_message.ts b/yarn-project/types/src/l1_to_l2_message.ts index d7311a8d01e..bd4397d54b8 100644 --- a/yarn-project/types/src/l1_to_l2_message.ts +++ b/yarn-project/types/src/l1_to_l2_message.ts @@ -8,11 +8,11 @@ import { Fr } from '@aztec/foundation/fields'; */ export interface L1ToL2MessageSource { /** - * Gets the `take` amount of pending L1 to L2 messages, sorted by fee - * @param take - The number of messages to return (by default NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP). + * Gets up to `limit` amount of pending L1 to L2 messages, sorted by fee + * @param limit - The maximum number of messages to return (by default NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP). * @returns The requested L1 to L2 messages' keys. */ - getPendingL1ToL2Messages(take?: number): Promise; + getPendingL1ToL2Messages(limit?: number): Promise; /** * Gets the confirmed L1 to L2 message with the given message key. diff --git a/yarn-project/types/src/l2_block_source.ts b/yarn-project/types/src/l2_block_source.ts index e2879dd7cf1..184266ae42b 100644 --- a/yarn-project/types/src/l2_block_source.ts +++ b/yarn-project/types/src/l2_block_source.ts @@ -11,12 +11,12 @@ export interface L2BlockSource { getBlockHeight(): Promise; /** - * Gets the `take` amount of L2 blocks starting from `from`. + * Gets up to `limit` amount of L2 blocks starting from `from`. * @param from - Number of the first block to return (inclusive). - * @param take - The number of blocks to return. + * @param limit - The maximum number of blocks to return. * @returns The requested L2 blocks. */ - getL2Blocks(from: number, take: number): Promise; + getL2Blocks(from: number, limit: number): Promise; /** * Starts the L2 block source. diff --git a/yarn-project/types/src/logs/l2_logs_source.ts b/yarn-project/types/src/logs/l2_logs_source.ts index d37446a178b..50cf9cb4ae2 100644 --- a/yarn-project/types/src/logs/l2_logs_source.ts +++ b/yarn-project/types/src/logs/l2_logs_source.ts @@ -6,13 +6,13 @@ import { LogType } from './log_type.js'; */ export interface L2LogsSource { /** - * Gets the `take` amount of logs starting from `from`. + * Gets up to `limit` amount of logs starting from `from`. * @param from - Number of the L2 block to which corresponds the first logs to be returned. - * @param take - The number of logs to return. + * @param limit - The maximum number of logs to return. * @param logType - Specifies whether to return encrypted or unencrypted logs. * @returns The requested logs. */ - getLogs(from: number, take: number, logType: LogType): Promise; + getLogs(from: number, limit: number, logType: LogType): Promise; /** * Starts the encrypted logs source.