Skip to content

Commit

Permalink
wip: update signing
Browse files Browse the repository at this point in the history
  • Loading branch information
boodyvo committed Nov 4, 2024
1 parent 0a8c606 commit 8a2ef3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 0 additions & 7 deletions app/ante/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,13 @@ func (vbd EthValidateBasicDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu
}

fmt.Println("EthValidateBasicDecorator.AnteHandle start")
for _, msg := range tx.GetMsgs() {
fmt.Println("EthValidateBasicDecorator.AnteHandle", msg.String())
}

//sigetheriumTx, ok := tx.(*evmtypes.MsgEthereumTx)
sigetheriumTx, ok := tx.(sdk.HasValidateBasic)
if ok {
fmt.Println("going to validate basic")
err := sigetheriumTx.ValidateBasic()
// ErrNoSignatures is fine with eth tx
fmt.Println("validation error is ", err)
if err != nil && !errors.Is(err, errortypes.ErrNoSignatures) {
return ctx, errorsmod.Wrap(err, "tx basic validation failed")
}
Expand All @@ -134,15 +130,12 @@ func (vbd EthValidateBasicDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu
// For eth type cosmos tx, some fields should be verified as zero values,
// since we will only verify the signature against the hash of the MsgEthereumTx.Data
wrapperTx, ok := tx.(protoTxProvider)
fmt.Println("wrapperTx", wrapperTx, ok)
if !ok {
return ctx, errorsmod.Wrapf(errortypes.ErrUnknownRequest, "invalid tx type %T, didn't implement interface protoTxProvider", tx)
}

protoTx := wrapperTx.GetProtoTx()
body := protoTx.Body
fmt.Println("protoTx", protoTx)
fmt.Println("body", body)
if body.Memo != "" || body.TimeoutHeight != uint64(0) || len(body.NonCriticalExtensionOptions) > 0 {
return ctx, errorsmod.Wrap(errortypes.ErrInvalidRequest,
"for eth tx body Memo TimeoutHeight NonCriticalExtensionOptions should be empty")
Expand Down
7 changes: 7 additions & 0 deletions x/evm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ const (

// Account implements the Query/Account gRPC method
func (k Keeper) Account(c context.Context, req *types.QueryAccountRequest) (*types.QueryAccountResponse, error) {
fmt.Println("calling evm account", req)
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}

fmt.Println("calling evm account", req.Address)

if err := ethermint.ValidateAddress(req.Address); err != nil {
return nil, status.Error(
codes.InvalidArgument, err.Error(),
Expand All @@ -67,6 +70,8 @@ func (k Keeper) Account(c context.Context, req *types.QueryAccountRequest) (*typ
ctx := sdk.UnwrapSDKContext(c)
acct := k.GetAccountOrEmpty(ctx, addr)

fmt.Println("calling evm account", acct)

return &types.QueryAccountResponse{
Balance: acct.Balance.String(),
CodeHash: common.BytesToHash(acct.CodeHash).Hex(),
Expand All @@ -75,6 +80,7 @@ func (k Keeper) Account(c context.Context, req *types.QueryAccountRequest) (*typ
}

func (k Keeper) CosmosAccount(c context.Context, req *types.QueryCosmosAccountRequest) (*types.QueryCosmosAccountResponse, error) {
fmt.Println("calling evm CosmosAccount", req)
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand Down Expand Up @@ -105,6 +111,7 @@ func (k Keeper) CosmosAccount(c context.Context, req *types.QueryCosmosAccountRe

// ValidatorAccount implements the Query/Balance gRPC method
func (k Keeper) ValidatorAccount(c context.Context, req *types.QueryValidatorAccountRequest) (*types.QueryValidatorAccountResponse, error) {
fmt.Println("calling evm ValidatorAccount", req)
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand Down

0 comments on commit 8a2ef3e

Please sign in to comment.