Skip to content

Commit

Permalink
Workaround the missing disappearing token transfer issue (#3289)
Browse files Browse the repository at this point in the history
- Add workaround for the missing disappearing token transfer issue
- Improve nft balance tracking performance
- Only show token related data for tokens created after genesis timestmap
- Update rosetta-cli check:data configuration to sync from index 1
- Remove genesis token balance retrieval logic in get-genesis-balance.sh
- Update rosetta github workflow to not generate genesis balance JSON file
- Fix bug that importer start date can't be changed
- Enable supervisorctl
- Fix issue that the supervisord process doesn't get SIGTERM sent by docker stop
- Set stopwaitsecs for importer and postgres for graceful shutdown
- Update postgres config for normal operation

Signed-off-by: Xin Li <xin.li@hedera.com>
Signed-off-by: Matheus DallRosa <matheus.dallrosa@swirlds.com>
  • Loading branch information
xin-hedera authored and matheus-dallrosa committed Feb 21, 2022
1 parent 713dbb2 commit 4751de2
Show file tree
Hide file tree
Showing 36 changed files with 1,818 additions and 927 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/rosetta-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
-e NETWORK=testnet \
-v /tmp/application_importer.yml:/app/importer/application.yml \
-v /tmp/application_rosetta.yml:/app/rosetta/application.yml \
-p 5432:5432 -p 5700:5700 "${MODULE}:latest")
-p 5700:5700 "${MODULE}:latest")
echo "ONLINE_CONTAINER_ID=$ONLINE_CONTAINER_ID" >> $GITHUB_ENV
- name: Run Mirror Node in Offline Mode
Expand All @@ -152,9 +152,6 @@ jobs:
env:
MAX_WAIT_SECONDS: 240

- name: Get Genesis Account Balances
run: ./scripts/validation/get-genesis-balance.sh testnet

- name: Rosetta CLI Configuration
run: |
# add prefunded accounts for construction validation, override construction offline_url
Expand Down
16 changes: 10 additions & 6 deletions docs/rosetta/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Configure and run the server in online mode:

```shell
docker run -d -e MODE=online -e NETWORK=testnet \
-v ./application.yml:/app/importer/application.yml \
-v ${PWD}/application.yml:/app/importer/application.yml \
-p 5432:5432 -p 5700:5700 hedera-mirror-rosetta:0.49.1
```

Expand All @@ -100,11 +100,15 @@ This can be done using the shell
script [wait-for-mirror-node.sh](/hedera-mirror-rosetta/scripts/wait-for-mirror-node.sh). The script will report that
mirror node syncing has started when the genesis information is available.

In order to run the rosetta-cli `check:data` command, run the
[script](/hedera-mirror-rosetta/scripts/validation/get-genesis-balance.sh) with the associated
[configuration file](/hedera-mirror-rosetta/scripts/validation/testnet/validation.json) to get the genesis account
balance file. Once the `get-genesis-balance.sh testnet` command is executed, it'll write the file
to `testnet/data_genesis_balances.json`. Note the script uses PostgreSQL's command line client psql to query the
A sample [configuration file](/hedera-mirror-rosetta/scripts/validation/testnet/validation.json) is provided to run
rosetta-cli tests. Please refer to [the official guide](https://docs.cloud.coinbase.com/rosetta/docs/configuration-file)
for the options.

You can run the rosetta-cli `check:data` command as is. The data configuration section is set with `"start_index": 1`
to work around the known `rosetta-cli` performance issue of loading large genesis account balance file. As an
alternative, use the [script](/hedera-mirror-rosetta/scripts/validation/get-genesis-balance.sh) to get the
genesis account balance file. Once the `get-genesis-balance.sh testnet` command is executed, it'll write the file to
`testnet/data_genesis_balances.json`. Note the script uses PostgreSQL's command line client psql to query the
database for genesis account balance information, so please install psql beforehand.

In order to run the rosetta-cli `check:construction` command with the DSL spec in `testnet`/`testnet.ros`, you need two
Expand Down
7 changes: 0 additions & 7 deletions hedera-mirror-rosetta/app/interfaces/account_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

rTypes "github.com/coinbase/rosetta-sdk-go/types"
"github.com/hashgraph/hedera-mirror-node/hedera-mirror-rosetta/app/domain/types"
"github.com/hashgraph/hedera-mirror-node/hedera-mirror-rosetta/app/persistence/domain"
)

// AccountRepository Interface that all AccountRepository structs must implement
Expand All @@ -37,10 +36,4 @@ type AccountRepository interface {
// if the account is deleted at T1 and T1 <= consensusEnd, the balance is calculated as
// balance = balanceAtLatestBalanceSnapshotBeforeT1 + balanceChangeBetweenSnapshotAndT1
RetrieveBalanceAtBlock(ctx context.Context, accountId, consensusEnd int64) ([]types.Amount, *rTypes.Error)

// RetrieveEverOwnedTokensByBlock returns the tokens the account has ever owned by the block's consensusEnd
RetrieveEverOwnedTokensByBlock(ctx context.Context, accountId, consensusEnd int64) (
[]domain.Token,
*rTypes.Error,
)
}
Loading

0 comments on commit 4751de2

Please sign in to comment.