Skip to content

Commit

Permalink
Merge pull request #5112 from filecoin-project/chore/update_ffi
Browse files Browse the repository at this point in the history
chore: update ffi
  • Loading branch information
hunjixin authored and simlecode committed Jul 21, 2022
1 parent 185f3f1 commit e10cb44
Show file tree
Hide file tree
Showing 34 changed files with 608 additions and 840 deletions.
2 changes: 1 addition & 1 deletion extern/filecoin-ffi
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,28 @@ require (
github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c
github.com/ipfs-force-community/metrics v1.0.1-0.20211022060227-11142a08b729
github.com/ipfs-force-community/venus-common-utils v0.0.0-20210924063144-1d3a5b30de87
github.com/ipfs/go-bitswap v0.5.1
github.com/ipfs/go-bitswap v0.6.0
github.com/ipfs/go-block-format v0.0.3
github.com/ipfs/go-blockservice v0.2.1
github.com/ipfs/go-blockservice v0.3.0
github.com/ipfs/go-cid v0.1.0
github.com/ipfs/go-datastore v0.5.1
github.com/ipfs/go-ds-badger2 v0.1.2
github.com/ipfs/go-fs-lock v0.0.7
github.com/ipfs/go-graphsync v0.13.1
github.com/ipfs/go-ipfs-blockstore v1.1.2
github.com/ipfs/go-ipfs-blockstore v1.2.0
github.com/ipfs/go-ipfs-chunker v0.0.5
github.com/ipfs/go-ipfs-cmdkit v0.0.1
github.com/ipfs/go-ipfs-cmds v0.6.1-0.20220212012746-40b8fddb899f
github.com/ipfs/go-ipfs-ds-help v1.1.0
github.com/ipfs/go-ipfs-exchange-interface v0.1.0
github.com/ipfs/go-ipfs-exchange-offline v0.1.1
github.com/ipfs/go-ipfs-exchange-offline v0.2.0
github.com/ipfs/go-ipfs-files v0.0.9
github.com/ipfs/go-ipfs-routing v0.2.1
github.com/ipfs/go-ipld-cbor v0.0.6
github.com/ipfs/go-ipld-format v0.2.0
github.com/ipfs/go-ipld-format v0.4.0
github.com/ipfs/go-log v1.0.5
github.com/ipfs/go-log/v2 v2.5.1
github.com/ipfs/go-merkledag v0.5.1
github.com/ipfs/go-merkledag v0.6.0
github.com/ipfs/go-unixfs v0.3.1
github.com/ipld/go-car v0.3.3
github.com/jbenet/goprocess v0.1.4
Expand Down
19 changes: 13 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,9 @@ github.com/ipfs/go-bitswap v0.1.0/go.mod h1:FFJEf18E9izuCqUtHxbWEvq+reg7o4CW5wSA
github.com/ipfs/go-bitswap v0.1.2/go.mod h1:qxSWS4NXGs7jQ6zQvoPY3+NmOfHHG47mhkiLzBpJQIs=
github.com/ipfs/go-bitswap v0.1.8/go.mod h1:TOWoxllhccevbWFUR2N7B1MTSVVge1s6XSMiCSA4MzM=
github.com/ipfs/go-bitswap v0.3.4/go.mod h1:4T7fvNv/LmOys+21tnLzGKncMeeXUYUd1nUiJ2teMvI=
github.com/ipfs/go-bitswap v0.5.1 h1:721YAEDBnLIrvcIMkCHCdqp34hA8jwL9yKMkyJpSpco=
github.com/ipfs/go-bitswap v0.5.1/go.mod h1:P+ckC87ri1xFLvk74NlXdP0Kj9RmWAh4+H78sC6Qopo=
github.com/ipfs/go-bitswap v0.6.0 h1:f2rc6GZtoSFhEIzQmddgGiel9xntj02Dg0ZNf2hSC+w=
github.com/ipfs/go-bitswap v0.6.0/go.mod h1:Hj3ZXdOC5wBJvENtdqsixmzzRukqd8EHLxZLZc3mzRA=
github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc=
github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=
github.com/ipfs/go-block-format v0.0.3 h1:r8t66QstRp/pd/or4dpnbVfXT5Gt7lOqRvC+/dDTpMc=
Expand All @@ -745,8 +746,9 @@ github.com/ipfs/go-blockservice v0.0.7/go.mod h1:EOfb9k/Y878ZTRY/CH0x5+ATtaipfbR
github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M=
github.com/ipfs/go-blockservice v0.1.4/go.mod h1:OTZhFpkgY48kNzbgyvcexW9cHrpjBYIjSR0KoDOFOLU=
github.com/ipfs/go-blockservice v0.1.7/go.mod h1:GmS+BAt4hrwBKkzE11AFDQUrnvqjwFatGS2MY7wOjEM=
github.com/ipfs/go-blockservice v0.2.1 h1:NJ4j/cwEfIg60rzAWcCIxRtOwbf6ZPK49MewNxObCPQ=
github.com/ipfs/go-blockservice v0.2.1/go.mod h1:k6SiwmgyYgs4M/qt+ww6amPeUH9EISLRBnvUurKJhi8=
github.com/ipfs/go-blockservice v0.3.0 h1:cDgcZ+0P0Ih3sl8+qjFr2sVaMdysg/YZpLj5WJ8kiiw=
github.com/ipfs/go-blockservice v0.3.0/go.mod h1:P5ppi8IHDC7O+pA0AlGTF09jruB2h+oP3wVVaZl8sfk=
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
Expand Down Expand Up @@ -812,8 +814,9 @@ github.com/ipfs/go-ipfs-blockstore v0.2.1/go.mod h1:jGesd8EtCM3/zPgx+qr0/feTXGUe
github.com/ipfs/go-ipfs-blockstore v1.0.4-0.20210205083733-fb07d7bc5aec/go.mod h1:feuklK+m9POeWJzYQO7l05yNEgUiX5oELBNA8/Be33E=
github.com/ipfs/go-ipfs-blockstore v1.0.4/go.mod h1:uL7/gTJ8QIZ3MtA3dWf+s1a0U3fJy2fcEZAsovpRp+w=
github.com/ipfs/go-ipfs-blockstore v1.1.1/go.mod h1:w51tNR9y5+QXB0wkNcHt4O2aSZjTdqaEWaQdSxEyUOY=
github.com/ipfs/go-ipfs-blockstore v1.1.2 h1:WCXoZcMYnvOTmlpX+RSSnhVN0uCmbWTeepTGX5lgiXw=
github.com/ipfs/go-ipfs-blockstore v1.1.2/go.mod h1:w51tNR9y5+QXB0wkNcHt4O2aSZjTdqaEWaQdSxEyUOY=
github.com/ipfs/go-ipfs-blockstore v1.2.0 h1:n3WTeJ4LdICWs/0VSfjHrlqpPpl6MZ+ySd3j8qz0ykw=
github.com/ipfs/go-ipfs-blockstore v1.2.0/go.mod h1:eh8eTFLiINYNSNawfZOC7HOxNTxpB1PFuA5E1m/7exE=
github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ=
github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk=
github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw=
Expand All @@ -837,8 +840,9 @@ github.com/ipfs/go-ipfs-exchange-interface v0.0.1/go.mod h1:c8MwfHjtQjPoDyiy9cFq
github.com/ipfs/go-ipfs-exchange-interface v0.1.0 h1:TiMekCrOGQuWYtZO3mf4YJXDIdNgnKWZ9IE3fGlnWfo=
github.com/ipfs/go-ipfs-exchange-interface v0.1.0/go.mod h1:ych7WPlyHqFvCi/uQI48zLZuAWVP5iTQPXEfVaw5WEI=
github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0=
github.com/ipfs/go-ipfs-exchange-offline v0.1.1 h1:mEiXWdbMN6C7vtDG21Fphx8TGCbZPpQnz/496w/PL4g=
github.com/ipfs/go-ipfs-exchange-offline v0.1.1/go.mod h1:vTiBRIbzSwDD0OWm+i3xeT0mO7jG2cbJYatp3HPk5XY=
github.com/ipfs/go-ipfs-exchange-offline v0.2.0 h1:2PF4o4A7W656rC0RxuhUace997FTcDTcIQ6NoEtyjAI=
github.com/ipfs/go-ipfs-exchange-offline v0.2.0/go.mod h1:HjwBeW0dvZvfOMwDP0TSKXIHf2s+ksdP4E3MLDRtLKY=
github.com/ipfs/go-ipfs-files v0.0.3/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4=
github.com/ipfs/go-ipfs-files v0.0.4/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4=
github.com/ipfs/go-ipfs-files v0.0.8/go.mod h1:wiN/jSG8FKyk7N0WyctKSvq3ljIa2NNTiZB55kpTdOs=
Expand Down Expand Up @@ -868,8 +872,10 @@ github.com/ipfs/go-ipld-cbor v0.0.6 h1:pYuWHyvSpIsOOLw4Jy7NbBkCyzLDcl64Bf/LZW7eB
github.com/ipfs/go-ipld-cbor v0.0.6/go.mod h1:ssdxxaLJPXH7OjF5V4NSjBbcfh+evoR4ukuru0oPXMA=
github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms=
github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k=
github.com/ipfs/go-ipld-format v0.2.0 h1:xGlJKkArkmBvowr+GMCX0FEZtkro71K1AwiKnL37mwA=
github.com/ipfs/go-ipld-format v0.2.0/go.mod h1:3l3C1uKoadTPbeNfrDi+xMInYKlx2Cvg1BuydPSdzQs=
github.com/ipfs/go-ipld-format v0.3.0/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM=
github.com/ipfs/go-ipld-format v0.4.0 h1:yqJSaJftjmjc9jEOFYlpkwOLVKv68OD27jFLlSghBlQ=
github.com/ipfs/go-ipld-format v0.4.0/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM=
github.com/ipfs/go-ipld-git v0.1.1/go.mod h1:+VyMqF5lMcJh4rwEppV0e6g4nCCHXThLYYDpKUkJubI=
github.com/ipfs/go-ipld-legacy v0.1.0/go.mod h1:86f5P/srAmh9GcIcWQR9lfFLZPrIyyXQeVlOWeeWEuI=
github.com/ipfs/go-ipld-legacy v0.1.1 h1:BvD8PEuqwBHLTKqlGFTHSwrwFOMkVESEvwIYwR2cdcc=
Expand Down Expand Up @@ -902,8 +908,9 @@ github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB
github.com/ipfs/go-merkledag v0.2.4/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk=
github.com/ipfs/go-merkledag v0.3.2/go.mod h1:fvkZNNZixVW6cKSZ/JfLlON5OlgTXNdRLz0p6QG/I2M=
github.com/ipfs/go-merkledag v0.4.0/go.mod h1:XshXBkhyeS63YNGisLL1uDSfuTyrQIxVUOg3ojR5MOE=
github.com/ipfs/go-merkledag v0.5.1 h1:tr17GPP5XtPhvPPiWtu20tSGZiZDuTaJRXBLcr79Umk=
github.com/ipfs/go-merkledag v0.5.1/go.mod h1:cLMZXx8J08idkp5+id62iVftUQV+HlYJ3PIhDfZsjA4=
github.com/ipfs/go-merkledag v0.6.0 h1:oV5WT2321tS4YQVOPgIrWHvJ0lJobRTerU+i9nmUCuA=
github.com/ipfs/go-merkledag v0.6.0/go.mod h1:9HSEwRd5sV+lbykiYP+2NC/3o6MZbKNaa4hfNcH5iH0=
github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg=
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
github.com/ipfs/go-metrics-prometheus v0.0.2/go.mod h1:ELLU99AQQNi+zX6GCGm2lAgnzdSH3u5UVlCdqSXnEks=
Expand Down
3 changes: 2 additions & 1 deletion pkg/chain/message_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/ipfs/go-datastore"
blockstore "github.com/ipfs/go-ipfs-blockstore"
cbor "github.com/ipfs/go-ipld-cbor"
ipld "github.com/ipfs/go-ipld-format"

"github.com/pkg/errors"
cbg "github.com/whyrusleeping/cbor-gen"
Expand Down Expand Up @@ -118,7 +119,7 @@ func (ms *MessageStore) LoadMessage(ctx context.Context, mid cid.Cid) (types.Cha
return m, nil
}

if err != blockstoreutil.ErrNotFound {
if !ipld.IsNotFound(err) {
log.Warnf("GetCMessage: unexpected error getting unsigned message: %s", err)
}

Expand Down
8 changes: 3 additions & 5 deletions pkg/gen/genesis/f00_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (

"github.com/filecoin-project/go-state-types/manifest"

"github.com/filecoin-project/venus/venus-shared/actors/builtin"

"github.com/filecoin-project/venus/venus-shared/actors"
"github.com/filecoin-project/venus/venus-shared/actors/adt"
"github.com/filecoin-project/venus/venus-shared/actors/builtin/system"
Expand Down Expand Up @@ -53,9 +51,9 @@ func SetupSystemActor(ctx context.Context, bs bstore.Blockstore, av actors.Versi
return nil, err
}

actcid, err := builtin.GetSystemActorCodeID(av)
if err != nil {
return nil, err
actcid, found := actors.GetActorCodeID(av, actors.SystemKey)
if !found {
return nil, fmt.Errorf("failed to get system actor code ID for actors version %d", av)
}

act := &types.Actor{
Expand Down
7 changes: 3 additions & 4 deletions pkg/gen/genesis/f01_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/filecoin-project/go-state-types/big"

"github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/venus/venus-shared/actors/builtin"

cbor "github.com/ipfs/go-ipld-cbor"
cbg "github.com/whyrusleeping/cbor-gen"
Expand Down Expand Up @@ -174,9 +173,9 @@ func SetupInitActor(ctx context.Context, bs bstore.Blockstore, netname string, i
return 0, nil, nil, err
}

actcid, err := builtin.GetInitActorCodeID(av)
if err != nil {
return 0, nil, nil, err
actcid, found := actors.GetActorCodeID(av, actors.InitKey)
if !found {
return 0, nil, nil, fmt.Errorf("failed to get init actor code ID for actors version %d", av)
}

act := &types.Actor{
Expand Down
8 changes: 4 additions & 4 deletions pkg/gen/genesis/f02_reward.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package genesis

import (
"context"
"fmt"

"github.com/filecoin-project/venus/pkg/constants"
"github.com/filecoin-project/venus/venus-shared/actors"
"github.com/filecoin-project/venus/venus-shared/actors/adt"
"github.com/filecoin-project/venus/venus-shared/actors/builtin"
"github.com/filecoin-project/venus/venus-shared/actors/builtin/reward"
"github.com/filecoin-project/venus/venus-shared/types"

Expand All @@ -29,9 +29,9 @@ func SetupRewardActor(ctx context.Context, bs bstore.Blockstore, qaPower big.Int
return nil, err
}

actcid, err := builtin.GetRewardActorCodeID(av)
if err != nil {
return nil, err
actcid, found := actors.GetActorCodeID(av, actors.RewardKey)
if !found {
return nil, fmt.Errorf("failed to get reward actor code ID for actors version %d", av)
}

act := &types.Actor{
Expand Down
8 changes: 4 additions & 4 deletions pkg/gen/genesis/f03_cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package genesis

import (
"context"
"fmt"

"github.com/filecoin-project/go-state-types/big"
cbor "github.com/ipfs/go-ipld-cbor"

"github.com/filecoin-project/venus/venus-shared/actors"
"github.com/filecoin-project/venus/venus-shared/actors/adt"
"github.com/filecoin-project/venus/venus-shared/actors/builtin"
"github.com/filecoin-project/venus/venus-shared/actors/builtin/cron"

bstore "github.com/filecoin-project/venus/pkg/util/blockstoreutil"
Expand All @@ -27,9 +27,9 @@ func SetupCronActor(ctx context.Context, bs bstore.Blockstore, av actors.Version
return nil, err
}

actcid, err := builtin.GetCronActorCodeID(av)
if err != nil {
return nil, err
actcid, found := actors.GetActorCodeID(av, actors.CronKey)
if !found {
return nil, fmt.Errorf("failed to get cron actor code ID for actors version %d", av)
}

act := &types.Actor{
Expand Down
8 changes: 4 additions & 4 deletions pkg/gen/genesis/f04_power.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package genesis

import (
"context"
"fmt"

"github.com/filecoin-project/venus/venus-shared/actors"
"github.com/filecoin-project/venus/venus-shared/actors/builtin/power"

"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/venus/venus-shared/actors/builtin"

cbor "github.com/ipfs/go-ipld-cbor"

Expand All @@ -29,9 +29,9 @@ func SetupStoragePowerActor(ctx context.Context, bs bstore.Blockstore, av actors
return nil, err
}

actcid, err := builtin.GetPowerActorCodeID(av)
if err != nil {
return nil, err
actcid, found := actors.GetActorCodeID(av, actors.PowerKey)
if !found {
return nil, fmt.Errorf("failed to get power actor code ID for actors version %d", av)
}

act := &types.Actor{
Expand Down
8 changes: 4 additions & 4 deletions pkg/gen/genesis/f05_market.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package genesis

import (
"context"
"fmt"

"github.com/filecoin-project/go-state-types/big"
cbor "github.com/ipfs/go-ipld-cbor"

"github.com/filecoin-project/venus/venus-shared/actors"
"github.com/filecoin-project/venus/venus-shared/actors/adt"
"github.com/filecoin-project/venus/venus-shared/actors/builtin"
"github.com/filecoin-project/venus/venus-shared/actors/builtin/market"

bstore "github.com/filecoin-project/venus/pkg/util/blockstoreutil"
Expand All @@ -27,9 +27,9 @@ func SetupStorageMarketActor(ctx context.Context, bs bstore.Blockstore, av actor
return nil, err
}

actcid, err := builtin.GetMarketActorCodeID(av)
if err != nil {
return nil, err
actcid, found := actors.GetActorCodeID(av, actors.MarketKey)
if !found {
return nil, fmt.Errorf("failed to get market actor code ID for actors version %d", av)
}

act := &types.Actor{
Expand Down
8 changes: 4 additions & 4 deletions pkg/gen/genesis/f06_vreg.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package genesis

import (
"context"
"fmt"

"github.com/filecoin-project/venus/venus-shared/actors"
"github.com/filecoin-project/venus/venus-shared/actors/builtin"
"github.com/filecoin-project/venus/venus-shared/actors/builtin/verifreg"

"github.com/filecoin-project/go-address"
Expand Down Expand Up @@ -42,9 +42,9 @@ func SetupVerifiedRegistryActor(ctx context.Context, bs bstore.Blockstore, av ac
return nil, err
}

actcid, err := builtin.GetVerifregActorCodeID(av)
if err != nil {
return nil, err
actcid, found := actors.GetActorCodeID(av, actors.VerifregKey)
if !found {
return nil, fmt.Errorf("failed to get verifreg actor code ID for actors version %d", av)
}

act := &types.Actor{
Expand Down
12 changes: 6 additions & 6 deletions pkg/gen/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,9 @@ func makeAccountActor(ctx context.Context, cst cbor.IpldStore, av actors.Version
return nil, err
}

actcid, err := builtin.GetAccountActorCodeID(av)
if err != nil {
return nil, err
actcid, found := actors.GetActorCodeID(av, actors.AccountKey)
if !found {
return nil, fmt.Errorf("failed to get account actor code ID for actors version %d", av)
}

act := &types.Actor{
Expand Down Expand Up @@ -467,9 +467,9 @@ func createMultisigAccount(ctx context.Context, cst cbor.IpldStore, state *tree.
return err
}

actcid, err := builtin.GetMultisigActorCodeID(av)
if err != nil {
return err
actcid, found := actors.GetActorCodeID(av, actors.MultisigKey)
if !found {
return fmt.Errorf("failed to get multisig actor code ID for actors version %d", av)
}

err = state.SetActor(ctx, ida, &types.Actor{
Expand Down
5 changes: 3 additions & 2 deletions pkg/util/blockstoreutil/autobatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

block "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
ipld "github.com/ipfs/go-ipld-format"
)

// autolog is a logger for the autobatching blockstore. It is subscoped from the
Expand Down Expand Up @@ -175,7 +176,7 @@ func (bs *AutobatchBlockstore) Get(ctx context.Context, c cid.Cid) (block.Block,
return blk, nil
}

if err != ErrNotFound {
if !ipld.IsNotFound(err) {
return blk, err
}

Expand Down Expand Up @@ -213,7 +214,7 @@ func (bs *AutobatchBlockstore) Has(ctx context.Context, c cid.Cid) (bool, error)
if err == nil {
return true, nil
}
if err == ErrNotFound {
if ipld.IsNotFound(err) {
return false, nil
}

Expand Down
9 changes: 5 additions & 4 deletions pkg/util/blockstoreutil/badger.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/ipfs/go-datastore/keytransform"
blockstore "github.com/ipfs/go-ipfs-blockstore"
dshelp "github.com/ipfs/go-ipfs-ds-help"
ipld "github.com/ipfs/go-ipld-format"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -189,7 +190,7 @@ func (b *BadgerBlockstore) View(ctx context.Context, cid cid.Cid, fn func([]byte
case nil:
return item.Value(fn)
case badger.ErrKeyNotFound:
return blockstore.ErrNotFound
return ipld.ErrNotFound{Cid: cid}
default:
return fmt.Errorf("failed to view block from badger blockstore: %w", err)
}
Expand Down Expand Up @@ -227,7 +228,7 @@ func (b *BadgerBlockstore) Has(ctx context.Context, cid cid.Cid) (bool, error) {
// Get implements blockstore.Get.
func (b *BadgerBlockstore) Get(ctx context.Context, cid cid.Cid) (blocks.Block, error) {
if !cid.Defined() {
return nil, blockstore.ErrNotFound
return nil, ipld.ErrNotFound{Cid: cid}
}

if atomic.LoadInt64(&b.state) != stateOpen {
Expand All @@ -250,7 +251,7 @@ func (b *BadgerBlockstore) Get(ctx context.Context, cid cid.Cid) (blocks.Block,
val, err = item.ValueCopy(nil)
return err
case badger.ErrKeyNotFound:
return blockstore.ErrNotFound
return ipld.ErrNotFound{Cid: cid}
default:
return fmt.Errorf("failed to get block from badger blockstore: %w", err)
}
Expand Down Expand Up @@ -286,7 +287,7 @@ func (b *BadgerBlockstore) GetSize(ctx context.Context, cid cid.Cid) (int, error
case nil:
size = int(item.ValueSize())
case badger.ErrKeyNotFound:
return blockstore.ErrNotFound
return ipld.ErrNotFound{Cid: cid}
default:
return fmt.Errorf("failed to get block size from badger blockstore: %w", err)
}
Expand Down
Loading

0 comments on commit e10cb44

Please sign in to comment.