Closed sideninja closed 3 months ago
[!WARNING]
Rate limit exceeded
@sideninja has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 29 seconds before requesting another review.
How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit.How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.Commits
Files that changed from the base of the PR and between c52bbf05a9d01b426aa7c33db12105b4498f5031 and fc2919a60602c67d500808e2e339c0f1e5d96a86.
The recent changes enhance the BlockChainAPI
and error handling in the server's response logging. Key functions for retrieving blockchain data were removed, suggesting a new approach to access this information. Error handling has been standardized across several methods, improving consistency and clarity. Additionally, a new test was added to validate the handling of non-existing blocks in Web3, strengthening the overall robustness of the API.
Files | Change Summary |
---|---|
api/api.go |
Removed functions: ChainId , Coinbase , GasPrice . Standardized error handling in methods like Syncing , GetBlockReceipts , improving logging consistency. |
api/server.go |
Enhanced error logging in Write method. Introduced errorIs function for clearer error checking. |
tests/web3js/eth_non_interactive_test.js |
Added a test for web3.eth.getBlock and web3.eth.getTransactionFromBlock to handle non-existing block heights, ensuring robust error handling. |
sequenceDiagram
participant Client
participant API
participant Logger
Client->>API: Request blockchain data
API->>Logger: Log request
API->>Client: Return data
alt Error occurs
API->>Logger: Log error
API-->>Client: Return error response
end
🐇 "In the code where bunnies hop,
Functions change and errors stop.
New tests ensure that all is right,
In our world of code so bright!
Through the logs, we dance with glee,
Robust and happy, as we should be!" 🌼
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?
diff --git a/api/api.go b/api/api.go
index 85648ab..7f14441 100644
--- a/api/api.go
+++ b/api/api.go
@@ -879,6 +879,7 @@ func handleError[T any](log zerolog.Logger, err error) (T, error) {
var (
zero T
errGasPriceTooLow *errs.GasPriceTooLowError
+ revertError *errs.RevertError
)
switch {
@@ -895,6 +896,8 @@ func handleError[T any](log zerolog.Logger, err error) (T, error) {
return zero, err
case errors.As(err, &errGasPriceTooLow):
return zero, errGasPriceTooLow
+ case errors.As(err, &revertError):
+ return zero, revertError
default:
log.Error().Err(err).Msg("api error")
return zero, errs.ErrInternal
(END)
@sideninja We need the above change, to properly handle revert errors in eth_sendRawTransaction
/ eth_call
/ eth_estimateGas
.
Smaller improvements to API error handling and logging.
For contributor use:
master
branchFiles changed
in the Github PR explorerSummary by CodeRabbit
Bug Fixes
New Features