From a7f78c52c5a4655566d513b5439443cfd23509a7 Mon Sep 17 00:00:00 2001 From: Andrey Orlov Date: Fri, 22 Oct 2021 20:17:57 +0400 Subject: [PATCH 1/4] Add remark check in CI --- .github/workflows/check.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e580570f264..cdd1777669d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -63,6 +63,36 @@ jobs: echo "" done < <(find . -name "Dockerfile") exit $total_exit_code + - name: Remark + run: | + yarn add remark-cli \ + remark-lint-mdash-style \ + https://github.com/typeable/remark-validate-links#anchors \ + remark-preset-lint-recommended \ + remark-lint-no-dead-urls + + total_exit_code=0 + while IFS= read -r file; do + yarn run remark -f \ + -u validate-links \ + -u remark-lint-mdash-style \ + -u remark-lint-final-newline \ + -u remark-lint-list-item-bullet-indent \ + -u remark-lint-no-blockquote-without-marker \ + -u remark-lint-ordered-list-marker-style \ + -u remark-lint-no-literal-urls \ + -u remark-lint-hard-break-spaces \ + -u remark-lint-no-duplicate-definitions \ + -u remark-lint-no-heading-content-indent \ + -u remark-lint-no-inline-padding \ + -u remark-lint-no-shortcut-reference-image \ + -u remark-lint-no-shortcut-reference-link \ + -u remark-lint-no-undefined-references \ + -u remark-lint-no-unused-definitions \ + -u remark-lint-no-dead-urls \ + $file || total_exit_code=$? + done < <(find . -name "*.md" -not -path "*/node_modules/*" -not -path "./.github/*") + exit $total_exit_code - name: Cargo clippy run: | SKIP_WASM_BUILD=1 cargo clippy -- -D warnings From 1ea9f16eb60ba5b808128b5412e210d448dc377c Mon Sep 17 00:00:00 2001 From: Andrey Orlov Date: Tue, 26 Oct 2021 01:02:29 +0400 Subject: [PATCH 2/4] Add a config file for remark --- .github/workflows/check.yml | 24 +++++------------------- .remarkrc | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 .remarkrc diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index cdd1777669d..a1e5d7fbf53 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -65,7 +65,10 @@ jobs: exit $total_exit_code - name: Remark run: | - yarn add remark-cli \ + npm install yarn + ./node_modules/.bin/yarn --version + ./node_modules/.bin/yarn --help + ./node_modules/.bin/yarn add remark-cli \ remark-lint-mdash-style \ https://github.com/typeable/remark-validate-links#anchors \ remark-preset-lint-recommended \ @@ -73,24 +76,7 @@ jobs: total_exit_code=0 while IFS= read -r file; do - yarn run remark -f \ - -u validate-links \ - -u remark-lint-mdash-style \ - -u remark-lint-final-newline \ - -u remark-lint-list-item-bullet-indent \ - -u remark-lint-no-blockquote-without-marker \ - -u remark-lint-ordered-list-marker-style \ - -u remark-lint-no-literal-urls \ - -u remark-lint-hard-break-spaces \ - -u remark-lint-no-duplicate-definitions \ - -u remark-lint-no-heading-content-indent \ - -u remark-lint-no-inline-padding \ - -u remark-lint-no-shortcut-reference-image \ - -u remark-lint-no-shortcut-reference-link \ - -u remark-lint-no-undefined-references \ - -u remark-lint-no-unused-definitions \ - -u remark-lint-no-dead-urls \ - $file || total_exit_code=$? + yarn run remark -f $file || total_exit_code=$? done < <(find . -name "*.md" -not -path "*/node_modules/*" -not -path "./.github/*") exit $total_exit_code - name: Cargo clippy diff --git a/.remarkrc b/.remarkrc new file mode 100644 index 00000000000..d99d19893ce --- /dev/null +++ b/.remarkrc @@ -0,0 +1,20 @@ +{ + "plugins": [ + "validate-links", + "remark-lint-mdash-style", + "remark-lint-final-newline", + "remark-lint-list-item-bullet-indent", + "remark-lint-no-blockquote-without-marker", + "remark-lint-ordered-list-marker-style", + "remark-lint-no-literal-urls", + "remark-lint-hard-break-spaces", + "remark-lint-no-duplicate-definitions", + "remark-lint-no-heading-content-indent", + "remark-lint-no-inline-padding", + "remark-lint-no-shortcut-reference-image", + "remark-lint-no-shortcut-reference-link", + "remark-lint-no-undefined-references", + "remark-lint-no-unused-definitions", + "remark-lint-no-dead-urls" + ] +} From 388ffc754d163e3664bd93d171ac8566e827f16f Mon Sep 17 00:00:00 2001 From: Andrey Orlov Date: Thu, 13 Jan 2022 13:58:16 +0400 Subject: [PATCH 3/4] Update config of CI --- .github/workflows/check.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e1db99ae3e0..7f434611e7b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -47,6 +47,10 @@ jobs: /home/runner/.cargo/bin/rustup show /home/runner/.cargo/bin/rustup override unset /home/runner/.cargo/bin/rustup show + - name: Use Node.js 14.x + uses: actions/setup-node@v2 + with: + node-version: 14.x - name: Cargo fmt run: | /home/runner/.cargo/bin/cargo fmt -- --check @@ -67,8 +71,6 @@ jobs: - name: Remark run: | npm install yarn - ./node_modules/.bin/yarn --version - ./node_modules/.bin/yarn --help ./node_modules/.bin/yarn add remark-cli \ remark-lint-mdash-style \ https://github.com/typeable/remark-validate-links#anchors \ @@ -77,7 +79,7 @@ jobs: total_exit_code=0 while IFS= read -r file; do - yarn run remark -f $file || total_exit_code=$? + ./node_modules/.bin/remark -f $file || total_exit_code=$? done < <(find . -name "*.md" -not -path "*/node_modules/*" -not -path "./.github/*") exit $total_exit_code - name: Cargo clippy From 45dbbb345b31d4a76ce4bb484cefa51269297779 Mon Sep 17 00:00:00 2001 From: Andrey Orlov Date: Thu, 13 Jan 2022 15:25:09 +0400 Subject: [PATCH 4/4] Make remark happier --- .maintain/playbooks/README.md | 2 +- README.md | 4 ++-- SECURITY.md | 2 +- docker/README.md | 2 +- docs/CONTRIBUTING.md | 6 +++--- docs/rust-setup.md | 2 +- frame/assets-registry/README.md | 2 +- frame/bonded-finance/README.md | 6 +++--- frame/democracy/README.md | 20 ++++++++++---------- frame/dutch-auction/research.md | 2 +- frame/oracle/README.md | 2 +- frame/vault/README.md | 6 +++--- integration-tests/README.md | 2 +- rfcs/0001-feature-gated-runtime.md | 2 +- rfcs/0002-rent-deposit.md | 2 +- sudo.md | 28 ++++++++++++++-------------- utils/price-feed/README.md | 8 ++++---- 17 files changed, 49 insertions(+), 49 deletions(-) diff --git a/.maintain/playbooks/README.md b/.maintain/playbooks/README.md index b9da8804d56..3ed6e25d9b7 100644 --- a/.maintain/playbooks/README.md +++ b/.maintain/playbooks/README.md @@ -27,4 +27,4 @@ This playbook does next: |:-------------------------|:------------------------:| | Relay Chain #1 | wss://domain_of_vps:9901 | | Composable's collator #1 | wss://domain_of_vps:9902 | -| Basilisk's collator #1 | wss://domain_of_vps:9903 | \ No newline at end of file +| Basilisk's collator #1 | wss://domain_of_vps:9903 | diff --git a/README.md b/README.md index 286a86e60c5..a967484dd38 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

