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

Rosetta API implementation #7695

Merged
merged 289 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from 224 commits
Commits
Show all changes
289 commits
Select commit Hold shift + click to select a range
529f6b8
update combine
sahith-narahari Nov 10, 2020
c431f61
add signature
jgimeno Nov 11, 2020
c63707e
use legacy amino
sahith-narahari Nov 12, 2020
94599c8
Fix linter.
jgimeno Nov 13, 2020
e276610
remove unused func
jgimeno Nov 13, 2020
0b80fc8
Fix lints.
jgimeno Nov 13, 2020
8c8a61a
Remove docker file.
jgimeno Nov 13, 2020
88b5e24
clean code
jgimeno Nov 13, 2020
eaebebd
Merge branch 'master' into add-rosetta-master
sahith-narahari Nov 15, 2020
9e46fb3
Merge pull request #7854 from cosmos/sahith/impl-cons
jgimeno Nov 16, 2020
09c1f98
add: rosetta CI
fdymylja Nov 16, 2020
b255eb4
change: remove git diff check
fdymylja Nov 16, 2020
d4fe16d
fix: rosetta bin name
fdymylja Nov 16, 2020
eabbe61
fix: rosetta bin name 2
fdymylja Nov 16, 2020
de8b62f
chore: detect containers
fdymylja Nov 16, 2020
e3c416a
change: run rosetta via docker run
fdymylja Nov 16, 2020
044f313
fix: flags
fdymylja Nov 16, 2020
6c44455
fix: rosetta cmd
fdymylja Nov 16, 2020
eab32fd
change: use exec on simnode0
fdymylja Nov 16, 2020
2f6e537
fix: rosetta run command
fdymylja Nov 16, 2020
ea60e01
rollback: docker-compose
fdymylja Nov 16, 2020
8cafd9b
change: run rosetta in a separate container
fdymylja Nov 16, 2020
d72f950
fix: run rosetta instance in daemon mode
fdymylja Nov 16, 2020
2f168c5
fix: get containers names and network
fdymylja Nov 16, 2020
1679cb1
fix: try use container ipv4 endpoint for rosetta instance
fdymylja Nov 16, 2020
1642bb4
fix: configuration file path
fdymylja Nov 16, 2020
69e03c8
fix: set data end conditions
fdymylja Nov 16, 2020
fa492b1
fix: remove cat command
fdymylja Nov 16, 2020
dc30861
fix: rosetta config file
fdymylja Nov 16, 2020
5e63fe5
add: construction API data
fdymylja Nov 17, 2020
d5b19a6
fix: construction json
fdymylja Nov 17, 2020
e3ebe99
fix: context paths of rosetta config extensions
fdymylja Nov 17, 2020
e8642f8
fix: determinstic acc address and currency
fdymylja Nov 17, 2020
29c325b
Update single network.
jgimeno Nov 17, 2020
00c94af
Clean interfaces.
jgimeno Nov 17, 2020
85c7bc7
add rosetta config
jgimeno Nov 17, 2020
894e257
add basic info
jgimeno Nov 17, 2020
9aaab9f
change: use custom node
fdymylja Nov 17, 2020
9e52d4a
fix: remove interactive
fdymylja Nov 17, 2020
e96776a
fix: try add sleep
fdymylja Nov 17, 2020
faa2e6e
change: run full test suite inside docker
fdymylja Nov 17, 2020
9a9d959
fix: permissions
fdymylja Nov 17, 2020
4fd1b75
fix: try permissions
fdymylja Nov 17, 2020
639e12d
Add fee to payloads
sahith-narahari Nov 18, 2020
ef45955
fix docker-compose file
Nov 18, 2020
de47299
add option to enable rosetta in process
jgimeno Nov 18, 2020
ef09df8
change: use zipped data dir
fdymylja Nov 18, 2020
f395605
add offline mode check
jgimeno Nov 18, 2020
cba447a
offline mode uses the config first.
jgimeno Nov 18, 2020
c440039
change struct so it uses less memory.
jgimeno Nov 18, 2020
c9bb2cf
Merge pull request #7958 from cosmos/add-rosetta-into-server-command
jgimeno Nov 18, 2020
6c19e48
add: construction API ci
fdymylja Nov 18, 2020
d2e774c
add: README.md
fdymylja Nov 18, 2020
9136166
change: speedup rosetta
fdymylja Nov 18, 2020
7fdfac9
update block response
sahith-narahari Nov 18, 2020
26fefc0
remove: unused files
fdymylja Nov 18, 2020
6dff38d
remove some line
jgimeno Nov 18, 2020
b2c6666
code cleanup
sahith-narahari Nov 18, 2020
f0ada97
fix lint
sahith-narahari Nov 18, 2020
b2935a4
clean some lines
jgimeno Nov 18, 2020
bfbb801
remove todos
sahith-narahari Nov 18, 2020
8d77c6b
Merge branch 'fdymylja/rosetta-ci' of github.com:cosmos/cosmos-sdk in…
sahith-narahari Nov 18, 2020
c7e71d1
update index
sahith-narahari Nov 18, 2020
8e9d081
update config
sahith-narahari Nov 18, 2020
219cb32
chore: py linting
fdymylja Nov 19, 2020
7338743
Merge pull request #7947 from cosmos/fdymylja/rosetta-ci
jgimeno Nov 19, 2020
7b651db
Merge branch 'add-rosetta-master' into sahith/add-fee-support
jgimeno Nov 19, 2020
ba8623b
Remove unused param.
jgimeno Nov 20, 2020
0d628f9
clean code
jgimeno Nov 20, 2020
0bb3815
unify file
jgimeno Nov 20, 2020
490f1a4
export function
jgimeno Nov 20, 2020
e4032e7
Remove some params.
jgimeno Nov 20, 2020
1b3ce34
update func
jgimeno Nov 20, 2020
b3c8ef0
Merge branch 'master' of github.com:cosmos/cosmos-sdk into add-rosett…
sahith-narahari Nov 23, 2020
261ce37
Merge branch 'add-rosetta-master' of github.com:cosmos/cosmos-sdk int…
sahith-narahari Nov 23, 2020
c8215ae
fix go mod conflicts
sahith-narahari Nov 23, 2020
6b2402a
Merge pull request #7973 from cosmos/sahith/add-fee-support
jgimeno Nov 23, 2020
beb8e77
use last version
jgimeno Nov 23, 2020
1b3bb4b
change: bump data dir to new tm version
fdymylja Nov 23, 2020
31d1483
change: remove volumes
fdymylja Nov 23, 2020
669ebb5
Merge pull request #8010 from cosmos/fdymylja/rosetta-ci-bump-tm
jgimeno Nov 23, 2020
ba0803b
Merge branch 'add-rosetta-master' into use-last-crg-version
jgimeno Nov 23, 2020
0d78166
Add v0.2.0 version.
jgimeno Nov 23, 2020
f316d5f
Update contrib/rosetta/README.md
jgimeno Nov 23, 2020
dcd44fd
address suggestions
sahith-narahari Nov 23, 2020
5785856
Merge remote-tracking branch 'origin/add-rosetta-master' into add-ros…
sahith-narahari Nov 23, 2020
2f165a4
Merge branch 'master' into add-rosetta-master
sahith-narahari Nov 23, 2020
069376c
update imports
sahith-narahari Nov 23, 2020
e308995
Merge remote-tracking branch 'origin/add-rosetta-master' into add-ros…
sahith-narahari Nov 23, 2020
9d3b9c5
make format
Nov 23, 2020
5746af6
add tx status
sahith-narahari Nov 24, 2020
32e1a4d
change: rename single network to online network
fdymylja Nov 24, 2020
be0a0e5
chore: omit hash
fdymylja Nov 24, 2020
08c2d63
fix: add other errors to allowed errors list
fdymylja Nov 24, 2020
2b31031
chore: make naming in rosetta conversion consistent
fdymylja Nov 24, 2020
101960e
add tx status
sahith-narahari Nov 24, 2020
6797cba
chore: lint
fdymylja Nov 24, 2020
a867fc9
Merge pull request #8008 from cosmos/use-last-crg-version
jgimeno Nov 24, 2020
237fbe3
Merge pull request #8017 from cosmos/sahith/add-tx-status
jgimeno Nov 24, 2020
ef15578
change: merge add-rosetta-master
fdymylja Nov 24, 2020
287bf09
Merge branch 'add-rosetta-master' into fdymylja/cleanup-rosetta-stargate
fdymylja Nov 24, 2020
4d53cb1
chore: fix doc on mempool tx
fdymylja Nov 24, 2020
2017b59
Merge pull request #8018 from cosmos/fdymylja/cleanup-rosetta-stargate
jgimeno Nov 24, 2020
417a4c3
Merge branch 'master' of github.com:cosmos/cosmos-sdk into add-rosett…
sahith-narahari Nov 25, 2020
67ffc3b
Merge branch 'add-rosetta-master' of github.com:cosmos/cosmos-sdk int…
sahith-narahari Nov 25, 2020
b603a46
Merge branch 'master' into add-rosetta-master
jgimeno Nov 26, 2020
a05c3d1
Merge branch 'master' into add-rosetta-master
Nov 27, 2020
ff40da7
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Nov 29, 2020
49120f5
Merge branch 'add-rosetta-master' of github.com:cosmos/cosmos-sdk int…
sahith-narahari Nov 29, 2020
b729108
Add staking support
sahith-narahari Nov 29, 2020
5f256f3
Merge branch 'master' into add-rosetta-master
Nov 29, 2020
78228e6
fix lint
sahith-narahari Nov 30, 2020
c62a947
Merge branch 'add-rosetta-master' of github.com:cosmos/cosmos-sdk int…
sahith-narahari Nov 30, 2020
8ef88d7
code cleanup
sahith-narahari Nov 30, 2020
97a01d9
update rosetta config
sahith-narahari Nov 30, 2020
af75c21
Merge branch 'master' into add-rosetta-master
jgimeno Dec 1, 2020
adb9be2
Update contrib/rosetta/configuration/data.sh
Dec 1, 2020
0a7071b
add: staking CI workflow
fdymylja Dec 2, 2020
3236b57
Rename files.
jgimeno Dec 2, 2020
12607e0
Try split images.
jgimeno Dec 2, 2020
de47bb1
update docker image for rosetta cli
jgimeno Dec 2, 2020
4bd738d
Merge pull request #8063 from cosmos/test-split-images
jgimeno Dec 2, 2020
01fecf4
Merge pull request #8044 from cosmos/sahith/add-staking
jgimeno Dec 2, 2020
c56aa8c
Merge branch 'master' into add-rosetta-master
Dec 2, 2020
84ddd5c
Merge branch 'master' into add-rosetta-master
Dec 3, 2020
e3d406f
Merge branch 'master' into add-rosetta-master
jgimeno Dec 4, 2020
58e8145
Merge branch 'master' into add-rosetta-master
Dec 7, 2020
f505e8c
Merge branch 'master' into add-rosetta-master
jgimeno Dec 7, 2020
264a119
fix error with imports duplicated
jgimeno Dec 7, 2020
2da7b67
add temp commit
jgimeno Dec 8, 2020
3f0713e
refactor to use sdk txs with hash to rosetta
jgimeno Dec 8, 2020
f3ab613
add msg to operations
jgimeno Dec 8, 2020
052ba73
save rosetta
jgimeno Dec 8, 2020
bcef594
Update tests.
jgimeno Dec 9, 2020
0c0e5e9
reduce api
jgimeno Dec 9, 2020
aeff276
comment and reduce some constant values
jgimeno Dec 10, 2020
efdbc5d
half refactor
jgimeno Dec 10, 2020
8ffd43f
temp commit
jgimeno Dec 11, 2020
6c3850f
fix
jgimeno Dec 11, 2020
d320aab
refactor function to get block with transactions by hash.
jgimeno Dec 11, 2020
11c8ef1
use methods to get transactions by hash
jgimeno Dec 11, 2020
1ab327e
remove old methods
jgimeno Dec 11, 2020
3c3cce5
change type of client
jgimeno Dec 11, 2020
73bd8f7
refactor mempools
jgimeno Dec 11, 2020
3d1a0ac
refactor construction
jgimeno Dec 11, 2020
6c1630a
refactor construction parse
jgimeno Dec 14, 2020
8c93857
refactor message
jgimeno Dec 14, 2020
ffba291
update construction
jgimeno Dec 14, 2020
277dc36
remove unused func
jgimeno Dec 14, 2020
09c40e5
add interface registry
jgimeno Dec 14, 2020
1144173
Add config to private method.
jgimeno Dec 14, 2020
b46b422
update files
jgimeno Dec 14, 2020
03f7aed
Use the proto name for staking too.
jgimeno Dec 14, 2020
4f9336d
refactor
jgimeno Dec 14, 2020
f6407ef
remove unused types
jgimeno Dec 15, 2020
5bd4ca1
some refactor
jgimeno Dec 15, 2020
7132919
other refactor to insert logic into the client
jgimeno Dec 15, 2020
af028d7
little step refactor
jgimeno Dec 15, 2020
116abce
move logic to msg
jgimeno Dec 15, 2020
bb6fbc4
remove unused funcs
jgimeno Dec 15, 2020
51772e5
remove signer addr
jgimeno Dec 15, 2020
2e5611d
some more refactor, closer
jgimeno Dec 15, 2020
97988d2
looks like we have it
jgimeno Dec 15, 2020
b0e6851
fix linter
jgimeno Dec 15, 2020
31848e6
remove Supported operations
jgimeno Dec 16, 2020
81fee4c
remove some things
jgimeno Dec 16, 2020
a70a905
Merge pull request #8114 from cosmos/refactor-include-operations
jgimeno Dec 16, 2020
f7fe0b6
Merge branch 'master' into add-rosetta-master
jgimeno Dec 16, 2020
781cb9c
add checks into client
jgimeno Dec 17, 2020
2334916
Merge branch 'master' into add-rosetta-master
Dec 17, 2020
a06b314
Merge branch 'master' into add-rosetta-master
jgimeno Dec 18, 2020
b748705
change: finalize refactor
fdymylja Dec 21, 2020
e244c6b
Rename handler to server.
jgimeno Dec 21, 2020
e9c9246
fix client
jgimeno Dec 21, 2020
8ce8b85
update go mod.
jgimeno Dec 22, 2020
398086b
change: update crg version, construction error returns
fdymylja Jan 4, 2021
65b0c16
chore: lint
fdymylja Jan 4, 2021
c5eee83
update staking ros
sahith-narahari Jan 4, 2021
374c6d6
fix ros
sahith-narahari Jan 4, 2021
a145583
Merge pull request #8212 from cosmos/fdymylja/refactor-rosetta-stargate
jgimeno Jan 4, 2021
21fb45b
Merge branch 'master' into add-rosetta-master
jgimeno Jan 4, 2021
ffa3950
Add sta
jgimeno Jan 4, 2021
d9aec37
Revert "Add sta"
jgimeno Jan 4, 2021
568f108
fix smoe weird problem
jgimeno Jan 4, 2021
a3eb478
fix smoe weird problem
jgimeno Jan 4, 2021
7b0e917
Update rosetta cli.
jgimeno Jan 4, 2021
2e3a652
Merge pull request #8253 from cosmos/jonathan/update-rosetta-cli
jgimeno Jan 5, 2021
2a6e0c2
Merge branch 'add-rosetta-master' of https://github.com/cosmos/cosmos…
fdymylja Jan 5, 2021
0272926
add: extend ros msg withdraw reward
fdymylja Jan 5, 2021
a29ac15
update validator addr
sahith-narahari Jan 5, 2021
89e34ac
Merge branch 'sahith/address-review' of github.com:cosmos/cosmos-sdk …
sahith-narahari Jan 5, 2021
a8dd59b
update ros file
sahith-narahari Jan 5, 2021
8dceebe
add amount
jgimeno Jan 5, 2021
6fb2456
add undelegate
sahith-narahari Jan 6, 2021
1d1c18f
update msg typw
sahith-narahari Jan 6, 2021
1698406
address comments
sahith-narahari Jan 6, 2021
05f8f1f
fix: use constants
fdymylja Jan 7, 2021
1645554
change: post tx in sync mode
fdymylja Jan 7, 2021
5947f2b
chore: clarify error message
fdymylja Jan 7, 2021
ba96466
chore: simplify and document operations to sdk msgs
fdymylja Jan 7, 2021
570b2dd
remove: construction payload operation check
fdymylja Jan 7, 2021
bca58fb
fix: operations minimum requirement checks
fdymylja Jan 7, 2021
c4e54e7
fix get tx
sahith-narahari Jan 7, 2021
73e2ab5
update tx.Tx
sahith-narahari Jan 7, 2021
822b68d
update test
sahith-narahari Jan 8, 2021
a79617e
update imports
sahith-narahari Jan 8, 2021
16e4400
Merge pull request #8247 from cosmos/sahith/address-review
jgimeno Jan 8, 2021
052d0fc
chore: fixes
fdymylja Jan 8, 2021
54b2cf7
add support for redelegate
sahith-narahari Jan 10, 2021
7189ef8
update constants
sahith-narahari Jan 11, 2021
a978fc4
goimports
sahith-narahari Jan 11, 2021
cffee3a
change: revisit adr with the latest changes
fdymylja Jan 11, 2021
81d308d
add: rosetta docs
fdymylja Jan 11, 2021
d14ddbc
Merge pull request #8288 from cosmos/sahith/add-redelegate
jgimeno Jan 12, 2021
0b8af06
Merge branch 'master' into add-rosetta-master
jgimeno Jan 12, 2021
7382363
document toml
jgimeno Jan 12, 2021
5416384
address little change by PR
jgimeno Jan 12, 2021
b399a94
Merge branch 'master' into add-rosetta-master
Jan 12, 2021
7749bfc
get the error
jgimeno Jan 12, 2021
1fa52aa
some minor chages
jgimeno Jan 12, 2021
56d11e7
add: undelegate tests with rosetta-cli
fdymylja Jan 12, 2021
d375113
add note for sign mode
sahith-narahari Jan 12, 2021
a50b92e
add version to client
jgimeno Jan 13, 2021
3b46221
Merge branch 'master' into add-rosetta-master
Jan 13, 2021
e5abbb6
Merge branch 'master' into add-rosetta-master
Jan 13, 2021
fbc5d37
now mempool shows tx
jgimeno Jan 14, 2021
0e8fd76
update version
jgimeno Jan 14, 2021
2282fdf
add default version
jgimeno Jan 14, 2021
f7c7152
Merge pull request #8331 from cosmos/jonathan/add-mempool-tx-endpoint
jgimeno Jan 14, 2021
c0e2905
change: disallow multiple msgs tx building
fdymylja Jan 14, 2021
46b4a26
Merge pull request #8305 from cosmos/fdymylja/rosetta-docs
jgimeno Jan 14, 2021
85c1a0a
Merge pull request #8335 from cosmos/fdymylja/rosetta-staking-tests
jgimeno Jan 14, 2021
3cc13a1
Move rosetta docs.
jgimeno Jan 15, 2021
7533b88
Merge pull request #8344 from cosmos/jonathan/docs-rosetta
jgimeno Jan 15, 2021
031abb3
resolve conflicts
Jan 18, 2021
5cdaaff
update gogo/protobuf
Jan 18, 2021
67f75c4
remove unnecessary dependency
Jan 18, 2021
07a1047
update cosmos-proto
Jan 18, 2021
03fb6a6
resolve conflicts
Jan 18, 2021
d920958
solve conflicts
Jan 18, 2021
41fa458
Merge branch 'master' into add-rosetta-master
Jan 18, 2021
66f4233
regenerate go.sum
Jan 18, 2021
7c630ba
Merge branch 'master' of github.com:cosmos/cosmos-sdk into add-rosett…
sahith-narahari Jan 19, 2021
c03c86f
run go mod tidy
sahith-narahari Jan 19, 2021
350e079
Merge pull request #8293 from cosmos/fdymylja/rosetta-update-adr
jgimeno Jan 20, 2021
d4e948f
Merge pull request #8336 from cosmos/fdymylja/rosetta-payload-preproc…
jgimeno Jan 20, 2021
bc0fd7b
Merge branch 'master' into add-rosetta-master
jgimeno Jan 20, 2021
504f212
Merge branch 'master' into add-rosetta-master
fedekunze Jan 20, 2021
785bacd
fix: ci bind address conflict
fdymylja Jan 20, 2021
8178c5d
Merge branch 'master' into add-rosetta-master
sahith-narahari Jan 21, 2021
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
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,23 @@ jobs:
name: "${{ github.sha }}-${{ matrix.part }}-race-output"
path: ./${{ matrix.part }}-race-output.txt

