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

Index DAL Attestations #178

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

ajinkyaraj-23
Copy link

DAL commitments are indexed in DalPublishCommitmentOps table.
The bakers attest these commitments after 8 blocks(DAL_ATTESTATION_LAG constant).
This pull request aims to index these attestations by the bakers.

The information is made available via api endpoints as follows:

  • v1/dal/attestation
  • v1/dal/commitments

spalmer25 and others added 22 commits August 2, 2024 11:08
* [preattestation] remove preattestation_with_dal

preattestation_with_dal is not an existing operation

* [Data] add a new DalAttestation field to EndorsementOperation

* [Api] expose the DalAttestation field in endorsements API call

* [Sync] index the DAL attestations EndorsementOperation table
* Add DAL protocol constants

* Add data migration for new protocol constants
Authorize to filter by:
 - hash
 - level
 - slot-index
 - publisher
Authorize to select fields:
 - hash
 - level
 - slotIndex
 - publisher

Authorize to filter by:
 - hash
 - level
 - slotIndex
 - publisher

Authorize to sort by:
 - level
 - slotIndex
Authorize to select fields:
 - hash
 - level
 - slotIndex
 - publisher

Authorize to filter by:
 - level
 - slotIndex
 - publisher

Authorize to sort by:
 - level
 - slotIndex
…ommitment-indexing

[DAL] Index DAL commitments
* [data] create a DalAttestationStatus table

In order to keep track of DAL attestations evolution

* [cache] create a cache for DalCommitmentStatus

To be able to retrieve them faster

* [dal-attestation] index DAL attestation status

Each time an endorsement contains dal-attestation, index a
DalAttestationStatus for each slot associated to a DAL commitment

* [api] add an endpoint to count DAL attestations

Authorize to filter by:
 - commitment
 - publishLevel
 - slot-index
 - attester
 - attested

* [api] add an endpoint to get DAL attestation information

Authorize to select fields:
 - commitment
 - publishLevel
 - slotIndex
 - attester
 - attested

Authorize to filter by:
 - commitment
 - publishLevel
 - slotIndex
 - attester
 - attested

Authorize to sort by:
 - publishLevel
 - slotIndex
* [data] add the field `DalShards` to the table `BakingRights`

In order to keep track of the DAL shards distribution

* [dal-shards] compute and index DAL shards

Shards are the `number_of_shards` first slots

* [api] Expose `DalShards` in `/v1/rights` endpoint's response

* [api] allow to filter rights by `dalShards`

For the `/v1/rights/count` and `/v1/rights` entrypoints
* [data] add field `ShardsCount` to the table `DalAttestationStatus`

In order to keep track of the DAL shards power of attestation

* [dal-attestation] index DAL attestation status

Rights should be the one of the (level - 1) because the attestation are
the attestation of the previous block. But, since the `BakingRights`
table maintains rights shifted by one level, we get the correct rights
stored at the current level.

* [api] add field `ShardsCount` to `/v1/dal/attestations/` endpoints

Authorize to select, filter and sort by `ShardsCount`
* Add ShardsAttested and Attested (bool) field in DalCommitmentStatus

* update cumulative attestations received from all bakers for a Dal commitment

* Add API endpoints for cumulative DAL commitment status

* Use cache services for dalcommitmentstatus in UpdateDalCommitmentStatus

* Cache the dal attestation data for this level.

* Revert status update made to DalCommitmentStatus due to this block.
…baking-bad#31)

* [dal] use a dictionnary for the DalAttestationsCache

* [dal] update dal commitment status during attestation handling
…g-bad#36)

* Replace DalCommitmentStatus with DalPublishCommitmentOps

move shardsAttested and Attested fields to DalPublishCommitmentOps
Reuse the cache file used for DalCommitmentStatus to cache DalPublishCommitmentOps

Co-authored-by: Palmer Sébastien <[email protected]>

* Update APi endpoints

Add applied filter on Dal commitments

* Add filter for applied Dal commitment operations in API

* Use existing enums for operation status

---------

Co-authored-by: Palmer Sébastien <[email protected]>
* [data] introduce a new DalRights table to store dal rights

DalShards field in BakingRights table will be removed later

* [dal] create Dal rights generator

Dal rights generation in others generator will be removed later

* [cache] add a cache for Dal rights

In order to prevent to many calls during dal attestation applies

* [dal] initiate/update dal rights

 - initiate rights for the first ConsensusRightsDelay cycle at first proto activation
 - update rights at proto update for future cycle in according to the new proto
 - add rights at new future cycle
* [dal] use the new DalRights table to apply dal attestation

* [api] add entrypoint that get dal rights using the DalRights table


* [dal] remove dal shards from baking rights


* [migration] generate files extracting dal rigths from baking rights
* [fix] DAL api

* [migration] merge all migration related to dal support
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