-
Notifications
You must be signed in to change notification settings - Fork 30
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
add tx decoder #2415
add tx decoder #2415
Conversation
Warning Rate Limit Exceeded@trajan0x has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 28 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. WalkthroughThe update introduces a script named 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.
Actionable comments posted: 2
Review Status
Configuration used: .coderabbit.yaml
Files selected for processing (1)
- contrib/scripts/txdecoder.sh (1 hunks)
Additional Context Used
Additional comments not posted (1)
contrib/scripts/txdecoder.sh (1)
22-22
: The conversion for thetype
field usingcast --to-dec
might not be appropriate, astype
is typically not a numeric value that requires decimal conversion. It's important to ensure that the conversion logic aligns with the expected data types and formats of the transaction fields.Consider reviewing the conversion logic for the
type
field to ensure it's meaningful and relevant.
contrib/scripts/txdecoder.sh
Outdated
echo "Type: $(cast --to-dec $type)" # This specific conversion might not make sense for 'type', as it's not a value field. | ||
echo "Gas: $(cast --to-dec $gas)" | ||
echo "Value: $(cast --to-unit $value ether)" | ||
echo "Nonce: $(cast --to-dec $nonce)" | ||
echo "MaxPriorityFeePerGas: $(cast --to-unit $maxPriorityFeePerGas gwei)" | ||
echo "MaxFeePerGas: $(cast --to-unit $maxFeePerGas gwei)" |
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.
To ensure the script's stability and prevent potential issues with globbing and word splitting, it's advisable to double-quote variables in all command substitutions.
- echo "Type: $(cast --to-dec $type)"
- echo "Gas: $(cast --to-dec $gas)"
- echo "Value: $(cast --to-unit $value ether)"
- echo "Nonce: $(cast --to-dec $nonce)"
- echo "MaxPriorityFeePerGas: $(cast --to-unit $maxPriorityFeePerGas gwei)"
- echo "MaxFeePerGas: $(cast --to-unit $maxFeePerGas gwei)"
+ echo "Type: $(cast --to-dec "$type")"
+ echo "Gas: $(cast --to-dec "$gas")"
+ echo "Value: $(cast --to-unit "$value" ether)"
+ echo "Nonce: $(cast --to-dec "$nonce")"
+ echo "MaxPriorityFeePerGas: $(cast --to-unit "$maxPriorityFeePerGas" gwei)"
+ echo "MaxFeePerGas: $(cast --to-unit "$maxFeePerGas" gwei)"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
echo "Type: $(cast --to-dec $type)" # This specific conversion might not make sense for 'type', as it's not a value field. | |
echo "Gas: $(cast --to-dec $gas)" | |
echo "Value: $(cast --to-unit $value ether)" | |
echo "Nonce: $(cast --to-dec $nonce)" | |
echo "MaxPriorityFeePerGas: $(cast --to-unit $maxPriorityFeePerGas gwei)" | |
echo "MaxFeePerGas: $(cast --to-unit $maxFeePerGas gwei)" | |
echo "Type: $(cast --to-dec "$type")" # This specific conversion might not make sense for 'type', as it's not a value field. | |
echo "Gas: $(cast --to-dec "$gas")" | |
echo "Value: $(cast --to-unit "$value" ether)" | |
echo "Nonce: $(cast --to-dec "$nonce")" | |
echo "MaxPriorityFeePerGas: $(cast --to-unit "$maxPriorityFeePerGas" gwei)" | |
echo "MaxFeePerGas: $(cast --to-unit "$maxFeePerGas" gwei)" |
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.
rawTx=$1 | ||
|
||
# Decode the transaction using cast dt and store the result in a variable | ||
decodedTx=$(cast dt $rawTx) |
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.
To prevent globbing and word splitting, double-quote variables in command substitutions.
- decodedTx=$(cast dt $rawTx)
+ decodedTx=$(cast dt "$rawTx")
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
decodedTx=$(cast dt $rawTx) | |
decodedTx=$(cast dt "$rawTx") |
type=$(echo "$decodedTx" | jq -r '.type') | ||
|
||
# Convert the type from hexadecimal to decimal | ||
txType=$(cast --to-dec $type) |
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.
Double-quote variables to prevent globbing and word splitting.
- txType=$(cast --to-dec $type)
+ txType=$(cast --to-dec "$type")
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
txType=$(cast --to-dec $type) | |
txType=$(cast --to-dec "$type") |
echo "Gas: $(cast --to-dec $gas)" | ||
echo "Value: $(cast --to-unit $value ether)" | ||
echo "Nonce: $(cast --to-dec $nonce)" |
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.
Ensure variables are double-quoted in command substitutions to prevent globbing and word splitting.
- echo "Gas: $(cast --to-dec $gas)"
- echo "Value: $(cast --to-unit $value ether)"
- echo "Nonce: $(cast --to-dec $nonce)"
+ echo "Gas: $(cast --to-dec "$gas")"
+ echo "Value: $(cast --to-unit "$value" ether)"
+ echo "Nonce: $(cast --to-dec "$nonce")"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
echo "Gas: $(cast --to-dec $gas)" | |
echo "Value: $(cast --to-unit $value ether)" | |
echo "Nonce: $(cast --to-dec $nonce)" | |
echo "Gas: $(cast --to-dec "$gas")" | |
echo "Value: $(cast --to-unit "$value" ether)" | |
echo "Nonce: $(cast --to-dec "$nonce")" |
if [[ "$txType" == "0" ]]; then | ||
# Transaction type 0 specific field | ||
gasPrice=$(echo "$decodedTx" | jq -r '.gasPrice') | ||
echo "GasPrice: $(cast --to-unit $gasPrice gwei)" |
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.
Double-quote variables in command substitutions to avoid globbing and word splitting.
- echo "GasPrice: $(cast --to-unit $gasPrice gwei)"
+ echo "GasPrice: $(cast --to-unit "$gasPrice" gwei)"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
echo "GasPrice: $(cast --to-unit $gasPrice gwei)" | |
echo "GasPrice: $(cast --to-unit "$gasPrice" gwei)" |
echo "MaxPriorityFeePerGas: $(cast --to-unit $maxPriorityFeePerGas gwei)" | ||
echo "MaxFeePerGas: $(cast --to-unit $maxFeePerGas gwei)" |
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.
Prevent globbing and word splitting by double-quoting variables in command substitutions.
- echo "MaxPriorityFeePerGas: $(cast --to-unit $maxPriorityFeePerGas gwei)"
- echo "MaxFeePerGas: $(cast --to-unit $maxFeePerGas gwei)"
+ echo "MaxPriorityFeePerGas: $(cast --to-unit "$maxPriorityFeePerGas" gwei)"
+ echo "MaxFeePerGas: $(cast --to-unit "$maxFeePerGas" gwei)"
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
echo "MaxPriorityFeePerGas: $(cast --to-unit $maxPriorityFeePerGas gwei)" | |
echo "MaxFeePerGas: $(cast --to-unit $maxFeePerGas gwei)" | |
echo "MaxPriorityFeePerGas: $(cast --to-unit "$maxPriorityFeePerGas" gwei)" | |
echo "MaxFeePerGas: $(cast --to-unit "$maxFeePerGas" gwei)" |
Description
Adds tx decoder
Summary by CodeRabbit