Skip to content

fix: revise to call Begin/EndRecheck even though mem.Size() is 0#162

Merged
jinsan-line merged 2 commits intoFinschia:feat/perffrom
jinsan-line:begin-recheck
Jan 13, 2021
Merged

fix: revise to call Begin/EndRecheck even though mem.Size() is 0#162
jinsan-line merged 2 commits intoFinschia:feat/perffrom
jinsan-line:begin-recheck

Conversation

@jinsan-line
Copy link

@jinsan-line jinsan-line commented Jan 12, 2021

Related with: https://github.com/line/link/issues/1151, #160

Description

W/ #160 CONTRACT, we need to call Begin/EndRecheck even though mem.Size() is 0. IMHO, it's conceptually expected behavior to call Begin/EndRecheck even though mem.Size() is 0. We could compare it w/ Begine/EndBlock that are called even though there is no deliverTx.

What I've got from the team

  • Only when mem.config.Recheck is true, call Begin/EndRecheck.
    • Conceptually it's more acceptable and readable.
    • This approach could cause an issue if mem.config.Recheck is false but
      • W/o this change, there is already issues if mem.config.Recheck is false.
      • mem.config.Recheck is configured true for all phase and all chain.
      • We don't have any plan to set it false and also it seems to be almost impossible.
  • Discuss more whether removing mem.config.Recheck or not w/ other issue/PR.

Need to discuss

  • How about removing mem.config.Recheck to restrict misuse it?
    • ~~cosmos-sdk assumes that recheck is working in terms of managing account sequence. ~~
    • If we disable recheck, we might get problems related with account sequence.
    • The PR could look like weird because it calls Begin/EndRecheck even when mem.config.Recheck is false.
    • We actually need to call these even when mem.config.Recheck is false.

I'd like to hear the team's opinion.


For contributor use:

  • Wrote tests
  • Updated CHANGELOG_PENDING.md
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments
  • Re-reviewed Files changed in the Github PR explorer

@egonspace
Copy link
Contributor

Would you explain why we should call BeginRecheckTx even when mem.size() is zero?

Copy link

@kukugi kukugi left a comment

Choose a reason for hiding this comment

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

LGTM 👍

mem.metrics.Size.Set(float64(mem.Size()))

return nil
return err
Copy link

Choose a reason for hiding this comment

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

you can omit err because you define variable in return type. so it can be just return

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@egonspace egonspace left a comment

Choose a reason for hiding this comment

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

LGTM

@jinsan-line
Copy link
Author

Please could anyone review this PR? @tnasu @torao @kokeshiM0chi

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.

6 participants