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

fix(L-01): Incomplete Implementation for checkpoints.rs #323

Open
wants to merge 10 commits into
base: v0.1.0
Choose a base branch
from

Conversation

qalisander
Copy link
Member

Extends checkpoints implementation without code duplications, albeit it has a bit complex generics

@qalisander qalisander force-pushed the fix/L-01-Incomplete-Implementation-for-checkpoints.rs branch from 19d98e6 to 111aa36 Compare October 4, 2024 22:30
@qalisander qalisander marked this pull request as ready for review October 4, 2024 22:58
Copy link
Collaborator

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

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

Left some comments.

use core::ops::{Add, Div, Mul, Sub};

use alloy_primitives::Uint;
use stylus_sdk::prelude::*;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Import only what we need.

impl<const B: usize, const L: usize> Accessor
for stylus_sdk::storage::StorageUint<B, L>
{
type Wraps = Uint<B, L>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: I do not like Wraps, I would remove.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or at least make it more self-descripting

Copy link
Member Author

@qalisander qalisander Oct 6, 2024

Choose a reason for hiding this comment

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

stylus_sdk::StorageType::Wraps has the same name for associated abi type. What other ideas you have?

}

/// Abstracts number inside the checkpoint contract.
pub trait Num: Add + Sub + Mul + Div + Ord + Sized + Copy {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the name should be more self-descripting.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not ideal, but what you think is better? AbiNum?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would add macros for Size generation similar to these

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.

2 participants