-# Composable Node +# Composable Node Composable Finance

@@ -44,7 +44,7 @@ In order to do so, install [yarn](https://classic.yarnpkg.com/lang/en/docs/insta ## Pallets Picasso ships with multiple custom made pallets such as: -[Cubic Vault](frame/vault/README.md) +[Cubic Vault](frame/vault/README.md) [Apollo](frame/oracle/README.md) and several others you can find in the frame folder. diff --git a/SECURITY.md b/SECURITY.md index f00670f1777..47fe4913a84 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -25,7 +25,7 @@ In return, we ask you to not publicly disclose your findings until either 2 week ## Scope: -What is currently in scope is finding bugs in a our code base running in a local enviroment. +What is currently in scope is finding bugs in a our code base running in a local enviroment. *Exploiting production systems are stricly prohibited* diff --git a/docker/README.md b/docker/README.md index 9e280051aae..bb532c320ac 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1 +1 @@ -# Setting up Composable \ No newline at end of file +# Setting up Composable diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index da9f0918a12..a514bb30fa7 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -4,9 +4,9 @@ We have a few guidelines and requirements to ensure correct workflows are follow ## First Things First Before contributing, go through the documentation found in `~/docs/`. Specifically: -* [rust-setup.md](./rust-setup.md) - A walkthrough for installing and configuring Rust and other tools in your develop ment environment -* [proptest.md](./proptest.md) - A guide to our approach and philosophy for automated testing -* [benchmarking.md](./benchmarking.md) - A guide for benchmarking pallet changes +* [rust-setup.md](./rust-setup.md) ― A walkthrough for installing and configuring Rust and other tools in your develop ment environment +* [proptest.md](./proptest.md) ― A guide to our approach and philosophy for automated testing +* [benchmarking.md](./benchmarking.md) ― A guide for benchmarking pallet changes ## Workflow When contributing code changes, follow this general process to ensure the CI pipeline processes code and that your work is accessible via ClickUp. diff --git a/docs/rust-setup.md b/docs/rust-setup.md index 34f6e43e7f0..87b207552f3 100644 --- a/docs/rust-setup.md +++ b/docs/rust-setup.md @@ -5,7 +5,7 @@ title: Installation This page will guide you through the steps needed to prepare a computer for development with the Substrate Node Template. Since Substrate is built with [the Rust programming language](https://www.rust-lang.org/), the first thing you will need to do is -prepare the computer for Rust development - these steps will vary based on the computer's operating +prepare the computer for Rust development ― these steps will vary based on the computer's operating system. Once Rust is configured, you will use its toolchains to interact with Rust projects; the commands for Rust's toolchains will be the same for all supported, Unix-based operating systems. diff --git a/frame/assets-registry/README.md b/frame/assets-registry/README.md index 5e8768299de..c27ca76f1f7 100644 --- a/frame/assets-registry/README.md +++ b/frame/assets-registry/README.md @@ -15,4 +15,4 @@ ## vNEXT -- support any assets to be added new via voting processes \ No newline at end of file +- support any assets to be added new via voting processes diff --git a/frame/bonded-finance/README.md b/frame/bonded-finance/README.md index 0c985b6dae5..84f237d5feb 100644 --- a/frame/bonded-finance/README.md +++ b/frame/bonded-finance/README.md @@ -10,8 +10,8 @@ This pallet implements the `BondedFinance` trait from `composable-traits`. ## Dispatchable Functions -- `offer` - Register a new bond offer, allowing use to later bond it. -- `bond` - Bond to an offer, the user should provide the number of contracts a user is willing +- `offer` ― Register a new bond offer, allowing use to later bond it. +- `bond` ― Bond to an offer, the user should provide the number of contracts a user is willing to buy. On offer completion (a.k.a. no more contract on the offer), the `stake` put by the creator is refunded. -- `cancel_offer` - Cancel a running offer, blocking further bond but not cancelling the +- `cancel_offer` ― Cancel a running offer, blocking further bond but not cancelling the currently vested rewards. The `stake` put by the creator is refunded. diff --git a/frame/democracy/README.md b/frame/democracy/README.md index 7948b6360ea..815443be364 100644 --- a/frame/democracy/README.md +++ b/frame/democracy/README.md @@ -18,22 +18,22 @@ a signed extrinsic. Basic actions with changes: -- `propose` - Submits a sensitive action in a preferred currency(token), represented as a hash. Requires a deposit in native currency(token). -- `second` - Signals agreement with a proposal, moves it higher on the proposal queue, and requires a matching deposit in native currency(token) to the original. -- `vote` - Votes in a referendum with preferred currency(token), either the vote is "Aye" to enact the proposal or "Nay" to keep the status quo. +- `propose` ― Submits a sensitive action in a preferred currency(token), represented as a hash. Requires a deposit in native currency(token). +- `second` ― Signals agreement with a proposal, moves it higher on the proposal queue, and requires a matching deposit in native currency(token) to the original. +- `vote` ― Votes in a referendum with preferred currency(token), either the vote is "Aye" to enact the proposal or "Nay" to keep the status quo. Administration actions that can be done to any account: -- `reap_vote` - Remove some account's expired votes. -- `unlock` - Redetermine the account's balance lock, potentially making tokens available. +- `reap_vote` ― Remove some account's expired votes. +- `unlock` ― Redetermine the account's balance lock, potentially making tokens available. Preimage actions: -- `note_preimage` - Registers the preimage for an upcoming proposal, requires +- `note_preimage` ― Registers the preimage for an upcoming proposal, requires a deposit that is returned once the proposal is enacted. -- `note_preimage_operational` - same but provided by `T::OperationalPreimageOrigin`. -- `note_imminent_preimage` - Registers the preimage for an upcoming proposal. +- `note_preimage_operational` ― same but provided by `T::OperationalPreimageOrigin`. +- `note_imminent_preimage` ― Registers the preimage for an upcoming proposal. Does not require a deposit, but the proposal must be in the dispatch queue. -- `note_imminent_preimage_operational` - same but provided by `T::OperationalPreimageOrigin`. -- `reap_preimage` - Removes the preimage for an expired proposal. Will only +- `note_imminent_preimage_operational` ― same but provided by `T::OperationalPreimageOrigin`. +- `reap_preimage` ― Removes the preimage for an expired proposal. Will only work under the condition that it's the same account that noted it and after the voting period, OR it's a different account after the enactment period. diff --git a/frame/dutch-auction/research.md b/frame/dutch-auction/research.md index 01ed741b0a0..57595f8a0fe 100644 --- a/frame/dutch-auction/research.md +++ b/frame/dutch-auction/research.md @@ -20,4 +20,4 @@ https://github.com/galacticcouncil/Basilisk-node/tree/master/pallets/exchange - Each block cleaned, so no data retained in block about intentions - If exact matches found, than sell via OB - If not exact found, sell remaining on AMM -- Can be used without AMM if set AMM allowance to low percentage or disable on runtime \ No newline at end of file +- Can be used without AMM if set AMM allowance to low percentage or disable on runtime diff --git a/frame/oracle/README.md b/frame/oracle/README.md index 845aec91d61..ac0f4cac9e3 100644 --- a/frame/oracle/README.md +++ b/frame/oracle/README.md @@ -1 +1 @@ -# Apollo \ No newline at end of file +# Apollo diff --git a/frame/vault/README.md b/frame/vault/README.md index 5034dafa223..71afe5496c0 100644 --- a/frame/vault/README.md +++ b/frame/vault/README.md @@ -13,7 +13,7 @@ with a fixed supply, including: * Strategy Re-balancing. * Surcharge Claims and Rent. -To use it in your runtime, you need to implement the vault's [`Config`]. +To use it in your runtime, you need to implement the vault's [`Config`](crate::Config). ## Concepts @@ -27,8 +27,8 @@ To use it in your runtime, you need to implement the vault's [`Config`]. ## Reusing the Vault -Pallets depending on the vault should use the [vault](composable_traits::vault) traits. When managing the reaping and deposits is too difficult due to the creation of many vaults, or prohibitively expensive; create the vault with an existential deposit. You should ensure that you delete the vault yourself once it is no longer required. +Pallets depending on the vault should use the [vault](composable-traits::vault) traits. When managing the reaping and deposits is too difficult due to the creation of many vaults, or prohibitively expensive; create the vault with an existential deposit. You should ensure that you delete the vault yourself once it is no longer required. ## Emergency Shutdown -Root is capable of completely shutting down a vault, disallowing deposits and withdrawals. This is intended as a mitigation for hacks. \ No newline at end of file +Root is capable of completely shutting down a vault, disallowing deposits and withdrawals. This is intended as a mitigation for hacks. diff --git a/integration-tests/README.md b/integration-tests/README.md index f7f5d82550d..678d7100926 100644 --- a/integration-tests/README.md +++ b/integration-tests/README.md @@ -79,7 +79,7 @@ hydra_xcm_executor -> hydra_assets: Dispatch to call relevant pallet for accepti - https://medium.com/polkadot-network/xcm-part-ii-versioning-and-compatibility-b313fc257b83 - https://medium.com/polkadot-network/xcm-part-iii-execution-and-error-management-ceb8155dd166 -- [xcmp format]:https://github.com/paritytech/xcm-format/blob/master/README.md +- https://github.com/paritytech/xcm-format/blob/master/README.md - https://research.web3.foundation/en/latest/polkadot/XCMP/index.html - https://medium.com/polkadot-network/xcm-the-cross-consensus-message-format-3b77b1373392 diff --git a/rfcs/0001-feature-gated-runtime.md b/rfcs/0001-feature-gated-runtime.md index f4cfe8c6928..b79abc1843d 100644 --- a/rfcs/0001-feature-gated-runtime.md +++ b/rfcs/0001-feature-gated-runtime.md @@ -58,4 +58,4 @@ Using develop branch is an attempted alternative to go forward. I see next probl - Versioning conditional blocks of code inside pallets. - https://github.com/paritytech/substrate/issues/10286 -Two of the above issues should be solved regardless of whether we are using develop branch or feature gate. \ No newline at end of file +Two of the above issues should be solved regardless of whether we are using develop branch or feature gate. diff --git a/rfcs/0002-rent-deposit.md b/rfcs/0002-rent-deposit.md index f8b525ba76b..f8e2f9c6015 100644 --- a/rfcs/0002-rent-deposit.md +++ b/rfcs/0002-rent-deposit.md @@ -49,7 +49,7 @@ So protecting storage is more important than CPU, as CPU attacks are only transi Another one is pefromance and polluting shared search lists. Example, are long list of token pairs to choose DEX pool. -## Forms paying - Rent/Deposit/Stake +## Forms paying ― Rent/Deposit/Stake Slashable stake. Until slashed and unlike rent, returned fully to staker during deletion. diff --git a/sudo.md b/sudo.md index 7acb6dde7d5..c42c38683b9 100644 --- a/sudo.md +++ b/sudo.md @@ -4,7 +4,7 @@ Substrate allows us to easily make privileged calls and actions with the built-i *ensure_root(origin);* -Thanks to these functions, we are able to perform privledged calls from various accounts. Such as +Thanks to these functions, we are able to perform privledged calls from various accounts. Such as upgrading the current blockchain. Only accounts that has the correct keys can execute functions that only allow Root origin to call them, meaning normal accounts can not execute them. @@ -31,7 +31,7 @@ Checking privledges of the origin with substrate: ## Examples: -In order to use ensure_root we need to store the account key that is allowed to use +In order to use ensure_root we need to store the account key that is allowed to use the privileged functions and then execute the ensure_root command. ```rust @@ -56,8 +56,8 @@ decl_module! { ... ``` -In this example, we create a privileged function and gives the sender/caller/origin root -privledges using the *ensure_root(origin)* function. Then we give the origin a reward of 1337 units. +In this example, we create a privileged function and gives the sender/caller/origin root +privledges using the *ensure_root(origin)* function. Then we give the origin a reward of 1337 units. Or if we want to write write functions that modify the heap(the programs allocated memory) we can do that: @@ -88,7 +88,7 @@ pub fn root_print(origin: OriginFor) -> DispatchResult { // Let's create a ``` ## Protecting sudo functions -In order to write safe functions that can execute privledged functions such as upgrading +In order to write safe functions that can execute privledged functions such as upgrading our chain, we want to add a check, that verifies that the person using the function is allowed to do so. This we can do with the *ensure_signed*(and scream if it fails) function from the frame_system library. We can simply do this by using the ensured_signed function then check the key and throw an error with @@ -113,14 +113,14 @@ fn powerfunction(origin: OriginFor) { ### References: -https://substrate.dev/rustdocs/v3.0.0/frame_system/struct.EnsureRoot.html -https://substrate.dev/rustdocs/v3.0.0/frame_system/struct.EnsureSigned.html -https://github.com/paritytech/substrate/blob/master/frame/support/src/traits/dispatch.rs#L24 -https://github.com/ComposableFi/composable-node-beta/blob/main/pallets/oracle/src/lib.rs#L276 -https://github.com/ComposableFi/composable-node-beta/blob/oracle/runtime/src/lib.rs#L312 -https://www.shawntabrizi.com/substrate/the-sudo-story-in-substrate/ -https://substrate.dev/docs/en/knowledgebase/runtime/origin -https://substrate.dev/docs/en/tutorials/forkless-upgrade/sudo-upgrade -https://github.com/paritytech/substrate/tree/master/frame/sudo +https://substrate.dev/rustdocs/v3.0.0/frame_system/struct.EnsureRoot.html +https://substrate.dev/rustdocs/v3.0.0/frame_system/struct.EnsureSigned.html +https://github.com/paritytech/substrate/blob/master/frame/support/src/traits/dispatch.rs#L24 +https://github.com/ComposableFi/composable-node-beta/blob/main/pallets/oracle/src/lib.rs#L276 +https://github.com/ComposableFi/composable-node-beta/blob/oracle/runtime/src/lib.rs#L312 +https://www.shawntabrizi.com/substrate/the-sudo-story-in-substrate/ +https://substrate.dev/docs/en/knowledgebase/runtime/origin +https://substrate.dev/docs/en/tutorials/forkless-upgrade/sudo-upgrade +https://github.com/paritytech/substrate/tree/master/frame/sudo diff --git a/utils/price-feed/README.md b/utils/price-feed/README.md index 569bf4c1b22..271133defc9 100644 --- a/utils/price-feed/README.md +++ b/utils/price-feed/README.md @@ -9,10 +9,10 @@ The server has a hardcoded map (u8 => Asset) to represent this ID. 1. Run an instance of the composable node. 2. ONLY IF PYTH IS USED: Run `pythd` along with `pyth_tx` using the provided nix script: - - Open a new terminal and run `nix-shell run_pyth.nix`. - - A bash function `run` is now available to start `pythd/pyth_tx`. - - Whenever you exit the terminal after having ran the `run` function, the two instances are going to be shutdown. - - You have accesss to both `pythd/pyth_tx` logs by using $PYTHD_LOG and $PYTH_TX_LOG. +- Open a new terminal and run `nix-shell run_pyth.nix`. +- A bash function `run` is now available to start `pythd/pyth_tx`. +- Whenever you exit the terminal after having ran the `run` function, the two instances are going to be shutdown. +- You have accesss to both `pythd/pyth_tx` logs by using $PYTHD_LOG and $PYTH_TX_LOG. 3. Run the price server, assuming you are running `RUST_LOG=info cargo run --bin price-feed` ![img not found](images/normal_run.png). 4. Go on your local [substrate panel](https://polkadot.js.org/apps) and add a new asset, make sure to use the unique index of an `asset_id` which is located in `asset.rs` 5. Trigger a price request for each `asset_id` you created and watch the oracle state machine progress.