WIP gaia-10k (#96)

* WIP gaia-10k

* Fix the gentxs

* Accepting gentxs for gaia-10k
This commit is contained in:
Zaki Manian 2019-01-24 19:46:48 -08:00 committed by GitHub
parent 7f07dadc84
commit 5eb82bbb57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 28712 additions and 0 deletions

View File

@ -11,6 +11,11 @@ To get started with the latest testnet, see the
# Testnet Status
## *January 24, 2019 22:30 EST* - Gaia-10k
We are gather gentxs for gaia-10k. Final genesis deadline isn't finalized yet but we are accepting pull requests for gen-txs to `gaia-10k/gentxs`
## *December 11, 2018 15:00 EST* - Genki-3001
`genki-3001` is a community-driven interim testnet that uses GoS accounts and parameters.

View File

@ -0,0 +1,48 @@
# https://circleci.com/docs/2.0/language-javascript/
version: 2
jobs:
"node-8":
docker:
- image: circleci/node:8
working_directory: ~/typescript-starter
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: npm test
- run: npx nyc report --reporter=lcov | npx codecov
- run: npm run cov:check
"node-latest":
docker:
- image: circleci/node:latest
working_directory: ~/typescript-starter
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: npm test
- run: npx nyc report --reporter=lcov | npx codecov
- run: npm run cov:check
workflows:
version: 2
build:
jobs:
- "node-8"
- "node-latest"

View File

@ -0,0 +1,3 @@
# Example Contributing Guidelines
This is an example of GitHub's contributing guidelines file. Check out GitHub's [CONTRIBUTING.md help center article](https://help.github.com/articles/setting-guidelines-for-repository-contributors/) for more information.

View File

@ -0,0 +1,11 @@
* **I'm submitting a ...**
[ ] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
* **Summary**
* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

View File

@ -0,0 +1,13 @@
* **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...)
* **What is the current behavior?** (You can also link to an open issue here)
* **What is the new behavior (if this is a feature change)?**
* **Other information**:

11
gaia-10k/gaia-10k-scripts/.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
node_modules
build
test
src/**.js
.idea/*
coverage
.nyc_output
*.log
package-lock.json

View File

@ -0,0 +1,14 @@
src
test
tsconfig.json
tsconfig.module.json
tslint.json
.travis.yml
.github
.prettierignore
.vscode
build/docs
**/*.spec.*
coverage
.nyc_output
*.log

View File

@ -0,0 +1,2 @@
# package.json is formatted by package managers, so we ignore it here
package.json

View File

@ -0,0 +1,52 @@
'use strict';
const meow = require('meow');
const path = require('path');
const tsFile = getTSFile();
const jsFile = TS2JS(tsFile);
replaceCLIArg(tsFile, jsFile);
// Ava debugger
require('ava/profile');
/**
* get ts file path from CLI args
*
* @return string path
*/
function getTSFile() {
const cli = meow();
return cli.input[0];
}
/**
* get associated compiled js file path
*
* @param tsFile path
* @return string path
*/
function TS2JS(tsFile) {
const srcFolder = path.join(__dirname, '..', 'src');
const distFolder = path.join(__dirname, '..', 'build', 'main');
const tsPathObj = path.parse(tsFile);
return path.format({
dir: tsPathObj.dir.replace(srcFolder, distFolder),
ext: '.js',
name: tsPathObj.name,
root: tsPathObj.root
});
}
/**
* replace a value in CLI args
*
* @param search value to search
* @param replace value to replace
* @return void
*/
function replaceCLIArg(search, replace) {
process.argv[process.argv.indexOf(search)] = replace;
}

View File

@ -0,0 +1,39 @@
{
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "Debug Project",
// we test in `build` to make cleanup fast and easy
"cwd": "${workspaceFolder}/build",
// Replace this with your project root. If there are multiple, you can
// automatically run the currently visible file with: "program": ${file}"
"program": "${workspaceFolder}/src/cli/cli.ts",
// "args": ["--no-install"],
"outFiles": ["${workspaceFolder}/build/main/**/*.js"],
"skipFiles": [
"<node_internals>/**/*.js",
"${workspaceFolder}/node_modules/**/*.js"
],
"preLaunchTask": "npm: build",
"stopOnEntry": true,
"smartStep": true,
"runtimeArgs": ["--nolazy"],
"env": {
"TYPESCRIPT_STARTER_REPO_URL": "${workspaceFolder}"
},
"console": "externalTerminal"
},
{
"type": "node",
"request": "launch",
"name": "Debug Spec",
"program": "${workspaceRoot}/.vscode/debug-ts.js",
"args": ["${file}"],
"skipFiles": ["<node_internals>/**/*.js"],
// Consider using `npm run watch` or `yarn watch` for faster debugging
// "preLaunchTask": "npm: build",
// "smartStep": true,
"runtimeArgs": ["--nolazy"]
}]
}

