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

L2 head move #2

Merged
merged 20 commits into from
Jun 26, 2024
Merged

L2 head move #2

merged 20 commits into from
Jun 26, 2024

Conversation

mskrzypkows
Copy link
Collaborator

No description provided.

} else {
// taking last block from L2 instead of parent based on L1 block id
// parent, err = s.rpc.L2ParentByBlockID(ctx, event.BlockId)
parent, err = s.rpc.L2.HeaderByNumber(ctx, nil)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

taking last L2 block instead

return fmt.Errorf("failed to insert new head to L2 execution engine: %w", err)
}

metrics.DriverL1CurrentHeightGauge.Set(float64(lastInsertedBlockHeader.Number.Uint64())) //(float64(event.Raw.BlockNumber))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

setting height here as a block number

)

// Get withdrawals
withdrawals := types.Withdrawals{}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

empty withdrawals

)
var attributes *engine.PayloadAttributes
if event == nil {
attributes = &engine.PayloadAttributes{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

default values here when event is nil, so in our case

// Get L2 baseFee
baseFeeInfo, err := s.rpc.TaikoL2.GetBasefee(
&bind.CallOpts{BlockNumber: parent.Number, Context: ctx},
l1Origin.BlockID.Uint64(), // event.Meta.L1Height,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

using block id instead of L1 height

Copy link
Collaborator

Choose a reason for hiding this comment

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

i would just get l1 height from l1 execution client instead.

@mskrzypkows mskrzypkows marked this pull request as ready for review June 18, 2024 07:42
"gasUsed", parentGasUsed,
)

return c.rpc.TaikoL2.Anchor(opts, common.BigToHash(common.Big0), common.BigToHash(common.Big0), common.Big0.Uint64(), uint32(parentGasUsed))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Setting basefee here can be taken from L1 at the current time instead of setting itto 0. 0 baseFee and 0 gas used could lead to problems. these can be simulated using eth_call and eth_estimateGas on l1 execution client

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

That makes no sense, though, because gasUsee in this block will definitely be different and can easily be extracted.
Let's do GasUsed: get it from the l1 call with eth_estimateGas
And BaseFee: Get it from parent 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.

As I call eth_estimateGas I need to specify ethereum.CallMsg. I'm not sure for which L1 message you want to estimate gas?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as the tx that 2ill be sent to mev boost for force inclusion

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But here we have no L1 tx, just L2 block 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

Send the gasUseed value with the payload from the avs node

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, so I understand to have another parameter for the used gas in the MoveTheHead method, and I'll pass there the value of used gas in Rust AVS node part.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes sir

// Get L2 baseFee
baseFeeInfo, err := s.rpc.TaikoL2.GetBasefee(
&bind.CallOpts{BlockNumber: parent.Number, Context: ctx},
l1Origin.BlockID.Uint64(), // event.Meta.L1Height,
Copy link
Collaborator

Choose a reason for hiding this comment

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

i would just get l1 height from l1 execution client instead.

@mskrzypkows
Copy link
Collaborator Author

Skipped tests which require prover to be run, and other failing, e.g. related to reorg.

@mskrzypkows mskrzypkows merged commit 174305d into main Jun 26, 2024
3 of 11 checks passed
mskrzypkows added a commit that referenced this pull request Jul 15, 2024
* Rpc server for fetching L2 tx lists

* RPC server with python test file

* RPC for sending L2 blocks

* Returning L2 tx lists in JSON RPC

* dependencies

* L2 head move (#2)

* RPC server with python test file

* RPC for sending L2 blocks

* Returning L2 tx lists in JSON RPC

* dependencies

* insert new head using decoded tx lists

* replacement for blockProposed event to move the head manually

* RPC server for the driver - init

* Advancing the L2 head without blockProposed event

* Tests for MoveTheHead

* Signed transactions for moveTheHead test

* lint

* review corrections

* used gas passed as parameter for MoveTheHead

* commented some proposer tests, as proposer eventloop is not running

* tests skipping

* more skips

* Custom response for the proposer RPC, not to return incompatible `"error":null`

* Same custom response for the driver RPC

* tests limited to syncer

* Returning encoded, compressed txLists and parent meta hash for RPC.GetL2TxLists

* Returning encoded, compressed txLists along with JSON

* lint

* parent meta hash for the GetL2TxLists

* commented precommit hook

* print base url in get blobs

* error at the beginning

* potential fix for forking

* info logs for block proposed event

* fix forkchoice wrong hash

* minor fix for parent block

* final fix hopefully for forkchoice finalized

* removed unneeded check

* brought back taking last L1 block in MoveTheHead

* L2 block ID set as its parent+1

* Replaced AssembleNullAnchorTx with AssembleAnchorTx for advancing the head

* lint

---------

Co-authored-by: Ahmad Bitar <[email protected]>
mskrzypkows added a commit that referenced this pull request Aug 6, 2024
* Rpc server for fetching L2 tx lists

* RPC server with python test file

* RPC for sending L2 blocks

* Returning L2 tx lists in JSON RPC

* dependencies

* L2 head move (#2)

* RPC server with python test file

* RPC for sending L2 blocks

* Returning L2 tx lists in JSON RPC

* dependencies

* insert new head using decoded tx lists

* replacement for blockProposed event to move the head manually

* RPC server for the driver - init

* Advancing the L2 head without blockProposed event

* Tests for MoveTheHead

* Signed transactions for moveTheHead test

* lint

* review corrections

* used gas passed as parameter for MoveTheHead

* commented some proposer tests, as proposer eventloop is not running

* tests skipping

* more skips

* Custom response for the proposer RPC, not to return incompatible `"error":null`

* Same custom response for the driver RPC

* tests limited to syncer

* Returning encoded, compressed txLists and parent meta hash for RPC.GetL2TxLists

* Returning encoded, compressed txLists along with JSON

* lint

* parent meta hash for the GetL2TxLists

* commented precommit hook

* print base url in get blobs

* error at the beginning

* potential fix for forking

* info logs for block proposed event

* fix forkchoice wrong hash

* minor fix for parent block

* final fix hopefully for forkchoice finalized

* removed unneeded check

* brought back taking last L1 block in MoveTheHead

* L2 block ID set as its parent+1

* Replaced AssembleNullAnchorTx with AssembleAnchorTx for advancing the head

* lint

---------

Co-authored-by: Ahmad Bitar <[email protected]>
mskrzypkows added a commit that referenced this pull request Oct 5, 2024
* Rpc server for fetching L2 tx lists

* RPC server with python test file

* RPC for sending L2 blocks

* Returning L2 tx lists in JSON RPC

* dependencies

* L2 head move (#2)

* RPC server with python test file

* RPC for sending L2 blocks

* Returning L2 tx lists in JSON RPC

* dependencies

* insert new head using decoded tx lists

* replacement for blockProposed event to move the head manually

* RPC server for the driver - init

* Advancing the L2 head without blockProposed event

* Tests for MoveTheHead

* Signed transactions for moveTheHead test

* lint

* review corrections

* used gas passed as parameter for MoveTheHead

* commented some proposer tests, as proposer eventloop is not running

* tests skipping

* more skips

* Custom response for the proposer RPC, not to return incompatible `"error":null`

* Same custom response for the driver RPC

* tests limited to syncer

* Returning encoded, compressed txLists and parent meta hash for RPC.GetL2TxLists

* Returning encoded, compressed txLists along with JSON

* lint

* parent meta hash for the GetL2TxLists

* commented precommit hook

* print base url in get blobs

* error at the beginning

* potential fix for forking

* info logs for block proposed event

* fix forkchoice wrong hash

* minor fix for parent block

* final fix hopefully for forkchoice finalized

* removed unneeded check

* brought back taking last L1 block in MoveTheHead

* L2 block ID set as its parent+1

* Replaced AssembleNullAnchorTx with AssembleAnchorTx for advancing the head

* lint

---------

Co-authored-by: Ahmad Bitar <[email protected]>
@smartprogrammer93 smartprogrammer93 deleted the l2_head_move branch December 5, 2024 10:45
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