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

feat: add amendments status backtracking #223

Merged
merged 4 commits into from
Apr 2, 2024

Conversation

pdp2121
Copy link
Collaborator

@pdp2121 pdp2121 commented Mar 28, 2024

High Level Overview of Change

Currently we are using p2p.livenet.ripple.com to retrieve amendments enablement via ledger + 1 for mainnet. However, its connection is very inconsistent, led to missing information.

We should backtrack every 30 minutes using clio for mainnet to retrieve this information in case the connections get lost. We would also backtrack major networks like testnet and devnet to ensure we have adequate data for these networks.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Test Plan

Ran without breaking on staging

@pdp2121 pdp2121 changed the title feat: Add backtracking feat: add amendments status backtracking Mar 28, 2024
src/connection-manager/wsHandling.ts Outdated Show resolved Hide resolved
Copy link

@justinr1234 justinr1234 left a comment

Choose a reason for hiding this comment

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

Left optional comments and approved

void createConnections()
}, CM_INTERVAL)

setInterval(() => {
void backtrackAmendmentStatus()

Choose a reason for hiding this comment

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

Technically speaking you need to have the ability to cancel a previous request in the event this request isn’t finished by the next interval tick (even if unlikely, it could happen)

url: string,
): Promise<void> {
try {
log.info(`Backtracking to update amendment status for ${network}...`)

Choose a reason for hiding this comment

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

Are the faucet url to debug

})

await handleWsMessageLedgerEnableAmendments(
ledger as LedgerResponseCorrected,

Choose a reason for hiding this comment

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

Can you avoid as?

Copy link
Collaborator Author

@pdp2121 pdp2121 Apr 2, 2024

Choose a reason for hiding this comment

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

There's a missing field hash for the BaseTransaction in xrpl.js (which should be fixed), so I would need to cast to LedgerResponseCorrected which I created to capture the hash. Once this is fixed in our client library then there would be no need for custom field or casting. I will drop a TODO for it.

log.info(`Finished backtracked amendment status for ${network}...`)
} catch (error) {
log.error(
`Failed to backtrack amendment status for ${network} due to error: ${String(

Choose a reason for hiding this comment

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

It shouldn’t be necessary to wrap in String since toString is automatically called anyways

Copy link
Collaborator Author

@pdp2121 pdp2121 Apr 2, 2024

Choose a reason for hiding this comment

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

This is to avoid linting issue for backtick string

@pdp2121 pdp2121 merged commit baaf0f8 into main Apr 2, 2024
4 checks passed
@pdp2121 pdp2121 deleted the add-amendment-status-backtrack branch April 2, 2024 18:34
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.

None yet

3 participants