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

Updating democracy module for Substrate PR #5294. #3

Merged
merged 12 commits into from
Apr 6, 2020

Conversation

jnaviask
Copy link
Collaborator

@jnaviask jnaviask commented Apr 2, 2020

Description

Substrate PR #5294 (paritytech/substrate#5294) brings many updates to the democracy module, which this PR aims to support.

Implementation TODO:

  • Upgrade API for latest democracy support
  • No more errors on democracy viewing
  • Fix existing democracy transactions
  • Support proxy system queries
  • Support proxy system transactions
  • Support adminstrative transactions (reap_vote, unlock)
  • Review and make changes for Instant as needed
  • Fix the locking mechanism to prevent proposal creation errors
    • I fixed this and liquid/illiquid seems accurate to the chain, but also sometimes doesn't make sense to me (edgeware votes locking even if you select 0.1x?)
  • Writing methods for tx fee calculation (Substrate now simulates txs and has floating gas prices).
  • Removing transactionfee because it no longer exists
  • Figure out why remark always fails to execute.
    • remark always fails, but balance.setBalance works, so I'm considering this a success.
  • Ensure conviction still works as expected.

UI fixes needed:

  • Passing/failing text on proposals page looks weird.
  • Some sort of notification on error, rather than just console printing?
  • Some way to unlock funds (unlock call, on Kusama), or else they'll remain illiquid forever.
  • Consider allowing unvote on Kusama. We may need to continue displaying proposals even after completion to allow for unvoting.
  • Add input for custom balance when voting.
  • Add visual display for passed-but-not-yet-dispatched proposal state (enactment time), and visual display for cooloff time too, if we want it.

Motivation and Context

Kusama runs off a more bleeding-edge version of Substrate than Edgeware, and we want to support Kusama, so this set of changes is designed to get Kusama back online.

How Has This Been Tested?

Code builds, and basic view tests. QA on local Kusama and local Edgeware chains. Query-only QA on live Kusama and live Edgeware chains.

Replication steps (Kusama):

  1. Check out Kusama at Substrate commit hash 2eb9c260a.
  2. Apply the following diff to decrease Democracy launch, voting, enactment, and cooloff times to minutes rather than days.:
diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs
index ccd2eba78..9e02db39a 100644
--- a/bin/node/runtime/src/lib.rs
+++ b/bin/node/runtime/src/lib.rs
@@ -301,13 +301,13 @@ impl pallet_staking::Trait for Runtime {
 }
 
 parameter_types! {
-       pub const LaunchPeriod: BlockNumber = 28 * 24 * 60 * MINUTES;
-       pub const VotingPeriod: BlockNumber = 28 * 24 * 60 * MINUTES;
+       pub const LaunchPeriod: BlockNumber = 2 * MINUTES;
+       pub const VotingPeriod: BlockNumber = 2 * MINUTES;
        pub const FastTrackVotingPeriod: BlockNumber = 3 * 24 * 60 * MINUTES;
        pub const InstantAllowed: bool = true;
        pub const MinimumDeposit: Balance = 100 * DOLLARS;
-       pub const EnactmentPeriod: BlockNumber = 30 * 24 * 60 * MINUTES;
-       pub const CooloffPeriod: BlockNumber = 28 * 24 * 60 * MINUTES;
+       pub const EnactmentPeriod: BlockNumber = 1 * MINUTES;
+       pub const CooloffPeriod: BlockNumber = 1 * MINUTES;
        // One cent: $10,000 / MB
        pub const PreimageByteDeposit: Balance = 1 * CENTS;
 }
  1. Build and run chain with ./target/release/substrate --alice --chain=dev --force-authoring --validator.
  2. Replace edgeware-local NodeInfo with kusama-local in the database (either manually or by resetting).
  3. Load http://localhost:8080/kusama-local/. Verify the console prints KUSAMA started..
  4. Follow flow to link address "Alice" (5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY) via subkey (use "//Alice" on command line).
  5. Create a democracy proposal as Alice. I typically use "remark". Use the private key to sign.
  6. (Optional) Note the preimage as well.
  7. Wait until the proposal becomes a referendum. Try to vote.
  8. Ensure the proposal outcome is as expected.
  9. At this point, if you try to repeat the process from step 7, you'll notice that all your funds are locked. This is where unvote and setting a vote quantity become important. Also, if you chose to register the preimage and then pass the proposal, you'll note in the execution event that the function call fails. The reason for this remains unclear to me.

