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

LPv2: Isolate gateway weights #1972

Merged
merged 1 commit into from
Aug 16, 2024
Merged

LPv2: Isolate gateway weights #1972

merged 1 commit into from
Aug 16, 2024

Conversation

lemunozm
Copy link
Contributor

@lemunozm lemunozm commented Aug 16, 2024

Description

Small PR to move the weight checks to MessageProcessor.

Like the fact that now only the MessageProcessor trait implementation knows about weights

@lemunozm lemunozm requested review from cdamian and wischli August 16, 2024 19:25
@lemunozm lemunozm self-assigned this Aug 16, 2024
);

let weight = match counter {
0 => LP_DEFENSIVE_WEIGHT / 10,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We want to add just a bit if we fail even before starting to process the first message

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we maybe add a LP_MIN_WEIGHT or something?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer hardcoding that as well, yes. An alternative would be a simple fn defensive_weight(counter).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't read it, and I had the auto-merge enabled. Tech-debt

return (Err(e), weight.saturating_mul(count));
}

if let Err(e) = Self::upsert_pending_entry(message_proof, &router_id, inbound_entry) {
Copy link
Contributor

Choose a reason for hiding this comment

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

My eyes are not bleeding anymore when looking at this, thank you <3

Copy link
Contributor Author

@lemunozm lemunozm Aug 16, 2024

Choose a reason for hiding this comment

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

BTW, liked that you moved the outbound processing impl into the MessageProcessor, now everything is quite unified 🙌🏻

@lemunozm lemunozm enabled auto-merge (squash) August 16, 2024 19:54
Copy link
Contributor

@wischli wischli left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this! LGTM but I would prefer hardcoding the reduced defensive weight.

);

let weight = match counter {
0 => LP_DEFENSIVE_WEIGHT / 10,
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer hardcoding that as well, yes. An alternative would be a simple fn defensive_weight(counter).

@lemunozm lemunozm merged commit 771fb78 into main Aug 16, 2024
8 of 14 checks passed
@lemunozm lemunozm deleted the lp/isolate_gateway_weights branch August 16, 2024 21:44
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.

3 participants