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

Separate Querier and TxHandler #298

Merged
merged 23 commits into from
Feb 5, 2024
Merged

Separate Querier and TxHandler #298

merged 23 commits into from
Feb 5, 2024

Conversation

Kayanski
Copy link
Contributor

@Kayanski Kayanski commented Jan 9, 2024

This PR aims at separating the querying and the transaction signing capabilities of CwEnv.

Closes ORC-61

Changes

  1. Removed BankQuerier : Replaced by BankQuerierGetter and BankQuerier on top of it
  2. Removed WasmCodeQuerier: Replaced by WasmQuerierGetter and WasmQuerier. Local hash function is also added in this trait

@Kayanski Kayanski marked this pull request as draft January 9, 2024 17:02
Copy link

cloudflare-workers-and-pages bot commented Jan 9, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: ee2ab1d
Status: ✅  Deploy successful!
Preview URL: https://83874985.cw-orchestrator.pages.dev
Branch Preview URL: https://update-separate-query-tx.cw-orchestrator.pages.dev

View logs

@CyberHoward
Copy link
Contributor

Deprecation issues

The block_info function of TxHandler is now marked as deprecated but we can't implement the exact same function on the QueryHandler trait because it would conflict with this function as long as it exists.

I think that we need to publish a breaking version for this change because of that !

Traits can have the same function. When calling the function the user needs to have either of the traits imported. If they are both imported they need to specify which trait they want to use. i.e.

TxHandler::block_info(chain)

So no breaking change required here afaik

@Kayanski
Copy link
Contributor Author

Kayanski commented Jan 10, 2024

Deprecation issues

The block_info function of TxHandler is now marked as deprecated but we can't implement the exact same function on the QueryHandler trait because it would conflict with this function as long as it exists.
I think that we need to publish a breaking version for this change because of that !

Traits can have the same function. When calling the function the user needs to have either of the traits imported. If they are both imported they need to specify which trait they want to use. i.e.

TxHandler::block_info(chain)

So no breaking change required here afaik

The error that show up at the following line shows exactly what I meant with this comment : https://github.com/AbstractSDK/cw-orchestrator/blob/update/separate-query-tx/contracts/counter/src/interface.rs#L48

@CyberHoward CyberHoward added this to the 0.20 milestone Jan 10, 2024
@CyberHoward
Copy link
Contributor

Can we maybe start working with milestones in github for breaking versions? I created one for 0.20

Have you merged anything that was breaking?

@Kayanski
Copy link
Contributor Author

Can we maybe start working with milestones in github for breaking versions? I created one for 0.20
--> OK

Have you merged anything that was breaking?
--> No

@Kayanski Kayanski marked this pull request as ready for review January 15, 2024 15:19
Copy link

codecov bot commented Jan 15, 2024

Codecov Report

Attention: 491 lines in your changes are missing coverage. Please review.

Comparison is base (f39ab04) 66.4% compared to head (ee2ab1d) 65.4%.
Report is 2 commits behind head on main.

Additional details and impacted files
Files Coverage Δ
cw-orch-daemon/src/error.rs 14.2% <ø> (ø)
...ges/cw-orch-core/src/contract/contract_instance.rs 81.8% <100.0%> (+3.4%) ⬆️
...ages/cw-orch-core/src/contract/interface_traits.rs 75.9% <100.0%> (+5.3%) ⬆️
...kages/cw-orch-core/src/environment/queriers/mod.rs 100.0% <100.0%> (ø)
...ages/cw-orch-core/src/environment/queriers/wasm.rs 100.0% <100.0%> (ø)
packages/cw-orch-core/src/environment/state.rs 55.5% <ø> (ø)
packages/cw-orch-mock/src/core.rs 93.7% <100.0%> (+6.2%) ⬆️
...kages/cw-orch-core/src/environment/queriers/env.rs 0.0% <0.0%> (ø)
cw-orch-daemon/src/tx_broadcaster.rs 76.7% <0.0%> (ø)
packages/cw-orch-core/src/environment/mut_env.rs 0.0% <0.0%> (ø)
... and 27 more

@Kayanski
Copy link
Contributor Author

In standby until #318 is done

@Kayanski Kayanski marked this pull request as draft January 24, 2024 11:04
Kayanski and others added 7 commits January 29, 2024 17:04
* show POC of generalized querier getter

* update

* fix merge and impl for all envs

* Doon't verify mockj error anymore

* Fixed test

* update `QueryHandler` and WasmQuerier functions

* fix smart query URL

* fix compile

* format and clippy

---------

Co-authored-by: Kayanski <kowalski.kowalskin@gmail.com>
* Added instantiate2

* some fixes

* Added instantiate2 addr getter

* Format

* Nits
@Kayanski Kayanski marked this pull request as ready for review February 1, 2024 17:33
Copy link
Contributor

@CyberHoward CyberHoward left a comment

Choose a reason for hiding this comment

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

Think some code can be removed and daemon queriers should be constructed with runtime by default


impl QuerierGetter<Staking> for Daemon {
fn querier(&self) -> Staking {
Staking::new_async(self.channel())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can it not get the runtime handle from the daemon object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But it can. Keeping the same structure as for Queriers with traits

@Kayanski Kayanski merged commit 7aa0123 into main Feb 5, 2024
17 of 18 checks passed
@Kayanski Kayanski deleted the update/separate-query-tx branch February 5, 2024 10:10
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