[Bug] Blob type being stack allocated leads to easy stack overflows
- Ngôn ngữ chính
- Rust
- Star
- 1.3k
- Fork
- 668
- Merge trung bình
- 2 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 29
Mô tả
### Component
consensus, eips, genesis
### What version of Alloy are you on?
1.0.24
### Operating System
None
### Describe the bug
I noticed some stack overflows with some tests I had written. The culprit is from this type in alloy-eips
```
/// A Blob serialized as 0x-prefixed hex string
pub type Blob = FixedBytes;
```
With `BYTES_PER_BLOB = 131_072` and FixedBytes being stack allocated it seems like alot to put on the stack and can easily overflow it in some situations especially if it ends up getting cloned a couple times. This simple test below will stack overflow on Arch and MacOs ive tested(in debug mode)
```
use alloy_rpc_types_engine::BlobsBundleV2;
use ssz::Encode as _;
#[test]
fn test() {
let blobs_bundle = BlobsBundleV2 {
commitments: vec![Default::default()],
proofs: vec![Default::default()],
blobs: vec![Default::default()],
};
let bytes = blobs_bundle.as_ssz_bytes();
// following line will stack overflow
let blob: BlobsBundleV2 = ssz::Decode::from_ssz_bytes(&bytes).unwrap();
}
```
Maybe we can Box<> this type to avoid these overflows?
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.