-
Notifications
You must be signed in to change notification settings - Fork 658
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(runtime) - Mitigate the receipt size limit bug (#12633)
There is a bug (#12606) which allows to create receipts which are slightly larger than `max_receipt_size`. Let's mitigate the issue by making the runtime able to handle receipts that are above `max_receipt_size`. First the size limit check is relaxed to check only new receipts. Then the receipt forwarding logic is modified to pretend that all receipts have `congestion_size` below `max_receipt_size`. This mostly matches the code that was added in `2.3.1` and `2.4.0`, but this PR contains one more change that is needed for bandwidth scheduler. Before bandwidth scheduler we were able to forward receipts that are slightly above the `max_receipt_size` because the big outgoing limit was 4.5 MiB and `try_forward` pretended that all receipts are at most 4 MiB. With bandwidth scheduler this changes, bandwidth scheduler expects all receipts to be at most `max_receipt_size`, otherwise there's no guarantee that the receipt will ever be forwarded. To deal with this there's the change which pretends that all receipts are at most `max_receipt_size` when generating bandwidth requests. This is just a mitigation, a proper fix will be done in the future. One more advantage of this patch is that it should allow us to reduce `max_receipt_size` without crazy protocol upgrade logic. We could reduce it to e.g 2MB and the scheduler would still be able to handle 4MB receipts created in the previous protocol version. I added some of tests which try to create a receipt above max size and check that everything still works fine. As usual the `test_transaction_limit_for_local_congestion` test broke when I added more methods to the `test-contract-rs` contract. For some reason this test is very sensitive to contract size and the congestion level rapidly drops when size of the contract increases. To deal with this I added a separate small contract that is used exclusively by these congestion control tests, that should fix the issue once and for all. The change is divided into commits for easier review.
- Loading branch information
1 parent
cd21498
commit 83bf747
Showing
11 changed files
with
945 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.