-
Notifications
You must be signed in to change notification settings - Fork 10
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
Patch models.StorageReceipt
to accommodate the old format
#343
Conversation
WalkthroughThe change introduces a new type, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant StorageSystem
participant Decoder
participant PreviewNet
User->>StorageSystem: Request receipt
StorageSystem->>Decoder: Decode receipt
Decoder->>StorageSystem: Return StorageReceiptV0
StorageSystem->>PreviewNet: Convert to new format
PreviewNet->>StorageSystem: Provide StorageReceipt
StorageSystem->>User: Return updated receipt
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
models.StorageReceipt
to accomodate the old decodingmodels.StorageReceipt
to accommodate the old decoding
models.StorageReceipt
to accommodate the old decodingmodels.StorageReceipt
to accommodate the old format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- models/receipt.go (1 hunks)
- storage/pebble/receipts.go (1 hunks)
Additional comments not posted (5)
storage/pebble/receipts.go (3)
137-147
: Ensure Robust Decoding Logic forStorageReceiptV0
.The decoding logic for
StorageReceiptV0
is appropriate for handling the older format. Ensure that theToNewReceipt
method correctly converts all necessary fields.
149-151
: Approve Conversion Logic to New Receipt Format.The loop correctly converts
StorageReceiptV0
instances to the newerStorageReceipt
type using theToNewReceipt
method. This ensures compatibility with existing receipt handling logic.
153-162
: Verify Fallback Decoding toStorageReceipt
.The fallback decoding logic ensures that the system can handle receipts in the older format. Ensure that this fallback mechanism is thoroughly tested.
Do you want me to generate the unit testing code or open a GitHub issue to track this task?
models/receipt.go (2)
18-35
: Temporary Type Definition forStorageReceiptV0
.The
StorageReceiptV0
type is defined with all necessary fields for receipt data. Ensure this type is removed after thePreviewNet
reset as indicated by the TODO comment.
37-56
: Approve Conversion Method forStorageReceiptV0
toStorageReceipt
.The
ToNewReceipt
method correctly maps all fields fromStorageReceiptV0
toStorageReceipt
. This ensures compatibility with the new receipt format.
Description
Add the
models.StorageReceiptV0
, to accommodate the encoding/decoding of the old format.For contributor use:
master
branchFiles changed
in the Github PR explorerSummary by CodeRabbit
StorageReceiptV0
type for handling receipts until thePreviewNet
reset.StorageReceiptV0
type.