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

Use espresso-types without testing feature #2283

Merged
merged 9 commits into from
Nov 18, 2024

Conversation

sveitser
Copy link
Collaborator

@sveitser sveitser commented Nov 14, 2024

We would like to be able to use the types crate in other crates but currently it won't compile without the testing feature enabled. This PR fixes that.

  • Use NullStateCatchup instead of MockStateCatchup where we don't need catchup.
  • Feature gate MockStateCatchup behind testing in types crate.
  • Remove the unused InstanceState argument from from_transactions_sync.
  • Add CI job to check compilation of each feature in each crate with cargo hack.
  • Remove the libp2p feature.

After this change I can add the types crate as a dependency in a rust project without turning on the testing feature and run cargo check successfully.

Closes #1491

sveitser added a commit to EspressoSystems/hotshot-query-service that referenced this pull request Nov 14, 2024
In the sequencer repo we don't have a proper `Default` implentation but
one that's gated behind the testing feature because it wouldn't actually
work.

Working on
EspressoSystems/espresso-sequencer#2283
it seems that this is one of the pain points for removing the spread of
the testing features in the sequencer crates.

It looks like we don't need the trait bound anymore in the query
service.
Base automatically changed from hotshot/rc-0.5.81 to main November 14, 2024 19:09
We would like to be able to use the types crate in other crates but
currently it won't compile without the testing feature enabled. This PR
fixes that.

- Use `NullStateCatchup` instead of `MockStateCatchup` where we don't
  need catchup.
- Feature gate `MockStateCatchup` behind testing in types crate.
- Remove the unused `InstanceState` argument from
  `from_transactions_sync`.
- `testing` feature enables `testing` feature of types and utils crate.
- Running tests enables `testing` feature of crate via dev-dependencies.

This allows to run `cargo check` and `cargo check --tests` in the
sequencer crate. Previously `cargo check` was broken without the
`testing` feature enabled explicitly.
sveitser added a commit to EspressoSystems/hotshot-query-service that referenced this pull request Nov 15, 2024
* Remove unused Default bound on InstanceState

In the sequencer repo we don't have a proper `Default` implentation but
one that's gated behind the testing feature because it wouldn't actually
work.

Working on
EspressoSystems/espresso-sequencer#2283
it seems that this is one of the pain points for removing the spread of
the testing features in the sequencer crates.

It looks like we don't need the trait bound anymore in the query
service.

* CI: run on all pull requests
@sveitser sveitser force-pushed the ma/types-create-without-testing-feature branch from ff008fd to 9d3b50b Compare November 15, 2024 11:07
The libp2p feature was always turned on and the code didn't compile
without it. With this change all feature sets checked with `cargo hack
check --each-feature` compile successfully.
@sveitser sveitser marked this pull request as ready for review November 15, 2024 13:33
Copy link
Contributor

@imabdulbasit imabdulbasit left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -488,15 +482,6 @@ pub async fn init_node<P: PersistenceOptions, V: Versions>(
))
};

// Wait for the CDN network to be ready if we're not using the P2P network
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rob-maron I removed this wait and think that should be fine because we always have the libp2p enabled. Let me know if you see an issue with this.

@sveitser sveitser merged commit c197b21 into main Nov 18, 2024
19 checks passed
@sveitser sveitser deleted the ma/types-create-without-testing-feature branch November 18, 2024 14:55
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.

Don't turn on testing feature for non-test builds
2 participants