Skip to content

Conversation

@pgherveou
Copy link
Contributor

@pgherveou pgherveou commented Mar 5, 2024

Moved bundle and mocking under session.
Alternatively we could keep it where it is but put this code behind other feature flags

This change is needed, cause the current setup introduce dependency cycle with ink!.
ink! should import drink! without the session feature to avoid creating a dependency cycle

@pgherveou pgherveou requested a review from pmikolajczyk41 March 5, 2024 09:40
@pmikolajczyk41
Copy link
Contributor

what exactly is the dependency cycle? drink doesn't depend on ink!, does it?

@pgherveou
Copy link
Contributor Author

pgherveou commented Mar 5, 2024

what exactly is the dependency cycle? drink doesn't depend on ink!, does it?

it does through contract-transcode (that is only required by feature session after this PR), we don't need all the session stuff in ink! as well

@ascjones
Copy link

ascjones commented Mar 5, 2024

what exactly is the dependency cycle? drink doesn't depend on ink!, does it?

it does through contract-transcode (that is only required by feature session after this PR), we don't need all the session stuff in ink! as well

Exactly.

drink -> contract-transcode -> ink_metadata + ink_env
^                                               ^
|                                               |
ink_e2e ----------------------------------------

drink/src/lib.rs Outdated
Comment on lines 13 to 14
#[cfg(feature = "session")]
pub use drink_test_macro::{contract_bundle_provider, test};
Copy link
Contributor

Choose a reason for hiding this comment

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

am I correct, that it is necessary to put only contract_bundle_provider behind feature gate? test should be fine

Copy link

Choose a reason for hiding this comment

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

Just looked and the drink_test_macro crate also brings in contract-build and contract-metadata crates which would also cause a circular dependency, so maybe we should make drink_test_macroa dependency feature of drink?

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, yeah, that sounds more reasonable... especially that I don't like hiding macros behind session feature

so I suggest introducing second default feature macros and feature-gate reexport here (and the dependency as well)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I am testing this with ink! fyi, to make sure we don't forget stuff.
Quick question we should also build with just the std feature (the one we will use in ink!)
What's the best way to check that the code does not generate warning

just a new step in the rust-checks.yml?

Copy link
Contributor

Choose a reason for hiding this comment

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

what warning do you have in mind? and yes, I guess adding some check to CI is the best idea

@pgherveou pgherveou changed the title Move bundle to "session" feature Move code to "macros" and "session" features Mar 5, 2024
@pgherveou pgherveou merged commit e110d55 into main Mar 5, 2024
@pgherveou pgherveou deleted the pg/move-bundle-to-session branch March 5, 2024 20:26
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.

4 participants