AbstractSDK / cw-orchestrator

All-in-one Rust-based CosmWasm testing, scripting, and deployment tool.
https://orchestrator.abstract.money
GNU General Public License v3.0
76 stars 18 forks source link

First impl of Mock and MockBech32 #325

Closed Kayanski closed 7 months ago

Kayanski commented 7 months ago

This PR aims at introducing MockBech32 that enforces valid addresses Tests needs a little revamp (doc tests mostly), but that's a good looking implementation and usable by users.

cloudflare-pages[bot] commented 7 months ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1d8c7e2
Status: ✅  Deploy successful!
Preview URL: https://e0853a05.cw-orchestrator.pages.dev
Branch Preview URL: https://fix-mock-bech32.cw-orchestrator.pages.dev

View logs

codecov[bot] commented 7 months ago

Codecov Report

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

Comparison is base (3a79f71) 65.4% compared to head (1d8c7e2) 65.4%.

Additional details and impacted files | [Files](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK) | Coverage Δ | | |---|---|---| | [cw-orch/src/osmosis\_test\_tube/core.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-Y3ctb3JjaC9zcmMvb3Ntb3Npc190ZXN0X3R1YmUvY29yZS5ycw==) | `55.2% <ø> (+0.2%)` | :arrow_up: | | [...ages/cw-orch-core/src/contract/interface\_traits.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-cGFja2FnZXMvY3ctb3JjaC1jb3JlL3NyYy9jb250cmFjdC9pbnRlcmZhY2VfdHJhaXRzLnJz) | `75.9% <100.0%> (ø)` | | | [...ages/cw-orch-core/src/environment/queriers/wasm.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-cGFja2FnZXMvY3ctb3JjaC1jb3JlL3NyYy9lbnZpcm9ubWVudC9xdWVyaWVycy93YXNtLnJz) | `100.0% <ø> (ø)` | | | [packages/cw-orch-core/src/error.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-cGFja2FnZXMvY3ctb3JjaC1jb3JlL3NyYy9lcnJvci5ycw==) | `57.1% <ø> (ø)` | | | [packages/cw-orch-mock/src/core.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-cGFja2FnZXMvY3ctb3JjaC1tb2NrL3NyYy9jb3JlLnJz) | `97.1% <100.0%> (+3.3%)` | :arrow_up: | | [packages/cw-orch-mock/src/queriers/bank.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-cGFja2FnZXMvY3ctb3JjaC1tb2NrL3NyYy9xdWVyaWVycy9iYW5rLnJz) | `92.8% <100.0%> (+3.2%)` | :arrow_up: | | [packages/cw-orch-mock/src/queriers/env.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-cGFja2FnZXMvY3ctb3JjaC1tb2NrL3NyYy9xdWVyaWVycy9lbnYucnM=) | `0.0% <ø> (ø)` | | | [packages/cw-orch-mock/src/queriers/mod.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-cGFja2FnZXMvY3ctb3JjaC1tb2NrL3NyYy9xdWVyaWVycy9tb2QucnM=) | `0.0% <ø> (ø)` | | | [cw-orch-daemon/src/queriers/cosmwasm.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-Y3ctb3JjaC1kYWVtb24vc3JjL3F1ZXJpZXJzL2Nvc213YXNtLnJz) | `47.7% <0.0%> (ø)` | | | [cw-orch/src/osmosis\_test\_tube/queriers/wasm.rs](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK#diff-Y3ctb3JjaC9zcmMvb3Ntb3Npc190ZXN0X3R1YmUvcXVlcmllcnMvd2FzbS5ycw==) | `52.9% <0.0%> (ø)` | | | ... and [4 more](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK) | | ... and [7 files with indirect coverage changes](https://app.codecov.io/gh/AbstractSDK/cw-orchestrator/pull/325/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AbstractSDK)
CyberHoward commented 7 months ago

Did a bit of a refactor of the queries to make them API generic by relying on the difference in addr generation between the mock and bech32 impls.

I'm a bit confused by the bech32 module in core.rs. Can we split these two type impls?

Kayanski commented 7 months ago

Did a bit of a refactor of the queries to make them API generic by relying on the difference in addr generation between the mock and bech32 impls.

I'm a bit confused by the bech32 module in core.rs. Can we split these two type impls?

Haha gotta love the refactor hack :)

--> Yes we can split the 2 impls in separate files, sure ! The differences are very subtle :)

CyberHoward commented 7 months ago

Another question we should ask ourselves is if we want to keep supporting impl Into<String> in our address fields?

Kayanski commented 7 months ago

Another question we should ask ourselves is if we want to keep supporting impl Into<String> in our address fields?

See answer above? I think that it's really good to simplify the users life in case no bech32 verification is needed