argumentcomputer / argumentcomputer/zk-light-clients
SIGSEGV in ethereum `generate_test_assets` in debug mode
- Dominant language
- Rust
- Stars
- 70
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
When running either `generate_committee_change_test_assets` or `generate_inclusion_test_assets` in debug mode or with `RUSTFLAGS="-C opt-level=0"`, the program runs into a segmentation fault inside `Bootstrap::from_ssz_bytes` when calling `SyncCommittee::from_ssz_bytes`. Passing `--release` or any other `opt-level` value causes the issue to go away.
Can be replicated with:
```
cargo test -F ethereum -- test_execute_committee_change
cargo test -F ethereum -- test_execute_inclusion
```
Looking with gdb, this seems to be a issue where `SyncCommittee::from_ssz_bytes` is receiving a different argument from what was passed to it. It doesn't look like a stack overflow issue. The code itself looks very innocuous and nothing weird is happening there. Seemingly both tests fail in the exact same way. Running under miri didn't report any errors and didn't segfault. I couldn't get it to run under valgrind or with ASAN enabled.
I'm not sure what the issue is, and the fact it depends on optimization level makes me suspicious it might be a weird LLVM/Rustc bug. This replicates on both on nightly and stable.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running `cargo test -F ethereum -- test_execute_committee_change` and `cargo test -F ethereum -- test_execute_inclusion` with debug settings, then trace the calls into `Bootstrap::from_ssz_bytes` and `SyncCommittee::from_ssz_bytes` under gdb. Done means identifying and fixing the optimization-dependent segmentation fault so both tests pass in debug mode as well as release mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- blockchain
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100