Repeat this process with a local Edgeware node rather than Kusama to verify the changes are non-breaking.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.

@jnaviask jnaviask changed the title [WIP] Updating democracy module for Substrate PR #5294. Updating democracy module for Substrate PR #5294. Apr 3, 2020
@raykyri raykyri merged commit f091add into master Apr 6, 2020
@raykyri raykyri deleted the jake.kusama-democracy-redesign branch October 14, 2020 19:07
dillchen added a commit that referenced this pull request Jul 23, 2021
jnaviask added a commit that referenced this pull request Jul 15, 2022
…ash-4.17.19

Bump lodash from 4.17.15 to 4.17.19
jnaviask added a commit that referenced this pull request Mar 16, 2023
* from event-types client side

* move chain + network to event -> working chain activity dashboard

* switch ce commands to ts-node-dev

* chain + network added to event in ChainEventConsumer

* save

* filter out non entity creation/completion events for notifications

* remove EventTypeCUD RabbitMQ types + config + pub/sub calls

* remove ChainEventType model

* remove chain-event-type migration

* CET model removal fixes

* CW remove CET migration

* CW remove CET model

* CET removal migrations + model update

* migration fixes

* migration fixes

* chain subscriptions + chain-event notification settings + subscribedChains

* add full chain to createSubscription route result + fix UI

* turn off sourceMap, use proper tsconfig when building ce, and fixed scraper imports

* add type check to CI + fix type errors

* add type check to CI + fix type errors + remove format in CE repo

* set allowJs: false in tsconfig so sourceMap files don't interrupt ts-node

* RabbitMQ merge fixes

* Make CI lint only the changes in the branch rather than everything

* fix tsconfig + run prettier

* merge fixes

* merge fixes

* discoverReconnectRange fix

* consumer erc20 notification handler bug fix

* load-env-var fix

* Procfile fix

* master merge fixes

* fix chain-event notifications

* fix chain-event email notifications

* format

* format

* CE css fix

* remove subscriptions count for chain-events

* fix getSubscribedChains call

* notification settings page fixes + remove unnecessary logs

* format

* delete script

* migration script fix

* prettier format

* publishCustomRabbitMQMessage.ts improvements

* prettier format

* more script improvements for testing/QA

* add dump file to gitignore

* 8 min local

* 15 seconds local

* add fkey from NR to Sub

* format

* eslint + format + .prettierignore update

* Ensure CET Removal Backwards Compatibility. (#2765)

* Use CE proxy for events too.

* Ensure backwards compatibility for deployment + fix link to chain.

* Prettier fixes.

* Remove log.

* fixed type errors

* fix lint

* fix lint

* format

* small logging fix

* migration log improvement

* ce procfile fix

* add missing index to notif table

* Subscriptions pkey + not null

* fix type

* test improved CE queries

* Procfile fix

* heroku test

* heroku test 2

* cleaup

---------

Co-authored-by: Jake Naviasky <jake@commonwealth.im>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Muon Shot <120686579+CowMuon@users.noreply.github.com>
jnaviask added a commit that referenced this pull request Mar 16, 2023
jnaviask added a commit that referenced this pull request Mar 16, 2023
* Revert "Remove Chain Event Types #3 (#3044)"

This reverts commit 68ba0c5.

* revert migration

* add back the migrations that did run successfully

* txn

* fix

---------

Co-authored-by: Timothee Legros <timothee@ualberta.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants