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

Pad addresses to correct length #2486

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

cptartur
Copy link
Member

@cptartur cptartur commented Sep 19, 2024

Closes #2248
Closes #2424

Introduced changes

  • Addresses used in sncast account create, sncast declare and sncast deploy are now correctly padded to 66 (64 after 0x) characters length.

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added relevant tests
  • Performed self-review of the code
  • Added changes to CHANGELOG.md

@cptartur cptartur marked this pull request as ready for review September 20, 2024 09:45
@@ -24,6 +26,30 @@ where
serializer.serialize_str(&format!("{value:#}"))
}

#[derive(Clone, Copy, Debug, PartialEq, Deserialize, CairoSerialize)]
pub struct Address(pub Felt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of using the Address name since it is also used for class_hash. Generally without additional context, it could be confusing to understand why it was introduced. Apart from this, I think we should also print transaction_hash with padded 0 for consistency.

CHANGELOG.md Outdated
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#### Fixed

- `sncast declare` no longer fails for flat contracts (i.e. CASM artifacts with `bytecode_segment_lengths` being a number)
- Addresses outputted when calling `sncast account create`, `sncast deploy` and `sncast declare` are now padded to the correct length and prefixed with `0x0`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The term correct length implies that it has been incorrect so far, which I think is not true (but we would need to define what this means first). How about rephrasing it to note that it's now padded with 0 and always 64 characters long?

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