test-rosetta:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v4
id: git_diff
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: test rosetta
run: |
make test-rosetta
# if: env.GIT_DIFF

race-detector-report:
runs-on: ubuntu-latest
needs: [test-race, install-tparse]
Expand Down
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ test-cover:
@export VERSION=$(VERSION); bash -x contrib/test_cover.sh
.PHONY: test-cover

test-rosetta:
docker build -t rosetta-ci:latest -f contrib/rosetta/node/Dockerfile .
docker-compose -f contrib/rosetta/docker-compose.yaml up --abort-on-container-exit --exit-code-from test_rosetta --build
.PHONY: test-rosetta

benchmark:
@go test -mod=readonly -bench=. $(PACKAGES_NOSIMULATION)
.PHONY: benchmark
Expand Down Expand Up @@ -470,3 +475,15 @@ localnet-stop:
docker-compose down

.PHONY: localnet-start localnet-stop

###############################################################################
### rosetta ###
###############################################################################
# builds rosetta test data dir
rosetta-data:
-docker container rm data_dir_build
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a typo here. Also, is this line still needed (we have it in 478 as well)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the - supresses errors. required because in case the container name is taken we reclaim it.

docker build -t rosetta-ci:latest -f contrib/rosetta/node/Dockerfile .
docker run --name data_dir_build -t rosetta-ci:latest sh /rosetta/data.sh
docker cp data_dir_build:/tmp/data.tar.gz "$(CURDIR)/contrib/rosetta/node/data.tar.gz"
docker container rm data_dir_build
.PHONY: rosetta-data
2 changes: 1 addition & 1 deletion contrib/githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ f_check_cmds
if [[ $STAGED_GO_FILES != "" ]]; then
f_echo_stderr "[pre-commit] fmt'ing staged files..."
for file in $STAGED_GO_FILES; do
if [[ $file =~ vendor/ ]] || [[ $file =~ client/lcd/statik/ ]] || [[ $file =~ tests/mocks/ ]] || [[ $file =~ \.pb\.go ]]; then
if [[ $file =~ vendor/ ]] || [[ $file =~ client/docs/statik/ ]] || [[ $file =~ tests/mocks/ ]] || [[ $file =~ \.pb\.go ]]; then
continue
fi

