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

chore: gnoclient: Require Caller in Msg. Remove syntax sugar Msgs #2715

Merged

Conversation

jefft0
Copy link
Contributor

@jefft0 jefft0 commented Aug 20, 2024

BREAKING CHANGE: The gnoclient API provides "syntax sugar" slices of messages like MsgCall. This PR removes them and instead uses the vm message definitions directly (without modification). This requires users of the gnoclient API to specify all needed fields, including Caller but it also simplifies the Sign logic. The concerns of message creation and message handling are now separated.

  • Remove "syntax sugar" MsgCall, MsgSend, MsgRun and MsgAddPackage.
  • Remove the related validateMsgCall, validateMsgSend, validateMsgRun and validateMsgAddPackage.
  • In Call, etc. change the msgs param to use vm.MsgCall, etc. Use the ValidateBasic method of these types.
  • Do not set the Caller from the Signer. Expect the Caller field to already be filled in.
  • In client_test.go and integration_test.go, specify the Caller where needed.
  • In client_test.go error tests, change expectedError to a string and use assert.ErrorContains. (This allows mixing errors that are defined by a type with errors defined as singleton objects.)
  • Update contribs/gnodev/pkg/dev/node_state_test.go to use vm.MsgCall.
Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description

@github-actions github-actions bot added the 📦 ⛰️ gno.land Issues or PRs gno.land package related label Aug 20, 2024
@zivkovicmilos zivkovicmilos self-requested a review August 20, 2024 17:16
@jefft0 jefft0 force-pushed the chore/gnoclient-require-Caller-in-Msg branch from 61e0d49 to 453aba8 Compare August 21, 2024 09:44
Copy link

codecov bot commented Aug 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.21%. Comparing base (aae5d49) to head (523211f).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2715      +/-   ##
==========================================
- Coverage   60.23%   60.21%   -0.02%     
==========================================
  Files         562      562              
  Lines       75091    75026      -65     
==========================================
- Hits        45228    45179      -49     
+ Misses      26482    26474       -8     
+ Partials     3381     3373       -8     
Flag Coverage Δ
contribs/gnodev 61.40% <ø> (ø)
contribs/gnofaucet 14.46% <ø> (ø)
gno.land 64.61% <100.00%> (-0.16%) ⬇️
gnovm 64.33% <ø> (ø)
misc/genstd 80.54% <ø> (ø)
misc/logos 19.88% <ø> (-0.36%) ⬇️
tm2 61.97% <ø> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jefft0 jefft0 marked this pull request as ready for review August 21, 2024 14:25
@leohhhn
Copy link
Contributor

leohhhn commented Aug 21, 2024

Hey @jefft0, please make sure to update the official documentation if needed as well, for example the how-to guide. 🙏

https://github.com/gnolang/gno/blob/master/docs/how-to-guides/connecting-from-go.md

@jefft0 jefft0 requested a review from moul as a code owner August 22, 2024 07:24
@jefft0
Copy link
Contributor Author

jefft0 commented Aug 22, 2024

Hey @jefft0, please make sure to update the official documentation if needed as well, for example the how-to guide.

Thanks. @leohhhn . I pushed the commit. 164b1b4

Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

Now it's super simple 💅

Looks good 💯

docs/how-to-guides/connecting-from-go.md Show resolved Hide resolved
docs/how-to-guides/connecting-from-go.md Outdated Show resolved Hide resolved
@zivkovicmilos zivkovicmilos added the breaking change Functionality that contains breaking changes label Aug 22, 2024
@zivkovicmilos zivkovicmilos merged commit 757cc84 into gnolang:master Aug 22, 2024
117 of 118 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Functionality that contains breaking changes 📦 ⛰️ gno.land Issues or PRs gno.land package related
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants