review fixes
This commit is contained in:
@@ -261,7 +261,7 @@ func ConfigFullNode(c interface{}) Option {
|
||||
// in lite-mode Eth event api is provided by gateway
|
||||
ApplyIf(isFullNode, Override(new(full.EthEventAPI), modules.EthEventAPI(cfg.ActorEvent))),
|
||||
|
||||
Override(new(full.EthModuleAPI), modules.EthModuleAPI(cfg.EthTxHashConfig)),
|
||||
Override(new(full.EthModuleAPI), modules.EthModuleAPI(cfg.Fevm)),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -107,8 +107,8 @@ func DefaultFullNode() *FullNode {
|
||||
MaxFilterResults: 10000,
|
||||
MaxFilterHeightRange: 2880, // conservative limit of one day
|
||||
},
|
||||
EthTxHashConfig: EthTxHashConfig{
|
||||
EnableEthHashToFilecoinCidMapping: true,
|
||||
Fevm: FevmConfig{
|
||||
EnableEthHashToFilecoinCidMapping: false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -391,14 +391,6 @@ see https://lotus.filecoin.io/storage-providers/advanced-configurations/market/#
|
||||
Comment: ``,
|
||||
},
|
||||
},
|
||||
"EthTxHashConfig": []DocField{
|
||||
{
|
||||
Name: "EnableEthHashToFilecoinCidMapping",
|
||||
Type: "bool",
|
||||
|
||||
Comment: `EnableEthHashToFilecoinCidMapping enables storing a mapping of eth transaction hashes to filecoin message Cids`,
|
||||
},
|
||||
},
|
||||
"FeeConfig": []DocField{
|
||||
{
|
||||
Name: "DefaultMaxFee",
|
||||
@@ -407,6 +399,14 @@ see https://lotus.filecoin.io/storage-providers/advanced-configurations/market/#
|
||||
Comment: ``,
|
||||
},
|
||||
},
|
||||
"FevmConfig": []DocField{
|
||||
{
|
||||
Name: "EnableEthHashToFilecoinCidMapping",
|
||||
Type: "bool",
|
||||
|
||||
Comment: `EnableEthHashToFilecoinCidMapping enables storing a mapping of eth transaction hashes to filecoin message Cids`,
|
||||
},
|
||||
},
|
||||
"FullNode": []DocField{
|
||||
{
|
||||
Name: "Client",
|
||||
@@ -445,8 +445,8 @@ see https://lotus.filecoin.io/storage-providers/advanced-configurations/market/#
|
||||
Comment: ``,
|
||||
},
|
||||
{
|
||||
Name: "EthTxHashConfig",
|
||||
Type: "EthTxHashConfig",
|
||||
Name: "Fevm",
|
||||
Type: "FevmConfig",
|
||||
|
||||
Comment: ``,
|
||||
},
|
||||
|
||||
@@ -22,13 +22,13 @@ type Common struct {
|
||||
// FullNode is a full node config
|
||||
type FullNode struct {
|
||||
Common
|
||||
Client Client
|
||||
Wallet Wallet
|
||||
Fees FeeConfig
|
||||
Chainstore Chainstore
|
||||
Cluster UserRaftConfig
|
||||
ActorEvent ActorEventConfig
|
||||
EthTxHashConfig EthTxHashConfig
|
||||
Client Client
|
||||
Wallet Wallet
|
||||
Fees FeeConfig
|
||||
Chainstore Chainstore
|
||||
Cluster UserRaftConfig
|
||||
ActorEvent ActorEventConfig
|
||||
Fevm FevmConfig
|
||||
}
|
||||
|
||||
// // Common
|
||||
@@ -694,7 +694,7 @@ type ActorEventConfig struct {
|
||||
// Set upper bound on index size
|
||||
}
|
||||
|
||||
type EthTxHashConfig struct {
|
||||
type FevmConfig struct {
|
||||
// EnableEthHashToFilecoinCidMapping enables storing a mapping of eth transaction hashes to filecoin message Cids
|
||||
EnableEthHashToFilecoinCidMapping bool
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
builtinactors "github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/ethhashlookup"
|
||||
"github.com/filecoin-project/lotus/chain/events/filter"
|
||||
"github.com/filecoin-project/lotus/chain/messagepool"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
@@ -1760,7 +1760,7 @@ func newEthTxReceipt(ctx context.Context, tx ethtypes.EthTx, lookup *api.MsgLook
|
||||
return receipt, nil
|
||||
}
|
||||
|
||||
func (m EthTxHashManager) Apply(ctx context.Context, from, to *types.TipSet) error {
|
||||
func (m *EthTxHashManager) Apply(ctx context.Context, from, to *types.TipSet) error {
|
||||
for _, blk := range to.Blocks() {
|
||||
_, smsgs, err := m.StateAPI.Chain.MessagesForBlock(ctx, blk)
|
||||
if err != nil {
|
||||
@@ -1789,10 +1789,10 @@ func (m EthTxHashManager) Apply(ctx context.Context, from, to *types.TipSet) err
|
||||
|
||||
type EthTxHashManager struct {
|
||||
StateAPI StateAPI
|
||||
TransactionHashLookup *chain.TransactionHashLookup
|
||||
TransactionHashLookup *ethhashlookup.TransactionHashLookup
|
||||
}
|
||||
|
||||
func (m EthTxHashManager) Revert(ctx context.Context, from, to *types.TipSet) error {
|
||||
func (m *EthTxHashManager) Revert(ctx context.Context, from, to *types.TipSet) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1814,7 +1814,7 @@ func WaitForMpoolUpdates(ctx context.Context, ch <-chan api.MpoolUpdate, manager
|
||||
log.Errorf("error converting filecoin message to eth tx: %s", err)
|
||||
}
|
||||
|
||||
err = manager.TransactionHashLookup.InsertTxHash(ethTx.Hash, u.Message.Cid(), chain.MemPoolEpoch)
|
||||
err = manager.TransactionHashLookup.InsertTxHash(ethTx.Hash, u.Message.Cid(), ethhashlookup.MemPoolEpoch)
|
||||
if err != nil {
|
||||
log.Errorf("error inserting tx mapping to db: %s", err)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"go.uber.org/fx"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain"
|
||||
"github.com/filecoin-project/lotus/chain/ethhashlookup"
|
||||
"github.com/filecoin-project/lotus/chain/events"
|
||||
"github.com/filecoin-project/lotus/chain/messagepool"
|
||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
)
|
||||
|
||||
func EthModuleAPI(cfg config.EthTxHashConfig) func(helpers.MetricsCtx, repo.LockedRepo, fx.Lifecycle, *store.ChainStore, *stmgr.StateManager, EventAPI, *messagepool.MessagePool, full.StateAPI, full.ChainAPI, full.MpoolAPI) (*full.EthModule, error) {
|
||||
func EthModuleAPI(cfg config.FevmConfig) func(helpers.MetricsCtx, repo.LockedRepo, fx.Lifecycle, *store.ChainStore, *stmgr.StateManager, EventAPI, *messagepool.MessagePool, full.StateAPI, full.ChainAPI, full.MpoolAPI) (*full.EthModule, error) {
|
||||
return func(mctx helpers.MetricsCtx, r repo.LockedRepo, lc fx.Lifecycle, cs *store.ChainStore, sm *stmgr.StateManager, evapi EventAPI, mp *messagepool.MessagePool, stateapi full.StateAPI, chainapi full.ChainAPI, mpoolapi full.MpoolAPI) (*full.EthModule, error) {
|
||||
em := &full.EthModule{
|
||||
Chain: cs,
|
||||
@@ -38,7 +38,7 @@ func EthModuleAPI(cfg config.EthTxHashConfig) func(helpers.MetricsCtx, repo.Lock
|
||||
return nil, err
|
||||
}
|
||||
|
||||
transactionHashLookup, err := chain.NewTransactionHashLookup(filepath.Join(dbPath + "txHash.db"))
|
||||
transactionHashLookup, err := ethhashlookup.NewTransactionHashLookup(filepath.Join(dbPath, "txhash.db"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user