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

Hermes may break the max_tx_size configuration param #2477

Closed
5 tasks
ancazamfir opened this issue Jul 29, 2022 · 3 comments · Fixed by #2480
Closed
5 tasks

Hermes may break the max_tx_size configuration param #2477

ancazamfir opened this issue Jul 29, 2022 · 3 comments · Fixed by #2480
Assignees
Milestone

Comments

@ancazamfir
Copy link
Collaborator

ancazamfir commented Jul 29, 2022

Summary of Bug

When we batch messages in a Tx we may exceed the max_tx_size if max_msg_num is not hit. The problem code is here:
https://github.com/informalsystems/ibc-rs/blob/1d188187721051a34d20841c0146b8c16b5b413b/relayer/src/chain/cosmos/batch.rs#L152-L157
We keep in the batch the msg that caused the crossing of max_tx_size.

It becomes an issue with chains like osmosis where Tx-es with size bigger than some threshold may be priced differently resulting in Tx simulation failure and no recovery (see #2422, the threshold is exceeded with 3 msgs, one update client and two packet messages)

In addition, the actual Tx will be slightly bigger due to extra auth encoding and we should do something about it.

Version

all recent

Steps to Reproduce

The code is obviously wrong but:

  • add assert!(current_size < max_tx_size); after L154
  • configure hermes with:
max_msg_num = 50
max_tx_size = 15000
  • send 100 packets

Acceptance Criteria


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@mzabaluev mzabaluev self-assigned this Jul 29, 2022
@adizere adizere added this to the v1.0.0 milestone Jul 29, 2022
@adizere adizere changed the title hermes may build Tx-es with size > max_tx_size Hermes may break the max_tx_size configuration param Jul 29, 2022
@soareschen
Copy link
Contributor

Since batch_messages is now a pure function, we should write some unit tests that test the behavior of batch_messages directly without having to run the full integration test.

@mzabaluev
Copy link
Contributor

Since batch_messages is now a pure function, we should write some unit tests that test the behavior of batch_messages directly without having to run the full integration test.

Thanks for reminding, it's good unit testable function indeed.

@seanchen1991
Copy link
Contributor

@mzabaluev I've started working on adding some unit tests

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 a pull request may close this issue.

5 participants