Skip to content

Commit

Permalink
fix some deepsource comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed Feb 24, 2023
1 parent 1d2c4ff commit c1093a3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion proof_ipa.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func VerifyVerkleProof(proof *Proof, Cs []*Point, indices []uint8, ys []*Fr, tc
func SerializeProof(proof *Proof) (*VerkleProof, StateDiff, error) {
otherstems := make([][31]byte, len(proof.PoaStems))
for i, stem := range proof.PoaStems {
copy(otherstems[i][:], stem[:])
copy(otherstems[i][:], stem)
}

cbp := make([][32]byte, len(proof.Cs))
Expand Down
6 changes: 3 additions & 3 deletions proof_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ func (ipp *IPAProof) UnmarshalJSON(data []byte) error {
if err != nil {
return fmt.Errorf("error decoding hex string for CL[%d]: %s", i, aux.CL[i])
}
copy(ipp.CL[i][:], val[:])
copy(ipp.CL[i][:], val)
if len(aux.CR[i]) != 64 {
return fmt.Errorf("invalid hex string for CR[%d]: %s", i, aux.CR[i])
}
val, err = hex.DecodeString(aux.CR[i])
if err != nil {
return fmt.Errorf("error decoding hex string for CR[%d]: %s", i, aux.CR[i])
}
copy(ipp.CR[i][:], val[:])
copy(ipp.CR[i][:], val)
}
copy(ipp.FinalEvaluation[:], currentValueBytes)

Expand All @@ -114,7 +114,7 @@ type verkleProofMarshaller struct {
func (vp *VerkleProof) MarshalJSON() ([]byte, error) {
aux := &verkleProofMarshaller{
OtherStems: make([]string, len(vp.OtherStems)),
DepthExtensionPresent: hex.EncodeToString(vp.DepthExtensionPresent[:]),
DepthExtensionPresent: hex.EncodeToString(vp.DepthExtensionPresent),
CommitmentsByPath: make([]string, len(vp.CommitmentsByPath)),
D: hex.EncodeToString(vp.D[:]),
IPAProof: vp.IPAProof,
Expand Down
4 changes: 0 additions & 4 deletions proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,6 @@ func TestProofDeserialize(t *testing.T) {
}
}

func TestProofDeserializeErrors(t *testing.T) {
// TODO
}

func TestProofOfAbsenceEdgeCase(t *testing.T) {
root := New()
root.Commit()
Expand Down
7 changes: 1 addition & 6 deletions tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1122,19 +1122,14 @@ func TestRustBanderwagonBlock48(t *testing.T) {
"c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"0000000000000000000000000000000000000000000000000000000000000000",
}
var (
vals [][]byte
initialVals = map[string][]byte{}
)
var initialVals = map[string][]byte{}

for i, s := range valStrings {
if s == "" {
vals = append(vals, nil)
continue
}

v, _ := hex.DecodeString(s)
vals = append(vals, v)
tree.Insert(keys[i], v, nil)

initialVals[string(keys[i])] = v
Expand Down

0 comments on commit c1093a3

Please sign in to comment.