[Storehouse] 004 - Payloadless Remote ledger service#8575
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| return nil, fmt.Errorf("failed to generate proof: %w", err) | ||
| } | ||
|
|
||
| bp, err := ledger.DecodePayloadlessTrieBatchProof(resp.Proof) |
There was a problem hiding this comment.
Decoding is done at the client side for now, in the future it can be optimized so that the caller can decode partially.
5ea0653 to
d790588
Compare
846ecd0 to
ec16cc9
Compare
d790588 to
de9df7f
Compare
ec16cc9 to
fc80c43
Compare
| return nil, fmt.Errorf("error decoding payloadless batch proof (content): %w", err) | ||
| } | ||
| bp.Proofs = append(bp.Proofs, proof) | ||
| } |
There was a problem hiding this comment.
decodePayloadlessTrieBatchProof reads numOfProofs, then reads exactly that many length-prefixed sub-proofs, but never checks that rest is empty afterward. Should we reject the input data if there are garbage trailing bytes?
| c.logger.Error().Err(err).Msg("failed to check state") | ||
| return false |
There was a problem hiding this comment.
Log err and continue pattern. Should we return a specific error state here instead?
| // query's state. Returns nil if the path is unallocated or the leaf | ||
| // represents an empty register. |
There was a problem hiding this comment.
Is it ok that these cases are indistinguishable?
See spec