Skip to content

Conversation

bertllll
Copy link
Contributor

No description provided.

Copy link

cursor bot commented Sep 25, 2025

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on October 14.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

};
let transaction_fee_margin = PurePercentage::try_from(15).unwrap();
transaction_fee_margin.add_percent_to(gas_limit_dev_chain * gas_price_major)
transaction_fee_margin.increase_by_percent_for(gas_limit_dev_chain * gas_price_major)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to keep the word _for in the functions's name. Please eliminate it.

};
let analyzed_accounts =
convert_qualified_into_analyzed_payables_in_test(unadjusted_qualified_accounts.clone());
convert_qualified_p_into_analyzed_p(unadjusted_qualified_accounts.clone());
Copy link
Collaborator

Choose a reason for hiding this comment

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

This shorthand is not helping here, maybe even introducing jargon. I'd suggest if you use the name convert_qualified_payable_into_analyzed_payable, or if you want shorter than qualified_to_analyzed_payable.

"ERROR: {test_name}: Payable scanner is blocked from preparing instructions for payments. \
The cause appears to be in competence of the user."
"ERROR: {test_name}: Payable scanner is unable to generate payment instructions. \
It looks like only the user can resolve this issue."
Copy link
Collaborator

@utkarshg6 utkarshg6 Sep 29, 2025

Choose a reason for hiding this comment

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

Instead of saying, "It looks like...", we can just direct the user by saying, "The user will have to resolve the issue manually."

use crate::accountant::payment_adjuster::miscellaneous::data_structures::UnconfirmedAdjustment;
use crate::accountant::payment_adjuster::test_utils::local_utils::{
make_meaningless_weighed_account, make_non_guaranteed_unconfirmed_adjustment,
make_meaningless_unconfirmed_adjustment, make_meaningless_weighed_account,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the word, meaningless is unnecessary, unless you have an alternate fn which says, meaningful, the prefix word make is enough to signify that it's meant for the test, and the developer should consider that it's fields were generated for testing purposes.

I mean this for both make_meaningless_unconfirmed_adjustment and make_meaningless_weighed_account.

.iter()
.filter(|wallet| wallet.address() == wallet_3)
.collect_vec();
assert_eq!(wallets_same_as_wallet_3.len(), 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've no idea why you decided to remove this... I thought you prefer stronger tests.

use web3::types::Address;

pub fn thriving_competitor_found_diagnostics(
pub fn diagnostics_for_accounts_above_disqualification_limit(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it mean that these accounts are disqualified or qualified? I'd suggest you either add it as a comment, or possibly rename the fn to make it clear.


pub enum AccountsByFinalization {
Unexhausted(Vec<AdjustedAccountBeforeFinalization>),
Finalized(Vec<PayableAccount>),
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does these enum variants? Their name doesn't appear to be mutually exclusive. For example, if you're using Unexhausted, then shouldn't the other be Exhausted? Similarly, if it's Finalized, then shouldn't the other variant be Incomplete?

Since they aren't mutually exclusive, I find them very confusing.

|tx_fee_check_err_opt: Option<TransactionFeeImmoderateInsufficiency>,
service_fee_check_err_opt: Option<ServiceFeeImmoderateInsufficiency>| {
PaymentAdjusterError::AbsolutelyInsufficientBalance {
PaymentAdjusterError::AbsoluteFeeInsufficiency {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer the older name. That's clearer.

let number_of_accounts = current_set_of_accounts.len();
PaymentAdjusterError::AbsolutelyInsufficientServiceFeeBalancePostTxFeeAdjustment {
original_number_of_accounts: self.original_number_of_accounts,
PaymentAdjusterError::AbsoluteFeeInsufficiency {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't it be simply "InsufficientBalance"?

)
.unwrap();
assert_eq!(adjustment_is_needed_actual, *adjustment_is_needed_expected);
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nicely done! 👏

assert_eq!(
result,
LateServiceFeeSingleTxErrorFactory {
LaterServiceFeeErrorFactory {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be LateServiceFeeErrorFactory instead? I'm implying to use the word Late instead of Later.

below_disq_limit.push(current)
}
(above_or_even_to_disq_limit, below_disq_limit)
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this could be further refactored like this:

let fold_guts = |(mut above_limit, mut below_limit): (Vec<_>, Vec<_>), current: UnconfirmedAdjustment| {
    let disqualification_limit = current.disqualification_limit_minor();
    
    if current.proposed_adjusted_balance_minor >= disqualification_limit {
        diagnostics_for_accounts_above_disqualification_limit(&current, disqualification_limit);
        
        let adjusted = UnconfirmedAdjustment {
            proposed_adjusted_balance_minor: disqualification_limit,
            ..current
        };
        above_limit.push(adjusted);
    } else {
        below_limit.push(current);
    }
    
    (above_limit, below_limit)
};

"Balance wei: {}\n\
Threshold: {}",
payable.balance_wei, threshold
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this...

Copy link
Collaborator

@utkarshg6 utkarshg6 left a comment

Choose a reason for hiding this comment

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

Continue with node/src/accountant/payment_adjuster/non_unit_tests/mod.rs

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.

2 participants