From 1d237e042962976591c2fa4d7b5baae8d3282e48 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 20 Feb 2023 10:24:21 +0800 Subject: [PATCH 01/11] feat: EthAPI: Add EthAddressToFilecoinAddress --- app/submodule/eth/dummy.go | 5 +++++ app/submodule/eth/eth_api.go | 4 ++++ venus-shared/api/chain/v1/eth.go | 3 +++ venus-shared/api/chain/v1/method.md | 16 ++++++++++++++++ venus-shared/api/chain/v1/mock/mock_fullnode.go | 15 +++++++++++++++ venus-shared/api/chain/v1/proxy_gen.go | 4 ++++ 6 files changed, 47 insertions(+) diff --git a/app/submodule/eth/dummy.go b/app/submodule/eth/dummy.go index bfe5c1d129..a7aa552681 100644 --- a/app/submodule/eth/dummy.go +++ b/app/submodule/eth/dummy.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" + "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-jsonrpc" v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" "github.com/filecoin-project/venus/venus-shared/types" @@ -31,6 +32,10 @@ func (e *ethAPIDummy) EthAccounts(ctx context.Context) ([]types.EthAddress, erro return nil, ErrModuleDisabled } +func (e *ethAPIDummy) EthAddressToFilecoinAddress(ctx context.Context, ethAddress types.EthAddress) (address.Address, error) { + return address.Undef, ErrModuleDisabled +} + func (e *ethAPIDummy) EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum types.EthUint64) (types.EthUint64, error) { return 0, ErrModuleDisabled } diff --git a/app/submodule/eth/eth_api.go b/app/submodule/eth/eth_api.go index 28b19adac4..d7c5523b85 100644 --- a/app/submodule/eth/eth_api.go +++ b/app/submodule/eth/eth_api.go @@ -139,6 +139,10 @@ func (a *ethAPI) EthAccounts(context.Context) ([]types.EthAddress, error) { return []types.EthAddress{}, nil } +func (a *ethAPI) EthAddressToFilecoinAddress(ctx context.Context, ethAddress types.EthAddress) (address.Address, error) { + return ethAddress.ToFilecoinAddress() +} + func (a *ethAPI) countTipsetMsgs(ctx context.Context, ts *types.TipSet) (int, error) { msgs, err := a.em.chainModule.MessageStore.MessagesForTipset(ts) if err != nil { diff --git a/venus-shared/api/chain/v1/eth.go b/venus-shared/api/chain/v1/eth.go index e8f9a34d3f..eff0dc30f8 100644 --- a/venus-shared/api/chain/v1/eth.go +++ b/venus-shared/api/chain/v1/eth.go @@ -3,6 +3,7 @@ package v1 import ( "context" + "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-jsonrpc" "github.com/filecoin-project/venus/venus-shared/types" "github.com/ipfs/go-cid" @@ -18,6 +19,8 @@ type IETH interface { // // EthAccounts will always return [] since we don't expect Lotus to manage private keys EthAccounts(ctx context.Context) ([]types.EthAddress, error) //perm:read + // EthAddressToFilecoinAddress converts an EthAddress into an f410 Filecoin Address + EthAddressToFilecoinAddress(ctx context.Context, ethAddress types.EthAddress) (address.Address, error) //perm:read // EthBlockNumber returns the height of the latest (heaviest) TipSet EthBlockNumber(ctx context.Context) (types.EthUint64, error) //perm:read // EthGetBlockTransactionCountByNumber returns the number of messages in the TipSet diff --git a/venus-shared/api/chain/v1/method.md b/venus-shared/api/chain/v1/method.md index fcc9748390..e64c585800 100644 --- a/venus-shared/api/chain/v1/method.md +++ b/venus-shared/api/chain/v1/method.md @@ -65,6 +65,7 @@ curl http://:/rpc/v1 -X POST -H "Content-Type: application/json" -H " * [Version](#version) * [ETH](#eth) * [EthAccounts](#ethaccounts) + * [EthAddressToFilecoinAddress](#ethaddresstofilecoinaddress) * [EthBlockNumber](#ethblocknumber) * [EthCall](#ethcall) * [EthChainId](#ethchainid) @@ -2116,6 +2117,21 @@ Response: ] ``` +### EthAddressToFilecoinAddress +EthAddressToFilecoinAddress converts an EthAddress into an f410 Filecoin Address + + +Perms: read + +Inputs: +```json +[ + "0x0707070707070707070707070707070707070707" +] +``` + +Response: `"f01234"` + ### EthBlockNumber EthBlockNumber returns the height of the latest (heaviest) TipSet diff --git a/venus-shared/api/chain/v1/mock/mock_fullnode.go b/venus-shared/api/chain/v1/mock/mock_fullnode.go index 17cdd49f48..0cecd8d1a2 100644 --- a/venus-shared/api/chain/v1/mock/mock_fullnode.go +++ b/venus-shared/api/chain/v1/mock/mock_fullnode.go @@ -470,6 +470,21 @@ func (mr *MockFullNodeMockRecorder) EthAccounts(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EthAccounts", reflect.TypeOf((*MockFullNode)(nil).EthAccounts), arg0) } +// EthAddressToFilecoinAddress mocks base method. +func (m *MockFullNode) EthAddressToFilecoinAddress(arg0 context.Context, arg1 types.EthAddress) (address.Address, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EthAddressToFilecoinAddress", arg0, arg1) + ret0, _ := ret[0].(address.Address) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// EthAddressToFilecoinAddress indicates an expected call of EthAddressToFilecoinAddress. +func (mr *MockFullNodeMockRecorder) EthAddressToFilecoinAddress(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EthAddressToFilecoinAddress", reflect.TypeOf((*MockFullNode)(nil).EthAddressToFilecoinAddress), arg0, arg1) +} + // EthBlockNumber mocks base method. func (m *MockFullNode) EthBlockNumber(arg0 context.Context) (types.EthUint64, error) { m.ctrl.T.Helper() diff --git a/venus-shared/api/chain/v1/proxy_gen.go b/venus-shared/api/chain/v1/proxy_gen.go index b7dcb0f73f..75856e2e25 100644 --- a/venus-shared/api/chain/v1/proxy_gen.go +++ b/venus-shared/api/chain/v1/proxy_gen.go @@ -839,6 +839,7 @@ func (s *ICommonStruct) Version(p0 context.Context) (types.Version, error) { type IETHStruct struct { Internal struct { EthAccounts func(ctx context.Context) ([]types.EthAddress, error) `perm:"read"` + EthAddressToFilecoinAddress func(ctx context.Context, ethAddress types.EthAddress) (address.Address, error) `perm:"read"` EthBlockNumber func(ctx context.Context) (types.EthUint64, error) `perm:"read"` EthCall func(ctx context.Context, tx types.EthCall, blkParam string) (types.EthBytes, error) `perm:"read"` EthChainId func(ctx context.Context) (types.EthUint64, error) `perm:"read"` @@ -871,6 +872,9 @@ type IETHStruct struct { func (s *IETHStruct) EthAccounts(p0 context.Context) ([]types.EthAddress, error) { return s.Internal.EthAccounts(p0) } +func (s *IETHStruct) EthAddressToFilecoinAddress(p0 context.Context, p1 types.EthAddress) (address.Address, error) { + return s.Internal.EthAddressToFilecoinAddress(p0, p1) +} func (s *IETHStruct) EthBlockNumber(p0 context.Context) (types.EthUint64, error) { return s.Internal.EthBlockNumber(p0) } From c28b98e8cdc1e9a1571d94678227bca33fbd1b57 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 20 Feb 2023 10:30:37 +0800 Subject: [PATCH 02/11] fix: eth: correctly decode EthGetStorageAt output --- app/submodule/eth/eth_api.go | 38 +++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/app/submodule/eth/eth_api.go b/app/submodule/eth/eth_api.go index d7c5523b85..e0aded07c3 100644 --- a/app/submodule/eth/eth_api.go +++ b/app/submodule/eth/eth_api.go @@ -464,13 +464,18 @@ func (a *ethAPI) EthGetCode(ctx context.Context, ethAddr types.EthAddress, blkPa } func (a *ethAPI) EthGetStorageAt(ctx context.Context, ethAddr types.EthAddress, position types.EthBytes, blkParam string) (types.EthBytes, error) { + ts, err := a.parseBlkParam(ctx, blkParam) + if err != nil { + return nil, fmt.Errorf("cannot parse block param: %s", blkParam) + } + l := len(position) if l > 32 { return nil, fmt.Errorf("supplied storage key is too long") } // pad with zero bytes if smaller than 32 bytes - position = append(make([]byte, 32-l), position...) + position = append(make([]byte, 32-l, 32), position...) to, err := ethAddr.ToFilecoinAddress() if err != nil { @@ -483,6 +488,18 @@ func (a *ethAPI) EthGetStorageAt(ctx context.Context, ethAddr types.EthAddress, return nil, fmt.Errorf("failed to construct system sender address: %w", err) } + actor, err := a.em.chainModule.Stmgr.GetActorAt(ctx, to, ts) + if err != nil { + if errors.Is(err, types.ErrActorNotFound) { + return types.EthBytes(make([]byte, 32)), nil + } + return nil, fmt.Errorf("failed to lookup contract %s: %w", ethAddr, err) + } + + if !builtinactors.IsEvmActor(actor.Code) { + return types.EthBytes(make([]byte, 32)), nil + } + params, err := actors.SerializeParams(&evm.GetStorageAtParams{ StorageKey: *(*[32]byte)(position), }) @@ -501,11 +518,6 @@ func (a *ethAPI) EthGetStorageAt(ctx context.Context, ethAddr types.EthAddress, GasPremium: big.Zero(), } - ts, err := a.chain.ChainHead(ctx) - if err != nil { - return nil, fmt.Errorf("failed to got head %v", err) - } - // Try calling until we find a height with no migration. var res *types.InvocResult for { @@ -527,7 +539,19 @@ func (a *ethAPI) EthGetStorageAt(ctx context.Context, ethAddr types.EthAddress, return nil, fmt.Errorf("no message receipt") } - return res.MsgRct.Return, nil + if res.MsgRct.ExitCode.IsError() { + return nil, fmt.Errorf("failed to lookup storage slot: %s", res.Error) + } + + var ret abi.CborBytes + if err := ret.UnmarshalCBOR(bytes.NewReader(res.MsgRct.Return)); err != nil { + return nil, fmt.Errorf("failed to unmarshal storage slot: %w", err) + } + + // pad with zero bytes if smaller than 32 bytes + ret = append(make([]byte, 32-len(ret), 32), ret...) + + return types.EthBytes(ret), nil } func (a *ethAPI) EthGetBalance(ctx context.Context, address types.EthAddress, blkParam string) (types.EthBigInt, error) { From 19ef5b4f774dadd7ae9e827cba1bdb55bab38f67 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 20 Feb 2023 10:47:58 +0800 Subject: [PATCH 03/11] feat: eth: parse revert data --- app/submodule/eth/eth_api.go | 84 +++++++++++++++++++++++++++++++- venus-shared/actors/types/eth.go | 32 +++++++++--- venus-shared/types/eth.go | 1 + 3 files changed, 108 insertions(+), 9 deletions(-) diff --git a/app/submodule/eth/eth_api.go b/app/submodule/eth/eth_api.go index e0aded07c3..7e916bb0fa 100644 --- a/app/submodule/eth/eth_api.go +++ b/app/submodule/eth/eth_api.go @@ -834,7 +834,8 @@ func (a *ethAPI) applyMessage(ctx context.Context, msg *types.Message, tsk types return nil, fmt.Errorf("no message receipt") } if res.MsgRct.ExitCode.IsError() { - return nil, fmt.Errorf("message execution failed: exit %s, msg receipt return: %s, reason: %v", res.MsgRct.ExitCode, res.MsgRct.Return, res.Error) + reason := parseEthRevert(res.MsgRct.Return) + return nil, fmt.Errorf("message execution failed: exit %s, revert reason: %s, vm error: %s", res.MsgRct.ExitCode, reason, res.Error) } return res, nil @@ -995,7 +996,7 @@ func (a *ethAPI) EthCall(ctx context.Context, tx types.EthCall, blkParam string) invokeResult, err := a.applyMessage(ctx, msg, ts.Key()) if err != nil { - return nil, fmt.Errorf("failed to apply message: %w", err) + return nil, err } if msg.To == builtintypes.EthereumAddressManagerActorAddr { @@ -1507,6 +1508,85 @@ func parseEthTopics(topics types.EthTopicSpec) (map[string][][]byte, error) { return keys, nil } +const errorFunctionSelector = "\x08\xc3\x79\xa0" // Error(string) +const panicFunctionSelector = "\x4e\x48\x7b\x71" // Panic(uint256) +// Eth ABI (solidity) panic codes. +var panicErrorCodes map[uint64]string = map[uint64]string{ + 0x00: "Panic()", + 0x01: "Assert()", + 0x11: "ArithmeticOverflow()", + 0x12: "DivideByZero()", + 0x21: "InvalidEnumVariant()", + 0x22: "InvalidStorageArray()", + 0x31: "PopEmptyArray()", + 0x32: "ArrayIndexOutOfBounds()", + 0x41: "OutOfMemory()", + 0x51: "CalledUninitializedFunction()", +} + +// Parse an ABI encoded revert reason. This reason should be encoded as if it were the parameters to +// an `Error(string)` function call. +// +// See https://docs.soliditylang.org/en/latest/control-structures.html#panic-via-assert-and-error-via-require +func parseEthRevert(ret []byte) string { + if len(ret) == 0 { + return "none" + } + var cbytes abi.CborBytes + if err := cbytes.UnmarshalCBOR(bytes.NewReader(ret)); err != nil { + return "ERROR: revert reason is not cbor encoded bytes" + } + if len(cbytes) == 0 { + return "none" + } + // If it's not long enough to contain an ABI encoded response, return immediately. + if len(cbytes) < 4+32 { + return types.EthBytes(cbytes).String() + } + switch string(cbytes[:4]) { + case panicFunctionSelector: + cbytes := cbytes[4 : 4+32] + // Read the and check the code. + code, err := types.EthUint64FromBytes(cbytes) + if err != nil { + // If it's too big, just return the raw value. + codeInt := big.PositiveFromUnsignedBytes(cbytes) + return fmt.Sprintf("Panic(%s)", types.EthBigInt(codeInt).String()) + } + if s, ok := panicErrorCodes[uint64(code)]; ok { + return s + } + return fmt.Sprintf("Panic(0x%x)", code) + case errorFunctionSelector: + cbytes := cbytes[4:] + cbytesLen := types.EthUint64(len(cbytes)) + // Read the and check the offset. + offset, err := types.EthUint64FromBytes(cbytes[:32]) + if err != nil { + break + } + if cbytesLen < offset { + break + } + + // Read and check the length. + if cbytesLen-offset < 32 { + break + } + start := offset + 32 + length, err := types.EthUint64FromBytes(cbytes[offset : offset+32]) + if err != nil { + break + } + if cbytesLen-start < length { + break + } + // Slice the error message. + return fmt.Sprintf("Error(%s)", cbytes[start:start+length]) + } + return types.EthBytes(cbytes).String() +} + func calculateRewardsAndGasUsed(rewardPercentiles []float64, txGasRewards gasRewardSorter) ([]types.EthBigInt, uint64) { var totalGasUsed uint64 for _, tx := range txGasRewards { diff --git a/venus-shared/actors/types/eth.go b/venus-shared/actors/types/eth.go index a1324f2e73..c7c9c3bf53 100644 --- a/venus-shared/actors/types/eth.go +++ b/venus-shared/actors/types/eth.go @@ -70,6 +70,18 @@ func EthUint64FromHex(s string) (EthUint64, error) { return EthUint64(parsedInt), nil } +// Parse a uint64 from big-endian encoded bytes. +func EthUint64FromBytes(b []byte) (EthUint64, error) { + if len(b) != 32 { + return 0, fmt.Errorf("eth int must be 32 bytes long") + } + var zeros [32 - 8]byte + if !bytes.Equal(b[:len(zeros)], zeros[:]) { + return 0, fmt.Errorf("eth int overflows 64 bits") + } + return EthUint64(binary.BigEndian.Uint64(b[len(zeros):])), nil +} + func (e EthUint64) Hex() string { if e == 0 { return "0x0" @@ -84,11 +96,15 @@ var ( EthBigIntZero = EthBigInt{Int: big.Zero().Int} ) -func (e EthBigInt) MarshalJSON() ([]byte, error) { +func (e EthBigInt) String() string { if e.Int == nil || e.Int.BitLen() == 0 { - return json.Marshal("0x0") + return "0x0" } - return json.Marshal(fmt.Sprintf("0x%x", e.Int)) + return fmt.Sprintf("0x%x", e.Int) +} + +func (e EthBigInt) MarshalJSON() ([]byte, error) { + return json.Marshal(e.String()) } func (e *EthBigInt) UnmarshalJSON(b []byte) error { @@ -112,13 +128,15 @@ func (e *EthBigInt) UnmarshalJSON(b []byte) error { // EthBytes represent arbitrary bytes. A nil or empty slice serializes to "0x". type EthBytes []byte -func (e EthBytes) MarshalJSON() ([]byte, error) { +func (e EthBytes) String() string { if len(e) == 0 { - return json.Marshal("0x") + return "0x" } - s := hex.EncodeToString(e) + return "0x" + hex.EncodeToString(e) +} - return json.Marshal("0x" + s) +func (e EthBytes) MarshalJSON() ([]byte, error) { + return json.Marshal(e.String()) } func (e *EthBytes) UnmarshalJSON(b []byte) error { diff --git a/venus-shared/types/eth.go b/venus-shared/types/eth.go index 5e96a9a238..144c117069 100644 --- a/venus-shared/types/eth.go +++ b/venus-shared/types/eth.go @@ -57,6 +57,7 @@ var ( EthBloomSet = types.EthBloomSet EthHashFromCid = types.EthHashFromCid EthHashFromTxBytes = types.EthHashFromTxBytes + EthUint64FromBytes = types.EthUint64FromBytes EthUint64FromHex = types.EthUint64FromHex GetContractEthAddressFromCode = types.GetContractEthAddressFromCode NewEthBlock = types.NewEthBlock From fecb291a5f57425eb9b2be8e5cf83341da452ba7 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 20 Feb 2023 10:55:16 +0800 Subject: [PATCH 04/11] feat: eth: return revert data on failed gas estimation --- app/submodule/eth/eth_api.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/submodule/eth/eth_api.go b/app/submodule/eth/eth_api.go index 7e916bb0fa..25cf0a5c9c 100644 --- a/app/submodule/eth/eth_api.go +++ b/app/submodule/eth/eth_api.go @@ -854,12 +854,25 @@ func (a *ethAPI) EthEstimateGas(ctx context.Context, tx types.EthCall) (types.Et if err != nil { return types.EthUint64(0), err } - msg, err = a.mpool.GasEstimateMessageGas(ctx, msg, nil, ts.Key()) + gassedMsg, err := a.mpool.GasEstimateMessageGas(ctx, msg, nil, ts.Key()) if err != nil { return types.EthUint64(0), fmt.Errorf("failed to estimate gas: %w", err) } + if err != nil { + // On failure, GasEstimateMessageGas doesn't actually return the invocation result, + // it just returns an error. That means we can't get the revert reason. + // + // So we re-execute the message with EthCall (well, applyMessage which contains the + // guts of EthCall). This will give us an ethereum specific error with revert + // information. + msg.GasLimit = constants.BlockGasLimit + if _, err2 := a.applyMessage(ctx, msg, ts.Key()); err2 != nil { + err = err2 + } + return types.EthUint64(0), fmt.Errorf("failed to estimate gas: %w", err) + } - expectedGas, err := ethGasSearch(ctx, a.em.chainModule.Stmgr, a.em.mpoolModule.MPool, msg, ts) + expectedGas, err := ethGasSearch(ctx, a.em.chainModule.Stmgr, a.em.mpoolModule.MPool, gassedMsg, ts) if err != nil { log.Errorw("expected gas", "err", err) } From 8e0343b9e78d3200c92812bae5d8301ff5a968f5 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 20 Feb 2023 11:37:15 +0800 Subject: [PATCH 05/11] fix: pack: support network name overrides in bundle git tags --- venus-devtool/bundle-gen/main.go | 52 ++++++++++ venus-shared/actors/builtin_actors.go | 9 +- venus-shared/actors/builtin_actors_gen.go | 110 +++++++++++++--------- 3 files changed, 123 insertions(+), 48 deletions(-) diff --git a/venus-devtool/bundle-gen/main.go b/venus-devtool/bundle-gen/main.go index 8742f8cdb6..7150aedb90 100644 --- a/venus-devtool/bundle-gen/main.go +++ b/venus-devtool/bundle-gen/main.go @@ -4,6 +4,8 @@ import ( "bytes" "fmt" "os" + "strconv" + "strings" "text/template" "github.com/urfave/cli/v2" @@ -12,19 +14,57 @@ import ( "github.com/filecoin-project/venus/venus-shared/actors" ) +func splitOverride(override string) (string, string) { + x := strings.Split(override, "=") + return x[0], x[1] +} + func main() { app := &cli.App{ Name: "bundle-gen", Usage: "generate builtin actors for venus-shared", Flags: []cli.Flag{ &cli.StringFlag{Name: "dst"}, + &cli.StringFlag{Name: "version"}, + &cli.StringFlag{Name: "release"}, + &cli.StringSliceFlag{Name: "release_overrides"}, }, Action: func(ctx *cli.Context) error { + // read metadata from the embedded bundle, includes all info except git tags metadata, err := actors.ReadEmbeddedBuiltinActorsMetadata() if err != nil { return err } + // IF args have been provided, extract git tag info from them, otherwise + // rely on previously embedded metadata for git tags. + if ver := ctx.String("version"); len(ver) != 0 { + // overrides are in the format network_name=override + gitTag := ctx.String("release") + packedActorsVersion, err := strconv.Atoi(ver[1:]) + if err != nil { + return err + } + + overrides := map[string]string{} + for _, override := range ctx.StringSlice("release_overrides") { + k, v := splitOverride(override) + overrides[k] = v + } + for _, m := range metadata { + if int(m.Version) == packedActorsVersion { + override, ok := overrides[m.Network] + if ok { + m.BundleGitTag = override + } else { + m.BundleGitTag = gitTag + } + } else { + m.BundleGitTag = getOldGitTagFromEmbeddedMetadata(m) + } + } + } + buf := &bytes.Buffer{} if err := tmpl.Execute(buf, metadata); err != nil { return err @@ -46,6 +86,17 @@ func main() { } } +func getOldGitTagFromEmbeddedMetadata(m *actors.BuiltinActorsMetadata) string { + for _, v := range actors.EmbeddedBuiltinActorsMetadata { + // if we agree on the manifestCid for the previously embedded metadata, use the previously set tag + if m.Version == v.Version && m.Network == v.Network && m.ManifestCid == v.ManifestCid { + return m.BundleGitTag + } + } + + return "" +} + var tmpl *template.Template = template.Must(template.New("actor-metadata").Parse(` // WARNING: This file has automatically been generated package actors @@ -56,6 +107,7 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet {{- range . }} { Network: {{printf "%q" .Network}}, Version: {{.Version}}, + {{if .BundleGitTag}} BundleGitTag: {{printf "%q" .BundleGitTag}}, {{end}} ManifestCid: mustParseCid({{printf "%q" .ManifestCid}}), Actors: map[string]cid.Cid { {{- range $name, $cid := .Actors }} diff --git a/venus-shared/actors/builtin_actors.go b/venus-shared/actors/builtin_actors.go index 067a84d222..acc0827153 100644 --- a/venus-shared/actors/builtin_actors.go +++ b/venus-shared/actors/builtin_actors.go @@ -138,10 +138,11 @@ func loadManifests(netw string) error { } type BuiltinActorsMetadata struct { // nolint - Network string - Version actorstypes.Version - ManifestCid cid.Cid - Actors map[string]cid.Cid + Network string + Version actorstypes.Version + ManifestCid cid.Cid + Actors map[string]cid.Cid + BundleGitTag string } // ReadEmbeddedBuiltinActorsMetadata reads the metadata from the embedded built-in actor bundles. diff --git a/venus-shared/actors/builtin_actors_gen.go b/venus-shared/actors/builtin_actors_gen.go index 3fea5c7bac..b01d7b7585 100644 --- a/venus-shared/actors/builtin_actors_gen.go +++ b/venus-shared/actors/builtin_actors_gen.go @@ -6,8 +6,9 @@ import ( ) var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMetadata{{ - Network: "butterflynet", - Version: 8, + Network: "butterflynet", + Version: 8, + ManifestCid: mustParseCid("bafy2bzaceba5qgs4z3imhlxwds5vamahngatvuuglbv5yl3ftfiosj6ud5chs"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacebd5zetyjtragjwrv2nqktct6u2pmsi4eifbanovxohx3a7lszjxi"), @@ -28,8 +29,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacebu4joy25gneu2qv3qfm3ktakzalndjrbhekeqrqk3zhotv6nyy2g"), }, }, { - Network: "butterflynet", - Version: 9, + Network: "butterflynet", + Version: 9, + ManifestCid: mustParseCid("bafy2bzacec35by4erhcdgcsgzp7yb3j57utydlxxfc73m3k5pep67ehvvyv6i"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzaceajsdln7v4chxqoukiw7lxw6aexg5qdsaex2hgelz2sbu24iblhzg"), @@ -46,8 +48,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacecjkesz766626ab4svnzpq3jfs26a75vfktlfaku5fjdao2eyiqyq"), }, }, { - Network: "butterflynet", - Version: 10, + Network: "butterflynet", + Version: 10, + ManifestCid: mustParseCid("bafy2bzacec4tgdtsrgbdywc5nzf5ekiw5zuefrasiahb4n5yqwcrwjzcdp4nk"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzaceae6holtld4caox2xood5rpcjotrxj7lnfxvfmhivb3s2ddyj22qw"), @@ -68,8 +71,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzaceaeqg3nqpjrgklq6nli6hz73s76hp4bwn6jsa64y22dj3csvmcl32"), }, }, { - Network: "calibrationnet", - Version: 8, + Network: "calibrationnet", + Version: 8, + ManifestCid: mustParseCid("bafy2bzacedrdn6z3z7xz7lx4wll3tlgktirhllzqxb766dxpaqp3ukxsjfsba"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacecruossn66xqbeutqx5r4k2kjzgd43frmwd4qkw6haez44ubvvpxo"), @@ -85,8 +89,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzaceaihibfu625lbtzdp3tcftscshrmbgghgrc7kzqhxn4455pycpdkm"), }, }, { - Network: "calibrationnet", - Version: 9, + Network: "calibrationnet", + Version: 9, + ManifestCid: mustParseCid("bafy2bzacedbedgynklc4dgpyxippkxmba2mgtw7ecntoneclsvvl4klqwuyyy"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzaceavfgpiw6whqigmskk74z4blm22nwjfnzxb4unlqz2e4wg3c5ujpw"), @@ -103,8 +108,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacebh7dj6j7yi5vadh7lgqjtq42qi2uq4n6zy2g5vjeathacwn2tscu"), }, }, { - Network: "calibrationnet", - Version: 10, + Network: "calibrationnet", + Version: 10, + ManifestCid: mustParseCid("bafy2bzaced25ta3j6ygs34roprilbtb3f6mxifyfnm7z7ndquaruxzdq3y7lo"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacebhfuz3sv7duvk653544xsxhdn4lsmy7ol7k6gdgancyctvmd7lnq"), @@ -125,8 +131,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacec67wuchq64k7kgrujguukjvdlsl24pgighqdx5vgjhyk6bycrwnc"), }, }, { - Network: "caterpillarnet", - Version: 8, + Network: "caterpillarnet", + Version: 8, + ManifestCid: mustParseCid("bafy2bzacebsdvrxmdajiyxq2mxxxppvg2zwvqjzz3pgbsxwh6pvdcjofpmnxw"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacedfms6w3ghqtljpgsfuiqa6ztjx7kcuin6myjezj6rypj3zjbqms6"), @@ -147,8 +154,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacebzndvdqtdck2y35smcxezldgh6nm6rbkj3g3fmiknsgg2uah235y"), }, }, { - Network: "caterpillarnet", - Version: 9, + Network: "caterpillarnet", + Version: 9, + ManifestCid: mustParseCid("bafy2bzacebsdvrxmdajiyxq2mxxxppvg2zwvqjzz3pgbsxwh6pvdcjofpmnxw"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacedfms6w3ghqtljpgsfuiqa6ztjx7kcuin6myjezj6rypj3zjbqms6"), @@ -169,8 +177,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacebzndvdqtdck2y35smcxezldgh6nm6rbkj3g3fmiknsgg2uah235y"), }, }, { - Network: "caterpillarnet", - Version: 10, + Network: "caterpillarnet", + Version: 10, + ManifestCid: mustParseCid("bafy2bzacedn6med544h6r7frzvyq5cvd7dqgnwgpmzgf42d4agoysx6tf475i"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzaceaysjus6ldo45qnedaopwctamtvvk4ga2l4dh7dmdtltsfin4puuk"), @@ -191,8 +200,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzaceae5zbc2h6gpyu6uzsvelvww53p5mujq2dvs3zi74w6mvnigwc3va"), }, }, { - Network: "devnet", - Version: 8, + Network: "devnet", + Version: 8, + ManifestCid: mustParseCid("bafy2bzacedq7tuibavyqxzkq4uybjj7ly22eu42mjkoehwn5d47xfunmtjm4k"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacea4tlgnp7m6tlldpz3termlwxlnyq24nwd4zdzv4r6nsjuaktuuzc"), @@ -208,8 +218,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzaceaajgtglewgitshgdi2nzrvq7eihjtyqj5yiamesqun2hujl3xev2"), }, }, { - Network: "devnet", - Version: 9, + Network: "devnet", + Version: 9, + ManifestCid: mustParseCid("bafy2bzacedozk3jh2j4nobqotkbofodq4chbrabioxbfrygpldgoxs3zwgggk"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzaced5llqnqqhypolyuogz3h2wjomugqkrhyhocvly3aoib4c5xiush6"), @@ -226,8 +237,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacednorhcy446agy7ecpmfms2u4aoa3mj2eqomffuoerbik5yavrxyi"), }, }, { - Network: "devnet", - Version: 10, + Network: "devnet", + Version: 10, + ManifestCid: mustParseCid("bafy2bzaceco52tjbexpijsegolhdkhlziflum4bl27hcjrpnny273t3lsa6tc"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacec6mdvynyu4cxb53tcdbkcu7w7jzxduxqqadi2y2rx2tsm42627tk"), @@ -248,8 +260,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzaced27273xjvuyhxlne2kmbrbtupcxxpdchqbkiyr3dcqoijaok2k7e"), }, }, { - Network: "hyperspace", - Version: 8, + Network: "hyperspace", + Version: 8, + ManifestCid: mustParseCid("bafy2bzacedvffumcvf72f2btjqvece3kpcdorxq5tq76iwcmqbzvsiu526cqm"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacecim7uybic2qprbkjhowg7qkniv4zywj5h5g4u4ss72urco2akzuo"), @@ -270,8 +283,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacea7rfkjrixaidksnmjehglmavyt56nyeu3sfxu2e3dcpf62oab6tw"), }, }, { - Network: "mainnet", - Version: 8, + Network: "mainnet", + Version: 8, + ManifestCid: mustParseCid("bafy2bzacebogjbpiemi7npzxchgcjjki3tfxon4ims55obfyfleqntteljsea"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacedudbf7fc5va57t3tmo63snmt3en4iaidv4vo3qlyacbxaa6hlx6y"), @@ -287,8 +301,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzaceb3zbkjz3auizmoln2unmxep7dyfcmsre64vnqfhdyh7rkqfoxlw4"), }, }, { - Network: "mainnet", - Version: 9, + Network: "mainnet", + Version: 9, + ManifestCid: mustParseCid("bafy2bzaceb6j6666h36xnhksu3ww4kxb6e25niayfgkdnifaqi6m6ooc66i6i"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacect2p7urje3pylrrrjy3tngn6yaih4gtzauuatf2jllk3ksgfiw2y"), @@ -305,8 +320,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacecf3yodlyudzukumehbuabgqljyhjt5ifiv4vetcfohnvsxzynwga"), }, }, { - Network: "mainnet", - Version: 10, + Network: "mainnet", + Version: 10, + ManifestCid: mustParseCid("bafy2bzacecyg4biu2uccoekdzen4qxf4qt24deyx6j5rpwfys7qp6lixvzsxo"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacect72amqxedrtjymuq5lfrskk2itnniyfa5gdvqp5sjoeeb33oi2e"), @@ -327,8 +343,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzaceanpda37bvefmzfemikyokwnspzxdxqz5kriaqex4hpevdhphu6sq"), }, }, { - Network: "testing", - Version: 8, + Network: "testing", + Version: 8, + ManifestCid: mustParseCid("bafy2bzacedkjpqx27wgsvfxzuxfvixuxtbpt2y6yo6igcasez6gqiowron776"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacebmfbtdj5vruje5auacrhhprcjdd6uclhukb7je7t2f6ozfcgqlu2"), @@ -344,8 +361,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacectzxvtoselhnzsair5nv6k5vokvegnht6z2lfee4p3xexo4kg4m6"), }, }, { - Network: "testing", - Version: 9, + Network: "testing", + Version: 9, + ManifestCid: mustParseCid("bafy2bzacecnnrmekqw2xvud46g3vo6x26cogh3ydgljqajlxqxzzbuxsjlwjm"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzaceaiebfiuu76zoywzltelio2zuvsavirka27ur6kspn7scvcl5cuiy"), @@ -362,8 +380,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzaceatmqip2o3ausbntvdhj7yemu6hb3b5yqv6hm42gylbbmz7geocpm"), }, }, { - Network: "testing", - Version: 10, + Network: "testing", + Version: 10, + ManifestCid: mustParseCid("bafy2bzacedjgfy7dmbd4i3io5r47eokprndhucdvwaxqyw4ijhhtldhewojk4"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacedhme5nkedu2x3vwwfakrs4zwqrbdcb7epevety7peisq4bcahyke"), @@ -384,8 +403,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacecwzauoon6sngmiiv4ppoxshirgzyfssfircvampxjkv673vlim6m"), }, }, { - Network: "testing-fake-proofs", - Version: 8, + Network: "testing-fake-proofs", + Version: 8, + ManifestCid: mustParseCid("bafy2bzacecd3lb5v6tzjylnhnrhexslssyaozy6hogzgpkhztoe76exbrgrug"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacebmfbtdj5vruje5auacrhhprcjdd6uclhukb7je7t2f6ozfcgqlu2"), @@ -401,8 +421,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzacectzxvtoselhnzsair5nv6k5vokvegnht6z2lfee4p3xexo4kg4m6"), }, }, { - Network: "testing-fake-proofs", - Version: 9, + Network: "testing-fake-proofs", + Version: 9, + ManifestCid: mustParseCid("bafy2bzacecql2gj2tri4fnbznmldue73qzt6zszvugw4exd64mwb52zrhv7k2"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzaceaiebfiuu76zoywzltelio2zuvsavirka27ur6kspn7scvcl5cuiy"), @@ -419,8 +440,9 @@ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMet "verifiedregistry": mustParseCid("bafk2bzaceatmqip2o3ausbntvdhj7yemu6hb3b5yqv6hm42gylbbmz7geocpm"), }, }, { - Network: "testing-fake-proofs", - Version: 10, + Network: "testing-fake-proofs", + Version: 10, + ManifestCid: mustParseCid("bafy2bzaceblvi7d3yosakpuux27gqzr34gcjr6a2f6uzbyagmwybgfsk4xeu2"), Actors: map[string]cid.Cid{ "account": mustParseCid("bafk2bzacedhme5nkedu2x3vwwfakrs4zwqrbdcb7epevety7peisq4bcahyke"), From 43e39ed691e01a44f6e06a1ea0ee38798e20dd25 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 20 Feb 2023 14:08:52 +0800 Subject: [PATCH 06/11] chore: deps: bump go-libipfs to v0.4.1 --- app/submodule/blockstore/blockstore_api.go | 2 +- app/submodule/eth/eth_api.go | 2 +- app/submodule/network/network_submodule.go | 2 +- go.mod | 9 +++++---- go.sum | 16 +++++++++------- pkg/chain/message_store.go | 2 +- pkg/chain/store.go | 2 +- pkg/chain/testing.go | 2 +- pkg/chain/utils.go | 2 +- pkg/fork/fork.go | 2 +- pkg/gen/genesis/genblock.go | 2 +- pkg/vm/vmcontext/gas_charge_ipld.go | 2 +- venus-component/go.mod | 2 +- venus-component/go.sum | 8 ++++---- venus-devtool/api-gen/example.go | 2 +- venus-devtool/go.mod | 3 ++- venus-devtool/go.sum | 12 +++++++----- venus-shared/actors/types/message.go | 2 +- venus-shared/actors/types/signed_message.go | 2 +- venus-shared/api/chain/v0/blockstore.go | 2 +- venus-shared/api/chain/v0/mock/mock_fullnode.go | 2 +- venus-shared/api/chain/v0/proxy_gen.go | 2 +- venus-shared/api/chain/v1/blockstore.go | 2 +- venus-shared/api/chain/v1/mock/mock_fullnode.go | 2 +- venus-shared/api/chain/v1/proxy_gen.go | 2 +- venus-shared/blockstore/apibstore.go | 2 +- venus-shared/blockstore/autobatch.go | 2 +- venus-shared/blockstore/autobatch_test.go | 2 +- venus-shared/blockstore/badger.go | 2 +- venus-shared/blockstore/buf_bstore.go | 2 +- venus-shared/blockstore/copy.go | 2 +- venus-shared/blockstore/mem.go | 2 +- venus-shared/blockstore/mem_test.go | 2 +- venus-shared/blockstore/net.go | 2 +- venus-shared/blockstore/net_serve.go | 2 +- venus-shared/blockstore/net_test.go | 2 +- venus-shared/blockstore/syncstore.go | 2 +- venus-shared/blockstore/view_blockstore.go | 2 +- venus-shared/types/block_header.go | 2 +- venus-shared/types/message_root.go | 2 +- venus-shared/types/message_test.go | 2 +- venus-shared/types/tipset_key.go | 2 +- 42 files changed, 64 insertions(+), 58 deletions(-) diff --git a/app/submodule/blockstore/blockstore_api.go b/app/submodule/blockstore/blockstore_api.go index 5982c91162..d2b142b002 100644 --- a/app/submodule/blockstore/blockstore_api.go +++ b/app/submodule/blockstore/blockstore_api.go @@ -7,11 +7,11 @@ import ( "github.com/filecoin-project/venus/venus-shared/types" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-blockservice" "github.com/ipfs/go-cid" offline "github.com/ipfs/go-ipfs-exchange-offline" ipld "github.com/ipfs/go-ipld-format" + blocks "github.com/ipfs/go-libipfs/blocks" "github.com/ipfs/go-merkledag" v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1" diff --git a/app/submodule/eth/eth_api.go b/app/submodule/eth/eth_api.go index 25cf0a5c9c..d655663d6d 100644 --- a/app/submodule/eth/eth_api.go +++ b/app/submodule/eth/eth_api.go @@ -1524,7 +1524,7 @@ func parseEthTopics(topics types.EthTopicSpec) (map[string][][]byte, error) { const errorFunctionSelector = "\x08\xc3\x79\xa0" // Error(string) const panicFunctionSelector = "\x4e\x48\x7b\x71" // Panic(uint256) // Eth ABI (solidity) panic codes. -var panicErrorCodes map[uint64]string = map[uint64]string{ +var panicErrorCodes = map[uint64]string{ 0x00: "Panic()", 0x01: "Assert()", 0x11: "ArithmeticOverflow()", diff --git a/app/submodule/network/network_submodule.go b/app/submodule/network/network_submodule.go index e657c9102b..6664912e0b 100644 --- a/app/submodule/network/network_submodule.go +++ b/app/submodule/network/network_submodule.go @@ -12,7 +12,6 @@ import ( "github.com/dchest/blake2b" "github.com/ipfs/go-bitswap" bsnet "github.com/ipfs/go-bitswap/network" - blocks "github.com/ipfs/go-block-format" bserv "github.com/ipfs/go-blockservice" "github.com/ipfs/go-cid" "github.com/ipfs/go-datastore" @@ -23,6 +22,7 @@ import ( "github.com/ipfs/go-graphsync/storeutil" exchange "github.com/ipfs/go-ipfs-exchange-interface" cbor "github.com/ipfs/go-ipld-cbor" + blocks "github.com/ipfs/go-libipfs/blocks" logging "github.com/ipfs/go-log" "github.com/libp2p/go-libp2p" dht "github.com/libp2p/go-libp2p-kad-dht" diff --git a/go.mod b/go.mod index 1cdd6b3832..8ee408595c 100644 --- a/go.mod +++ b/go.mod @@ -58,7 +58,6 @@ 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/go-bitswap v0.10.2 - github.com/ipfs/go-block-format v0.0.3 github.com/ipfs/go-blockservice v0.4.0 github.com/ipfs/go-cid v0.3.2 github.com/ipfs/go-datastore v0.6.0 @@ -75,6 +74,7 @@ require ( github.com/ipfs/go-ipfs-files v0.1.1 github.com/ipfs/go-ipld-cbor v0.0.6 github.com/ipfs/go-ipld-format v0.4.0 + github.com/ipfs/go-libipfs v0.4.1 github.com/ipfs/go-log v1.0.5 github.com/ipfs/go-log/v2 v2.5.1 github.com/ipfs/go-merkledag v0.8.1 @@ -116,6 +116,8 @@ require ( gotest.tools v2.2.0+incompatible ) +require github.com/ipfs/go-block-format v0.1.1 // indirect + require ( github.com/BurntSushi/toml v1.1.0 // indirect github.com/Kubuxu/go-os-helper v0.0.1 // indirect @@ -189,13 +191,12 @@ require ( github.com/ipfs/go-bitfield v1.1.0 // indirect github.com/ipfs/go-ipfs-delay v0.0.1 // indirect github.com/ipfs/go-ipfs-posinfo v0.0.1 // indirect - github.com/ipfs/go-ipfs-pq v0.0.2 // indirect + github.com/ipfs/go-ipfs-pq v0.0.3 // indirect github.com/ipfs/go-ipfs-util v0.0.2 // indirect github.com/ipfs/go-ipld-legacy v0.1.1 // indirect github.com/ipfs/go-ipns v0.3.0 // indirect - github.com/ipfs/go-libipfs v0.1.0 // indirect github.com/ipfs/go-metrics-interface v0.0.1 // indirect - github.com/ipfs/go-peertaskqueue v0.8.0 // indirect + github.com/ipfs/go-peertaskqueue v0.8.1 // indirect github.com/ipfs/go-unixfsnode v1.4.0 // indirect github.com/ipfs/go-verifcid v0.0.2 // indirect github.com/ipld/go-codec-dagpb v1.5.0 // indirect diff --git a/go.sum b/go.sum index 77f5ec305e..326a24f2ac 100644 --- a/go.sum +++ b/go.sum @@ -689,8 +689,9 @@ github.com/ipfs/go-bitswap v0.10.2 h1:B81RIwkTnIvSYT1ZCzxjYTeF0Ek88xa9r1AMpTfk+9 github.com/ipfs/go-bitswap v0.10.2/go.mod h1:+fZEvycxviZ7c+5KlKwTzLm0M28g2ukCPqiuLfJk4KA= 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= github.com/ipfs/go-block-format v0.0.3/go.mod h1:4LmD4ZUw0mhO+JSKdpWwrzATiEfM7WWgQ8H5l6P8MVk= +github.com/ipfs/go-block-format v0.1.1 h1:129vSO3zwbsYADcyQWcOYiuCpAqt462SFfqFHdFJhhI= +github.com/ipfs/go-block-format v0.1.1/go.mod h1:+McEIT+g52p+zz5xGAABGSOKrzmrdX97bc0USBdWPUs= github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M= github.com/ipfs/go-blockservice v0.2.1/go.mod h1:k6SiwmgyYgs4M/qt+ww6amPeUH9EISLRBnvUurKJhi8= github.com/ipfs/go-blockservice v0.4.0 h1:7MUijAW5SqdsqEW/EhnNFRJXVF8mGU5aGhZ3CQaCWbY= @@ -776,11 +777,12 @@ github.com/ipfs/go-ipfs-files v0.1.1/go.mod h1:8xkIrMWH+Y5P7HvJ4Yc5XWwIW2e52dyXU github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs= github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A= github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= -github.com/ipfs/go-ipfs-pq v0.0.2 h1:e1vOOW6MuOwG2lqxcLA+wEn93i/9laCY8sXAw76jFOY= github.com/ipfs/go-ipfs-pq v0.0.2/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= +github.com/ipfs/go-ipfs-pq v0.0.3 h1:YpoHVJB+jzK15mr/xsWC574tyDLkezVrDNeaalQBsTE= +github.com/ipfs/go-ipfs-pq v0.0.3/go.mod h1:btNw5hsHBpRcSSgZtiNm/SLj5gYIZ18AKtv3kERkRb4= github.com/ipfs/go-ipfs-routing v0.1.0/go.mod h1:hYoUkJLyAUKhF58tysKpids8RNDPO42BVMgK5dNsoqY= -github.com/ipfs/go-ipfs-routing v0.2.1 h1:E+whHWhJkdN9YeoHZNj5itzc+OR292AJ2uE9FFiW0BY= github.com/ipfs/go-ipfs-routing v0.2.1/go.mod h1:xiNNiwgjmLqPS1cimvAw6EyB9rkVDbiocA4yY+wRNLM= +github.com/ipfs/go-ipfs-routing v0.3.0 h1:9W/W3N+g+y4ZDeffSgqhgo7BsBSJwPMcyssET9OWevc= github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= @@ -802,8 +804,8 @@ github.com/ipfs/go-ipld-legacy v0.1.1 h1:BvD8PEuqwBHLTKqlGFTHSwrwFOMkVESEvwIYwR2 github.com/ipfs/go-ipld-legacy v0.1.1/go.mod h1:8AyKFCjgRPsQFf15ZQgDB8Din4DML/fOmKZkkFkrIEg= github.com/ipfs/go-ipns v0.3.0 h1:ai791nTgVo+zTuq2bLvEGmWP1M0A6kGTXUsgv/Yq67A= github.com/ipfs/go-ipns v0.3.0/go.mod h1:3cLT2rbvgPZGkHJoPO1YMJeh6LtkxopCkKFcio/wE24= -github.com/ipfs/go-libipfs v0.1.0 h1:I6CrHHp4cIiqsWJPVU3QBH4BZrRWSljS2aAbA3Eg9AY= -github.com/ipfs/go-libipfs v0.1.0/go.mod h1:qX0d9h+wu53PFtCTXxdXVBakd6ZCvGDdkZUKmdLMLx0= +github.com/ipfs/go-libipfs v0.4.1 h1:tyu3RRMKFQUyUQt5jyt5SmDnls93H4Tr3HifL50zihg= +github.com/ipfs/go-libipfs v0.4.1/go.mod h1:Ad8ybPqwCkl2cNiNUMvM/iaVc/5bwNpHu8RPZ5te1hw= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= github.com/ipfs/go-log v1.0.0/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA= github.com/ipfs/go-log v1.0.1/go.mod h1:HuWlQttfN6FWNHRhlY5yMk/lW7evQC0HHGOxEwMRR8I= @@ -834,8 +836,8 @@ github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j github.com/ipfs/go-peertaskqueue v0.1.0/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U= github.com/ipfs/go-peertaskqueue v0.7.0/go.mod h1:M/akTIE/z1jGNXMU7kFB4TeSEFvj68ow0Rrb04donIU= github.com/ipfs/go-peertaskqueue v0.7.1/go.mod h1:M/akTIE/z1jGNXMU7kFB4TeSEFvj68ow0Rrb04donIU= -github.com/ipfs/go-peertaskqueue v0.8.0 h1:JyNO144tfu9bx6Hpo119zvbEL9iQ760FHOiJYsUjqaU= -github.com/ipfs/go-peertaskqueue v0.8.0/go.mod h1:cz8hEnnARq4Du5TGqiWKgMr/BOSQ5XOgMOh1K5YYKKM= +github.com/ipfs/go-peertaskqueue v0.8.1 h1:YhxAs1+wxb5jk7RvS0LHdyiILpNmRIRnZVztekOF0pg= +github.com/ipfs/go-peertaskqueue v0.8.1/go.mod h1:Oxxd3eaK279FxeydSPPVGHzbwVeHjatZ2GA8XD+KbPU= github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb/go.mod h1:IwAAgul1UQIcNZzKPYZWOCijryFBeCV79cNubPzol+k= github.com/ipfs/go-unixfs v0.3.1/go.mod h1:h4qfQYzghiIc8ZNFKiLMFWOTzrWIAtzYQ59W/pCFf1o= github.com/ipfs/go-unixfs v0.4.3 h1:EdDc1sNZNFDUlo4UrVAvvAofVI5EwTnKu8Nv8mgXkWQ= diff --git a/pkg/chain/message_store.go b/pkg/chain/message_store.go index 5b9414c993..6eae86b4e5 100644 --- a/pkg/chain/message_store.go +++ b/pkg/chain/message_store.go @@ -11,12 +11,12 @@ import ( cbor2 "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/specs-actors/actors/util/adt" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" "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" + blocks "github.com/ipfs/go-libipfs/blocks" "github.com/pkg/errors" cbg "github.com/whyrusleeping/cbor-gen" diff --git a/pkg/chain/store.go b/pkg/chain/store.go index 0a326629ea..b3dd8ae468 100644 --- a/pkg/chain/store.go +++ b/pkg/chain/store.go @@ -12,11 +12,11 @@ import ( "github.com/filecoin-project/pubsub" blockstoreutil "github.com/filecoin-project/venus/venus-shared/blockstore" lru "github.com/hashicorp/golang-lru" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" "github.com/ipfs/go-datastore" blockstore "github.com/ipfs/go-ipfs-blockstore" cbor "github.com/ipfs/go-ipld-cbor" + blocks "github.com/ipfs/go-libipfs/blocks" logging "github.com/ipfs/go-log/v2" "github.com/ipld/go-car" carutil "github.com/ipld/go-car/util" diff --git a/pkg/chain/testing.go b/pkg/chain/testing.go index b43202d983..4cfba8de0e 100644 --- a/pkg/chain/testing.go +++ b/pkg/chain/testing.go @@ -24,9 +24,9 @@ import ( "github.com/pkg/errors" "github.com/stretchr/testify/require" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" + blocks "github.com/ipfs/go-libipfs/blocks" "github.com/filecoin-project/venus/fixtures/assets" "github.com/filecoin-project/venus/pkg/clock" diff --git a/pkg/chain/utils.go b/pkg/chain/utils.go index 5cdc4f938e..217baf8f87 100644 --- a/pkg/chain/utils.go +++ b/pkg/chain/utils.go @@ -6,8 +6,8 @@ import ( blockstoreutil "github.com/filecoin-project/venus/venus-shared/blockstore" "github.com/filecoin-project/venus/venus-shared/types" - blockFormat "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + blockFormat "github.com/ipfs/go-libipfs/blocks" ) type storable interface { diff --git a/pkg/fork/fork.go b/pkg/fork/fork.go index b27cbaee90..ba61211266 100644 --- a/pkg/fork/fork.go +++ b/pkg/fork/fork.go @@ -24,10 +24,10 @@ import ( "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/rt" gstStore "github.com/filecoin-project/go-state-types/store" - ipfsblock "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" blockstore "github.com/ipfs/go-ipfs-blockstore" cbor "github.com/ipfs/go-ipld-cbor" + ipfsblock "github.com/ipfs/go-libipfs/blocks" logging "github.com/ipfs/go-log/v2" mh "github.com/multiformats/go-multihash" cbg "github.com/whyrusleeping/cbor-gen" diff --git a/pkg/gen/genesis/genblock.go b/pkg/gen/genesis/genblock.go index e66b1c5f88..37b4d614f9 100644 --- a/pkg/gen/genesis/genblock.go +++ b/pkg/gen/genesis/genblock.go @@ -3,8 +3,8 @@ package genesis import ( "encoding/hex" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" "github.com/multiformats/go-multihash" ) diff --git a/pkg/vm/vmcontext/gas_charge_ipld.go b/pkg/vm/vmcontext/gas_charge_ipld.go index 94e92c4247..ef266bce72 100644 --- a/pkg/vm/vmcontext/gas_charge_ipld.go +++ b/pkg/vm/vmcontext/gas_charge_ipld.go @@ -4,9 +4,9 @@ import ( "context" "github.com/filecoin-project/venus/pkg/vm/gas" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" + blocks "github.com/ipfs/go-libipfs/blocks" xerrors "github.com/pkg/errors" ) diff --git a/venus-component/go.mod b/venus-component/go.mod index b5e8c84de8..6be8f4ddde 100644 --- a/venus-component/go.mod +++ b/venus-component/go.mod @@ -30,7 +30,7 @@ require ( github.com/filecoin-project/specs-actors/v6 v6.0.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - github.com/ipfs/go-block-format v0.0.3 // indirect + github.com/ipfs/go-libipfs/blocks v0.0.3 // indirect github.com/ipfs/go-ipfs-util v0.0.2 // indirect github.com/ipfs/go-ipld-cbor v0.0.5 // indirect github.com/ipfs/go-ipld-format v0.0.2 // indirect diff --git a/venus-component/go.sum b/venus-component/go.sum index 958aa700e8..17617e9f75 100644 --- a/venus-component/go.sum +++ b/venus-component/go.sum @@ -132,10 +132,10 @@ github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3 github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI= github.com/ipfs/go-bitswap v0.1.0/go.mod h1:FFJEf18E9izuCqUtHxbWEvq+reg7o4CW5wSAE1wsxj0= github.com/ipfs/go-bitswap v0.1.2/go.mod h1:qxSWS4NXGs7jQ6zQvoPY3+NmOfHHG47mhkiLzBpJQIs= -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= -github.com/ipfs/go-block-format v0.0.3/go.mod h1:4LmD4ZUw0mhO+JSKdpWwrzATiEfM7WWgQ8H5l6P8MVk= +github.com/ipfs/go-libipfs/blocks v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= +github.com/ipfs/go-libipfs/blocks v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= +github.com/ipfs/go-libipfs/blocks v0.0.3 h1:r8t66QstRp/pd/or4dpnbVfXT5Gt7lOqRvC+/dDTpMc= +github.com/ipfs/go-libipfs/blocks v0.0.3/go.mod h1:4LmD4ZUw0mhO+JSKdpWwrzATiEfM7WWgQ8H5l6P8MVk= github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M= 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= diff --git a/venus-devtool/api-gen/example.go b/venus-devtool/api-gen/example.go index 0aba13a2fc..15485829e7 100644 --- a/venus-devtool/api-gen/example.go +++ b/venus-devtool/api-gen/example.go @@ -21,9 +21,9 @@ import ( "github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/venus/venus-shared/types/market" auuid "github.com/google/uuid" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" "github.com/ipfs/go-graphsync" + blocks "github.com/ipfs/go-libipfs/blocks" textselector "github.com/ipld/go-ipld-selector-text-lite" pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/libp2p/go-libp2p/core/metrics" diff --git a/venus-devtool/go.mod b/venus-devtool/go.mod index 8adad97e6a..d87428560a 100644 --- a/venus-devtool/go.mod +++ b/venus-devtool/go.mod @@ -12,9 +12,9 @@ require ( github.com/filecoin-project/lotus v1.20.0-rc1 github.com/filecoin-project/venus v0.0.0-00010101000000-000000000000 github.com/google/uuid v1.3.0 - github.com/ipfs/go-block-format v0.0.3 github.com/ipfs/go-cid v0.3.2 github.com/ipfs/go-graphsync v0.13.2 + github.com/ipfs/go-libipfs v0.4.1 github.com/ipld/go-ipld-selector-text-lite v0.0.1 github.com/libp2p/go-libp2p v0.23.4 github.com/libp2p/go-libp2p-pubsub v0.8.2 @@ -101,6 +101,7 @@ require ( github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/icza/backscanner v0.0.0-20210726202459-ac2ffc679f94 // indirect github.com/ipfs/bbloom v0.0.4 // indirect + github.com/ipfs/go-block-format v0.1.1 // indirect github.com/ipfs/go-blockservice v0.4.0 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect github.com/ipfs/go-ds-badger2 v0.1.2 // indirect diff --git a/venus-devtool/go.sum b/venus-devtool/go.sum index ed0b6e0d0e..dc754ca583 100644 --- a/venus-devtool/go.sum +++ b/venus-devtool/go.sum @@ -628,8 +628,9 @@ github.com/ipfs/go-bitswap v0.5.1/go.mod h1:P+ckC87ri1xFLvk74NlXdP0Kj9RmWAh4+H78 github.com/ipfs/go-bitswap v0.10.2 h1:B81RIwkTnIvSYT1ZCzxjYTeF0Ek88xa9r1AMpTfk+9Q= 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= github.com/ipfs/go-block-format v0.0.3/go.mod h1:4LmD4ZUw0mhO+JSKdpWwrzATiEfM7WWgQ8H5l6P8MVk= +github.com/ipfs/go-block-format v0.1.1 h1:129vSO3zwbsYADcyQWcOYiuCpAqt462SFfqFHdFJhhI= +github.com/ipfs/go-block-format v0.1.1/go.mod h1:+McEIT+g52p+zz5xGAABGSOKrzmrdX97bc0USBdWPUs= github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M= github.com/ipfs/go-blockservice v0.2.1/go.mod h1:k6SiwmgyYgs4M/qt+ww6amPeUH9EISLRBnvUurKJhi8= github.com/ipfs/go-blockservice v0.4.0 h1:7MUijAW5SqdsqEW/EhnNFRJXVF8mGU5aGhZ3CQaCWbY= @@ -718,11 +719,11 @@ github.com/ipfs/go-ipfs-http-client v0.4.0/go.mod h1:NXzPUKt/QVCuR74a8angJCGOSLP github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs= github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A= github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= -github.com/ipfs/go-ipfs-pq v0.0.2 h1:e1vOOW6MuOwG2lqxcLA+wEn93i/9laCY8sXAw76jFOY= github.com/ipfs/go-ipfs-pq v0.0.2/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY= +github.com/ipfs/go-ipfs-pq v0.0.3 h1:YpoHVJB+jzK15mr/xsWC574tyDLkezVrDNeaalQBsTE= github.com/ipfs/go-ipfs-routing v0.1.0/go.mod h1:hYoUkJLyAUKhF58tysKpids8RNDPO42BVMgK5dNsoqY= -github.com/ipfs/go-ipfs-routing v0.2.1 h1:E+whHWhJkdN9YeoHZNj5itzc+OR292AJ2uE9FFiW0BY= github.com/ipfs/go-ipfs-routing v0.2.1/go.mod h1:xiNNiwgjmLqPS1cimvAw6EyB9rkVDbiocA4yY+wRNLM= +github.com/ipfs/go-ipfs-routing v0.3.0 h1:9W/W3N+g+y4ZDeffSgqhgo7BsBSJwPMcyssET9OWevc= github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= @@ -744,7 +745,8 @@ github.com/ipfs/go-ipld-legacy v0.1.1 h1:BvD8PEuqwBHLTKqlGFTHSwrwFOMkVESEvwIYwR2 github.com/ipfs/go-ipld-legacy v0.1.1/go.mod h1:8AyKFCjgRPsQFf15ZQgDB8Din4DML/fOmKZkkFkrIEg= github.com/ipfs/go-ipns v0.3.0 h1:ai791nTgVo+zTuq2bLvEGmWP1M0A6kGTXUsgv/Yq67A= github.com/ipfs/go-ipns v0.3.0/go.mod h1:3cLT2rbvgPZGkHJoPO1YMJeh6LtkxopCkKFcio/wE24= -github.com/ipfs/go-libipfs v0.1.0 h1:I6CrHHp4cIiqsWJPVU3QBH4BZrRWSljS2aAbA3Eg9AY= +github.com/ipfs/go-libipfs v0.4.1 h1:tyu3RRMKFQUyUQt5jyt5SmDnls93H4Tr3HifL50zihg= +github.com/ipfs/go-libipfs v0.4.1/go.mod h1:Ad8ybPqwCkl2cNiNUMvM/iaVc/5bwNpHu8RPZ5te1hw= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= github.com/ipfs/go-log v1.0.0/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA= github.com/ipfs/go-log v1.0.2/go.mod h1:1MNjMxe0u6xvJZgeqbJ8vdo2TKaGwZ1a0Bpza+sr2Sk= @@ -776,7 +778,7 @@ github.com/ipfs/go-path v0.3.0/go.mod h1:NOScsVgxfC/eIw4nz6OiGwK42PjaSJ4Y/ZFPn1X github.com/ipfs/go-peertaskqueue v0.1.0/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U= github.com/ipfs/go-peertaskqueue v0.7.0/go.mod h1:M/akTIE/z1jGNXMU7kFB4TeSEFvj68ow0Rrb04donIU= github.com/ipfs/go-peertaskqueue v0.7.1/go.mod h1:M/akTIE/z1jGNXMU7kFB4TeSEFvj68ow0Rrb04donIU= -github.com/ipfs/go-peertaskqueue v0.8.0 h1:JyNO144tfu9bx6Hpo119zvbEL9iQ760FHOiJYsUjqaU= +github.com/ipfs/go-peertaskqueue v0.8.1 h1:YhxAs1+wxb5jk7RvS0LHdyiILpNmRIRnZVztekOF0pg= github.com/ipfs/go-unixfs v0.2.2-0.20190827150610-868af2e9e5cb/go.mod h1:IwAAgul1UQIcNZzKPYZWOCijryFBeCV79cNubPzol+k= github.com/ipfs/go-unixfs v0.2.4/go.mod h1:SUdisfUjNoSDzzhGVxvCL9QO/nKdwXdr+gbMUdqcbYw= github.com/ipfs/go-unixfs v0.3.1/go.mod h1:h4qfQYzghiIc8ZNFKiLMFWOTzrWIAtzYQ59W/pCFf1o= diff --git a/venus-shared/actors/types/message.go b/venus-shared/actors/types/message.go index ae253835fb..3bf903df01 100644 --- a/venus-shared/actors/types/message.go +++ b/venus-shared/actors/types/message.go @@ -11,8 +11,8 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/venus/venus-shared/types/params" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" ) const MessageVersion = 0 diff --git a/venus-shared/actors/types/signed_message.go b/venus-shared/actors/types/signed_message.go index f1797fe9e1..84e0f89111 100644 --- a/venus-shared/actors/types/signed_message.go +++ b/venus-shared/actors/types/signed_message.go @@ -7,8 +7,8 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/crypto" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" ) // SignedMessage contains a message and its signature diff --git a/venus-shared/api/chain/v0/blockstore.go b/venus-shared/api/chain/v0/blockstore.go index 2590ba52ad..9c8f264fbc 100644 --- a/venus-shared/api/chain/v0/blockstore.go +++ b/venus-shared/api/chain/v0/blockstore.go @@ -4,8 +4,8 @@ import ( "context" "github.com/filecoin-project/venus/venus-shared/types" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" ) type IBlockStore interface { diff --git a/venus-shared/api/chain/v0/mock/mock_fullnode.go b/venus-shared/api/chain/v0/mock/mock_fullnode.go index da07d2bf7b..0cf4825fd3 100644 --- a/venus-shared/api/chain/v0/mock/mock_fullnode.go +++ b/venus-shared/api/chain/v0/mock/mock_fullnode.go @@ -23,7 +23,7 @@ import ( types "github.com/filecoin-project/venus/venus-shared/actors/types" types0 "github.com/filecoin-project/venus/venus-shared/types" gomock "github.com/golang/mock/gomock" - blocks "github.com/ipfs/go-block-format" + blocks "github.com/ipfs/go-libipfs/blocks" cid "github.com/ipfs/go-cid" metrics "github.com/libp2p/go-libp2p/core/metrics" network0 "github.com/libp2p/go-libp2p/core/network" diff --git a/venus-shared/api/chain/v0/proxy_gen.go b/venus-shared/api/chain/v0/proxy_gen.go index 20c0b08f0e..edafc7757a 100644 --- a/venus-shared/api/chain/v0/proxy_gen.go +++ b/venus-shared/api/chain/v0/proxy_gen.go @@ -12,7 +12,7 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/network" - blocks "github.com/ipfs/go-block-format" + blocks "github.com/ipfs/go-libipfs/blocks" cid "github.com/ipfs/go-cid" "github.com/libp2p/go-libp2p/core/metrics" network2 "github.com/libp2p/go-libp2p/core/network" diff --git a/venus-shared/api/chain/v1/blockstore.go b/venus-shared/api/chain/v1/blockstore.go index ddb74b74e7..8e316fb452 100644 --- a/venus-shared/api/chain/v1/blockstore.go +++ b/venus-shared/api/chain/v1/blockstore.go @@ -4,8 +4,8 @@ import ( "context" "github.com/filecoin-project/venus/venus-shared/types" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" ) type IBlockStore interface { diff --git a/venus-shared/api/chain/v1/mock/mock_fullnode.go b/venus-shared/api/chain/v1/mock/mock_fullnode.go index 0cecd8d1a2..c419afb4bb 100644 --- a/venus-shared/api/chain/v1/mock/mock_fullnode.go +++ b/venus-shared/api/chain/v1/mock/mock_fullnode.go @@ -25,7 +25,7 @@ import ( types "github.com/filecoin-project/venus/venus-shared/actors/types" types0 "github.com/filecoin-project/venus/venus-shared/types" gomock "github.com/golang/mock/gomock" - blocks "github.com/ipfs/go-block-format" + blocks "github.com/ipfs/go-libipfs/blocks" cid "github.com/ipfs/go-cid" metrics "github.com/libp2p/go-libp2p/core/metrics" network0 "github.com/libp2p/go-libp2p/core/network" diff --git a/venus-shared/api/chain/v1/proxy_gen.go b/venus-shared/api/chain/v1/proxy_gen.go index 75856e2e25..fab35d393c 100644 --- a/venus-shared/api/chain/v1/proxy_gen.go +++ b/venus-shared/api/chain/v1/proxy_gen.go @@ -14,7 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/network" - blocks "github.com/ipfs/go-block-format" + blocks "github.com/ipfs/go-libipfs/blocks" cid "github.com/ipfs/go-cid" "github.com/libp2p/go-libp2p/core/metrics" network2 "github.com/libp2p/go-libp2p/core/network" diff --git a/venus-shared/blockstore/apibstore.go b/venus-shared/blockstore/apibstore.go index cdc803d130..2b4b95376e 100644 --- a/venus-shared/blockstore/apibstore.go +++ b/venus-shared/blockstore/apibstore.go @@ -4,8 +4,8 @@ import ( "context" "errors" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" ) type ChainIO interface { diff --git a/venus-shared/blockstore/autobatch.go b/venus-shared/blockstore/autobatch.go index be06ee8a69..3d337f0c3b 100644 --- a/venus-shared/blockstore/autobatch.go +++ b/venus-shared/blockstore/autobatch.go @@ -6,9 +6,9 @@ import ( "sync" "time" - block "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" + block "github.com/ipfs/go-libipfs/blocks" ) // autolog is a logger for the autobatching blockstore. It is subscoped from the diff --git a/venus-shared/blockstore/autobatch_test.go b/venus-shared/blockstore/autobatch_test.go index d82ecf2268..0aed61a096 100644 --- a/venus-shared/blockstore/autobatch_test.go +++ b/venus-shared/blockstore/autobatch_test.go @@ -5,8 +5,8 @@ import ( "testing" tf "github.com/filecoin-project/venus/pkg/testhelpers/testflags" - blocks "github.com/ipfs/go-block-format" ipld "github.com/ipfs/go-ipld-format" + blocks "github.com/ipfs/go-libipfs/blocks" "github.com/stretchr/testify/require" ) diff --git a/venus-shared/blockstore/badger.go b/venus-shared/blockstore/badger.go index 5211108a71..177ce9fd9b 100644 --- a/venus-shared/blockstore/badger.go +++ b/venus-shared/blockstore/badger.go @@ -8,13 +8,13 @@ import ( "github.com/dgraph-io/badger/v2" "github.com/dgraph-io/badger/v2/options" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" "github.com/ipfs/go-datastore" "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" + blocks "github.com/ipfs/go-libipfs/blocks" "go.uber.org/zap" ) diff --git a/venus-shared/blockstore/buf_bstore.go b/venus-shared/blockstore/buf_bstore.go index 7959267652..588335a551 100644 --- a/venus-shared/blockstore/buf_bstore.go +++ b/venus-shared/blockstore/buf_bstore.go @@ -4,9 +4,9 @@ import ( "context" "os" - block "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" + block "github.com/ipfs/go-libipfs/blocks" logging "github.com/ipfs/go-log/v2" ) diff --git a/venus-shared/blockstore/copy.go b/venus-shared/blockstore/copy.go index b773078cdd..fa5d6bedc3 100644 --- a/venus-shared/blockstore/copy.go +++ b/venus-shared/blockstore/copy.go @@ -5,8 +5,8 @@ import ( "context" "fmt" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" mh "github.com/multiformats/go-multihash" cbg "github.com/whyrusleeping/cbor-gen" "go.opencensus.io/trace" diff --git a/venus-shared/blockstore/mem.go b/venus-shared/blockstore/mem.go index d3bfcae2dd..e5f0663b28 100644 --- a/venus-shared/blockstore/mem.go +++ b/venus-shared/blockstore/mem.go @@ -3,9 +3,9 @@ package blockstore import ( "context" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" + blocks "github.com/ipfs/go-libipfs/blocks" ) // NewMemory returns a temporary memory-backed blockstore. diff --git a/venus-shared/blockstore/mem_test.go b/venus-shared/blockstore/mem_test.go index 4d4a776245..6a5e0d2d11 100644 --- a/venus-shared/blockstore/mem_test.go +++ b/venus-shared/blockstore/mem_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" mh "github.com/multiformats/go-multihash" "github.com/stretchr/testify/require" ) diff --git a/venus-shared/blockstore/net.go b/venus-shared/blockstore/net.go index 9eee66c3a1..bd4f4985d2 100644 --- a/venus-shared/blockstore/net.go +++ b/venus-shared/blockstore/net.go @@ -8,9 +8,9 @@ import ( "sync" "sync/atomic" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" + blocks "github.com/ipfs/go-libipfs/blocks" "github.com/libp2p/go-msgio" cbg "github.com/whyrusleeping/cbor-gen" "golang.org/x/xerrors" diff --git a/venus-shared/blockstore/net_serve.go b/venus-shared/blockstore/net_serve.go index 0a2310743f..fdc6e49b26 100644 --- a/venus-shared/blockstore/net_serve.go +++ b/venus-shared/blockstore/net_serve.go @@ -5,9 +5,9 @@ import ( "context" "encoding/binary" - block "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" + block "github.com/ipfs/go-libipfs/blocks" "github.com/libp2p/go-msgio" cbg "github.com/whyrusleeping/cbor-gen" "golang.org/x/xerrors" diff --git a/venus-shared/blockstore/net_test.go b/venus-shared/blockstore/net_test.go index 9b91514631..af9a74facb 100644 --- a/venus-shared/blockstore/net_test.go +++ b/venus-shared/blockstore/net_test.go @@ -6,8 +6,8 @@ import ( "testing" tf "github.com/filecoin-project/venus/pkg/testhelpers/testflags" - block "github.com/ipfs/go-block-format" ipld "github.com/ipfs/go-ipld-format" + block "github.com/ipfs/go-libipfs/blocks" "github.com/libp2p/go-msgio" "github.com/stretchr/testify/require" ) diff --git a/venus-shared/blockstore/syncstore.go b/venus-shared/blockstore/syncstore.go index 122dcd4a92..2cdd200081 100644 --- a/venus-shared/blockstore/syncstore.go +++ b/venus-shared/blockstore/syncstore.go @@ -4,8 +4,8 @@ import ( "context" "sync" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" ) var _ Blockstore = (*SyncStore)(nil) diff --git a/venus-shared/blockstore/view_blockstore.go b/venus-shared/blockstore/view_blockstore.go index 2d6ad629fa..d2d48d8bd1 100644 --- a/venus-shared/blockstore/view_blockstore.go +++ b/venus-shared/blockstore/view_blockstore.go @@ -6,12 +6,12 @@ import ( "fmt" "github.com/dgraph-io/badger/v2" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/keytransform" dshelp "github.com/ipfs/go-ipfs-ds-help" ipld "github.com/ipfs/go-ipld-format" + blocks "github.com/ipfs/go-libipfs/blocks" ) var _ Blockstore = (*TxBlockstore)(nil) diff --git a/venus-shared/types/block_header.go b/venus-shared/types/block_header.go index 1eb878695d..06a6a2416d 100644 --- a/venus-shared/types/block_header.go +++ b/venus-shared/types/block_header.go @@ -10,10 +10,10 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/proof" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" cbor "github.com/ipfs/go-ipld-cbor" node "github.com/ipfs/go-ipld-format" + blocks "github.com/ipfs/go-libipfs/blocks" ) // DecodeBlock decodes raw cbor bytes into a BlockHeader. diff --git a/venus-shared/types/message_root.go b/venus-shared/types/message_root.go index 9211f1f9db..0d2d7d1f34 100644 --- a/venus-shared/types/message_root.go +++ b/venus-shared/types/message_root.go @@ -4,8 +4,8 @@ import ( "bytes" "github.com/filecoin-project/go-state-types/abi" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" ) type MessageRoot struct { diff --git a/venus-shared/types/message_test.go b/venus-shared/types/message_test.go index c8b79e762b..70af7279f5 100644 --- a/venus-shared/types/message_test.go +++ b/venus-shared/types/message_test.go @@ -10,7 +10,7 @@ import ( tf "github.com/filecoin-project/venus/pkg/testhelpers/testflags" "github.com/filecoin-project/venus/venus-shared/testutil" "github.com/filecoin-project/venus/venus-shared/types/params" - blocks "github.com/ipfs/go-block-format" + blocks "github.com/ipfs/go-libipfs/blocks" "github.com/stretchr/testify/require" ) diff --git a/venus-shared/types/tipset_key.go b/venus-shared/types/tipset_key.go index a7862df8ec..36a3723c8b 100644 --- a/venus-shared/types/tipset_key.go +++ b/venus-shared/types/tipset_key.go @@ -8,8 +8,8 @@ import ( "strings" "github.com/filecoin-project/go-state-types/abi" - block "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" + block "github.com/ipfs/go-libipfs/blocks" logging "github.com/ipfs/go-log/v2" cbg "github.com/whyrusleeping/cbor-gen" ) From 7fc452c7b4bf906158fc80b19dfda4a35d629e99 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 20 Feb 2023 14:17:55 +0800 Subject: [PATCH 07/11] fix: eth: return the correct nonce from EthGetTransactionCount --- app/submodule/eth/eth_api.go | 22 +++++++++++++++++++ venus-devtool/go.mod | 2 +- venus-devtool/go.sum | 4 ++-- venus-shared/actors/builtin/evm/actor.go | 1 + .../actors/builtin/evm/actor.go.template | 1 + .../actors/builtin/evm/state.sep.go.template | 5 +++++ venus-shared/actors/builtin/evm/state.v10.go | 6 ++++- .../api/chain/v0/mock/mock_fullnode.go | 2 +- venus-shared/api/chain/v0/proxy_gen.go | 2 +- .../api/chain/v1/mock/mock_fullnode.go | 2 +- venus-shared/api/chain/v1/proxy_gen.go | 2 +- .../compatible-checks/api-checksum.txt | 5 +++-- 12 files changed, 44 insertions(+), 10 deletions(-) diff --git a/app/submodule/eth/eth_api.go b/app/submodule/eth/eth_api.go index d655663d6d..b89c4a87da 100644 --- a/app/submodule/eth/eth_api.go +++ b/app/submodule/eth/eth_api.go @@ -31,6 +31,7 @@ import ( "github.com/filecoin-project/venus/pkg/statemanger" "github.com/filecoin-project/venus/venus-shared/actors" builtinactors "github.com/filecoin-project/venus/venus-shared/actors/builtin" + builtinevm "github.com/filecoin-project/venus/venus-shared/actors/builtin/evm" types2 "github.com/filecoin-project/venus/venus-shared/actors/types" v1 "github.com/filecoin-project/venus/venus-shared/api/chain/v1" "github.com/filecoin-project/venus/venus-shared/types" @@ -321,6 +322,27 @@ func (a *ethAPI) EthGetTransactionCount(ctx context.Context, sender types.EthAdd if err != nil { return types.EthUint64(0), fmt.Errorf("cannot parse block param: %s", blkParam) } + + // First, handle the case where the "sender" is an EVM actor. + if actor, err := a.em.chainModule.Stmgr.GetActorAt(ctx, addr, ts); err != nil { + if errors.Is(err, types.ErrActorNotFound) { + return 0, nil + } + return 0, fmt.Errorf("failed to lookup contract %s: %w", sender, err) + } else if builtinactors.IsEvmActor(actor.Code) { + evmState, err := builtinevm.Load(a.em.chainModule.ChainReader.Store(ctx), actor) + if err != nil { + return 0, fmt.Errorf("failed to load evm state: %w", err) + } + if alive, err := evmState.IsAlive(); err != nil { + return 0, err + } else if !alive { + return 0, nil + } + nonce, err := evmState.Nonce() + return types.EthUint64(nonce), err + } + nonce, err := a.em.mpoolModule.MPool.GetNonce(ctx, addr, ts.Key()) if err != nil { return types.EthUint64(0), err diff --git a/venus-devtool/go.mod b/venus-devtool/go.mod index d87428560a..1eb8089fa2 100644 --- a/venus-devtool/go.mod +++ b/venus-devtool/go.mod @@ -9,7 +9,7 @@ require ( github.com/filecoin-project/go-fil-markets v1.25.2 github.com/filecoin-project/go-jsonrpc v0.2.1 github.com/filecoin-project/go-state-types v0.10.0-rc3 - github.com/filecoin-project/lotus v1.20.0-rc1 + github.com/filecoin-project/lotus v1.20.0-rc2 github.com/filecoin-project/venus v0.0.0-00010101000000-000000000000 github.com/google/uuid v1.3.0 github.com/ipfs/go-cid v0.3.2 diff --git a/venus-devtool/go.sum b/venus-devtool/go.sum index dc754ca583..9bff129ea7 100644 --- a/venus-devtool/go.sum +++ b/venus-devtool/go.sum @@ -338,8 +338,8 @@ github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWc github.com/filecoin-project/go-statestore v0.2.0 h1:cRRO0aPLrxKQCZ2UOQbzFGn4WDNdofHZoGPjfNaAo5Q= github.com/filecoin-project/go-statestore v0.2.0/go.mod h1:8sjBYbS35HwPzct7iT4lIXjLlYyPor80aU7t7a/Kspo= github.com/filecoin-project/index-provider v0.9.1 h1:Jnh9dviIHvQxZ2baNoYu3n8z6F9O62ksnVlyREgPyyM= -github.com/filecoin-project/lotus v1.20.0-rc1 h1:VWvqNgM9u+bSEkdLmPpdv61HqpXNFaFVbUF3mIH6G2g= -github.com/filecoin-project/lotus v1.20.0-rc1/go.mod h1:h+VTMD+klqctZBruSVi8OuAUYULufxSv8HvBmJZ7bdk= +github.com/filecoin-project/lotus v1.20.0-rc2 h1:0oFPzq/SqsuimAKLmXyiONwiKW3joKHoX8pjqh3kPpY= +github.com/filecoin-project/lotus v1.20.0-rc2/go.mod h1:LwDjcMt5GMH31DH61eEeB7KraRaux23vmnP35NPyCFg= github.com/filecoin-project/pubsub v1.0.0 h1:ZTmT27U07e54qV1mMiQo4HDr0buo8I1LDHBYLXlsNXM= github.com/filecoin-project/pubsub v1.0.0/go.mod h1:GkpB33CcUtUNrLPhJgfdy4FDx4OMNR9k+46DHx/Lqrg= github.com/filecoin-project/specs-actors v0.9.13/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao= diff --git a/venus-shared/actors/builtin/evm/actor.go b/venus-shared/actors/builtin/evm/actor.go index 49edfcba9e..c677c9a319 100644 --- a/venus-shared/actors/builtin/evm/actor.go +++ b/venus-shared/actors/builtin/evm/actor.go @@ -52,6 +52,7 @@ type State interface { cbor.Marshaler Nonce() (uint64, error) + IsAlive() (bool, error) GetState() interface{} GetBytecode() ([]byte, error) diff --git a/venus-shared/actors/builtin/evm/actor.go.template b/venus-shared/actors/builtin/evm/actor.go.template index 0f6d12bbb8..6d9a3ce92b 100644 --- a/venus-shared/actors/builtin/evm/actor.go.template +++ b/venus-shared/actors/builtin/evm/actor.go.template @@ -50,6 +50,7 @@ type State interface { cbor.Marshaler Nonce() (uint64, error) + IsAlive() (bool, error) GetState() interface{} GetBytecode() ([]byte, error) diff --git a/venus-shared/actors/builtin/evm/state.sep.go.template b/venus-shared/actors/builtin/evm/state.sep.go.template index 788fe12393..68488ae58d 100644 --- a/venus-shared/actors/builtin/evm/state.sep.go.template +++ b/venus-shared/actors/builtin/evm/state.sep.go.template @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" "github.com/filecoin-project/venus/venus-shared/actors/adt" + "github.com/filecoin-project/go-state-types/abi" evm{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}evm" ) @@ -42,6 +43,10 @@ func (s *state{{.v}}) Nonce() (uint64, error) { return s.State.Nonce, nil } +func (s *state{{.v}}) IsAlive() (bool, error) { + return s.State.Tombstone == nil, nil +} + func (s *state{{.v}}) GetState() interface{} { return &s.State } diff --git a/venus-shared/actors/builtin/evm/state.v10.go b/venus-shared/actors/builtin/evm/state.v10.go index f1a431eac1..a265e43514 100644 --- a/venus-shared/actors/builtin/evm/state.v10.go +++ b/venus-shared/actors/builtin/evm/state.v10.go @@ -5,9 +5,9 @@ package evm import ( "github.com/ipfs/go-cid" + "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/venus/venus-shared/actors/adt" - "github.com/filecoin-project/go-state-types/abi" evm10 "github.com/filecoin-project/go-state-types/builtin/v10/evm" ) @@ -43,6 +43,10 @@ func (s *state10) Nonce() (uint64, error) { return s.State.Nonce, nil } +func (s *state10) IsAlive() (bool, error) { + return s.State.Tombstone == nil, nil +} + func (s *state10) GetState() interface{} { return &s.State } diff --git a/venus-shared/api/chain/v0/mock/mock_fullnode.go b/venus-shared/api/chain/v0/mock/mock_fullnode.go index 0cf4825fd3..b7ef2df026 100644 --- a/venus-shared/api/chain/v0/mock/mock_fullnode.go +++ b/venus-shared/api/chain/v0/mock/mock_fullnode.go @@ -23,8 +23,8 @@ import ( types "github.com/filecoin-project/venus/venus-shared/actors/types" types0 "github.com/filecoin-project/venus/venus-shared/types" gomock "github.com/golang/mock/gomock" - blocks "github.com/ipfs/go-libipfs/blocks" cid "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" metrics "github.com/libp2p/go-libp2p/core/metrics" network0 "github.com/libp2p/go-libp2p/core/network" peer "github.com/libp2p/go-libp2p/core/peer" diff --git a/venus-shared/api/chain/v0/proxy_gen.go b/venus-shared/api/chain/v0/proxy_gen.go index edafc7757a..c5846b48f8 100644 --- a/venus-shared/api/chain/v0/proxy_gen.go +++ b/venus-shared/api/chain/v0/proxy_gen.go @@ -12,8 +12,8 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/network" - blocks "github.com/ipfs/go-libipfs/blocks" cid "github.com/ipfs/go-cid" + "github.com/ipfs/go-libipfs/blocks" "github.com/libp2p/go-libp2p/core/metrics" network2 "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" diff --git a/venus-shared/api/chain/v1/mock/mock_fullnode.go b/venus-shared/api/chain/v1/mock/mock_fullnode.go index c419afb4bb..33da7a0e84 100644 --- a/venus-shared/api/chain/v1/mock/mock_fullnode.go +++ b/venus-shared/api/chain/v1/mock/mock_fullnode.go @@ -25,8 +25,8 @@ import ( types "github.com/filecoin-project/venus/venus-shared/actors/types" types0 "github.com/filecoin-project/venus/venus-shared/types" gomock "github.com/golang/mock/gomock" - blocks "github.com/ipfs/go-libipfs/blocks" cid "github.com/ipfs/go-cid" + blocks "github.com/ipfs/go-libipfs/blocks" metrics "github.com/libp2p/go-libp2p/core/metrics" network0 "github.com/libp2p/go-libp2p/core/network" peer "github.com/libp2p/go-libp2p/core/peer" diff --git a/venus-shared/api/chain/v1/proxy_gen.go b/venus-shared/api/chain/v1/proxy_gen.go index fab35d393c..b2d5a42785 100644 --- a/venus-shared/api/chain/v1/proxy_gen.go +++ b/venus-shared/api/chain/v1/proxy_gen.go @@ -14,8 +14,8 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/network" - blocks "github.com/ipfs/go-libipfs/blocks" cid "github.com/ipfs/go-cid" + "github.com/ipfs/go-libipfs/blocks" "github.com/libp2p/go-libp2p/core/metrics" network2 "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" diff --git a/venus-shared/compatible-checks/api-checksum.txt b/venus-shared/compatible-checks/api-checksum.txt index 3ead35a664..2bc0992b8c 100644 --- a/venus-shared/compatible-checks/api-checksum.txt +++ b/venus-shared/compatible-checks/api-checksum.txt @@ -20,7 +20,7 @@ v0api.FullNode: ChainHasObj: In=2, Out=2, CheckSum=7fe71bcffa1b110db106e0104e98a32f ChainHead: In=1, Out=2, CheckSum=6d1e4c4d8184dc8d645a56278f14cfad ChainNotify: In=1, Out=2, CheckSum=9525148e93a5b83600ebfbde4d24f3e9 - ChainPutObj: In=2, Out=1, CheckSum=8f14a26d66dd2a48d50d58af2ff7d722 + ChainPutObj: In=2, Out=1, CheckSum=7a4402108142bfbc03ebb507ad09aa1d ChainReadObj: In=2, Out=2, CheckSum=6fd9244d87bf5d14fb5e79b0dbc0940d ChainSetHead: In=2, Out=1, CheckSum=cdfe593ac791e823186abb77bfad49a0 ChainStatObj: In=3, Out=2, CheckSum=9db2a0d97998daaf9c15e7c3d6ffe82d @@ -247,7 +247,7 @@ api.FullNode: ChainHead: In=1, Out=2, CheckSum=6d1e4c4d8184dc8d645a56278f14cfad ChainNotify: In=1, Out=2, CheckSum=9525148e93a5b83600ebfbde4d24f3e9 ChainPrune: In=2, Out=1, CheckSum=af574df2ee0daa338f8d54b5f5da15a3 - ChainPutObj: In=2, Out=1, CheckSum=8f14a26d66dd2a48d50d58af2ff7d722 + ChainPutObj: In=2, Out=1, CheckSum=7a4402108142bfbc03ebb507ad09aa1d ChainReadObj: In=2, Out=2, CheckSum=6fd9244d87bf5d14fb5e79b0dbc0940d ChainSetHead: In=2, Out=1, CheckSum=cdfe593ac791e823186abb77bfad49a0 ChainStatObj: In=3, Out=2, CheckSum=9db2a0d97998daaf9c15e7c3d6ffe82d @@ -284,6 +284,7 @@ api.FullNode: CreateBackup: In=2, Out=1, CheckSum=7b0679c2c73ab9606a7da21c5251ad19 Discover: In=1, Out=2, CheckSum=09640e20c6d71c3e96c7a56c8698acc9 EthAccounts: In=1, Out=2, CheckSum=d2d1b2a1ffc7dc9b28e8c64c79147670 + EthAddressToFilecoinAddress: In=2, Out=2, CheckSum=d1ca5904502264aa05b428089d46d660 EthBlockNumber: In=1, Out=2, CheckSum=442f3dc12ea5a22b7b8fea633069692a EthCall: In=3, Out=2, CheckSum=64610416ed5674a0c717908d51904008 EthChainId: In=1, Out=2, CheckSum=442f3dc12ea5a22b7b8fea633069692a From e5df5f46890bdaf82030dc2b2f0b955b7bb210f9 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 20 Feb 2023 15:53:34 +0800 Subject: [PATCH 08/11] chore: avoid actor not found --- cmd/evm.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/evm.go b/cmd/evm.go index 4d494bb0eb..f9ba97adeb 100644 --- a/cmd/evm.go +++ b/cmd/evm.go @@ -23,6 +23,7 @@ import ( "github.com/filecoin-project/venus/app/node" "github.com/filecoin-project/venus/pkg/constants" "github.com/filecoin-project/venus/venus-shared/actors" + "github.com/filecoin-project/venus/venus-shared/actors/builtin" v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1" "github.com/filecoin-project/venus/venus-shared/types" ) @@ -76,16 +77,22 @@ var evmGetInfoCmd = &cmds.Command{ } actor, err := chainAPI.StateGetActor(ctx, faddr, types.EmptyTSK) - if err != nil { - return err - } buf := new(bytes.Buffer) writer := NewSilentWriter(buf) writer.Println("Filecoin address: ", faddr) writer.Println("Eth address: ", eaddr) - writer.Println("Code cid: ", actor.Code.String()) + if err != nil { + writer.Printf("Actor lookup failed for faddr %s with error: %s\n", faddr, err) + } else { + idAddr, err := chainAPI.StateLookupID(ctx, faddr, types.EmptyTSK) + if err == nil { + fmt.Println("ID address: ", idAddr) + fmt.Println("Code cid: ", actor.Code.String()) + fmt.Println("Actor Type: ", builtin.ActorNameByCode(actor.Code)) + } + } return re.Emit(buf) }, From ac3677367fdb85d85bcfa1af5ad2c05f7776db8f Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 20 Feb 2023 15:55:38 +0800 Subject: [PATCH 09/11] fix: eth: cleanup error cases --- app/submodule/eth/eth_api.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/submodule/eth/eth_api.go b/app/submodule/eth/eth_api.go index b89c4a87da..215f7bcbe4 100644 --- a/app/submodule/eth/eth_api.go +++ b/app/submodule/eth/eth_api.go @@ -896,7 +896,7 @@ func (a *ethAPI) EthEstimateGas(ctx context.Context, tx types.EthCall) (types.Et expectedGas, err := ethGasSearch(ctx, a.em.chainModule.Stmgr, a.em.mpoolModule.MPool, gassedMsg, ts) if err != nil { - log.Errorw("expected gas", "err", err) + return 0, fmt.Errorf("gas search failed: %w", err) } return types.EthUint64(expectedGas), nil @@ -1488,11 +1488,13 @@ func (m *ethTxHashManager) ProcessSignedMessage(ctx context.Context, msg *types. ethTx, err := newEthTxFromSignedMessage(ctx, msg, m.chainAPI) if err != nil { log.Errorf("error converting filecoin message to eth tx: %s", err) + return } err = m.TransactionHashLookup.UpsertHash(ethTx.Hash, msg.Cid()) if err != nil { log.Errorf("error inserting tx mapping to db: %s", err) + return } } From 9e05e628878bb2f2c988efecc5f27ed47fb6b787 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 20 Feb 2023 16:04:11 +0800 Subject: [PATCH 10/11] fix: update nv10 per migration --- pkg/fork/fork.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/fork/fork.go b/pkg/fork/fork.go index ba61211266..64dd3146f4 100644 --- a/pkg/fork/fork.go +++ b/pkg/fork/fork.go @@ -364,8 +364,8 @@ func DefaultUpgradeSchedule(cf *ChainFork, upgradeHeight *config.ForkUpgradeConf Migration: cf.UpgradeActorsV10, PreMigrations: []PreMigration{{ PreMigration: cf.PreUpgradeActorsV10, - StartWithin: 180, - DontStartWithin: 60, + StartWithin: 60, + DontStartWithin: 10, StopWithin: 5, }}, Expensive: true, From 1be7d78ad3d7f9d4ffa8e4656fab4425f2dc2be7 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Mon, 20 Feb 2023 16:32:01 +0800 Subject: [PATCH 11/11] chore: use silent writer --- cmd/evm.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/evm.go b/cmd/evm.go index f9ba97adeb..1f633c0e8a 100644 --- a/cmd/evm.go +++ b/cmd/evm.go @@ -88,9 +88,9 @@ var evmGetInfoCmd = &cmds.Command{ } else { idAddr, err := chainAPI.StateLookupID(ctx, faddr, types.EmptyTSK) if err == nil { - fmt.Println("ID address: ", idAddr) - fmt.Println("Code cid: ", actor.Code.String()) - fmt.Println("Actor Type: ", builtin.ActorNameByCode(actor.Code)) + writer.Println("ID address: ", idAddr) + writer.Println("Code cid: ", actor.Code.String()) + writer.Println("Actor Type: ", builtin.ActorNameByCode(actor.Code)) } }