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

Genesis port script v0.34.0 #4023

Merged
merged 29 commits into from
Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0d88bc9
genesis port script
Apr 2, 2019
9aa7005
add command
Apr 2, 2019
e20d778
various fixes
Apr 2, 2019
4c549f2
works
fedekunze Apr 3, 2019
62bca4d
cleanup and move to script
fedekunze Apr 3, 2019
f6887b0
typo
fedekunze Apr 3, 2019
8915f47
check args
fedekunze Apr 3, 2019
1dab733
rename files and fix scripts
fedekunze Apr 3, 2019
ddec599
command to run
fedekunze Apr 3, 2019
4d726bc
address comments from review
fedekunze Apr 3, 2019
5e4f838
use flags
fedekunze Apr 3, 2019
2c99fb9
changelog
fedekunze Apr 4, 2019
d88b6d2
Update .pending/improvements/gaia/4018-create-genesis-
cwgoes Apr 4, 2019
2f3012a
update value and validation test
fedekunze Apr 4, 2019
39d7ce0
Merge branch 'fedekunze/4018-genesis-scritp' of https://github.com/co…
fedekunze Apr 4, 2019
9df1f1b
add chain-id
fedekunze Apr 4, 2019
50c58c6
Merge branch 'release/v0.34.0' into fedekunze/4018-genesis-scritp
alexanderbez Apr 4, 2019
b55d40a
New python script
alessio Apr 4, 2019
31952f1
delete go files
fedekunze Apr 4, 2019
4a3b178
numbers to strings
fedekunze Apr 4, 2019
9c6a515
add crisis constant fee
fedekunze Apr 5, 2019
afe9952
Exit with error on stderr
alessio Apr 7, 2019
6e01099
Refactoring, slightly more modular design
alessio Apr 7, 2019
1b56d64
Fix indentation
alessio Apr 8, 2019
34a9b36
Remove unnecessary variable
alessio Apr 8, 2019
0fd205c
Minor reformatting
alexanderbez Apr 8, 2019
1581756
Minor reformatting
alexanderbez Apr 8, 2019
c4de703
Rename file
alexanderbez Apr 8, 2019
5c85697
Update contrib/export/v0.33.x-to-v0.34.0.py
cwgoes Apr 8, 2019
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*.swn
.vscode
.idea
*.pyc

# Build
vendor
Expand Down
1 change: 1 addition & 0 deletions .pending/improvements/gaia/4018-create-genesis-
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#4018 create genesis port script for release v.0.34.0
28 changes: 28 additions & 0 deletions contrib/export/lib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3

import argparse
import json
import sys


def init_default_argument_parser(prog_desc, default_chain_id, default_start_time):
parser = argparse.ArgumentParser(description=prog_desc)
parser.add_argument(
'exported_genesis',
help='exported genesis.json file',
type=argparse.FileType('r'), default=sys.stdin,
)
parser.add_argument('--chain-id', type=str, default=default_chain_id)
parser.add_argument('--start-time', type=str, default=default_start_time)
return parser


def main(argument_parser, process_genesis_func):
args = argument_parser.parse_args()
if args.chain_id.strip() == '':
sys.exit('chain-id required')

genesis = json.loads(args.exported_genesis.read())

print(json.dumps(process_genesis_func(
genesis=genesis, parsed_args=args,), indent=True))
42 changes: 42 additions & 0 deletions contrib/export/v0.33.x-to-v0.34.0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python3

import lib


def process_raw_genesis(genesis, parsed_args):
# update genesis with breaking changes
genesis['consensus_params']['block'] = genesis['consensus_params']['block_size']
del genesis['consensus_params']['block_size']

genesis['app_state']['crisis'] = {
'constant_fee': {
'amount': '1333000000', # ~$5,000 worth of uatoms
'denom': 'uatom',
},
}

# proposal #1 updates
genesis['app_state']['mint']['params']['blocks_per_year'] = '4855015'

# proposal #2 updates
genesis['consensus_params']['block']['max_gas'] = '2000000'
genesis['consensus_params']['block']['max_bytes'] = '200000'

# enable transfers
genesis['app_state']['bank']['send_enabled'] = True
genesis['app_state']['distr']['withdraw_addr_enabled'] = True

# Set new chain ID and genesis start time
genesis['chain_id'] = parsed_args.chain_id.strip()
genesis['genesis_time'] = parsed_args.start_time

return genesis


if __name__ == '__main__':
parser = lib.init_default_argument_parser(
prog_desc='Convert genesis.json from v0.33.x to v0.34.0',
default_chain_id='cosmoshub-n',
default_start_time='2019-02-11T12:00:00Z',
)
lib.main(parser, process_raw_genesis)