-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: master
Are you sure you want to change the base?
Add ICP exporter #207
Conversation
|
||
const transactions = await this.getTransactions(blocks); | ||
|
||
this.lastExportedBlock += blocks.length; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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[]) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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
No description provided.