Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tx fee event #9860

Merged
merged 9 commits into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ var (

AttributeKeyAccountSequence = "acc_seq"
AttributeKeySignature = "signature"
AttributeKeyFee = "fee"

EventTypeMessage = "message"

Expand Down
6 changes: 6 additions & 0 deletions x/auth/ante/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo
}
}

var events sdk.Events
events = append(events, sdk.NewEvent(sdk.EventTypeTx,
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved
sdk.NewAttribute(sdk.AttributeKeyFee, feeTx.GetFee().String()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR Colin!

This is the total fee payed by the tx, represented as a coin/denom?
I'm trying to test this with Hermes and will provide feedback on how easy is it for the relayer to use the fee info.

As a side-note, I'm trying to rebuild my local gaiad using this branch, and was wondering if there any instructions for doing that. I'm patching my gaia go.mod but not sure that's the right approach.

Copy link
Contributor Author

@colin-axner colin-axner Aug 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is the total fee, but the fee may be multiple coins. Each coin would be represented by denom/amount. An empty coin set returns an empty string

Using the SDK's simd binary is another alternative to gaiad. You can run make build or make install depending on your usage

Edit: I realize SDK's simd doesn't have IBC

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the entire fee. In the case of the Hub, it would be Nuatom, but could be multiple coins as @colin-axner pointed out, e.g. Nuatom,Yphoton

))
ctx.EventManager().EmitEvents(events)

return next(ctx, tx, simulate)
}

Expand Down