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

fix!(pallet-gear): append outgoing bytes limit to prevent runtime allocator overflow #3743

Merged
merged 31 commits into from
Mar 5, 2024

Conversation

grishasobol
Copy link
Member

@grishasobol grishasobol commented Feb 21, 2024

Resolves https://github.com/gear-tech/core-audit/issues/25 and #3718

  1. Appends OutgoingBytesLimit runtime constant and corresponding outgoing_bytes_limit to ContextSettings.
  2. MessageContext now takes in account outgoing_bytes_limit in send_commit, send_push, send_push_input.

P.S. special thanks to @gshep @techraed

core-processor/src/common.rs Outdated Show resolved Hide resolved
core/src/message/context.rs Show resolved Hide resolved
core/src/message/context.rs Show resolved Hide resolved
core/src/message/context.rs Show resolved Hide resolved
core/src/message/mod.rs Show resolved Hide resolved
pallets/gear/src/lib.rs Outdated Show resolved Hide resolved
pallets/gear/src/queue.rs Show resolved Hide resolved
@grishasobol grishasobol self-assigned this Feb 21, 2024
@grishasobol grishasobol added the A0-pleasereview PR is ready to be reviewed by the team label Feb 21, 2024
@grishasobol grishasobol changed the title Gsobol outgoing bytes limit fix!(node): append outgoing bytes limit to prevent runtime allocator overflow Feb 21, 2024
@grishasobol grishasobol changed the title fix!(node): append outgoing bytes limit to prevent runtime allocator overflow fix!(pallet-gear): append outgoing bytes limit to prevent runtime allocator overflow Feb 21, 2024
core/src/message/context.rs Outdated Show resolved Hide resolved
core-processor/src/common.rs Outdated Show resolved Hide resolved
@NikVolf
Copy link
Member

NikVolf commented Feb 25, 2024

Can you move your PR notes to the code itself @grishasobol ?

And resolve the rest

@grishasobol
Copy link
Member Author

Can you move your PR notes to the code itself @grishasobol ?

And resolve the rest

Ok, some of them truly can be added in code. About possible gear_run panics - I'm thinking what is better to do to prevent them

@NikVolf
Copy link
Member

NikVolf commented Feb 29, 2024

@breathx please

Pls wait for my review

core-processor/src/common.rs Outdated Show resolved Hide resolved
runtime/vara/src/lib.rs Show resolved Hide resolved
core-errors/src/lib.rs Show resolved Hide resolved
core-processor/src/executor.rs Show resolved Hide resolved
core-processor/src/executor.rs Show resolved Hide resolved
core/src/message/context.rs Outdated Show resolved Hide resolved
core/src/message/context.rs Outdated Show resolved Hide resolved
core/src/message/context.rs Show resolved Hide resolved
Copy link
Member

@breathx breathx left a comment

Choose a reason for hiding this comment

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

Everything is good, thanks for your patience!

Requesting changes due to lack of impls and tests for reply_push, reply_push_input and reply_commit

core/src/message/context.rs Show resolved Hide resolved
core/src/message/context.rs Outdated Show resolved Hide resolved
@breathx breathx added A3-gotissues PR occurred to have issues after the review and removed A0-pleasereview PR is ready to be reviewed by the team labels Mar 4, 2024
@grishasobol
Copy link
Member Author

Everything is good, thanks for your patience!

Requesting changes due to lack of impls and tests for reply_push, reply_push_input and reply_commit

We don't need to implement this for replys because this is outgoing messages bytes limit. Reply is limited by max message size and we do not need to append additional counter for replies.

@grishasobol grishasobol added the A0-pleasereview PR is ready to be reviewed by the team label Mar 5, 2024
core/src/message/mod.rs Show resolved Hide resolved
@grishasobol grishasobol merged commit 3135f83 into master Mar 5, 2024
10 checks passed
@grishasobol grishasobol deleted the gsobol-outgoing-bytes-limit branch March 5, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-pleasereview PR is ready to be reviewed by the team A3-gotissues PR occurred to have issues after the review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

does not make system unreserve in case ExecutionError::Actor is returned
5 participants