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

refactor: add abci wrapper #16199

Merged
merged 2 commits into from
May 22, 2023
Merged

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented May 17, 2023

Description

Personally, as I was onboarding on the branch this PR is targeting, I was confused when updating tests and wrongly passing context that were actually going to be discarded.

This is a proposal of simplifying it. I have not thought about the possible implications, but I'd like early feedback.

What is the context supposed to be used for actually?


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)

@julienrbrt julienrbrt changed the title [proposal] refactor: simplify abci 2.0 api [proposal] refactor: add abci wrapper May 17, 2023
}

bApp.InitChain(context.Background(), &cmtabcitypes.RequestInitChain{ChainId: appName})
bApp.Commit(context.TODO(), &cmtabcitypes.RequestCommit{})
bApp.Commit()

Check warning

Code scanning / gosec

Errors unhandled.

Errors unhandled.
x/simulation/simulate.go Fixed Show fixed Hide fixed
@@ -143,7 +143,7 @@
require.False(t, finalizeSuccess)
}

app.Commit(context.TODO(), &types2.RequestCommit{})
app.Commit()

Check warning

Code scanning / gosec

Errors unhandled.

Errors unhandled.
testutil/integration/router.go Fixed Show fixed Hide fixed
testutil/integration/router.go Fixed Show fixed Hide fixed
testutil/integration/router.go Fixed Show fixed Hide fixed
simapp/test_helpers.go Fixed Show fixed Hide fixed
@alexanderbez
Copy link
Contributor

alexanderbez commented May 17, 2023

What is the context supposed to be used for actually?

Great question and one primarily for the CometBFT team. I don't see us needing the use of Go Context in any of the core ABCI methods with the exception of ExtendVote maybe (as networks calls can happen there). Otherwise, yes, I agree with you.

A good task to have is look at the CometBFT code and see what kind of Context is provided to us. Does it have a timeout or deadline?

@julienrbrt
Copy link
Member Author

julienrbrt commented May 17, 2023

What is the context supposed to be used for actually?

Great question and one primarily for the CometBFT team. I don't see us needing the use of Go Context in any of the core ABCI methods with the exception of ExtendVote maybe (as networks calls can happen there). Otherwise, yes, I agree with you.

A good task to have is look at the CometBFT code and see what kind of Context is provided to us. Does it have a timeout or deadline?

Right, I'll re-add it in ExtendVote, but it is still not used there. Let me ask comet then 👍🏾

@@ -222,7 +221,7 @@
logWriter.AddEntry(EndBlockEntry(int64(height)))

if config.Commit {
app.Commit(context.TODO(), &abci.RequestCommit{})
app.Commit()

Check warning

Code scanning / gosec

Errors unhandled.

Errors unhandled.
@julienrbrt julienrbrt marked this pull request as ready for review May 17, 2023 22:04
@julienrbrt julienrbrt requested a review from a team as a code owner May 17, 2023 22:04
@julienrbrt julienrbrt changed the title [proposal] refactor: add abci wrapper refactor: add abci wrapper May 17, 2023
@github-actions github-actions bot added the C:x/genutil genutil module issues label May 17, 2023
@alexanderbez
Copy link
Contributor

@julienrbrt any updates from CometBFT exploration?

@julienrbrt
Copy link
Member Author

julienrbrt commented May 18, 2023

@julienrbrt any updates from CometBFT exploration?

Yes, see on Slack. To sum-up for another reader, they have no plan to use it soon.

@alexanderbez
Copy link
Contributor

@julienrbrt any updates from CometBFT exploration?

Yes, see on Slack. To sum-up for another reader, they have no plan to use it soon.

I see. Yes, we should keep Context for ExtendVote and any query-related methods.

@tac0turtle
Copy link
Member

my thinking is we will break this api again in the future with runtime modules, so doing one break with contexts and our own types makes sense. Id be open to merging this for now to reduce breakage for this release

@julienrbrt julienrbrt merged commit af38979 into bez/feature/abci-2.0-base May 22, 2023
@julienrbrt julienrbrt deleted the julien/abci-wrapper branch May 22, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants