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] implement balance tracking and redo tx construction #8729

Merged
merged 39 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
702ea89
change(rosetta): data api block and tx parsing
fdymylja Mar 1, 2021
8f711a1
change(rosetta): finalize data API
fdymylja Mar 1, 2021
ab91ce3
add: converter
fdymylja Mar 3, 2021
b3bf68b
fix: casting error message
fdymylja Mar 3, 2021
593f26d
change: rework construction API to support every possible transaction…
fdymylja Mar 4, 2021
fbdeabc
change: make construction stateless
fdymylja Mar 4, 2021
232d83f
chore: cleanup api
fdymylja Mar 4, 2021
b43553e
chore: cleanup api
fdymylja Mar 4, 2021
e2b1a01
chore: reorder methods declaration
fdymylja Mar 5, 2021
5292379
add: signed tx tests
fdymylja Mar 5, 2021
976f2e2
add: ops and signers test
fdymylja Mar 5, 2021
a489652
fix: begin and endblock tx conversions
fdymylja Mar 5, 2021
18bd9e3
add: begin and endblock invalid tests
fdymylja Mar 5, 2021
a32c005
add: balance and signing components tests
fdymylja Mar 5, 2021
9ad9d28
change: remove staking tests
fdymylja Mar 5, 2021
52be187
Merge branch 'master' into frojdi/rosetta-balance-tracking
fdymylja Mar 5, 2021
7375263
chore: lint
fdymylja Mar 5, 2021
2246c6c
chore: lint
fdymylja Mar 5, 2021
4377a09
revert: makefile rosetta test
fdymylja Mar 5, 2021
a1f82bc
chore: lint again
fdymylja Mar 5, 2021
89de69c
chore: move tests to package based ones
fdymylja Mar 5, 2021
687aef2
chore: lint
fdymylja Mar 5, 2021
8a9a140
chore: lint
fdymylja Mar 5, 2021
bf428f4
chore: cleanup ci
fdymylja Mar 5, 2021
c7da349
Merge branch 'master' into frojdi/rosetta-balance-tracking
Mar 5, 2021
8af9112
Merge branch 'master' into frojdi/rosetta-balance-tracking
Mar 5, 2021
b3f5410
chore: address documentation changes
fdymylja Mar 5, 2021
0bb7b16
chore: address documentation changes
fdymylja Mar 5, 2021
daeb5f0
Merge branch 'master' into frojdi/rosetta-balance-tracking
fdymylja Mar 5, 2021
fe10978
Merge branch 'master' into frojdi/rosetta-balance-tracking
Mar 10, 2021
57e684a
Update docs server/rosetta/client_online.go
fdymylja Mar 11, 2021
0c3bad6
Update docs server/rosetta/client_online.go
fdymylja Mar 11, 2021
d6e1622
cleanup spacing server/rosetta/converter_test.go
fdymylja Mar 11, 2021
f28f18d
revert: baseapp.md
fdymylja Mar 11, 2021
2f7a5c8
add: docs for interface implementation
fdymylja Mar 11, 2021
9fda8a2
remove: converter_test.go utils anonymous type
fdymylja Mar 11, 2021
958fba5
change: set interface name constant
fdymylja Mar 11, 2021
6354cfa
chore: add CHANGELOG.md entry
fdymylja Mar 11, 2021
3e47bb4
Merge branch 'master' into frojdi/rosetta-balance-tracking
Mar 11, 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
2 changes: 1 addition & 1 deletion contrib/rosetta/configuration/bootstrap.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"account_identifier": {
"address":"cosmos158nkd0l9tyemv2crp579rmj8dg37qty8lzff88"
"address":"cosmos1ujtnemf6jmfm995j000qdry064n5lq854gfe3j"
},
"currency":{
"symbol":"stake",
Expand Down
2 changes: 1 addition & 1 deletion contrib/rosetta/configuration/data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ 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
simd tx bank send "$addr" cosmos19g9cm8ymzchq2qkcdv3zgqtwayj9asv3hjv5u5 100stake --yes --keyring-backend=test --broadcast-mode=block --chain-id=testing

sleep 10

Expand Down
2 changes: 1 addition & 1 deletion contrib/rosetta/configuration/rosetta.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"constructor_dsl_file": "transfer.ros",
"end_conditions": {
"create_account": 1,
"transfer": 3
"transfer": 1
}
},
"data": {
Expand Down
12 changes: 0 additions & 12 deletions contrib/rosetta/configuration/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@

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
}
Expand All @@ -25,5 +15,3 @@ 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
30 changes: 0 additions & 30 deletions contrib/rosetta/configuration/staking.json

