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: expand forkChoiceUpdatedV3 with basic block building #540

Merged
merged 24 commits into from
Sep 27, 2024
Merged

Conversation

fmoletta
Copy link
Contributor

@fmoletta fmoletta commented Sep 23, 2024

Motivation

Add basic block building to forkChoiceUpdatedV3

Description

  • Expand engine_forkChoiceUpdated:
    • Add validations
    • Fix fork state update conditions
    • Add basic block building

With these changes hive engine tests no longer fail after calling engine_forkChoiceUpdatedV3. We still need to implement engine_getPayload to progress further
NOTE: Some fixes over this code have been included in #571 (Computing the state root for newly built payloads instead of using the parent state root)

Closes None, is part of #344

@fmoletta fmoletta changed the title [WIP] Work on hive engine tests feat: expand forkChoiceUpdatedV3 with basic block building Sep 24, 2024
@fmoletta fmoletta marked this pull request as ready for review September 26, 2024 16:50
@fmoletta fmoletta requested a review from a team as a code owner September 26, 2024 16:50
}

impl BuildPayloadArgs {
/// Computes an 8-byte identifier by hashing the components of the payload arguments.
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is what the spec says? not against it, just curious

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I took it from geth. The spec says 8 Bytes - identifier of the payload build process

gas_limit,
gas_used: 0,
timestamp: args.timestamp,
// TODO: should use miner config's extra_data
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit, the concept of miner doesn't exist anymore in post merge networks. it's either proposer or builder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switched to builder

fn set_canonical_block(&self, number: BlockNumber, hash: BlockHash) -> Result<(), StoreError>;

fn add_local_block(&self, payload_id: u64, block: Block) -> Result<(), StoreError>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm, I would rename to payload, since block might be a bit confusing. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured block should be included in the name as the type stored is a Block, but I agree

@fmoletta fmoletta added this pull request to the merge queue Sep 27, 2024
Merged via the queue into main with commit 0270aef Sep 27, 2024
8 checks passed
@fmoletta fmoletta deleted the engine-hive branch September 27, 2024 16:14
github-merge-queue bot pushed a commit that referenced this pull request Sep 30, 2024
…g pipeline (#571)

Depends on #540 
**Motivation**
Being able to run the full basic block building pipeline
(forkChoiceUpdated -> getPayload -> newPayload)
CURRENT_STATUS: I could successfully run some tests that ran the above
sequence, we still need to add transactions sent by sendRawTransaction
endpoint to the payload in order to fully build blocks
<!-- Why does this pull request exist? What are its goals? -->

**Description**
* Add rpc endpoint `engine_getPayloadV3`
* Compute new state root (after applying beacon_root contract &
withdrawals) when building a new payload (`engine_forkChoiceUpdated`)
* Set new block as canonical in `engine_newPayloadV3` (TEMP FIX for not
being able to fetch non canonical blocks)

Missing work (for a later PR)
* Fetch transactions from the mempool and add them to the block
* Populate BlobsBundle 

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes None, but is part of #344
mpaulucci pushed a commit to mpaulucci/lambda_ethereum_rust that referenced this pull request Oct 16, 2024
…ss#540)

**Motivation**

Add basic block building to forkChoiceUpdatedV3

<!-- Why does this pull request exist? What are its goals? -->

**Description**

* Expand engine_forkChoiceUpdated:
   - Add validations
   - Fix fork state update conditions
   - Add basic block building

With these changes hive engine tests no longer fail after calling
engine_forkChoiceUpdatedV3. We still need to implement engine_getPayload
to progress further
NOTE: Some fixes over this code have been included in lambdaclass#571 (Computing
the state root for newly built payloads instead of using the parent
state root)
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 -->

Closes None, is part of lambdaclass#344
mpaulucci pushed a commit to mpaulucci/lambda_ethereum_rust that referenced this pull request Oct 16, 2024
…g pipeline (lambdaclass#571)

Depends on lambdaclass#540 
**Motivation**
Being able to run the full basic block building pipeline
(forkChoiceUpdated -> getPayload -> newPayload)
CURRENT_STATUS: I could successfully run some tests that ran the above
sequence, we still need to add transactions sent by sendRawTransaction
endpoint to the payload in order to fully build blocks
<!-- Why does this pull request exist? What are its goals? -->

**Description**
* Add rpc endpoint `engine_getPayloadV3`
* Compute new state root (after applying beacon_root contract &
withdrawals) when building a new payload (`engine_forkChoiceUpdated`)
* Set new block as canonical in `engine_newPayloadV3` (TEMP FIX for not
being able to fetch non canonical blocks)

Missing work (for a later PR)
* Fetch transactions from the mempool and add them to the block
* Populate BlobsBundle 

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 -->

Closes None, but is part of lambdaclass#344
mpaulucci pushed a commit to mpaulucci/lambda_ethereum_rust that referenced this pull request Oct 16, 2024
…ss#540)

**Motivation**

Add basic block building to forkChoiceUpdatedV3

<!-- Why does this pull request exist? What are its goals? -->

**Description**

* Expand engine_forkChoiceUpdated:
   - Add validations
   - Fix fork state update conditions
   - Add basic block building

With these changes hive engine tests no longer fail after calling
engine_forkChoiceUpdatedV3. We still need to implement engine_getPayload
to progress further
NOTE: Some fixes over this code have been included in lambdaclass#571 (Computing
the state root for newly built payloads instead of using the parent
state root)
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 -->

Closes None, is part of lambdaclass#344
mpaulucci pushed a commit to mpaulucci/lambda_ethereum_rust that referenced this pull request Oct 16, 2024
…g pipeline (lambdaclass#571)

Depends on lambdaclass#540 
**Motivation**
Being able to run the full basic block building pipeline
(forkChoiceUpdated -> getPayload -> newPayload)
CURRENT_STATUS: I could successfully run some tests that ran the above
sequence, we still need to add transactions sent by sendRawTransaction
endpoint to the payload in order to fully build blocks
<!-- Why does this pull request exist? What are its goals? -->

**Description**
* Add rpc endpoint `engine_getPayloadV3`
* Compute new state root (after applying beacon_root contract &
withdrawals) when building a new payload (`engine_forkChoiceUpdated`)
* Set new block as canonical in `engine_newPayloadV3` (TEMP FIX for not
being able to fetch non canonical blocks)

Missing work (for a later PR)
* Fetch transactions from the mempool and add them to the block
* Populate BlobsBundle 

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 -->

Closes None, but is part of lambdaclass#344
mpaulucci pushed a commit that referenced this pull request Oct 16, 2024
**Motivation**

Add basic block building to forkChoiceUpdatedV3

<!-- Why does this pull request exist? What are its goals? -->

**Description**

* Expand engine_forkChoiceUpdated:
   - Add validations
   - Fix fork state update conditions
   - Add basic block building

With these changes hive engine tests no longer fail after calling
engine_forkChoiceUpdatedV3. We still need to implement engine_getPayload
to progress further
NOTE: Some fixes over this code have been included in #571 (Computing
the state root for newly built payloads instead of using the parent
state root)
<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes None, is part of #344
mpaulucci pushed a commit that referenced this pull request Oct 16, 2024
…g pipeline (#571)

Depends on #540 
**Motivation**
Being able to run the full basic block building pipeline
(forkChoiceUpdated -> getPayload -> newPayload)
CURRENT_STATUS: I could successfully run some tests that ran the above
sequence, we still need to add transactions sent by sendRawTransaction
endpoint to the payload in order to fully build blocks
<!-- Why does this pull request exist? What are its goals? -->

**Description**
* Add rpc endpoint `engine_getPayloadV3`
* Compute new state root (after applying beacon_root contract &
withdrawals) when building a new payload (`engine_forkChoiceUpdated`)
* Set new block as canonical in `engine_newPayloadV3` (TEMP FIX for not
being able to fetch non canonical blocks)

Missing work (for a later PR)
* Fetch transactions from the mempool and add them to the block
* Populate BlobsBundle 

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes None, but is part of #344
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.

2 participants