Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MagisterDaIlis
Copy link
Contributor

This was missing. Now i can do things like let c: ContractAddress = 1_u64.into() or let c: ContractAddress = 1_u256.try_into().unwrap()

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@orizi orizi left a 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?

Copy link
Contributor Author

@MagisterDaIlis MagisterDaIlis left a 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.

Copy link
Collaborator

@orizi orizi left a 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)

Copy link
Contributor Author

@MagisterDaIlis MagisterDaIlis left a 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

Copy link
Collaborator

@orizi orizi left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants