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

[WIP] improve(HubPoolClient): Don't throw on token resolution failure #643

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pxrl
Copy link
Contributor

@pxrl pxrl commented May 10, 2024

WIP - there's lots of users of this function so there's a bit of fallout from the change. I'll update it progressively as each case is addressed.

This is too violent for a lot of use cases and requires callers to wrap their calls in try/catch statements, which has its own set of problems. Instead, just return undefined if the requested token can't be resolved and allow the caller to decide on how to respond to that.

pxrl added 2 commits May 10, 2024 15:46
This is too violent for a lot of use cases and requires callers to wrap
their calls in try/catch statements, which has its own set of problems.
Instead, just return undefined if the requested token can't be resolved
and allow the caller to decide on how to respond to that.
@@ -160,8 +161,10 @@ export function _buildPoolRebalanceRoot(
mainnetBundleEndBlock
);

updateRunningBalance(runningBalances, repaymentChainId, l1TokenCounterpart, totalRefundAmount);
updateRunningBalance(realizedLpFees, repaymentChainId, l1TokenCounterpart, totalRealizedLpFee);
if (isDefined(l1TokenCounterpart)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Leaving a comment here since this is just a temporary fix to let the code compile. I'm pretty sure this is a bad idea to do since if l1TokenCounterpart is undefined, then we probably do want to throw an error. (Maybe we should just assert that here).

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.

2 participants