-
Notifications
You must be signed in to change notification settings - Fork 39
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
Replace BlockNumber
alias with dedicated structure
#1846
Conversation
d711d05
to
dc0e083
Compare
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.
Overall looks good 👍
internal/mithril-persistence/src/database/query/block_range_root/delete_block_range_root.rs
Outdated
Show resolved
Hide resolved
mithril-aggregator/src/services/cardano_transactions_importer.rs
Outdated
Show resolved
Hide resolved
2025826
to
6dc54be
Compare
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.
LGTM 👍
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.
LGTM 👍. Just a minor suggestion.
A wrapper on `u64` with comparaison, add, sub, display, and deref built in. It will replace an alias over `u64` so we can have stronger type check at compilation and more readable code.
By defining macros. This add several impl that were missing for the `Epoch` type (mostly for operations that use a reference).
A wrapper on `u64` with comparaison, add, sub, display, and deref built in. It will replace an alias over `u64` so we can have stronger type check at compilation and more readable code.
To allow them when the wrapped type is on the left.
Only common compile, other crates still needs some work. In order to do so some more capabilities add to be added to the `BlockNumber`: * Convertion from u64: to use with 'Into<BlockNumber>' generics, should be reserved to specific cases when it's clear that the number written is a Block Number and not something magic. * PartialOrd from/to `u64`: so it can be passed to Range::contains method.
Aggregator & signer still doesn't compile. In order to do so some more capabilities add to be added to the `BlockNumber`: * Faillible conversion to i64: since it's the target datatype for sqlite integer fields.
Aggregator still doesn't compile.
This commit can be reverted to be the starting point of the PR that add the `SlotNumber`.
mithril-signer:0.2.167 => 0.2.168 mithril-persistence:0.2.18 => 0.2.19 mithril-common:0.4.34 => 0.4.35 mithril-aggregator:0.5.46 => 0.5.47 mithril-client:0.8.7 => 0.8.8
6dc54be
to
664f3e4
Compare
Content
This PR replace the
BlockNumber
alias overu64
with dedicated tuple structure.In order to share code and simplify implementation of tuple structs that wrap an integer type, some macros have been defined to easily implement recurring traits such as arithmetic operations.
Those macros are defined in
mithril-common/src/entities/arithmetic_operation_wrapper.rs
.Pre-submit checklist
Comments
About the traits exclusively implemented on
BlockNumber
:impl TryFrom<BlockNumber> for i64
: implemented to facilitate usage with the database layer as the sqlite crate use ai64
for all integers.About
SlotNumber
: a type was defined but removed to keep this PR focused onBlockNumber
.Reverting the commit 997cb3a can be a good starting point for the PR for slot number.
Issue(s)
Relates to #1755