Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat: remove blockMetaInput.gasLimit
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Aug 7, 2023
1 parent b39f23a commit 40cd6a3
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 18 deletions.
4 changes: 0 additions & 4 deletions bindings/encoding/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ var (
Name: "txListByteEnd",
Type: "uint24",
},
{
Name: "gasLimit",
Type: "uint32",
},
{
Name: "beneficiary",
Type: "address",
Expand Down
1 change: 0 additions & 1 deletion bindings/encoding/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type TaikoL1Evidence struct {
type TaikoL1BlockMetadataInput struct {
TxListHash [32]byte
Beneficiary common.Address
GasLimit uint32
TxListByteStart *big.Int
TxListByteEnd *big.Int
CacheTxListInfo uint8
Expand Down
1 change: 0 additions & 1 deletion bindings/encoding/struct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ var (
}
testMetaInput = TaikoL1BlockMetadataInput{
Beneficiary: common.BytesToAddress(randomHash().Bytes()),
GasLimit: rand.Uint32(),
TxListHash: randomHash(),
TxListByteStart: common.Big0,
TxListByteEnd: common.Big0,
Expand Down
30 changes: 26 additions & 4 deletions driver/chain_syncer/calldata/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ func (s *Syncer) onBlockProposed(
txListBytes,
l1Origin,
)

if err != nil {
return fmt.Errorf("failed to insert new head to L2 execution engine: %w", err)
}
Expand Down Expand Up @@ -384,7 +383,6 @@ func (s *Syncer) insertNewHead(
baseFee,
withdrawals,
)

if err != nil {
return nil, fmt.Errorf("failed to create execution payloads: %w", err)
}
Expand Down Expand Up @@ -435,7 +433,21 @@ func (s *Syncer) createExecutionPayloads(
L1Origin: l1Origin,
}

log.Debug("PayloadAttributes", "attributes", attributes, "meta", attributes.BlockMetadata)
log.Debug(
"PayloadAttributes",
"blockID", event.BlockId,
"timestamp", attributes.Timestamp,
"random", attributes.Random,
"suggestedFeeRecipient", attributes.SuggestedFeeRecipient,
"withdrawals", len(attributes.Withdrawals),
"highestBlockID", attributes.BlockMetadata.HighestBlockID,
"gasLimit", attributes.BlockMetadata.GasLimit,
"timestamp", attributes.BlockMetadata.Timestamp,
"mixHash", attributes.BlockMetadata.MixHash,
"baseFee", attributes.BaseFeePerGas,
"l1OriginHeight", attributes.L1Origin.L1BlockHeight,
"l1OriginHash", attributes.L1Origin.L1BlockHash,
)

// Step 1, prepare a payload
fcRes, err := s.rpc.L2Engine.ForkchoiceUpdate(ctx, fc, attributes)
Expand All @@ -455,7 +467,17 @@ func (s *Syncer) createExecutionPayloads(
return nil, fmt.Errorf("failed to get payload: %w", err)
}

log.Debug("Payload", "payload", payload)
log.Debug(
"Payload",
"blockID", event.BlockId,
"baseFee", payload.BaseFeePerGas,
"number", payload.Number,
"hash", payload.BlockHash,
"gasLimit", payload.GasLimit,
"gasUsed", payload.GasUsed,
"timestamp", payload.Timestamp,
"withdrawalsHash", payload.WithdrawalsHash,
)

// Step 3, execute the payload
execStatus, err := s.rpc.L2Engine.NewPayload(ctx, payload)
Expand Down
2 changes: 0 additions & 2 deletions proposer/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ func (p *Proposer) ProposeOp(ctx context.Context) error {
txNonce := nonce + uint64(i)
if err := p.ProposeTxList(ctx, &encoding.TaikoL1BlockMetadataInput{
Beneficiary: p.l2SuggestedFeeRecipient,
GasLimit: p.protocolConfigs.BlockMaxGasLimit,
TxListHash: crypto.Keccak256Hash(txListBytes),
TxListByteStart: common.Big0,
TxListByteEnd: new(big.Int).SetUint64(uint64(len(txListBytes))),
Expand Down Expand Up @@ -445,7 +444,6 @@ func (p *Proposer) ProposeEmptyBlockOp(ctx context.Context) error {
return p.ProposeTxList(ctx, &encoding.TaikoL1BlockMetadataInput{
TxListHash: crypto.Keccak256Hash([]byte{}),
Beneficiary: p.L2SuggestedFeeRecipient(),
GasLimit: p.protocolConfigs.BlockMaxGasLimit,
TxListByteStart: common.Big0,
TxListByteEnd: common.Big0,
CacheTxListInfo: 0,
Expand Down
1 change: 0 additions & 1 deletion proposer/proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ func (s *ProposerTestSuite) TestSendProposeBlockTx() {
context.Background(),
&encoding.TaikoL1BlockMetadataInput{
Beneficiary: s.p.L2SuggestedFeeRecipient(),
GasLimit: 21000,
TxListHash: crypto.Keccak256Hash(encoded),
TxListByteStart: common.Big0,
TxListByteEnd: new(big.Int).SetUint64(uint64(len(encoded))),
Expand Down
5 changes: 0 additions & 5 deletions testutils/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ import (
)

func ProposeInvalidTxListBytes(s *ClientTestSuite, proposer Proposer) {
configs, err := s.RpcClient.TaikoL1.GetConfig(nil)
s.Nil(err)

invalidTxListBytes := RandomBytes(256)

s.Nil(proposer.ProposeTxList(context.Background(), &encoding.TaikoL1BlockMetadataInput{
Beneficiary: proposer.L2SuggestedFeeRecipient(),
GasLimit: uint32(rand.Int63n(int64(configs.BlockMaxGasLimit))),
TxListHash: crypto.Keccak256Hash(invalidTxListBytes),
TxListByteStart: common.Big0,
TxListByteEnd: new(big.Int).SetUint64(uint64(len(invalidTxListBytes))),
Expand Down Expand Up @@ -60,7 +56,6 @@ func ProposeAndInsertEmptyBlocks(

s.Nil(proposer.ProposeTxList(context.Background(), &encoding.TaikoL1BlockMetadataInput{
Beneficiary: proposer.L2SuggestedFeeRecipient(),
GasLimit: 21000,
TxListHash: crypto.Keccak256Hash(encoded),
TxListByteStart: common.Big0,
TxListByteEnd: new(big.Int).SetUint64(uint64(len(encoded))),
Expand Down

0 comments on commit 40cd6a3

Please sign in to comment.