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

/account/balance staking support #206

Closed
AlanVerbner opened this issue Nov 2, 2020 · 1 comment · Fixed by #213
Closed

/account/balance staking support #206

AlanVerbner opened this issue Nov 2, 2020 · 1 comment · Fixed by #213
Assignees
Labels
data-api enhancement New feature or request
Projects
Milestone

Comments

@AlanVerbner
Copy link
Contributor

AlanVerbner commented Nov 2, 2020

As we will be introducing staking functionality, we also need to be able to return staking account balances. We need to provide the balance of a staking account at a certain block number. To do so, we need to let people to query for an account based on a stake address.

The response format should not change but different tables will need to be queried when looking for a stake address.

  1. This query could be used as as a starting point although don't forget to consider the withdrawals.
  2. We can switch thery by address bech32 preffix (stake, stake_test)
  3. Update src/server/services/block-service.ts#findUtxoByAddressAndBlock to:
    1. Switch based on the address type and perform different queries
    2. Update the interface to return something for stake and non stake accounts.
    3. Update src/server/utils/data-mapper.ts#mapToAccountBalanceResponse to properly map the new type (do not include utxos in case of staking

Testing

As mentioned in #208 we cannot use a db-snapshot therefore some blocks will need to be inserter to fake data.

  1. Check our e2e suite is still working (no actions needed)
  2. Add new tests to the current ones. To do so, we will need to manually insert a fake blocks:
    • A block were a reward is received
    • A block were another reward is received (in order to test the sum is working)
    • A block with a withdrawal to check staking account balance has been reduced
  3. We need to be make sure rosetta-cli check:data still works
    1. Deploy the new version (using the commit as build context for docker) on our mainnet testing server.
    2. Execute check:data for a block range containing block TBD.
    3. Execute check:data for the whole chain.
@AlanVerbner AlanVerbner created this issue from a note in staking (To Do) Nov 2, 2020
@AlanVerbner AlanVerbner added data-api enhancement New feature or request labels Nov 2, 2020
@AlanVerbner AlanVerbner self-assigned this Nov 2, 2020
@AlanVerbner AlanVerbner added this to the phase 2 milestone Nov 8, 2020
@jvieiro jvieiro moved this from To Do to In Progress in staking Nov 10, 2020
jvieiro pushed a commit that referenced this issue Nov 12, 2020
Create findBalanceByAddressAndBlock query in blockchain-queries.ts, findBalanceByAddressAndBlock in blockchain-repository.ts and BlockBalance in models.ts

Refs #206
jvieiro pushed a commit that referenced this issue Nov 12, 2020
Update findUtxoByAddressAndBlock interface for stake accounts and create function getPrefixFromAddress

Refs #206
jvieiro pushed a commit that referenced this issue Nov 12, 2020
jvieiro pushed a commit that referenced this issue Nov 13, 2020
change number type for string

Refs #206
jvieiro pushed a commit that referenced this issue Nov 13, 2020
jvieiro pushed a commit that referenced this issue Nov 13, 2020
change name and balance type

Refs #206
jvieiro pushed a commit that referenced this issue Nov 13, 2020
Create findBalanceByAddressAndBlock query in blockchain-queries.ts, findBalanceByAddressAndBlock in blockchain-repository.ts and BlockBalance in models.ts

Refs #206
jvieiro pushed a commit that referenced this issue Nov 13, 2020
Update findUtxoByAddressAndBlock interface for stake accounts and create function getPrefixFromAddress

Refs #206
jvieiro pushed a commit that referenced this issue Nov 13, 2020
jvieiro pushed a commit that referenced this issue Nov 13, 2020
change number type for string

Refs #206
jvieiro pushed a commit that referenced this issue Nov 13, 2020
jvieiro pushed a commit that referenced this issue Nov 13, 2020
change name and balance type

Refs #206
jvieiro pushed a commit that referenced this issue Nov 13, 2020
jvieiro pushed a commit that referenced this issue Nov 13, 2020
Add cardanoService for blockService in services.ts

Refs #206
jvieiro pushed a commit that referenced this issue Nov 13, 2020
jvieiro pushed a commit that referenced this issue Nov 13, 2020
jvieiro pushed a commit that referenced this issue Nov 13, 2020
jvieiro pushed a commit that referenced this issue Nov 16, 2020
change name for a more generic one and handle properly stake accounts

Refs #206
jvieiro pushed a commit that referenced this issue Nov 25, 2020
Update findUtxoByAddressAndBlock interface for stake accounts and create function getPrefixFromAddress

Refs #206
jvieiro pushed a commit that referenced this issue Nov 25, 2020
jvieiro pushed a commit that referenced this issue Nov 25, 2020
change number type for string

Refs #206
jvieiro pushed a commit that referenced this issue Nov 25, 2020
jvieiro pushed a commit that referenced this issue Nov 25, 2020
change name and balance type

Refs #206
jvieiro pushed a commit that referenced this issue Nov 25, 2020
jvieiro pushed a commit that referenced this issue Nov 25, 2020
Add cardanoService for blockService in services.ts

