-
Notifications
You must be signed in to change notification settings - Fork 391
feat(batcher): add queue limit #1875
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
Conversation
Changes to gas cost
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
the function was making lots of assumptions in its usage
MarcosNicolau
left a comment
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.
Tested and it works fine. I've introduced some changes to make it more readable and remove many assumptions that were not documented with hidden behavior. Also, the pr was missing a how to test section, so I've update it.
JuArce
left a comment
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.
Use cases:
- Queue is full (1 element). Same user
- Send proof with less fee from same user ✅ new proof is rejected
- Send proof with same fee from same user ✅ new proof is rejected
- Send proof with greater fee from same user ✅ new proof is rejected
- Queue is full (1 element). Diferent user
- Send proof with less fee from diferent user ✅ new proof is rejected
- Send proof with same fee from diferent user ✅ new proof is rejected
- Send proof with greater fee from diferent user ✅ new proof is accepted
- Queue is full (1 element). Replacement
- Send proof with less fee, same nonce from same user ✅ new proof is rejected
- Send proof with same fee, same nonce from same user ✅ new proof is accepted
- Send proof with greater fee, same nonce from same user ✅ new proof is accepted
- Queue is full (3 elements) Same user sends 3 proofs with the same fee
- Send proof with less fee from same user ✅ new proof is rejected
- Send proof with same fee from same user ✅ new proof is rejected
- Send proof with greater fee from diferent user 🚧 new proof is accepted, but the old user connection is closed, despite it has 2 proof in the queue. Only one proof is removed
Description
Added queue limit in the batcher. When a new proof is added and the queue limit is exceded, the least priority element is removed and the WS is closed with an UnderpricedProof to the sender.
How to test
max_queue_sizein the batcher to a lower number:config-files/config-batcher.yamcd batcher/aligned cargo run --release -- deposit-to-batcher --amount 0.1ether --private_key 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a cargo run --release -- deposit-to-batcher --amount 0.1ether --private_key 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a610as the max_queue_limit:cd batcher/aligned cargo run --release -- submit --proving_system SP1 --proof ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.proof --vm_program ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.elf --repetitions 10 --private_key 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 --custom_fee_estimate 15max_fee, you should see the other ones are replaced:cd batcher/aligned cargo run --release -- submit --proving_system SP1 --proof ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.proof --vm_program ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.elf --repetitions 10 --private_key 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 --custom_fee_estimate 14max_feeis less than the lowest priority proof, they should be rejected in that case.Type of change
Checklist
testnet, everything else tostaging