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

Add Enable tips parameter #142

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

faddat
Copy link

@faddat faddat commented Sep 6, 2024

This PR provides a new parameter, enable_tips.

This way, it is not always necessary to support the tip concept.

@aljo242
Copy link
Collaborator

aljo242 commented Sep 6, 2024

@faddat thanks for opening this!

Could we add some tests to x/feemarket/post/fee_test to verify that this behavior is working as expected?

@faddat
Copy link
Author

faddat commented Sep 7, 2024

Absolutely, id be very happy to!

@faddat
Copy link
Author

faddat commented Sep 7, 2024

So it seems the conditional adds 18 gas -- next commit fixes existing tests.... (by adding 18 gas to them)

@faddat
Copy link
Author

faddat commented Sep 7, 2024

@aljo242 - I think this is good to go. Only thing I am unsure about right now is if I should make 18 a constant, continue to use it as a bare number, or something else

@@ -353,7 +406,7 @@ func TestPostHandleMock(t *testing.T) {
Simulate: false,
ExpPass: true,
ExpErr: nil,
ExpectConsumedGas: 15340, // extra gas consumed because msg server is run, but deduction is skipped
ExpectConsumedGas: 15412, // extra gas consumed because msg server is run, but deduction is skipped
Copy link
Author

Choose a reason for hiding this comment

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

92 = 18 * 4

proposer := sdk.AccAddress(ctx.BlockHeader().ProposerAddress)
if !tip.IsNil() {
// Only process tips if EnableTips is true
if params.EnableTips && !tip.IsNil() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If tips is not enabled, then, fee+tip should be passed to DeductCoins above

Copy link
Collaborator

Choose a reason for hiding this comment

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

The full value is already held in the escrow account, so it needs to be accounted for and not refunded

Choose a reason for hiding this comment

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

I think this is set now, and thank you!

@aljo242
Copy link
Collaborator

aljo242 commented Sep 10, 2024

@faddat we are not going to be adding any features to feemarket for the time being. The project is going to be upstreamed into the mainline cosmos sdk soon along with an audit

@mantrachain-support
Copy link

@aljo242 thanks so much for the recommended changes, and for you and Skips work on fee market. It's great!

I'll correct this nonetheless.

:)

@faddat
Copy link
Author

faddat commented Sep 12, 2024

thank you so much for this.

Do you have any suggestion on how to test for this? Because another thing that we learned here is that the tests that I wrote are probably not good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants