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

Audit BaseApp v0.46..v0.47 prepare & process proposal #13951

Closed
Tracked by #13456
amaury1093 opened this issue Nov 21, 2022 · 14 comments
Closed
Tracked by #13456

Audit BaseApp v0.46..v0.47 prepare & process proposal #13951

amaury1093 opened this issue Nov 21, 2022 · 14 comments
Assignees

Comments

@amaury1093
Copy link
Contributor

No description provided.

@amaury1093 amaury1093 mentioned this issue Nov 21, 2022
54 tasks
@amaury1093 amaury1093 changed the title prepare & process proposal Audit BaseApp v0.46..v0.47 prepare & process proposal Nov 21, 2022
@amaury1093 amaury1093 self-assigned this Nov 21, 2022
@julienrbrt julienrbrt self-assigned this Dec 19, 2022
@julienrbrt
Copy link
Member

julienrbrt commented Dec 19, 2022

Just assigning myself here to have a look at prepare & process proposal (but not auditing baseapp).

@amaury1093
Copy link
Contributor Author

Sharing my notes here: https://hackmd.io/_Aj3jciNTRiNVwLxcZ5K2A#Baseapp (scroll down to baseapp), I had mostly questions on why things were the way they were, probably nothing alarming. Also i'm going on holidays and won't be available until Jan 3rd.

@facundomedica
Copy link
Member

@JeancarloBarrios @kocubinski could you please take a look at Amaury's notes?

@facundomedica
Copy link
Member

I'm reopening @alexanderbez , there are some stuff in Amaury's notes that needs more eyes imo (points 2 through 5)

@facundomedica facundomedica reopened this Dec 22, 2022
@tac0turtle
Copy link
Member

Lets complete this issue this week, what else is left to do

@facundomedica
Copy link
Member

imo we didn't get enough feedback on some points in Amaury's notes yet.

  1. Why does PrepareProposal call ctx := app.getContextForTx(runTxPrepareProposal, []byte{}) and ProcessProposal not?
  1. Should we set ctx.{Height,Time} in PrepareProposal? (currently not:
    func (app *BaseApp) PrepareProposal(req abci.RequestPrepareProposal) abci.ResponsePrepareProposal {
    )
  1. Should we also consume block gas in Prepare and Process proposal? (currently not:
    if mode == runTxModeDeliver {
    )
  1. Also, why do we call consumeBlockGas twice in runTx?

@JeancarloBarrios
Copy link
Contributor

JeancarloBarrios commented Jan 4, 2023

  1. Should we also consume block gas in Prepare and Process proposal? (currently not:
    if mode == runTxModeDeliver {

When we did it, we assumed that only during deliver( when tx is executed) we consume gas, but I don't know if anybody else thinks it should also happen in prepare and process.

@amaury1093
Copy link
Contributor Author

My doubt was if it was possible to have a proposal with a set of tx whose gas sum is greater than the block gas limit, passes prepare & process, gets voted on, but ultimately fails on deliver?

@kocubinski
Copy link
Member

kocubinski commented Jan 4, 2023

My doubt was if it was possible to have a proposal with a set of tx whose gas sum is greater than the block gas limit, passes prepare & process, gets voted on, but ultimately fails on deliver?

I guess we could execute consumeBlockGas in mode runTxPrepareProposal and runTxProccessProposal. I think the state branching already in place would prevent gas consumption from being committed, right? No this isn't tracked in store, just in memory with a meter set in BeginBlock. I think we'd need a different meter for prepare/process, or only consume/check blockGas in one of these steps? Does that make sense?

@alexanderbez
Copy link
Contributor

Should we also consume block gas in Prepare and Process proposal?

I do NOT think so. Certainly not in PrepareProposal since that is executed by the proposer only.

Now as for ProcessProposal, you could make an argument, especially since in the future the entire block proposal can be executed there. So I vote:

  • PrepareProposal No
  • ProcessProposal Yes

@kocubinski
Copy link
Member

kocubinski commented Jan 5, 2023

  1. Also, why do we call consumeBlockGas twice in runTx?

It looks like we should remove the deferred consumeBlockGas. The inline call prevents state from being committed when consumeBlockGas panics.

This wasn't modified by the scope of the changes in ABCI 1.0 though, so maybe this can be handled separately.

@tac0turtle
Copy link
Member

can this be closed now?

@alexanderbez
Copy link
Contributor

@facundomedica are you done with the audit, correct?

@facundomedica
Copy link
Member

Yes, points 2 and 3 @AmauryM pointed out were part of the issue reported by dydx and Celestia. That's fixed. Then there are issues tracking gas consumption. So I'll close this as done ✅

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

No branches or pull requests

7 participants