Refs #206
jvieiro pushed a commit that referenced this issue Nov 25, 2020
jvieiro pushed a commit that referenced this issue Nov 25, 2020
jvieiro pushed a commit that referenced this issue Nov 25, 2020
jvieiro pushed a commit that referenced this issue Nov 25, 2020
change name for a more generic one and handle properly stake accounts

Refs #206
jvieiro pushed a commit that referenced this issue Nov 25, 2020
change response expected for stake account test

Refs #206
jvieiro pushed a commit that referenced this issue Nov 26, 2020
jvieiro pushed a commit that referenced this issue Nov 26, 2020
jvieiro pushed a commit that referenced this issue Nov 26, 2020
change name for a more generic one and handle properly stake accounts

Refs #206
jvieiro pushed a commit that referenced this issue Nov 26, 2020
tomasBustamante pushed a commit that referenced this issue Nov 27, 2020
* feat: Handle stake accounts in account/balance

Refs #206

* test: add stake account test

Refs #206

* refactor: refact findUtxoByAddressAndBlock function

change name for a more generic one and handle properly stake accounts

Refs #206

* test: add data set for rewards

Refs #206

* fix: fix account balance query

* test: add stake account balance tests

* refactor: create isStakeAddress function

* test: adapt fixture data for account balance

* fix: fix account balance query
Use block id as filter
AlanVerbner pushed a commit that referenced this issue Nov 28, 2020
* feat: Handle stake accounts in account/balance

Refs #206

* test: add stake account test

Refs #206

* refactor: refact findUtxoByAddressAndBlock function

change name for a more generic one and handle properly stake accounts

Refs #206

* test: add data set for rewards

Refs #206

* fix: fix account balance query

* test: add stake account balance tests

* refactor: create isStakeAddress function

* test: adapt fixture data for account balance

* fix: fix account balance query
Use block id as filter
@tomasBustamante tomasBustamante moved this from Review In Progress to Reviewer Approved in staking Dec 1, 2020
@tomasBustamante tomasBustamante moved this from Reviewer Approved to Done in staking Dec 1, 2020
AlanVerbner pushed a commit that referenced this issue Dec 2, 2020
* feat: Handle stake accounts in account/balance

Refs #206

* test: add stake account test

Refs #206

* refactor: refact findUtxoByAddressAndBlock function

change name for a more generic one and handle properly stake accounts

Refs #206

* test: add data set for rewards

Refs #206

* fix: fix account balance query

* test: add stake account balance tests

* refactor: create isStakeAddress function

* test: adapt fixture data for account balance

* fix: fix account balance query
Use block id as filter
rhyslbw pushed a commit that referenced this issue Dec 4, 2020
* feat: Handle stake accounts in account/balance

Refs #206

* test: add stake account test

Refs #206

* refactor: refact findUtxoByAddressAndBlock function

change name for a more generic one and handle properly stake accounts

Refs #206

* test: add data set for rewards

Refs #206

* fix: fix account balance query

* test: add stake account balance tests

* refactor: create isStakeAddress function

* test: adapt fixture data for account balance

* fix: fix account balance query
Use block id as filter
AlanVerbner pushed a commit that referenced this issue Dec 7, 2020
* feat: Handle stake accounts in account/balance

Refs #206

* test: add stake account test

Refs #206

* refactor: refact findUtxoByAddressAndBlock function

change name for a more generic one and handle properly stake accounts

Refs #206

* test: add data set for rewards

Refs #206

* fix: fix account balance query

* test: add stake account balance tests

* refactor: create isStakeAddress function

* test: adapt fixture data for account balance

* fix: fix account balance query
Use block id as filter
AlanVerbner pushed a commit that referenced this issue Dec 8, 2020
* feat: Handle stake accounts in account/balance

Refs #206

* test: add stake account test

Refs #206

* refactor: refact findUtxoByAddressAndBlock function

change name for a more generic one and handle properly stake accounts

Refs #206

* test: add data set for rewards

Refs #206

* fix: fix account balance query

* test: add stake account balance tests

* refactor: create isStakeAddress function

* test: adapt fixture data for account balance

* fix: fix account balance query
Use block id as filter
AlanVerbner pushed a commit that referenced this issue Dec 11, 2020
* feat: Handle stake accounts in account/balance

Refs #206

* test: add stake account test

Refs #206

* refactor: refact findUtxoByAddressAndBlock function

change name for a more generic one and handle properly stake accounts

Refs #206

* test: add data set for rewards

Refs #206

* fix: fix account balance query

* test: add stake account balance tests

* refactor: create isStakeAddress function

* test: adapt fixture data for account balance

* fix: fix account balance query
Use block id as filter
AlanVerbner pushed a commit that referenced this issue Dec 11, 2020
* feat: Handle stake accounts in account/balance

Refs #206

* test: add stake account test

Refs #206

* refactor: refact findUtxoByAddressAndBlock function

change name for a more generic one and handle properly stake accounts

Refs #206

* test: add data set for rewards

Refs #206

* fix: fix account balance query

* test: add stake account balance tests

* refactor: create isStakeAddress function

* test: adapt fixture data for account balance

* fix: fix account balance query
Use block id as filter
@AlanVerbner
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data-api enhancement New feature or request
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants