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: increase gas cost for submit proposal #9995

Merged
merged 19 commits into from Sep 29, 2021

Conversation

atheeshp
Copy link
Contributor

Description

Closes: #9683


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@orijbot
Copy link

orijbot commented Sep 3, 2021

@codecov
Copy link

codecov bot commented Sep 3, 2021

Codecov Report

Merging #9995 (196180f) into master (16a953c) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9995      +/-   ##
==========================================
- Coverage   63.67%   63.65%   -0.02%     
==========================================
  Files         573      573              
  Lines       53807    53816       +9     
==========================================
  Hits        34259    34259              
- Misses      17599    17608       +9     
  Partials     1949     1949              
Impacted Files Coverage Δ
x/gov/keeper/msg_server.go 1.53% <0.00%> (-0.12%) ⬇️

@atheeshp atheeshp marked this pull request as ready for review September 3, 2021 10:34
return nil, err
}

ctx.BlockGasMeter().ConsumeGas(uint64(3*gasCostPerStorage*len(bytes)), "Submit proposal")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

any thought on this gas value?
cc: @robert-zaremba

Copy link
Contributor

Choose a reason for hiding this comment

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

How did we come up with this value? Personally, i think a min self-deposit approach is better because we can then just tweak the param.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We are automatically deleting it - so the motivation here is to pay for that operation. Deposit doesn't really pay for the operation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@atheeshp could you link the issue next to the line to explain why we do it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the initial deposit does @robert-zaremba

Copy link
Collaborator

Choose a reason for hiding this comment

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

The deposit is returned. Here we want to consume a gas for the EndBlocker operations.

Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't think this is a clean approach, but I can't think of a more streamlined way atm.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here we want to consume a gas for the EndBlocker operations.

Shouldn't we then charge exactly what EndBlocker consumes? if I'm not mistaken, it would be gas_cost_per_READ * len(proposal_bytes * {the number of blocks where it gets read}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is what we are charging for: submit proposal, inactive queue operation, active queue operation.

Copy link
Collaborator

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

pre approving. Please add a link (in a comment) to the issue in the line where we increase the gas consumption.

return nil, err
}

ctx.BlockGasMeter().ConsumeGas(uint64(3*gasCostPerStorage*len(bytes)), "Submit proposal")
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are automatically deleting it - so the motivation here is to pay for that operation. Deposit doesn't really pay for the operation.

return nil, err
}

ctx.BlockGasMeter().ConsumeGas(uint64(3*gasCostPerStorage*len(bytes)), "Submit proposal")
Copy link
Collaborator

Choose a reason for hiding this comment

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

@atheeshp could you link the issue next to the line to explain why we do it?

x/gov/keeper/msg_server.go Outdated Show resolved Hide resolved
@robert-zaremba robert-zaremba added A:automerge Automatically merge PR once all prerequisites pass. and removed A:automerge Automatically merge PR once all prerequisites pass. labels Sep 21, 2021
x/gov/keeper/msg_server.go Outdated Show resolved Hide resolved
x/gov/keeper/msg_server.go Outdated Show resolved Hide resolved
x/gov/keeper/msg_server.go Outdated Show resolved Hide resolved
@amaury1093
Copy link
Contributor

This change is worth a changelog entry too

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

LGTM, but the charged gas seems arbitrary to me too. I'm proposing #9995 (comment)

Not blocking the PR because of this though.

x/gov/abci_test.go Outdated Show resolved Hide resolved
@amaury1093
Copy link
Contributor

@alexanderbez Are you okay with the current changes? If yes, we can merge this PR?

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Yes

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:x/gov
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase the x/gov MsgSubmitProposal cost and don't delete dead proposals.
6 participants