refactor(address): use extracted address library
Switch to using extracted address library
This commit is contained in:
parent
f6b96480d1
commit
8418464d91
@ -8,8 +8,8 @@ import (
|
||||
"github.com/ipfs/go-filestore"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ package api
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||
)
|
||||
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ package api
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package actors
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
|
||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||
|
||||
|
@ -6,10 +6,10 @@ import (
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||
|
@ -3,8 +3,8 @@ package actors
|
||||
import (
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
)
|
||||
|
@ -7,9 +7,9 @@ import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/minio/blake2b-simd"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
)
|
||||
|
@ -12,9 +12,9 @@ import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/ipfs/go-hamt-ipld"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/cborutil"
|
||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||
|
@ -13,9 +13,9 @@ import (
|
||||
"go.opencensus.io/trace"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
. "github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
|
@ -1,7 +1,7 @@
|
||||
package actors
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
mh "github.com/multiformats/go-multihash"
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
. "github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
@ -1,8 +1,8 @@
|
||||
package actors
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
)
|
||||
|
||||
func NewIDAddress(id uint64) (address.Address, ActorError) {
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"io"
|
||||
"sort"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
@ -14,8 +14,8 @@ import (
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
|
@ -1,415 +0,0 @@
|
||||
package address
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
|
||||
bls "github.com/filecoin-project/filecoin-ffi"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
"github.com/minio/blake2b-simd"
|
||||
"github.com/multiformats/go-varint"
|
||||
"github.com/polydawn/refmt/obj/atlas"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cbor.RegisterCborType(addressAtlasEntry)
|
||||
}
|
||||
|
||||
var addressAtlasEntry = atlas.BuildEntry(Address{}).Transform().
|
||||
TransformMarshal(atlas.MakeMarshalTransformFunc(
|
||||
func(a Address) (string, error) {
|
||||
return string(a.Bytes()), nil
|
||||
})).
|
||||
TransformUnmarshal(atlas.MakeUnmarshalTransformFunc(
|
||||
func(x string) (Address, error) {
|
||||
return NewFromBytes([]byte(x))
|
||||
})).
|
||||
Complete()
|
||||
|
||||
// Address is the go type that represents an address in the filecoin network.
|
||||
type Address struct{ str string }
|
||||
|
||||
// Undef is the type that represents an undefined address.
|
||||
var Undef = Address{}
|
||||
|
||||
// Network represents which network an address belongs to.
|
||||
type Network = byte
|
||||
|
||||
const (
|
||||
// Mainnet is the main network.
|
||||
Mainnet Network = iota
|
||||
// Testnet is the test network.
|
||||
Testnet
|
||||
)
|
||||
|
||||
// MainnetPrefix is the main network prefix.
|
||||
const MainnetPrefix = "f"
|
||||
|
||||
// TestnetPrefix is the main network prefix.
|
||||
const TestnetPrefix = "t"
|
||||
|
||||
// Protocol represents which protocol an address uses.
|
||||
type Protocol = byte
|
||||
|
||||
const (
|
||||
// ID represents the address ID protocol.
|
||||
ID Protocol = iota
|
||||
// SECP256K1 represents the address SECP256K1 protocol.
|
||||
SECP256K1
|
||||
// Actor represents the address Actor protocol.
|
||||
Actor
|
||||
// BLS represents the address BLS protocol.
|
||||
BLS
|
||||
|
||||
Unknown = Protocol(255)
|
||||
)
|
||||
|
||||
// Protocol returns the protocol used by the address.
|
||||
func (a Address) Protocol() Protocol {
|
||||
if len(a.str) == 0 {
|
||||
return Unknown
|
||||
}
|
||||
return a.str[0]
|
||||
}
|
||||
|
||||
// Payload returns the payload of the address.
|
||||
func (a Address) Payload() []byte {
|
||||
return []byte(a.str[1:])
|
||||
}
|
||||
|
||||
// Bytes returns the address as bytes.
|
||||
func (a Address) Bytes() []byte {
|
||||
return []byte(a.str)
|
||||
}
|
||||
|
||||
// String returns an address encoded as a string.
|
||||
func (a Address) String() string {
|
||||
str, err := encode(Testnet, a)
|
||||
if err != nil {
|
||||
panic(err) // I don't know if this one is okay
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
// Empty returns true if the address is empty, false otherwise.
|
||||
func (a Address) Empty() bool {
|
||||
return a == Undef
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals the cbor bytes into the address.
|
||||
func (a Address) Unmarshal(b []byte) error {
|
||||
return cbor.DecodeInto(b, &a)
|
||||
}
|
||||
|
||||
// Marshal marshals the address to cbor.
|
||||
func (a Address) Marshal() ([]byte, error) {
|
||||
return cbor.DumpObject(a)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json unmarshal interface.
|
||||
func (a *Address) UnmarshalJSON(b []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(b, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
addr, err := decode(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*a = addr
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json marshal interface.
|
||||
func (a Address) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"` + a.String() + `"`), nil
|
||||
}
|
||||
|
||||
// Format implements the Formatter interface.
|
||||
func (a Address) Format(f fmt.State, c rune) {
|
||||
switch c {
|
||||
case 'v':
|
||||
if a.Empty() {
|
||||
fmt.Fprint(f, UndefAddressString) //nolint: errcheck
|
||||
} else {
|
||||
fmt.Fprintf(f, "[%x - %x]", a.Protocol(), a.Payload()) // nolint: errcheck
|
||||
}
|
||||
case 's':
|
||||
fmt.Fprintf(f, "%s", a.String()) // nolint: errcheck
|
||||
default:
|
||||
fmt.Fprintf(f, "%"+string(c), a.Bytes()) // nolint: errcheck
|
||||
}
|
||||
}
|
||||
|
||||
func (a *Address) Scan(value interface{}) error {
|
||||
switch value := value.(type) {
|
||||
case string:
|
||||
a1, err := decode(value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*a = a1
|
||||
|
||||
return nil
|
||||
default:
|
||||
return xerrors.New("non-string types unsupported")
|
||||
}
|
||||
}
|
||||
|
||||
// NewIDAddress returns an address using the ID protocol.
|
||||
func NewIDAddress(id uint64) (Address, error) {
|
||||
return newAddress(ID, varint.ToUvarint(id))
|
||||
}
|
||||
|
||||
// NewSecp256k1Address returns an address using the SECP256K1 protocol.
|
||||
func NewSecp256k1Address(pubkey []byte) (Address, error) {
|
||||
return newAddress(SECP256K1, addressHash(pubkey))
|
||||
}
|
||||
|
||||
// NewActorAddress returns an address using the Actor protocol.
|
||||
func NewActorAddress(data []byte) (Address, error) {
|
||||
return newAddress(Actor, addressHash(data))
|
||||
}
|
||||
|
||||
// NewBLSAddress returns an address using the BLS protocol.
|
||||
func NewBLSAddress(pubkey []byte) (Address, error) {
|
||||
return newAddress(BLS, pubkey)
|
||||
}
|
||||
|
||||
// NewFromString returns the address represented by the string `addr`.
|
||||
func NewFromString(addr string) (Address, error) {
|
||||
return decode(addr)
|
||||
}
|
||||
|
||||
// NewFromBytes return the address represented by the bytes `addr`.
|
||||
func NewFromBytes(addr []byte) (Address, error) {
|
||||
if len(addr) == 0 {
|
||||
return Undef, nil
|
||||
}
|
||||
if len(addr) == 1 {
|
||||
return Undef, ErrInvalidLength
|
||||
}
|
||||
return newAddress(addr[0], addr[1:])
|
||||
}
|
||||
|
||||
// Checksum returns the checksum of `ingest`.
|
||||
func Checksum(ingest []byte) []byte {
|
||||
return hash(ingest, checksumHashConfig)
|
||||
}
|
||||
|
||||
// ValidateChecksum returns true if the checksum of `ingest` is equal to `expected`>
|
||||
func ValidateChecksum(ingest, expect []byte) bool {
|
||||
digest := Checksum(ingest)
|
||||
return bytes.Equal(digest, expect)
|
||||
}
|
||||
|
||||
func addressHash(ingest []byte) []byte {
|
||||
return hash(ingest, payloadHashConfig)
|
||||
}
|
||||
|
||||
func newAddress(protocol Protocol, payload []byte) (Address, error) {
|
||||
switch protocol {
|
||||
case ID:
|
||||
_, n, err := varint.FromUvarint(payload)
|
||||
if err != nil {
|
||||
return Undef, xerrors.Errorf("could not decode: %v: %w", err, ErrInvalidPayload)
|
||||
}
|
||||
if n != len(payload) {
|
||||
return Undef, xerrors.Errorf("different varint length (v:%d != p:%d): %w",
|
||||
n, len(payload), ErrInvalidPayload)
|
||||
}
|
||||
case SECP256K1, Actor:
|
||||
if len(payload) != PayloadHashLength {
|
||||
return Undef, ErrInvalidPayload
|
||||
}
|
||||
case BLS:
|
||||
if len(payload) != bls.PublicKeyBytes {
|
||||
return Undef, ErrInvalidPayload
|
||||
}
|
||||
default:
|
||||
return Undef, ErrUnknownProtocol
|
||||
}
|
||||
explen := 1 + len(payload)
|
||||
buf := make([]byte, explen)
|
||||
|
||||
buf[0] = protocol
|
||||
copy(buf[1:], payload)
|
||||
|
||||
return Address{string(buf)}, nil
|
||||
}
|
||||
|
||||
func encode(network Network, addr Address) (string, error) {
|
||||
if addr == Undef {
|
||||
return UndefAddressString, nil
|
||||
}
|
||||
var ntwk string
|
||||
switch network {
|
||||
case Mainnet:
|
||||
ntwk = MainnetPrefix
|
||||
case Testnet:
|
||||
ntwk = TestnetPrefix
|
||||
default:
|
||||
return UndefAddressString, ErrUnknownNetwork
|
||||
}
|
||||
|
||||
var strAddr string
|
||||
switch addr.Protocol() {
|
||||
case SECP256K1, Actor, BLS:
|
||||
cksm := Checksum(append([]byte{addr.Protocol()}, addr.Payload()...))
|
||||
strAddr = ntwk + fmt.Sprintf("%d", addr.Protocol()) + AddressEncoding.WithPadding(-1).EncodeToString(append(addr.Payload(), cksm[:]...))
|
||||
case ID:
|
||||
i, n, err := varint.FromUvarint(addr.Payload())
|
||||
if err != nil {
|
||||
return UndefAddressString, xerrors.Errorf("could not decode varint: %w", err)
|
||||
}
|
||||
if n != len(addr.Payload()) {
|
||||
return UndefAddressString, xerrors.Errorf("payload contains additional bytes")
|
||||
}
|
||||
strAddr = fmt.Sprintf("%s%d%d", ntwk, addr.Protocol(), i)
|
||||
default:
|
||||
return UndefAddressString, ErrUnknownProtocol
|
||||
}
|
||||
return strAddr, nil
|
||||
}
|
||||
|
||||
func decode(a string) (Address, error) {
|
||||
if len(a) == 0 {
|
||||
return Undef, nil
|
||||
}
|
||||
if a == UndefAddressString {
|
||||
return Undef, nil
|
||||
}
|
||||
if len(a) > MaxAddressStringLength || len(a) < 3 {
|
||||
return Undef, ErrInvalidLength
|
||||
}
|
||||
|
||||
if string(a[0]) != MainnetPrefix && string(a[0]) != TestnetPrefix {
|
||||
return Undef, ErrUnknownNetwork
|
||||
}
|
||||
|
||||
var protocol Protocol
|
||||
switch a[1] {
|
||||
case '0':
|
||||
protocol = ID
|
||||
case '1':
|
||||
protocol = SECP256K1
|
||||
case '2':
|
||||
protocol = Actor
|
||||
case '3':
|
||||
protocol = BLS
|
||||
default:
|
||||
return Undef, ErrUnknownProtocol
|
||||
}
|
||||
|
||||
raw := a[2:]
|
||||
if protocol == ID {
|
||||
// 20 is length of math.MaxUint64 as a string
|
||||
if len(raw) > 20 {
|
||||
return Undef, ErrInvalidLength
|
||||
}
|
||||
id, err := strconv.ParseUint(raw, 10, 64)
|
||||
if err != nil {
|
||||
return Undef, ErrInvalidPayload
|
||||
}
|
||||
return newAddress(protocol, varint.ToUvarint(id))
|
||||
}
|
||||
|
||||
payloadcksm, err := AddressEncoding.WithPadding(-1).DecodeString(raw)
|
||||
if err != nil {
|
||||
return Undef, err
|
||||
}
|
||||
payload := payloadcksm[:len(payloadcksm)-ChecksumHashLength]
|
||||
cksm := payloadcksm[len(payloadcksm)-ChecksumHashLength:]
|
||||
|
||||
if protocol == SECP256K1 || protocol == Actor {
|
||||
if len(payload) != 20 {
|
||||
return Undef, ErrInvalidPayload
|
||||
}
|
||||
}
|
||||
|
||||
if !ValidateChecksum(append([]byte{protocol}, payload...), cksm) {
|
||||
return Undef, ErrInvalidChecksum
|
||||
}
|
||||
|
||||
return newAddress(protocol, payload)
|
||||
}
|
||||
|
||||
func hash(ingest []byte, cfg *blake2b.Config) []byte {
|
||||
hasher, err := blake2b.New(cfg)
|
||||
if err != nil {
|
||||
// If this happens sth is very wrong.
|
||||
panic(fmt.Sprintf("invalid address hash configuration: %v", err)) // ok
|
||||
}
|
||||
if _, err := hasher.Write(ingest); err != nil {
|
||||
// blake2bs Write implementation never returns an error in its current
|
||||
// setup. So if this happens sth went very wrong.
|
||||
panic(fmt.Sprintf("blake2b is unable to process hashes: %v", err)) // ok
|
||||
}
|
||||
return hasher.Sum(nil)
|
||||
}
|
||||
|
||||
func (a Address) MarshalCBOR(w io.Writer) error {
|
||||
if a == Undef {
|
||||
return fmt.Errorf("cannot marshal undefined address")
|
||||
}
|
||||
|
||||
abytes := a.Bytes()
|
||||
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajByteString, uint64(len(abytes)))); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := w.Write(abytes); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *Address) UnmarshalCBOR(br io.Reader) error {
|
||||
maj, extra, err := cbg.CborReadHeader(br)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if maj != cbg.MajByteString {
|
||||
return fmt.Errorf("cbor type for address unmarshal was not byte string")
|
||||
}
|
||||
|
||||
if extra > 64 {
|
||||
return fmt.Errorf("too many bytes to unmarshal for an address")
|
||||
}
|
||||
|
||||
buf := make([]byte, int(extra))
|
||||
if _, err := io.ReadFull(br, buf); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
addr, err := NewFromBytes(buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if addr == Undef {
|
||||
return fmt.Errorf("cbor input should not contain empty addresses")
|
||||
}
|
||||
|
||||
*a = addr
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func IDFromAddress(addr Address) (uint64, error) {
|
||||
if addr.Protocol() != ID {
|
||||
return 0, xerrors.Errorf("cannot get id from non id address")
|
||||
}
|
||||
|
||||
i, _, err := varint.FromUvarint(addr.Payload())
|
||||
return i, err
|
||||
}
|
@ -1,542 +0,0 @@
|
||||
package address
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base32"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||
"github.com/multiformats/go-varint"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/filecoin-project/lotus/lib/crypto"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rand.Seed(time.Now().Unix())
|
||||
}
|
||||
|
||||
func TestRandomIDAddress(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
addr, err := NewIDAddress(uint64(rand.Int()))
|
||||
assert.NoError(err)
|
||||
assert.Equal(ID, addr.Protocol())
|
||||
|
||||
str, err := encode(Testnet, addr)
|
||||
assert.NoError(err)
|
||||
|
||||
maybe, err := decode(str)
|
||||
assert.NoError(err)
|
||||
assert.Equal(addr, maybe)
|
||||
|
||||
}
|
||||
|
||||
var allTestAddresses = []string{
|
||||
"t00",
|
||||
"t01",
|
||||
"t010",
|
||||
"t0150",
|
||||
"t0499",
|
||||
"t01024",
|
||||
"t01729",
|
||||
"t0999999",
|
||||
"t15ihq5ibzwki2b4ep2f46avlkrqzhpqgtga7pdrq",
|
||||
"t12fiakbhe2gwd5cnmrenekasyn6v5tnaxaqizq6a",
|
||||
"t1wbxhu3ypkuo6eyp6hjx6davuelxaxrvwb2kuwva",
|
||||
"t1xtwapqc6nh4si2hcwpr3656iotzmlwumogqbuaa",
|
||||
"t1xcbgdhkgkwht3hrrnui3jdopeejsoatkzmoltqy",
|
||||
"t17uoq6tp427uzv7fztkbsnn64iwotfrristwpryy",
|
||||
"t24vg6ut43yw2h2jqydgbg2xq7x6f4kub3bg6as6i",
|
||||
"t25nml2cfbljvn4goqtclhifepvfnicv6g7mfmmvq",
|
||||
"t2nuqrg7vuysaue2pistjjnt3fadsdzvyuatqtfei",
|
||||
"t24dd4ox4c2vpf5vk5wkadgyyn6qtuvgcpxxon64a",
|
||||
"t2gfvuyh7v2sx3patm5k23wdzmhyhtmqctasbr23y",
|
||||
"t3vvmn62lofvhjd2ugzca6sof2j2ubwok6cj4xxbfzz4yuxfkgobpihhd2thlanmsh3w2ptld2gqkn2jvlss4a",
|
||||
"t3wmuu6crofhqmm3v4enos73okk2l366ck6yc4owxwbdtkmpk42ohkqxfitcpa57pjdcftql4tojda2poeruwa",
|
||||
"t3s2q2hzhkpiknjgmf4zq3ejab2rh62qbndueslmsdzervrhapxr7dftie4kpnpdiv2n6tvkr743ndhrsw6d3a",
|
||||
"t3q22fijmmlckhl56rn5nkyamkph3mcfu5ed6dheq53c244hfmnq2i7efdma3cj5voxenwiummf2ajlsbxc65a",
|
||||
"t3u5zgwa4ael3vuocgc5mfgygo4yuqocrntuuhcklf4xzg5tcaqwbyfabxetwtj4tsam3pbhnwghyhijr5mixa",
|
||||
}
|
||||
|
||||
func TestVectorsIDAddress(t *testing.T) {
|
||||
testCases := []struct {
|
||||
input uint64
|
||||
expected string
|
||||
}{
|
||||
{uint64(0), "t00"},
|
||||
{uint64(1), "t01"},
|
||||
{uint64(10), "t010"},
|
||||
{uint64(150), "t0150"},
|
||||
{uint64(499), "t0499"},
|
||||
{uint64(1024), "t01024"},
|
||||
{uint64(1729), "t01729"},
|
||||
{uint64(999999), "t0999999"},
|
||||
{math.MaxUint64, fmt.Sprintf("t0%s", strconv.FormatUint(math.MaxUint64, 10))},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(fmt.Sprintf("testing actorID address: %s", tc.expected), func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
// Round trip encoding and decoding from string
|
||||
addr, err := NewIDAddress(tc.input)
|
||||
assert.NoError(err)
|
||||
assert.Equal(tc.expected, addr.String())
|
||||
|
||||
maybeAddr, err := NewFromString(tc.expected)
|
||||
assert.NoError(err)
|
||||
assert.Equal(ID, maybeAddr.Protocol())
|
||||
id, _, err := varint.FromUvarint(maybeAddr.Payload())
|
||||
assert.NoError(err)
|
||||
assert.Equal(tc.input, id)
|
||||
|
||||
// Round trip to and from bytes
|
||||
maybeAddrBytes, err := NewFromBytes(maybeAddr.Bytes())
|
||||
assert.NoError(err)
|
||||
assert.Equal(maybeAddr, maybeAddrBytes)
|
||||
|
||||
// Round trip encoding and decoding json
|
||||
b, err := addr.MarshalJSON()
|
||||
assert.NoError(err)
|
||||
|
||||
var newAddr Address
|
||||
err = newAddr.UnmarshalJSON(b)
|
||||
assert.NoError(err)
|
||||
assert.Equal(addr, newAddr)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestSecp256k1Address(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
sk, err := crypto.GenerateKey()
|
||||
assert.NoError(err)
|
||||
|
||||
addr, err := NewSecp256k1Address(crypto.PublicKey(sk))
|
||||
assert.NoError(err)
|
||||
assert.Equal(SECP256K1, addr.Protocol())
|
||||
|
||||
str, err := encode(Mainnet, addr)
|
||||
assert.NoError(err)
|
||||
|
||||
maybe, err := decode(str)
|
||||
assert.NoError(err)
|
||||
assert.Equal(addr, maybe)
|
||||
|
||||
}
|
||||
|
||||
func TestVectorSecp256k1Address(t *testing.T) {
|
||||
testCases := []struct {
|
||||
input []byte
|
||||
expected string
|
||||
}{
|
||||
{[]byte{4, 148, 2, 250, 195, 126, 100, 50, 164, 22, 163, 160, 202, 84,
|
||||
38, 181, 24, 90, 179, 178, 79, 97, 52, 239, 162, 92, 228, 135, 200,
|
||||
45, 46, 78, 19, 191, 69, 37, 17, 224, 210, 36, 84, 33, 248, 97, 59,
|
||||
193, 13, 114, 250, 33, 102, 102, 169, 108, 59, 193, 57, 32, 211,
|
||||
255, 35, 63, 208, 188, 5},
|
||||
"t15ihq5ibzwki2b4ep2f46avlkrqzhpqgtga7pdrq"},
|
||||
|
||||
{[]byte{4, 118, 135, 185, 16, 55, 155, 242, 140, 190, 58, 234, 103, 75,
|
||||
18, 0, 12, 107, 125, 186, 70, 255, 192, 95, 108, 148, 254, 42, 34,
|
||||
187, 204, 38, 2, 255, 127, 92, 118, 242, 28, 165, 93, 54, 149, 145,
|
||||
82, 176, 225, 232, 135, 145, 124, 57, 53, 118, 238, 240, 147, 246,
|
||||
30, 189, 58, 208, 111, 127, 218},
|
||||
"t12fiakbhe2gwd5cnmrenekasyn6v5tnaxaqizq6a"},
|
||||
{[]byte{4, 222, 253, 208, 16, 1, 239, 184, 110, 1, 222, 213, 206, 52,
|
||||
248, 71, 167, 58, 20, 129, 158, 230, 65, 188, 182, 11, 185, 41, 147,
|
||||
89, 111, 5, 220, 45, 96, 95, 41, 133, 248, 209, 37, 129, 45, 172,
|
||||
65, 99, 163, 150, 52, 155, 35, 193, 28, 194, 255, 53, 157, 229, 75,
|
||||
226, 135, 234, 98, 49, 155},
|
||||
"t1wbxhu3ypkuo6eyp6hjx6davuelxaxrvwb2kuwva"},
|
||||
{[]byte{4, 3, 237, 18, 200, 20, 182, 177, 13, 46, 224, 157, 149, 180,
|
||||
104, 141, 178, 209, 128, 208, 169, 163, 122, 107, 106, 125, 182, 61,
|
||||
41, 129, 30, 233, 115, 4, 121, 216, 239, 145, 57, 233, 18, 73, 202,
|
||||
189, 57, 50, 145, 207, 229, 210, 119, 186, 118, 222, 69, 227, 224,
|
||||
133, 163, 118, 129, 191, 54, 69, 210},
|
||||
"t1xtwapqc6nh4si2hcwpr3656iotzmlwumogqbuaa"},
|
||||
{[]byte{4, 247, 150, 129, 154, 142, 39, 22, 49, 175, 124, 24, 151, 151,
|
||||
181, 69, 214, 2, 37, 147, 97, 71, 230, 1, 14, 101, 98, 179, 206, 158,
|
||||
254, 139, 16, 20, 65, 97, 169, 30, 208, 180, 236, 137, 8, 0, 37, 63,
|
||||
166, 252, 32, 172, 144, 251, 241, 251, 242, 113, 48, 164, 236, 195,
|
||||
228, 3, 183, 5, 118},
|
||||
"t1xcbgdhkgkwht3hrrnui3jdopeejsoatkzmoltqy"},
|
||||
{[]byte{4, 66, 131, 43, 248, 124, 206, 158, 163, 69, 185, 3, 80, 222,
|
||||
125, 52, 149, 133, 156, 164, 73, 5, 156, 94, 136, 221, 231, 66, 133,
|
||||
223, 251, 158, 192, 30, 186, 188, 95, 200, 98, 104, 207, 234, 235,
|
||||
167, 174, 5, 191, 184, 214, 142, 183, 90, 82, 104, 120, 44, 248, 111,
|
||||
200, 112, 43, 239, 138, 31, 224},
|
||||
"t17uoq6tp427uzv7fztkbsnn64iwotfrristwpryy"},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(fmt.Sprintf("testing secp256k1 address: %s", tc.expected), func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
// Round trip encoding and decoding from string
|
||||
addr, err := NewSecp256k1Address(tc.input)
|
||||
assert.NoError(err)
|
||||
assert.Equal(tc.expected, addr.String())
|
||||
|
||||
maybeAddr, err := NewFromString(tc.expected)
|
||||
assert.NoError(err)
|
||||
assert.Equal(SECP256K1, maybeAddr.Protocol())
|
||||
assert.Equal(addressHash(tc.input), maybeAddr.Payload())
|
||||
|
||||
// Round trip to and from bytes
|
||||
maybeAddrBytes, err := NewFromBytes(maybeAddr.Bytes())
|
||||
assert.NoError(err)
|
||||
assert.Equal(maybeAddr, maybeAddrBytes)
|
||||
|
||||
// Round trip encoding and decoding json
|
||||
b, err := addr.MarshalJSON()
|
||||
assert.NoError(err)
|
||||
|
||||
var newAddr Address
|
||||
err = newAddr.UnmarshalJSON(b)
|
||||
assert.NoError(err)
|
||||
assert.Equal(addr, newAddr)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRandomActorAddress(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
actorMsg := make([]byte, 20)
|
||||
rand.Read(actorMsg)
|
||||
|
||||
addr, err := NewActorAddress(actorMsg)
|
||||
assert.NoError(err)
|
||||
assert.Equal(Actor, addr.Protocol())
|
||||
|
||||
str, err := encode(Mainnet, addr)
|
||||
assert.NoError(err)
|
||||
|
||||
maybe, err := decode(str)
|
||||
assert.NoError(err)
|
||||
assert.Equal(addr, maybe)
|
||||
|
||||
}
|
||||
|
||||
func TestVectorActorAddress(t *testing.T) {
|
||||
testCases := []struct {
|
||||
input []byte
|
||||
expected string
|
||||
}{
|
||||
{[]byte{118, 18, 129, 144, 205, 240, 104, 209, 65, 128, 68, 172, 192,
|
||||
62, 11, 103, 129, 151, 13, 96},
|
||||
"t24vg6ut43yw2h2jqydgbg2xq7x6f4kub3bg6as6i"},
|
||||
{[]byte{44, 175, 184, 226, 224, 107, 186, 152, 234, 101, 124, 92, 245,
|
||||
244, 32, 35, 170, 35, 232, 142},
|
||||
"t25nml2cfbljvn4goqtclhifepvfnicv6g7mfmmvq"},
|
||||
{[]byte{2, 44, 158, 14, 162, 157, 143, 64, 197, 106, 190, 195, 92, 141,
|
||||
88, 125, 160, 166, 76, 24},
|
||||
"t2nuqrg7vuysaue2pistjjnt3fadsdzvyuatqtfei"},
|
||||
{[]byte{223, 236, 3, 14, 32, 79, 15, 89, 216, 15, 29, 94, 233, 29, 253,
|
||||
6, 109, 127, 99, 189},
|
||||
"t24dd4ox4c2vpf5vk5wkadgyyn6qtuvgcpxxon64a"},
|
||||
{[]byte{61, 58, 137, 232, 221, 171, 84, 120, 50, 113, 108, 109, 70, 140,
|
||||
53, 96, 201, 244, 127, 216},
|
||||
"t2gfvuyh7v2sx3patm5k23wdzmhyhtmqctasbr23y"},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(fmt.Sprintf("testing Actor address: %s", tc.expected), func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
// Round trip encoding and decoding from string
|
||||
addr, err := NewActorAddress(tc.input)
|
||||
assert.NoError(err)
|
||||
assert.Equal(tc.expected, addr.String())
|
||||
|
||||
maybeAddr, err := NewFromString(tc.expected)
|
||||
assert.NoError(err)
|
||||
assert.Equal(Actor, maybeAddr.Protocol())
|
||||
assert.Equal(addressHash(tc.input), maybeAddr.Payload())
|
||||
|
||||
// Round trip to and from bytes
|
||||
maybeAddrBytes, err := NewFromBytes(maybeAddr.Bytes())
|
||||
assert.NoError(err)
|
||||
assert.Equal(maybeAddr, maybeAddrBytes)
|
||||
|
||||
// Round trip encoding and decoding json
|
||||
b, err := addr.MarshalJSON()
|
||||
assert.NoError(err)
|
||||
|
||||
var newAddr Address
|
||||
err = newAddr.UnmarshalJSON(b)
|
||||
assert.NoError(err)
|
||||
assert.Equal(addr, newAddr)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRandomBLSAddress(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
pk := ffi.PrivateKeyPublicKey(ffi.PrivateKeyGenerate())
|
||||
|
||||
addr, err := NewBLSAddress(pk[:])
|
||||
assert.NoError(err)
|
||||
assert.Equal(BLS, addr.Protocol())
|
||||
|
||||
str, err := encode(Mainnet, addr)
|
||||
assert.NoError(err)
|
||||
|
||||
maybe, err := decode(str)
|
||||
assert.NoError(err)
|
||||
assert.Equal(addr, maybe)
|
||||
|
||||
}
|
||||
|
||||
func TestVectorBLSAddress(t *testing.T) {
|
||||
testCases := []struct {
|
||||
input []byte
|
||||
expected string
|
||||
}{
|
||||
{[]byte{173, 88, 223, 105, 110, 45, 78, 145, 234, 134, 200, 129, 233, 56,
|
||||
186, 78, 168, 27, 57, 94, 18, 121, 123, 132, 185, 207, 49, 75, 149, 70,
|
||||
112, 94, 131, 156, 122, 153, 214, 6, 178, 71, 221, 180, 249, 172, 122,
|
||||
52, 20, 221},
|
||||
"t3vvmn62lofvhjd2ugzca6sof2j2ubwok6cj4xxbfzz4yuxfkgobpihhd2thlanmsh3w2ptld2gqkn2jvlss4a"},
|
||||
{[]byte{179, 41, 79, 10, 46, 41, 224, 198, 110, 188, 35, 93, 47, 237,
|
||||
202, 86, 151, 191, 120, 74, 246, 5, 199, 90, 246, 8, 230, 166, 61, 92,
|
||||
211, 142, 168, 92, 168, 152, 158, 14, 253, 233, 24, 139, 56, 47,
|
||||
147, 114, 70, 13},
|
||||
"t3wmuu6crofhqmm3v4enos73okk2l366ck6yc4owxwbdtkmpk42ohkqxfitcpa57pjdcftql4tojda2poeruwa"},
|
||||
{[]byte{150, 161, 163, 228, 234, 122, 20, 212, 153, 133, 230, 97, 178,
|
||||
36, 1, 212, 79, 237, 64, 45, 29, 9, 37, 178, 67, 201, 35, 88, 156,
|
||||
15, 188, 126, 50, 205, 4, 226, 158, 215, 141, 21, 211, 125, 58, 170,
|
||||
63, 230, 218, 51},
|
||||
"t3s2q2hzhkpiknjgmf4zq3ejab2rh62qbndueslmsdzervrhapxr7dftie4kpnpdiv2n6tvkr743ndhrsw6d3a"},
|
||||
{[]byte{134, 180, 84, 37, 140, 88, 148, 117, 247, 209, 111, 90, 172, 1,
|
||||
138, 121, 246, 193, 22, 157, 32, 252, 51, 146, 29, 216, 181, 206, 28,
|
||||
172, 108, 52, 143, 144, 163, 96, 54, 36, 246, 174, 185, 27, 100, 81,
|
||||
140, 46, 128, 149},
|
||||
"t3q22fijmmlckhl56rn5nkyamkph3mcfu5ed6dheq53c244hfmnq2i7efdma3cj5voxenwiummf2ajlsbxc65a"},
|
||||
{[]byte{167, 114, 107, 3, 128, 34, 247, 90, 56, 70, 23, 88, 83, 96, 206,
|
||||
230, 41, 7, 10, 45, 157, 40, 113, 41, 101, 229, 242, 110, 204, 64,
|
||||
133, 131, 130, 128, 55, 36, 237, 52, 242, 114, 3, 54, 240, 157, 182,
|
||||
49, 240, 116},
|
||||
"t3u5zgwa4ael3vuocgc5mfgygo4yuqocrntuuhcklf4xzg5tcaqwbyfabxetwtj4tsam3pbhnwghyhijr5mixa"},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(fmt.Sprintf("testing bls address: %s", tc.expected), func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
// Round trip encoding and decoding from string
|
||||
addr, err := NewBLSAddress(tc.input)
|
||||
assert.NoError(err)
|
||||
assert.Equal(tc.expected, addr.String())
|
||||
|
||||
maybeAddr, err := NewFromString(tc.expected)
|
||||
assert.NoError(err)
|
||||
assert.Equal(BLS, maybeAddr.Protocol())
|
||||
assert.Equal(tc.input, maybeAddr.Payload())
|
||||
|
||||
// Round trip to and from bytes
|
||||
maybeAddrBytes, err := NewFromBytes(maybeAddr.Bytes())
|
||||
assert.NoError(err)
|
||||
assert.Equal(maybeAddr, maybeAddrBytes)
|
||||
|
||||
// Round trip encoding and decoding json
|
||||
b, err := addr.MarshalJSON()
|
||||
assert.NoError(err)
|
||||
|
||||
var newAddr Address
|
||||
err = newAddr.UnmarshalJSON(b)
|
||||
assert.NoError(err)
|
||||
assert.Equal(addr, newAddr)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvalidStringAddresses(t *testing.T) {
|
||||
testCases := []struct {
|
||||
input string
|
||||
expetErr error
|
||||
}{
|
||||
{"Q2gfvuyh7v2sx3patm5k23wdzmhyhtmqctasbr23y", ErrUnknownNetwork},
|
||||
{"t4gfvuyh7v2sx3patm5k23wdzmhyhtmqctasbr23y", ErrUnknownProtocol},
|
||||
{"t2gfvuyh7v2sx3patm5k23wdzmhyhtmqctasbr24y", ErrInvalidChecksum},
|
||||
{"t0banananananannnnnnnnn", ErrInvalidLength},
|
||||
{"t0banananananannnnnnnn", ErrInvalidPayload},
|
||||
{"t2gfvuyh7v2sx3patm1k23wdzmhyhtmqctasbr24y", base32.CorruptInputError(16)}, // '1' is not in base32 alphabet
|
||||
{"t2gfvuyh7v2sx3paTm1k23wdzmhyhtmqctasbr24y", base32.CorruptInputError(14)}, // 'T' is not in base32 alphabet
|
||||
{"t2", ErrInvalidLength},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(fmt.Sprintf("testing string address: %s", tc.expetErr), func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
_, err := NewFromString(tc.input)
|
||||
assert.Equal(tc.expetErr, err)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestInvalidByteAddresses(t *testing.T) {
|
||||
testCases := []struct {
|
||||
input []byte
|
||||
expetErr error
|
||||
}{
|
||||
// Unknown Protocol
|
||||
{[]byte{4, 4, 4}, ErrUnknownProtocol},
|
||||
|
||||
// ID protocol
|
||||
{[]byte{0}, ErrInvalidLength},
|
||||
|
||||
// SECP256K1 Protocol
|
||||
{append([]byte{1}, make([]byte, PayloadHashLength-1)...), ErrInvalidPayload},
|
||||
{append([]byte{1}, make([]byte, PayloadHashLength+1)...), ErrInvalidPayload},
|
||||
// Actor Protocol
|
||||
{append([]byte{2}, make([]byte, PayloadHashLength-1)...), ErrInvalidPayload},
|
||||
{append([]byte{2}, make([]byte, PayloadHashLength+1)...), ErrInvalidPayload},
|
||||
|
||||
// BLS Protocol
|
||||
{append([]byte{3}, make([]byte, ffi.PublicKeyBytes-1)...), ErrInvalidPayload},
|
||||
{append([]byte{3}, make([]byte, ffi.PrivateKeyBytes+1)...), ErrInvalidPayload},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(fmt.Sprintf("testing byte address: %s", tc.expetErr), func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
_, err := NewFromBytes(tc.input)
|
||||
assert.Equal(tc.expetErr, err)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestChecksum(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
data := []byte("helloworld")
|
||||
bata := []byte("kittinmittins")
|
||||
|
||||
cksm := Checksum(data)
|
||||
assert.Len(cksm, ChecksumHashLength)
|
||||
|
||||
assert.True(ValidateChecksum(data, cksm))
|
||||
assert.False(ValidateChecksum(bata, cksm))
|
||||
|
||||
}
|
||||
|
||||
func TestAddressFormat(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
require := require.New(t)
|
||||
|
||||
a, err := NewActorAddress([]byte("hello"))
|
||||
require.NoError(err)
|
||||
|
||||
assert.Equal("t2wvjry4bx6bwj6kkhcmvgu5zafqyi5cjzbtet3va", a.String())
|
||||
assert.Equal("02B5531C7037F06C9F2947132A6A77202C308E8939", fmt.Sprintf("%X", a))
|
||||
assert.Equal("[2 - b5531c7037f06c9f2947132a6a77202c308e8939]", fmt.Sprintf("%v", a))
|
||||
|
||||
assert.Equal("", fmt.Sprintf("%X", Undef))
|
||||
assert.Equal(UndefAddressString, Undef.String())
|
||||
assert.Equal(UndefAddressString, fmt.Sprintf("%v", Undef))
|
||||
}
|
||||
|
||||
func TestCborMarshal(t *testing.T) {
|
||||
for _, a := range allTestAddresses {
|
||||
addr, err := NewFromString(a)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
if err := addr.MarshalCBOR(buf); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
/*
|
||||
// Note: this is commented out because we're currently serializing addresses as cbor "text strings", not "byte strings".
|
||||
// This is to get around the restriction that refmt only allows string keys in maps.
|
||||
// if you change it to serialize to byte strings and uncomment this, the tests pass fine
|
||||
oldbytes, err := cbor.DumpObject(addr)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if !bytes.Equal(oldbytes, buf.Bytes()) {
|
||||
t.Fatalf("serialization doesnt match old serialization: %s", a)
|
||||
}
|
||||
*/
|
||||
|
||||
var out Address
|
||||
if err := out.UnmarshalCBOR(buf); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if out != addr {
|
||||
t.Fatalf("failed to round trip %s", a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCborMarshal(b *testing.B) {
|
||||
addr, err := NewFromString("t15ihq5ibzwki2b4ep2f46avlkrqzhpqgtga7pdrq")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
for i := 0; i < b.N; i++ {
|
||||
buf.Reset()
|
||||
if err := addr.MarshalCBOR(buf); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCborUnmarshal(b *testing.B) {
|
||||
addr, err := NewFromString("t15ihq5ibzwki2b4ep2f46avlkrqzhpqgtga7pdrq")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
if err := addr.MarshalCBOR(buf); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
var a Address
|
||||
if err := a.UnmarshalCBOR(bytes.NewReader(buf.Bytes())); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestIDEdgeCase(t *testing.T) {
|
||||
a, err := NewFromBytes([]byte{0, 0x80})
|
||||
_ = a.String()
|
||||
assert.Error(t, err)
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
package address
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func blsaddr(n int64) Address {
|
||||
buf := make([]byte, 48)
|
||||
r := rand.New(rand.NewSource(n))
|
||||
r.Read(buf)
|
||||
|
||||
addr, err := NewBLSAddress(buf)
|
||||
if err != nil {
|
||||
panic(err) // ok
|
||||
}
|
||||
|
||||
return addr
|
||||
}
|
||||
|
||||
func makeActorAddresses(n int) [][]byte {
|
||||
var addrs [][]byte
|
||||
for i := 0; i < n; i++ {
|
||||
a, err := NewActorAddress([]byte(fmt.Sprintf("ACTOR ADDRESS %d", i)))
|
||||
if err != nil {
|
||||
panic(err) // ok
|
||||
}
|
||||
addrs = append(addrs, a.Bytes())
|
||||
}
|
||||
|
||||
return addrs
|
||||
}
|
||||
|
||||
func makeBlsAddresses(n int64) [][]byte {
|
||||
var addrs [][]byte
|
||||
for i := int64(0); i < n; i++ {
|
||||
addrs = append(addrs, blsaddr(n).Bytes())
|
||||
}
|
||||
return addrs
|
||||
}
|
||||
|
||||
func makeSecpAddresses(n int) [][]byte {
|
||||
var addrs [][]byte
|
||||
for i := 0; i < n; i++ {
|
||||
r := rand.New(rand.NewSource(int64(i)))
|
||||
buf := make([]byte, 32)
|
||||
r.Read(buf)
|
||||
|
||||
a, err := NewSecp256k1Address(buf)
|
||||
if err != nil {
|
||||
panic(err) // ok
|
||||
}
|
||||
|
||||
addrs = append(addrs, a.Bytes())
|
||||
}
|
||||
return addrs
|
||||
}
|
||||
|
||||
func makeIDAddresses(n int) [][]byte {
|
||||
var addrs [][]byte
|
||||
for i := 0; i < n; i++ {
|
||||
|
||||
a, err := NewIDAddress(uint64(i))
|
||||
if err != nil {
|
||||
panic(err) // ok
|
||||
}
|
||||
|
||||
addrs = append(addrs, a.Bytes())
|
||||
}
|
||||
return addrs
|
||||
}
|
||||
|
||||
func BenchmarkParseActorAddress(b *testing.B) {
|
||||
benchTestWithAddrs := func(a [][]byte) func(b *testing.B) {
|
||||
return func(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := NewFromBytes(a[i%len(a)])
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b.Run("actor", benchTestWithAddrs(makeActorAddresses(20)))
|
||||
b.Run("bls", benchTestWithAddrs(makeBlsAddresses(20)))
|
||||
b.Run("secp256k1", benchTestWithAddrs(makeSecpAddresses(20)))
|
||||
b.Run("id", benchTestWithAddrs(makeIDAddresses(20)))
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package address
|
||||
|
||||
import (
|
||||
"encoding/base32"
|
||||
"errors"
|
||||
|
||||
"github.com/minio/blake2b-simd"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
var err error
|
||||
|
||||
TestAddress, err = NewActorAddress([]byte("satoshi"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
TestAddress2, err = NewActorAddress([]byte("nakamoto"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
// TestAddress is an account with some initial funds in it.
|
||||
TestAddress Address
|
||||
// TestAddress2 is an account with some initial funds in it.
|
||||
TestAddress2 Address
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrUnknownNetwork is returned when encountering an unknown network in an address.
|
||||
ErrUnknownNetwork = errors.New("unknown address network")
|
||||
|
||||
// ErrUnknownProtocol is returned when encountering an unknown protocol in an address.
|
||||
ErrUnknownProtocol = errors.New("unknown address protocol")
|
||||
// ErrInvalidPayload is returned when encountering an invalid address payload.
|
||||
ErrInvalidPayload = errors.New("invalid address payload")
|
||||
// ErrInvalidLength is returned when encountering an address of invalid length.
|
||||
ErrInvalidLength = errors.New("invalid address length")
|
||||
// ErrInvalidChecksum is returned when encountering an invalid address checksum.
|
||||
ErrInvalidChecksum = errors.New("invalid address checksum")
|
||||
)
|
||||
|
||||
// UndefAddressString is the string used to represent an empty address when encoded to a string.
|
||||
var UndefAddressString = "<empty>"
|
||||
|
||||
// PayloadHashLength defines the hash length taken over addresses using the Actor and SECP256K1 protocols.
|
||||
const PayloadHashLength = 20
|
||||
|
||||
// ChecksumHashLength defines the hash length used for calculating address checksums.
|
||||
const ChecksumHashLength = 4
|
||||
|
||||
// MaxAddressStringLength is the max length of an address encoded as a string
|
||||
// it include the network prefx, protocol, and bls publickey
|
||||
const MaxAddressStringLength = 2 + 84
|
||||
|
||||
var payloadHashConfig = &blake2b.Config{Size: PayloadHashLength}
|
||||
var checksumHashConfig = &blake2b.Config{Size: ChecksumHashLength}
|
||||
|
||||
const encodeStd = "abcdefghijklmnopqrstuvwxyz234567"
|
||||
|
||||
// AddressEncoding defines the base32 config used for address encoding and decoding.
|
||||
var AddressEncoding = base32.NewEncoding(encodeStd)
|
@ -1,20 +0,0 @@
|
||||
package address
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// NewForTestGetter returns a closure that returns an address unique to that invocation.
|
||||
// The address is unique wrt the closure returned, not globally.
|
||||
func NewForTestGetter() func() Address {
|
||||
i := 0
|
||||
return func() Address {
|
||||
s := fmt.Sprintf("address%d", i)
|
||||
i++
|
||||
newAddr, err := NewActorAddress([]byte(s))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return newAddr
|
||||
}
|
||||
}
|
@ -10,9 +10,9 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/events"
|
||||
"github.com/filecoin-project/lotus/chain/market"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
|
@ -12,9 +12,9 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/datatransfer"
|
||||
"github.com/filecoin-project/lotus/lib/cborutil"
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/cborutil"
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
"github.com/ipld/go-ipld-prime"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/cborutil"
|
||||
"github.com/filecoin-project/lotus/lib/statestore"
|
||||
|
@ -13,9 +13,9 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/deals"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/cborutil"
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/cborutil"
|
||||
"github.com/ipfs/go-cid"
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
logging "github.com/ipfs/go-log"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
@ -13,8 +13,8 @@ import (
|
||||
"github.com/multiformats/go-multihash"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -19,9 +19,9 @@ import (
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
@ -15,9 +15,9 @@ import (
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
actors "github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/node/impl/full"
|
||||
|
@ -19,9 +19,9 @@ import (
|
||||
"go.uber.org/multierr"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/types/mock"
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
logging "github.com/ipfs/go-log"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -3,8 +3,8 @@ package state
|
||||
import (
|
||||
"testing"
|
||||
|
||||
address "github.com/filecoin-project/go-address"
|
||||
actors "github.com/filecoin-project/lotus/chain/actors"
|
||||
address "github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
hamt "github.com/ipfs/go-hamt-ipld"
|
||||
)
|
||||
|
@ -3,6 +3,7 @@ package stmgr
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-amt-ipld"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/ipfs/go-hamt-ipld"
|
||||
@ -12,7 +13,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
amt "github.com/filecoin-project/go-amt-ipld"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
|
||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
"encoding/json"
|
||||
"sync"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
"go.opencensus.io/trace"
|
||||
|
@ -25,10 +25,10 @@ import (
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/blocksync"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
|
@ -12,9 +12,9 @@ import (
|
||||
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
@ -1,7 +1,7 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
)
|
||||
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
"go.opencensus.io/trace"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
)
|
||||
|
||||
type Ticket struct {
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
)
|
||||
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/multiformats/go-multihash"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
)
|
||||
|
||||
type Message struct {
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
"github.com/ipfs/go-cid"
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
bls "github.com/filecoin-project/filecoin-ffi"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/lib/crypto"
|
||||
"github.com/minio/blake2b-simd"
|
||||
)
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
)
|
||||
|
||||
func blsaddr(n int64) address.Address {
|
||||
|
@ -3,9 +3,9 @@ package types
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-amt-ipld"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
hamt "github.com/ipfs/go-hamt-ipld"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
cborrpc "github.com/filecoin-project/lotus/lib/cborutil"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
)
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
vstate "github.com/filecoin-project/chain-validation/pkg/state"
|
||||
vtypes "github.com/filecoin-project/chain-validation/pkg/state/types"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
)
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
vaddress "github.com/filecoin-project/chain-validation/pkg/state/address"
|
||||
vtypes "github.com/filecoin-project/chain-validation/pkg/state/types"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
vaddress "github.com/filecoin-project/chain-validation/pkg/state/address"
|
||||
vtypes "github.com/filecoin-project/chain-validation/pkg/state/types"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
)
|
||||
|
@ -18,8 +18,8 @@ import (
|
||||
vaddress "github.com/filecoin-project/chain-validation/pkg/state/address"
|
||||
vtypes "github.com/filecoin-project/chain-validation/pkg/state/types"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
hamt "github.com/ipfs/go-hamt-ipld"
|
||||
bstore "github.com/ipfs/go-ipfs-blockstore"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
@ -15,10 +15,10 @@ import (
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/bufbstore"
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
"github.com/minio/blake2b-simd"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/crypto"
|
||||
)
|
||||
|
@ -12,9 +12,9 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
actors "github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -3,7 +3,7 @@ package cli
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
types "github.com/filecoin-project/lotus/chain/types"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ package cli
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
)
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
types "github.com/filecoin-project/lotus/chain/types"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
)
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
|
||||
|
@ -22,8 +22,8 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/genesis"
|
||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"github.com/ipfs/go-cid"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
actors2 "github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
|
@ -16,10 +16,10 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
)
|
||||
|
@ -13,8 +13,8 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
|
||||
"github.com/filecoin-project/lotus/genesis"
|
||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||
|
@ -14,9 +14,9 @@ import (
|
||||
logging "github.com/ipfs/go-log"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
"github.com/filecoin-project/lotus/genesis"
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
|
@ -20,10 +20,10 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/deals"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
|
@ -1,8 +1,8 @@
|
||||
package genesis
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
5
go.mod
5
go.mod
@ -11,7 +11,8 @@ require (
|
||||
github.com/docker/go-units v0.4.0
|
||||
github.com/fatih/color v1.7.0 // indirect
|
||||
github.com/filecoin-project/chain-validation v0.0.3
|
||||
github.com/filecoin-project/filecoin-ffi v0.0.0-20191204125133-ebb3e13addf1
|
||||
github.com/filecoin-project/filecoin-ffi v0.0.0-20191213130254-f261762ff8ed
|
||||
github.com/filecoin-project/go-address v0.0.0-20191219011437-af739c490b4f
|
||||
github.com/filecoin-project/go-amt-ipld v0.0.0-20191205011053-79efc22d6cdc
|
||||
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878
|
||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
||||
@ -78,7 +79,7 @@ require (
|
||||
github.com/multiformats/go-multiaddr-dns v0.2.0
|
||||
github.com/multiformats/go-multiaddr-net v0.1.1
|
||||
github.com/multiformats/go-multihash v0.0.10
|
||||
github.com/multiformats/go-varint v0.0.1
|
||||
github.com/multiformats/go-varint v0.0.2
|
||||
github.com/onsi/ginkgo v1.9.0 // indirect
|
||||
github.com/onsi/gomega v1.6.0 // indirect
|
||||
github.com/opentracing/opentracing-go v1.1.0
|
||||
|
7
go.sum
7
go.sum
@ -81,10 +81,14 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
|
||||
github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E=
|
||||
github.com/filecoin-project/chain-validation v0.0.3 h1:luT/8kJ0WdMIqQ9Bm31W4JkuYCW0wUb26AvnD4WK59M=
|
||||
github.com/filecoin-project/chain-validation v0.0.3/go.mod h1:NCEGFjcWRjb8akWFSOXvU6n2efkWIqAeOKU6o5WBGQw=
|
||||
github.com/filecoin-project/go-address v0.0.0-20191219011437-af739c490b4f h1:L2jaVU8TvWTx7iZPhlYvUE8vkoOnj778XuKavz8W36g=
|
||||
github.com/filecoin-project/go-address v0.0.0-20191219011437-af739c490b4f/go.mod h1:rCbpXPva2NKF9/J4X6sr7hbKBgQCxyFtRj7KOZqoIms=
|
||||
github.com/filecoin-project/go-amt-ipld v0.0.0-20191205011053-79efc22d6cdc h1:cODZD2YzpTUtrOSxbEnWFcQHidNRZiRdvLxySjGvG/M=
|
||||
github.com/filecoin-project/go-amt-ipld v0.0.0-20191205011053-79efc22d6cdc/go.mod h1:KsFPWjF+UUYl6n9A+qbg4bjFgAOneicFZtDH/LQEX2U=
|
||||
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878 h1:YicJT9xhPzZ1SBGiJFNUCkfwqK/G9vFyY1ytKBSjNJA=
|
||||
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878/go.mod h1:40kI2Gv16mwcRsHptI3OAV4nlOEU7wVDc4RgMylNFjU=
|
||||
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 h1:2pMXdBnCiXjfCYx/hLqFxccPoqsSveQFxVLvNxy9bus=
|
||||
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03/go.mod h1:+viYnvGtUTgJRdy6oaeF4MTFKAfatX071MPDPBL11EQ=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 h1:EzDjxMg43q1tA2c0MV3tNbaontnHLplHyFF6M5KiVP0=
|
||||
@ -532,6 +536,8 @@ github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9A
|
||||
github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg=
|
||||
github.com/multiformats/go-varint v0.0.1 h1:TR/0rdQtnNxuN2IhiB639xC3tWM4IUi7DkTBVTdGW/M=
|
||||
github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
||||
github.com/multiformats/go-varint v0.0.2 h1:6sUvyh2YHpJCb8RZ6eYzj6iJQ4+chWYmyIHxszqlPTA=
|
||||
github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229 h1:E2B8qYyeSgv5MXpmzZXRNp8IAQ4vjxIjhpAf5hv/tAg=
|
||||
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
|
||||
@ -563,6 +569,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
||||
github.com/polydawn/refmt v0.0.0-20190408063855-01bf1e26dd14/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
||||
github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
||||
github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a h1:hjZfReYVLbqFkAtr2us7vdy04YWz3LVAirzP7reh8+M=
|
||||
github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
|
@ -1,7 +1,7 @@
|
||||
package sectorbuilder
|
||||
|
||||
import (
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
|
||||
|
@ -16,8 +16,8 @@ import (
|
||||
dcopy "github.com/otiai10/copy"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
sectorbuilder "github.com/filecoin-project/filecoin-ffi"
|
||||
"go.opencensus.io/trace"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
|
||||
)
|
||||
|
||||
|
@ -5,10 +5,10 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
|
@ -3,8 +3,8 @@ package miner
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
)
|
||||
|
||||
|
@ -22,9 +22,9 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"go.uber.org/fx"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/deals"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
@ -21,8 +21,8 @@ import (
|
||||
"go.uber.org/fx"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
"go.uber.org/fx"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/messagepool"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
@ -14,9 +14,9 @@ import (
|
||||
"go.uber.org/fx"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
|
@ -3,7 +3,7 @@ package full
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"go.uber.org/fx"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/market"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
"go.uber.org/fx"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
full "github.com/filecoin-project/lotus/node/impl/full"
|
||||
"github.com/filecoin-project/lotus/paych"
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
"github.com/gorilla/mux"
|
||||
files "github.com/ipfs/go-ipfs-files"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||
"github.com/filecoin-project/lotus/lib/tarutil"
|
||||
"github.com/filecoin-project/lotus/miner"
|
||||
|
@ -19,9 +19,9 @@ import (
|
||||
"go.uber.org/fx"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/lotus/chain/deals"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/datatransfer"
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/address"
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user