From 98f19ec44cba155dcff1abbd83ed2d2fbe33f5e6 Mon Sep 17 00:00:00 2001 From: Gustavo Gonzalez Date: Tue, 5 Nov 2024 15:13:22 +0700 Subject: [PATCH] fix workflows and improve docs --- .github/workflows/check.yml | 5 +-- .github/workflows/test.yml | 2 +- procedural/src/lib.rs | 86 ++++++++++++++++++------------------- 3 files changed, 46 insertions(+), 47 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index db9716e..7fc0bb5 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -14,8 +14,8 @@ on: # If new code is pushed to a PR branch, then cancel in progress workflows for # that PR. Ensures that we don't waste CI time, and returns results quicker. concurrency: - group: ci-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true env: CARGO_TERM_COLOR: always @@ -77,4 +77,3 @@ jobs: uses: actions/checkout@v4 - name: Check spelling of files in the workspace uses: crate-ci/typos@v1.26.0 - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d29439..ebbbcdf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ on: # If new code is pushed to a PR branch, then cancel in progress workflows for # that PR. Ensures that we don't waste CI time, and returns results quicker. concurrency: - group: ci-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: diff --git a/procedural/src/lib.rs b/procedural/src/lib.rs index 1ff527b..9b204b1 100644 --- a/procedural/src/lib.rs +++ b/procedural/src/lib.rs @@ -6,10 +6,10 @@ mod models; mod runtime_apis; /// Construct runtime macro wrapper -/// This macro allows to construct runtime operating with abstractions as long as with pallets. -/// It allows you omit the pallet indexes -- they will be assigned in ascending order. -/// This API may change in future releases, it is not yet stabilised. -/// +/// This macro allows to construct your runtime using abstractions and/or vanilla pallets. +/// It allows you to omit the pallet indexes -- they will be assigned automatically in ascending order. +/// This macro is in very early stages of development, expect breaking changes. +/// /// Example: /// ``` /// #[openzeppelin_construct_runtime] @@ -20,9 +20,9 @@ mod runtime_apis; /// type Pallet = pallet_crate; // It mimics the second version of construct runtime macro, but without the pallet_index assignment /// } /// ``` -/// +/// /// Supported abstractions and pallets inside them: -/// * `System`: +/// * `System`: /// * `frame_system` /// * `pallet_timestamp` /// * `parachain_info` @@ -51,7 +51,7 @@ mod runtime_apis; /// * `pallet_whitelist` /// * `pallet_custom_origins` /// * `pallet_referenda` -/// * `XCM` +/// * `XCM` /// * `pallet_message_queue` /// * `cumulus_pallet_xcmp_queue` /// * `pallet_xcm` @@ -59,7 +59,7 @@ mod runtime_apis; /// * `pallet_xcm_weight_trader` /// * `orml_xtokens` /// * `pallet_xcm_transactor` -/// * `EVM` +/// * `EVM` /// * `pallet_ethereum` /// * `pallet_evm` /// * `pallet_base_fee` @@ -71,9 +71,9 @@ pub fn openzeppelin_construct_runtime(_: TokenStream, tokens: TokenStream) -> To } /// Runtime API macro wrapper -/// This macro wraps the `impl_runtime_api` macro and provides our implementations of them. +/// This macro wraps the `impl_runtime_api` macro and provides a simpler interface. /// It also works in the same groupings as our abstractions pallets and to get the runtime API implementations you only need to provide some types. -/// +/// /// Example: /// ``` /// #[openzeppelin_runtime_apis] @@ -81,48 +81,22 @@ pub fn openzeppelin_construct_runtime(_: TokenStream, tokens: TokenStream) -> To /// // these types should be present and required for all abstractions /// // runtime generated by construct_runtime /// type Runtime = Runtime; -/// // block type +/// // block type /// type Block = Block; -/// +/// /// #[abstraction] /// mod assets { /// type TransactionPayment = TransactionPayment; /// type RuntimeCall = RuntimeCall; /// type Balance = Balance; /// } -/// -/// // Any impl block can also go there, it will be ported to the `impl_runtime_api!` +/// +/// // Any impl block can also go here, it will be ported to the `impl_runtime_api!` /// } /// ``` -/// +/// /// Supported abstractions: -/// * `EVM` -/// * Implemented APIs: -/// * `fp_rpc::EthereumRuntimeRPCApi` -/// * `fp_rpc::ConvertTransactionRuntimeApi` -/// * Required Types: -/// * `RuntimeCall` -- runtime call generated by `construct_runtime` macro -/// * `Executive` -- `frame_executive::Executive` specification used by parachain system -/// * `Ethereum` -- `pallet_ethereum` pallet struct generated by `construct_runtime` macro -/// * `assets` -/// * Implemented APIs: -/// * `pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi` -/// * `pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi` -/// * Required Types: -/// * `TransactionPayment` -- `pallet_transaction_payment` struct pallet generated by `construct_runtime` macro -/// * `RuntimeCall` -- runtime call generated by `construct_runtime` macro -/// * `Balance` -- type used for balance specification (e.g. in `pallet_balances` config) -/// * `consensus` -/// * Implemented APIs: -/// * `sp_consensus_aura::AuraApi` -/// * `sp_session::SessionKeys` -/// * `cumulus_primitives_aura::AuraUnincludedSegmentApi` (if `async-backing` feature is enabled) -/// * Required Types: -/// * `SessionKeys` -- struct generated by `impl_opaque_keys` macro -/// * `Aura` -- `pallet_aura` struct pallet generated by `construct_runtime` macro (only if `async-backing` feature is not enabled) -/// * `SlotDuration` -- constant that is use for slot duration definition (only if `async-backing` feature is enabled) -/// * `ConsensusHook` -- type that is used in `cumulus_pallet_parachain_system::Config::ConsensusHook` (only if `async-backing` feature is enabled) -/// * `system` +/// * `System` /// * Implemented APIs: /// * `sp_api::Core` /// * `sp_api::Metadata` @@ -142,7 +116,33 @@ pub fn openzeppelin_construct_runtime(_: TokenStream, tokens: TokenStream) -> To /// * `Nonce` -- nonce type that was specified in `frame_system::Config` /// * `RuntimeGenesisConfig` -- type generated by `construct_runtime` macro. /// * `RuntimeBlockWeights` -- type implementing `Get`, often built by `BlockWeights::builder` -/// * `benchmarks` +/// * `Consensus` +/// * Implemented APIs: +/// * `sp_consensus_aura::AuraApi` +/// * `sp_session::SessionKeys` +/// * `cumulus_primitives_aura::AuraUnincludedSegmentApi` (if `async-backing` feature is enabled) +/// * Required Types: +/// * `SessionKeys` -- struct generated by `impl_opaque_keys` macro +/// * `Aura` -- `pallet_aura` struct pallet generated by `construct_runtime` macro (only if `async-backing` feature is not enabled) +/// * `SlotDuration` -- constant that is used for slot duration definition (only if `async-backing` feature is enabled) +/// * `ConsensusHook` -- type that is used in `cumulus_pallet_parachain_system::Config::ConsensusHook` (only if `async-backing` feature is enabled) +/// * `Assets` +/// * Implemented APIs: +/// * `pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi` +/// * `pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi` +/// * Required Types: +/// * `TransactionPayment` -- `pallet_transaction_payment` struct pallet generated by `construct_runtime` macro +/// * `RuntimeCall` -- runtime call generated by `construct_runtime` macro +/// * `Balance` -- type used for balance specification (e.g. in `pallet_balances` config) +/// * `EVM` +/// * Implemented APIs: +/// * `fp_rpc::EthereumRuntimeRPCApi` +/// * `fp_rpc::ConvertTransactionRuntimeApi` +/// * Required Types: +/// * `RuntimeCall` -- runtime call generated by `construct_runtime` macro +/// * `Executive` -- `frame_executive::Executive` specification used by parachain system +/// * `Ethereum` -- `pallet_ethereum` pallet struct generated by `construct_runtime` macro +/// * `Benchmarks` /// * Implemented APIs: /// * `frame_benchmarking::Benchmark` (under `runtime-benchmarks` feature) /// * Required Types: