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

feat: add blob tx listener #92

Merged
merged 49 commits into from
Aug 10, 2024
Merged

feat: add blob tx listener #92

merged 49 commits into from
Aug 10, 2024

Conversation

hal3e
Copy link
Contributor

@hal3e hal3e commented Jul 24, 2024

Adds a new service state_listener which will periodically check if the pending blob tx are finalized.

The sql tables for blob support have been updated and look like this:

CREATE TABLE IF NOT EXISTS l1_submissions (
    id                SERIAL PRIMARY KEY,
    fuel_block_hash   BYTEA NOT NULL,
    fuel_block_height BIGINT NOT NULL UNIQUE CHECK (fuel_block_height >= 0),
    CHECK (octet_length(fuel_block_hash) = 32)
);

CREATE TABLE IF NOT EXISTS l1_fragments (
    id            SERIAL PRIMARY KEY,
    fragment_idx  BIGINT NOT NULL CHECK (fragment_idx >= 0),
    submission_id INTEGER NOT NULL REFERENCES l1_submissions(id),
    data          BYTEA NOT NULL,
    created_at    TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS l1_transactions (
    id    SERIAL PRIMARY KEY,
    hash  BYTEA NOT NULL UNIQUE,
    state SMALLINT NOT NULL,
    CHECK (octet_length(hash) = 32)
);

CREATE TABLE IF NOT EXISTS l1_transaction_fragments (
    transaction_id INTEGER NOT NULL REFERENCES l1_transactions(id),
    fragment_id    INTEGER NOT NULL REFERENCES l1_fragments(id),
    PRIMARY KEY (transaction_id, fragment_id)
);

The sql queries are updated but the functionality remained the same. The new tables make it easier to update the tx state and query for finalized submissions (thans @segfault-magnet for the idea).

Copy link
Contributor

@segfault-magnet segfault-magnet left a comment

Choose a reason for hiding this comment

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

Crispy :)

packages/services/src/state_listener.rs Outdated Show resolved Hide resolved
packages/services/src/state_listener.rs Show resolved Hide resolved
committer/src/config.rs Outdated Show resolved Hide resolved
packages/storage/src/tables.rs Outdated Show resolved Hide resolved
packages/ports/src/types/state_submission.rs Show resolved Hide resolved
@hal3e hal3e removed the bug Something isn't working label Aug 5, 2024
Copy link
Member

@digorithm digorithm left a comment

Choose a reason for hiding this comment

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

LGTM! Left just a small question.

Another question: If I'm not missing anything, this listener simply updates a db table with the status of a tx, but it doesn't perform any action to fix (e.g., retry) failed txs. Is that right?

packages/services/src/block_committer.rs Show resolved Hide resolved
@hal3e
Copy link
Contributor Author

hal3e commented Aug 9, 2024

LGTM! Left just a small question.

Another question: If I'm not missing anything, this listener simply updates a db table with the status of a tx, but it doesn't perform any action to fix (e.g., retry) failed txs. Is that right?

Yes. The state-commiter will handle failed fragments and create new txs. The state-listener will fetch all pending tx and check their status and update the db.

@hal3e hal3e merged commit 1daed88 into master Aug 10, 2024
7 checks passed
@mchristopher mchristopher deleted the feat/blob-tx-watcher branch August 20, 2024 20:27
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.

5 participants