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

bug: Zebra panics with "Sprout note commitment tree must exist if there is a finalized tip" shortly after launch #7581

Closed
1 of 4 tasks
teor2345 opened this issue Sep 19, 2023 · 2 comments · Fixed by #7590
Closed
1 of 4 tasks
Assignees
Labels
A-concurrency Area: Async code, needs extra work to make it work properly. A-state Area: State / database changes C-bug Category: This is a bug C-security Category: Security issues I-panic Zebra panics with an internal error message I-remote-trigger Remote nodes can make Zebra do something bad

Comments

@teor2345
Copy link
Collaborator

teor2345 commented Sep 19, 2023

What happened?

I expected to see this happen:

Zebra always launches successfully.

Instead, this happened:

Zebra panics with "Sprout note commitment tree must exist if there is a finalized tip" shortly after launch.

What were you doing when the issue happened?

Testing the subtree code in PR #7566 on my local machine
Testing unrelated code on my local machine
Running unrelated PRs in CI

Zebra logs

Exit Status:
command terminated unsuccessfully by signal 6
Stdout:
Stderr:
The application panicked (crashed).
Message: Sprout note commitment tree must exist if there is a finalized tip
Location: zebra-state/src/service/finalized_state/zebra_db/shielded.rs:97
Metadata:
failures:
config_tests

Zebra Version

zebrad 1.2.0, multiple commits on different PRs

Which operating systems does the issue happen on?

  • Linux
  • macOS
  • Windows
  • Other OS

OS details

various machines: CI, local machine

Additional information

The panic is from the expect() in:

/// Returns the Sprout note commitment tree of the finalized tip
/// or the empty tree if the state is empty.
pub fn sprout_tree(&self) -> Arc<sprout::tree::NoteCommitmentTree> {
let height = match self.finalized_tip_height() {
Some(h) => h,
None => return Default::default(),
};
let sprout_nct_handle = self.db.cf_handle("sprout_note_commitment_tree").unwrap();
self.db
.zs_get(&sprout_nct_handle, &height)
.map(Arc::new)
.expect("Sprout note commitment tree must exist if there is a finalized tip")
}

This issue should be fixed by PR #7392.

It might be possible for remote nodes to trigger this bug, or make it more likely, because it happens when a block is downloaded during launch. (Or maybe while writing another block.)

@teor2345 teor2345 added C-bug Category: This is a bug S-needs-triage Status: A bug report needs triage P-Low ❄️ C-security Category: Security issues I-panic Zebra panics with an internal error message I-usability Zebra is hard to understand or use A-state Area: State / database changes labels Sep 19, 2023
@teor2345 teor2345 self-assigned this Sep 19, 2023
@teor2345 teor2345 added A-concurrency Area: Async code, needs extra work to make it work properly. I-remote-trigger Remote nodes can make Zebra do something bad and removed I-usability Zebra is hard to understand or use labels Sep 19, 2023
@teor2345
Copy link
Collaborator Author

This just happened again on my local machine.

@mpguerra
Copy link
Contributor

@teor2345 can you please add an estimate here?

@mergify mergify bot closed this as completed in #7590 Sep 20, 2023
@mpguerra mpguerra removed the S-needs-triage Status: A bug report needs triage label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-concurrency Area: Async code, needs extra work to make it work properly. A-state Area: State / database changes C-bug Category: This is a bug C-security Category: Security issues I-panic Zebra panics with an internal error message I-remote-trigger Remote nodes can make Zebra do something bad
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants