-
Notifications
You must be signed in to change notification settings - Fork 289
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: Imporve signer confirm tx #2970
Conversation
WalkthroughWalkthroughThe updates involve refining error handling and testing in a Go package. The Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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
747669d
to
563a154
Compare
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.
[question] IDK how this was missed in a previous PR but should https://github.com/htiennv/celestia-app/blob/563a154b4f76e1489bda929b64024677117723ff/pkg/user/signer_test.go#L72 contain a leading Test
so that it actually runs in the test suite?
Note: it passes before this PR but fails after so should be addressed prior to merging.
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.
it looks like we're still seeing quite a few tests fail, so we need to figure out why before we can merge anything. per the other review we should also clean up todo comments
Oh sorry, I will fix this PR for handle test cases! |
I have update this PR, please review it @evan-forbes @rootulp. Thanks! |
Thanks for the ping @htiennv . I'm observing that |
Thanks @rootulp, I understand why this test fails, because currently we're checking require.Equal(s.T(), context.DeadlineExceeded, err) But in this change I call so it reach error looks like: So I think we can check as follows: require.Equal(s.T(), strings.Contains(err.Error(), context.DeadlineExceeded.Error()), true) How do you feel about that? |
Hmm, slight nit but also appears fixed with: assert.Error(t, err)
assert.Contains(t, err.Error(), context.DeadlineExceeded.Error()) |
@rootulp I added some tests for ConfirmTx as you suggest. But I think case 3 (What happens if the tx if found after the second poll) is not necessary and can be ignored. |
fix order of expected vs actual
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.
Thanks for adding the test cases! I have a few comments on them
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.
Great work! Thanks for the PR
Thanks! |
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.
Nice!
This PR using a
Ticker
for periodically callGetTx
by given hash instead of aTimer
. This makes the code clean and avoids calling resetTimer
multiple times.It's similar to
WaitMined
in geth.Other changes:
pollTime