-
Notifications
You must be signed in to change notification settings - Fork 10
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
Validate TransactionArgs
passed in eth_estimateGas
& eth_call
JSON-RPC endpoints
#320
Conversation
Warning Rate limit exceeded@m-Peter has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 49 minutes and 54 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 for further information. WalkthroughThe recent changes enhance validation and error handling within the Changes
Poem
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- api/api.go (2 hunks)
- api/models.go (2 hunks)
- api/models_test.go (1 hunks)
Additional comments not posted (3)
api/models_test.go (1)
14-149
: Comprehensive Testing for Transaction ValidationThe
TestValidateTransaction
function is well-implemented, covering a broad range of scenarios from valid transactions to various error conditions like conflicting inputs and invalid transaction data. The use of table-driven tests enhances the maintainability and readability of the test code.api/models.go (1)
41-107
: Robust Validation Logic inTransactionArgs.Validate
The
Validate
method in theTransactionArgs
struct is robust, covering crucial checks against ambiguous inputs, contract creation conditions, and transaction data format compliance. This method is critical for ensuring the integrity of transactions processed by the system.api/api.go (1)
490-493
: Proper Validation and Error Handling inBlockChainAPI.Call
The addition of
args.Validate()
at the beginning of theCall
method is a good practice. It ensures that the transaction arguments are verified before any further processing, which is crucial for maintaining the integrity and reliability of the API.
@@ -33,6 +38,75 @@ type TransactionArgs struct { | |||
ChainID *hexutil.Big `json:"chainId,omitempty"` | |||
} | |||
|
|||
func (txArgs TransactionArgs) Validate() error { |
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
gasLimit := uint64(125_000) | ||
|
||
nonce := uint64(1) | ||
tests := map[string]struct { |
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.
🧡
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!
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- api/api.go (2 hunks)
- api/models.go (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- api/api.go
- api/models.go
b7e8d6c
to
f3c8beb
Compare
Work towards: #117
Description
Perform the applicable validation rules from https://github.com/onflow/go-ethereum/blob/master/signer/fourbyte/validation.go#L29-L32 .
The same rules are also applied to the transaction payload in
eth_sendRawTransaction
.For contributor use:
master
branchFiles changed
in the Github PR explorerSummary by CodeRabbit
New Features
Tests