Skip to content

feat:ephemeral header put and state for findcontent an offer - #182

Open
GrapeBaBa wants to merge 1 commit into
mainfrom
ephemeral_storage1
Open

feat:ephemeral header put and state for findcontent an offer#182
GrapeBaBa wants to merge 1 commit into
mainfrom
ephemeral_storage1

Conversation

@GrapeBaBa

Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Chen Kai <281165273grape@gmail.com>
@GrapeBaBa
GrapeBaBa requested a review from Copilot May 22, 2025 06:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces ephemeral header functionality for both "find content" and "offer" cases, enhancing header decoding and storage.

  • Added two helper functions to decode ephemeral header payloads in types_helper.go
  • Extended validation logic in validation.go to bypass ephemeral content validation
  • Implemented storage support for ephemeral headers (with distinct handling for find content and offer types) and added writeOptions in beacon storage

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
types/history/types_helper.go Added decoding functions for ephemeral header payloads
history/validation.go Added bypass logic for ephemeral content validation
history/ephemeral_storage.go Added Get/Put handling for ephemeral header types with batch DB updates
beacon/storage.go Integrated writeOptions for beacon storage

Comment thread history/validation.go
}
_, err = ValidatePortalReceiptsBytes(content, header.ReceiptHash.Bytes())
return err
case history.FindContentEphemeralType:

Copilot AI May 22, 2025

Copy link

Choose a reason for hiding this comment

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

Consider adding a brief comment explaining why validation for ephemeral content is postponed, ensuring future maintainers understand that this is an intentional design decision.

Copilot uses AI. Check for mistakes.
}
return payloadBytes, nil
case history.OfferEphemeralType:
return nil, fmt.Errorf("OfferEphemeralType is not supported")

Copilot AI May 22, 2025

Copy link

Choose a reason for hiding this comment

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

Clarify in-code or in documentation why OfferEphemeralType is unsupported in the Get function, to avoid confusion from API consumers regarding its handling contrasted with the Put implementation.

Copilot uses AI. Check for mistakes.
return fmt.Errorf("failed to commit batch: %w", err)
}
return nil
case history.OfferEphemeralType:

Copilot AI May 22, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The OfferEphemeralType branch in the Put function includes multiple batch operations and error checks; consider refactoring this block into smaller helper functions to improve readability and long-term maintainability.

Copilot uses AI. Check for mistakes.
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 this pull request may close these issues.

2 participants