Skip to content

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

Merged
jmalicevic merged 9 commits into
tendermint:masterfrom
hvanz:hernan/abci-cli-process-proposal
Jul 5, 2022
Merged

jmalicevic merged 9 commits into
tendermint:masterfrom
hvanz:hernan/abci-cli-process-proposal

Conversation

@hvanz

@hvanz hvanz commented Jun 29, 2022

Copy link
Copy Markdown

Closes #8644

@sergio-mena sergio-mena left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread abci/cmd/abci-cli/abci-cli.go Outdated
}

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread abci/cmd/abci-cli/abci-cli.go Resolved
@sergio-mena

sergio-mena commented Jul 1, 2022 •

Copy link
Copy Markdown
Contributor

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

Please take a look

Comment thread abci/example/kvstore/kvstore.go Resolved
@jmalicevic

Copy link
Copy Markdown
Contributor

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

@sergio-mena

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

I think this change deserves an entry into the changelog.

@sergio-mena

Copy link
Copy Markdown
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 mentioned this pull request Jul 22, 2022
35 tasks done
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 <[email protected]>
Co-authored-by: Jasmina Malicevic <[email protected]>
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 <[email protected]>
Co-authored-by: Jasmina Malicevic <[email protected]>

* Addressed @williambanfield's comment

Co-authored-by: Jasmina Malicevic <[email protected]>
Co-authored-by: Hernán Vanzetto <[email protected]>
@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

None yet

Development

Successfully merging this pull request may close these issues.

abci-cli: Implement command for ProcessProposal

3 participants