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

Add quality checks to the makefile #1556

Merged
merged 5 commits into from
Jan 27, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/config/markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"commands-show-output": false,
"no-bare-urls": true,
"no-inline-html": false,
"no-hard-tabs": false,
}
"no-hard-tabs": false
}
23 changes: 20 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
all: names codes references
# Set default to run all checks if none specified
.DEFAULT_GOAL := all

all: spellcheck markdownlint names codes links references

# Check that all the specifications are named appropriately
.PHONY: names
names:
npx @vegaprotocol/approbation check-filenames

# Count how many Acceptance Criteria each specification has
.PHONY: codes
codes:
npx @vegaprotocol/approbation check-codes

# Which Acceptance Criteria are referenced in which feature files?
.PHONY: references
references:
npx @vegaprotocol/approbation check-references

# Imperfect, but useful - hence not included in ALL
.PHONY: links
links:
npx markdown-link-check protocol/*.md
npx markdown-link-check non-protocol-specs/*.md
npx --yes markdown-link-check protocol/*.md
npx --yes markdown-link-check non-protocol-specs/*.md

# check the markdown formatting (/protocol specs only at this time)
.PHONY: markdownlint
markdownlint:
@./markdownlint.sh

# check the markdown spelling (/protocol specs only at this time)
.PHONY: spellcheck
spellcheck:
@./spellcheck.sh
9 changes: 9 additions & 0 deletions markdownlint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -x

echo "Installing markdownlint-cli..."

npm install -g markdownlint-cli --yes

echo "Running markdownlint-cli..."

markdownlint --ignore-path .github/workflows/config/markdownlintignore --config .github/workflows/config/markdownlint.json .
2 changes: 1 addition & 1 deletion protocol/0057-TRAN-transfers.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Note: if there is no market with contribution to the reward metric - no transfer

A fee is taken from all transfers, and paid out to validators in a similar manner to the existing [infrastructure fees](0059-simple-POS-rewards.md). For recurring transfers, the fee is charged each time the transfer occurs.

The fee is set by the `transfer.fee.factor` [network parameter](#network-parameter) that defines the proportion of each transfer taken as a fee.
The fee is set by the `transfer.fee.factor` [network parameter](#network-parameters) that defines the proportion of each transfer taken as a fee.
The fee is taken from the transfer initiator's account immediately on execution, and is taken on top of the total amount transferred.
It is [paid in to the infrastructure fee pool](./0029-fees.md#collecting-and-distributing-fees).
Fees are charged in the asset that is being transferred.
Expand Down
4 changes: 1 addition & 3 deletions protocol/0062-SPAM-spam_protection.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ max_transfer_commands_per_epoch = 20 // maximal amount of internal asset transf
max_batch_size = 15 // maximal number of transactions allowed in one batch; this is the maximum size of a batch
```

(for consistency reasons, the prevailing source for all parameter values is the code file in
https:/vegaprotocol/vega/blob/develop/core/netparams/defaults.go
. In case of differences, the information in that file is the valid one).
(for consistency reasons, the prevailing source for all parameter values is the [defaults](https:/vegaprotocol/vega/blob/develop/core/netparams/defaults.go)code file. In case of differences, the information in that file is the valid one).

- Any tokenholder with more than `min_voting_tokens` tokens on a public key has `num_votes` voting attempts per epoch and proposal, i.e., they can change their mind `num_votes-1` times in one epoch. This means a transaction is pre-block rejected if there are `num_votes` or more on the same proposal in the blockchain in the same epoch, and post_block rejected if there are `num_votes` or more on the same proposal in the blockchain plus earlier in the current block.
- Any tokenholder that had more than 50% of its governance transactions post-rejected is banned for max (30 seconds, 1/48 of an epoch) or until the next epoch starts, and all of its governance related transactions (but no trading related transactions) are immediately rejected. E.g., if the epoch duration is 1 day, then the ban period is 30 minutes. If however the epoch is 10 seconds, then the ban period is 30 seconds (or until the start of the next epoch). The test for 50% of the governance transactions is repeated once the next governance related transaction is post-rejected, so it is possible for a violating party to get banned quite quickly again; the test is only done in case of a new post-rejection, so the account does not get banned twice just because the 50% quota is still exceeded when the ban ends. The voting counters are unaffected by the ban, so voting again on a proposal that already had the full number of votes in the epoch will lead to a rejection of the new vote; this is now unlikely to trigger a new ban, as this rejection will happen pre-consensus, and thus not affect the 50% rule.
Expand Down
4 changes: 2 additions & 2 deletions protocol/0069-VCBS-validators_chosen_by_stake.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,13 @@ See [limited network life spec](./0073-LIMN-limited_network_life.md).
- 2 validators drop below `ownstake`, but have relative high delegated stake (7000)
- 1 validator drops to the lowest delegated stake (1000)
- 1 ersatz validator has 6000 stake and sufficient `ownstake`
- the pending validator has sufficiemt 'ownstake'
- the pending validator has sufficient `ownstake`
- Verify that the the first ersatz validator is removed (marked as pending in the epoch change and then removed due to continuous insufficient `ownstake`), and one validator with insufficient `ownstake` is replaced by the other ersatz validator.
1. Setup a network with 6 nodes (3 validators, 2 ersatz validators, 1 pending validator). In one epoch,
- 1 validator drops below `ownstake`, but has relative high delegated stake (7000)
- 2 validators drop to the lowest delegated stake (1000 and 1500, respectively)
- 2 ersatz validators have 6000 stake and sufficient `ownstake`
- the pending validator has sufficient 'ownstake'
- the pending validator has sufficient `ownstake`
- Verify that at the epoch change, the validator with insufficient `ownstake` is replaced; in the next epoch, the second validator with the lowest score is replaced, and the validator that was demoted to ersatz validator due to insufficient `ownstake` is removed (stops being listed as an ersatz validator).
- Verify that the validator that dropped below `ownstake` is not demoted and removed at the same epoch change.
1. Setup a network with 5 nodes (3 validators, 2 ersatz validators). In one epoch,
Expand Down
13 changes: 13 additions & 0 deletions spellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash -x

echo "Installing pyspelling..."

pip3 install pyspelling

echo "Installing aspell..."

brew install aspell

echo "Running the spell checker..."

pyspelling --config spellcheck.yaml
27 changes: 0 additions & 27 deletions spellcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,3 @@ matrix:
- api-ref-button
- code
- pre

- name: Python
sources:
- "scripts/*.py"
default_encoding: utf-8
aspell:
d: en_GB
lang: en
dictionary:
encoding: utf-8
output: .pyspelling-custom-py.dic.tmp
wordlists:
- wordlist.txt
pipeline:
- pyspelling.filters.context:
context_visible_first: true
escapes: '\\[\\`]'
delimiters:
# Ignore multiline content between (possibly indented) triple backticks
- open: '(?s)^(?P<open>[ ]*```)'
close: '^(?P=open)$'
# Ignore text between inline back ticks
- open: '(?P<open>`)'
close: '(?P=open)'
- pyspelling.filters.python:
strings: false
comments: false