2023-01-13 19:11:13 +00:00
|
|
|
package full
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
|
2023-01-19 17:06:59 +00:00
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
|
2023-02-15 19:17:00 +00:00
|
|
|
"github.com/filecoin-project/go-address"
|
2023-02-02 13:52:01 +00:00
|
|
|
"github.com/filecoin-project/go-jsonrpc"
|
2023-03-14 04:59:16 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
2023-02-02 13:52:01 +00:00
|
|
|
|
2023-01-13 19:11:13 +00:00
|
|
|
"github.com/filecoin-project/lotus/api"
|
|
|
|
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
|
|
|
)
|
|
|
|
|
2023-02-03 15:57:39 +00:00
|
|
|
var ErrModuleDisabled = errors.New("module disabled, enable with Fevm.EnableEthRPC / LOTUS_FEVM_ENABLEETHRPC")
|
2023-01-13 19:11:13 +00:00
|
|
|
|
|
|
|
type EthModuleDummy struct{}
|
|
|
|
|
2023-02-15 19:17:00 +00:00
|
|
|
func (e *EthModuleDummy) EthAddressToFilecoinAddress(ctx context.Context, ethAddress ethtypes.EthAddress) (address.Address, error) {
|
|
|
|
return address.Undef, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
2023-01-19 17:06:59 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-01-13 19:11:13 +00:00
|
|
|
func (e *EthModuleDummy) EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return 0, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return nil, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum ethtypes.EthUint64) (ethtypes.EthUint64, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return 0, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGetBlockTransactionCountByHash(ctx context.Context, blkHash ethtypes.EthHash) (ethtypes.EthUint64, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return 0, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return ethtypes.EthBlock{}, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return ethtypes.EthBlock{}, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return nil, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
2023-03-14 04:59:16 +00:00
|
|
|
func (e *EthModuleDummy) EthGetTransactionByHashLimited(ctx context.Context, txHash *ethtypes.EthHash, limit abi.ChainEpoch) (*ethtypes.EthTx, error) {
|
|
|
|
return nil, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
2023-06-21 17:36:04 +00:00
|
|
|
func (e *EthModuleDummy) EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthUint64, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return 0, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*api.EthTxReceipt, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return nil, ErrModuleDisabled
|
2023-03-14 04:59:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGetTransactionReceiptLimited(ctx context.Context, txHash ethtypes.EthHash, limit abi.ChainEpoch) (*api.EthTxReceipt, error) {
|
|
|
|
return nil, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return ethtypes.EthTx{}, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum ethtypes.EthUint64, txIndex ethtypes.EthUint64) (ethtypes.EthTx, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return ethtypes.EthTx{}, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
2023-06-21 17:36:04 +00:00
|
|
|
func (e *EthModuleDummy) EthGetCode(ctx context.Context, address ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return nil, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
2023-06-21 17:36:04 +00:00
|
|
|
func (e *EthModuleDummy) EthGetStorageAt(ctx context.Context, address ethtypes.EthAddress, position ethtypes.EthBytes, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return nil, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
2023-06-21 17:36:04 +00:00
|
|
|
func (e *EthModuleDummy) EthGetBalance(ctx context.Context, address ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBigInt, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return ethtypes.EthBigIntZero, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
2023-02-10 18:33:59 +00:00
|
|
|
func (e *EthModuleDummy) EthFeeHistory(ctx context.Context, p jsonrpc.RawParams) (ethtypes.EthFeeHistory, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return ethtypes.EthFeeHistory{}, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthChainId(ctx context.Context) (ethtypes.EthUint64, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return 0, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
2023-04-21 12:02:40 +00:00
|
|
|
func (e *EthModuleDummy) EthSyncing(ctx context.Context) (ethtypes.EthSyncingResult, error) {
|
|
|
|
return ethtypes.EthSyncingResult{}, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
2023-01-13 19:11:13 +00:00
|
|
|
func (e *EthModuleDummy) NetVersion(ctx context.Context) (string, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return "", ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) NetListening(ctx context.Context) (bool, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return false, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthProtocolVersion(ctx context.Context) (ethtypes.EthUint64, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return 0, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGasPrice(ctx context.Context) (ethtypes.EthBigInt, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return ethtypes.EthBigIntZero, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthEstimateGas(ctx context.Context, tx ethtypes.EthCall) (ethtypes.EthUint64, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return 0, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
2023-06-21 17:36:04 +00:00
|
|
|
func (e *EthModuleDummy) EthCall(ctx context.Context, tx ethtypes.EthCall, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return nil, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthMaxPriorityFeePerGas(ctx context.Context) (ethtypes.EthBigInt, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return ethtypes.EthBigIntZero, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthSendRawTransaction(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error) {
|
2023-01-19 17:06:59 +00:00
|
|
|
return ethtypes.EthHash{}, ErrModuleDisabled
|
2023-01-13 19:11:13 +00:00
|
|
|
}
|
2023-01-19 17:06:59 +00:00
|
|
|
|
2023-01-25 03:59:46 +00:00
|
|
|
func (e *EthModuleDummy) Web3ClientVersion(ctx context.Context) (string, error) {
|
2023-01-25 03:56:04 +00:00
|
|
|
return "", ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
2023-02-02 13:52:01 +00:00
|
|
|
func (e *EthModuleDummy) EthGetLogs(ctx context.Context, filter *ethtypes.EthFilterSpec) (*ethtypes.EthFilterResult, error) {
|
|
|
|
return ðtypes.EthFilterResult{}, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGetFilterChanges(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) {
|
|
|
|
return ðtypes.EthFilterResult{}, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthGetFilterLogs(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error) {
|
|
|
|
return ðtypes.EthFilterResult{}, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthNewFilter(ctx context.Context, filter *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error) {
|
|
|
|
return ethtypes.EthFilterID{}, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthNewBlockFilter(ctx context.Context) (ethtypes.EthFilterID, error) {
|
|
|
|
return ethtypes.EthFilterID{}, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthNewPendingTransactionFilter(ctx context.Context) (ethtypes.EthFilterID, error) {
|
|
|
|
return ethtypes.EthFilterID{}, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthUninstallFilter(ctx context.Context, id ethtypes.EthFilterID) (bool, error) {
|
|
|
|
return false, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthSubscribe(ctx context.Context, params jsonrpc.RawParams) (ethtypes.EthSubscriptionID, error) {
|
|
|
|
return ethtypes.EthSubscriptionID{}, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthUnsubscribe(ctx context.Context, id ethtypes.EthSubscriptionID) (bool, error) {
|
|
|
|
return false, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
2023-09-21 15:37:02 +00:00
|
|
|
func (e *EthModuleDummy) EthTraceBlock(ctx context.Context, blkNum string) ([]*ethtypes.EthTraceBlock, error) {
|
|
|
|
return nil, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EthModuleDummy) EthTraceReplayBlockTransactions(ctx context.Context, blkNum string, traceTypes []string) ([]*ethtypes.EthTraceReplayBlockTransaction, error) {
|
|
|
|
return nil, ErrModuleDisabled
|
|
|
|
}
|
|
|
|
|
2023-01-19 17:06:59 +00:00
|
|
|
var _ EthModuleAPI = &EthModuleDummy{}
|
2023-02-02 13:52:01 +00:00
|
|
|
var _ EthEventAPI = &EthModuleDummy{}
|