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(primitives): add additional common aliases #654

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

zerosnacks
Copy link
Member

@zerosnacks zerosnacks commented Jun 10, 2024

Motivation

Closes: #653

For context + related PR in alloy: alloy-rs/alloy#859

Solution

Add generic aliases unrelated to specific EIPs

  • TxNonce (with doc alias)
  • BlockTimestamp

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

lgtm otherwise, no strong feeling either way, just dont want us to end up not using the new alias:)

@@ -65,6 +65,9 @@ pub type BlockHash = B256;
/// A block number.
pub type BlockNumber = u64;

/// A block timestamp.
pub type BlockTimestamp = u64;
Copy link
Member

Choose a reason for hiding this comment

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

unsure if we should add this w/o also using it, so maybe a separate pr?

Copy link
Member Author

@zerosnacks zerosnacks Jun 10, 2024

Choose a reason for hiding this comment

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

I would update alloy-rs/alloy#859 to include it so it would be used there

Same for TxNonce

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

hmm, I'm sceptical that these aliases are useful

@zerosnacks
Copy link
Member Author

zerosnacks commented Jun 10, 2024

hmm, I'm sceptical that these aliases are useful

Added some additional context here: alloy-rs/alloy#859

Reduces magic values, reduces chance of error and makes it easier for end-users to see what value they are getting e.g. TxHash instead of FixedBytes<32> when watch()-ing a transaction. Main goal is to limit showing internal types and help with consistency / standardize fields / encourage native types (u64 vs U64) and sizes.

@DaniPopes DaniPopes merged commit 4a258dc into main Jun 10, 2024
30 checks passed
@DaniPopes DaniPopes deleted the zerosnacks/additional-aliases branch June 10, 2024 13:12
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.

[Feature] Add additional aliases
4 participants