This file was deleted.

147 changes: 0 additions & 147 deletions contrib/rosetta/configuration/staking.ros

This file was deleted.

40 changes: 18 additions & 22 deletions contrib/rosetta/configuration/transfer.ros
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ request_funds(1){
loaded_account = find_balance({
"account_identifier": {{random_account.account_identifier}},
"minimum_balance":{
"value": "100",
"value": "50",
"currency": {{currency}}
}
});
Expand Down Expand Up @@ -57,6 +57,8 @@ transfer(3){
"currency": {{currency}}
}
});
acc_identifier = {{sender.account_identifier}};
sender_address = {{acc_identifier.address}};
// Set the recipient_amount as some value <= sender.balance-max_fee
max_fee = "0";
fee_amount = "1";
Expand All @@ -76,34 +78,28 @@ transfer(3){
"create_probability": 50
});
transfer.confirmation_depth = "1";
recipient_account_identifier = {{recipient.account_identifier}};
recipient_address = {{recipient_account_identifier.address}};
transfer.operations = [
{
"operation_identifier":{"index":0},
"type":"fee",
"account":{{sender.account_identifier}},
"amount":{
"value":{{fee_value}},
"currency":{{currency}}
}
},
{
"operation_identifier":{"index":1},
"type":"cosmos.bank.v1beta1.MsgSend",
"account":{{sender.account_identifier}},
"amount":{
"value":{{sender_amount}},
"currency":{{currency}}
}
},
{
"operation_identifier":{"index":2},
"type":"cosmos.bank.v1beta1.MsgSend",
"account":{{recipient.account_identifier}},
"amount":{
"value":{{recipient_amount}},
"currency":{{currency}}
"metadata": {
"amount": [
{
"amount": {{recipient_amount}},
"denom": {{currency.symbol}}
}
],
"from_address": {{sender_address}},
"to_address": {{recipient_address}}
}
}
];
transfer.preprocess_metadata = {
"gas_price": "1stake",
"gas_limit": 250000
};
}
}
Binary file modified contrib/rosetta/node/data.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/core/baseapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Finally, a few more important parameterd:

```go
func NewBaseApp(
name string, logger log.Logger, db dbm.DB, txDecoder sdk.TxDecoder, options ...func(*BaseApp),
name string, logger log.Logger, db dbm.DB, txDecode sdk.TxDecoder, options ...func(*BaseApp),
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 the original name is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i refactored something somewhere in the code and this got affected too! thanks for pointing it out!

) *BaseApp {

// ...
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ require (
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
github.com/tendermint/btcd v0.1.1
github.com/tendermint/cosmos-rosetta-gateway v0.3.0-rc2
github.com/tendermint/cosmos-rosetta-gateway v0.3.0-rc2.0.20210304154332-87d6ca4410df
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15
github.com/tendermint/go-amino v0.16.0
github.com/tendermint/tendermint v0.34.8
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,8 @@ github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzH
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8=
github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s=
github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U=
github.com/tendermint/cosmos-rosetta-gateway v0.3.0-rc2 h1:crekJuQ57yIBDuKd3/dMJ00ZvOHURuv9RGJSi2hWTW4=
github.com/tendermint/cosmos-rosetta-gateway v0.3.0-rc2/go.mod h1:gBPw8WV2Erm4UGHlBRiM3zaEBst4bsuihmMCNQdgP/s=
github.com/tendermint/cosmos-rosetta-gateway v0.3.0-rc2.0.20210304154332-87d6ca4410df h1:hoMLrOS4WyyMM+Y+iWdGu94o0zzp6Q43y7v89Q1/OIw=
github.com/tendermint/cosmos-rosetta-gateway v0.3.0-rc2.0.20210304154332-87d6ca4410df/go.mod h1:gBPw8WV2Erm4UGHlBRiM3zaEBst4bsuihmMCNQdgP/s=
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI=
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk=
github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E=
Expand Down
Loading