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

Commit

Permalink
feat: update testutils package
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Sep 29, 2023
1 parent e58ace7 commit 3267dab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
21 changes: 3 additions & 18 deletions testutils/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"crypto/rand"
"errors"
"fmt"
"math/big"
"net/http"
"net/url"
"os"
Expand All @@ -17,27 +16,19 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp"
"github.com/go-resty/resty/v2"
"github.com/phayes/freeport"
"github.com/taikoxyz/taiko-client/bindings"
"github.com/taikoxyz/taiko-client/bindings/encoding"
capacity "github.com/taikoxyz/taiko-client/prover/capacity_manager"
"github.com/taikoxyz/taiko-client/prover/server"
)

func ProposeInvalidTxListBytes(s *ClientTestSuite, proposer Proposer) {
invalidTxListBytes := RandomBytes(256)

s.Nil(proposer.ProposeTxList(context.Background(), &encoding.TaikoL1BlockMetadataInput{
Proposer: proposer.L2SuggestedFeeRecipient(),
TxListHash: crypto.Keccak256Hash(invalidTxListBytes),
TxListByteStart: common.Big0,
TxListByteEnd: new(big.Int).SetUint64(uint64(len(invalidTxListBytes))),
CacheTxListInfo: false,
}, invalidTxListBytes, 1, nil))
s.Nil(proposer.ProposeTxList(context.Background(), invalidTxListBytes, 1, nil))
}

func ProposeAndInsertEmptyBlocks(
Expand All @@ -64,13 +55,7 @@ func ProposeAndInsertEmptyBlocks(
encoded, err := rlp.EncodeToBytes(emptyTxs)
s.Nil(err)

s.Nil(proposer.ProposeTxList(context.Background(), &encoding.TaikoL1BlockMetadataInput{
Proposer: proposer.L2SuggestedFeeRecipient(),
TxListHash: crypto.Keccak256Hash(encoded),
TxListByteStart: common.Big0,
TxListByteEnd: new(big.Int).SetUint64(uint64(len(encoded))),
CacheTxListInfo: false,
}, encoded, 0, nil))
s.Nil(proposer.ProposeTxList(context.Background(), encoded, 0, nil))

ProposeInvalidTxListBytes(s, proposer)

Expand Down Expand Up @@ -203,7 +188,7 @@ func NewTestProverServer(
CapacityManager: capacityManager,
TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")),
Rpc: s.RpcClient,
Bond: protocolConfig.ProofBond,
Bond: protocolConfig.LivenessBond,
IsOracle: true,
})
s.Nil(err)
Expand Down
2 changes: 0 additions & 2 deletions testutils/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/taikoxyz/taiko-client/bindings/encoding"
"github.com/taikoxyz/taiko-client/cmd/utils"
)

Expand All @@ -20,7 +19,6 @@ type Proposer interface {
L2SuggestedFeeRecipient() common.Address
ProposeTxList(
ctx context.Context,
meta *encoding.TaikoL1BlockMetadataInput,
txListBytes []byte,
txNum uint,
nonce *uint64,
Expand Down

0 comments on commit 3267dab

Please sign in to comment.