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

feat: Introduce msg_limit for application subnets in payload builder #1798

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stiegerc
Copy link
Contributor

@stiegerc stiegerc commented Oct 2, 2024

After inducting a stream slice, the number of signals in the outgoing stream is equal to number_of_signals_after_gcing + number_of_messages_inducted. So if we want to cap the number of signals in a stream at 50k, we can induct no more than 50k - number_of_signals_after_gcing number of messages.

Gc'ing signals is done using begin in the stream slice, so number_of_signals_after_gcing = outgoing_stream_signals_end - incoming_slice_begin; the signals_end of the outgoing stream is given by message_index of ExpectedIndices.

One way or another this means we now have a cap on how many messages we can extract from the slice pool in any case. Since there already is a mechanism for limiting the number of messages called msg_limit it seems logical to modify this accordingly. Note that this is not handed in from outside but rather initialized by the function get_msg_limit() in get_xnet_payload_impl() and validate_slice(). To include what I laid out out above in get_msg_limit(), I need the signals_end of the outgoing stream and the begin of the stream slice we want to extract.

In validate_slice() both are available, in get_xnet_payload_impl() the begin of the stream slice is not. But msg_limit is only passed down to a place where it is.

What this PR does is move the call to get_msg_limit() further down to where all the variables are available. All I have to do for that is pass a reference to the state rather than the msg_limit.

@stiegerc stiegerc changed the title msg_limit for application subnets in payload builder feat: Introduce msg_limit for application subnets in payload builder Oct 2, 2024
@github-actions github-actions bot added the feat label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant