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): Add Send support #1639

Merged
merged 4 commits into from
Feb 9, 2024

Conversation

jefft0
Copy link
Contributor

@jefft0 jefft0 commented Feb 8, 2024

gnoclient already supports MsgCall and MsgRun. This adds Send to support MsgSend.

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
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

Signed-off-by: Jeff Thompson <jeff@thefirst.org>
@jefft0 jefft0 requested a review from moul as a code owner February 8, 2024 09:05
@jefft0 jefft0 requested a review from leohhhn February 8, 2024 09:06
@github-actions github-actions bot added the 📦 ⛰️ gno.land Issues or PRs gno.land package related label Feb 8, 2024
Copy link

codecov bot commented Feb 8, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (059a3b8) 56.12% compared to head (9633f07) 56.16%.
Report is 6 commits behind head on master.

Files Patch % Lines
gno.land/pkg/gnoclient/client_txs.go 85.71% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1639      +/-   ##
==========================================
+ Coverage   56.12%   56.16%   +0.04%     
==========================================
  Files         439      439              
  Lines       66185    66236      +51     
==========================================
+ Hits        37144    37204      +60     
+ Misses      26148    26142       -6     
+ Partials     2893     2890       -3     
Flag Coverage Δ
go-1.21.x ∅ <ø> (∅)
misc ∅ <ø> (∅)
misc-_test.genstd ∅ <ø> (∅)

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.

@leohhhn leohhhn changed the title chore: Add gnoclient Send chore(gnoclient): Add Send support Feb 8, 2024
Copy link
Contributor

@leohhhn leohhhn left a comment

Choose a reason for hiding this comment

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

This looks good, but please add some unit tests 🙏

You can see examples for unit tests with how they're done for Call.

@jefft0
Copy link
Contributor Author

jefft0 commented Feb 8, 2024

Hi @leohhhn . I'm not clear on what the unit tests should check. You mention the unit tests using a Mock for Call. These check the response from Call based on the existing code in the genesis.

assert.Equal(t, string(res.DeliverTx.Data), "it works!")

But a MsgSend doesn't have a response. Instead, it changes the state of the blockchain which must be checked by an integration test which can track a state change. This is what I did. Since MsgSend doesn't have a response, what should a unit test do?

@leohhhn
Copy link
Contributor

leohhhn commented Feb 8, 2024

@jefft0

In that case, I think adding tests that check the validity of the inputs for Send would be great. The tests would show that gnoclient.Send will error out on invalid inputs, instead of allowing for bad input and erroring from the node after sending the transaction.

Something like the following test:

func TestClient_Call_Errors(t *testing.T) {

Btw, while working on implementing this exact testing on the Run in my PR, I found a two small errors with how we validate the configs, for example here (should be == instead of <) & here (should be <=). I've fixed them in my PR, and am now checking out why the tests didn't catch them.

@jefft0
Copy link
Contributor Author

jefft0 commented Feb 8, 2024

Thanks for the details. I'll make unit tests to check for error conditions for invalid inputs.

…d_Errors.

Signed-off-by: Jeff Thompson <jeff@thefirst.org>
@jefft0
Copy link
Contributor Author

jefft0 commented Feb 9, 2024

I added unit tests.

jefft0 and others added 2 commits February 9, 2024 12:22
Co-authored-by: Leon Hudak <33522493+leohhhn@users.noreply.github.com>
Signed-off-by: Jeff Thompson <jeff@thefirst.org>
@leohhhn leohhhn merged commit 2b15731 into gnolang:master Feb 9, 2024
179 of 180 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related
Projects
Status: Done
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants