Skip to content
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

Add ICP exporter #207

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Add ICP exporter #207

wants to merge 8 commits into from

Conversation

antisaa
Copy link
Contributor

@antisaa antisaa commented Oct 25, 2024

No description provided.


const transactions = await this.getTransactions(blocks);

this.lastExportedBlock += blocks.length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we assert that we have results for exactly numConcurrentRequests of blocks? Potential problem is the following example. Asking for blocks 1 to 3 and getting results for blocks 1 and 3 only (2 blocks, not 3). This would create weird math of lastExportedBlock being 2, where maybe it should be 3.

export const CONFIRMATIONS = getIntEnvVariable('CONFIRMATIONS', 10);
export const NODE_URL = process.env.NODE_URL || 'http://localhost:8545/';
export const LOOP_INTERVAL_CURRENT_MODE_SEC = getIntEnvVariable('LOOP_INTERVAL_CURRENT_MODE_SEC', 10);
exports.RPC_USERNAME = process.env.RPC_USERNAME;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixing two different syntaxes here, most probably this can be unified to:

export RPC_USERNAME = ...

return fetchWithRetry(0); // Start with the first attempt
}

async getTransactions(blocks: ICPBlock[]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function holds all the domain specific knowledge, it should be unit tested.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a pure function, so you can move it to a separate utils file and test it easily.

Copy link
Contributor

@YordanPavlov YordanPavlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests. LGTM.

Add missing fields to ICP exporter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants