Skip to content

Commit

Permalink
remove GetL2ParentHashes
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerLamTd committed Dec 18, 2023
1 parent a2b3626 commit 377c52b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 50 deletions.
14 changes: 0 additions & 14 deletions eth/taiko_api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,6 @@ func (s *TaikoAPIBackend) TxPoolContent(
)
}

// Get L2ParentHashes retrieves the preceding 256 parent hashes given a block number.
func (s *TaikoAPIBackend) GetL2ParentHashes(blockID uint64) ([]common.Hash, error) {
var hashes []common.Hash
headers, err := s.GetL2ParentHeaders(blockID)
if err != nil {
return nil, err
}

for _, x := range headers {
hashes = append(hashes, x.Hash())
}
return hashes, nil
}

// Get L2ParentBlocks retrieves the preceding 256 parent blocks given a block number.
func (s *TaikoAPIBackend) GetL2ParentHeaders(blockID uint64) ([]*types.Header, error) {
var headers []*types.Header
Expand Down
11 changes: 0 additions & 11 deletions ethclient/taiko_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/rawdb"
)
Expand All @@ -31,16 +30,6 @@ func (ec *Client) L1OriginByID(ctx context.Context, blockID *big.Int) (*rawdb.L1
return res, nil
}

func (ec *Client) GetL2ParentHashes(ctx context.Context, blockID uint64) ([]common.Hash, error) {
var res []common.Hash

if err := ec.c.CallContext(ctx, &res, "taiko_getL2ParentHashes", blockID); err != nil {
return nil, err
}

return res, nil
}

func (ec *Client) GetL2ParentHeaders(ctx context.Context, blockID uint64) ([]map[string]interface{}, error) {
var res []map[string]interface{}

Expand Down
25 changes: 0 additions & 25 deletions ethclient/taiko_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,31 +104,6 @@ func TestL1OriginByID(t *testing.T) {
require.Equal(t, testL1Origin, l1OriginFound)
}

func TestGetL2ParentHashes(t *testing.T) {
ec, blocks, _ := newTaikoAPITestClient(t)

hashes, err := ec.GetL2ParentHashes(context.Background(), common.Big3.Uint64())
require.Nil(t, err)

log.Info("hashes", "a", hashes)
require.Equal(t, 3, len(hashes))
require.Equal(t, blocks[0].Hash(), hashes[0])
require.Equal(t, blocks[1].Hash(), hashes[1])
require.Equal(t, blocks[2].Hash(), hashes[2])

hashes, err = ec.GetL2ParentHashes(context.Background(), common.Big2.Uint64())
require.Nil(t, err)

require.Equal(t, 2, len(hashes))
require.Equal(t, blocks[0].Hash(), hashes[0])
require.Equal(t, blocks[1].Hash(), hashes[1])

hashes, err = ec.GetL2ParentHashes(context.Background(), common.Big0.Uint64())
require.Nil(t, err)

require.Equal(t, 0, len(hashes))
}

func TestGetL2ParentBlocks(t *testing.T) {
ec, blocks, _ := newTaikoAPITestClient(t)

Expand Down

0 comments on commit 377c52b

Please sign in to comment.