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

wip: Host associate type, ChainSpec refactor #1528

Closed
wants to merge 2 commits into from

Conversation

rakita
Copy link
Member

@rakita rakita commented Jun 17, 2024

This adds ChainSpec as associate type inside Host and removed a need to modify instruction.

Small refactor on ChainSpec where associate types are moved to standalone traits.

@rakita
Copy link
Member Author

rakita commented Jun 18, 2024

Closing it as it is merged in Nomic repo

@rakita rakita closed this Jun 18, 2024

/// Trait for retrieving transaction information required for execution.
pub trait Transaction {
pub trait Transaction: Clone + Debug + Default + PartialEq + Eq {
Copy link
Contributor

Choose a reason for hiding this comment

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

I was looking at this again and I'm not a fan a of adding these trait bounds on the Transaction trait itself.

This is saying that anything that implements Transaction should also have implemented Clone, Debug, Default, PartialEq, and Eq.

I think the trait should be further constrained to trait bounds at the usage site, not universally. This trait inherently doesn't have any of these requirements and thus is overly constrained, limiting reusability.

The same applies for the type TransactionValidationError. Maybe that should live on a secondary trait that's specifically used for the trait ChainSpec?

Copy link
Contributor

Choose a reason for hiding this comment

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

There is an efficient way of doing this that I could create a proof-of-concept for, but it requires the latest version of Rust.

Is there a minimum supported version of Rust for revm?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, latest stable is fine

Copy link
Contributor

Choose a reason for hiding this comment

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

This is what I had in mind: 4bb0f27

@rakita rakita deleted the rakita/associte_types_refactor branch August 30, 2024 16:24
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.

3 participants