-
Notifications
You must be signed in to change notification settings - Fork 19
do not save non-existing to_address as null address #207
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
do not save non-existing to_address as null address #207
Conversation
WalkthroughThe changes update the handling of empty or zero "to" addresses in transaction serialization and deserialization. The serializer now assigns the "to" address directly without substituting a zero address, while the deserializer replaces a 42-byte zero "to" address with an empty string. A new constant for the zero address is introduced. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Serializer
participant Deserializer
Client->>Serializer: serializeTransaction(txMap)
Serializer-->>Client: Transaction (with "to" assigned directly)
Client->>Deserializer: scanTransaction(rows)
Deserializer->>Deserializer: Check if ToAddress == ZERO_BYTES_42
alt ToAddress is zero
Deserializer->>Deserializer: Replace ToAddress with ""
end
Deserializer-->>Client: Transaction (with processed ToAddress)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🔇 Additional comments (3)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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
CodeRabbit Configuration File (
|
the only issue I'm worried about here are transactions which legit target zero address, we should somehow keep them as is no? |
Those will be saved as zero addresses, because RPC returns them as such. |
TL;DR
Changed how null transaction recipients are handled in the codebase.
What changed?
serializeTransaction
function to directly assign theto
field value without replacing empty values with a zero addressZERO_BYTES_42
for handling empty address stringsscanTransaction
function to convert zero-byte address strings back to empty strings when retrieving transaction dataHow to test?
ToAddress
fields instead of zero addressesWhy make this change?
This change provides a more accurate representation of contract creation transactions, which have no recipient address. Instead of replacing empty recipient addresses with the zero address (0x0000000000000000000000000000000000000000), the code now preserves the empty value, making it clearer when a transaction is creating a contract versus sending to the zero address.
Summary by CodeRabbit