From dbd9bfcff2b0b5a108cf8f7ecbc0b51080bfeacf Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Mon, 11 Sep 2023 06:26:59 -0300 Subject: [PATCH] proof: use safe deserialization method (#390) * proof: use safe deserialization method Signed-off-by: Ignacio Hagopian * ignore linter Signed-off-by: Ignacio Hagopian --------- Signed-off-by: Ignacio Hagopian --- proof_ipa.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proof_ipa.go b/proof_ipa.go index c5cb000f..5df38b1f 100644 --- a/proof_ipa.go +++ b/proof_ipa.go @@ -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 @@ -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]) {