-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix(headers): move tx_id_commitment to application_headers #2678
Conversation
c2174b2
to
12903c5
Compare
12903c5
to
f9fc060
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit, and one question. Only blocker from my side is that we should update the changelog:
- The previous entry from fault_proving(headers): create new version of the block header, with tx_id_commitment #2648 should be marked as breaking iirc.
- We should either modify or write a new entry for this PR if we change visibility of public fields in the block header.
Other than that, this looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. Looks good now!
@@ -51,12 +45,11 @@ pub enum BlockHeader { | |||
} | |||
|
|||
/// Helpful methods for all variants of the block header. | |||
#[enum_dispatch] | |||
pub(crate) trait GetBlockHeaderFields { | |||
pub trait GetBlockHeaderFields<GAF> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see what is the use case of having a trait for getters(and setters in the case of the tests).
Because it is generic, it means that it will be implemented only for HeaderV1
and HeaderV2
only. It can't be implemented for the BlockHeader
enum, so it can't be used with it. Then, why do we need it? Looks like just public getters from impl
section should be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover code from enum_dispatch land, will fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 28a816a
Linked Issues/PRs
Description
We get rid of
enum_dispatch
because if you try to derive the impl on a trait with a generic, you also have to apply the generic to the enum ~ which we don't need. rather than having 2 traits, one generic and one not, opted to cutenum_dispatch
altogether.idk why we were directly accessing the block header fields in the whole codebase without using accessor methods, even when we had defined an enum for block header. this PR fixes that.
if
fault-proving
is enabled, we now generateBlockV1
withBlockHeaderV2
.tx_id_commitment
has been moved toGeneratedApplicationFieldsV2
, renamedGeneratedApplicationFields
toGeneratedApplicationFieldsV1
. maybe we can removepub
from a lot of fields and convert topub(crate)
but i can do that in a follow up PR.I still favour having a separate
FaultProvingHeader
field on the header, since we anyway have to define a new hash function for theApplicationHeader<GeneratedApplicationFieldsV2>
, it was less verbose before.Reviewers guide
types
is just using getters/setters where necessarytypes/header
, refactored, removedenum_dispatch
due to generic usage that didn't apply on parent enumtx_id_commitment
fromfault_proving_header
toapplication_header
. New structGeneratedApplicationFieldsV2
to accommodate it.AI generated desc
This pull request includes several changes to improve the consistency and readability of the code by replacing direct field accesses with method calls for accessing block header fields. The most important changes include updates to the
BlockHeader
field access, test adjustments, and feature additions in theCargo.toml
file.Block Header Field Access Updates:
impl LastBlockConfig
incrates/chain-config/src/config/state.rs
to use method calls for accessing block header fields instead of direct field accesses.impl From<&BlockHeader> for CompressedBlockHeader
incrates/compression/src/compressed_block_payload/v1.rs
to use method calls for accessing block header fields.impl Header
incrates/fuel-core/src/schema/block.rs
to use method calls for accessing block header fields.Test Adjustments:
crates/fuel-core/src/executor.rs
to use method calls for accessing block header fields. [1] [2] [3] [4]crates/fuel-core/src/service/adapters/consensus_parameters_provider.rs
to use method calls for setting consensus parameters version.Feature Additions:
fault-proving
inCargo.toml
forcrates/services/consensus_module
.crates/services/consensus_module/poa/src/verifier.rs
to support the new feature and improve code structure. [1] [2] [3]Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]