config: Fevm.EnableEthPRC
This commit is contained in:
parent
9463dc4a99
commit
66f5ee4ae9
@ -344,12 +344,11 @@
|
|||||||
|
|
||||||
|
|
||||||
[Fevm]
|
[Fevm]
|
||||||
# EnableEthHashToFilecoinCidMapping enables storing a mapping of eth transaction hashes to filecoin message Cids
|
# EnableEthPRC enables eth_ rpc, and enables storing a mapping of eth transaction hashes to filecoin message Cids.
|
||||||
# You will not be able to look up ethereum transactions by their hash if this is disabled.
|
|
||||||
#
|
#
|
||||||
# type: bool
|
# type: bool
|
||||||
# env var: LOTUS_FEVM_ENABLEETHHASHTOFILECOINCIDMAPPING
|
# env var: LOTUS_FEVM_ENABLEETHPRC
|
||||||
#EnableEthHashToFilecoinCidMapping = false
|
#EnableEthPRC = false
|
||||||
|
|
||||||
# EthTxHashMappingLifetimeDays the transaction hash lookup database will delete mappings that have been stored for more than x days
|
# EthTxHashMappingLifetimeDays the transaction hash lookup database will delete mappings that have been stored for more than x days
|
||||||
# Set to 0 to keep all mappings
|
# Set to 0 to keep all mappings
|
||||||
|
@ -41,7 +41,7 @@ func TestDeployment(t *testing.T) {
|
|||||||
cfg.ActorEvent.EnableRealTimeFilterAPI = true
|
cfg.ActorEvent.EnableRealTimeFilterAPI = true
|
||||||
return nil
|
return nil
|
||||||
}),
|
}),
|
||||||
kit.EthTxHashLookup(),
|
kit.EthRPC(),
|
||||||
)
|
)
|
||||||
ens.InterconnectAll().BeginMining(blockTime)
|
ens.InterconnectAll().BeginMining(blockTime)
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ func TestEthNewFilterCatchAll(t *testing.T) {
|
|||||||
kit.QuietMiningLogs()
|
kit.QuietMiningLogs()
|
||||||
|
|
||||||
blockTime := 100 * time.Millisecond
|
blockTime := 100 * time.Millisecond
|
||||||
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC(), kit.RealTimeFilterAPI(), kit.EthTxHashLookup())
|
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC(), kit.RealTimeFilterAPI(), kit.EthRPC())
|
||||||
ens.InterconnectAll().BeginMining(blockTime)
|
ens.InterconnectAll().BeginMining(blockTime)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||||
|
@ -16,7 +16,6 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
||||||
"github.com/filecoin-project/lotus/itests/kit"
|
"github.com/filecoin-project/lotus/itests/kit"
|
||||||
"github.com/filecoin-project/lotus/node/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestTransactionHashLookup tests to see if lotus correctly stores a mapping from ethereum transaction hash to
|
// TestTransactionHashLookup tests to see if lotus correctly stores a mapping from ethereum transaction hash to
|
||||||
@ -29,7 +28,7 @@ func TestTransactionHashLookup(t *testing.T) {
|
|||||||
t,
|
t,
|
||||||
kit.MockProofs(),
|
kit.MockProofs(),
|
||||||
kit.ThroughRPC(),
|
kit.ThroughRPC(),
|
||||||
kit.EthTxHashLookup(),
|
kit.EthRPC(),
|
||||||
)
|
)
|
||||||
ens.InterconnectAll().BeginMining(blocktime)
|
ens.InterconnectAll().BeginMining(blocktime)
|
||||||
|
|
||||||
@ -112,86 +111,6 @@ func TestTransactionHashLookup(t *testing.T) {
|
|||||||
require.Equal(t, uint64(*chainTx.TransactionIndex), uint64(0)) // only transaction
|
require.Equal(t, uint64(*chainTx.TransactionIndex), uint64(0)) // only transaction
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestTransactionHashLookupNoDb tests to see if looking up eth transactions by hash breaks without the lookup table
|
|
||||||
func TestTransactionHashLookupNoDb(t *testing.T) {
|
|
||||||
kit.QuietMiningLogs()
|
|
||||||
|
|
||||||
blocktime := 1 * time.Second
|
|
||||||
client, _, ens := kit.EnsembleMinimal(
|
|
||||||
t,
|
|
||||||
kit.MockProofs(),
|
|
||||||
kit.ThroughRPC(),
|
|
||||||
kit.WithCfgOpt(func(cfg *config.FullNode) error {
|
|
||||||
cfg.Fevm.EnableEthHashToFilecoinCidMapping = false
|
|
||||||
return nil
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
ens.InterconnectAll().BeginMining(blocktime)
|
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
// install contract
|
|
||||||
contractHex, err := os.ReadFile("./contracts/SimpleCoin.hex")
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
contract, err := hex.DecodeString(string(contractHex))
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
// create a new Ethereum account
|
|
||||||
key, ethAddr, deployer := client.EVM().NewAccount()
|
|
||||||
|
|
||||||
// send some funds to the f410 address
|
|
||||||
kit.SendFunds(ctx, t, client, deployer, types.FromFil(10))
|
|
||||||
|
|
||||||
gaslimit, err := client.EthEstimateGas(ctx, ethtypes.EthCall{
|
|
||||||
From: ðAddr,
|
|
||||||
Data: contract,
|
|
||||||
})
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
maxPriorityFeePerGas, err := client.EthMaxPriorityFeePerGas(ctx)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
// now deploy a contract from the embryo, and validate it went well
|
|
||||||
tx := ethtypes.EthTxArgs{
|
|
||||||
ChainID: build.Eip155ChainId,
|
|
||||||
Value: big.Zero(),
|
|
||||||
Nonce: 0,
|
|
||||||
MaxFeePerGas: types.NanoFil,
|
|
||||||
MaxPriorityFeePerGas: big.Int(maxPriorityFeePerGas),
|
|
||||||
GasLimit: int(gaslimit),
|
|
||||||
Input: contract,
|
|
||||||
V: big.Zero(),
|
|
||||||
R: big.Zero(),
|
|
||||||
S: big.Zero(),
|
|
||||||
}
|
|
||||||
|
|
||||||
client.EVM().SignTransaction(&tx, key.PrivateKey)
|
|
||||||
|
|
||||||
rawTxHash, err := tx.TxHash()
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
hash := client.EVM().SubmitTransaction(ctx, &tx)
|
|
||||||
require.Equal(t, rawTxHash, hash)
|
|
||||||
|
|
||||||
// We shouldn't be able to find the tx
|
|
||||||
mpoolTx, err := client.EthGetTransactionByHash(ctx, &hash)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Nil(t, mpoolTx)
|
|
||||||
|
|
||||||
// Wait for message to land on chain, we can't know exactly when because we can't find it.
|
|
||||||
time.Sleep(20 * blocktime)
|
|
||||||
receipt, err := client.EthGetTransactionReceipt(ctx, hash)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Nil(t, receipt)
|
|
||||||
|
|
||||||
// We still shouldn't be able to find the tx
|
|
||||||
chainTx, err := client.EthGetTransactionByHash(ctx, &hash)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Nil(t, chainTx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// TestTransactionHashLookupBlsFilecoinMessage tests to see if lotus can find a BLS Filecoin Message using the transaction hash
|
// TestTransactionHashLookupBlsFilecoinMessage tests to see if lotus can find a BLS Filecoin Message using the transaction hash
|
||||||
func TestTransactionHashLookupBlsFilecoinMessage(t *testing.T) {
|
func TestTransactionHashLookupBlsFilecoinMessage(t *testing.T) {
|
||||||
kit.QuietMiningLogs()
|
kit.QuietMiningLogs()
|
||||||
@ -201,7 +120,7 @@ func TestTransactionHashLookupBlsFilecoinMessage(t *testing.T) {
|
|||||||
t,
|
t,
|
||||||
kit.MockProofs(),
|
kit.MockProofs(),
|
||||||
kit.ThroughRPC(),
|
kit.ThroughRPC(),
|
||||||
kit.EthTxHashLookup(),
|
kit.EthRPC(),
|
||||||
)
|
)
|
||||||
ens.InterconnectAll().BeginMining(blocktime)
|
ens.InterconnectAll().BeginMining(blocktime)
|
||||||
|
|
||||||
@ -271,7 +190,7 @@ func TestTransactionHashLookupSecpFilecoinMessage(t *testing.T) {
|
|||||||
t,
|
t,
|
||||||
kit.MockProofs(),
|
kit.MockProofs(),
|
||||||
kit.ThroughRPC(),
|
kit.ThroughRPC(),
|
||||||
kit.EthTxHashLookup(),
|
kit.EthRPC(),
|
||||||
)
|
)
|
||||||
ens.InterconnectAll().BeginMining(blocktime)
|
ens.InterconnectAll().BeginMining(blocktime)
|
||||||
|
|
||||||
@ -348,7 +267,7 @@ func TestTransactionHashLookupNonexistentMessage(t *testing.T) {
|
|||||||
t,
|
t,
|
||||||
kit.MockProofs(),
|
kit.MockProofs(),
|
||||||
kit.ThroughRPC(),
|
kit.ThroughRPC(),
|
||||||
kit.EthTxHashLookup(),
|
kit.EthRPC(),
|
||||||
)
|
)
|
||||||
ens.InterconnectAll().BeginMining(blocktime)
|
ens.InterconnectAll().BeginMining(blocktime)
|
||||||
|
|
||||||
@ -379,7 +298,7 @@ func TestEthGetMessageCidByTransactionHashEthTx(t *testing.T) {
|
|||||||
t,
|
t,
|
||||||
kit.MockProofs(),
|
kit.MockProofs(),
|
||||||
kit.ThroughRPC(),
|
kit.ThroughRPC(),
|
||||||
kit.EthTxHashLookup(),
|
kit.EthRPC(),
|
||||||
)
|
)
|
||||||
ens.InterconnectAll().BeginMining(blocktime)
|
ens.InterconnectAll().BeginMining(blocktime)
|
||||||
|
|
||||||
@ -476,7 +395,7 @@ func TestEthGetMessageCidByTransactionHashSecp(t *testing.T) {
|
|||||||
t,
|
t,
|
||||||
kit.MockProofs(),
|
kit.MockProofs(),
|
||||||
kit.ThroughRPC(),
|
kit.ThroughRPC(),
|
||||||
kit.EthTxHashLookup(),
|
kit.EthRPC(),
|
||||||
)
|
)
|
||||||
ens.InterconnectAll().BeginMining(blocktime)
|
ens.InterconnectAll().BeginMining(blocktime)
|
||||||
|
|
||||||
@ -547,7 +466,7 @@ func TestEthGetMessageCidByTransactionHashBLS(t *testing.T) {
|
|||||||
t,
|
t,
|
||||||
kit.MockProofs(),
|
kit.MockProofs(),
|
||||||
kit.ThroughRPC(),
|
kit.ThroughRPC(),
|
||||||
kit.EthTxHashLookup(),
|
kit.EthRPC(),
|
||||||
)
|
)
|
||||||
ens.InterconnectAll().BeginMining(blocktime)
|
ens.InterconnectAll().BeginMining(blocktime)
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
func TestValueTransferValidSignature(t *testing.T) {
|
func TestValueTransferValidSignature(t *testing.T) {
|
||||||
blockTime := 100 * time.Millisecond
|
blockTime := 100 * time.Millisecond
|
||||||
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC(), kit.EthTxHashLookup())
|
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC(), kit.EthRPC())
|
||||||
|
|
||||||
ens.InterconnectAll().BeginMining(blockTime)
|
ens.InterconnectAll().BeginMining(blockTime)
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ func TestLegacyTransaction(t *testing.T) {
|
|||||||
func TestContractDeploymentValidSignature(t *testing.T) {
|
func TestContractDeploymentValidSignature(t *testing.T) {
|
||||||
|
|
||||||
blockTime := 100 * time.Millisecond
|
blockTime := 100 * time.Millisecond
|
||||||
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC(), kit.EthTxHashLookup())
|
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC(), kit.EthRPC())
|
||||||
|
|
||||||
ens.InterconnectAll().BeginMining(blockTime)
|
ens.InterconnectAll().BeginMining(blockTime)
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ func TestContractDeploymentValidSignature(t *testing.T) {
|
|||||||
|
|
||||||
func TestContractInvocation(t *testing.T) {
|
func TestContractInvocation(t *testing.T) {
|
||||||
blockTime := 100 * time.Millisecond
|
blockTime := 100 * time.Millisecond
|
||||||
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC(), kit.EthTxHashLookup())
|
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC(), kit.EthRPC())
|
||||||
|
|
||||||
ens.InterconnectAll().BeginMining(blockTime)
|
ens.InterconnectAll().BeginMining(blockTime)
|
||||||
|
|
||||||
|
@ -297,9 +297,9 @@ func HistoricFilterAPI(dbpath string) NodeOpt {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func EthTxHashLookup() NodeOpt {
|
func EthRPC() NodeOpt {
|
||||||
return WithCfgOpt(func(cfg *config.FullNode) error {
|
return WithCfgOpt(func(cfg *config.FullNode) error {
|
||||||
cfg.Fevm.EnableEthHashToFilecoinCidMapping = true
|
cfg.Fevm.EnableEthPRC = true
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,8 @@ func ConfigFullNode(c interface{}) Option {
|
|||||||
// in lite-mode Eth event api is provided by gateway
|
// in lite-mode Eth event api is provided by gateway
|
||||||
ApplyIf(isFullNode, Override(new(full.EthEventAPI), modules.EthEventAPI(cfg.ActorEvent))),
|
ApplyIf(isFullNode, Override(new(full.EthEventAPI), modules.EthEventAPI(cfg.ActorEvent))),
|
||||||
|
|
||||||
Override(new(full.EthModuleAPI), modules.EthModuleAPI(cfg.Fevm)),
|
If(cfg.Fevm.EnableEthPRC, Override(new(full.EthModuleAPI), modules.EthModuleAPI(cfg.Fevm))),
|
||||||
|
If(!cfg.Fevm.EnableEthPRC, Override(new(full.EthModuleAPI), &full.EthModuleDummy{})),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ func DefaultFullNode() *FullNode {
|
|||||||
MaxFilterHeightRange: 2880, // conservative limit of one day
|
MaxFilterHeightRange: 2880, // conservative limit of one day
|
||||||
},
|
},
|
||||||
Fevm: FevmConfig{
|
Fevm: FevmConfig{
|
||||||
EnableEthHashToFilecoinCidMapping: false,
|
EnableEthPRC: false,
|
||||||
EthTxHashMappingLifetimeDays: 0,
|
EthTxHashMappingLifetimeDays: 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -401,11 +401,10 @@ see https://lotus.filecoin.io/storage-providers/advanced-configurations/market/#
|
|||||||
},
|
},
|
||||||
"FevmConfig": []DocField{
|
"FevmConfig": []DocField{
|
||||||
{
|
{
|
||||||
Name: "EnableEthHashToFilecoinCidMapping",
|
Name: "EnableEthPRC",
|
||||||
Type: "bool",
|
Type: "bool",
|
||||||
|
|
||||||
Comment: `EnableEthHashToFilecoinCidMapping enables storing a mapping of eth transaction hashes to filecoin message Cids
|
Comment: `EnableEthPRC enables eth_ rpc, and enables storing a mapping of eth transaction hashes to filecoin message Cids.`,
|
||||||
You will not be able to look up ethereum transactions by their hash if this is disabled.`,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "EthTxHashMappingLifetimeDays",
|
Name: "EthTxHashMappingLifetimeDays",
|
||||||
|
@ -695,9 +695,9 @@ type ActorEventConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FevmConfig struct {
|
type FevmConfig struct {
|
||||||
// EnableEthHashToFilecoinCidMapping enables storing a mapping of eth transaction hashes to filecoin message Cids
|
// EnableEthPRC enables eth_ rpc, and enables storing a mapping of eth transaction hashes to filecoin message Cids.
|
||||||
// You will not be able to look up ethereum transactions by their hash if this is disabled.
|
EnableEthPRC bool
|
||||||
EnableEthHashToFilecoinCidMapping bool
|
|
||||||
// EthTxHashMappingLifetimeDays the transaction hash lookup database will delete mappings that have been stored for more than x days
|
// EthTxHashMappingLifetimeDays the transaction hash lookup database will delete mappings that have been stored for more than x days
|
||||||
// Set to 0 to keep all mappings
|
// Set to 0 to keep all mappings
|
||||||
EthTxHashMappingLifetimeDays int
|
EthTxHashMappingLifetimeDays int
|
||||||
|
@ -4,106 +4,118 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrImplementMe = errors.New("Not implemented yet")
|
var ErrModuleDisabled = errors.New("module disabled, enable with Fevm.EnableEthPRC / LOTUS_FEVM_ENABLEETHPRC")
|
||||||
|
|
||||||
type EthModuleDummy struct{}
|
type EthModuleDummy struct{}
|
||||||
|
|
||||||
|
func (e *EthModuleDummy) EthGetMessageCidByTransactionHash(ctx context.Context, txHash *ethtypes.EthHash) (*cid.Cid, error) {
|
||||||
|
return nil, ErrModuleDisabled
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EthModuleDummy) EthGetTransactionHashByCid(ctx context.Context, cid cid.Cid) (*ethtypes.EthHash, error) {
|
||||||
|
return nil, ErrModuleDisabled
|
||||||
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error) {
|
func (e *EthModuleDummy) EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error) {
|
||||||
return 0, ErrImplementMe
|
return 0, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error) {
|
func (e *EthModuleDummy) EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error) {
|
||||||
return nil, ErrImplementMe
|
return nil, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum ethtypes.EthUint64) (ethtypes.EthUint64, error) {
|
func (e *EthModuleDummy) EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum ethtypes.EthUint64) (ethtypes.EthUint64, error) {
|
||||||
return 0, ErrImplementMe
|
return 0, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetBlockTransactionCountByHash(ctx context.Context, blkHash ethtypes.EthHash) (ethtypes.EthUint64, error) {
|
func (e *EthModuleDummy) EthGetBlockTransactionCountByHash(ctx context.Context, blkHash ethtypes.EthHash) (ethtypes.EthUint64, error) {
|
||||||
return 0, ErrImplementMe
|
return 0, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error) {
|
func (e *EthModuleDummy) EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error) {
|
||||||
return ethtypes.EthBlock{}, ErrImplementMe
|
return ethtypes.EthBlock{}, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error) {
|
func (e *EthModuleDummy) EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error) {
|
||||||
return ethtypes.EthBlock{}, ErrImplementMe
|
return ethtypes.EthBlock{}, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error) {
|
func (e *EthModuleDummy) EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error) {
|
||||||
return nil, ErrImplementMe
|
return nil, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkOpt string) (ethtypes.EthUint64, error) {
|
func (e *EthModuleDummy) EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkOpt string) (ethtypes.EthUint64, error) {
|
||||||
return 0, ErrImplementMe
|
return 0, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*api.EthTxReceipt, error) {
|
func (e *EthModuleDummy) EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*api.EthTxReceipt, error) {
|
||||||
return nil, ErrImplementMe
|
return nil, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) {
|
func (e *EthModuleDummy) EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) {
|
||||||
return ethtypes.EthTx{}, ErrImplementMe
|
return ethtypes.EthTx{}, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum ethtypes.EthUint64, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) {
|
func (e *EthModuleDummy) EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum ethtypes.EthUint64, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) {
|
||||||
return ethtypes.EthTx{}, ErrImplementMe
|
return ethtypes.EthTx{}, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetCode(ctx context.Context, address ethtypes.EthAddress, blkOpt string) (ethtypes.EthBytes, error) {
|
func (e *EthModuleDummy) EthGetCode(ctx context.Context, address ethtypes.EthAddress, blkOpt string) (ethtypes.EthBytes, error) {
|
||||||
return nil, ErrImplementMe
|
return nil, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetStorageAt(ctx context.Context, address ethtypes.EthAddress, position ethtypes.EthBytes, blkParam string) (ethtypes.EthBytes, error) {
|
func (e *EthModuleDummy) EthGetStorageAt(ctx context.Context, address ethtypes.EthAddress, position ethtypes.EthBytes, blkParam string) (ethtypes.EthBytes, error) {
|
||||||
return nil, ErrImplementMe
|
return nil, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGetBalance(ctx context.Context, address ethtypes.EthAddress, blkParam string) (ethtypes.EthBigInt, error) {
|
func (e *EthModuleDummy) EthGetBalance(ctx context.Context, address ethtypes.EthAddress, blkParam string) (ethtypes.EthBigInt, error) {
|
||||||
return ethtypes.EthBigIntZero, ErrImplementMe
|
return ethtypes.EthBigIntZero, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthFeeHistory(ctx context.Context, blkCount ethtypes.EthUint64, newestBlk string, rewardPercentiles []float64) (ethtypes.EthFeeHistory, error) {
|
func (e *EthModuleDummy) EthFeeHistory(ctx context.Context, blkCount ethtypes.EthUint64, newestBlk string, rewardPercentiles []float64) (ethtypes.EthFeeHistory, error) {
|
||||||
return ethtypes.EthFeeHistory{}, ErrImplementMe
|
return ethtypes.EthFeeHistory{}, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthChainId(ctx context.Context) (ethtypes.EthUint64, error) {
|
func (e *EthModuleDummy) EthChainId(ctx context.Context) (ethtypes.EthUint64, error) {
|
||||||
return 0, ErrImplementMe
|
return 0, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) NetVersion(ctx context.Context) (string, error) {
|
func (e *EthModuleDummy) NetVersion(ctx context.Context) (string, error) {
|
||||||
return "", ErrImplementMe
|
return "", ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) NetListening(ctx context.Context) (bool, error) {
|
func (e *EthModuleDummy) NetListening(ctx context.Context) (bool, error) {
|
||||||
return false, ErrImplementMe
|
return false, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthProtocolVersion(ctx context.Context) (ethtypes.EthUint64, error) {
|
func (e *EthModuleDummy) EthProtocolVersion(ctx context.Context) (ethtypes.EthUint64, error) {
|
||||||
return 0, ErrImplementMe
|
return 0, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthGasPrice(ctx context.Context) (ethtypes.EthBigInt, error) {
|
func (e *EthModuleDummy) EthGasPrice(ctx context.Context) (ethtypes.EthBigInt, error) {
|
||||||
return ethtypes.EthBigIntZero, ErrImplementMe
|
return ethtypes.EthBigIntZero, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthEstimateGas(ctx context.Context, tx ethtypes.EthCall) (ethtypes.EthUint64, error) {
|
func (e *EthModuleDummy) EthEstimateGas(ctx context.Context, tx ethtypes.EthCall) (ethtypes.EthUint64, error) {
|
||||||
return 0, ErrImplementMe
|
return 0, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthCall(ctx context.Context, tx ethtypes.EthCall, blkParam string) (ethtypes.EthBytes, error) {
|
func (e *EthModuleDummy) EthCall(ctx context.Context, tx ethtypes.EthCall, blkParam string) (ethtypes.EthBytes, error) {
|
||||||
return nil, ErrImplementMe
|
return nil, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthMaxPriorityFeePerGas(ctx context.Context) (ethtypes.EthBigInt, error) {
|
func (e *EthModuleDummy) EthMaxPriorityFeePerGas(ctx context.Context) (ethtypes.EthBigInt, error) {
|
||||||
return ethtypes.EthBigIntZero, ErrImplementMe
|
return ethtypes.EthBigIntZero, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EthModuleDummy) EthSendRawTransaction(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error) {
|
func (e *EthModuleDummy) EthSendRawTransaction(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error) {
|
||||||
return ethtypes.EthHash{}, ErrImplementMe
|
return ethtypes.EthHash{}, ErrModuleDisabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ EthModuleAPI = &EthModuleDummy{}
|
||||||
|
@ -258,7 +258,7 @@ func (a *EthModule) EthGetTransactionByHash(ctx context.Context, txHash *ethtype
|
|||||||
}
|
}
|
||||||
|
|
||||||
c := cid.Undef
|
c := cid.Undef
|
||||||
if a.EthTxHashManager != nil {
|
if a.EthTxHashManager != nil { // todo rm checks
|
||||||
var err error
|
var err error
|
||||||
c, err = a.EthTxHashManager.TransactionHashLookup.GetCidFromHash(*txHash)
|
c, err = a.EthTxHashManager.TransactionHashLookup.GetCidFromHash(*txHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -28,11 +28,6 @@ func EthModuleAPI(cfg config.FevmConfig) func(helpers.MetricsCtx, repo.LockedRep
|
|||||||
StateAPI: stateapi,
|
StateAPI: stateapi,
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.EnableEthHashToFilecoinCidMapping {
|
|
||||||
// mapping functionality disabled. Nothing to do here
|
|
||||||
return em, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
dbPath, err := r.SqlitePath()
|
dbPath, err := r.SqlitePath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user