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

Binary port balance query #274

Merged

Conversation

jacek-casper
Copy link

@jacek-casper jacek-casper commented Apr 8, 2024

Modifies existing GetBalance and QueryBalance and adds QueryBalanceDetails.

Depends on: casper-network/casper-node#4645

casperlabs-bors-ng bot added a commit to casper-network/casper-node that referenced this pull request Apr 9, 2024
4645: Binary port balance query r=jacek-casper a=jacek-casper

This PR adds a new request to the binary port that allows querying for balance directly.
- I've added some additional types to `binary_port`, they're very similar to the existing `storage` types, with some slight adjustments to adapt them to the binary port:
  - added `BalanceResponse` for the new response payload type
  - added `PurseIdentifier` for specifying what balance to query, it's basically `BalanceIdentifier`, but without PenalizedAccount and Internal variants (these two look like they're for internal use only)
  - added `GlobalStateRequest::BalanceByStateRoot`, which has a state identifier, a purse identifier and a timestamp for holds lookup, it uses a `Timestamp` unlike the `storage` types which use `HoldsEpoch`, because `HoldsEpoch` requires a chainspec value to construct (balance hold interval)
  - added `GlobalStateRequest::BalanceByBlock`, which has a block identifier and a purse identifier, the holds timestamp is derived from the block

Also:
- boxed the `GetRequest::State` variant because it started triggering a lint
- added some missing handling for `WasmV1Result`

Related sidecar changes: casper-network/casper-sidecar#274

4650: Fix a bug in the BlockValidator r=fizyk20 a=fizyk20

Closes #4619 

This is a simple, slightly hacky approach to solving the issue - but a less hacky one involving adding more variants to `BlockValidationState` and storing the state immediately after receiving a request turned out to become quite complex, which is why I chose this way eventually.


4653: Use custom Serialize/Deserialize for EntityAddr r=jacek-casper a=jacek-casper

The existing Serialize/Deserialize impls encode the address as a JSON array of bytes instead of the formatted string format. This PR fixes that.

There was also an issue with the schema, which I addressed here as well.

Co-authored-by: Jacek Malec <[email protected]>
Co-authored-by: Bartłomiej Kamiński <[email protected]>
casperlabs-bors-ng bot added a commit to casper-network/casper-node that referenced this pull request Apr 9, 2024
4645: Binary port balance query r=jacek-casper a=jacek-casper

This PR adds a new request to the binary port that allows querying for balance directly.
- I've added some additional types to `binary_port`, they're very similar to the existing `storage` types, with some slight adjustments to adapt them to the binary port:
  - added `BalanceResponse` for the new response payload type
  - added `PurseIdentifier` for specifying what balance to query, it's basically `BalanceIdentifier`, but without PenalizedAccount and Internal variants (these two look like they're for internal use only)
  - added `GlobalStateRequest::BalanceByStateRoot`, which has a state identifier, a purse identifier and a timestamp for holds lookup, it uses a `Timestamp` unlike the `storage` types which use `HoldsEpoch`, because `HoldsEpoch` requires a chainspec value to construct (balance hold interval)
  - added `GlobalStateRequest::BalanceByBlock`, which has a block identifier and a purse identifier, the holds timestamp is derived from the block

Also:
- boxed the `GetRequest::State` variant because it started triggering a lint
- added some missing handling for `WasmV1Result`

Related sidecar changes: casper-network/casper-sidecar#274

4650: Fix a bug in the BlockValidator r=fizyk20 a=fizyk20

Closes #4619 

This is a simple, slightly hacky approach to solving the issue - but a less hacky one involving adding more variants to `BlockValidationState` and storing the state immediately after receiving a request turned out to become quite complex, which is why I chose this way eventually.


Co-authored-by: Jacek Malec <[email protected]>
Co-authored-by: Bartłomiej Kamiński <[email protected]>
casperlabs-bors-ng bot added a commit to casper-network/casper-node that referenced this pull request Apr 9, 2024
4645: Binary port balance query r=jacek-casper a=jacek-casper

This PR adds a new request to the binary port that allows querying for balance directly.
- I've added some additional types to `binary_port`, they're very similar to the existing `storage` types, with some slight adjustments to adapt them to the binary port:
  - added `BalanceResponse` for the new response payload type
  - added `PurseIdentifier` for specifying what balance to query, it's basically `BalanceIdentifier`, but without PenalizedAccount and Internal variants (these two look like they're for internal use only)
  - added `GlobalStateRequest::BalanceByStateRoot`, which has a state identifier, a purse identifier and a timestamp for holds lookup, it uses a `Timestamp` unlike the `storage` types which use `HoldsEpoch`, because `HoldsEpoch` requires a chainspec value to construct (balance hold interval)
  - added `GlobalStateRequest::BalanceByBlock`, which has a block identifier and a purse identifier, the holds timestamp is derived from the block

Also:
- boxed the `GetRequest::State` variant because it started triggering a lint
- added some missing handling for `WasmV1Result`

Related sidecar changes: casper-network/casper-sidecar#274

Co-authored-by: Jacek Malec <[email protected]>
casperlabs-bors-ng bot added a commit to casper-network/casper-node that referenced this pull request Apr 10, 2024
4645: Binary port balance query r=jacek-casper a=jacek-casper

This PR adds a new request to the binary port that allows querying for balance directly.
- I've added some additional types to `binary_port`, they're very similar to the existing `storage` types, with some slight adjustments to adapt them to the binary port:
  - added `BalanceResponse` for the new response payload type
  - added `PurseIdentifier` for specifying what balance to query, it's basically `BalanceIdentifier`, but without PenalizedAccount and Internal variants (these two look like they're for internal use only)
  - added `GlobalStateRequest::BalanceByStateRoot`, which has a state identifier, a purse identifier and a timestamp for holds lookup, it uses a `Timestamp` unlike the `storage` types which use `HoldsEpoch`, because `HoldsEpoch` requires a chainspec value to construct (balance hold interval)
  - added `GlobalStateRequest::BalanceByBlock`, which has a block identifier and a purse identifier, the holds timestamp is derived from the block

Also:
- boxed the `GetRequest::State` variant because it started triggering a lint
- added some missing handling for `WasmV1Result`

Related sidecar changes: casper-network/casper-sidecar#274

4653: Use custom Serialize/Deserialize for EntityAddr r=jacek-casper a=jacek-casper

The existing Serialize/Deserialize impls encode the address as a JSON array of bytes instead of the formatted string format. This PR fixes that.

There was also an issue with the schema, which I addressed here as well.

Co-authored-by: Jacek Malec <[email protected]>
casperlabs-bors-ng bot added a commit to casper-network/casper-node that referenced this pull request Apr 10, 2024
4645: Binary port balance query r=jacek-casper a=jacek-casper

This PR adds a new request to the binary port that allows querying for balance directly.
- I've added some additional types to `binary_port`, they're very similar to the existing `storage` types, with some slight adjustments to adapt them to the binary port:
  - added `BalanceResponse` for the new response payload type
  - added `PurseIdentifier` for specifying what balance to query, it's basically `BalanceIdentifier`, but without PenalizedAccount and Internal variants (these two look like they're for internal use only)
  - added `GlobalStateRequest::BalanceByStateRoot`, which has a state identifier, a purse identifier and a timestamp for holds lookup, it uses a `Timestamp` unlike the `storage` types which use `HoldsEpoch`, because `HoldsEpoch` requires a chainspec value to construct (balance hold interval)
  - added `GlobalStateRequest::BalanceByBlock`, which has a block identifier and a purse identifier, the holds timestamp is derived from the block

Also:
- boxed the `GetRequest::State` variant because it started triggering a lint
- added some missing handling for `WasmV1Result`

Related sidecar changes: casper-network/casper-sidecar#274

4653: Use custom Serialize/Deserialize for EntityAddr r=jacek-casper a=jacek-casper

The existing Serialize/Deserialize impls encode the address as a JSON array of bytes instead of the formatted string format. This PR fixes that.

There was also an issue with the schema, which I addressed here as well.

Co-authored-by: Jacek Malec <[email protected]>
@jacek-casper jacek-casper marked this pull request as ready for review April 10, 2024 18:41
@jacek-casper jacek-casper requested review from rafal-ch and zajko April 11, 2024 11:05
Copy link

@rafal-ch rafal-ch left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@jacek-casper jacek-casper merged commit c87274d into casper-network:feat-2.0 Apr 11, 2024
2 checks passed
@jacek-casper jacek-casper deleted the binary-port-balance-query branch April 11, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants