chore: fee payer event (#12850)

* updates

* updates

* updates
This commit is contained in:
Aleksandr Bezobchuk 2022-08-08 13:10:32 -04:00 committed by GitHub
parent cfed17ebf5
commit a6159feab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -217,6 +217,7 @@ const (
AttributeKeyAccountSequence = "acc_seq"
AttributeKeySignature = "signature"
AttributeKeyFee = "fee"
AttributeKeyFeePayer = "fee_payer"
EventTypeMessage = "message"

View File

@ -109,9 +109,10 @@ func (dfd DeductFeeDecorator) checkDeductFee(ctx sdk.Context, sdkTx sdk.Tx, fee
}
}
events := sdk.Events{sdk.NewEvent(sdk.EventTypeTx,
sdk.NewAttribute(sdk.AttributeKeyFee, fee.String()),
)}
events := sdk.Events{
sdk.NewEvent(sdk.EventTypeTx, sdk.NewAttribute(sdk.AttributeKeyFee, fee.String())),
sdk.NewEvent(sdk.EventTypeTx, sdk.NewAttribute(sdk.AttributeKeyFeePayer, deductFeesFrom.String())),
}
ctx.EventManager().EmitEvents(events)
return nil

View File

@ -225,7 +225,7 @@ func (s IntegrationTestSuite) TestSimulateTx_GRPC() {
// - tx.* events: tx.fee, tx.acc_seq, tx.signature
// - Sending Amount to recipient: coin_spent, coin_received, transfer and message.sender=<val1>
// - Msg events: message.module=bank and message.action=/cosmos.bank.v1beta1.MsgSend
s.Require().Equal(len(res.GetResult().GetEvents()), 13) // 1 coin recv 1 coin spent, 1 transfer, 3 messages.
s.Require().Equal(len(res.GetResult().GetEvents()), 14) // 1 coin recv 1 coin spent, 1 transfer, 3 messages.
s.Require().True(res.GetGasInfo().GetGasUsed() > 0) // Gas used sometimes change, just check it's not empty.
}
})
@ -267,7 +267,7 @@ func (s IntegrationTestSuite) TestSimulateTx_GRPCGateway() {
s.Require().NoError(err)
// Check the result and gas used are correct.
s.Require().Len(result.GetResult().MsgResponses, 1)
s.Require().Equal(len(result.GetResult().GetEvents()), 13) // See TestSimulateTx_GRPC for the 13 events.
s.Require().Equal(len(result.GetResult().GetEvents()), 14) // See TestSimulateTx_GRPC for the 13 events.
s.Require().True(result.GetGasInfo().GetGasUsed() > 0) // Gas used sometimes change, jus
}
})