Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CU-22bc21g] Add remark check in CI #220

Merged
merged 5 commits into from
Jan 13, 2022
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
18 changes: 18 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -64,6 +68,20 @@ jobs:
echo ""
done < <(find . -name "Dockerfile")
exit $total_exit_code
- name: Remark
run: |
npm install yarn
./node_modules/.bin/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
andor0 marked this conversation as resolved.
Show resolved Hide resolved
./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
run: |
/home/runner/.cargo/bin/cargo clippy -- -D warnings
Expand Down
2 changes: 1 addition & 1 deletion .maintain/playbooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| Basilisk's collator #1 | wss://domain_of_vps:9903 |
20 changes: 20 additions & 0 deletions .remarkrc
Original file line number Diff line number Diff line change
@@ -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"
]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<p align="center">

# Composable Node
# Composable Node
<img alt="Composable Finance" title="Composable Finance" src="composable.png">
</p>

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


Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Setting up Composable
# Setting up Composable
6 changes: 3 additions & 3 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/rust-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion frame/assets-registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

## vNEXT

- support any assets to be added new via voting processes
- support any assets to be added new via voting processes
6 changes: 3 additions & 3 deletions frame/bonded-finance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
20 changes: 10 additions & 10 deletions frame/democracy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion frame/dutch-auction/research.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- Can be used without AMM if set AMM allowance to low percentage or disable on runtime
2 changes: 1 addition & 1 deletion frame/oracle/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Apollo
# Apollo
6 changes: 3 additions & 3 deletions frame/vault/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Root is capable of completely shutting down a vault, disallowing deposits and withdrawals. This is intended as a mitigation for hacks.
2 changes: 1 addition & 1 deletion integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion rfcs/0001-feature-gated-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Two of the above issues should be solved regardless of whether we are using develop branch or feature gate.
2 changes: 1 addition & 1 deletion rfcs/0002-rent-deposit.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
28 changes: 14 additions & 14 deletions sudo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -88,7 +88,7 @@ pub fn root_print(origin: OriginFor<T>) -> 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
Expand All @@ -113,14 +113,14 @@ fn powerfunction(origin: OriginFor<T>) {


### 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


8 changes: 4 additions & 4 deletions utils/price-feed/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.