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

Some lines seem to be unreachable code. #34

Open
yangby-cryptape opened this issue Jun 28, 2023 · 3 comments · May be fixed by #36
Open

Some lines seem to be unreachable code. #34

yangby-cryptape opened this issue Jun 28, 2023 · 3 comments · May be fixed by #36

Comments

@yangby-cryptape
Copy link
Collaborator

I have run fuzz tests again and again, the following if condition is never entered:

if let Some(rhs_peaks_hashes) = proof_iter.next() {
peaks_hashes.push(rhs_peaks_hashes.clone());
}

I could NOT prove but I think it is unreachable.

@quake
Copy link
Member

quake commented Jul 11, 2023

it's reachable, I added an unit test: #36

@yangby-cryptape
Copy link
Collaborator Author

Why don't just return CorruptedProof if it only could be reached when "a malicious attacker can create a proof with duplicate items".

In the unit tests that you added, it returns false.

@quake
Copy link
Member

quake commented Jul 11, 2023

Yes, better to return CorruptedProof directly, and I noticed that line 408 checked the iterator empty again, so these lines can be deleted directly, cc @jjyr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants