From 3190959bc8318f234656ba5010954f2ae3ff7dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20=C4=8Cerni=C4=8D?= Date: Fri, 22 Nov 2024 11:42:55 +0100 Subject: [PATCH 1/8] remove unused folders --- api/.gitkeep | 0 market-protocols/.gitkeep | 0 network/.gitkeep | 0 pallets/collator-power/.gitkeep | 0 pallets/collator-reward/.gitkeep | 0 pallets/collator-selection/.gitkeep | 0 pallets/payment-channel/.gitkeep | 0 pallets/xcm-dispatcher/.gitkeep | 0 8 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 api/.gitkeep delete mode 100644 market-protocols/.gitkeep delete mode 100644 network/.gitkeep delete mode 100644 pallets/collator-power/.gitkeep delete mode 100644 pallets/collator-reward/.gitkeep delete mode 100644 pallets/collator-selection/.gitkeep delete mode 100644 pallets/payment-channel/.gitkeep delete mode 100644 pallets/xcm-dispatcher/.gitkeep diff --git a/api/.gitkeep b/api/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/market-protocols/.gitkeep b/market-protocols/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/network/.gitkeep b/network/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/pallets/collator-power/.gitkeep b/pallets/collator-power/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/pallets/collator-reward/.gitkeep b/pallets/collator-reward/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/pallets/collator-selection/.gitkeep b/pallets/collator-selection/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/pallets/payment-channel/.gitkeep b/pallets/payment-channel/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/pallets/xcm-dispatcher/.gitkeep b/pallets/xcm-dispatcher/.gitkeep deleted file mode 100644 index e69de29bb..000000000 From ef1a4bbc99a37450a648465ec7ceca0425a28d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20=C4=8Cerni=C4=8D?= Date: Fri, 22 Nov 2024 12:22:14 +0100 Subject: [PATCH 2/8] merge cli with lib --- Cargo.lock | 37 +-- Cargo.toml | 2 - cli/polka-storage/storagext-cli/Cargo.toml | 34 -- cli/polka-storage/storagext-cli/README.md | 307 ------------------ cli/polka-storage/storagext/Cargo.toml | 2 +- cli/polka-storage/storagext/README.md | 5 +- .../src/bin/storagext-cli}/cmd/faucet.rs | 0 .../src/bin/storagext-cli}/cmd/market.rs | 0 .../src/bin/storagext-cli}/cmd/mod.rs | 0 .../src/bin/storagext-cli}/cmd/proofs.rs | 0 .../src/bin/storagext-cli}/cmd/randomness.rs | 0 .../storagext-cli}/cmd/storage_provider.rs | 0 .../src/bin/storagext-cli}/cmd/system.rs | 0 .../src/bin/storagext-cli}/main.rs | 0 storage/file-storage/.gitkeep | 0 storage/mater-cli/Cargo.toml | 26 -- storage/mater-cli/README.md | 3 - storage/mater/Cargo.toml | 2 + storage/mater/README.md | 4 + .../src/bin/mater-cli}/convert.rs | 0 .../src => mater/src/bin/mater-cli}/error.rs | 0 .../src/bin/mater-cli}/extract.rs | 0 .../src => mater/src/bin/mater-cli}/main.rs | 0 storage/mater/src/lib.rs | 3 + 24 files changed, 16 insertions(+), 409 deletions(-) delete mode 100644 cli/polka-storage/storagext-cli/Cargo.toml delete mode 100644 cli/polka-storage/storagext-cli/README.md rename cli/polka-storage/{storagext-cli/src => storagext/src/bin/storagext-cli}/cmd/faucet.rs (100%) rename cli/polka-storage/{storagext-cli/src => storagext/src/bin/storagext-cli}/cmd/market.rs (100%) rename cli/polka-storage/{storagext-cli/src => storagext/src/bin/storagext-cli}/cmd/mod.rs (100%) rename cli/polka-storage/{storagext-cli/src => storagext/src/bin/storagext-cli}/cmd/proofs.rs (100%) rename cli/polka-storage/{storagext-cli/src => storagext/src/bin/storagext-cli}/cmd/randomness.rs (100%) rename cli/polka-storage/{storagext-cli/src => storagext/src/bin/storagext-cli}/cmd/storage_provider.rs (100%) rename cli/polka-storage/{storagext-cli/src => storagext/src/bin/storagext-cli}/cmd/system.rs (100%) rename cli/polka-storage/{storagext-cli/src => storagext/src/bin/storagext-cli}/main.rs (100%) delete mode 100644 storage/file-storage/.gitkeep delete mode 100644 storage/mater-cli/Cargo.toml delete mode 100644 storage/mater-cli/README.md rename storage/{mater-cli/src => mater/src/bin/mater-cli}/convert.rs (100%) rename storage/{mater-cli/src => mater/src/bin/mater-cli}/error.rs (100%) rename storage/{mater-cli/src => mater/src/bin/mater-cli}/extract.rs (100%) rename storage/{mater-cli/src => mater/src/bin/mater-cli}/main.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 20e16e766..40eee772e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7999,10 +7999,12 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" name = "mater" version = "0.1.0" dependencies = [ + "anyhow", "async-stream", "bitflags 2.6.0", "byteorder", "bytes", + "clap", "criterion", "digest 0.10.7", "futures", @@ -8022,18 +8024,6 @@ dependencies = [ "tokio-util", ] -[[package]] -name = "mater-cli" -version = "0.1.0" -dependencies = [ - "anyhow", - "clap", - "mater", - "tempfile", - "thiserror 2.0.3", - "tokio", -] - [[package]] name = "matrixmultiply" version = "0.3.9" @@ -20968,29 +20958,6 @@ dependencies = [ "url", ] -[[package]] -name = "storagext-cli" -version = "0.1.0" -dependencies = [ - "anyhow", - "cid 0.11.1", - "clap", - "frame-support 38.0.0 (git+https://github.com/paritytech/polkadot-sdk?tag=polkadot-stable2409-2)", - "hex", - "parity-scale-codec", - "primitives-proofs", - "serde", - "serde_json", - "storagext", - "subxt", - "subxt-signer", - "thiserror 2.0.3", - "tokio", - "tracing", - "tracing-subscriber 0.3.18", - "url", -] - [[package]] name = "str0m" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index d178f58a7..3fbb075f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,6 @@ members = [ "cli/polka-storage-provider/common", "cli/polka-storage-provider/server", "cli/polka-storage/storagext", - "cli/polka-storage/storagext-cli", "lib/polka-storage-proofs", "maat", "node", @@ -24,7 +23,6 @@ members = [ "primitives/proofs", "runtime", "storage/mater", - "storage/mater-cli", "storage/polka-index", ] resolver = "2" diff --git a/cli/polka-storage/storagext-cli/Cargo.toml b/cli/polka-storage/storagext-cli/Cargo.toml deleted file mode 100644 index 15929b2c2..000000000 --- a/cli/polka-storage/storagext-cli/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -[package] -authors.workspace = true -edition.workspace = true -homepage.workspace = true -license-file.workspace = true -name = "storagext-cli" -repository.workspace = true -version = "0.1.0" - -[features] -insecure_url = ["storagext/insecure_url"] - -[dependencies] -storagext = { workspace = true, features = ["clap"] } - -anyhow.workspace = true -cid = { workspace = true, features = ["scale-codec"], default-features = true } -clap = { workspace = true, features = ["derive", "env"] } -codec.workspace = true -frame-support = { workspace = true, features = ["std"] } -hex = { workspace = true, features = ["serde", "std"] } -primitives-proofs = { workspace = true } -serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true } -subxt = { workspace = true, features = ["jsonrpsee", "substrate-compat"] } -subxt-signer = { workspace = true, features = ["subxt"] } -thiserror = { workspace = true } -tokio = { workspace = true, features = ["rt-multi-thread"] } -tracing = { workspace = true } -tracing-subscriber = { workspace = true, features = ["env-filter"] } -url = { workspace = true } - -[lints] -workspace = true diff --git a/cli/polka-storage/storagext-cli/README.md b/cli/polka-storage/storagext-cli/README.md deleted file mode 100644 index f108f4ccd..000000000 --- a/cli/polka-storage/storagext-cli/README.md +++ /dev/null @@ -1,307 +0,0 @@ -# storagext-cli - -CLI wrapper around `storagext`, it aims to provide an ergonomic way to execute the extrinsics made available by the Polka Storage Parachain. - -The CLI commands are namespaced according to the pallet you will be interacting with, -as such, if you want to interact with the `market` pallet, you can find it's functions under `storagext-cli market`. - -## Global Flags - -> [!NOTE] -> Commands that take in JSON objects as input, are also able to read in files with the provided content. -> -> Instead of passing the JSON object as a parameter, pass the JSON filename prefixed with an `@`. -> For example: -> ``` -> storagext-cli --sr25519-key storage-provider pre-commit @pre-commit-sector.json -> ``` - -### Keypair — `--X-key` - -Extrinsics are *required* to be signed, as such you need to pass your key. - -You can pass it as an hex encoded string, seed key (BIP-39) or use the dev phrases available -(e.g. `//Alice` — remember that these are configured as Sr25519 keypairs by default). - -Depending on the type of key you use, you should use a different flag as well: - -* `--sr25519-key` for Sr25519 keypairs -* `--ecdsa-key` for ECDSA keypairs -* `--ed25519-key` for Ed25519 keypairs - -Example: - -```bash -storagext-cli --sr25519-key "//Alice" ... -``` - -### RPC Address — `--node-rpc` - -If you so wish, you can also change the node RPC address, this is achieved through the `--node-rpc` flag. The address can be secure or not (i.e. use TLS). - -Secure if, for example, you are running the node behind a reverse proxy (like Nginx) which enables TLS for your connections: - -```bash -storagext-cli --node-rpc wss://172.16.10.10:9944 ... -``` - -Or insecure if, for example, you are running the node locally, using just the standard setup. - -```bash -storagext-cli --node-rpc ws://127.0.0.1:7331 ... -``` - -## `market` - -The `market` subcommand enables you to interact with the `market` pallet, -this is one of the entrypoints for the parachain as you need to add some balance before you can make use of the parachain features. - -### `add-balance` - -Add a given amount of [Plancks](https://wiki.polkadot.network/docs/learn-DOT#the-planck-unit) to your free balance, -this will enable you to store your files in providers or provide space to others. - -```bash -storagext-cli --sr25519-key market add-balance -``` - -### `withdraw-balance` - -The dual to `add-balance`, `withdraw-balance` allows you to reclaim back DOT from your free balance. -You cannot reclaim DOT from the locked balance, as it is necessary to pay out for faults, etc. - -```bash -storagext-cli --sr25519-key market withdraw-balance -``` - -### `publish-storage-deals` - -As a storage provider, you are able to publish storage deals you have done off-chain. -As this is an experimental CLI, you must provide Client's private key to sign a deal. -Normally, you'd just publish a signed message which you received from a client. - -```bash -storagext-cli \ - --sr25519-key \ - market publish-storage-deals \ - --client-sr25519-key \ - -``` - -The command takes `deals` as a JSON array, containing one or more storage deals. - -
-Example Storage Deals JSON -

- -```json -[ - { - "piece_cid": "bafkreibme22gw2h7y2h7tg2fhqotaqjucnbc24deqo72b6mkl2egezxhvy", - "piece_size": 47000000000, - "client": "5GvHnpY1433RytXW66r77iL4CyewAAErDU6fAouoaPKvcvLU", - "provider": "5DJiX75PZjvntUMeq7XP8qqJ3Tdg6F2Nybk9So1Z5mWArnG2", - "label": "737-800 schematics", - "start_block": 1580889600, - "end_block": 1721747575, - "storage_price_per_block": 17144352, - "provider_collateral": 3735928559, - "state": "Published" - }, - { - "piece_cid": "bafybeih5zgcgqor3dv6kfdtv3lshv3yfkfewtx73lhedgihlmvpcmywmua", - "piece_size": 269490583, - "client": "5GvHnpY1433RytXW66r77iL4CyewAAErDU6fAouoaPKvcvLU", - "provider": "5DJiX75PZjvntUMeq7XP8qqJ3Tdg6F2Nybk9So1Z5mWArnG2", - "label": "Falcon C-00000291", - "start_block": 1721410062, - "end_block": 1721747843, - "storage_price_per_block": 46349, - "provider_collateral": 3735928559, - "state": "Published" - } -] -``` - -

-
- - -### `settle-deal-payments` - -As a storage provider, you are entitled to your payment (when you are well behaved), -you can claim your payment by calling`settle-deal-payments`. The command takes a -list of IDs for the deals to be processed. - -> [!NOTE] -> The deal ID list is separated by spaces, for example: -> ``` -> settle_deal_payments 1203 1243 1254 -> ``` - -```bash -storagext-cli --sr25519-key market settle-deal-payments -``` - - -## `storage-provider` - -The `storage-provider` subcommand enables you to interact with the `storage-provider` pallet. - -### `register` - -You need to register as a `Storage Provider` to be able to deal with the clients and perform any storage provider duties. - -```bash -storagext-cli --sr25519-key storage-provider register -``` - -### `pre-commit` - -Storage Provider must pre-commit a sector with deals that have been published by `market publish-storage-deals`, so it can later be proven. -If the deals are not pre-commited in any sector and then proven, they'll be slashed. -Deals in the sector are validated, so without calling `publish-storage-deals` it's not possible to execute this function. -`seal-proof` must match the `post-proof` used in `register`. - -```bash -storagext-cli --sr25519-key storage-provider pre-commit -``` - -This command takes `pre-commit-sector` as JSON Object. - -
-Example Pre-commit Sector JSON -

- -```json -{ - "sector_number": 1, - "sealed_cid": "bafk2bzaceajreoxfdcpdvitpvxm7vkpvcimlob5ejebqgqidjkz4qoug4q6zu", - "deal_ids": [0], - "expiration": 100, - "unsealed_cid": "bafkreibme22gw2h7y2h7tg2fhqotaqjucnbc24deqo72b6mkl2egezxhvy", - "seal_proof": "StackedDRG2KiBV1P1" -} -``` - -

-
- -### `prove-commit` - -Storage Provider must prove commit a sector which has been pre-commited. -If the sector is not proven, deal won't become `Active` and will be **slashed**. - -```bash -storagext-cli --sr25519-key storage-provider prove-commit -``` - -This command takes a `prove-commit-sector` JSON object, the `proof` must be a valid hex-string. -Proof is accepted if it is any valid hex string of length >= 1. - -
-Example Prove Commit Sector JSON -

- -```json -{ - "sector_number": 1, - "proof": "1230deadbeef" -} -``` - -

-
- -### `submit-windowed-post` - -Submit a window [Proof-of-Spacetime](https://spec.filecoin.io/#section-algorithms.pos.post) -to prove the storage provider is still storing the client data. - -```bash -storagext-cli --sr25519-key storage-provider submit-windowed-post -``` - -The command takes a JSON object with four fields — `deadline` a number, `partition` a number, -`chain_commit_block` a block number and `proof` which is another JSON object with fields — -`post_proof` which can either be `2KiB` or `StackedDRGWindow2KiBV1P1` (both amounting to the same value) -and `proof_bytes` which expectes a valid hex string. - -
-Example Submit Windowed Proof-of-Spacetime JSON -

- -```json -{ - "deadline": 10, - "partitions": [10], - "chain_commit_block": 1, - "proof": { - "post_proof": "2KiB", - "proof_bytes": "07482439" - } -} -``` - -

-
- -### `declare-faults` - -Declare [faulty sectors](https://spec.filecoin.io/#section-systems.filecoin_mining.sector.lifecycle) to avoid penalties for not submitting [Window PoSt](../../../docs/glossary.md#post) at the required time. - -```bash -storagext-cli --sr25519-key storage-provider declare-faults -``` - -The command takes a list of JSON objects with the fields — `deadline` a number, `partition` a number and `sectors` an array of numbers. -The `deadline` parameter specificies the deadline where to find the respective `partition` and `sectors`. - -
-Example Declaration of Faults JSON -

- -```json -[ - { - "deadline": 0, - "partition": 0, - "sectors": [ - 0 - ] - } -] -``` - -

-
- -### `declare-faults-recovered` - -Declare [recovered faulty sectors](https://spec.filecoin.io/#section-systems.filecoin_mining.sector.lifecycle) to avoid penalties over sectors that have been recovered. Note that a sector is only considered to be "fully-healed" (i.e. not suffer any penalties) after a new proof has been submitted. - -```bash -storagext-cli --sr25519-key storage-provider declare-faults-recovered -``` - -The command takes a list of JSON objects with the fields — `deadline` a number, `partition` a number and `sectors` an array of numbers. -The `deadline` parameter specificies the deadline where to find the respective `partition` and `sectors`. - -
-Example Declaration of Recovered Faults JSON -

- -```json -[ - { - "deadline": 0, - "partition": 0, - "sectors": [ - 0 - ] - } -] -``` - -

-
diff --git a/cli/polka-storage/storagext/Cargo.toml b/cli/polka-storage/storagext/Cargo.toml index 24f6414c0..218535c7d 100644 --- a/cli/polka-storage/storagext/Cargo.toml +++ b/cli/polka-storage/storagext/Cargo.toml @@ -34,7 +34,7 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] } url = { workspace = true } # Optional dependencies -clap = { workspace = true, optional = true, features = ["derive"] } +clap = { workspace = true, optional = true, features = ["derive", "env"] } [dev-dependencies] # "Duplicated" so we can always test clap-dependent things diff --git a/cli/polka-storage/storagext/README.md b/cli/polka-storage/storagext/README.md index 77ae6f769..4ef7fa0a9 100644 --- a/cli/polka-storage/storagext/README.md +++ b/cli/polka-storage/storagext/README.md @@ -1,8 +1,11 @@ +# storagext CLI + +Docs for the storagext CLI can be found in [the book](../../docs/src/storagext-cli/index.md) + # storagext Extrinsics library for the Polka Storage Parachain. - ## Development note: `subxt` and `frame_support` don't play nice with eachother! diff --git a/cli/polka-storage/storagext-cli/src/cmd/faucet.rs b/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/faucet.rs similarity index 100% rename from cli/polka-storage/storagext-cli/src/cmd/faucet.rs rename to cli/polka-storage/storagext/src/bin/storagext-cli/cmd/faucet.rs diff --git a/cli/polka-storage/storagext-cli/src/cmd/market.rs b/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/market.rs similarity index 100% rename from cli/polka-storage/storagext-cli/src/cmd/market.rs rename to cli/polka-storage/storagext/src/bin/storagext-cli/cmd/market.rs diff --git a/cli/polka-storage/storagext-cli/src/cmd/mod.rs b/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/mod.rs similarity index 100% rename from cli/polka-storage/storagext-cli/src/cmd/mod.rs rename to cli/polka-storage/storagext/src/bin/storagext-cli/cmd/mod.rs diff --git a/cli/polka-storage/storagext-cli/src/cmd/proofs.rs b/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/proofs.rs similarity index 100% rename from cli/polka-storage/storagext-cli/src/cmd/proofs.rs rename to cli/polka-storage/storagext/src/bin/storagext-cli/cmd/proofs.rs diff --git a/cli/polka-storage/storagext-cli/src/cmd/randomness.rs b/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/randomness.rs similarity index 100% rename from cli/polka-storage/storagext-cli/src/cmd/randomness.rs rename to cli/polka-storage/storagext/src/bin/storagext-cli/cmd/randomness.rs diff --git a/cli/polka-storage/storagext-cli/src/cmd/storage_provider.rs b/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/storage_provider.rs similarity index 100% rename from cli/polka-storage/storagext-cli/src/cmd/storage_provider.rs rename to cli/polka-storage/storagext/src/bin/storagext-cli/cmd/storage_provider.rs diff --git a/cli/polka-storage/storagext-cli/src/cmd/system.rs b/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/system.rs similarity index 100% rename from cli/polka-storage/storagext-cli/src/cmd/system.rs rename to cli/polka-storage/storagext/src/bin/storagext-cli/cmd/system.rs diff --git a/cli/polka-storage/storagext-cli/src/main.rs b/cli/polka-storage/storagext/src/bin/storagext-cli/main.rs similarity index 100% rename from cli/polka-storage/storagext-cli/src/main.rs rename to cli/polka-storage/storagext/src/bin/storagext-cli/main.rs diff --git a/storage/file-storage/.gitkeep b/storage/file-storage/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/storage/mater-cli/Cargo.toml b/storage/mater-cli/Cargo.toml deleted file mode 100644 index 420759edd..000000000 --- a/storage/mater-cli/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -authors.workspace = true -edition.workspace = true -homepage.workspace = true -license-file.workspace = true -name = "mater-cli" -repository.workspace = true -version = "0.1.0" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -# Workspace -mater.workspace = true - -# Crates.io -clap = { workspace = true, features = ["derive"] } -thiserror.workspace = true -tokio = { workspace = true, features = ["fs", "macros", "rt-multi-thread"] } - -[dev-dependencies] -anyhow.workspace = true -tempfile.workspace = true - -[lints] -workspace = true diff --git a/storage/mater-cli/README.md b/storage/mater-cli/README.md deleted file mode 100644 index b74d3bb64..000000000 --- a/storage/mater-cli/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Mater CLI - -Docs for the Mater CLI can be found in [the book](../../docs/src/mater-cli/index.md) diff --git a/storage/mater/Cargo.toml b/storage/mater/Cargo.toml index ba72449ea..1660bf67b 100644 --- a/storage/mater/Cargo.toml +++ b/storage/mater/Cargo.toml @@ -12,6 +12,7 @@ async-stream.workspace = true bitflags.workspace = true byteorder = { workspace = true, features = ["i128"] } bytes.workspace = true +clap = { workspace = true, features = ["derive"] } digest.workspace = true futures.workspace = true indexmap.workspace = true @@ -28,6 +29,7 @@ tokio-stream.workspace = true tokio-util = { workspace = true, features = ["io"] } [dev-dependencies] +anyhow.workspace = true criterion = { workspace = true, features = ["async_tokio", "html_reports"] } rand = { workspace = true, default_features = true } tempfile.workspace = true diff --git a/storage/mater/README.md b/storage/mater/README.md index 8848b52c3..cf9a76d12 100644 --- a/storage/mater/README.md +++ b/storage/mater/README.md @@ -1,3 +1,7 @@ +# Mater CLI + +Docs for the Mater CLI can be found in [the book](../../docs/src/mater-cli/index.md) + # Mater A Rust library to read and write CAR files. diff --git a/storage/mater-cli/src/convert.rs b/storage/mater/src/bin/mater-cli/convert.rs similarity index 100% rename from storage/mater-cli/src/convert.rs rename to storage/mater/src/bin/mater-cli/convert.rs diff --git a/storage/mater-cli/src/error.rs b/storage/mater/src/bin/mater-cli/error.rs similarity index 100% rename from storage/mater-cli/src/error.rs rename to storage/mater/src/bin/mater-cli/error.rs diff --git a/storage/mater-cli/src/extract.rs b/storage/mater/src/bin/mater-cli/extract.rs similarity index 100% rename from storage/mater-cli/src/extract.rs rename to storage/mater/src/bin/mater-cli/extract.rs diff --git a/storage/mater-cli/src/main.rs b/storage/mater/src/bin/mater-cli/main.rs similarity index 100% rename from storage/mater-cli/src/main.rs rename to storage/mater/src/bin/mater-cli/main.rs diff --git a/storage/mater/src/lib.rs b/storage/mater/src/lib.rs index e9e6dd62e..f79e1cafb 100644 --- a/storage/mater/src/lib.rs +++ b/storage/mater/src/lib.rs @@ -10,6 +10,9 @@ #![deny(rustdoc::private_intra_doc_links)] #![deny(unsafe_code)] +// It is used by the cli. But the unused_crate_dependencies lint doesn't know that. +use clap as _; + mod async_varint; mod multicodec; mod stores; From ccb4411d5a4846c4ae60b03aa6dca9f210766d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20=C4=8Cerni=C4=8D?= Date: Fri, 22 Nov 2024 13:20:44 +0100 Subject: [PATCH 3/8] move storagext to root --- Cargo.toml | 4 ++-- Justfile | 2 +- cli/polka-storage/.gitkeep | 0 .../storagext => storagext}/Cargo.toml | 0 .../polka-storage/storagext => storagext}/README.md | 0 {cli => storagext}/artifacts/metadata.scale | Bin {cli/polka-storage/storagext => storagext}/build.rs | 2 +- .../src/bin/storagext-cli/cmd/faucet.rs | 0 .../src/bin/storagext-cli/cmd/market.rs | 0 .../src/bin/storagext-cli/cmd/mod.rs | 0 .../src/bin/storagext-cli/cmd/proofs.rs | 0 .../src/bin/storagext-cli/cmd/randomness.rs | 0 .../src/bin/storagext-cli/cmd/storage_provider.rs | 0 .../src/bin/storagext-cli/cmd/system.rs | 0 .../src/bin/storagext-cli/main.rs | 0 .../storagext => storagext}/src/clients/faucet.rs | 0 .../storagext => storagext}/src/clients/market.rs | 0 .../storagext => storagext}/src/clients/mod.rs | 0 .../storagext => storagext}/src/clients/proofs.rs | 0 .../src/clients/randomness.rs | 0 .../src/clients/storage_provider.rs | 0 .../storagext => storagext}/src/clients/system.rs | 0 .../storagext => storagext}/src/deser.rs | 0 .../storagext => storagext}/src/lib.rs | 0 .../storagext => storagext}/src/multipair.rs | 0 .../src/runtime/bounded_vec.rs | 0 .../storagext => storagext}/src/runtime/client.rs | 0 .../src/runtime/display/faucet.rs | 0 .../src/runtime/display/market.rs | 0 .../src/runtime/display/mod.rs | 0 .../src/runtime/display/proofs.rs | 0 .../src/runtime/display/storage_provider.rs | 0 .../storagext => storagext}/src/runtime/mod.rs | 2 +- .../storagext => storagext}/src/types/market.rs | 0 .../storagext => storagext}/src/types/mod.rs | 0 .../storagext => storagext}/src/types/proofs.rs | 0 .../src/types/storage_provider.rs | 0 37 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 cli/polka-storage/.gitkeep rename {cli/polka-storage/storagext => storagext}/Cargo.toml (100%) rename {cli/polka-storage/storagext => storagext}/README.md (100%) rename {cli => storagext}/artifacts/metadata.scale (100%) rename {cli/polka-storage/storagext => storagext}/build.rs (72%) rename {cli/polka-storage/storagext => storagext}/src/bin/storagext-cli/cmd/faucet.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/bin/storagext-cli/cmd/market.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/bin/storagext-cli/cmd/mod.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/bin/storagext-cli/cmd/proofs.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/bin/storagext-cli/cmd/randomness.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/bin/storagext-cli/cmd/storage_provider.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/bin/storagext-cli/cmd/system.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/bin/storagext-cli/main.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/clients/faucet.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/clients/market.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/clients/mod.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/clients/proofs.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/clients/randomness.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/clients/storage_provider.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/clients/system.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/deser.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/lib.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/multipair.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/runtime/bounded_vec.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/runtime/client.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/runtime/display/faucet.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/runtime/display/market.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/runtime/display/mod.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/runtime/display/proofs.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/runtime/display/storage_provider.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/runtime/mod.rs (98%) rename {cli/polka-storage/storagext => storagext}/src/types/market.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/types/mod.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/types/proofs.rs (100%) rename {cli/polka-storage/storagext => storagext}/src/types/storage_provider.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 3fbb075f0..035eb0aa6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,6 @@ members = [ "cli/polka-storage-provider/client", "cli/polka-storage-provider/common", "cli/polka-storage-provider/server", - "cli/polka-storage/storagext", "lib/polka-storage-proofs", "maat", "node", @@ -24,6 +23,7 @@ members = [ "runtime", "storage/mater", "storage/polka-index", + "storagext", ] resolver = "2" @@ -140,7 +140,7 @@ polka-storage-provider-common = { path = "cli/polka-storage-provider/common" } polka-storage-runtime = { path = "runtime" } primitives-commitment = { path = "primitives/commitment" } primitives-proofs = { path = "primitives/proofs", default-features = false } -storagext = { path = "cli/polka-storage/storagext" } +storagext = { path = "storagext" } # FileCoin proofs bellpepper-core = "0.2" diff --git a/Justfile b/Justfile index 6690c12cc..77c40b9f7 100644 --- a/Justfile +++ b/Justfile @@ -5,7 +5,7 @@ alias f := fmt # Generate the `metadata.scale` file, requires the node to be up and running at `127.0.0.1:42069` generate-scale: - subxt metadata -a --url http://127.0.0.1:42069 > cli/artifacts/metadata.scale + subxt metadata -a --url http://127.0.0.1:42069 > storagext/artifacts/metadata.scale # Lint the project lint: diff --git a/cli/polka-storage/.gitkeep b/cli/polka-storage/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/polka-storage/storagext/Cargo.toml b/storagext/Cargo.toml similarity index 100% rename from cli/polka-storage/storagext/Cargo.toml rename to storagext/Cargo.toml diff --git a/cli/polka-storage/storagext/README.md b/storagext/README.md similarity index 100% rename from cli/polka-storage/storagext/README.md rename to storagext/README.md diff --git a/cli/artifacts/metadata.scale b/storagext/artifacts/metadata.scale similarity index 100% rename from cli/artifacts/metadata.scale rename to storagext/artifacts/metadata.scale diff --git a/cli/polka-storage/storagext/build.rs b/storagext/build.rs similarity index 72% rename from cli/polka-storage/storagext/build.rs rename to storagext/build.rs index f8d3bf5c3..61c1ce1ce 100644 --- a/cli/polka-storage/storagext/build.rs +++ b/storagext/build.rs @@ -1,5 +1,5 @@ fn main() { // This ensures that the library recompiles when the SCALE file suffers changes // To generate a new scale file use `just generate-scale` after running the parachain. - println!("cargo::rerun-if-changed=../../artifacts/metadata.scale") + println!("cargo::rerun-if-changed=./artifacts/metadata.scale") } diff --git a/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/faucet.rs b/storagext/src/bin/storagext-cli/cmd/faucet.rs similarity index 100% rename from cli/polka-storage/storagext/src/bin/storagext-cli/cmd/faucet.rs rename to storagext/src/bin/storagext-cli/cmd/faucet.rs diff --git a/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/market.rs b/storagext/src/bin/storagext-cli/cmd/market.rs similarity index 100% rename from cli/polka-storage/storagext/src/bin/storagext-cli/cmd/market.rs rename to storagext/src/bin/storagext-cli/cmd/market.rs diff --git a/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/mod.rs b/storagext/src/bin/storagext-cli/cmd/mod.rs similarity index 100% rename from cli/polka-storage/storagext/src/bin/storagext-cli/cmd/mod.rs rename to storagext/src/bin/storagext-cli/cmd/mod.rs diff --git a/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/proofs.rs b/storagext/src/bin/storagext-cli/cmd/proofs.rs similarity index 100% rename from cli/polka-storage/storagext/src/bin/storagext-cli/cmd/proofs.rs rename to storagext/src/bin/storagext-cli/cmd/proofs.rs diff --git a/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/randomness.rs b/storagext/src/bin/storagext-cli/cmd/randomness.rs similarity index 100% rename from cli/polka-storage/storagext/src/bin/storagext-cli/cmd/randomness.rs rename to storagext/src/bin/storagext-cli/cmd/randomness.rs diff --git a/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/storage_provider.rs b/storagext/src/bin/storagext-cli/cmd/storage_provider.rs similarity index 100% rename from cli/polka-storage/storagext/src/bin/storagext-cli/cmd/storage_provider.rs rename to storagext/src/bin/storagext-cli/cmd/storage_provider.rs diff --git a/cli/polka-storage/storagext/src/bin/storagext-cli/cmd/system.rs b/storagext/src/bin/storagext-cli/cmd/system.rs similarity index 100% rename from cli/polka-storage/storagext/src/bin/storagext-cli/cmd/system.rs rename to storagext/src/bin/storagext-cli/cmd/system.rs diff --git a/cli/polka-storage/storagext/src/bin/storagext-cli/main.rs b/storagext/src/bin/storagext-cli/main.rs similarity index 100% rename from cli/polka-storage/storagext/src/bin/storagext-cli/main.rs rename to storagext/src/bin/storagext-cli/main.rs diff --git a/cli/polka-storage/storagext/src/clients/faucet.rs b/storagext/src/clients/faucet.rs similarity index 100% rename from cli/polka-storage/storagext/src/clients/faucet.rs rename to storagext/src/clients/faucet.rs diff --git a/cli/polka-storage/storagext/src/clients/market.rs b/storagext/src/clients/market.rs similarity index 100% rename from cli/polka-storage/storagext/src/clients/market.rs rename to storagext/src/clients/market.rs diff --git a/cli/polka-storage/storagext/src/clients/mod.rs b/storagext/src/clients/mod.rs similarity index 100% rename from cli/polka-storage/storagext/src/clients/mod.rs rename to storagext/src/clients/mod.rs diff --git a/cli/polka-storage/storagext/src/clients/proofs.rs b/storagext/src/clients/proofs.rs similarity index 100% rename from cli/polka-storage/storagext/src/clients/proofs.rs rename to storagext/src/clients/proofs.rs diff --git a/cli/polka-storage/storagext/src/clients/randomness.rs b/storagext/src/clients/randomness.rs similarity index 100% rename from cli/polka-storage/storagext/src/clients/randomness.rs rename to storagext/src/clients/randomness.rs diff --git a/cli/polka-storage/storagext/src/clients/storage_provider.rs b/storagext/src/clients/storage_provider.rs similarity index 100% rename from cli/polka-storage/storagext/src/clients/storage_provider.rs rename to storagext/src/clients/storage_provider.rs diff --git a/cli/polka-storage/storagext/src/clients/system.rs b/storagext/src/clients/system.rs similarity index 100% rename from cli/polka-storage/storagext/src/clients/system.rs rename to storagext/src/clients/system.rs diff --git a/cli/polka-storage/storagext/src/deser.rs b/storagext/src/deser.rs similarity index 100% rename from cli/polka-storage/storagext/src/deser.rs rename to storagext/src/deser.rs diff --git a/cli/polka-storage/storagext/src/lib.rs b/storagext/src/lib.rs similarity index 100% rename from cli/polka-storage/storagext/src/lib.rs rename to storagext/src/lib.rs diff --git a/cli/polka-storage/storagext/src/multipair.rs b/storagext/src/multipair.rs similarity index 100% rename from cli/polka-storage/storagext/src/multipair.rs rename to storagext/src/multipair.rs diff --git a/cli/polka-storage/storagext/src/runtime/bounded_vec.rs b/storagext/src/runtime/bounded_vec.rs similarity index 100% rename from cli/polka-storage/storagext/src/runtime/bounded_vec.rs rename to storagext/src/runtime/bounded_vec.rs diff --git a/cli/polka-storage/storagext/src/runtime/client.rs b/storagext/src/runtime/client.rs similarity index 100% rename from cli/polka-storage/storagext/src/runtime/client.rs rename to storagext/src/runtime/client.rs diff --git a/cli/polka-storage/storagext/src/runtime/display/faucet.rs b/storagext/src/runtime/display/faucet.rs similarity index 100% rename from cli/polka-storage/storagext/src/runtime/display/faucet.rs rename to storagext/src/runtime/display/faucet.rs diff --git a/cli/polka-storage/storagext/src/runtime/display/market.rs b/storagext/src/runtime/display/market.rs similarity index 100% rename from cli/polka-storage/storagext/src/runtime/display/market.rs rename to storagext/src/runtime/display/market.rs diff --git a/cli/polka-storage/storagext/src/runtime/display/mod.rs b/storagext/src/runtime/display/mod.rs similarity index 100% rename from cli/polka-storage/storagext/src/runtime/display/mod.rs rename to storagext/src/runtime/display/mod.rs diff --git a/cli/polka-storage/storagext/src/runtime/display/proofs.rs b/storagext/src/runtime/display/proofs.rs similarity index 100% rename from cli/polka-storage/storagext/src/runtime/display/proofs.rs rename to storagext/src/runtime/display/proofs.rs diff --git a/cli/polka-storage/storagext/src/runtime/display/storage_provider.rs b/storagext/src/runtime/display/storage_provider.rs similarity index 100% rename from cli/polka-storage/storagext/src/runtime/display/storage_provider.rs rename to storagext/src/runtime/display/storage_provider.rs diff --git a/cli/polka-storage/storagext/src/runtime/mod.rs b/storagext/src/runtime/mod.rs similarity index 98% rename from cli/polka-storage/storagext/src/runtime/mod.rs rename to storagext/src/runtime/mod.rs index a9ad37fb1..0ad6bdd55 100644 --- a/cli/polka-storage/storagext/src/runtime/mod.rs +++ b/storagext/src/runtime/mod.rs @@ -10,7 +10,7 @@ pub mod display; // NOTE: you'll need to reload the window if the underlying SCALE file changes // https://github.com/rust-lang/rust-analyzer/issues/10719 #[subxt::subxt( - runtime_metadata_path = "../../artifacts/metadata.scale", + runtime_metadata_path = "./artifacts/metadata.scale", derive_for_all_types = "Clone, PartialEq, Eq", substitute_type( path = "sp_runtime::MultiSignature", diff --git a/cli/polka-storage/storagext/src/types/market.rs b/storagext/src/types/market.rs similarity index 100% rename from cli/polka-storage/storagext/src/types/market.rs rename to storagext/src/types/market.rs diff --git a/cli/polka-storage/storagext/src/types/mod.rs b/storagext/src/types/mod.rs similarity index 100% rename from cli/polka-storage/storagext/src/types/mod.rs rename to storagext/src/types/mod.rs diff --git a/cli/polka-storage/storagext/src/types/proofs.rs b/storagext/src/types/proofs.rs similarity index 100% rename from cli/polka-storage/storagext/src/types/proofs.rs rename to storagext/src/types/proofs.rs diff --git a/cli/polka-storage/storagext/src/types/storage_provider.rs b/storagext/src/types/storage_provider.rs similarity index 100% rename from cli/polka-storage/storagext/src/types/storage_provider.rs rename to storagext/src/types/storage_provider.rs From 6c3115b62f7770863c712944d238bf854ad9be34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20=C4=8Cerni=C4=8D?= Date: Fri, 22 Nov 2024 13:29:49 +0100 Subject: [PATCH 4/8] legacy --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 035eb0aa6..357fe5609 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -128,7 +128,6 @@ zombienet-sdk = "0.2.15" zombienet-support = "0.2.15" # Local -cli-primitives = { path = "primitives/cli" } mater = { path = "storage/mater" } pallet-faucet = { path = "pallets/faucet", default-features = false } pallet-market = { path = "pallets/market", default-features = false } From aee4cfd88848d89e6c94f8a09196eaadf62276d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20=C4=8Cerni=C4=8D?= Date: Fri, 22 Nov 2024 17:55:49 +0100 Subject: [PATCH 5/8] storagext split --- Cargo.lock | 23 ++++++++++++ Cargo.toml | 5 +-- storagext/cli/Cargo.toml | 34 ++++++++++++++++++ storagext/cli/README.md | 3 ++ .../storagext-cli => cli/src}/cmd/faucet.rs | 0 .../storagext-cli => cli/src}/cmd/market.rs | 0 .../bin/storagext-cli => cli/src}/cmd/mod.rs | 0 .../storagext-cli => cli/src}/cmd/proofs.rs | 0 .../src}/cmd/randomness.rs | 0 .../src}/cmd/storage_provider.rs | 0 .../storagext-cli => cli/src}/cmd/system.rs | 0 .../bin/storagext-cli => cli/src}/main.rs | 0 storagext/{ => lib}/Cargo.toml | 2 +- storagext/{ => lib}/README.md | 4 --- storagext/{ => lib}/artifacts/metadata.scale | Bin storagext/{ => lib}/build.rs | 0 storagext/{ => lib}/src/clients/faucet.rs | 0 storagext/{ => lib}/src/clients/market.rs | 0 storagext/{ => lib}/src/clients/mod.rs | 0 storagext/{ => lib}/src/clients/proofs.rs | 0 storagext/{ => lib}/src/clients/randomness.rs | 0 .../{ => lib}/src/clients/storage_provider.rs | 0 storagext/{ => lib}/src/clients/system.rs | 0 storagext/{ => lib}/src/deser.rs | 0 storagext/{ => lib}/src/lib.rs | 0 storagext/{ => lib}/src/multipair.rs | 0 .../{ => lib}/src/runtime/bounded_vec.rs | 0 storagext/{ => lib}/src/runtime/client.rs | 0 .../{ => lib}/src/runtime/display/faucet.rs | 0 .../{ => lib}/src/runtime/display/market.rs | 0 .../{ => lib}/src/runtime/display/mod.rs | 0 .../{ => lib}/src/runtime/display/proofs.rs | 0 .../src/runtime/display/storage_provider.rs | 0 storagext/{ => lib}/src/runtime/mod.rs | 0 storagext/{ => lib}/src/types/market.rs | 0 storagext/{ => lib}/src/types/mod.rs | 0 storagext/{ => lib}/src/types/proofs.rs | 0 .../{ => lib}/src/types/storage_provider.rs | 0 38 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 storagext/cli/Cargo.toml create mode 100644 storagext/cli/README.md rename storagext/{src/bin/storagext-cli => cli/src}/cmd/faucet.rs (100%) rename storagext/{src/bin/storagext-cli => cli/src}/cmd/market.rs (100%) rename storagext/{src/bin/storagext-cli => cli/src}/cmd/mod.rs (100%) rename storagext/{src/bin/storagext-cli => cli/src}/cmd/proofs.rs (100%) rename storagext/{src/bin/storagext-cli => cli/src}/cmd/randomness.rs (100%) rename storagext/{src/bin/storagext-cli => cli/src}/cmd/storage_provider.rs (100%) rename storagext/{src/bin/storagext-cli => cli/src}/cmd/system.rs (100%) rename storagext/{src/bin/storagext-cli => cli/src}/main.rs (100%) rename storagext/{ => lib}/Cargo.toml (99%) rename storagext/{ => lib}/README.md (57%) rename storagext/{ => lib}/artifacts/metadata.scale (100%) rename storagext/{ => lib}/build.rs (100%) rename storagext/{ => lib}/src/clients/faucet.rs (100%) rename storagext/{ => lib}/src/clients/market.rs (100%) rename storagext/{ => lib}/src/clients/mod.rs (100%) rename storagext/{ => lib}/src/clients/proofs.rs (100%) rename storagext/{ => lib}/src/clients/randomness.rs (100%) rename storagext/{ => lib}/src/clients/storage_provider.rs (100%) rename storagext/{ => lib}/src/clients/system.rs (100%) rename storagext/{ => lib}/src/deser.rs (100%) rename storagext/{ => lib}/src/lib.rs (100%) rename storagext/{ => lib}/src/multipair.rs (100%) rename storagext/{ => lib}/src/runtime/bounded_vec.rs (100%) rename storagext/{ => lib}/src/runtime/client.rs (100%) rename storagext/{ => lib}/src/runtime/display/faucet.rs (100%) rename storagext/{ => lib}/src/runtime/display/market.rs (100%) rename storagext/{ => lib}/src/runtime/display/mod.rs (100%) rename storagext/{ => lib}/src/runtime/display/proofs.rs (100%) rename storagext/{ => lib}/src/runtime/display/storage_provider.rs (100%) rename storagext/{ => lib}/src/runtime/mod.rs (100%) rename storagext/{ => lib}/src/types/market.rs (100%) rename storagext/{ => lib}/src/types/mod.rs (100%) rename storagext/{ => lib}/src/types/proofs.rs (100%) rename storagext/{ => lib}/src/types/storage_provider.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 40eee772e..6b4715515 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20958,6 +20958,29 @@ dependencies = [ "url", ] +[[package]] +name = "storagext-cli" +version = "0.1.0" +dependencies = [ + "anyhow", + "cid 0.11.1", + "clap", + "frame-support 38.0.0 (git+https://github.com/paritytech/polkadot-sdk?tag=polkadot-stable2409-2)", + "hex", + "parity-scale-codec", + "primitives-proofs", + "serde", + "serde_json", + "storagext", + "subxt", + "subxt-signer", + "thiserror 2.0.3", + "tokio", + "tracing", + "tracing-subscriber 0.3.18", + "url", +] + [[package]] name = "str0m" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index 357fe5609..8c89ae5d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,8 @@ members = [ "runtime", "storage/mater", "storage/polka-index", - "storagext", + "storagext/cli", + "storagext/lib", ] resolver = "2" @@ -139,7 +140,7 @@ polka-storage-provider-common = { path = "cli/polka-storage-provider/common" } polka-storage-runtime = { path = "runtime" } primitives-commitment = { path = "primitives/commitment" } primitives-proofs = { path = "primitives/proofs", default-features = false } -storagext = { path = "storagext" } +storagext = { path = "storagext/lib" } # FileCoin proofs bellpepper-core = "0.2" diff --git a/storagext/cli/Cargo.toml b/storagext/cli/Cargo.toml new file mode 100644 index 000000000..15929b2c2 --- /dev/null +++ b/storagext/cli/Cargo.toml @@ -0,0 +1,34 @@ +[package] +authors.workspace = true +edition.workspace = true +homepage.workspace = true +license-file.workspace = true +name = "storagext-cli" +repository.workspace = true +version = "0.1.0" + +[features] +insecure_url = ["storagext/insecure_url"] + +[dependencies] +storagext = { workspace = true, features = ["clap"] } + +anyhow.workspace = true +cid = { workspace = true, features = ["scale-codec"], default-features = true } +clap = { workspace = true, features = ["derive", "env"] } +codec.workspace = true +frame-support = { workspace = true, features = ["std"] } +hex = { workspace = true, features = ["serde", "std"] } +primitives-proofs = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +subxt = { workspace = true, features = ["jsonrpsee", "substrate-compat"] } +subxt-signer = { workspace = true, features = ["subxt"] } +thiserror = { workspace = true } +tokio = { workspace = true, features = ["rt-multi-thread"] } +tracing = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } +url = { workspace = true } + +[lints] +workspace = true diff --git a/storagext/cli/README.md b/storagext/cli/README.md new file mode 100644 index 000000000..311abe2b0 --- /dev/null +++ b/storagext/cli/README.md @@ -0,0 +1,3 @@ +# storagext CLI + +Docs for the storagext CLI can be found in [the book](../../docs/src/storagext-cli/index.md) diff --git a/storagext/src/bin/storagext-cli/cmd/faucet.rs b/storagext/cli/src/cmd/faucet.rs similarity index 100% rename from storagext/src/bin/storagext-cli/cmd/faucet.rs rename to storagext/cli/src/cmd/faucet.rs diff --git a/storagext/src/bin/storagext-cli/cmd/market.rs b/storagext/cli/src/cmd/market.rs similarity index 100% rename from storagext/src/bin/storagext-cli/cmd/market.rs rename to storagext/cli/src/cmd/market.rs diff --git a/storagext/src/bin/storagext-cli/cmd/mod.rs b/storagext/cli/src/cmd/mod.rs similarity index 100% rename from storagext/src/bin/storagext-cli/cmd/mod.rs rename to storagext/cli/src/cmd/mod.rs diff --git a/storagext/src/bin/storagext-cli/cmd/proofs.rs b/storagext/cli/src/cmd/proofs.rs similarity index 100% rename from storagext/src/bin/storagext-cli/cmd/proofs.rs rename to storagext/cli/src/cmd/proofs.rs diff --git a/storagext/src/bin/storagext-cli/cmd/randomness.rs b/storagext/cli/src/cmd/randomness.rs similarity index 100% rename from storagext/src/bin/storagext-cli/cmd/randomness.rs rename to storagext/cli/src/cmd/randomness.rs diff --git a/storagext/src/bin/storagext-cli/cmd/storage_provider.rs b/storagext/cli/src/cmd/storage_provider.rs similarity index 100% rename from storagext/src/bin/storagext-cli/cmd/storage_provider.rs rename to storagext/cli/src/cmd/storage_provider.rs diff --git a/storagext/src/bin/storagext-cli/cmd/system.rs b/storagext/cli/src/cmd/system.rs similarity index 100% rename from storagext/src/bin/storagext-cli/cmd/system.rs rename to storagext/cli/src/cmd/system.rs diff --git a/storagext/src/bin/storagext-cli/main.rs b/storagext/cli/src/main.rs similarity index 100% rename from storagext/src/bin/storagext-cli/main.rs rename to storagext/cli/src/main.rs diff --git a/storagext/Cargo.toml b/storagext/lib/Cargo.toml similarity index 99% rename from storagext/Cargo.toml rename to storagext/lib/Cargo.toml index 218535c7d..24f6414c0 100644 --- a/storagext/Cargo.toml +++ b/storagext/lib/Cargo.toml @@ -34,7 +34,7 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] } url = { workspace = true } # Optional dependencies -clap = { workspace = true, optional = true, features = ["derive", "env"] } +clap = { workspace = true, optional = true, features = ["derive"] } [dev-dependencies] # "Duplicated" so we can always test clap-dependent things diff --git a/storagext/README.md b/storagext/lib/README.md similarity index 57% rename from storagext/README.md rename to storagext/lib/README.md index 4ef7fa0a9..ed1bb5972 100644 --- a/storagext/README.md +++ b/storagext/lib/README.md @@ -1,7 +1,3 @@ -# storagext CLI - -Docs for the storagext CLI can be found in [the book](../../docs/src/storagext-cli/index.md) - # storagext Extrinsics library for the Polka Storage Parachain. diff --git a/storagext/artifacts/metadata.scale b/storagext/lib/artifacts/metadata.scale similarity index 100% rename from storagext/artifacts/metadata.scale rename to storagext/lib/artifacts/metadata.scale diff --git a/storagext/build.rs b/storagext/lib/build.rs similarity index 100% rename from storagext/build.rs rename to storagext/lib/build.rs diff --git a/storagext/src/clients/faucet.rs b/storagext/lib/src/clients/faucet.rs similarity index 100% rename from storagext/src/clients/faucet.rs rename to storagext/lib/src/clients/faucet.rs diff --git a/storagext/src/clients/market.rs b/storagext/lib/src/clients/market.rs similarity index 100% rename from storagext/src/clients/market.rs rename to storagext/lib/src/clients/market.rs diff --git a/storagext/src/clients/mod.rs b/storagext/lib/src/clients/mod.rs similarity index 100% rename from storagext/src/clients/mod.rs rename to storagext/lib/src/clients/mod.rs diff --git a/storagext/src/clients/proofs.rs b/storagext/lib/src/clients/proofs.rs similarity index 100% rename from storagext/src/clients/proofs.rs rename to storagext/lib/src/clients/proofs.rs diff --git a/storagext/src/clients/randomness.rs b/storagext/lib/src/clients/randomness.rs similarity index 100% rename from storagext/src/clients/randomness.rs rename to storagext/lib/src/clients/randomness.rs diff --git a/storagext/src/clients/storage_provider.rs b/storagext/lib/src/clients/storage_provider.rs similarity index 100% rename from storagext/src/clients/storage_provider.rs rename to storagext/lib/src/clients/storage_provider.rs diff --git a/storagext/src/clients/system.rs b/storagext/lib/src/clients/system.rs similarity index 100% rename from storagext/src/clients/system.rs rename to storagext/lib/src/clients/system.rs diff --git a/storagext/src/deser.rs b/storagext/lib/src/deser.rs similarity index 100% rename from storagext/src/deser.rs rename to storagext/lib/src/deser.rs diff --git a/storagext/src/lib.rs b/storagext/lib/src/lib.rs similarity index 100% rename from storagext/src/lib.rs rename to storagext/lib/src/lib.rs diff --git a/storagext/src/multipair.rs b/storagext/lib/src/multipair.rs similarity index 100% rename from storagext/src/multipair.rs rename to storagext/lib/src/multipair.rs diff --git a/storagext/src/runtime/bounded_vec.rs b/storagext/lib/src/runtime/bounded_vec.rs similarity index 100% rename from storagext/src/runtime/bounded_vec.rs rename to storagext/lib/src/runtime/bounded_vec.rs diff --git a/storagext/src/runtime/client.rs b/storagext/lib/src/runtime/client.rs similarity index 100% rename from storagext/src/runtime/client.rs rename to storagext/lib/src/runtime/client.rs diff --git a/storagext/src/runtime/display/faucet.rs b/storagext/lib/src/runtime/display/faucet.rs similarity index 100% rename from storagext/src/runtime/display/faucet.rs rename to storagext/lib/src/runtime/display/faucet.rs diff --git a/storagext/src/runtime/display/market.rs b/storagext/lib/src/runtime/display/market.rs similarity index 100% rename from storagext/src/runtime/display/market.rs rename to storagext/lib/src/runtime/display/market.rs diff --git a/storagext/src/runtime/display/mod.rs b/storagext/lib/src/runtime/display/mod.rs similarity index 100% rename from storagext/src/runtime/display/mod.rs rename to storagext/lib/src/runtime/display/mod.rs diff --git a/storagext/src/runtime/display/proofs.rs b/storagext/lib/src/runtime/display/proofs.rs similarity index 100% rename from storagext/src/runtime/display/proofs.rs rename to storagext/lib/src/runtime/display/proofs.rs diff --git a/storagext/src/runtime/display/storage_provider.rs b/storagext/lib/src/runtime/display/storage_provider.rs similarity index 100% rename from storagext/src/runtime/display/storage_provider.rs rename to storagext/lib/src/runtime/display/storage_provider.rs diff --git a/storagext/src/runtime/mod.rs b/storagext/lib/src/runtime/mod.rs similarity index 100% rename from storagext/src/runtime/mod.rs rename to storagext/lib/src/runtime/mod.rs diff --git a/storagext/src/types/market.rs b/storagext/lib/src/types/market.rs similarity index 100% rename from storagext/src/types/market.rs rename to storagext/lib/src/types/market.rs diff --git a/storagext/src/types/mod.rs b/storagext/lib/src/types/mod.rs similarity index 100% rename from storagext/src/types/mod.rs rename to storagext/lib/src/types/mod.rs diff --git a/storagext/src/types/proofs.rs b/storagext/lib/src/types/proofs.rs similarity index 100% rename from storagext/src/types/proofs.rs rename to storagext/lib/src/types/proofs.rs diff --git a/storagext/src/types/storage_provider.rs b/storagext/lib/src/types/storage_provider.rs similarity index 100% rename from storagext/src/types/storage_provider.rs rename to storagext/lib/src/types/storage_provider.rs From b5a8be96de4e6052f513043aa1873709883a02c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20=C4=8Cerni=C4=8D?= Date: Fri, 22 Nov 2024 18:19:08 +0100 Subject: [PATCH 6/8] split mater --- Cargo.lock | 14 ++++++++-- Cargo.toml | 5 ++-- mater/cli/Cargo.toml | 26 ++++++++++++++++++ mater/cli/README.md | 3 ++ .../mater-cli => mater/cli/src}/convert.rs | 0 .../bin/mater-cli => mater/cli/src}/error.rs | 0 .../mater-cli => mater/cli/src}/extract.rs | 0 .../bin/mater-cli => mater/cli/src}/main.rs | 0 {storage/mater => mater/lib}/BENCHMARK.md | 0 {storage/mater => mater/lib}/Cargo.toml | 2 -- {storage/mater => mater/lib}/README.md | 4 --- .../mater => mater/lib}/benches/benchmark.rs | 0 .../mater => mater/lib}/src/async_varint.rs | 0 {storage/mater => mater/lib}/src/lib.rs | 3 -- .../mater => mater/lib}/src/multicodec.rs | 0 .../lib}/src/stores/blockstore.rs | 0 .../lib}/src/stores/filestore.rs | 0 .../mater => mater/lib}/src/stores/mod.rs | 0 .../mater => mater/lib}/src/unixfs/mod.rs | 0 .../lib}/src/unixfs/unixfs.proto | 0 .../lib}/src/unixfs/unixfs_pb.rs | 0 {storage/mater => mater/lib}/src/v1/mod.rs | 0 {storage/mater => mater/lib}/src/v1/reader.rs | 0 {storage/mater => mater/lib}/src/v1/writer.rs | 0 {storage/mater => mater/lib}/src/v2/index.rs | 0 {storage/mater => mater/lib}/src/v2/mod.rs | 0 {storage/mater => mater/lib}/src/v2/reader.rs | 0 {storage/mater => mater/lib}/src/v2/writer.rs | 0 .../lib}/tests/fixtures/car_v1/lorem.car | Bin .../tests/fixtures/car_v1/lorem_header.car | Bin .../tests/fixtures/car_v1/spaceglenda.car | Bin .../lib}/tests/fixtures/car_v2/empty.car | Bin .../lib}/tests/fixtures/car_v2/lorem.car | Bin .../tests/fixtures/car_v2/spaceglenda.car | Bin .../lib}/tests/fixtures/original/lorem.txt | 0 .../tests/fixtures/original/lorem_1024.txt | 0 .../fixtures/original/lorem_4096_dup.txt | 0 .../tests/fixtures/original/spaceglenda.jpg | Bin 38 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 mater/cli/Cargo.toml create mode 100644 mater/cli/README.md rename {storage/mater/src/bin/mater-cli => mater/cli/src}/convert.rs (100%) rename {storage/mater/src/bin/mater-cli => mater/cli/src}/error.rs (100%) rename {storage/mater/src/bin/mater-cli => mater/cli/src}/extract.rs (100%) rename {storage/mater/src/bin/mater-cli => mater/cli/src}/main.rs (100%) rename {storage/mater => mater/lib}/BENCHMARK.md (100%) rename {storage/mater => mater/lib}/Cargo.toml (94%) rename {storage/mater => mater/lib}/README.md (95%) rename {storage/mater => mater/lib}/benches/benchmark.rs (100%) rename {storage/mater => mater/lib}/src/async_varint.rs (100%) rename {storage/mater => mater/lib}/src/lib.rs (98%) rename {storage/mater => mater/lib}/src/multicodec.rs (100%) rename {storage/mater => mater/lib}/src/stores/blockstore.rs (100%) rename {storage/mater => mater/lib}/src/stores/filestore.rs (100%) rename {storage/mater => mater/lib}/src/stores/mod.rs (100%) rename {storage/mater => mater/lib}/src/unixfs/mod.rs (100%) rename {storage/mater => mater/lib}/src/unixfs/unixfs.proto (100%) rename {storage/mater => mater/lib}/src/unixfs/unixfs_pb.rs (100%) rename {storage/mater => mater/lib}/src/v1/mod.rs (100%) rename {storage/mater => mater/lib}/src/v1/reader.rs (100%) rename {storage/mater => mater/lib}/src/v1/writer.rs (100%) rename {storage/mater => mater/lib}/src/v2/index.rs (100%) rename {storage/mater => mater/lib}/src/v2/mod.rs (100%) rename {storage/mater => mater/lib}/src/v2/reader.rs (100%) rename {storage/mater => mater/lib}/src/v2/writer.rs (100%) rename {storage/mater => mater/lib}/tests/fixtures/car_v1/lorem.car (100%) rename {storage/mater => mater/lib}/tests/fixtures/car_v1/lorem_header.car (100%) rename {storage/mater => mater/lib}/tests/fixtures/car_v1/spaceglenda.car (100%) rename {storage/mater => mater/lib}/tests/fixtures/car_v2/empty.car (100%) rename {storage/mater => mater/lib}/tests/fixtures/car_v2/lorem.car (100%) rename {storage/mater => mater/lib}/tests/fixtures/car_v2/spaceglenda.car (100%) rename {storage/mater => mater/lib}/tests/fixtures/original/lorem.txt (100%) rename {storage/mater => mater/lib}/tests/fixtures/original/lorem_1024.txt (100%) rename {storage/mater => mater/lib}/tests/fixtures/original/lorem_4096_dup.txt (100%) rename {storage/mater => mater/lib}/tests/fixtures/original/spaceglenda.jpg (100%) diff --git a/Cargo.lock b/Cargo.lock index 6b4715515..20e16e766 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7999,12 +7999,10 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" name = "mater" version = "0.1.0" dependencies = [ - "anyhow", "async-stream", "bitflags 2.6.0", "byteorder", "bytes", - "clap", "criterion", "digest 0.10.7", "futures", @@ -8024,6 +8022,18 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "mater-cli" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "mater", + "tempfile", + "thiserror 2.0.3", + "tokio", +] + [[package]] name = "matrixmultiply" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 8c89ae5d5..4fff8fd38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,8 @@ members = [ "cli/polka-storage-provider/server", "lib/polka-storage-proofs", "maat", + "mater/cli", + "mater/lib", "node", "pallets/faucet", "pallets/market", @@ -21,7 +23,6 @@ members = [ "primitives/commitment", "primitives/proofs", "runtime", - "storage/mater", "storage/polka-index", "storagext/cli", "storagext/lib", @@ -129,7 +130,7 @@ zombienet-sdk = "0.2.15" zombienet-support = "0.2.15" # Local -mater = { path = "storage/mater" } +mater = { path = "mater/lib" } pallet-faucet = { path = "pallets/faucet", default-features = false } pallet-market = { path = "pallets/market", default-features = false } pallet-proofs = { path = "pallets/proofs", default-features = false } diff --git a/mater/cli/Cargo.toml b/mater/cli/Cargo.toml new file mode 100644 index 000000000..420759edd --- /dev/null +++ b/mater/cli/Cargo.toml @@ -0,0 +1,26 @@ +[package] +authors.workspace = true +edition.workspace = true +homepage.workspace = true +license-file.workspace = true +name = "mater-cli" +repository.workspace = true +version = "0.1.0" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +# Workspace +mater.workspace = true + +# Crates.io +clap = { workspace = true, features = ["derive"] } +thiserror.workspace = true +tokio = { workspace = true, features = ["fs", "macros", "rt-multi-thread"] } + +[dev-dependencies] +anyhow.workspace = true +tempfile.workspace = true + +[lints] +workspace = true diff --git a/mater/cli/README.md b/mater/cli/README.md new file mode 100644 index 000000000..b74d3bb64 --- /dev/null +++ b/mater/cli/README.md @@ -0,0 +1,3 @@ +# Mater CLI + +Docs for the Mater CLI can be found in [the book](../../docs/src/mater-cli/index.md) diff --git a/storage/mater/src/bin/mater-cli/convert.rs b/mater/cli/src/convert.rs similarity index 100% rename from storage/mater/src/bin/mater-cli/convert.rs rename to mater/cli/src/convert.rs diff --git a/storage/mater/src/bin/mater-cli/error.rs b/mater/cli/src/error.rs similarity index 100% rename from storage/mater/src/bin/mater-cli/error.rs rename to mater/cli/src/error.rs diff --git a/storage/mater/src/bin/mater-cli/extract.rs b/mater/cli/src/extract.rs similarity index 100% rename from storage/mater/src/bin/mater-cli/extract.rs rename to mater/cli/src/extract.rs diff --git a/storage/mater/src/bin/mater-cli/main.rs b/mater/cli/src/main.rs similarity index 100% rename from storage/mater/src/bin/mater-cli/main.rs rename to mater/cli/src/main.rs diff --git a/storage/mater/BENCHMARK.md b/mater/lib/BENCHMARK.md similarity index 100% rename from storage/mater/BENCHMARK.md rename to mater/lib/BENCHMARK.md diff --git a/storage/mater/Cargo.toml b/mater/lib/Cargo.toml similarity index 94% rename from storage/mater/Cargo.toml rename to mater/lib/Cargo.toml index 1660bf67b..ba72449ea 100644 --- a/storage/mater/Cargo.toml +++ b/mater/lib/Cargo.toml @@ -12,7 +12,6 @@ async-stream.workspace = true bitflags.workspace = true byteorder = { workspace = true, features = ["i128"] } bytes.workspace = true -clap = { workspace = true, features = ["derive"] } digest.workspace = true futures.workspace = true indexmap.workspace = true @@ -29,7 +28,6 @@ tokio-stream.workspace = true tokio-util = { workspace = true, features = ["io"] } [dev-dependencies] -anyhow.workspace = true criterion = { workspace = true, features = ["async_tokio", "html_reports"] } rand = { workspace = true, default_features = true } tempfile.workspace = true diff --git a/storage/mater/README.md b/mater/lib/README.md similarity index 95% rename from storage/mater/README.md rename to mater/lib/README.md index cf9a76d12..8848b52c3 100644 --- a/storage/mater/README.md +++ b/mater/lib/README.md @@ -1,7 +1,3 @@ -# Mater CLI - -Docs for the Mater CLI can be found in [the book](../../docs/src/mater-cli/index.md) - # Mater A Rust library to read and write CAR files. diff --git a/storage/mater/benches/benchmark.rs b/mater/lib/benches/benchmark.rs similarity index 100% rename from storage/mater/benches/benchmark.rs rename to mater/lib/benches/benchmark.rs diff --git a/storage/mater/src/async_varint.rs b/mater/lib/src/async_varint.rs similarity index 100% rename from storage/mater/src/async_varint.rs rename to mater/lib/src/async_varint.rs diff --git a/storage/mater/src/lib.rs b/mater/lib/src/lib.rs similarity index 98% rename from storage/mater/src/lib.rs rename to mater/lib/src/lib.rs index f79e1cafb..e9e6dd62e 100644 --- a/storage/mater/src/lib.rs +++ b/mater/lib/src/lib.rs @@ -10,9 +10,6 @@ #![deny(rustdoc::private_intra_doc_links)] #![deny(unsafe_code)] -// It is used by the cli. But the unused_crate_dependencies lint doesn't know that. -use clap as _; - mod async_varint; mod multicodec; mod stores; diff --git a/storage/mater/src/multicodec.rs b/mater/lib/src/multicodec.rs similarity index 100% rename from storage/mater/src/multicodec.rs rename to mater/lib/src/multicodec.rs diff --git a/storage/mater/src/stores/blockstore.rs b/mater/lib/src/stores/blockstore.rs similarity index 100% rename from storage/mater/src/stores/blockstore.rs rename to mater/lib/src/stores/blockstore.rs diff --git a/storage/mater/src/stores/filestore.rs b/mater/lib/src/stores/filestore.rs similarity index 100% rename from storage/mater/src/stores/filestore.rs rename to mater/lib/src/stores/filestore.rs diff --git a/storage/mater/src/stores/mod.rs b/mater/lib/src/stores/mod.rs similarity index 100% rename from storage/mater/src/stores/mod.rs rename to mater/lib/src/stores/mod.rs diff --git a/storage/mater/src/unixfs/mod.rs b/mater/lib/src/unixfs/mod.rs similarity index 100% rename from storage/mater/src/unixfs/mod.rs rename to mater/lib/src/unixfs/mod.rs diff --git a/storage/mater/src/unixfs/unixfs.proto b/mater/lib/src/unixfs/unixfs.proto similarity index 100% rename from storage/mater/src/unixfs/unixfs.proto rename to mater/lib/src/unixfs/unixfs.proto diff --git a/storage/mater/src/unixfs/unixfs_pb.rs b/mater/lib/src/unixfs/unixfs_pb.rs similarity index 100% rename from storage/mater/src/unixfs/unixfs_pb.rs rename to mater/lib/src/unixfs/unixfs_pb.rs diff --git a/storage/mater/src/v1/mod.rs b/mater/lib/src/v1/mod.rs similarity index 100% rename from storage/mater/src/v1/mod.rs rename to mater/lib/src/v1/mod.rs diff --git a/storage/mater/src/v1/reader.rs b/mater/lib/src/v1/reader.rs similarity index 100% rename from storage/mater/src/v1/reader.rs rename to mater/lib/src/v1/reader.rs diff --git a/storage/mater/src/v1/writer.rs b/mater/lib/src/v1/writer.rs similarity index 100% rename from storage/mater/src/v1/writer.rs rename to mater/lib/src/v1/writer.rs diff --git a/storage/mater/src/v2/index.rs b/mater/lib/src/v2/index.rs similarity index 100% rename from storage/mater/src/v2/index.rs rename to mater/lib/src/v2/index.rs diff --git a/storage/mater/src/v2/mod.rs b/mater/lib/src/v2/mod.rs similarity index 100% rename from storage/mater/src/v2/mod.rs rename to mater/lib/src/v2/mod.rs diff --git a/storage/mater/src/v2/reader.rs b/mater/lib/src/v2/reader.rs similarity index 100% rename from storage/mater/src/v2/reader.rs rename to mater/lib/src/v2/reader.rs diff --git a/storage/mater/src/v2/writer.rs b/mater/lib/src/v2/writer.rs similarity index 100% rename from storage/mater/src/v2/writer.rs rename to mater/lib/src/v2/writer.rs diff --git a/storage/mater/tests/fixtures/car_v1/lorem.car b/mater/lib/tests/fixtures/car_v1/lorem.car similarity index 100% rename from storage/mater/tests/fixtures/car_v1/lorem.car rename to mater/lib/tests/fixtures/car_v1/lorem.car diff --git a/storage/mater/tests/fixtures/car_v1/lorem_header.car b/mater/lib/tests/fixtures/car_v1/lorem_header.car similarity index 100% rename from storage/mater/tests/fixtures/car_v1/lorem_header.car rename to mater/lib/tests/fixtures/car_v1/lorem_header.car diff --git a/storage/mater/tests/fixtures/car_v1/spaceglenda.car b/mater/lib/tests/fixtures/car_v1/spaceglenda.car similarity index 100% rename from storage/mater/tests/fixtures/car_v1/spaceglenda.car rename to mater/lib/tests/fixtures/car_v1/spaceglenda.car diff --git a/storage/mater/tests/fixtures/car_v2/empty.car b/mater/lib/tests/fixtures/car_v2/empty.car similarity index 100% rename from storage/mater/tests/fixtures/car_v2/empty.car rename to mater/lib/tests/fixtures/car_v2/empty.car diff --git a/storage/mater/tests/fixtures/car_v2/lorem.car b/mater/lib/tests/fixtures/car_v2/lorem.car similarity index 100% rename from storage/mater/tests/fixtures/car_v2/lorem.car rename to mater/lib/tests/fixtures/car_v2/lorem.car diff --git a/storage/mater/tests/fixtures/car_v2/spaceglenda.car b/mater/lib/tests/fixtures/car_v2/spaceglenda.car similarity index 100% rename from storage/mater/tests/fixtures/car_v2/spaceglenda.car rename to mater/lib/tests/fixtures/car_v2/spaceglenda.car diff --git a/storage/mater/tests/fixtures/original/lorem.txt b/mater/lib/tests/fixtures/original/lorem.txt similarity index 100% rename from storage/mater/tests/fixtures/original/lorem.txt rename to mater/lib/tests/fixtures/original/lorem.txt diff --git a/storage/mater/tests/fixtures/original/lorem_1024.txt b/mater/lib/tests/fixtures/original/lorem_1024.txt similarity index 100% rename from storage/mater/tests/fixtures/original/lorem_1024.txt rename to mater/lib/tests/fixtures/original/lorem_1024.txt diff --git a/storage/mater/tests/fixtures/original/lorem_4096_dup.txt b/mater/lib/tests/fixtures/original/lorem_4096_dup.txt similarity index 100% rename from storage/mater/tests/fixtures/original/lorem_4096_dup.txt rename to mater/lib/tests/fixtures/original/lorem_4096_dup.txt diff --git a/storage/mater/tests/fixtures/original/spaceglenda.jpg b/mater/lib/tests/fixtures/original/spaceglenda.jpg similarity index 100% rename from storage/mater/tests/fixtures/original/spaceglenda.jpg rename to mater/lib/tests/fixtures/original/spaceglenda.jpg From 32971604b3d2c85b4ef224323400f3dc9e63bf26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20=C4=8Cerni=C4=8D?= Date: Mon, 25 Nov 2024 12:17:21 +0100 Subject: [PATCH 7/8] fix scale location --- Justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Justfile b/Justfile index 77c40b9f7..2ef05a00b 100644 --- a/Justfile +++ b/Justfile @@ -5,7 +5,7 @@ alias f := fmt # Generate the `metadata.scale` file, requires the node to be up and running at `127.0.0.1:42069` generate-scale: - subxt metadata -a --url http://127.0.0.1:42069 > storagext/artifacts/metadata.scale + subxt metadata -a --url http://127.0.0.1:42069 > storagext/lib/artifacts/metadata.scale # Lint the project lint: From 627b76b753f79218770761837ca863e6e070f8fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rok=20=C4=8Cerni=C4=8D?= Date: Mon, 25 Nov 2024 20:09:02 +0100 Subject: [PATCH 8/8] fix tests --- mater/cli/src/extract.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mater/cli/src/extract.rs b/mater/cli/src/extract.rs index 399e34fa3..bef6a2ff2 100644 --- a/mater/cli/src/extract.rs +++ b/mater/cli/src/extract.rs @@ -50,7 +50,7 @@ mod tests { async fn extract_file_success() -> Result<()> { // Setup input and output paths let temp_dir = tempdir()?; - let input_path = PathBuf::from("../mater/tests/fixtures/car_v2/lorem.car"); + let input_path = PathBuf::from("../lib/tests/fixtures/car_v2/lorem.car"); let output_path = temp_dir.path().join("output_file"); // Call the function under test @@ -59,7 +59,7 @@ mod tests { assert!(result.is_ok()); // extract original contents - let mut original = File::open("../mater/tests/fixtures/original/lorem.txt").await?; + let mut original = File::open("../lib/tests/fixtures/original/lorem.txt").await?; let mut original_contents = vec![]; original.read_to_end(&mut original_contents).await?; @@ -82,7 +82,7 @@ mod tests { async fn extract_file_success_empty_file() -> Result<()> { // Setup input and output paths let temp_dir = tempdir()?; - let input_path = PathBuf::from("../mater/tests/fixtures/car_v2/empty.car"); + let input_path = PathBuf::from("../lib/tests/fixtures/car_v2/empty.car"); let output_path = temp_dir.path().join("output_file"); // Call the function under test @@ -127,7 +127,7 @@ mod tests { #[tokio::test] async fn io_error_extract_output_path_exists() -> Result<()> { // Setup input and output paths - let input_path = PathBuf::from("../mater/tests/fixtures/car_v2/lorem.car"); + let input_path = PathBuf::from("../lib/tests/fixtures/car_v2/lorem.car"); let output_path = PathBuf::from("output_file"); // Create a file at ouput path