Expand Down
24 changes: 24 additions & 0 deletions contrib/rosetta/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# rosetta

This directory contains the files required to run the rosetta CI. It builds `simapp` based on the current codebase.

## docker-compose.yaml

Builds:
- cosmos-sdk simapp node, with prefixed data directory, keys etc. This is required to test historical balances.
- faucet is required so we can test construction API, it was literally impossible to put there a deterministic address to request funds for
- rosetta is the rosetta node used by rosetta-cli to interact with the cosmos-sdk app
- test_rosetta runs the rosetta-cli test against construction API and data API

## configuration

Contains the required files to set up rosetta cli and make it work against its workflows

## node

Contains the files for a deterministic network, with fixed keys and some actions on there, to test parsing of msgs and historical balances.

## Notes

- Keyring password is 12345678
- data.sh creates node data, it's required in case consensus breaking changes are made to quickly recreate replicable node data for rosetta
12 changes: 12 additions & 0 deletions contrib/rosetta/configuration/bootstrap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"account_identifier": {
"address":"cosmos1hdmjfmqmf8ck4pv4evu0s3up0ucm0yjjqfl87e"
},
"currency":{
"symbol":"stake",
"decimals":0
},
"value": "999900000000"
}
]
58 changes: 58 additions & 0 deletions contrib/rosetta/configuration/data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/sh

