diff --git a/api/api_full.go b/api/api_full.go index d8fec7723..6e6796476 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -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" ) diff --git a/api/api_storage.go b/api/api_storage.go index 1a1aff853..1c89f6688 100644 --- a/api/api_storage.go +++ b/api/api_storage.go @@ -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" ) diff --git a/api/apistruct/struct.go b/api/apistruct/struct.go index ae52b24d8..90fd41d13 100644 --- a/api/apistruct/struct.go +++ b/api/apistruct/struct.go @@ -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" ) diff --git a/api/utils.go b/api/utils.go index 9927d44d0..0576ad1d4 100644 --- a/api/utils.go +++ b/api/utils.go @@ -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" ) diff --git a/chain/actors/actor_cron.go b/chain/actors/actor_cron.go index 8f9a08ade..f0be6a439 100644 --- a/chain/actors/actor_cron.go +++ b/chain/actors/actor_cron.go @@ -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" ) diff --git a/chain/actors/actor_init.go b/chain/actors/actor_init.go index 99030f6ed..45da1401e 100644 --- a/chain/actors/actor_init.go +++ b/chain/actors/actor_init.go @@ -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" diff --git a/chain/actors/actor_miner.go b/chain/actors/actor_miner.go index 53a8d303d..19b319662 100644 --- a/chain/actors/actor_miner.go +++ b/chain/actors/actor_miner.go @@ -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" diff --git a/chain/actors/actor_miner_test.go b/chain/actors/actor_miner_test.go index 568ce4805..173e7e6e0 100644 --- a/chain/actors/actor_miner_test.go +++ b/chain/actors/actor_miner_test.go @@ -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" diff --git a/chain/actors/actor_multisig.go b/chain/actors/actor_multisig.go index e8c360de6..4cff548ad 100644 --- a/chain/actors/actor_multisig.go +++ b/chain/actors/actor_multisig.go @@ -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" diff --git a/chain/actors/actor_multisig_test.go b/chain/actors/actor_multisig_test.go index b55d17b13..5ed76265c 100644 --- a/chain/actors/actor_multisig_test.go +++ b/chain/actors/actor_multisig_test.go @@ -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" ) diff --git a/chain/actors/actor_paych.go b/chain/actors/actor_paych.go index 3ff4dd95e..32181e592 100644 --- a/chain/actors/actor_paych.go +++ b/chain/actors/actor_paych.go @@ -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" ) diff --git a/chain/actors/actor_paych_test.go b/chain/actors/actor_paych_test.go index 55de306c0..226f147c5 100644 --- a/chain/actors/actor_paych_test.go +++ b/chain/actors/actor_paych_test.go @@ -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" ) diff --git a/chain/actors/actor_storagemarket.go b/chain/actors/actor_storagemarket.go index 7a9549ba6..22249e430 100644 --- a/chain/actors/actor_storagemarket.go +++ b/chain/actors/actor_storagemarket.go @@ -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" diff --git a/chain/actors/actor_storagepower.go b/chain/actors/actor_storagepower.go index 2f164dbcb..09a3eb30a 100644 --- a/chain/actors/actor_storagepower.go +++ b/chain/actors/actor_storagepower.go @@ -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" ) diff --git a/chain/actors/actor_storagepower_test.go b/chain/actors/actor_storagepower_test.go index 20157ada8..3e6f47f29 100644 --- a/chain/actors/actor_storagepower_test.go +++ b/chain/actors/actor_storagepower_test.go @@ -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" diff --git a/chain/actors/actors.go b/chain/actors/actors.go index 5208286a3..44c790fb2 100644 --- a/chain/actors/actors.go +++ b/chain/actors/actors.go @@ -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" diff --git a/chain/actors/actors_test.go b/chain/actors/actors_test.go index 3433ea0d3..64207b422 100644 --- a/chain/actors/actors_test.go +++ b/chain/actors/actors_test.go @@ -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" diff --git a/chain/actors/address.go b/chain/actors/address.go index f88cf0f0a..eb3bcbff3 100644 --- a/chain/actors/address.go +++ b/chain/actors/address.go @@ -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) { diff --git a/chain/actors/cbor_gen.go b/chain/actors/cbor_gen.go index dac7ef456..73a3512a0 100644 --- a/chain/actors/cbor_gen.go +++ b/chain/actors/cbor_gen.go @@ -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" diff --git a/chain/actors/harness2_test.go b/chain/actors/harness2_test.go index 6f1da8d58..d5d34795b 100644 --- a/chain/actors/harness2_test.go +++ b/chain/actors/harness2_test.go @@ -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" diff --git a/chain/address/address.go b/chain/address/address.go deleted file mode 100644 index 7cf99e67e..000000000 --- a/chain/address/address.go +++ /dev/null @@ -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 -} diff --git a/chain/address/address_test.go b/chain/address/address_test.go deleted file mode 100644 index bf77b974a..000000000 --- a/chain/address/address_test.go +++ /dev/null @@ -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) -} diff --git a/chain/address/bench_test.go b/chain/address/bench_test.go deleted file mode 100644 index 2c21d549e..000000000 --- a/chain/address/bench_test.go +++ /dev/null @@ -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))) -} diff --git a/chain/address/constants.go b/chain/address/constants.go deleted file mode 100644 index 9eabb862b..000000000 --- a/chain/address/constants.go +++ /dev/null @@ -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 = "" - -// 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) diff --git a/chain/address/testing.go b/chain/address/testing.go deleted file mode 100644 index 9bc41376d..000000000 --- a/chain/address/testing.go +++ /dev/null @@ -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 - } -} diff --git a/chain/deals/client.go b/chain/deals/client.go index 39289db28..daa3063ce 100644 --- a/chain/deals/client.go +++ b/chain/deals/client.go @@ -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" diff --git a/chain/deals/provider.go b/chain/deals/provider.go index 7716d88e4..518535939 100644 --- a/chain/deals/provider.go +++ b/chain/deals/provider.go @@ -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" diff --git a/chain/deals/provider_asks.go b/chain/deals/provider_asks.go index 1fc8e69ed..4bc50ca39 100644 --- a/chain/deals/provider_asks.go +++ b/chain/deals/provider_asks.go @@ -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" diff --git a/chain/deals/provider_utils.go b/chain/deals/provider_utils.go index 5a4135f1c..b9b8eaa73 100644 --- a/chain/deals/provider_utils.go +++ b/chain/deals/provider_utils.go @@ -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" diff --git a/chain/deals/request_validation_test.go b/chain/deals/request_validation_test.go index 3f466f69a..b035ebc6a 100644 --- a/chain/deals/request_validation_test.go +++ b/chain/deals/request_validation_test.go @@ -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" diff --git a/chain/deals/types.go b/chain/deals/types.go index eebca4f60..e71d35b35 100644 --- a/chain/deals/types.go +++ b/chain/deals/types.go @@ -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" diff --git a/chain/events/events.go b/chain/events/events.go index cc51fbfae..683dab5db 100644 --- a/chain/events/events.go +++ b/chain/events/events.go @@ -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" ) diff --git a/chain/events/events_test.go b/chain/events/events_test.go index 7ffa5aa28..a18c916e2 100644 --- a/chain/events/events_test.go +++ b/chain/events/events_test.go @@ -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" ) diff --git a/chain/events/tscache_test.go b/chain/events/tscache_test.go index 9c7c203bb..12fdb6a94 100644 --- a/chain/events/tscache_test.go +++ b/chain/events/tscache_test.go @@ -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" ) diff --git a/chain/gen/gen.go b/chain/gen/gen.go index 07565d4b8..20b238dd8 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -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" diff --git a/chain/gen/mining.go b/chain/gen/mining.go index e9aeaef7d..dec684ec2 100644 --- a/chain/gen/mining.go +++ b/chain/gen/mining.go @@ -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" diff --git a/chain/gen/utils.go b/chain/gen/utils.go index c707f2242..3f528075e 100644 --- a/chain/gen/utils.go +++ b/chain/gen/utils.go @@ -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" diff --git a/chain/market/fundmgr.go b/chain/market/fundmgr.go index 9f8068ae2..1500a78a5 100644 --- a/chain/market/fundmgr.go +++ b/chain/market/fundmgr.go @@ -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" diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 64ebe11db..94f495d0a 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -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" diff --git a/chain/messagepool/messagepool_test.go b/chain/messagepool/messagepool_test.go index 105c28206..514806eb1 100644 --- a/chain/messagepool/messagepool_test.go +++ b/chain/messagepool/messagepool_test.go @@ -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" diff --git a/chain/state/statetree.go b/chain/state/statetree.go index 1237007a5..fc3da47e4 100644 --- a/chain/state/statetree.go +++ b/chain/state/statetree.go @@ -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" ) diff --git a/chain/state/statetree_test.go b/chain/state/statetree_test.go index 360f4778e..a12bbbeca 100644 --- a/chain/state/statetree_test.go +++ b/chain/state/statetree_test.go @@ -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" ) diff --git a/chain/stmgr/fork_no_p_eps.go b/chain/stmgr/fork_no_p_eps.go index f74f20cdd..2eb112ca6 100644 --- a/chain/stmgr/fork_no_p_eps.go +++ b/chain/stmgr/fork_no_p_eps.go @@ -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" ) diff --git a/chain/stmgr/stmgr.go b/chain/stmgr/stmgr.go index 6f8e7ece9..b880492f2 100644 --- a/chain/stmgr/stmgr.go +++ b/chain/stmgr/stmgr.go @@ -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" diff --git a/chain/stmgr/utils.go b/chain/stmgr/utils.go index b6dcfe335..c9bcd8529 100644 --- a/chain/stmgr/utils.go +++ b/chain/stmgr/utils.go @@ -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" diff --git a/chain/store/store.go b/chain/store/store.go index e7ff6fa2a..d59126518 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -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" diff --git a/chain/sync.go b/chain/sync.go index 3c80b3275..c6907b848 100644 --- a/chain/sync.go +++ b/chain/sync.go @@ -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" diff --git a/chain/sync_test.go b/chain/sync_test.go index f9c62b93e..c9b8e7bbb 100644 --- a/chain/sync_test.go +++ b/chain/sync_test.go @@ -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" diff --git a/chain/types/ask.go b/chain/types/ask.go index dd768feb3..42265c9dc 100644 --- a/chain/types/ask.go +++ b/chain/types/ask.go @@ -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" ) diff --git a/chain/types/blockheader.go b/chain/types/blockheader.go index aaa41cb2f..adbea8951 100644 --- a/chain/types/blockheader.go +++ b/chain/types/blockheader.go @@ -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 { diff --git a/chain/types/blockheader_test.go b/chain/types/blockheader_test.go index 54ec1da09..ee9ca8192 100644 --- a/chain/types/blockheader_test.go +++ b/chain/types/blockheader_test.go @@ -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" ) diff --git a/chain/types/message.go b/chain/types/message.go index aee5300cf..8d08dc53c 100644 --- a/chain/types/message.go +++ b/chain/types/message.go @@ -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 { diff --git a/chain/types/mock/chain.go b/chain/types/mock/chain.go index f51573d03..55fe8c11d 100644 --- a/chain/types/mock/chain.go +++ b/chain/types/mock/chain.go @@ -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" diff --git a/chain/types/signature_cgo.go b/chain/types/signature_cgo.go index 4b5a262f6..89f881a88 100644 --- a/chain/types/signature_cgo.go +++ b/chain/types/signature_cgo.go @@ -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" ) diff --git a/chain/types/types_test.go b/chain/types/types_test.go index 4849db5b7..d912c20e3 100644 --- a/chain/types/types_test.go +++ b/chain/types/types_test.go @@ -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 { diff --git a/chain/types/vmcontext.go b/chain/types/vmcontext.go index 39667d2a4..1af2aa3da 100644 --- a/chain/types/vmcontext.go +++ b/chain/types/vmcontext.go @@ -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" diff --git a/chain/types/voucher.go b/chain/types/voucher.go index 1a510d07e..8631ff40c 100644 --- a/chain/types/voucher.go +++ b/chain/types/voucher.go @@ -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" ) diff --git a/chain/types_test.go b/chain/types_test.go index f0cf4afb5..17b6c9cdd 100644 --- a/chain/types_test.go +++ b/chain/types_test.go @@ -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" ) diff --git a/chain/validation/applier.go b/chain/validation/applier.go index eb8f542f7..4e21f1228 100644 --- a/chain/validation/applier.go +++ b/chain/validation/applier.go @@ -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" ) diff --git a/chain/validation/message.go b/chain/validation/message.go index ed9f2c0b9..2e497184f 100644 --- a/chain/validation/message.go +++ b/chain/validation/message.go @@ -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" ) diff --git a/chain/validation/message_test.go b/chain/validation/message_test.go index a6fd4838a..65fcc94dc 100644 --- a/chain/validation/message_test.go +++ b/chain/validation/message_test.go @@ -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" ) diff --git a/chain/validation/state.go b/chain/validation/state.go index a3acfcd68..b82b9f47f 100644 --- a/chain/validation/state.go +++ b/chain/validation/state.go @@ -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" diff --git a/chain/vm/mkactor.go b/chain/vm/mkactor.go index 3419f9f3c..a84387321 100644 --- a/chain/vm/mkactor.go +++ b/chain/vm/mkactor.go @@ -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" ) diff --git a/chain/vm/vm.go b/chain/vm/vm.go index 55516e88b..6fa6a432c 100644 --- a/chain/vm/vm.go +++ b/chain/vm/vm.go @@ -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" diff --git a/chain/wallet/wallet.go b/chain/wallet/wallet.go index 9ca4d2e0a..4be3605fe 100644 --- a/chain/wallet/wallet.go +++ b/chain/wallet/wallet.go @@ -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" ) diff --git a/cli/client.go b/cli/client.go index 7235fce6f..34208318f 100644 --- a/cli/client.go +++ b/cli/client.go @@ -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" ) diff --git a/cli/mpool.go b/cli/mpool.go index a2b4324f6..2517e7df6 100644 --- a/cli/mpool.go +++ b/cli/mpool.go @@ -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" ) diff --git a/cli/paych.go b/cli/paych.go index 3b018bc1d..a41211e31 100644 --- a/cli/paych.go +++ b/cli/paych.go @@ -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" ) diff --git a/cli/send.go b/cli/send.go index 9965cd904..e221ee49a 100644 --- a/cli/send.go +++ b/cli/send.go @@ -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" ) diff --git a/cli/state.go b/cli/state.go index 62e3dd4ff..2f13fc3f1 100644 --- a/cli/state.go +++ b/cli/state.go @@ -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" diff --git a/cli/wallet.go b/cli/wallet.go index dcd5f55d2..1f950adb8 100644 --- a/cli/wallet.go +++ b/cli/wallet.go @@ -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" ) diff --git a/cmd/chain-noise/main.go b/cmd/chain-noise/main.go index 96d128d7b..ae187b116 100644 --- a/cmd/chain-noise/main.go +++ b/cmd/chain-noise/main.go @@ -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" diff --git a/cmd/lotus-bench/main.go b/cmd/lotus-bench/main.go index 4603733ca..b1ff4b838 100644 --- a/cmd/lotus-bench/main.go +++ b/cmd/lotus-bench/main.go @@ -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" diff --git a/cmd/lotus-chainwatch/storage.go b/cmd/lotus-chainwatch/storage.go index 43be97d27..5900f972b 100644 --- a/cmd/lotus-chainwatch/storage.go +++ b/cmd/lotus-chainwatch/storage.go @@ -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" ) diff --git a/cmd/lotus-chainwatch/sync.go b/cmd/lotus-chainwatch/sync.go index 24aba4629..947601321 100644 --- a/cmd/lotus-chainwatch/sync.go +++ b/cmd/lotus-chainwatch/sync.go @@ -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" diff --git a/cmd/lotus-fountain/main.go b/cmd/lotus-fountain/main.go index 6e1ff8f2b..33abeb76b 100644 --- a/cmd/lotus-fountain/main.go +++ b/cmd/lotus-fountain/main.go @@ -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" ) diff --git a/cmd/lotus-seed/main.go b/cmd/lotus-seed/main.go index 3e3c09649..f79655294 100644 --- a/cmd/lotus-seed/main.go +++ b/cmd/lotus-seed/main.go @@ -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" diff --git a/cmd/lotus-seed/seed/seed.go b/cmd/lotus-seed/seed/seed.go index 497f0258a..520748b82 100644 --- a/cmd/lotus-seed/seed/seed.go +++ b/cmd/lotus-seed/seed/seed.go @@ -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" diff --git a/cmd/lotus-shed/nonce-fix.go b/cmd/lotus-shed/nonce-fix.go index fc812283e..67b34d7b7 100644 --- a/cmd/lotus-shed/nonce-fix.go +++ b/cmd/lotus-shed/nonce-fix.go @@ -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" diff --git a/cmd/lotus-storage-miner/init.go b/cmd/lotus-storage-miner/init.go index 2812291ad..280094aa6 100644 --- a/cmd/lotus-storage-miner/init.go +++ b/cmd/lotus-storage-miner/init.go @@ -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" diff --git a/genesis/types.go b/genesis/types.go index 712c116cc..27eabea4a 100644 --- a/genesis/types.go +++ b/genesis/types.go @@ -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" ) diff --git a/go.mod b/go.mod index 94b896239..64a056ee7 100644 --- a/go.mod +++ b/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 diff --git a/go.sum b/go.sum index 835d7ebd7..d9141b3d6 100644 --- a/go.sum +++ b/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= diff --git a/lib/sectorbuilder/mock.go b/lib/sectorbuilder/mock.go index 8573050ef..fe90a64f0 100644 --- a/lib/sectorbuilder/mock.go +++ b/lib/sectorbuilder/mock.go @@ -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" ) diff --git a/lib/sectorbuilder/sectorbuilder.go b/lib/sectorbuilder/sectorbuilder.go index 7564f1c6b..206ea41b2 100644 --- a/lib/sectorbuilder/sectorbuilder.go +++ b/lib/sectorbuilder/sectorbuilder.go @@ -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" ) diff --git a/lib/sectorbuilder/simple.go b/lib/sectorbuilder/simple.go index 082489b8a..28078493a 100644 --- a/lib/sectorbuilder/simple.go +++ b/lib/sectorbuilder/simple.go @@ -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" ) diff --git a/lotuspond/spawn.go b/lotuspond/spawn.go index 2146554b6..bc0602fa6 100644 --- a/lotuspond/spawn.go +++ b/lotuspond/spawn.go @@ -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" ) diff --git a/miner/miner.go b/miner/miner.go index cabee16fd..4c6c3d2a0 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -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" diff --git a/miner/miner_test.go b/miner/miner_test.go index 160433d72..3b6f34b82 100644 --- a/miner/miner_test.go +++ b/miner/miner_test.go @@ -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" ) diff --git a/miner/testminer.go b/miner/testminer.go index 1f93eb04f..8e60956c8 100644 --- a/miner/testminer.go +++ b/miner/testminer.go @@ -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" ) diff --git a/node/impl/client/client.go b/node/impl/client/client.go index 66a9e2473..a0c420e7e 100644 --- a/node/impl/client/client.go +++ b/node/impl/client/client.go @@ -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" diff --git a/node/impl/full/chain.go b/node/impl/full/chain.go index 2c80e7228..702f0a32a 100644 --- a/node/impl/full/chain.go +++ b/node/impl/full/chain.go @@ -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" ) diff --git a/node/impl/full/mpool.go b/node/impl/full/mpool.go index 7d2dd5639..9f1f02e9a 100644 --- a/node/impl/full/mpool.go +++ b/node/impl/full/mpool.go @@ -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" diff --git a/node/impl/full/state.go b/node/impl/full/state.go index db39df009..0a5f915e0 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -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" diff --git a/node/impl/full/wallet.go b/node/impl/full/wallet.go index 809a938bc..b30a55f38 100644 --- a/node/impl/full/wallet.go +++ b/node/impl/full/wallet.go @@ -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" diff --git a/node/impl/market/market.go b/node/impl/market/market.go index 3e7724e43..fceb75781 100644 --- a/node/impl/market/market.go +++ b/node/impl/market/market.go @@ -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" ) diff --git a/node/impl/paych/paych.go b/node/impl/paych/paych.go index e4ae9e23f..d3811ec0c 100644 --- a/node/impl/paych/paych.go +++ b/node/impl/paych/paych.go @@ -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" diff --git a/node/impl/storminer.go b/node/impl/storminer.go index d7eba489a..dd6e6825e 100644 --- a/node/impl/storminer.go +++ b/node/impl/storminer.go @@ -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" diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index 3e45ca5cb..5a5b55cec 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -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" diff --git a/node/modules/testing/genesis.go b/node/modules/testing/genesis.go index 5efe22382..6d13612ab 100644 --- a/node/modules/testing/genesis.go +++ b/node/modules/testing/genesis.go @@ -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" diff --git a/node/node_test.go b/node/node_test.go index 1b729fe24..e44305977 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -20,11 +20,11 @@ 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/api/client" "github.com/filecoin-project/lotus/api/test" "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" "github.com/filecoin-project/lotus/cmd/lotus-seed/seed" diff --git a/paych/paych.go b/paych/paych.go index 61c6bd5c1..255d6c786 100644 --- a/paych/paych.go +++ b/paych/paych.go @@ -12,8 +12,8 @@ import ( logging "github.com/ipfs/go-log" "go.uber.org/fx" + "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" diff --git a/paych/simple.go b/paych/simple.go index 81ba51830..0c5844545 100644 --- a/paych/simple.go +++ b/paych/simple.go @@ -7,8 +7,8 @@ import ( "github.com/ipfs/go-cid" "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" ) diff --git a/paych/state.go b/paych/state.go index 8a0150620..bd9521864 100644 --- a/paych/state.go +++ b/paych/state.go @@ -4,8 +4,8 @@ import ( "context" "fmt" + "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" xerrors "golang.org/x/xerrors" ) diff --git a/paych/store.go b/paych/store.go index f08969630..b9c5d075c 100644 --- a/paych/store.go +++ b/paych/store.go @@ -12,7 +12,7 @@ import ( dsq "github.com/ipfs/go-datastore/query" "golang.org/x/xerrors" - "github.com/filecoin-project/lotus/chain/address" + "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/chain/types" cborrpc "github.com/filecoin-project/lotus/lib/cborutil" "github.com/filecoin-project/lotus/node/modules/dtypes" diff --git a/retrieval/client.go b/retrieval/client.go index cfbfdfb05..abe76f4e1 100644 --- a/retrieval/client.go +++ b/retrieval/client.go @@ -13,9 +13,9 @@ import ( cbg "github.com/whyrusleeping/cbor-gen" "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/types" "github.com/filecoin-project/lotus/lib/cborutil" payapi "github.com/filecoin-project/lotus/node/impl/paych" diff --git a/retrieval/discovery/discovery.go b/retrieval/discovery/discovery.go index a10949f50..9933ad793 100644 --- a/retrieval/discovery/discovery.go +++ b/retrieval/discovery/discovery.go @@ -1,7 +1,7 @@ package discovery import ( - "github.com/filecoin-project/lotus/chain/address" + "github.com/filecoin-project/go-address" "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" "github.com/libp2p/go-libp2p-core/peer" diff --git a/retrieval/miner.go b/retrieval/miner.go index 361054037..98563b7f9 100644 --- a/retrieval/miner.go +++ b/retrieval/miner.go @@ -11,9 +11,9 @@ import ( "github.com/libp2p/go-libp2p-core/network" "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/types" "github.com/filecoin-project/lotus/lib/cborutil" "github.com/filecoin-project/lotus/storage/sectorblocks" diff --git a/storage/fpost_sched.go b/storage/fpost_sched.go index 58cca22ef..4b2a92ac7 100644 --- a/storage/fpost_sched.go +++ b/storage/fpost_sched.go @@ -7,8 +7,8 @@ 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/address" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/lib/sectorbuilder" diff --git a/storage/miner.go b/storage/miner.go index 5d07908de..2a0b267f5 100644 --- a/storage/miner.go +++ b/storage/miner.go @@ -12,9 +12,9 @@ import ( "github.com/libp2p/go-libp2p-core/host" "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/events" "github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/store" diff --git a/tools/stats/metrics.go b/tools/stats/metrics.go index d1e1b1e1c..c30523259 100644 --- a/tools/stats/metrics.go +++ b/tools/stats/metrics.go @@ -9,10 +9,10 @@ import ( "strings" "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/types" "github.com/ipfs/go-cid" "github.com/multiformats/go-multihash"