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

Make tx size calculation consistent #3937

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

marta-lokhova
Copy link
Contributor

@marta-lokhova marta-lokhova commented Sep 14, 2023

Follow-up to #3786 to resolve #3765. Also, I updated the calculation on the overlay side to not include XDR type overhead (4 bytes).

@dmkozh
Copy link
Contributor

dmkozh commented Sep 14, 2023

Thanks for the fix, please update the test.

@@ -75,8 +75,55 @@ FlowControlByteCapacity::getCapacityLimits() const
uint64_t
FlowControlByteCapacity::getMsgResourceCount(StellarMessage const& msg) const
{

return static_cast<uint64_t>(xdr::xdr_argpack_size(msg));
switch (msg.type())
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this different from the generated implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need to exclude size of type (additional 4 bytes) for the calculation to be consistent with the rest of the codebase. I updated this function to be less verbose though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, it's much more clear now.

@marta-lokhova marta-lokhova force-pushed the tx_size_fix branch 2 times, most recently from a15c415 to 006b6af Compare September 20, 2023 22:09
@dmkozh
Copy link
Contributor

dmkozh commented Sep 21, 2023

r+ 0843e92

@latobarita latobarita merged commit ddbae4e into stellar:master Sep 21, 2023
6 checks passed
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.

Make tx size limits consistent across the codebase
3 participants