Fix linting issue.
This commit is contained in:
parent
a1c13a66a8
commit
ac7fa08255
@ -111,7 +111,7 @@ func (as *EthAccountSnapshot) Resolve(p []string) (interface{}, []string, error)
|
|||||||
case "root":
|
case "root":
|
||||||
return &node.Link{Cid: keccak256ToCid(MEthStorageTrie, as.Root)}, nil, nil
|
return &node.Link{Cid: keccak256ToCid(MEthStorageTrie, as.Root)}, nil, nil
|
||||||
default:
|
default:
|
||||||
return nil, nil, fmt.Errorf("no such link")
|
return nil, nil, ErrInvalidLink
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ func TestAccountSnapshotResolve(t *testing.T) {
|
|||||||
if rest != nil {
|
if rest != nil {
|
||||||
t.Fatal("rest should be nil")
|
t.Fatal("rest should be nil")
|
||||||
}
|
}
|
||||||
if err.Error() != fmt.Sprintf("no such link") {
|
if err != ErrInvalidLink {
|
||||||
t.Fatal("wrong error")
|
t.Fatal("wrong error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,7 +175,7 @@ func TestAccountSnapshotResolveLink(t *testing.T) {
|
|||||||
if rest != nil {
|
if rest != nil {
|
||||||
t.Fatal("Expected rest to be nil")
|
t.Fatal("Expected rest to be nil")
|
||||||
}
|
}
|
||||||
if err.Error() != "no such link" {
|
if err != ErrInvalidLink {
|
||||||
t.Fatal("Wrong error")
|
t.Fatal("Wrong error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ func (b *EthHeader) Resolve(p []string) (interface{}, []string, error) {
|
|||||||
case "time":
|
case "time":
|
||||||
return b.Time, nil, nil
|
return b.Time, nil, nil
|
||||||
default:
|
default:
|
||||||
return nil, nil, fmt.Errorf("no such link")
|
return nil, nil, ErrInvalidLink
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,8 +192,8 @@ func TestEthBlockResolveNoSuchLink(t *testing.T) {
|
|||||||
t.Fatal("Should have failed with unknown field")
|
t.Fatal("Should have failed with unknown field")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err.Error() != "no such link" {
|
if err != ErrInvalidLink {
|
||||||
t.Fatalf("Wrong error message\r\nexpected %s\r\ngot %s", "no such link", err.Error())
|
t.Fatalf("Wrong error message\r\nexpected %s\r\ngot %s", ErrInvalidLink, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,8 +393,8 @@ func TestEthBlockResolveLinksBadLink(t *testing.T) {
|
|||||||
if rest != nil {
|
if rest != nil {
|
||||||
t.Fatal("Expected rest to be nil")
|
t.Fatal("Expected rest to be nil")
|
||||||
}
|
}
|
||||||
if err.Error() != "no such link" {
|
if err != ErrInvalidLink {
|
||||||
t.Fatalf("Expected error\r\nexpected %s\r\ngot %s", "no such link", err.Error())
|
t.Fatalf("Expected error\r\nexpected %s\r\ngot %s", ErrInvalidLink, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ func (r *EthReceipt) Resolve(p []string) (interface{}, []string, error) {
|
|||||||
case "gasUsed":
|
case "gasUsed":
|
||||||
return r.GasUsed, nil, nil
|
return r.GasUsed, nil, nil
|
||||||
default:
|
default:
|
||||||
return nil, nil, fmt.Errorf("no such link")
|
return nil, nil, ErrInvalidLink
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ func (t *EthTx) Resolve(p []string) (interface{}, []string, error) {
|
|||||||
case "value":
|
case "value":
|
||||||
return hexutil.EncodeBig(t.Value()), nil, nil
|
return hexutil.EncodeBig(t.Value()), nil, nil
|
||||||
default:
|
default:
|
||||||
return nil, nil, fmt.Errorf("no such link")
|
return nil, nil, ErrInvalidLink
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,8 +164,8 @@ func TestEthTxResolve(t *testing.T) {
|
|||||||
if rest != nil {
|
if rest != nil {
|
||||||
t.Fatal("rest should be nil")
|
t.Fatal("rest should be nil")
|
||||||
}
|
}
|
||||||
if err.Error() != "no such link" {
|
if err != ErrInvalidLink {
|
||||||
t.Fatalf("wrong error\r\nexpected %s\r\ngot %s", "no such link", err.Error())
|
t.Fatalf("wrong error\r\nexpected %s\r\ngot %s", ErrInvalidLink, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,8 +245,8 @@ func TestEthTxResolveLink(t *testing.T) {
|
|||||||
if rest != nil {
|
if rest != nil {
|
||||||
t.Fatal("Expected rest to be nil")
|
t.Fatal("Expected rest to be nil")
|
||||||
}
|
}
|
||||||
if err.Error() != "no such link" {
|
if err != ErrInvalidLink {
|
||||||
t.Fatalf("Wrong error\r\nexpected %s\r\ngot %s", "no such link", err.Error())
|
t.Fatalf("Wrong error\r\nexpected %s\r\ngot %s", ErrInvalidLink, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// good case
|
// good case
|
||||||
|
@ -216,7 +216,7 @@ func TestTxTrieResolveBranch(t *testing.T) {
|
|||||||
t.Fatalf("Returned object is not a link")
|
t.Fatalf("Returned object is not a link")
|
||||||
}
|
}
|
||||||
|
|
||||||
for j, _ := range expectedRest {
|
for j := range expectedRest {
|
||||||
if rest[j] != expectedRest[j] {
|
if rest[j] != expectedRest[j] {
|
||||||
t.Fatalf("Wrong rest of the path returned\r\nexpected %s\r\ngot %s", expectedRest[j], rest[j])
|
t.Fatalf("Wrong rest of the path returned\r\nexpected %s\r\ngot %s", expectedRest[j], rest[j])
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ package ipld
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
mh "github.com/multiformats/go-multihash"
|
mh "github.com/multiformats/go-multihash"
|
||||||
@ -46,7 +47,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
nullHashBytes = common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000000")
|
nullHashBytes = common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000000")
|
||||||
|
ErrInvalidLink = errors.New("no such link")
|
||||||
)
|
)
|
||||||
|
|
||||||
// RawdataToCid takes the desired codec and a slice of bytes
|
// RawdataToCid takes the desired codec and a slice of bytes
|
||||||
|
@ -159,7 +159,7 @@ func FuzzCrossG1MultiExp(data []byte) int {
|
|||||||
gethPoints = append(gethPoints, new(bls12381.PointG1).Set(kp1))
|
gethPoints = append(gethPoints, new(bls12381.PointG1).Set(kp1))
|
||||||
gnarkPoints = append(gnarkPoints, *cp1)
|
gnarkPoints = append(gnarkPoints, *cp1)
|
||||||
}
|
}
|
||||||
if len(gethScalars) == 0{
|
if len(gethScalars) == 0 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
// compute multi exponentiation
|
// compute multi exponentiation
|
||||||
|
Loading…
Reference in New Issue
Block a user