set -e

wait_simd() {
timeout 30 sh -c 'until nc -z $0 $1; do sleep 1; done' localhost 9090
}
# this script is used to recreate the data dir
echo clearing /root/.simapp
rm -rf /root/.simapp
echo initting new chain
# init config files
simd init simd --chain-id testing

# create accounts
simd keys add fd --keyring-backend=test

addr=$(simd keys show fd -a --keyring-backend=test)

# give the accounts some money
simd add-genesis-account "$addr" 1000000000000stake --keyring-backend=test

# save configs for the daemon
simd gentx fd --chain-id testing --keyring-backend=test

# input genTx to the genesis file
simd collect-gentxs
# verify genesis file is fine
simd validate-genesis
echo changing network settings
sed -i 's/127.0.0.1/0.0.0.0/g' /root/.simapp/config/config.toml

# start simd
echo starting simd...
simd start --pruning=nothing &
pid=$!
echo simd started with PID $pid

echo awaiting for simd to be ready
wait_simd
echo simd is ready
sleep 10


# send transaction to deterministic address
echo sending transaction with addr $addr
simd tx bank send "$addr" cosmos1wjmt63j4fv9nqda92nsrp2jp2vsukcke4va3pt 100stake --yes --keyring-backend=test --broadcast-mode=block --chain-id=testing

