-
Notifications
You must be signed in to change notification settings - Fork 992
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
Implement BlockSpaceAllocator
state machine
#778
Implement BlockSpaceAllocator
state machine
#778
Conversation
be62303
to
17c7c78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PRs are in draft
apps/src/lib/node/ledger/shell/prepare_proposal/block_space_alloc.rs
Outdated
Show resolved
Hide resolved
apps/src/lib/node/ledger/shell/prepare_proposal/block_space_alloc.rs
Outdated
Show resolved
Hide resolved
// TODO: what if a tx has a size greater than the threshold for | ||
// its bin? how do we handle this? if we keep it in the mempool | ||
// forever, it'll be a DoS vec, as we can make nodes run out of | ||
// memory! maybe we should allow block decisions for txs that are | ||
// too big to fit in their respective bin? in these special block | ||
// decisions, we would only decide proposals with "large" txs?? | ||
// | ||
// MAYBE: in the state machine impl, reset to beginning state, and | ||
// and alloc space for large tx right at the start. the problem with | ||
// this is that then we may not have enough space for decrypted txs | ||
|
||
// TODO: panic if we don't have enough space reserved for a | ||
// decrypted tx; in theory, we should always have enough space | ||
// reserved for decrypted txs, given the invariants of the state | ||
// machine | ||
|
||
// TODO: refactor our measure of space to also reflect gas costs. | ||
// the total gas of all chosen txs cannot exceed the configured max | ||
// gas per block, otherwise a proposal will be rejected! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these could have GH issues
apps/src/lib/node/ledger/shell/prepare_proposal/block_space_alloc.rs
Outdated
Show resolved
Hide resolved
@james-chf yeah I set them all to draft PRs, since the top priority right now is getting rid of digests. then these PRs will be based on those changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will look at #774 to see how this PR is used
apps/src/lib/node/ledger/shell/prepare_proposal/block_space_alloc.rs
Outdated
Show resolved
Hide resolved
apps/src/lib/node/ledger/shell/prepare_proposal/block_space_alloc.rs
Outdated
Show resolved
Hide resolved
…bridge/impl-tx-bins-state-machine
/// | ||
/// Signal the caller if the tx is larger than its max | ||
/// allotted bin space. | ||
fn try_dump(&mut self, tx: &[u8]) -> Result<(), AllocFailure> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could rename this error as Constipation
. 💩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
legit lol'd at this
Separated from #774
Allocate space for the different
TxBin
instances depending on the current phase of a type-level state machine. This will be useful to allow, e.g. decrypted txs to use as much space as needed, or to disallow including user encrypted txs in blocks when space is a critical resource needed for protocol level txs.Unit tests will be added in a new PR, to simplify the review process.