Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ 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
├── provider-node/ # Off-chain HTTP storage server
├── 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see there is also possibility to write the interface directly to the rs file alloy::sol! {, not sure which one is better

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I remember that I tried several approaches, and Cisco's Photo App PRs also mentioned this issue before. It seems to be due to revive's poor support for this

use IDriveRegistry::IDriveRegistryCalls;

const LOG_TARGET: &str = "web3-storage::drive-registry-precompile";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
6 changes: 3 additions & 3 deletions docs/drafts/smart-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
2 changes: 1 addition & 1 deletion examples/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |

Expand Down
3 changes: 1 addition & 2 deletions licenserc.apache.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading