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

abci-cli: Add process_proposal command to abci-cli #8901

Merged

Conversation

hvanz
Copy link
Contributor

@hvanz hvanz commented Jun 29, 2022

Closes #8644

Copy link
Contributor

@sergio-mena sergio-mena left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this Hernán

@@ -682,6 +700,38 @@ func cmdPrepareProposal(cmd *cobra.Command, args []string) error {
return nil
}

func cmdProcessProposal(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the app accepts empty blocks, would we want to do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both PrepareProposal and ProcessProposal in kvstore accept empty blocks (that is, requests with the field Txs having an empty array). PrepareProposal will just return an empty array in the field TxRecords, and ProcessProposal will return "accept". But empty blocks will never reach the application through abci-cli, because abci-cli does not accept an empty list of arguments for these two types of requests. So to keep it consistent with the application, probably the if len(args) == 0 ... block should be removed, for both commands.

Copy link
Contributor

Choose a reason for hiding this comment

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

My initial question was motivated by this thought:
"Would it be good for abci-cli to accept ProcessProposal without arguments to denote an empty block?"

Copy link
Contributor

Choose a reason for hiding this comment

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

If it is correct behaviour for TM to accept empty blocks then Hernan is right, we should remove this check from both commands unless we think that for the kvstore app it does not make sense. I don't think it matters much, but if ProcessProposal accepts empty blocks, then PrepareProposal should too. We should keep the two consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So what is the correct behaviour? Does Tendermint accept empty blocks? And the applications?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think so, although not sure about Query. Please don't modify Query for the time being

If you run into problems with regressions, etc, let me know

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed a commit to allow empty blocks in PrepareProposal, ProcessProposal, and FinalizeBlock. CheckTx is not about blocks, it's only for one transaction, so I didn't change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

The changes look good but can you add a test in the files (the ones Sergio added) that have no transactions to make sure nothing will explode (maybe we have places where we assume that the transaction array is not empty) like in the actual function implementations within kvstore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check the tests that I added. In particular, prepare_proposal for an empty block does not display in the console code: OK. This is expected because code: OK is printed for each transaction, and in this case there are none.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks Hernán. I just pushed a small commit to keep the tutorial in sync with ex1.abci.out

abci/cmd/abci-cli/abci-cli.go Show resolved Hide resolved
@sergio-mena
Copy link
Contributor

sergio-mena commented Jul 1, 2022

As discussed offline, I pushed a commit to include the new command into the "tutorial" abci-cli tests.

Please take a look

@jmalicevic
Copy link
Contributor

Seems all good if we want the transactions to be rejected after "Prepare" is removed then all is fine.

@sergio-mena
Copy link
Contributor

Seems all good if we want the transactions to be rejected after "Prepare" is removed then all is fine.
Merge state

Note that I left the bug Hernán found with MBT (I think he has a patch to fix it): we should remove the len(tx) == 0 condition

@jmalicevic
Copy link
Contributor

Yes, I think that's better done as a separate PR.

@jmalicevic jmalicevic changed the title Add process_proposal command to abci-cli abci-cli: Add process_proposal command to abci-cli Jul 4, 2022
@jmalicevic
Copy link
Contributor

I think this change deserves an entry into the changelog.

@sergio-mena
Copy link
Contributor

I think this change deserves an entry into the changelog.

That's a very good point

@jmalicevic jmalicevic merged commit 3cde9a0 into tendermint:master Jul 5, 2022
@hvanz hvanz deleted the hernan/abci-cli-process-proposal branch July 5, 2022 13:11
@sergio-mena sergio-mena added this to In progress in ABCI++ via automation Jul 5, 2022
@sergio-mena sergio-mena moved this from In progress to Done in ABCI++ Jul 5, 2022
@sergio-mena sergio-mena mentioned this pull request Jul 22, 2022
35 tasks
sergio-mena added a commit that referenced this pull request Aug 17, 2022
…ci-cli (#8901)

* Add `process_proposal` command to abci-cli

* Added process proposal to the 'tutorial' examples

* Added entry in CHANGELOG_PENDING.md

* Allow empty blocks in PrepareProposal, ProcessProposal, and FinalizeBlock

* Fix minimum arguments

* Add tests for empty block

* Updated abci-cli doc

Co-authored-by: Sergio Mena <sergio@informal.systems>
Co-authored-by: Jasmina Malicevic <jasmina.dustinac@gmail.com>
sergio-mena added a commit that referenced this pull request Aug 17, 2022
* [cherrypicked] abci-cli: added `PrepareProposal` command to cli (#8656)

* Prepare prosal cli

* [cherrypicked + fixes] abci-cli: Add `process_proposal` command to abci-cli (#8901)

* Add `process_proposal` command to abci-cli

* Added process proposal to the 'tutorial' examples

* Added entry in CHANGELOG_PENDING.md

* Allow empty blocks in PrepareProposal, ProcessProposal, and FinalizeBlock

* Fix minimum arguments

* Add tests for empty block

* Updated abci-cli doc

Co-authored-by: Sergio Mena <sergio@informal.systems>
Co-authored-by: Jasmina Malicevic <jasmina.dustinac@gmail.com>

* Addressed @williambanfield's comment

Co-authored-by: Jasmina Malicevic <jasmina.dustinac@gmail.com>
Co-authored-by: Hernán Vanzetto <hernan.vanzetto@gmail.com>
@hvanz hvanz mentioned this pull request Sep 12, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

abci-cli: Implement command for ProcessProposal
3 participants