-
Notifications
You must be signed in to change notification settings - Fork 376
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: add the gas estimation API to the signer #4270
Conversation
📝 WalkthroughWalkthroughThe pull request introduces two new methods to the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
✨ Finishing Touches
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
pkg/user/tx_client_test.go (1)
357-381
: Consider adding edge case tests.While the current tests cover the happy path well, consider adding tests for:
- Different transaction priorities (low, medium)
- Invalid transaction bytes
- Context cancellation/timeout scenarios
- Error cases from the gRPC client
Example test cases to add:
t.Run("query with different priorities", func(t *testing.T) { priorities := []gasestimation.TxPriority{ gasestimation.TxPriority_TX_PRIORITY_LOW, gasestimation.TxPriority_TX_PRIORITY_MEDIUM, } for _, priority := range priorities { gasPrice, err := signer.QueryGasPrice(ctx, suite.ctx.GRPCClient, priority) assert.NoError(t, err) assert.Greater(t, gasPrice, float64(0)) } }) t.Run("query with invalid tx bytes", func(t *testing.T) { invalidTx := []byte("invalid tx") _, _, err := signer.QueryGasUsedAndPrice( ctx, suite.ctx.GRPCClient, gasestimation.TxPriority_TX_PRIORITY_HIGH, invalidTx, ) assert.Error(t, err) }) t.Run("query with cancelled context", func(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() _, err := signer.QueryGasPrice(ctx, suite.ctx.GRPCClient, gasestimation.TxPriority_TX_PRIORITY_HIGH) assert.Error(t, err) })
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
pkg/user/signer.go
(2 hunks)pkg/user/tx_client_test.go
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: test / test
- GitHub Check: Summary
🔇 Additional comments (2)
pkg/user/signer.go (2)
305-322
: LGTM! Well-documented gas price estimation method.The implementation is clean, includes proper error handling, and references the architecture decision record (ADR-023) for more details.
324-346
: LGTM! Well-documented gas estimation method.The implementation correctly handles both gas price and usage estimation, includes proper error handling, and references the architecture decision record (ADR-023) for more details.
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
Hey, are there any plans to rework |
this means that the txclient will always need to have an app gRPC endpoint. is this something we want? |
but it already keeps it celestia-app/pkg/user/tx_client.go Line 138 in d43ec72
|
then let's do it |
Overview
Closes #4258
If there are other places where it would be beneficial to document the API, please let me know to make the corresponding changes.