forked from cerc-io/laconicd-deprecated
evm: remove tx logs and block bloom from chain state (#556)
Closes #452 fix unit tests changelog and fix lint fix unit test Update ethereum/rpc/backend/backend.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> Update ethereum/rpc/backend/utils.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> changelog Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Federico Kunze Küllmer
parent
3f1eeb30b6
commit
116de54617
@@ -55,10 +55,6 @@ func InitGenesis(
|
||||
}
|
||||
}
|
||||
|
||||
for _, txLog := range data.TxsLogs {
|
||||
k.SetLogs(common.HexToHash(txLog.Hash), txLog.EthLogs())
|
||||
}
|
||||
|
||||
return []abci.ValidatorUpdate{}
|
||||
}
|
||||
|
||||
@@ -93,7 +89,6 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper, ak types.AccountKeeper) *t
|
||||
|
||||
return &types.GenesisState{
|
||||
Accounts: ethGenAccounts,
|
||||
TxsLogs: k.GetAllTxLogs(ctx),
|
||||
Params: k.GetParams(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.Vali
|
||||
k.WithContext(infCtx)
|
||||
|
||||
bloom := ethtypes.BytesToBloom(k.GetBlockBloomTransient().Bytes())
|
||||
k.SetBlockBloom(infCtx, req.Height, bloom)
|
||||
k.EmitBlockBloomEvent(infCtx, bloom)
|
||||
|
||||
k.WithContext(ctx)
|
||||
|
||||
|
||||
@@ -14,10 +14,7 @@ import (
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/cosmos/cosmos-sdk/types/query"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
@@ -199,126 +196,6 @@ func (k Keeper) Code(c context.Context, req *types.QueryCodeRequest) (*types.Que
|
||||
}, nil
|
||||
}
|
||||
|
||||
// TxLogs implements the Query/TxLogs gRPC method
|
||||
func (k Keeper) TxLogs(c context.Context, req *types.QueryTxLogsRequest) (*types.QueryTxLogsResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "empty request")
|
||||
}
|
||||
|
||||
if ethermint.IsEmptyHash(req.Hash) {
|
||||
return nil, status.Error(
|
||||
codes.InvalidArgument,
|
||||
types.ErrEmptyHash.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
k.WithContext(ctx)
|
||||
|
||||
hash := common.HexToHash(req.Hash)
|
||||
|
||||
store := prefix.NewStore(k.Ctx().KVStore(k.storeKey), append(types.KeyPrefixLogs, hash.Bytes()...))
|
||||
|
||||
var logs []*types.Log
|
||||
|
||||
pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error {
|
||||
var log types.Log
|
||||
if err := k.cdc.Unmarshal(value, &log); err != nil {
|
||||
return err
|
||||
}
|
||||
logs = append(logs, &log)
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
return &types.QueryTxLogsResponse{
|
||||
Logs: logs,
|
||||
Pagination: pageRes,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// BlockLogs implements the Query/BlockLogs gRPC method
|
||||
func (k Keeper) BlockLogs(c context.Context, req *types.QueryBlockLogsRequest) (*types.QueryBlockLogsResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "empty request")
|
||||
}
|
||||
|
||||
if ethermint.IsEmptyHash(req.Hash) {
|
||||
return nil, status.Error(
|
||||
codes.InvalidArgument,
|
||||
types.ErrEmptyHash.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixLogs)
|
||||
|
||||
mapOrder := []string{}
|
||||
logs := make(map[string][]*types.Log)
|
||||
|
||||
pageRes, err := query.FilteredPaginate(store, req.Pagination, func(_, value []byte, accumulate bool) (bool, error) {
|
||||
var txLog types.Log
|
||||
if err := k.cdc.Unmarshal(value, &txLog); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
if txLog.BlockHash == req.Hash {
|
||||
if accumulate {
|
||||
if len(logs[txLog.TxHash]) == 0 {
|
||||
mapOrder = append(mapOrder, txLog.TxHash)
|
||||
}
|
||||
|
||||
logs[txLog.TxHash] = append(logs[txLog.TxHash], &txLog)
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
txsLogs := []types.TransactionLogs{}
|
||||
for _, txHash := range mapOrder {
|
||||
if len(logs[txHash]) > 0 {
|
||||
txsLogs = append(txsLogs, types.TransactionLogs{Hash: txHash, Logs: logs[txHash]})
|
||||
}
|
||||
}
|
||||
|
||||
return &types.QueryBlockLogsResponse{
|
||||
TxLogs: txsLogs,
|
||||
Pagination: pageRes,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// BlockBloom implements the Query/BlockBloom gRPC method
|
||||
func (k Keeper) BlockBloom(c context.Context, req *types.QueryBlockBloomRequest) (*types.QueryBlockBloomResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
bloom, found := k.GetBlockBloom(ctx, req.Height)
|
||||
if !found {
|
||||
// if the bloom is not found, query the transient store at the current height
|
||||
k.WithContext(ctx)
|
||||
bloomInt := k.GetBlockBloomTransient()
|
||||
|
||||
if bloomInt.Sign() == 0 {
|
||||
return nil, status.Error(
|
||||
codes.NotFound, sdkerrors.Wrapf(types.ErrBloomNotFound, "height: %d", req.Height).Error(),
|
||||
)
|
||||
}
|
||||
|
||||
bloom = ethtypes.BytesToBloom(bloomInt.Bytes())
|
||||
}
|
||||
|
||||
return &types.QueryBlockBloomResponse{
|
||||
Bloom: bloom.Bytes(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Params implements the Query/Params gRPC method
|
||||
func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
+13
-226
@@ -5,19 +5,14 @@ import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"google.golang.org/grpc/metadata"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
ethermint "github.com/tharsis/ethermint/types"
|
||||
"github.com/tharsis/ethermint/x/evm/types"
|
||||
|
||||
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
|
||||
)
|
||||
|
||||
// Not valid Ethereum address
|
||||
@@ -341,38 +336,25 @@ func (suite *KeeperTestSuite) TestQueryCode() {
|
||||
|
||||
func (suite *KeeperTestSuite) TestQueryTxLogs() {
|
||||
var (
|
||||
req *types.QueryTxLogsRequest
|
||||
txHash common.Hash
|
||||
expLogs []*types.Log
|
||||
)
|
||||
|
||||
testCases := []struct {
|
||||
msg string
|
||||
malleate func()
|
||||
expPass bool
|
||||
}{
|
||||
{
|
||||
"empty hash",
|
||||
"empty logs",
|
||||
func() {
|
||||
req = &types.QueryTxLogsRequest{
|
||||
Hash: common.Hash{}.String(),
|
||||
}
|
||||
txHash = common.BytesToHash([]byte("hash"))
|
||||
expLogs = nil
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"logs not found",
|
||||
func() {
|
||||
hash := common.BytesToHash([]byte("hash"))
|
||||
req = &types.QueryTxLogsRequest{
|
||||
Hash: hash.String(),
|
||||
}
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
hash := common.BytesToHash([]byte("tx_hash"))
|
||||
txHash = common.BytesToHash([]byte("tx_hash"))
|
||||
|
||||
expLogs = []*types.Log{
|
||||
{
|
||||
@@ -380,21 +362,20 @@ func (suite *KeeperTestSuite) TestQueryTxLogs() {
|
||||
Topics: []string{common.BytesToHash([]byte("topic")).String()},
|
||||
Data: []byte("data"),
|
||||
BlockNumber: 1,
|
||||
TxHash: hash.String(),
|
||||
TxHash: txHash.String(),
|
||||
TxIndex: 1,
|
||||
BlockHash: common.BytesToHash([]byte("block_hash")).String(),
|
||||
BlockHash: common.BytesToHash(suite.ctx.HeaderHash()).Hex(),
|
||||
Index: 0,
|
||||
Removed: false,
|
||||
},
|
||||
}
|
||||
|
||||
suite.app.EvmKeeper.SetLogs(hash, types.LogsToEthereum(expLogs))
|
||||
|
||||
req = &types.QueryTxLogsRequest{
|
||||
Hash: hash.String(),
|
||||
suite.app.EvmKeeper.SetTxHashTransient(txHash)
|
||||
suite.app.EvmKeeper.IncreaseTxIndexTransient()
|
||||
for _, log := range types.LogsToEthereum(expLogs) {
|
||||
suite.app.EvmKeeper.AddLog(log)
|
||||
}
|
||||
},
|
||||
true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -403,202 +384,8 @@ func (suite *KeeperTestSuite) TestQueryTxLogs() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
tc.malleate()
|
||||
ctx := sdk.WrapSDKContext(suite.ctx)
|
||||
res, err := suite.queryClient.TxLogs(ctx, req)
|
||||
|
||||
if tc.expPass {
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().NotNil(res)
|
||||
|
||||
suite.Require().Equal(expLogs, res.Logs)
|
||||
} else {
|
||||
suite.Require().Error(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestQueryBlockLogs() {
|
||||
var (
|
||||
req *types.QueryBlockLogsRequest
|
||||
expLogs []types.TransactionLogs
|
||||
)
|
||||
|
||||
testCases := []struct {
|
||||
msg string
|
||||
malleate func()
|
||||
expPass bool
|
||||
}{
|
||||
{
|
||||
"empty hash",
|
||||
func() {
|
||||
req = &types.QueryBlockLogsRequest{
|
||||
Hash: common.Hash{}.String(),
|
||||
}
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"logs not found",
|
||||
func() {
|
||||
hash := common.BytesToHash([]byte("hash"))
|
||||
req = &types.QueryBlockLogsRequest{
|
||||
Hash: hash.String(),
|
||||
}
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
hash := common.BytesToHash([]byte("block_hash"))
|
||||
expLogs = []types.TransactionLogs{
|
||||
{
|
||||
Hash: common.BytesToHash([]byte("tx_hash_0")).String(),
|
||||
Logs: []*types.Log{
|
||||
{
|
||||
Address: suite.address.String(),
|
||||
Topics: []string{common.BytesToHash([]byte("topic")).String()},
|
||||
Data: []byte("data"),
|
||||
BlockNumber: 1,
|
||||
TxHash: common.BytesToHash([]byte("tx_hash_0")).String(),
|
||||
TxIndex: 1,
|
||||
BlockHash: common.BytesToHash([]byte("block_hash")).String(),
|
||||
Index: 0,
|
||||
Removed: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Hash: common.BytesToHash([]byte("tx_hash_1")).String(),
|
||||
Logs: []*types.Log{
|
||||
{
|
||||
Address: suite.address.String(),
|
||||
Topics: []string{common.BytesToHash([]byte("topic")).String()},
|
||||
Data: []byte("data"),
|
||||
BlockNumber: 1,
|
||||
TxHash: common.BytesToHash([]byte("tx_hash_1")).String(),
|
||||
TxIndex: 1,
|
||||
BlockHash: common.BytesToHash([]byte("block_hash")).String(),
|
||||
Index: 1,
|
||||
Removed: false,
|
||||
},
|
||||
{
|
||||
Address: suite.address.String(),
|
||||
Topics: []string{common.BytesToHash([]byte("topic_1")).String()},
|
||||
Data: []byte("data_1"),
|
||||
BlockNumber: 1,
|
||||
TxHash: common.BytesToHash([]byte("tx_hash_1")).String(),
|
||||
TxIndex: 1,
|
||||
BlockHash: common.BytesToHash([]byte("block_hash")).String(),
|
||||
Index: 2,
|
||||
Removed: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
suite.app.EvmKeeper.SetLogs(common.BytesToHash([]byte("tx_hash_0")), types.LogsToEthereum(expLogs[0].Logs))
|
||||
suite.app.EvmKeeper.SetLogs(common.BytesToHash([]byte("tx_hash_1")), types.LogsToEthereum(expLogs[1].Logs))
|
||||
|
||||
req = &types.QueryBlockLogsRequest{
|
||||
Hash: hash.String(),
|
||||
}
|
||||
},
|
||||
true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
tc.malleate()
|
||||
ctx := sdk.WrapSDKContext(suite.ctx)
|
||||
res, err := suite.queryClient.BlockLogs(ctx, req)
|
||||
|
||||
if tc.expPass {
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().NotNil(res)
|
||||
|
||||
suite.Require().Equal(expLogs, res.TxLogs)
|
||||
} else {
|
||||
suite.Require().Error(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestQueryBlockBloom() {
|
||||
var (
|
||||
req *types.QueryBlockBloomRequest
|
||||
expBloom []byte
|
||||
)
|
||||
|
||||
testCases := []struct {
|
||||
msg string
|
||||
malleate func()
|
||||
expPass bool
|
||||
}{
|
||||
{
|
||||
"bad height",
|
||||
func() {
|
||||
req = &types.QueryBlockBloomRequest{Height: -2}
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"bloom from transient store",
|
||||
func() {
|
||||
req = &types.QueryBlockBloomRequest{Height: 1}
|
||||
bloom := ethtypes.BytesToBloom([]byte("bloom"))
|
||||
expBloom = bloom.Bytes()
|
||||
suite.app.EvmKeeper.WithContext(suite.ctx.WithBlockHeight(1))
|
||||
suite.app.EvmKeeper.SetBlockBloomTransient(bloom.Big())
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"bloom not found for height",
|
||||
func() {
|
||||
req = &types.QueryBlockBloomRequest{Height: 100}
|
||||
bloom := ethtypes.BytesToBloom([]byte("bloom"))
|
||||
expBloom = bloom.Bytes()
|
||||
suite.ctx = suite.ctx.WithBlockHeight(100)
|
||||
suite.app.EvmKeeper.SetBlockBloom(suite.ctx, 2, bloom)
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"success",
|
||||
func() {
|
||||
req = &types.QueryBlockBloomRequest{Height: 3}
|
||||
bloom := ethtypes.BytesToBloom([]byte("bloom"))
|
||||
expBloom = bloom.Bytes()
|
||||
suite.ctx = suite.ctx.WithBlockHeight(3)
|
||||
suite.app.EvmKeeper.SetBlockBloom(suite.ctx, 3, bloom)
|
||||
},
|
||||
true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
|
||||
suite.SetupTest() // reset
|
||||
|
||||
tc.malleate()
|
||||
ctx := sdk.WrapSDKContext(suite.ctx)
|
||||
ctx = metadata.AppendToOutgoingContext(ctx, grpctypes.GRPCBlockHeightHeader, fmt.Sprintf("%d", suite.ctx.BlockHeight()))
|
||||
res, err := suite.queryClient.BlockBloom(ctx, req)
|
||||
|
||||
if tc.expPass {
|
||||
suite.Require().NoError(err)
|
||||
suite.Require().NotNil(res)
|
||||
|
||||
suite.Require().Equal(expBloom, res.Bloom)
|
||||
} else {
|
||||
suite.Require().Error(err)
|
||||
}
|
||||
logs := suite.app.EvmKeeper.GetTxLogsTransient(txHash)
|
||||
suite.Require().Equal(expLogs, types.NewLogsFromEth(logs))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ func (suite *KeeperTestSuite) TestEvmHooks() {
|
||||
Topics: []common.Hash{},
|
||||
Address: suite.address,
|
||||
})
|
||||
logs := k.GetTxLogs(txHash)
|
||||
logs := k.GetTxLogsTransient(txHash)
|
||||
result := k.PostTxProcessing(txHash, logs)
|
||||
|
||||
tc.expFunc(hook, result)
|
||||
|
||||
+13
-83
@@ -139,23 +139,14 @@ func (k Keeper) ChainID() *big.Int {
|
||||
// Required by Web3 API.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// GetBlockBloom gets bloombits from block height
|
||||
func (k Keeper) GetBlockBloom(ctx sdk.Context, height int64) (ethtypes.Bloom, bool) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
bz := store.Get(types.BloomKey(height))
|
||||
if len(bz) == 0 {
|
||||
return ethtypes.Bloom{}, false
|
||||
}
|
||||
|
||||
return ethtypes.BytesToBloom(bz), true
|
||||
}
|
||||
|
||||
// SetBlockBloom sets the mapping from block height to bloom bits
|
||||
func (k Keeper) SetBlockBloom(ctx sdk.Context, height int64, bloom ethtypes.Bloom) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
|
||||
key := types.BloomKey(height)
|
||||
store.Set(key, bloom.Bytes())
|
||||
// EmitBlockBloomEvent emit block bloom events
|
||||
func (k Keeper) EmitBlockBloomEvent(ctx sdk.Context, bloom ethtypes.Bloom) {
|
||||
ctx.EventManager().EmitEvent(
|
||||
sdk.NewEvent(
|
||||
types.EventTypeBlockBloom,
|
||||
sdk.NewAttribute(types.AttributeKeyEthereumBloom, string(bloom.Bytes())),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
// GetBlockBloomTransient returns bloom bytes for the current block height
|
||||
@@ -233,41 +224,10 @@ func (k Keeper) ResetRefundTransient(ctx sdk.Context) {
|
||||
// Log
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// GetAllTxLogs return all the transaction logs from the store.
|
||||
func (k Keeper) GetAllTxLogs(ctx sdk.Context) []types.TransactionLogs {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
iter := sdk.KVStorePrefixIterator(store, types.KeyPrefixLogs)
|
||||
defer iter.Close()
|
||||
|
||||
mapOrder := []string{}
|
||||
mapLogs := make(map[string][]*types.Log)
|
||||
for ; iter.Valid(); iter.Next() {
|
||||
var txLog types.Log
|
||||
k.cdc.MustUnmarshal(iter.Value(), &txLog)
|
||||
|
||||
txlogs := mapLogs[txLog.TxHash]
|
||||
if len(txlogs) == 0 {
|
||||
mapOrder = append(mapOrder, txLog.TxHash)
|
||||
}
|
||||
|
||||
txlogs = append(txlogs, &txLog)
|
||||
mapLogs[txLog.TxHash] = txlogs
|
||||
}
|
||||
|
||||
txsLogs := []types.TransactionLogs{}
|
||||
for _, txHash := range mapOrder {
|
||||
if len(mapLogs[txHash]) > 0 {
|
||||
txLogs := types.TransactionLogs{Hash: txHash, Logs: mapLogs[txHash]}
|
||||
txsLogs = append(txsLogs, txLogs)
|
||||
}
|
||||
}
|
||||
return txsLogs
|
||||
}
|
||||
|
||||
// GetLogs returns the current logs for a given transaction hash from the KVStore.
|
||||
// GetTxLogsTransient returns the current logs for a given transaction hash from the KVStore.
|
||||
// This function returns an empty, non-nil slice if no logs are found.
|
||||
func (k Keeper) GetTxLogs(txHash common.Hash) []*ethtypes.Log {
|
||||
store := prefix.NewStore(k.Ctx().KVStore(k.storeKey), types.KeyPrefixLogs)
|
||||
func (k Keeper) GetTxLogsTransient(txHash common.Hash) []*ethtypes.Log {
|
||||
store := prefix.NewStore(k.Ctx().TransientStore(k.transientKey), types.KeyPrefixTransientTxLogs)
|
||||
|
||||
// We store the logs with key equal to txHash.Bytes() | sdk.Uint64ToBigEndian(uint64(log.Index)),
|
||||
// therefore, we set the end boundary(excluded) to txHash.Bytes() | uint64.Max -> []byte
|
||||
@@ -287,22 +247,9 @@ func (k Keeper) GetTxLogs(txHash common.Hash) []*ethtypes.Log {
|
||||
return logs
|
||||
}
|
||||
|
||||
// SetLogs sets the logs for a transaction in the KVStore.
|
||||
func (k Keeper) SetLogs(txHash common.Hash, logs []*ethtypes.Log) {
|
||||
store := prefix.NewStore(k.Ctx().KVStore(k.storeKey), types.KeyPrefixLogs)
|
||||
|
||||
for _, log := range logs {
|
||||
key := txHash.Bytes()
|
||||
key = append(key, sdk.Uint64ToBigEndian(uint64(log.Index))...)
|
||||
txIndexLog := types.NewLogFromEth(log)
|
||||
bz := k.cdc.MustMarshal(txIndexLog)
|
||||
store.Set(key, bz)
|
||||
}
|
||||
}
|
||||
|
||||
// SetLog sets the log for a transaction in the KVStore.
|
||||
func (k Keeper) SetLog(log *ethtypes.Log) {
|
||||
store := prefix.NewStore(k.Ctx().KVStore(k.storeKey), types.KeyPrefixLogs)
|
||||
func (k Keeper) AddLogTransient(log *ethtypes.Log) {
|
||||
store := prefix.NewStore(k.Ctx().TransientStore(k.transientKey), types.KeyPrefixTransientTxLogs)
|
||||
|
||||
key := log.TxHash.Bytes()
|
||||
key = append(key, sdk.Uint64ToBigEndian(uint64(log.Index))...)
|
||||
@@ -312,23 +259,6 @@ func (k Keeper) SetLog(log *ethtypes.Log) {
|
||||
store.Set(key, bz)
|
||||
}
|
||||
|
||||
// DeleteLogs removes the logs from the KVStore. It is used during journal.Revert.
|
||||
func (k Keeper) DeleteTxLogs(ctx sdk.Context, txHash common.Hash) {
|
||||
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixLogs)
|
||||
|
||||
// We store the logs with key equal to txHash.Bytes() | sdk.Uint64ToBigEndian(uint64(log.Index)),
|
||||
// therefore, we set the end boundary(excluded) to txHash.Bytes() | uint64.Max -> []byte
|
||||
end := txHash.Bytes()
|
||||
end = append(end, []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}...)
|
||||
|
||||
iter := store.Iterator(txHash.Bytes(), end)
|
||||
defer iter.Close()
|
||||
|
||||
for ; iter.Valid(); iter.Next() {
|
||||
store.Delete(iter.Key())
|
||||
}
|
||||
}
|
||||
|
||||
// GetLogSizeTransient returns EVM log index on the current block.
|
||||
func (k Keeper) GetLogSizeTransient() uint64 {
|
||||
store := k.Ctx().TransientStore(k.transientKey)
|
||||
|
||||
@@ -52,12 +52,22 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
|
||||
attrs = append(attrs, sdk.NewAttribute(types.AttributeKeyEthereumTxFailed, response.VmError))
|
||||
}
|
||||
|
||||
txLogAttrs := make([]sdk.Attribute, 0)
|
||||
for _, log := range response.Logs {
|
||||
bz := k.cdc.MustMarshal(log)
|
||||
txLogAttrs = append(txLogAttrs, sdk.NewAttribute(types.AttributeKeyTxLog, string(bz)))
|
||||
}
|
||||
|
||||
// emit events
|
||||
ctx.EventManager().EmitEvents(sdk.Events{
|
||||
sdk.NewEvent(
|
||||
types.EventTypeEthereumTx,
|
||||
attrs...,
|
||||
),
|
||||
sdk.NewEvent(
|
||||
types.EventTypeTxLog,
|
||||
txLogAttrs...,
|
||||
),
|
||||
sdk.NewEvent(
|
||||
sdk.EventTypeMessage,
|
||||
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
|
||||
|
||||
@@ -184,7 +184,7 @@ func (k *Keeper) ApplyTransaction(tx *ethtypes.Transaction) (*types.MsgEthereumT
|
||||
}
|
||||
|
||||
res.Hash = txHash.Hex()
|
||||
logs := k.GetTxLogs(txHash)
|
||||
logs := k.GetTxLogsTransient(txHash)
|
||||
|
||||
if !res.Failed() {
|
||||
// Only call hooks if tx executed successfully.
|
||||
|
||||
@@ -654,7 +654,7 @@ func (k *Keeper) AddLog(log *ethtypes.Log) {
|
||||
|
||||
log.Index = uint(k.GetLogSizeTransient())
|
||||
k.IncreaseLogSizeTransient()
|
||||
k.SetLog(log)
|
||||
k.AddLogTransient(log)
|
||||
|
||||
k.Logger(ctx).Debug(
|
||||
"log added",
|
||||
|
||||
@@ -608,7 +608,7 @@ func (suite *KeeperTestSuite) TestAddLog() {
|
||||
|
||||
suite.app.EvmKeeper.SetTxHashTransient(tc.hash)
|
||||
suite.app.EvmKeeper.AddLog(tc.log)
|
||||
logs := suite.app.EvmKeeper.GetTxLogs(tc.hash)
|
||||
logs := suite.app.EvmKeeper.GetTxLogsTransient(tc.hash)
|
||||
suite.Require().Equal(1, len(logs))
|
||||
suite.Require().Equal(tc.expLog, logs[0])
|
||||
})
|
||||
|
||||
@@ -3,15 +3,19 @@ package types
|
||||
// Evm module events
|
||||
const (
|
||||
EventTypeEthereumTx = TypeMsgEthereumTx
|
||||
EventTypeBlockBloom = "block_bloom"
|
||||
EventTypeTxLog = "tx_log"
|
||||
|
||||
AttributeKeyContractAddress = "contract"
|
||||
AttributeKeyRecipient = "recipient"
|
||||
AttributeKeyTxHash = "txHash"
|
||||
AttributeKeyEthereumTxHash = "ethereumTxHash"
|
||||
AttributeKeyTxType = "txType"
|
||||
AttributeKeyTxLog = "txLog"
|
||||
// tx failed in eth vm execution
|
||||
AttributeKeyEthereumTxFailed = "ethereumTxFailed"
|
||||
AttributeValueCategory = ModuleName
|
||||
AttributeKeyEthereumBloom = "bloom"
|
||||
|
||||
MetricKeyTransitionDB = "transition_db"
|
||||
MetricKeyStaticCall = "static_call"
|
||||
|
||||
@@ -19,7 +19,6 @@ func (ga GenesisAccount) Validate() error {
|
||||
func DefaultGenesisState() *GenesisState {
|
||||
return &GenesisState{
|
||||
Accounts: []GenesisAccount{},
|
||||
TxsLogs: []TransactionLogs{},
|
||||
Params: DefaultParams(),
|
||||
}
|
||||
}
|
||||
@@ -28,7 +27,6 @@ func DefaultGenesisState() *GenesisState {
|
||||
// failure.
|
||||
func (gs GenesisState) Validate() error {
|
||||
seenAccounts := make(map[string]bool)
|
||||
seenTxs := make(map[string]bool)
|
||||
for _, acc := range gs.Accounts {
|
||||
if seenAccounts[acc.Address] {
|
||||
return fmt.Errorf("duplicated genesis account %s", acc.Address)
|
||||
@@ -39,17 +37,5 @@ func (gs GenesisState) Validate() error {
|
||||
seenAccounts[acc.Address] = true
|
||||
}
|
||||
|
||||
for _, tx := range gs.TxsLogs {
|
||||
if seenTxs[tx.Hash] {
|
||||
return fmt.Errorf("duplicated logs from transaction %s", tx.Hash)
|
||||
}
|
||||
|
||||
if err := tx.Validate(); err != nil {
|
||||
return fmt.Errorf("invalid logs from transaction %s: %w", tx.Hash, err)
|
||||
}
|
||||
|
||||
seenTxs[tx.Hash] = true
|
||||
}
|
||||
|
||||
return gs.Params.Validate()
|
||||
}
|
||||
|
||||
+21
-87
@@ -28,8 +28,7 @@ type GenesisState struct {
|
||||
// accounts is an array containing the ethereum genesis accounts.
|
||||
Accounts []GenesisAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"`
|
||||
// params defines all the paramaters of the module.
|
||||
Params Params `protobuf:"bytes,3,opt,name=params,proto3" json:"params"`
|
||||
TxsLogs []TransactionLogs `protobuf:"bytes,4,rep,name=txs_logs,json=txsLogs,proto3" json:"txs_logs" yaml:"txs_logs"`
|
||||
Params Params `protobuf:"bytes,3,opt,name=params,proto3" json:"params"`
|
||||
}
|
||||
|
||||
func (m *GenesisState) Reset() { *m = GenesisState{} }
|
||||
@@ -79,13 +78,6 @@ func (m *GenesisState) GetParams() Params {
|
||||
return Params{}
|
||||
}
|
||||
|
||||
func (m *GenesisState) GetTxsLogs() []TransactionLogs {
|
||||
if m != nil {
|
||||
return m.TxsLogs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GenesisAccount defines an account to be initialized in the genesis state.
|
||||
// Its main difference between with Geth's GenesisAccount is that it uses a
|
||||
// custom storage type and that it doesn't contain the private key field.
|
||||
@@ -160,30 +152,26 @@ func init() {
|
||||
func init() { proto.RegisterFile("ethermint/evm/v1/genesis.proto", fileDescriptor_9bcdec50cc9d156d) }
|
||||
|
||||
var fileDescriptor_9bcdec50cc9d156d = []byte{
|
||||
// 353 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x51, 0xbf, 0x4e, 0xc2, 0x40,
|
||||
0x18, 0xef, 0x09, 0xa1, 0x78, 0x18, 0x31, 0x17, 0x13, 0x1a, 0x86, 0x82, 0x9d, 0x3a, 0xb5, 0x01,
|
||||
0x13, 0x07, 0x37, 0xbb, 0xb8, 0x38, 0x98, 0xa2, 0x8b, 0x8b, 0x39, 0xca, 0xe5, 0x68, 0x42, 0x7b,
|
||||
0xe4, 0xbe, 0xa3, 0x81, 0xd5, 0x27, 0xf0, 0x39, 0x7c, 0x12, 0x46, 0x46, 0x27, 0x54, 0x78, 0x03,
|
||||
0x9f, 0xc0, 0xf4, 0x0a, 0x18, 0xed, 0xf6, 0xdd, 0xfd, 0xfe, 0x7c, 0xbf, 0xbb, 0x1f, 0xb6, 0x99,
|
||||
0x1a, 0x33, 0x99, 0xc4, 0xa9, 0xf2, 0x59, 0x96, 0xf8, 0x59, 0xcf, 0xe7, 0x2c, 0x65, 0x10, 0x83,
|
||||
0x37, 0x95, 0x42, 0x09, 0x72, 0x76, 0xc0, 0x3d, 0x96, 0x25, 0x5e, 0xd6, 0x6b, 0x9f, 0x73, 0xc1,
|
||||
0x85, 0x06, 0xfd, 0x7c, 0x2a, 0x78, 0xed, 0x76, 0xc9, 0x27, 0xa7, 0x6b, 0xcc, 0xf9, 0x42, 0xf8,
|
||||
0xe4, 0xb6, 0x70, 0x1d, 0x28, 0xaa, 0x18, 0x09, 0x70, 0x9d, 0x46, 0x91, 0x98, 0xa5, 0x0a, 0x2c,
|
||||
0xd4, 0xad, 0xb8, 0x8d, 0x7e, 0xd7, 0xfb, 0xbf, 0xc7, 0xdb, 0x29, 0x6e, 0x0a, 0x62, 0x50, 0x5d,
|
||||
0xae, 0x3b, 0x46, 0x78, 0xd0, 0x91, 0x2b, 0x5c, 0x9b, 0x52, 0x49, 0x13, 0xb0, 0x2a, 0x5d, 0xe4,
|
||||
0x36, 0xfa, 0x56, 0xd9, 0xe1, 0x5e, 0xe3, 0x3b, 0xe5, 0x8e, 0x4d, 0x1e, 0x71, 0x5d, 0xcd, 0xe1,
|
||||
0x79, 0x22, 0x38, 0x58, 0x55, 0xbd, 0xfb, 0xa2, 0xac, 0x7c, 0x90, 0x34, 0x05, 0x1a, 0xa9, 0x58,
|
||||
0xa4, 0x77, 0x82, 0x43, 0xd0, 0xca, 0x2d, 0xbe, 0xd7, 0x9d, 0xe6, 0x82, 0x26, 0x93, 0x6b, 0x67,
|
||||
0x6f, 0xe0, 0x84, 0xa6, 0x9a, 0x43, 0xce, 0x70, 0x5e, 0x10, 0x3e, 0xfd, 0x9b, 0x98, 0x58, 0xd8,
|
||||
0xa4, 0xa3, 0x91, 0x64, 0x90, 0x3f, 0x12, 0xb9, 0xc7, 0xe1, 0xfe, 0x48, 0x08, 0xae, 0x46, 0x62,
|
||||
0xc4, 0xac, 0x23, 0x7d, 0xad, 0x67, 0x12, 0x60, 0x13, 0x94, 0x90, 0x94, 0x33, 0xab, 0xa2, 0x63,
|
||||
0xb5, 0xca, 0xb1, 0xf4, 0xef, 0x05, 0xcd, 0x3c, 0xcc, 0xdb, 0x47, 0xc7, 0x1c, 0x14, 0xfc, 0x70,
|
||||
0x2f, 0x0c, 0x82, 0xe5, 0xc6, 0x46, 0xab, 0x8d, 0x8d, 0x3e, 0x37, 0x36, 0x7a, 0xdd, 0xda, 0xc6,
|
||||
0x6a, 0x6b, 0x1b, 0xef, 0x5b, 0xdb, 0x78, 0x72, 0x79, 0xac, 0xc6, 0xb3, 0xa1, 0x17, 0x89, 0xc4,
|
||||
0x57, 0x63, 0x2a, 0x21, 0x06, 0xff, 0xb7, 0xb1, 0xb9, 0xee, 0x4c, 0x2d, 0xa6, 0x0c, 0x86, 0x35,
|
||||
0xdd, 0xd9, 0xe5, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x76, 0xc7, 0x9e, 0xf9, 0x19, 0x02, 0x00,
|
||||
0x00,
|
||||
// 299 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x50, 0xbd, 0x4e, 0xeb, 0x30,
|
||||
0x14, 0x8e, 0x6f, 0xab, 0xf6, 0xe2, 0x22, 0x40, 0x16, 0x12, 0x56, 0x07, 0xb7, 0xea, 0x94, 0xc9,
|
||||
0x56, 0x8b, 0xc4, 0x8e, 0x17, 0x56, 0x94, 0x6e, 0x6c, 0x6e, 0x62, 0x25, 0x19, 0x12, 0x47, 0xb6,
|
||||
0x1b, 0xc1, 0xca, 0xc8, 0xc4, 0x73, 0xf0, 0x24, 0x1d, 0x3b, 0x32, 0x01, 0x4a, 0x5e, 0x04, 0xc5,
|
||||
0x49, 0x8b, 0x20, 0xdb, 0xb1, 0xbf, 0xbf, 0x73, 0x3e, 0x48, 0xa4, 0x4d, 0xa4, 0xce, 0xd2, 0xdc,
|
||||
0x32, 0x59, 0x66, 0xac, 0x5c, 0xb2, 0x58, 0xe6, 0xd2, 0xa4, 0x86, 0x16, 0x5a, 0x59, 0x85, 0x2e,
|
||||
0x8e, 0x38, 0x95, 0x65, 0x46, 0xcb, 0xe5, 0xf4, 0x32, 0x56, 0xb1, 0x72, 0x20, 0x6b, 0xa6, 0x96,
|
||||
0x37, 0x9d, 0xf6, 0x7c, 0x1a, 0xba, 0xc3, 0x16, 0x2f, 0x00, 0x9e, 0xde, 0xb5, 0xae, 0x6b, 0x2b,
|
||||
0xac, 0x44, 0x1c, 0xfe, 0x17, 0x61, 0xa8, 0xb6, 0xb9, 0x35, 0x18, 0xcc, 0x07, 0xfe, 0x64, 0x35,
|
||||
0xa7, 0x7f, 0x73, 0x68, 0xa7, 0xb8, 0x6d, 0x89, 0x7c, 0xb8, 0xfb, 0x98, 0x79, 0xc1, 0x51, 0x87,
|
||||
0x6e, 0xe0, 0xa8, 0x10, 0x5a, 0x64, 0x06, 0x0f, 0xe6, 0xc0, 0x9f, 0xac, 0x70, 0xdf, 0xe1, 0xde,
|
||||
0xe1, 0x9d, 0xb2, 0x63, 0x2f, 0x9e, 0x01, 0x3c, 0xfb, 0x6d, 0x8d, 0x30, 0x1c, 0x8b, 0x28, 0xd2,
|
||||
0xd2, 0x34, 0xdb, 0x00, 0xff, 0x24, 0x38, 0x3c, 0x11, 0x82, 0xc3, 0x50, 0x45, 0x12, 0xff, 0x73,
|
||||
0xdf, 0x6e, 0x46, 0x1c, 0x8e, 0x8d, 0x55, 0x5a, 0xc4, 0x12, 0x0f, 0xdc, 0xee, 0x57, 0xfd, 0x64,
|
||||
0x77, 0x26, 0x3f, 0x6f, 0x82, 0xdf, 0x3e, 0x67, 0xe3, 0x75, 0xcb, 0x0f, 0x0e, 0x42, 0xce, 0x77,
|
||||
0x15, 0x01, 0xfb, 0x8a, 0x80, 0xaf, 0x8a, 0x80, 0xd7, 0x9a, 0x78, 0xfb, 0x9a, 0x78, 0xef, 0x35,
|
||||
0xf1, 0x1e, 0xfc, 0x38, 0xb5, 0xc9, 0x76, 0x43, 0x43, 0x95, 0x31, 0x9b, 0x08, 0x6d, 0x52, 0xc3,
|
||||
0x7e, 0xaa, 0x7d, 0x74, 0xe5, 0xda, 0xa7, 0x42, 0x9a, 0xcd, 0xc8, 0x95, 0x7b, 0xfd, 0x1d, 0x00,
|
||||
0x00, 0xff, 0xff, 0x87, 0x96, 0x85, 0x5d, 0xc2, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
||||
@@ -206,20 +194,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.TxsLogs) > 0 {
|
||||
for iNdEx := len(m.TxsLogs) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.TxsLogs[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
}
|
||||
{
|
||||
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
@@ -323,12 +297,6 @@ func (m *GenesisState) Size() (n int) {
|
||||
}
|
||||
l = m.Params.Size()
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
if len(m.TxsLogs) > 0 {
|
||||
for _, e := range m.TxsLogs {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
@@ -457,40 +425,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field TxsLogs", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.TxsLogs = append(m.TxsLogs, TransactionLogs{})
|
||||
if err := m.TxsLogs[len(m.TxsLogs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||
|
||||
@@ -106,24 +106,6 @@ func (suite *GenesisTestSuite) TestValidateGenesis() {
|
||||
},
|
||||
},
|
||||
},
|
||||
TxsLogs: []TransactionLogs{
|
||||
{
|
||||
Hash: suite.hash.String(),
|
||||
Logs: []*Log{
|
||||
{
|
||||
Address: suite.address,
|
||||
Topics: []string{suite.hash.String()},
|
||||
Data: []byte("data"),
|
||||
BlockNumber: 1,
|
||||
TxHash: suite.hash.String(),
|
||||
TxIndex: 1,
|
||||
BlockHash: suite.hash.String(),
|
||||
Index: 1,
|
||||
Removed: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Params: DefaultParams(),
|
||||
},
|
||||
expPass: true,
|
||||
@@ -181,40 +163,6 @@ func (suite *GenesisTestSuite) TestValidateGenesis() {
|
||||
},
|
||||
},
|
||||
},
|
||||
TxsLogs: []TransactionLogs{
|
||||
{
|
||||
Hash: suite.hash.String(),
|
||||
Logs: []*Log{
|
||||
{
|
||||
Address: suite.address,
|
||||
Topics: []string{suite.hash.String()},
|
||||
Data: []byte("data"),
|
||||
BlockNumber: 1,
|
||||
TxHash: suite.hash.String(),
|
||||
TxIndex: 1,
|
||||
BlockHash: suite.hash.String(),
|
||||
Index: 1,
|
||||
Removed: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Hash: suite.hash.String(),
|
||||
Logs: []*Log{
|
||||
{
|
||||
Address: suite.address,
|
||||
Topics: []string{suite.hash.String()},
|
||||
Data: []byte("data"),
|
||||
BlockNumber: 1,
|
||||
TxHash: suite.hash.String(),
|
||||
TxIndex: 1,
|
||||
BlockHash: suite.hash.String(),
|
||||
Index: 1,
|
||||
Removed: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
@@ -231,7 +179,6 @@ func (suite *GenesisTestSuite) TestValidateGenesis() {
|
||||
},
|
||||
},
|
||||
},
|
||||
TxsLogs: []TransactionLogs{NewTransactionLogs(common.Hash{}, nil)},
|
||||
},
|
||||
expPass: false,
|
||||
},
|
||||
|
||||
+6
-18
@@ -1,8 +1,6 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
@@ -16,7 +14,7 @@ const (
|
||||
// The EVM module should use a prefix store.
|
||||
StoreKey = ModuleName
|
||||
|
||||
// Transient Key is the key to access the EVM transient store, that is reset
|
||||
// TransientKey is the key to access the EVM transient store, that is reset
|
||||
// during the Commit phase.
|
||||
TransientKey = "transient_" + ModuleName
|
||||
|
||||
@@ -26,10 +24,7 @@ const (
|
||||
|
||||
// prefix bytes for the EVM persistent store
|
||||
const (
|
||||
prefixHeightToHeaderHash = iota + 1
|
||||
prefixBloom
|
||||
prefixLogs
|
||||
prefixCode
|
||||
prefixCode = iota + 1
|
||||
prefixStorage
|
||||
)
|
||||
|
||||
@@ -43,15 +38,13 @@ const (
|
||||
prefixTransientAccessListSlot
|
||||
prefixTransientTxHash
|
||||
prefixTransientLogSize
|
||||
prefixTransientTxLogs
|
||||
)
|
||||
|
||||
// KVStore key prefixes
|
||||
var (
|
||||
KeyPrefixHeightToHeaderHash = []byte{prefixHeightToHeaderHash}
|
||||
KeyPrefixBloom = []byte{prefixBloom}
|
||||
KeyPrefixLogs = []byte{prefixLogs}
|
||||
KeyPrefixCode = []byte{prefixCode}
|
||||
KeyPrefixStorage = []byte{prefixStorage}
|
||||
KeyPrefixCode = []byte{prefixCode}
|
||||
KeyPrefixStorage = []byte{prefixStorage}
|
||||
)
|
||||
|
||||
// Transient Store key prefixes
|
||||
@@ -64,14 +57,9 @@ var (
|
||||
KeyPrefixTransientAccessListSlot = []byte{prefixTransientAccessListSlot}
|
||||
KeyPrefixTransientTxHash = []byte{prefixTransientTxHash}
|
||||
KeyPrefixTransientLogSize = []byte{prefixTransientLogSize}
|
||||
KeyPrefixTransientTxLogs = []byte{prefixTransientTxLogs}
|
||||
)
|
||||
|
||||
// BloomKey defines the store key for a block Bloom
|
||||
func BloomKey(height int64) []byte {
|
||||
heightBytes := sdk.Uint64ToBigEndian(uint64(height))
|
||||
return append(KeyPrefixBloom, heightBytes...)
|
||||
}
|
||||
|
||||
// AddressStoragePrefix returns a prefix to iterate over a given account storage.
|
||||
func AddressStoragePrefix(address common.Address) []byte {
|
||||
return append(KeyPrefixStorage, address.Bytes()...)
|
||||
|
||||
+80
-1002
File diff suppressed because it is too large
Load Diff
+33
-313
@@ -20,6 +20,7 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
@@ -30,6 +31,7 @@ var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = descriptor.ForMessage
|
||||
var _ = metadata.Join
|
||||
|
||||
func request_Query_Account_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryAccountRequest
|
||||
@@ -377,186 +379,6 @@ func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_TxLogs_0 = &utilities.DoubleArray{Encoding: map[string]int{"hash": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
)
|
||||
|
||||
func request_Query_TxLogs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryTxLogsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["hash"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash")
|
||||
}
|
||||
|
||||
protoReq.Hash, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TxLogs_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.TxLogs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_TxLogs_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryTxLogsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["hash"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash")
|
||||
}
|
||||
|
||||
protoReq.Hash, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TxLogs_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.TxLogs(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_BlockLogs_0 = &utilities.DoubleArray{Encoding: map[string]int{"hash": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
)
|
||||
|
||||
func request_Query_BlockLogs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryBlockLogsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["hash"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash")
|
||||
}
|
||||
|
||||
protoReq.Hash, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlockLogs_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.BlockLogs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_BlockLogs_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryBlockLogsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["hash"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash")
|
||||
}
|
||||
|
||||
protoReq.Hash, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlockLogs_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.BlockLogs(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_Query_BlockBloom_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_Query_BlockBloom_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryBlockBloomRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlockBloom_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.BlockBloom(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_BlockBloom_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryBlockBloomRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlockBloom_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.BlockBloom(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryParamsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
@@ -686,12 +508,14 @@ func local_request_Query_TraceTx_0(ctx context.Context, marshaler runtime.Marsha
|
||||
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
|
||||
// UnaryRPC :call QueryServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
|
||||
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
|
||||
|
||||
mux.Handle("GET", pattern_Query_Account_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -699,6 +523,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_Account_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -712,6 +537,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
mux.Handle("GET", pattern_Query_CosmosAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -719,6 +546,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_CosmosAccount_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -732,6 +560,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
mux.Handle("GET", pattern_Query_ValidatorAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -739,6 +569,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_ValidatorAccount_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -752,6 +583,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
mux.Handle("GET", pattern_Query_Balance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -759,6 +592,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_Balance_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -772,6 +606,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
mux.Handle("GET", pattern_Query_Storage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -779,6 +615,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_Storage_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -792,6 +629,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -799,6 +638,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_Code_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -809,69 +649,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_TxLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_TxLogs_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_TxLogs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_BlockLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_BlockLogs_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_BlockLogs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_BlockBloom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_BlockBloom_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_BlockBloom_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -879,6 +661,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -892,6 +675,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
mux.Handle("GET", pattern_Query_EthCall_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -899,6 +684,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_EthCall_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -912,6 +698,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
mux.Handle("GET", pattern_Query_EstimateGas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -919,6 +707,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_EstimateGas_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -932,6 +721,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
mux.Handle("GET", pattern_Query_TraceTx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -939,6 +730,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_TraceTx_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -1110,66 +902,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_TxLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_TxLogs_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_TxLogs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_BlockLogs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_BlockLogs_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_BlockLogs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_BlockBloom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_BlockBloom_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_BlockBloom_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -1266,12 +998,6 @@ var (
|
||||
|
||||
pattern_Query_Code_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "codes", "address"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_TxLogs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "tx_logs", "hash"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_BlockLogs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"ethermint", "evm", "v1", "block_logs", "hash"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_BlockBloom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "block_bloom"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
|
||||
pattern_Query_EthCall_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ethermint", "evm", "v1", "eth_call"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
@@ -1294,12 +1020,6 @@ var (
|
||||
|
||||
forward_Query_Code_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_TxLogs_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_BlockLogs_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_BlockBloom_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_Params_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_EthCall_0 = runtime.ForwardResponseMessage
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
@@ -30,6 +31,7 @@ var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = descriptor.ForMessage
|
||||
var _ = metadata.Join
|
||||
|
||||
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryParamsRequest
|
||||
@@ -88,12 +90,14 @@ func local_request_Query_BlockGas_0(ctx context.Context, marshaler runtime.Marsh
|
||||
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
|
||||
// UnaryRPC :call QueryServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
|
||||
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
|
||||
|
||||
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -101,6 +105,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -114,6 +119,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
mux.Handle("GET", pattern_Query_BaseFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -121,6 +128,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_BaseFee_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -134,6 +142,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
mux.Handle("GET", pattern_Query_BlockGas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
@@ -141,6 +151,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_BlockGas_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
|
||||
Reference in New Issue
Block a user