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: remove TEE from tree #2627

Closed
wants to merge 4 commits into from
Closed

Conversation

thomasknauth
Copy link
Contributor

TEE input producer jobs are now created by monitoring the db instead of hooking directly into the tree logic.

What ❔

Why ❔

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted via zk fmt and zk lint.

@thomasknauth thomasknauth requested review from haraldh and pbeza August 8, 2024 20:17
@RomanBrodetski RomanBrodetski requested a review from popzxc August 15, 2024 08:18
TEE input producer jobs are now created by monitoring the db instead of hooking directly into the tree logic.
Change get_new_l1_batches() to only return a single value.
@thomasknauth thomasknauth force-pushed the tk-remove-tee-from-tree branch from 3a1fa96 to c1988f7 Compare August 19, 2024 10:34
// Since we depend on Merkle paths, we use the proof_generation_details table to inform us of newly available to-be-proven batches.
let row = sqlx::query!(
r#"
SELECT
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this mean you could miss some entries (you query once, MAX = 10, you query second time, now there have been 5 batches incoming, MAX = 15, you'd be missing batches 11, 12, 13 and 14, no?).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That should not happen. You only return max(l1_batch_number) from the proof_generation_details table if the TEE jobs table is empty (which just handles the special case when the thing comes up for the first time, L114). Normal case is to return max(l1_batch_number)+1 from the TEE jobs table.

SELECT
MAX(l1_batch_number) AS "number"
FROM
proof_generation_details
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like that TEE is tied to proof_generation_details. If this table happens to become too hot (for instance, a bug in TEE), proof generation (and our SLAs + customer experience) will degrade. I don't have a better solution than code duplication, which I dislike even more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What code do you intend to duplicate as a potential solution? I'm open to suggestions in terms of an alternate "signal" to monitor for new batches.

Copy link
Member

Choose a reason for hiding this comment

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

I think that the right way would be to move save_merkle_paths_artifacts_metadata from proof_generation_dal to the blocks_dal (e.g. existence of the metainformation is the property of the block, regardless of the consumer).

This way we (later, not now!) will be able to get rid of insert_proof_generation_details in the updater.rs as well -- so that the tree is not aware of any verification logic (as it should be).

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say it's unclear who would create the tables afterwards. But I don't oppose the suggestion.

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.

6 participants