-
Notifications
You must be signed in to change notification settings - Fork 562
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
feat: integers into ContractAddress #7185
base: main
Are you sure you want to change the base?
feat: integers into ContractAddress #7185
Conversation
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @MagisterDaIlis)
a discussion (no related file):
it is missing - but why is it actually necessary?
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @orizi)
a discussion (no related file):
Previously, orizi wrote…
it is missing - but why is it actually necessary?
I was writing tests for my contracts, iterating over a range of u64 numbers that represented contract addresses, and could not convert them to the proper type for my contract interactions because of missing impls.
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @MagisterDaIlis)
a discussion (no related file):
Previously, MagisterDaIlis wrote…
I was writing tests for my contracts, iterating over a range of u64 numbers that represented contract addresses, and could not convert them to the proper type for my contract interactions because of missing impls.
it is very weird that u64 numbers represented contract addresses.
i would probably expect felt252s in this case (which do have a conversion into a contract address)
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @orizi)
a discussion (no related file):
Previously, orizi wrote…
it is very weird that u64 numbers represented contract addresses.
i would probably expect felt252s in this case (which do have a conversion into a contract address)
Yes I could force these values to be felt252s, it's for tests only anyway. But I don't understand why restricting conversion from integers to contract addresses
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @MagisterDaIlis)
a discussion (no related file):
Previously, MagisterDaIlis wrote…
Yes I could force these values to be felt252s, it's for tests only anyway. But I don't understand why restricting conversion from integers to contract addresses
first of all - you shouldn't ever have a contract address as u64 (as it is a result of a hash) - so i wouldn't recommend it.
second of all - logically - an address here is not just a numeric type - as it is mostly an actual address.
This was missing. Now i can do things like
let c: ContractAddress = 1_u64.into()
orlet c: ContractAddress = 1_u256.try_into().unwrap()