Skip to content

Commit

Permalink
proof: use safe deserialization method (#390)
Browse files Browse the repository at this point in the history
* proof: use safe deserialization method

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* ignore linter

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

---------

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
  • Loading branch information
jsign authored Sep 11, 2023
1 parent 3b1282b commit dbd9bfc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions proof_ipa.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func DeserializeProof(vp *VerkleProof, statediff StateDiff) (*Proof, error) {
commitments = make([]*Point, len(vp.CommitmentsByPath))
for i, commitmentBytes := range vp.CommitmentsByPath {
var commitment Point
if err := commitment.SetBytesUnsafe(commitmentBytes[:]); err != nil {
if err := commitment.SetBytes(commitmentBytes[:]); err != nil {
return nil, err
}
commitments[i] = &commitment
Expand Down Expand Up @@ -286,7 +286,7 @@ type stemInfo struct {
}

// TreeFromProof builds a stateless tree from the proof
func TreeFromProof(proof *Proof, rootC *Point) (VerkleNode, error) {
func TreeFromProof(proof *Proof, rootC *Point) (VerkleNode, error) { // skipcq: GO-R1005
stems := make([][]byte, 0, len(proof.Keys))
for _, k := range proof.Keys {
if len(stems) == 0 || !bytes.Equal(stems[len(stems)-1], k[:31]) {
Expand Down

0 comments on commit dbd9bfc

Please sign in to comment.