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

Limit event msg size & event number per operation #4768

Open
wants to merge 7 commits into
base: mainnet_2_3
Choose a base branch
from

Conversation

sydhds
Copy link
Contributor

@sydhds sydhds commented Oct 25, 2024

No description provided.

@sydhds sydhds marked this pull request as draft October 25, 2024 08:30
@sydhds sydhds marked this pull request as ready for review October 25, 2024 15:03
@sydhds sydhds requested a review from bilboquet October 25, 2024 15:03
// Note on lifetimes:
// 'a -> is the lifetime for self -> because the iterator returns items from self
// 'b -> is the lifetime for filter -> because the returning iterator captures filter
// and we have lifetime 'a > 'b because filter can live less than self
Copy link
Contributor

Choose a reason for hiding this comment

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

do you mean "can't live"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No here lifetime 'b has the following bound: 'a: 'b. So it means that lifetime 'b can live less than lifetime 'a

@@ -1150,6 +1152,24 @@ impl Interface for InterfaceImpl {

let mut context = context_guard!(self);
let event = context.event_create(data, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe move this line just after

 if event_per_op >= self.config.max_event_per_operation {
    bail!("Too many event for this operation");
}

(only create the event if it's possible)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

@bilboquet bilboquet left a comment

Choose a reason for hiding this comment

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

2 minor comments
it's looking good to me

@sydhds sydhds requested a review from bilboquet October 30, 2024 13:24
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