Skip to content

Fix RPCError code and add DeleteSector #297

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

peterjan
Copy link
Member

Testing data integrity in indexd I noticed the RPCError returned by RPCVerifySector has a wrong code. I also extended the EphemeralSectorStore with a DeleteSector to enable mocking a host that lost it.

@peterjan peterjan self-assigned this Jul 17, 2025
@github-project-automation github-project-automation bot moved this to In Progress in Sia Jul 17, 2025
@peterjan peterjan requested a review from n8maninger July 17, 2025 10:30
@peterjan peterjan marked this pull request as ready for review July 17, 2025 10:32
@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 10:32
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fix incorrect RPCError code in RPCVerifySector and extend the ephemeral sector store with a deletion method

  • Added DeleteSector to EphemeralSectorStore for simulating a lost sector
  • Changed RPCVerifySector to return ErrorCodeHostError instead of ErrorCodeBadRequest
  • Added a changeset entry for tracking this minor fix

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
testutil/host.go Implement DeleteSector to remove sectors from the in-memory store
rhp/v4/server.go Update handleRPCVerifySector to use ErrorCodeHostError
.changeset/fix_rpcerror_code_in_rpcverifysector.md Add a changeset file documenting the RPC error code correction
Comments suppressed due to low confidence (2)

testutil/host.go:60

  • Consider adding unit tests for DeleteSector to cover both successful deletion and the error path when the sector is not present.
func (es *EphemeralSectorStore) DeleteSector(root types.Hash256) error {

rhp/v4/server.go:1110

  • Update or add RPC-level tests for handleRPCVerifySector to assert that a missing sector now returns ErrorCodeHostError.
		return rhp4.NewRPCError(rhp4.ErrorCodeHostError, err.Error())

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

Successfully merging this pull request may close these issues.

2 participants