-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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(baseapp): handle cases for PostHandler in runTx #14593
Conversation
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
|
||
newCtx, err := app.postHandler(postCtx, tx, mode == runTxModeSimulate, err == nil) | ||
if err != nil { | ||
return gInfo, nil, anteEvents, priority, err | ||
// return result in case the pointer has been modified by the post decorators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what pointer? There's no pointer being passed into postHandler
.
if len(anteEvents) > 0 && (mode == runTxModeDeliver || mode == runTxModeSimulate) { | ||
// append the events in the order of occurrence | ||
postEvents = newCtx.EventManager().ABCIEvents() | ||
events = make([]abci.Event, len(anteEvents)+len(postEvents)) | ||
copy(events[:len(anteEvents)], anteEvents) | ||
copy(events[len(anteEvents):], postEvents) | ||
result.Events = append(result.Events, events...) | ||
} else { | ||
events = make([]abci.Event, len(postEvents)) | ||
copy(events, postEvents) | ||
result.Events = append(result.Events, postEvents...) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really messy IMO. runTx
is arguably the most important method of BaseApp
and the state machine in general and it's already not written in the most friendly and intuitive way. These changes exacerbate that IMO.
Also the change from anteEvents
to events
is invalid. It should remain anteEvents
because that's what we're returning.
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
what is the status here? @JeancarloBarrios @alexanderbez |
I'm not thrilled with the changes, specifically all the event logic. So we're gonna sync tomorrow. |
Description
This is a follow up PR to #13940. It includes the 3 cases for
PostHandler
logic inrunTx
.Closes: #14592 #13942
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change