sleep 10

echo stopping simd...
kill -9 $pid

echo zipping data dir and saving to /tmp/data.tar.gz

tar -czvf /tmp/data.tar.gz /root/.simapp

echo new address for bootstrap.json "$addr"
25 changes: 25 additions & 0 deletions contrib/rosetta/configuration/faucet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from http.server import HTTPServer, BaseHTTPRequestHandler
import subprocess

import os


class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):

def do_POST(self):
try:
content_len = int(self.headers.get('Content-Length'))
addr = self.rfile.read(content_len).decode("utf-8")
print("sending funds to " + addr)
subprocess.call(['sh', './send_funds.sh', addr])
self.send_response(200)
self.end_headers()
except Exception as e:
print("failed " + str(e))
os._exit(1)


if __name__ == "__main__":
print("starting faucet server...")
httpd = HTTPServer(('0.0.0.0', 8000), SimpleHTTPRequestHandler)
httpd.serve_forever()
51 changes: 51 additions & 0 deletions contrib/rosetta/configuration/rosetta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"network": {
"blockchain": "app",
"network": "network"
},
"online_url": "http://rosetta:8080",
"data_directory": "",
"http_timeout": 300,
"max_retries": 5,
"retry_elapsed_time": 0,
"max_online_connections": 0,
"max_sync_concurrency": 0,
"tip_delay": 60,
"log_configuration": true,
"construction": {
"offline_url": "http://rosetta:8080",
"max_offline_connections": 0,
"stale_depth": 0,
"broadcast_limit": 0,
"ignore_broadcast_failures": false,
"clear_broadcasts": false,
"broadcast_behind_tip": false,
"block_broadcast_limit": 0,
"rebroadcast_all": false,
"constructor_dsl_file": "transfer.ros",
"end_conditions": {
"create_account": 1,
"transfer": 3
}
},
"data": {
"active_reconciliation_concurrency": 0,
"inactive_reconciliation_concurrency": 0,
"inactive_reconciliation_frequency": 0,
"log_blocks": false,
"log_transactions": false,
"log_balance_changes": false,
"log_reconciliations": false,
"ignore_reconciliation_error": false,
"exempt_accounts": "",
"bootstrap_balances": "bootstrap.json",
"interesting_accounts": "",
"reconciliation_disabled": false,
"inactive_discrepency_search_disabled": false,
"balance_tracking_disabled": false,
"coin_tracking_disabled": false,
"end_conditions": {
"tip": true
}
}
}
29 changes: 29 additions & 0 deletions contrib/rosetta/configuration/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

