-
Notifications
You must be signed in to change notification settings - Fork 106
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
Check Transaction cardinality at parse time, to limit memory usage #1917
Labels
A-consensus
Area: Consensus rule updates
A-rust
Area: Updates to Rust code
C-security
Category: Security issues
I-invalid-data
Zebra relies on invalid or untrusted data, or sends invalid data
I-slow
Problems with performance or responsiveness
Comments
teor2345
added
C-bug
Category: This is a bug
A-consensus
Area: Consensus rule updates
A-rust
Area: Updates to Rust code
S-needs-triage
Status: A bug report needs triage
NU-5
Network Upgrade: NU5 specific tasks
P-High
C-security
Category: Security issues
I-slow
Problems with performance or responsiveness
I-unbounded-growth
Zebra keeps using resources, without any limit
I-invalid-data
Zebra relies on invalid or untrusted data, or sends invalid data
labels
Mar 17, 2021
This was referenced Mar 17, 2021
Merged
teor2345
changed the title
Implement Transaction count constraints at parse time, to limit memory usage
Check Transaction cardinality at parse time, to limit memory usage
Mar 17, 2021
Actually Orchard is more important than this local node security fix. |
2 tasks
Adding this one to Sprint 24 for discussion |
teor2345
added
P-Medium
and removed
C-bug
Category: This is a bug
NU-5
Network Upgrade: NU5 specific tasks
P-High
I-unbounded-growth
Zebra keeps using resources, without any limit
labels
Nov 24, 2021
This is done |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-consensus
Area: Consensus rule updates
A-rust
Area: Updates to Rust code
C-security
Category: Security issues
I-invalid-data
Zebra relies on invalid or untrusted data, or sends invalid data
I-slow
Problems with performance or responsiveness
Motivation
Zebra can use a lot of memory when parsing malicious transactions, but we can use existing consensus rules to limit memory usage at parse time.
We should also
Box
some of the largeOption
al data structures, so that memory isn't allocated unless they are actually used. Then we can statically assert that theTransaction
,Output
, andSpend
types aren't too large.We should make these fixes after the Orchard designs and code (#1886 and #1860) and
SafeAllocate
(#1920) are implemented.Solution
zebra_consensus::transaction::check::has_inputs_and_outputs
SafeAllocate
limits forSpend
,Output
andAction
are all less than2^16
(done in Check nSpendsSapling, nOutputsSapling, and nActionsOrchard 2^16 limit #3069 and Add missing nSpendsSapling limit check #3076)Alternative Designs
We could
Box
data structures that are insideVec
s, but that increases memory fragmentation, and doesn't help if the incoming message or block has enough data to fill theVec
.The text was updated successfully, but these errors were encountered: