Uh oh!
There was an error while loading. Please reload this page.
Fix: Batcher User Balance Checks - #1404
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
MauroToscano
commented
Nov 13, 2024
Code looks good, may need some extra testing |
| let mut min_fee = user_min_fee; | ||
| if user_min_fee == U256::max_value() { | ||
| min_fee = user_max_fee | ||
| } | ||
| let min_balance: U256 = U256::from(user_proofs_in_batch) * min_fee; |
There was a problem hiding this comment.
Maybe I am wrong here but why don't we move the min_balance check after the msg_max_fee check? This way, in the min_balance check we'll verify against the msg_max_fee directly (as it will become the new min_fee if everything goes ok), we'll save ourselves this if:
if user_min_fee == U256::max_value(){
min_fee = user_max_fee
}It is hard to understand that U256::max_value() is the default value.
There was a problem hiding this comment.
My thoughts are to leave this check in as it handles an explicit case that a user's proof has been submitted for the first time not the replacement max_fee invariant. I we move this check behind the msg_max_fee check we still need to have logic to check and specify that if a proof is submitted for the first time we use it's submitted max_fee instead of the user_max_fee. I think it's worth considering verifying that these checks are not redundant, but lets address that in another issue.
cee3b0c to
e242905Compare
uri-99
left a comment
There was a problem hiding this comment.
the removed var, MIN_FEE_PER_PROOF, is no longer used in the codebase.
We should remove it from the constants file as well
uri-99
commented
Nov 15, 2024
Its working now but I can't approve it because i made this pr |
MarcosNicolau
left a comment
There was a problem hiding this comment.
Tested on macos, everything worked fine. Code looks good, I leave some comments that you can address if you want.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
uri-99
commented
Nov 19, 2024
1 sec testing something |

Fix: Batcher User Balance Checker
Description
Replaces the hardcoded constant in https://github.com/yetanotherco/aligned_layer/blob/testnet/batcher/aligned-batcher/src/lib.rs#L607 with the user's
min_fee. Addresses the first point of #1383 .This fix is done by adding
total_fees_in_queuevariable in the UserState struct, and comparing if user has enough balance to pay for the needed amount.This PR also refactors the infamous
min_feevariable, to be calledmax_fee_limit/last_max_fee_limitThis PR also adds some metrics of this. dont forget to visualize them in the following tests running
To Test:
test 1
1.) Start a local testnet with an no balance:
2.) Create a wallet with no funds
3.)
ensure the proof submission errors within the batcher with
InsufficientBalance.test 2
1.) Fund the wallet by sending eth from a prefunded anvil account:
cast send <WALLET_ADDRESS --rpc-url http://localhost:8545 --private-key 2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 --value 1ether2.) Fund the batcher with an insufficient balance for multiple proofs.
3.) Send one proof, see it succeeds.
4.) Send a burst of 10 or more proofs, observe it submission fails due to insufficient balance.
Type of change
Please delete options that are not relevant.
Checklist