set -e

addr="abcd"

send_tx() {
echo '12345678' | simd tx bank send $addr "$1" "$2"
}

detect_account() {
line=$1
}

wait_for_rosetta() {
timeout 30 sh -c 'until nc -z $0 $1; do sleep 1; done' rosetta 8080
}

echo "waiting for rosetta instance to be up"
wait_for_rosetta

echo "checking data API"
rosetta-cli check:data --configuration-file ./config/rosetta.json

echo "checking construction API"
rosetta-cli check:construction --configuration-file ./config/rosetta.json

echo "checking staking API"
rosetta-cli check:construction --configuration-file ./config/staking.json
5 changes: 5 additions & 0 deletions contrib/rosetta/configuration/send_funds.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

set -e
addr=$(simd keys show fd -a --keyring-backend=test)
echo "12345678" | simd tx bank send "$addr" "$1" 100stake --chain-id="testing" --node tcp://cosmos:26657 --yes --keyring-backend=test
30 changes: 30 additions & 0 deletions contrib/rosetta/configuration/staking.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"network": {
"blockchain": "app",
"network": "network"
},
"online_url": "http://rosetta:8080",
"data_directory": "",
"http_timeout": 300,
"max_retries": 5,
"retry_elapsed_time": 0,
"max_online_connections": 0,
"max_sync_concurrency": 0,
"tip_delay": 60,
"log_configuration": true,
"construction": {
"offline_url": "http://rosetta:8080",
"max_offline_connections": 0,
"stale_depth": 0,
"broadcast_limit": 0,
"ignore_broadcast_failures": false,
"clear_broadcasts": false,
"broadcast_behind_tip": false,
"block_broadcast_limit": 0,
"rebroadcast_all": false,
"constructor_dsl_file": "staking.ros",
"end_conditions": {
"staking": 3
}
}
}
Loading