[ZK Stack] - From and to are uint256? #621
-
Module Affected
Rust VersionOperating System
Issue DescriptionIt's not an issue. I'm just asking. How come from and to fields are uint256 and not address? Should I cast them as address on comparison, or cast expected address as uint256? Expected BehaviorCurrent BehaviorRepository Link (if applicable)No response Additional DetailsNo response Prior Research
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
In the context of zkSync transactions, the Here’s how you should handle these fields in your smart contracts or when performing comparisons:
The decision to use Your feedback helps us serve you better. If this fully addresses your question, please give it a thumbs up. If it doesn't, please give it a thumbs down. This will inform the community and team so we can improve our support. |
Beta Was this translation helpful? Give feedback.
In the context of zkSync transactions, the
from
andto
fields are indeed defined asuint256
values rather than the typicaladdress
type, which is essentiallyuint160
under the hood. This design choice is primarily for forward compatibility, considering potential future changes in address sizes, such as the migration to 32-byte addresses discussed in various Ethereum community proposals.Here’s how you should handle these fields in your smart contracts or when performing comparisons:
Casting for Comparisons: When you need to compare these
uint256
fields with actual EVM addresses, you should safely cast theuint256
touint160
. This casting ensures that you are only dealing with valid EVM …