View File

@ -0,0 +1,5 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
// "typescript.implementationsCodeLens.enabled": true
// "typescript.referencesCodeLens.enabled": true
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 YOUR_NAME
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,3 @@
# gaia9000
Convert a gaia8000 json to gaia9000

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,103 @@
{
"name": "gaia-9002_scripts",
"version": "1.0.0",
"description": "Convert a gaia8000 json to gaia9000",
"main": "build/main/index.js",
"typings": "build/main/index.d.ts",
"module": "build/module/index.js",
"repository": "https://github.com/YOUR_GITHUB_USER_NAME/gaia9000",
"license": "MIT",
"keywords": [],
"scripts": {
"exe": "run-p build && node build/main/index.js",
"info": "npm-scripts-info",
"build": "run-s clean && run-p build:*",
"build:main": "tsc -p tsconfig.json",
"build:module": "tsc -p tsconfig.module.json",
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.ts\" --write",
"fix:tslint": "tslint --fix --project .",
"test": "run-s build test:*",
"test:lint": "tslint --project . && prettier \"src/**/*.ts\" --list-different",
"test:unit": "nyc --silent ava",
"watch": "run-s clean build:main && run-p \"build:main -- -w\" \"test:unit -- --watch\"",
"cov": "run-s build test:unit cov:html && opn coverage/index.html",
"cov:html": "nyc report --reporter=html",
"cov:send": "nyc report --reporter=lcov > coverage.lcov && codecov",
"cov:check": "nyc report && nyc check-coverage --lines 100 --functions 100 --branches 100",
"doc": "run-s doc:html && opn build/docs/index.html",
"doc:html": "typedoc src/ --target ES6 --mode file --out build/docs",
"doc:json": "typedoc src/ --target ES6 --mode file --json build/docs/typedoc.json",
"doc:publish": "gh-pages -m \"[ci skip] Updates\" -d build/docs",
"version": "standard-version",
"reset": "git clean -dfx && git reset --hard && npm i",
"clean": "trash build test",
"all": "run-s reset test cov:check doc:html",
"prepare-release": "run-s all version doc:publish",
"preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('gaia9000 must be installed with Yarn: https://yarnpkg.com/')\""
},
"scripts-info": {
"info": "Display information about the package scripts",
"build": "Clean and rebuild the project",
"fix": "Try to automatically fix any linting problems",
"test": "Lint and unit test the project",
"watch": "Watch and rebuild the project on save, then rerun relevant tests",
"cov": "Rebuild, run tests, then create and open the coverage report",
"doc": "Generate HTML API documentation and open it in a browser",
"doc:json": "Generate API documentation in typedoc JSON format",
"version": "Bump package.json version, update CHANGELOG.md, tag release",
"reset": "Delete all untracked files and reset the repo to the last commit",
"prepare-release": "One-step: clean, build, test, publish docs, and prep a release"
},
"engines": {
"node": ">=8.9"
},
"dependencies": {
"@types/bech32": "^1.1.1",
"@types/csv-parse": "^1.1.11",
"@types/node": "^10.12.0",
"bech32": "^1.1.3",
"bignumber.js": "^7.2.1",
"csv-parse": "^3.2.0",
"sha.js": "^2.4.11"
},
"devDependencies": {
"ava": "1.0.0-beta.7",
"codecov": "^3.1.0",
"cz-conventional-changelog": "^2.1.0",
"gh-pages": "^2.0.0",
"npm-run-all": "^4.1.3",
"nyc": "^13.0.1",
"opn-cli": "^3.1.0",
"prettier": "^1.14.3",
"standard-version": "^4.4.0",
"trash-cli": "^1.4.0",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"tslint-immutable": "^4.7.0",
"typedoc": "^0.13.0",
"typescript": "^3.0.3"
},
"ava": {
"failFast": true,
"files": [
"build/main/**/*.spec.js"
],
"sources": [
"build/main/**/*.js"
]
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"prettier": {
"singleQuote": true
},
"nyc": {
"exclude": [
"**/*.spec.js"
]
}
}

View File

@ -0,0 +1,155 @@
import * as fs from 'fs';
import * as util from 'util';
// import parse from 'csv-parse';
// import {BigNumber} from "bignumber.js"
// import * as bech32 from "bech32"
// Convert fs.readFile into Promise version of same
const readFile = util.promisify(fs.readFile);
// function parseFraction(fraction: string):string{
// let parts = fraction.split("/")
// if( parts.length == 2){
// return new BigNumber(parts[0]).div(new BigNumber(parts[1])).toFixed(10)
// }
// return new BigNumber(parts[0]).toFixed(10)
// }
// function fractionToDecimal(fraction: string):string{
// return parseFraction(fraction)
// }
interface genesis{
app_state: app_state
}
interface app_state{
accounts: account[]
staking: staking
}
interface staking{
pool: pool
}
interface pool{
loose_tokens:string
bonded_tokens:string
}
interface account{
address: string
sequence_number:string
account_number:string
coins:coin[]
original_vesting: coin[],
delegated_free: coin[],
delegated_vesting: null[],
start_time:string,
end_time: string
}
interface coin{
amount:string
denon:string
}
// function convertBech32(encoded:string, new_hrp:string):string{
// let data = bech32.decode(encoded)
// return bech32.encode(new_hrp,data.words)
// }
async function getAddresses() {
return [await readFile('../../gaia-9002/genesis.json'),await readFile('../genesis-template.json')];
}
getAddresses().then(data => {
let accounts_9001:genesis = JSON.parse(data[0].toString());
let template:genesis = JSON.parse(data[1].toString())
let accounts = [];
let new_acc ={
"address":"cosmos1uclv9m6xuh4m8puxd8ndwhxhf968gxyhk5udyx",
"coins":[
{
"amount":"10000000000",
"denom":"photinos",
},
{
"amount":"10000",
"denom":"stake",
}
],
"sequence_number":"0",
"account_number":"0",
"original_vesting": null,
"delegated_free": null,
"delegated_vesting": null,
"start_time": "0",
"end_time": "0"
}
accounts.push(new_acc)
for (let account of accounts_9001.app_state.accounts){
let acc = {
"address":account.address,
"coins":[
{
"amount":"10000000000",
"denom":"photinos"
},
{
"amount":"10000",
"denom":"stake"
}
],
"sequence_number":"0",
"account_number":"0",
"original_vesting": null,
"delegated_free": null,
"delegated_vesting": null,
"start_time": "0",
"end_time": "0"
}
accounts.push(acc);
}
template.app_state.accounts= accounts
fs.writeFileSync("../genesis.json",JSON.stringify(template,undefined, 4))
})
// let accounts = genesis.app_state.accounts
// for (let account of accounts){
// account.address = convertBech32(account.address, "cosmos")
// account.coins = [{
// "denom":"steak",
// "amount":"50"
// }]
// }
// let tokens = accounts.length * 50
// console.log(JSON.stringify(accounts, null, 4))
// console.log(tokens)

View File

@ -0,0 +1,45 @@
{
"compilerOptions": {
"target": "es2017",
"outDir": "build/main",
"rootDir": "src",
"moduleResolution": "node",
"module": "commonjs",
"declaration": true,
"inlineSourceMap": true,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
// "strict": true /* Enable all strict type-checking options. */,
/* Strict Type-Checking Options */
// "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
// "strictNullChecks": true /* Enable strict null checks. */,
// "strictFunctionTypes": true /* Enable strict checking of function types. */,
// "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
// "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
// "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
/* Additional Checks */
"noUnusedLocals": true /* Report errors on unused locals. */,
"noUnusedParameters": true /* Report errors on unused parameters. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
/* Debugging Options */
"traceResolution": false /* Report module resolution log messages. */,
"listEmittedFiles": false /* Print names of generated files part of the compilation. */,
"listFiles": false /* Print names of files part of the compilation. */,
"pretty": true /* Stylize errors and messages using color and context. */,
/* Experimental Options */
// "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
// "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
"lib": ["es2017"],
"types": ["node"],
"typeRoots": ["node_modules/@types", "src/types"]
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules/**"],
"compileOnSave": false
}

View File

@ -0,0 +1,11 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"target": "esnext",
"outDir": "build/module",
"module": "esnext"
},
"exclude": [
"node_modules/**"
]
}

View File

@ -0,0 +1,34 @@
{
"extends": ["tslint:latest", "tslint-config-prettier", "tslint-immutable"],
"rules": {
"interface-name": [true, "never-prefix"],
// TODO: allow devDependencies only in **/*.spec.ts files:
// waiting on https://github.com/palantir/tslint/pull/3708
"no-implicit-dependencies": [true, "dev"],
/* tslint-immutable rules */
// Recommended built-in rules
"no-var-keyword": true,
"no-parameter-reassignment": true,
"typedef": [true, "call-signature"],
// Immutability rules
"readonly-keyword": true,
"readonly-array": true,
"no-let": true,
"no-object-mutation": true,
"no-delete": true,
"no-method-signature": true,
// Functional style rules
"no-this": true,
"no-class": true,
"no-mixed-interface": true,
"no-expression-statement": [
true,
{ "ignore-prefix": ["console.", "process.exit"] }
],
"no-if-statement": true
/* end tslint-immutable rules */
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,118 @@
{
"genesis_time": "2019-01-25T02:47:16.078849Z",
"chain_id": "gaia-10k",
"consensus_params": {
"block_size": {
"max_bytes": "22020096",
"max_gas": "-1"
},
"evidence": {
"max_age": "100000"
},
"validator": {
"pub_key_types": [
"ed25519"
]
}
},
"app_hash": "",
"app_state": {
"accounts": null,
"auth": {
"collected_fees": [],
"params": {
"MemoCostPerByte": "3",
"MaxMemoCharacters": "256",
"TxSigLimit": "7",
"SigVerifyCostED25519": "590",
"SigVerifyCostSecp256k1": "1000"
}
},
"staking": {
"pool": {
"not_bonded_tokens": "0",
"bonded_tokens": "0"
},
"params": {
"unbonding_time": "259200000000000",
"max_validators": 100,
"bond_denom": "stake"
},
"last_total_power": "0",
"last_validator_powers": null,
"validators": null,
"bonds": null,
"unbonding_delegations": null,
"redelegations": null,
"exported": false
},
"mint": {
"minter": {
"inflation": "0.130000000000000000",
"annual_provisions": "0.000000000000000000"
},
"params": {
"mint_denom": "stake",
"inflation_rate_change": "0.130000000000000000",
"inflation_max": "0.200000000000000000",
"inflation_min": "0.070000000000000000",
"goal_bonded": "0.670000000000000000",
"blocks_per_year": "6311520"
}
},
"distr": {
"fee_pool": {
"community_pool": []
},
"community_tax": "0.020000000000000000",
"base_proposer_reward": "0.010000000000000000",
"bonus_proposer_reward": "0.040000000000000000",
"withdraw_addr_enabled": true,
"delegator_withdraw_infos": [],
"previous_proposer": "cosmosvalcons1m46yrx",
"outstanding_rewards": [],
"validator_accumulated_commissions": [],
"validator_historical_rewards": [],
"validator_current_rewards": [],
"delegator_starting_infos": [],
"validator_slash_events": []
},
"gov": {
"starting_proposal_id": "1",
"deposits": null,
"votes": null,
"proposals": null,
"deposit_params": {
"min_deposit": [
{
"denom": "stake",
"amount": "10"
}
],
"max_deposit_period": "172800000000000"
},
"voting_params": {
"voting_period": "172800000000000"
},
"tally_params": {
"quorum": "0.334000000000000000",
"threshold": "0.500000000000000000",
"veto": "0.334000000000000000",
"governance_penalty": "0.010000000000000000"
}
},
"slashing": {
"params": {
"max-evidence-age": "120000000000",
"signed-blocks-window": "100",
"min-signed-per-window": "0.500000000000000000",
"downtime-jail-duration": "600000000000",
"slash-fraction-double-sign": "0.050000000000000000",
"slash-fraction-downtime": "0.010000000000000000"
},
"signing_infos": {},
"missed_blocks": {}
},
"gentxs": null
}
}

19839
gaia-10k/genesis.json Normal file

File diff suppressed because it is too large Load Diff