diff --git a/CLAUDE.md b/CLAUDE.md index ebb9d692..a6cc41bf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -246,7 +246,7 @@ See [Project Structure](README.md#project-structure) in the root README for the **Primitives (`crates/primitives/storage/`)**: Shared types used across pallet, provider node, and client. -**Smart Contracts (`precompiles/`, `examples/contracts/`)**: `pallet_revive` (PolkaVM-based smart contracts) is wired into both runtimes. Two custom precompiles expose the client-side bucket lifecycle and drive registry to Solidity contracts. The `StorageMarketplace.sol` example shows how a dApp buys storage on behalf of its users; `just sc-demo` runs the end-to-end PAPI test. Full design in [docs/drafts/smart-contracts.md](docs/drafts/smart-contracts.md). +**Smart Contracts (`crates/pallets/*/precompiles/`, `examples/contracts/`)**: `pallet_revive` (PolkaVM-based smart contracts) is wired into both runtimes. Two custom precompiles expose the client-side bucket lifecycle and drive registry to Solidity contracts. The `StorageMarketplace.sol` example shows how a dApp buys storage on behalf of its users; `just sc-demo` runs the end-to-end PAPI test. Full design in [docs/drafts/smart-contracts.md](docs/drafts/smart-contracts.md). #### Layer 1 (File System Interface) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3240246d..fb788fc5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,7 +62,7 @@ This repository is dual-licensed. The license that applies depends on the crate: | License | Crates | |---------|--------| | [GPL-3.0-only](LICENSE-GPL3) | `runtimes/`, `provider-node/`, `user-interfaces/` | -| [Apache-2.0](LICENSE-APACHE2) | `crates/pallets/`, `crates/primitives/`, `client/`, `precompiles/`, `storage-interfaces/` | +| [Apache-2.0](LICENSE-APACHE2) | `crates/pallets/` (pallets and their precompiles), `crates/primitives/`, `client/`, `storage-interfaces/` | Each crate declares its applicable license in its `Cargo.toml` or `package.json`. diff --git a/Cargo.toml b/Cargo.toml index b4dd9134..83155008 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,9 +17,9 @@ members = [ "crates/primitives/storage", # Smart-contract precompiles (pallet_revive integration) - "precompiles/drive-registry-precompile", - "precompiles/s3-registry-precompile", - "precompiles/storage-provider-precompile", + "crates/pallets/drive-registry/precompiles", + "crates/pallets/s3-registry/precompiles", + "crates/pallets/storage-provider/precompiles", # Storage Interfaces: File System Interface "storage-interfaces/file-system/client", @@ -36,10 +36,10 @@ repository = "https://github.com/paritytech/web3-storage" [workspace.dependencies] # Layer 0: Scalable Web3 Storage (Internal crates) -pallet-drive-registry-precompile = { path = "precompiles/drive-registry-precompile", default-features = false } -pallet-s3-registry-precompile = { path = "precompiles/s3-registry-precompile", default-features = false } +pallet-drive-registry-precompile = { path = "crates/pallets/drive-registry/precompiles", default-features = false } +pallet-s3-registry-precompile = { path = "crates/pallets/s3-registry/precompiles", default-features = false } pallet-storage-provider = { path = "crates/pallets/storage-provider", default-features = false } -pallet-storage-provider-precompile = { path = "precompiles/storage-provider-precompile", default-features = false } +pallet-storage-provider-precompile = { path = "crates/pallets/storage-provider/precompiles", default-features = false } provider-negotiation = { path = "provider/negotiation" } storage-client = { path = "client" } storage-parachain-runtime = { path = "runtimes/web3-storage-local" } diff --git a/README.md b/README.md index 0cc08ef2..3916a280 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,7 @@ Two types of nodes work together: web3-storage/ ├── crates/ │ ├── pallets/ # FRAME pallets: storage-provider, drive-registry, s3-registry +│ │ # each with a precompiles/ subfolder (pallet_revive precompiles) │ ├── primitives/ # Shared types: storage, file-system, s3 │ └── storage-subxt/ # Static subxt runtime bindings ├── runtimes/ # Parachain runtimes: web3-storage-local, web3-storage-paseo @@ -201,7 +202,6 @@ web3-storage/ ├── provider/ # provider-negotiation: off-chain client<->provider wire protocol crate ├── client/ # Layer 0 Rust client SDK ├── storage-interfaces/ # Layer 1 interfaces: file-system, s3 -├── precompiles/ # pallet_revive precompiles: storage-provider, drive-registry, s3-registry ├── packages/ # JS/TS workspace: @web3-storage/{core,layer0,layer1,papi,sdk} ├── user-interfaces/ # Web apps: landing, drive-ui, provider, s3-ui, photos, shared ├── examples/ # contracts/ (Solidity dApps), papi/ (end-to-end PAPI demos) diff --git a/precompiles/drive-registry-precompile/Cargo.toml b/crates/pallets/drive-registry/precompiles/Cargo.toml similarity index 100% rename from precompiles/drive-registry-precompile/Cargo.toml rename to crates/pallets/drive-registry/precompiles/Cargo.toml diff --git a/precompiles/drive-registry-precompile/src/IDriveRegistry.sol b/crates/pallets/drive-registry/precompiles/src/interface/IDriveRegistry.sol similarity index 100% rename from precompiles/drive-registry-precompile/src/IDriveRegistry.sol rename to crates/pallets/drive-registry/precompiles/src/interface/IDriveRegistry.sol diff --git a/precompiles/drive-registry-precompile/src/lib.rs b/crates/pallets/drive-registry/precompiles/src/lib.rs similarity index 99% rename from precompiles/drive-registry-precompile/src/lib.rs rename to crates/pallets/drive-registry/precompiles/src/lib.rs index 12b654e8..58133994 100644 --- a/precompiles/drive-registry-precompile/src/lib.rs +++ b/crates/pallets/drive-registry/precompiles/src/lib.rs @@ -28,7 +28,7 @@ use pallet_storage_provider::BalanceOf; use storage_primitives::Role; use tracing::error; -alloy::sol!("src/IDriveRegistry.sol"); +alloy::sol!("src/interface/IDriveRegistry.sol"); use IDriveRegistry::IDriveRegistryCalls; const LOG_TARGET: &str = "web3-storage::drive-registry-precompile"; diff --git a/precompiles/s3-registry-precompile/Cargo.toml b/crates/pallets/s3-registry/precompiles/Cargo.toml similarity index 100% rename from precompiles/s3-registry-precompile/Cargo.toml rename to crates/pallets/s3-registry/precompiles/Cargo.toml diff --git a/precompiles/s3-registry-precompile/src/IS3Registry.sol b/crates/pallets/s3-registry/precompiles/src/interface/IS3Registry.sol similarity index 100% rename from precompiles/s3-registry-precompile/src/IS3Registry.sol rename to crates/pallets/s3-registry/precompiles/src/interface/IS3Registry.sol diff --git a/precompiles/s3-registry-precompile/src/lib.rs b/crates/pallets/s3-registry/precompiles/src/lib.rs similarity index 99% rename from precompiles/s3-registry-precompile/src/lib.rs rename to crates/pallets/s3-registry/precompiles/src/lib.rs index 14d925f6..d914bf80 100644 --- a/precompiles/s3-registry-precompile/src/lib.rs +++ b/crates/pallets/s3-registry/precompiles/src/lib.rs @@ -29,7 +29,7 @@ use pallet_storage_provider::BalanceOf; use sp_core::H256; use tracing::error; -alloy::sol!("src/IS3Registry.sol"); +alloy::sol!("src/interface/IS3Registry.sol"); use IS3Registry::IS3RegistryCalls; const LOG_TARGET: &str = "web3-storage::s3-registry-precompile"; diff --git a/precompiles/storage-provider-precompile/Cargo.toml b/crates/pallets/storage-provider/precompiles/Cargo.toml similarity index 100% rename from precompiles/storage-provider-precompile/Cargo.toml rename to crates/pallets/storage-provider/precompiles/Cargo.toml diff --git a/precompiles/storage-provider-precompile/src/IWeb3Storage.sol b/crates/pallets/storage-provider/precompiles/src/interface/IWeb3Storage.sol similarity index 100% rename from precompiles/storage-provider-precompile/src/IWeb3Storage.sol rename to crates/pallets/storage-provider/precompiles/src/interface/IWeb3Storage.sol diff --git a/precompiles/storage-provider-precompile/src/lib.rs b/crates/pallets/storage-provider/precompiles/src/lib.rs similarity index 99% rename from precompiles/storage-provider-precompile/src/lib.rs rename to crates/pallets/storage-provider/precompiles/src/lib.rs index dd9ed3e5..3a82ae5a 100644 --- a/precompiles/storage-provider-precompile/src/lib.rs +++ b/crates/pallets/storage-provider/precompiles/src/lib.rs @@ -29,7 +29,7 @@ use pallet_storage_provider::{BalanceOf, WeightInfo}; use storage_primitives::{BucketId, EndAction, Role}; use tracing::error; -alloy::sol!("src/IWeb3Storage.sol"); +alloy::sol!("src/interface/IWeb3Storage.sol"); use IWeb3Storage::IWeb3StorageCalls; const LOG_TARGET: &str = "web3-storage::precompile"; diff --git a/docs/drafts/smart-contracts.md b/docs/drafts/smart-contracts.md index 6b6bacf4..279b8c2b 100644 --- a/docs/drafts/smart-contracts.md +++ b/docs/drafts/smart-contracts.md @@ -24,9 +24,9 @@ The contract's caller is computed by `AccountId32Mapper` (substrate-native, iden | Address | Matcher | Crate | Pallet | | --------------------------------------------- | ----------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------- | -| `0x0000000000000000000000000000000009010000` | `Fixed(0x0901)` | [`pallet-storage-provider-precompile`](../../precompiles/storage-provider-precompile) | `pallet_storage_provider` | -| `0x0000000000000000000000000000000009020000` | `Fixed(0x0902)` | [`pallet-drive-registry-precompile`](../../precompiles/drive-registry-precompile) | `pallet_drive_registry` | -| `0x0000000000000000000000000000000009030000` | `Fixed(0x0903)` | [`pallet-s3-registry-precompile`](../../precompiles/s3-registry-precompile) | `pallet_s3_registry` | +| `0x0000000000000000000000000000000009010000` | `Fixed(0x0901)` | [`pallet-storage-provider-precompile`](../../crates/pallets/storage-provider/precompiles) | `pallet_storage_provider` | +| `0x0000000000000000000000000000000009020000` | `Fixed(0x0902)` | [`pallet-drive-registry-precompile`](../../crates/pallets/drive-registry/precompiles) | `pallet_drive_registry` | +| `0x0000000000000000000000000000000009030000` | `Fixed(0x0903)` | [`pallet-s3-registry-precompile`](../../crates/pallets/s3-registry/precompiles) | `pallet_s3_registry` | Both use `HAS_CONTRACT_INFO = false` (no storage deposits or contract metadata; pure stateless dispatch). diff --git a/examples/contracts/README.md b/examples/contracts/README.md index 31f41c6e..b9fec874 100644 --- a/examples/contracts/README.md +++ b/examples/contracts/README.md @@ -27,7 +27,7 @@ The exact pinned versions live in `.github/env` and are installed identically in | File | Purpose | |-------------------------|----------------------------------------------------------| -| `IWeb3Storage.sol` | Vendored ABI of the precompile (kept in sync with `precompiles/storage-provider-precompile/src/IWeb3Storage.sol`). | +| `IWeb3Storage.sol` | Vendored ABI of the precompile (kept in sync with `crates/pallets/storage-provider/precompiles/src/interface/IWeb3Storage.sol`). | | `StorageMarketplace.sol`| Marketplace contract: `buyStorage` / `endMyAgreement`. | | `build.sh` | One-shot compile script. | diff --git a/licenserc.apache.toml b/licenserc.apache.toml index 7b21f61b..e82bb58b 100644 --- a/licenserc.apache.toml +++ b/licenserc.apache.toml @@ -8,14 +8,13 @@ keywords = ["SPDX-License-Identifier"] includes = [ "client/**/*.rs", "crates/pallets/**/*.rs", + "crates/pallets/**/*.sol", "crates/primitives/**/*.rs", "examples/contracts/**/*.sol", "examples/papi/**/*.ts", "packages/**/*.js", "packages/**/*.ts", "packages/**/*.tsx", - "precompiles/**/*.rs", - "precompiles/**/*.sol", "provider/**/*.rs", "storage-interfaces/**/*.rs", "user-interfaces/photos/contracts/**/*.sol",