-
Notifications
You must be signed in to change notification settings - Fork 87
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
fix: looser is_local_representation
#1815
Conversation
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.
Thanks for researching this @wischli, and for adding related tests
Ok(self == &local) | ||
Ok(self == &local.into()) | ||
} else { | ||
Ok(false) |
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.
Nice found!
#[test] | ||
fn is_local_happy_paths() { | ||
new_test_ext().execute_with(|| { | ||
assert_eq!(<CurrencyId as HasLocalAssetRepresentation<MockRegistry>>::is_local_representation_of(&USDC_LOCAL, &USDC_1), Ok(true)); |
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.
Just curious,
CurrencyId::is_local_representation_of()
Does not compile? Does the compiler force you to specify the trait?
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.
Unfortunately not, the AssetInspect
parameter type cannot be inferred. Tried different variants but none of the shortcuts worked.
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.
Thanks for the hustle! Nice found!
* add tests that fail and shouldn't * add fix * add extra tests
Description
Fixes issue which blocks FRAX <> USDC order fulfilments on Demo.
The current implementation of
is_local_representation
is too strict such that it throws an error if the checkedCurrencyId
has not configured a local representation. Instead, it should returnOk(false)
. This function has not been tested directly.To the best of my knowledge, this does not affect production for now as it only affects checking currencies which don't have a configured local asset, e.g. FRAX.
Checklist: