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

Block refactor #368

Merged
merged 2 commits into from
Sep 5, 2023
Merged

Block refactor #368

merged 2 commits into from
Sep 5, 2023

Conversation

danielSanchezQ
Copy link
Collaborator

@danielSanchezQ danielSanchezQ commented Sep 1, 2023

Added blobs to block

Comment on lines 16 to 32
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ExecutionZoneSidecar<Blob: Clone + Eq + Hash> {
blobs: IndexSet<Blob>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct CoordinationLayerSidecar<Tx: Clone + Eq + Hash> {
transactions: IndexSet<Tx>,
}

/// A block
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Block<TxId: Clone + Eq + Hash> {
pub struct Block<Tx: Clone + Eq + Hash, Blob: Clone + Eq + Hash> {
header: consensus_engine::Block,
transactions: IndexSet<TxId>,
beacon: RandomBeaconState,
coordination_layer_sidecar: CoordinationLayerSidecar<Tx>,
execution_zone_sidecar: ExecutionZoneSidecar<Blob>,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This are the most important changes. The other are just generics spreading away.

Copy link

@alvatar alvatar Sep 1, 2023

Choose a reason for hiding this comment

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

This is inaccurate as it is. The base layer needs to have no knowledge of the existence of EZs at all.
The fields should, for now, be:

  • cl_transactions: this is a list of transactions. The cl prefix denotes that they are interpreted by the Coordination Layer, and so the BL only knows it's a list.
  • bl_blobs: this is a list of pointers to blobs (ie hashes probably, probably more things that we will need to figure out). Blobs belong to the BL, but they are not interpreted by either the BL or the CL. Only the EZs know about this.

Ideally a clean design does not have any coupling with the EZs here at all. The BL should not know of the existence of EZs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense, it is more naming/concept than an issue. But I had a mix in my head with everything.

Copy link

Choose a reason for hiding this comment

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

Yes, it's true. It's still the same. But I think it's important to keep the references to EZs out of the BL. The CL will be inevitably coupled with the BL since it provides global computation/verification.
Also to clarify, both transactions and blobs must be ordered. Especially in the case of blobs where it might be tempting to conceptualize them as a set, but in reality they must be ordered for the case in which two blobs of the same EZ are included in the same block.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, We use IndexSet which is an ordered set.

for the case in which two blobs of the same EZ are included in the same block

Why would the same blob be included twice?

Copy link
Contributor

Choose a reason for hiding this comment

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

The CL will be inevitably coupled with the BL since it provides global computation/verification.

curious about this, why would we need a two-way coupling instead of requiring the CL to interact with the BL but not the other way around?

One thing is that if we want to price CL transactions differently we need a way to signal that to the BL

Copy link
Contributor

@youngjoon-lee youngjoon-lee left a comment

Choose a reason for hiding this comment

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

lgtm

self.transactions.iter()
}

pub fn blobs(&self) -> impl Iterator<Item = &Blob> + '_ {
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't a blob just a type of transaction? or do we mean cl transactions and data blobs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, transactions are cltransactions. Blobs just data blobs. I didn't wanted to include the distinction in the naming. But it may be worth it. cl_transactions and bl_blobs as Alvaro suggested?

Copy link
Contributor

Choose a reason for hiding this comment

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

cl_transactions and bl_blobs as Alvaro suggested?

This might be clearer, at least until we have something visible for CL and EZ in the future.

@codecov-commenter
Copy link

Codecov Report

Patch has no changes to coverable lines.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

📢 Thoughts on this report? Let us know!.

Copy link
Contributor

@zeegomo zeegomo left a comment

Choose a reason for hiding this comment

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

Oh the generics

@danielSanchezQ
Copy link
Collaborator Author

Oh the generics

Yeah. But I think they are necessary evil. I'm working on the da management. Fitting the types together without actually knowing them is useful. But ugly indeed 😂

@danielSanchezQ danielSanchezQ merged commit 57746f5 into master Sep 5, 2023
11 checks passed
@jakubgs jakubgs deleted the block-blobs branch February 15, 2024 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants