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

Support ZSAs in zebra-state #8990

Open
arya2 opened this issue Nov 4, 2024 · 0 comments
Open

Support ZSAs in zebra-state #8990

arya2 opened this issue Nov 4, 2024 · 0 comments
Assignees
Labels
A-consensus Area: Consensus rule updates A-state Area: State / database changes NU-7 Network Upgrade: NU7 specific tasks

Comments

@arya2
Copy link
Contributor

arya2 commented Nov 4, 2024

Motivation

ZIP 227: Global Issuance State defines a map, issued_assets, of AssetBase and AssetState ("amount of the Asset in circulation" and whether the asset has been finalized such that no more of the asset may be issued). This is used to contextually validate ZSA actions that transfer or burn assets in ZIP 226.

The asset state may also need to include a reference note commitment (such as the first note commitment for that asset).

Design

  • In the non-finalized state, an issued_assets: HashMap<AssetBase, AssetState> should be added as a field on ChainInner
    • The update_chain_tip_with_block_parallel() method should be updated to maintain the issued_assets map when blocks are added to the chain:
      • adding newly issued assets to the collection,
      • updating the supply when more of an existing asset is issued or some of an existing asset is burned, and
      • setting the finalize flag when assets are finalized.
    • The revert_chain_with() method should be updated to revert changes to the issued_assets map when blocks are removed from the chain, applying the opposite changes as those applied when blocks are added.
  • In the finalized state, a new column family may be added to store the same information for the finalized chain tip.

Testing

Existing property-based and vectors tests for the non-finalized state that add blocks to non-finalized chains and check that the internal state of the updated chain match expectations will need to be updated.

The new column family should be added to the column family snapshot, and serialization tests should be added for the new types used in the db format (AssetBase and AssetState).

@arya2 arya2 added A-consensus Area: Consensus rule updates A-state Area: State / database changes NU-7 Network Upgrade: NU7 specific tasks labels Nov 4, 2024
@arya2 arya2 self-assigned this Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-consensus Area: Consensus rule updates A-state Area: State / database changes NU-7 Network Upgrade: NU7 specific tasks
Projects
Status: Sprint Backlog
Development

No branches or pull requests

1 participant