Skip to content

feat: MMD-1309 10-to-1 #225

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

Draft
wants to merge 73 commits into
base: luke/MMD-1309/update-substrate-3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
f77b639
wip
ltfschoen Sep 8, 2021
7c2490c
try fix github actions Check error
ltfschoen Sep 8, 2021
c5d193e
move rewards-allowance test into unit test folder
ltfschoen Sep 8, 2021
14ab43c
add rewards-allowance to Cargo.toml
ltfschoen Sep 8, 2021
1b410fc
add MiningRewardsAllowanceTestModule to construct_runtime so unit tes…
ltfschoen Sep 8, 2021
4d3ab04
add Aura to mock for mining-rewards-allowance
ltfschoen Sep 8, 2021
89c883a
fix use of struct data and alias BondedDHXForAccountData and update t…
ltfschoen Sep 8, 2021
779ca2b
add events. add test for reduce allowance dhx for date. remove templa…
ltfschoen Sep 8, 2021
b74ebfc
change from reduce to change remaining dhx rewards allowance. add und…
ltfschoen Sep 8, 2021
6699091
wip error
ltfschoen Sep 8, 2021
227df09
try making mock for pallet-scheduler same as substrate repo
ltfschoen Sep 8, 2021
a2b3305
try using the real construct_runtime instead of mocking it for tests
ltfschoen Sep 9, 2021
9718552
added Scheduler to mock with help from @xlchen
ltfschoen Sep 9, 2021
636ebb0
add Treasury, Tips, and Bounties to mock
ltfschoen Sep 9, 2021
33dc9aa
add Democracy, Collective, and Membership to mock
ltfschoen Sep 9, 2021
6616b4c
add Elections Phragmen to mock
ltfschoen Sep 9, 2021
3b60cf6
fix mock
ltfschoen Sep 10, 2021
4170cb8
tests: try to create preimage, proposal and referendum but error Prop…
ltfschoen Sep 13, 2021
d3ab8b6
tests: try to emit event with pre-image hash but no System events
ltfschoen Sep 13, 2021
bd324b2
wip
ltfschoen Sep 14, 2021
9d2cbe5
fix tests
ltfschoen Sep 21, 2021
cb6a50e
wip
ltfschoen Sep 21, 2021
936c960
chore: use fork of Substrate in branch luke/democracy latest commit t…
ltfschoen Sep 22, 2021
14121ba
tests: fix tests
ltfschoen Sep 22, 2021
d11a467
wip - error
ltfschoen Sep 22, 2021
325aa6a
fix so works with two default registered miners
ltfschoen Sep 23, 2021
62c81b3
wip
ltfschoen Sep 24, 2021
a9a1f40
update to use our newer version of Substrate fork where BalanceLocks …
ltfschoen Sep 24, 2021
acd85a4
fix errors
ltfschoen Sep 24, 2021
afd6859
feat: transfer reward to dhx miner and reduce reward allowance availa…
ltfschoen Sep 25, 2021
0857b75
move into on_initialize
ltfschoen Sep 27, 2021
e6f86ac
wip
ltfschoen Sep 27, 2021
484299e
record when rewards allowance is finished being distributed for a day
ltfschoen Sep 27, 2021
c9283a5
try to randomize order of registere dhx miners
ltfschoen Sep 27, 2021
5ed1fd7
fix errors
ltfschoen Sep 29, 2021
13ab82b
add response from parity
ltfschoen Sep 29, 2021
3de3060
add todo
ltfschoen Sep 29, 2021
0b85ebf
add Date to cooling off period so only reduce or reward each miner on…
ltfschoen Sep 30, 2021
6ee519d
add fn to convert block number to u64 incase figure out way to use it…
ltfschoen Oct 1, 2021
c14e9ad
wip - start adding aggregation and accumulation of rewards
ltfschoen Oct 1, 2021
dc77e69
wip - temporarily comment out so rewards per block instead of per day…
ltfschoen Oct 3, 2021
9090acd
fix distribution of rewards for 3x registered miners. splits proporti…
ltfschoen Oct 3, 2021
ed3b295
remove useless debugging comments
ltfschoen Oct 3, 2021
33b6011
restore code after debugging now that it works. only distributes rewa…
ltfschoen Oct 3, 2021
be7ef6b
fix failing tests
ltfschoen Oct 3, 2021
54a15c4
fix so no most attempts to distribute rewards after second loop
ltfschoen Oct 4, 2021
2b90f58
fix tests for rewards allowance pallet
ltfschoen Oct 4, 2021
b2a5167
fix mock so consistent with implementation using u128 for Balance typ…
ltfschoen Oct 6, 2021
e1f8da4
remove comment about shuffling miners. we do not need to do this as w…
ltfschoen Oct 6, 2021
439f565
remove hard-coded data that was accidently left in the code when debu…
ltfschoen Oct 6, 2021
df73d7a
remove set timestamp before block 1. fix set_bonded_dhx_of_account_fo…
ltfschoen Oct 7, 2021
816f7dc
add test to check rwards works with largest possible balances bonded
ltfschoen Oct 8, 2021
ef933d3
add multiplier for 10 to 1 mining that allows fractions incase we wan…
ltfschoen Oct 11, 2021
d299cee
wip
ltfschoen Oct 11, 2021
ba98831
wip
ltfschoen Oct 11, 2021
0a38134
rename to _remaining for clarity. remove all _to_try code. fix tests.…
ltfschoen Oct 12, 2021
a5c2f01
refactor move min_bonded for fetching in common function and return b…
ltfschoen Oct 12, 2021
c338381
identified an issue and added fixme
ltfschoen Oct 12, 2021
d67afca
fixed tests that were using incorrect value for min_bonded_dhx_daily …
ltfschoen Oct 13, 2021
2211881
comment out debugging logs that were used
ltfschoen Oct 13, 2021
5f6a26e
wip - adding min mpower setup
ltfschoen Oct 15, 2021
679f8aa
remove multiplier multiplication and fix tests
ltfschoen Oct 15, 2021
eba67b9
wip
ltfschoen Oct 15, 2021
6b83e03
fix to use genesis config mock in tests thanks to help from kaichaosun
ltfschoen Oct 18, 2021
8ae45f4
remove debugging printlns
ltfschoen Oct 18, 2021
10fce79
change rewards multiplier next period days to just 2 days in tests in…
ltfschoen Oct 18, 2021
26f2d54
add test to confirm that reward multiplier doubles after each 10:1 re…
ltfschoen Oct 18, 2021
bdbaeaf
refactor reward multiplier period
ltfschoen Oct 18, 2021
e34f1a3
add tests to check not eligible for rewards when not have min bonded …
ltfschoen Oct 19, 2021
2427e2b
add test to check cooling off period starts again if sufficient bonde…
ltfschoen Oct 19, 2021
586dd35
add tests to check eligibility and ineligibility for rewards if miner…
ltfschoen Oct 19, 2021
740e532
add test to check reward multiplier pause works
ltfschoen Oct 19, 2021
5c580c7
add test to check that pause/unpause and reset rewards multiplier works
ltfschoen Oct 20, 2021
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
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
rustup update stable
rustup toolchain install nightly-2021-08-31
rustup default nightly-2021-08-31
rustup override set nightly-2021-08-31
rustup target add wasm32-unknown-unknown --toolchain nightly-2021-08-31
cargo build --release

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ jobs:
with:
profile: minimal
toolchain: nightly
override: true

- name: Initialize WASM build environment
run: |
rustup update stable
rustup toolchain install nightly-2021-08-31
rustup default nightly-2021-08-31
rustup override set nightly-2021-08-31
rustup target add wasm32-unknown-unknown --toolchain nightly-2021-08-31

- name: Run cargo check
Expand All @@ -52,12 +54,14 @@ jobs:
with:
profile: minimal
toolchain: nightly
override: true

- name: Initialize WASM build environment
run: |
rustup update stable
rustup toolchain install nightly-2021-08-31
rustup default nightly-2021-08-31
rustup override set nightly-2021-08-31
rustup target add wasm32-unknown-unknown --toolchain nightly-2021-08-31

# Runs integration tests in the runtime/tests folder
Expand Down Expand Up @@ -87,6 +91,7 @@ jobs:
cargo +nightly-2021-08-31 test -p mining-setting-hardware &&
cargo +nightly-2021-08-31 test -p mining-rates-token &&
cargo +nightly-2021-08-31 test -p mining-rates-hardware &&
cargo +nightly-2021-08-31 test -p mining-rewards-allowance &&
cargo +nightly-2021-08-31 test -p mining-sampling-token &&
cargo +nightly-2021-08-31 test -p mining-sampling-hardware &&
cargo +nightly-2021-08-31 test -p mining-eligibility-token &&
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ cargo +nightly-2021-08-31-aarch64-apple-darwin fmt --all -- --check
* Ans: Because there is a type mismatch, perhaps the first variable requires a `Balance` instead of `u32` in custom_types.json or similar.

* Question: How to debug when running tests?
* Ans: Run tests with this `SKIP_WASM_BUILD=1 RUST_LOG=runtime=debug` in front, i.e. `SKIP_WASM_BUILD=1 RUST_LOG=runtime=debug cargo +nightly-2021-08-31 test -p datahighway-runtime`, and use `println!` where you want to log the output (i.e. `println!("claim duration {:#?}", claim_duration);`), as `debug::info!` not work in tests. Try using `info!` (have not tried yet)
* Ans: Run tests with this `SKIP_WASM_BUILD=1 RUST_LOG=runtime=debug` in front and `-- --nocapture` at the end, i.e. `SKIP_WASM_BUILD=1 RUST_LOG=runtime=debug cargo +nightly-2021-08-31 test -p datahighway-runtime -- --nocapture`, and use `println!` in the implementation where you want to log the output (i.e. `println!("claim duration {:#?}", claim_duration);`), as `debug::info!` not work in tests. It is important that you do a find/replace to comment out all those `println!` statements before you build your code with `cargo build`, otherwise it will give an error message `duplicate lang item in crate`.

* Question: Why can't I connect my node to telemetry?
* Ans: Try use these flags when running your node `--telemetry-url 'wss://telemetry.polkadot.io/submit/ 0' --unsafe-ws-external --unsafe-rpc-external --rpc-cors=all --rpc-methods=Unsafe`
Expand Down
Loading