Skip to content

Commit 366f377

Browse files
committed
go fmt
1 parent fff8ec8 commit 366f377

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

go/main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ In particular:
1818
1919
We make an adjustment to accept a Spec to ensure the provided proof is in the format of the expected merkle store.
2020
This can avoid an range of attacks on fake preimages, as we need to be careful on how to map key, value -> leaf
21-
and determine neighbors
21+
and determine neighbors
2222
*/
2323
package proofs
2424

@@ -39,10 +39,10 @@ func VerifyMembership(spec *ProofSpec, root CommitmentRoot, proof *CommitmentPro
3939
}
4040

4141
// VerifyNonMembership returns true iff
42-
// proof is (contains) a NonExistenceProof
42+
// proof is (contains) a NonExistenceProof
4343
// both left and right sub-proofs are valid existence proofs (see above) or nil
4444
// left and right proofs are neighbors (or left/right most if one is nil)
45-
// provided key is between the keys of the two proofs
45+
// provided key is between the keys of the two proofs
4646
func VerifyNonMembership(spec *ProofSpec, root CommitmentRoot, proof CommitmentProof, key []byte) bool {
4747
// TODO: handle batch
4848
np, ok := proof.Proof.(*CommitmentProof_Nonexist)
@@ -51,4 +51,4 @@ func VerifyNonMembership(spec *ProofSpec, root CommitmentRoot, proof CommitmentP
5151
}
5252
err := np.Nonexist.Verify(spec, root, key)
5353
return err == nil
54-
}
54+
}

go/ops.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
// adds ripemd160 capability to crypto.RIPEMD160
1212
_ "golang.org/x/crypto/ripemd160"
13-
13+
1414
"github.com/pkg/errors"
1515
)
1616

@@ -36,7 +36,7 @@ func (op *LeafOp) Apply(key []byte, value []byte) ([]byte, error) {
3636
}
3737

3838
// CheckAgainstSpec will verify the LeafOp is in the format defined in spec
39-
func (op *LeafOp)CheckAgainstSpec(spec *ProofSpec) error {
39+
func (op *LeafOp) CheckAgainstSpec(spec *ProofSpec) error {
4040
lspec := spec.LeafSpec
4141

4242
if op.Hash != lspec.Hash {
@@ -68,15 +68,14 @@ func (op *InnerOp) Apply(child []byte) ([]byte, error) {
6868
}
6969

7070
// CheckAgainstSpec will verify the InnerOp is in the format defined in spec
71-
func (op *InnerOp)CheckAgainstSpec(spec *ProofSpec) error {
71+
func (op *InnerOp) CheckAgainstSpec(spec *ProofSpec) error {
7272
leafPrefix := spec.LeafSpec.Prefix
7373
if bytes.HasPrefix(op.Prefix, leafPrefix) {
7474
return errors.Errorf("Inner Prefix starts with %X", leafPrefix)
7575
}
7676
return nil
7777
}
7878

79-
8079
func prepareLeafData(hashOp HashOp, lengthOp LengthOp, data []byte) ([]byte, error) {
8180
// TODO: lengthop before or after hash ???
8281
hdata, err := doHashOrNoop(hashOp, data)

go/proof.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func (p *ExistenceProof) CheckAgainstSpec(spec *ProofSpec) error {
9797
// and matches the spec.
9898
func (p *NonExistenceProof) Verify(spec *ProofSpec, root CommitmentRoot, key []byte) error {
9999
// ensure the existence proofs are valid
100-
var leftKey, rightKey []byte
100+
var leftKey, rightKey []byte
101101
if p.Left != nil {
102102
if err := p.Left.Verify(spec, root, p.Left.Key, p.Left.Value); err != nil {
103103
return errors.Wrap(err, "left proof")

0 commit comments

Comments
 (0)