Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align types with recent iterations (#96)
* Move storage to types repo * Use asU8a instead of aasU8a256 * Update types (in the dark) * Bump deps * Bump * Update with manual db endpoint creation * Ok, here we are - ready to align with genesis setups again * Rework key handling * Cleanup comments * Align with Rust dev network keys * Fix state tests * Address test failures * Update for latest types * Update deps * Re-introduce genesis checks * Cleanup interfaces * Make CLI run * Bump versions * Upgrade libp2p, used dialProtocol * Bump dev (type definitions) * Cleanup tests after libp2p upgrade * Skip long-running test
- Loading branch information
Showing
115 changed files
with
2,507 additions
and
3,336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: '@polkadot/dev/config/babel' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,5 @@ | |
"packages": [ | ||
"packages/*" | ||
], | ||
"version": "0.10.4" | ||
"version": "0.11.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright 2017-2018 Jaco Greeff | ||
// This software may be modified and distributed under the terms | ||
// of the ISC license. See the LICENSE file for details. | ||
// @flow | ||
|
||
import type { ChainConfig } from '../types'; | ||
|
||
const BN = require('bn.js'); | ||
|
||
const blake2AsU8a = require('@polkadot/util-crypto/blake2/asU8a'); | ||
const keyring = require('@polkadot/util-keyring/testingPairs')(); | ||
|
||
const code = require('../wasm/polkadot_runtime_wasm'); | ||
const codeHash = blake2AsU8a(code, 256); | ||
|
||
const authorities = [ keyring.alice.publicKey() ]; | ||
const endowed = authorities.concat([ keyring.bob.publicKey(), keyring.charlie.publicKey(), keyring.dave.publicKey(), keyring.eve.publicKey(), keyring.ferdie.publicKey() ]); | ||
|
||
module.exports = ({ | ||
name: 'Development', | ||
description: 'An initial @polkadot/client development network. Network follows the Rust implementation config for the development chain.', | ||
type: 'polkadot', | ||
blockTime: 5, | ||
code, | ||
codeHash, | ||
networkId: 12345, | ||
genesis: { | ||
consensus: { | ||
authorities, | ||
code | ||
}, | ||
council: { | ||
activeCouncil: authorities.map((accountId) => ({ | ||
accountId, | ||
duration: 1000000 | ||
})), | ||
candidacyBond: 10, | ||
carryCount: 4, | ||
desiredSeats: endowed.length - authorities.length, | ||
inactiveGracePeriod: 1, | ||
presentationDuration: 10, | ||
presentSlashPerVoter: 1, | ||
termDuration: 1000000, | ||
votingBond: 2, | ||
votingPeriod: 20 | ||
}, | ||
councilVoting: { | ||
cooloffPeriod: 75, | ||
votingPeriod: 20 | ||
}, | ||
democracy: { | ||
launchPeriod: 9, | ||
minimumDeposit: 10, | ||
votingPeriod: 18 | ||
}, | ||
session: { | ||
validators: authorities, | ||
length: 10 | ||
}, | ||
staking: { | ||
bondingDuration: 2, | ||
balances: endowed.map((accountId) => ({ | ||
accountId, | ||
balance: new BN(1).iushln(60) | ||
})), | ||
currentEra: 0, | ||
intentions: authorities, | ||
sessionsPerEra: 5, | ||
transactionFee: 1, | ||
validatorCount: 2 | ||
} | ||
}, | ||
nodes: [] | ||
}: ChainConfig); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2017-2018 Jaco Greeff | ||
// This software may be modified and distributed under the terms | ||
// of the ISC license. See the LICENSE file for details. | ||
|
||
const memDb = require('@polkadot/client-db/memory'); | ||
const hexToU8a = require('@polkadot/util/hex/toU8a'); | ||
|
||
const init = require('../init'); | ||
const config = require('./index'); | ||
|
||
describe('genesis', () => { | ||
let genesis; | ||
|
||
beforeEach(() => { | ||
const stateDb = memDb(); | ||
const blockDb = memDb(); | ||
|
||
genesis = init({ chain: 'test' }, config, stateDb, blockDb).genesis; | ||
}); | ||
|
||
it('creates a correct genesis block (stateRoot)', () => { | ||
expect( | ||
genesis.header.stateRoot | ||
).toEqual( | ||
new Uint8Array([133, 218, 140, 182, 43, 145, 77, 72, 119, 152, 247, 190, 16, 37, 199, 164, 59, 142, 238, 150, 62, 132, 122, 69, 112, 213, 167, 118, 182, 71, 247, 210]) | ||
); | ||
}); | ||
|
||
it('creates a correct genesis block (extrinsicsRoot)', () => { | ||
expect( | ||
genesis.header.extrinsicsRoot | ||
).toEqual( | ||
hexToU8a('0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421') | ||
); | ||
}); | ||
|
||
it('creates a correct block hash', () => { | ||
expect( | ||
genesis.hash | ||
).toEqual( | ||
new Uint8Array([84, 57, 249, 216, 185, 26, 248, 116, 15, 160, 105, 99, 44, 179, 200, 161, 64, 248, 104, 240, 111, 84, 182, 134, 130, 50, 37, 138, 242, 42, 27, 135]) | ||
); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.