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

Replace cl_audits table with tree_transactions #153

Closed
kespinola opened this issue Dec 21, 2023 · 2 comments
Closed

Replace cl_audits table with tree_transactions #153

kespinola opened this issue Dec 21, 2023 · 2 comments

Comments

@kespinola
Copy link
Collaborator

Context

A cl_audit system was introduced in this PR #94 which keeps complete revision history of change logs for a tree where the cl_items tracks the current change history for the tree. The cl_audit records also record the corresponding transaction signature and instruction identifier.

The cl_audit records in upstream is a configurable feature that only adds the records but Helius has used these records to provide a getSignaturesForAsset method which returns a list of transaction signatures related to a leaf. https://github.com/rpcpool/digital-asset-rpc-infrastructure/blob/triton-build/digital_asset_types/src/dapi/signatures_for_asset.rs#L21

Issues

Proposal

Replace the writing of cl_audit with tree_sequence records. The tree_sequence tracks every sequence for a tree seen by the indexer with additional meta information like the transaction signature and instruction identifier (as currently recorded on cl_audits). Instead of writing n change log records per transaction with each sequence change write 1 record for the sequence change only.

CREATE TABLE tree_sequences (
    -- Composite primary key consisting of the sequence number and tree public key
    seq BIGINT NOT NULL,
    tree BYTEA NOT NULL,
    -- Index of the leaf causing the tree change
    leaf_idx BIGINT,
    -- Signature of the transaction associated with the instruction
    signature BYTEA NOT NULL,
    -- Identifier for the instruction
    instruction VARCHAR,
    PRIMARY KEY (seq, tree)
);

Uses

  • Maintain feature parity with the existing getSignaturesForAsset RPC method by providing transaction signatures for tree leaves.
  • Enhance tree backfilling and reporting capabilities by utilizing sequence information
    [Feature] Tree Sequence Based Backfilling #150
@NicolasPennie
Copy link
Collaborator

Discussed reconciling this schema with Helius' new one here: #150 (comment)

@kespinola
Copy link
Collaborator Author

resolved by #163

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

No branches or pull requests

2 participants