Skip to content

Instantly share code, notes, and snippets.

View joepetrowski's full-sized avatar

joe petrowski joepetrowski

  • Zug, Switzerland
View GitHub Profile
@joepetrowski
joepetrowski / rustc-error
Created November 17, 2022 06:51
Assets Instantiation Rustc Error
> cargo build -p westmint-runtime
⚡ Found 3 strongly connected components which includes at least one cycle each
cycle(001) ∈ α: ApprovalVoting ~~{"ApprovalDistributionMessage"}~~> ApprovalDistribution ~~{"ApprovalVotingMessage"}~~> *
cycle(002) ∈ β: CandidateBacking ~~{"StatementDistributionMessage"}~~> StatementDistribution ~~{"CandidateBackingMessage"}~~> *
cycle(003) ∈ γ: NetworkBridgeRx ~~{"GossipSupportMessage"}~~> GossipSupport ~~{"NetworkBridgeRxMessage"}~~> *
Compiling westmint-runtime v1.0.0 (/home/joe/parity/cumulus/parachains/runtimes/assets/westmint)
error: failed to run custom build command for `westmint-runtime v1.0.0 (/home/joe/parity/cumulus/parachains/runtimes/assets/westmint)`
Caused by:
process didn't exit successfully: `/home/joe/parity/cumulus/target/debug/build/westmint-runtime-0325cdfe0c0057e7/build-script-build` (exit status: 1)

This is a guide to test claims on a local testnet for wallet integrations.

Generate a Chainspec

Clone the chainspec generator and follow the instructions in the README. You only need to run up to ./scripts/polkadot-genesis.sh, and you will get the chainspec that was used for Polkadot genesis.

This will output a polkadot.json file; rename it to something like modified-polkadot.json.

Get Runtime Code

Lazy Payouts

Polkadot makes all stakers claim their rewards for past eras by submitting a transaction. This naturally leads to spreading out reward distribution, as people make transactions at disparate times, rather than updating the accounts of all stakers in a single block. Even if everyone submitted a reward claim at the same time, the fact that they are individual transactions would allow the block construction algorithm to process only a limited number per block and ensure that Polkadot maintains a constant block time.

Lazy payouts requires 1 transaction per staker per era to claim rewards, where a staker can be either a validator or a nominator. The reason Polkadot requires this is to avoid an attack where someone has several thousand accounts nominating a single validator. The major cost in reward distribution is mutating the accounts in storage, and Polkadot cannot pay out several thousand accounts in a single transaction.

Claiming Rewards

Polkadot stores up to 84 eras of reward info like ma

Inspect a seed phrase (so you see the info):

$ subkey inspect "favorite liar zebra assume hurt cage any damp inherit rescue delay panic"
Secret phrase `favorite liar zebra assume hurt cage any damp inherit rescue delay panic` is account:
  Secret seed: 0x235c69907d33b85f27bd78e73ff5d0c67bd4894515cc30c77f4391859bc1a3f2
  Public key (hex): 0x6ce96ae5c300096b09dbd4567b0574f6a1281ae0e5cfe4f6b0233d1821f6206b
  Address (SS58): 5EXWNJuoProc7apm1JS8m9RTqV3vVwR9dCg6sQVpKnoHtJ68

Generate a Kusama address (should this work? It gives me an address, so I hope yes):

Keybase proof

I hereby claim:

  • I am joepetrowski on github.
  • I am joepetrowski (https://keybase.io/joepetrowski) on keybase.
  • I have a public key ASDVu7o6yh-LGlkfGuVP-TZFj6n3XqN9j3v2XErHTS6-Hwo

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 16qSWVVSxXNqESNhfkAj6CrxE75dbwYmHM https://explorer.blockstack.org/address/16qSWVVSxXNqESNhfkAj6CrxE75dbwYmHM