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: chain id refactoring #134

Merged
merged 14 commits into from
Sep 3, 2024
Merged

feat: chain id refactoring #134

merged 14 commits into from
Sep 3, 2024

Conversation

rkdud007
Copy link
Member

@rkdud007 rkdud007 commented Sep 2, 2024

Internal ChainId

we want to keep raw value which this heavy coupled with encode/decode, so we stay as integer

  • every input/output file via cli <> cairo-run ( dry-run output, sound-run-input... )
  • solidity type definition and encoding

in this case we are stick to original chain_id numeric value :

https://github.com/HerodotusDev/hdp/blob/starknet/hdp/src/primitives/chain_id.rs#L94-L110

Userfacing (External)ChainId

as SN_SEPOLIA chain integer value is bad UX, we keep seperate deserialize value target for external userfacing type

For request.json and cli input, we are accepting as this type:

https://github.com/HerodotusDev/hdp/blob/starknet/hdp/src/primitives/chain_id.rs#L55-L69

So e.g you could construct request format in this way

:

"destinationChainId": "ETHEREUM_SEPOLIA",

also .env variable will be following external type , don't use 11155111, use ETHEREUM_SEPOLIA

@rkdud007 rkdud007 changed the title starknet support feat: chain id refactoring Sep 2, 2024
@rkdud007 rkdud007 marked this pull request as ready for review September 2, 2024 05:31
@rkdud007 rkdud007 added the C-primitives Related to primitives label Sep 2, 2024
@rkdud007 rkdud007 linked an issue Sep 2, 2024 that may be closed by this pull request
@rkdud007
Copy link
Member Author

rkdud007 commented Sep 2, 2024

can you double check if the chain_id integer value is same as what will be used on Cairo? https://github.com/HerodotusDev/hdp/blob/starknet/hdp/src/primitives/chain_id.rs#L94-L110 @petscheit

@rkdud007
Copy link
Member Author

rkdud007 commented Sep 3, 2024

to fully confirm if works, need to resolve HerodotusDev/hdp-cairo#76

@rkdud007 rkdud007 merged commit 2cbf18b into dev Sep 3, 2024
1 check passed
@rkdud007 rkdud007 deleted the starknet branch September 3, 2024 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-primitives Related to primitives
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support SN_MAIN and SN_SEPOLIA
1 participant