-
Notifications
You must be signed in to change notification settings - Fork 44
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
Respect trustline limit in to_classic
conversions
#516
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.
LGTM. Just wanted to point out that to_classic
was renamed to export
.
Sure, I'm aware of this. That's just a cherry-pick from an older branch. |
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.
One question that comes from my lack of knowledge about how this works in stellar-core, so no need to block merging.
soroban-env-host/src/host.rs
Outdated
@@ -1002,6 +1002,7 @@ impl Host { | |||
let max_balance = i64::MAX; | |||
(min_balance, max_balance) | |||
}; | |||
let max_balance = min(max_balance, tl.limit); |
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 excludes the buying liabilities from the limit, rather than reduces the limit by the buying liabilities. Is that correct?
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 seems suspicious to me because this would, I think, mean that you could exceed your limit by canceling things that create buying liabilities.
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.
Yeah you're right. max_balance
should be initialized with tl.limit
instead of i64::MAX
.
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.
I think you are right, changed this to apply limit before liabilities.
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 looks good to me. Is this being tested in the follow testing PR referenced previously? @sisuresh can this be merged now?
What
Respect trustline limit in
to_classic
conversionsWhy
This is to respect the trustline invariant of balance not exceeding the limit.
Known limitations
N/A