-
Notifications
You must be signed in to change notification settings - Fork 31
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: consensus messages #351
Conversation
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.
LGTM! left a few remark
app/app.go
Outdated
|
||
theType, err := proto.Marshal(resp) | ||
if err != nil { | ||
return nil |
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.
why return nil
? don't you need to append to responses
and continue?
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.
not sure about this, if the message passed but the resp is not correct?
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.
related to my previous question - should we maybe run it with cached context and if the message changed the state but the response is incorrect than simply uncommit the context? what happens in the same case if a tx runs? (i.e the response can't be marshalled?)
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.
I changed this code, but it will be a weird case when the message passes, but the response is not correct.
It looks like there will be a bug, and we end reverting the full tx.
_, isError := response.Response.(*abci.ConsensusMessageResponse_Error) | ||
require.True(t, isError, "Expected an error response but got a success") |
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.
i'd also suggest verifying the returned error string
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.
@danwt did not like to check the strings of errors
app/app.go
Outdated
if err != nil { | ||
responses = append(responses, &abci.ConsensusMessageResponse{ | ||
Response: &abci.ConsensusMessageResponse_Error{ | ||
Error: fmt.Errorf("failed to execute consensus message: %w", err).Error(), |
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.
app/app.go
Outdated
continue | ||
} | ||
|
||
resp, err := app.MsgServiceRouter().Handler(msg)(ctx, msg) |
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.
shouldn't we here pass cache ctx and than abort in case of errors?
deliver tx provides it for us automatically but afair in begin block we need to handle it manually.
i.e - if the handler fails, how does the state changes get reverted?
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.
totally, I think the abort in case of errors is not what was expected. If there is an error the context is not written and we move to next message. Only the error message is appended in the response. Check the writeCache() that is done at the end of the loop. Only if everything is perfect it is written to state.
app/app.go
Outdated
|
||
theType, err := proto.Marshal(resp) | ||
if err != nil { | ||
return nil |
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.
related to my previous question - should we maybe run it with cached context and if the message changed the state but the response is incorrect than simply uncommit the context? what happens in the same case if a tx runs? (i.e the response can't be marshalled?)
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.
Still have answered questions but approving to unblock
…xyz/rollapp-evm into feat/consensus-messages
Description
ADR link https://www.notion.so/dymension/ADR-x-Sequencer-Messages-34f95e2b579e458e8bb4252da19324bd
Closes https://github.com/dymensionxyz/epics/issues/1
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.
PR review checkboxes:
I have...
Unreleased
section inCHANGELOG.md
godoc
commentsSDK Checklist
map
time.Now()
sendCoin
and notSendCoins
Full security checklist here
----;
For Reviewer:
---;
After reviewer approval: