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!: Comet v0.38 Integration #15519

Merged
merged 97 commits into from
May 24, 2023
Merged

feat!: Comet v0.38 Integration #15519

merged 97 commits into from
May 24, 2023

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Mar 22, 2023

Description

This PR acts as the base feature PR for Comet v0.38 integration into the SDK. Primarily, it contains the following:

  • Update of go.mod deps
  • Updates to existing ABCI methods in abci.go
  • A (partial) implementation of FinalizeBlock

Subsequent PRs should be based off of this branch and use this branch as the base branch when creating PRs.

ref: #12272


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)

baseapp/abci.go Outdated Show resolved Hide resolved
baseapp/abci.go Fixed Show resolved Hide resolved
baseapp/abci.go Fixed Show fixed Hide fixed
baseapp/abci.go Fixed Show fixed Hide fixed
baseapp/abci.go Outdated Show resolved Hide resolved
baseapp/abci.go Fixed Show resolved Hide resolved
baseapp/abci.go Fixed Show fixed Hide fixed
@alexanderbez alexanderbez marked this pull request as ready for review April 6, 2023 13:40
@alexanderbez alexanderbez requested a review from a team as a code owner April 6, 2023 13:40
@alexanderbez alexanderbez changed the title feat!: [DNM] Comet v0.38 Integration feat!: Comet v0.38 Integration [1/n] Apr 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2023

@alexanderbez your pull request is missing a changelog!

baseapp/abci.go Outdated
Comment on lines 359 to 424
}
}

return res
return resp
}

// EndBlock implements the ABCI interface.
func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBlock) {
if app.deliverState.ms.TracingEnabled() {
app.deliverState.ms = app.deliverState.ms.SetTracingContext(nil).(storetypes.CacheMultiStore)
}
func (app *BaseApp) legacyEndBlock(req *abci.RequestFinalizeBlock) sdk.LegacyResponseEndBlock {
var (
resp sdk.LegacyResponseEndBlock
err error
)

// TODO: Fill out!
legacyReq := sdk.LegacyRequestEndBlock{}

if app.endBlocker != nil {
var err error
res, err = app.endBlocker(app.deliverState.ctx, req)
resp, err = app.endBlocker(app.finalizeBlockState.ctx, legacyReq)
if err != nil {
panic(err)
}
res.Events = sdk.MarkEventsToIndex(res.Events, app.indexEvents)

resp.Response.Events = sdk.MarkEventsToIndex(resp.Response.Events, app.indexEvents)
}

cp := app.GetConsensusParams(app.deliverState.ctx)
res.ConsensusParamUpdates = &cp
cp := app.GetConsensusParams(app.finalizeBlockState.ctx)
resp.Response.ConsensusParamUpdates = &cp

// call the streaming service hook with the EndBlock messages
for _, abciListener := range app.streamingManager.ABCIListeners {
ctx := app.deliverState.ctx
ctx := app.finalizeBlockState.ctx
blockHeight := ctx.BlockHeight()

// TODO: Figure out what to do with ListenEndBlock and the types necessary
// as we cannot have the store sub-module depend on the root SDK module.
//
// Ref: https://github.com/cosmos/cosmos-sdk/issues/12272
if err := abciListener.ListenEndBlock(ctx, req, res); err != nil {
app.logger.Error("EndBlock listening hook failed", "height", blockHeight, "err", err)
}
}

return res
return resp
}

// CheckTx implements the ABCI interface and executes a tx in CheckTx mode. In
// CheckTx mode, messages are not executed. This means messages are only validated
// and only the AnteHandler is executed. State is persisted to the BaseApp's
// internal CheckTx state if the AnteHandler passes. Otherwise, the ResponseCheckTx
// will contain relevant error information. Regardless of tx execution outcome,
// the ResponseCheckTx will contain relevant gas execution context.
func (app *BaseApp) CheckTx(_ context.Context, req *abci.RequestCheckTx) (*abci.ResponseCheckTx, error) {
var mode runTxMode

switch {
case req.Type == abci.CheckTxType_New:
mode = runTxModeCheck

case req.Type == abci.CheckTxType_Recheck:
mode = runTxModeReCheck

default:
panic(fmt.Sprintf("unknown RequestCheckTx type: %s", req.Type))
}

gInfo, result, anteEvents, err := app.runTx(mode, req.Tx)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Change potentially affects state.

Call sequence:

(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).DeliverTx (baseapp/abci.go:410)

@github-actions github-actions bot removed C:x/crisis C:Hubl Tool: Hubl Type: CI C:Confix Issues and PR related to Confix C:x/mint C:log C:Cosmovisor Issues and PR related to Cosmovisor C:collections C:orm labels May 24, 2023
baseapp/abci.go Outdated Show resolved Hide resolved
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

lgtm!

baseapp/abci.go Outdated Show resolved Hide resolved
@tac0turtle tac0turtle enabled auto-merge May 24, 2023 15:54
@tac0turtle tac0turtle added this pull request to the merge queue May 24, 2023
Merged via the queue into main with commit 6cee22d May 24, 2023
@tac0turtle tac0turtle deleted the bez/feature/abci-2.0-base branch May 24, 2023 16:11
@coderabbitai coderabbitai bot mentioned this pull request May 3, 2024
12 tasks
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.

8 participants