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

cannon: Fix path used when verifying a downloaded state #11813

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion op-challenger/game/fault/trace/prestates/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (m *MultiPrestateProvider) fetchPrestate(hash common.Hash, fileType string,
return fmt.Errorf("failed to close file %v: %w", dest, err)
}
// Verify the prestate actually matches the expected hash before moving it into the final destination
proof, _, _, err := m.stateConverter.ConvertStateToProof(dest)
proof, _, _, err := m.stateConverter.ConvertStateToProof(tmpFile)
if err != nil || proof.ClaimValue != hash {
// Treat invalid prestates as unavailable. Often servers return a 404 page with 200 status code
_ = os.Remove(tmpFile) // Best effort attempt to clean up the temporary file
Expand Down
4 changes: 4 additions & 0 deletions op-challenger/game/fault/trace/prestates/multi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,9 @@ type stubStateConverter struct {
}

func (s *stubStateConverter) ConvertStateToProof(path string) (*utils.ProofData, uint64, bool, error) {
// Return an error if we're given the wrong path
if _, err := os.Stat(path); err != nil {
return nil, 0, false, err
}
return &utils.ProofData{ClaimValue: s.hash}, 0, false, s.err
}