-
Notifications
You must be signed in to change notification settings - Fork 111
[utils] Introduce Span
(and rename array
to sequence
)
#1337
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
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.
Pull Request Overview
This PR introduces a new Span
trait to the utils sequence module to handle variable-size byte sequences, while refactoring the existing Array
trait to inherit from Span
. The change enables better type safety and API design for handling both fixed-size and variable-size data types.
- Introduces the
Span
trait for variable-size byte sequences withEncodeSize
constraint - Refactors
Array
trait to inherit fromSpan
while addingEncodeFixed
constraint - Updates all existing array types to implement both
Span
andArray
traits
Reviewed Changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
utils/src/sequence/mod.rs | Introduces Span trait and refactors Array to inherit from it |
utils/src/sequence/*.rs | Adds Span implementations to U32, U64, prefixed_u64::U64, and FixedBytes |
utils/src/lib.rs | Updates module structure from array to sequence and exports Span |
Multiple storage files | Updates import paths from array:: to sequence:: |
Multiple cryptography files | Adds Span implementations to cryptographic types and updates imports |
resolver/src/*.rs | Changes type constraints from Array to Span for keys in Producer/Consumer traits |
Span
Span
(and rename array
to sequence
)
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1337 +/- ##
==========================================
- Coverage 91.22% 91.22% -0.01%
==========================================
Files 262 262
Lines 65073 65073
==========================================
- Hits 59362 59361 -1
- Misses 5711 5712 +1
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Resolves: #1338
Credit to @BrendanChou for the insightful approach.
Future work: #1339