diff --git a/internal/docker/nodes/docker-compose.yml b/internal/docker/nodes/docker-compose.yml index bd0d48940..488010182 100644 --- a/internal/docker/nodes/docker-compose.yml +++ b/internal/docker/nodes/docker-compose.yml @@ -9,6 +9,8 @@ services: - "8545" entrypoint: - anvil + - --chain-id + - "32301" - --host - "0.0.0.0" - --hardfork diff --git a/proposer/proposer_test.go b/proposer/proposer_test.go index 98f12fc64..da7170ae0 100644 --- a/proposer/proposer_test.go +++ b/proposer/proposer_test.go @@ -6,7 +6,6 @@ import ( "testing" "time" - "github.com/ethereum-optimism/optimism/op-service/eth" "github.com/ethereum-optimism/optimism/op-service/txmgr" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" @@ -22,7 +21,6 @@ import ( "github.com/taikoxyz/taiko-client/driver/chain_syncer/beaconsync" "github.com/taikoxyz/taiko-client/driver/chain_syncer/blob" "github.com/taikoxyz/taiko-client/driver/state" - txlistfetcher "github.com/taikoxyz/taiko-client/driver/txlist_fetcher" "github.com/taikoxyz/taiko-client/internal/testutils" "github.com/taikoxyz/taiko-client/internal/utils" "github.com/taikoxyz/taiko-client/pkg/jwt" @@ -87,6 +85,8 @@ func (s *ProposerTestSuite) SetupTest() { MaxTierFeePriceBumps: 3, ExtraData: "test", L1BlockBuilderTip: common.Big0, + BlobAllowed: true, + ProposeBlockTxGasLimit: 10_000_000, TxmgrConfigs: &txmgr.CLIConfig{ L1RPCURL: os.Getenv("L1_NODE_WS_ENDPOINT"), NumConfirmations: 0, @@ -108,36 +108,6 @@ func (s *ProposerTestSuite) SetupTest() { s.cancel = cancel } -func parseTxs(client *rpc.Client, event *bindings.TaikoL1ClientBlockProposed) (types.Transactions, error) { - tx, err := client.L1.TransactionInBlock(context.Background(), event.Raw.BlockHash, event.Raw.TxIndex) - if err != nil { - return nil, err - } - - // Decode transactions list. - var txListDecoder txlistfetcher.TxListFetcher - if event.Meta.BlobUsed { - txListDecoder = txlistfetcher.NewBlobTxListFetcher(client.L1Beacon, rpc.NewBlobDataSource( - context.Background(), - client, - nil, - )) - } else { - txListDecoder = new(txlistfetcher.CalldataFetcher) - } - txListBytes, err := txListDecoder.Fetch(context.Background(), tx, &event.Meta) - if err != nil { - return nil, err - } - - txListBytes, err = utils.Decompress(txListBytes) - if err != nil { - return nil, err - } - - var txs types.Transactions - return txs, rlp.DecodeBytes(txListBytes, &txs) -} func (s *ProposerTestSuite) TestProposeTxLists() { p := s.p ctx := p.ctx @@ -178,57 +148,16 @@ func (s *ProposerTestSuite) TestProposeTxLists() { } // trigger the error - candidate.Blobs = []*eth.Blob{} - candidate.GasLimit = 10000000 + candidate.GasLimit = 10_000_000 txCandidates[i] = *candidate } - var errors []error for _, txCandidate := range txCandidates { receipt, err := p.txmgr.Send(ctx, txCandidate) s.Nil(err) - errors = append(errors, encoding.TryParsingCustomErrorFromReceipt(ctx, p.rpc.L1, p.proposerAddress, receipt)) - } - - // confirm errors handled - for _, err := range errors { - s.Equal("L1_BLOB_NOT_AVAILABLE", err.Error()) - } -} - -func (s *ProposerTestSuite) getLatestProposedTxs( - n int, - timeout time.Duration, -) (<-chan []types.Transactions, error) { - sink := make(chan *bindings.TaikoL1ClientBlockProposed) - sub, err := s.p.rpc.TaikoL1.WatchBlockProposed(nil, sink, nil, nil) - if err != nil { - return nil, err + s.Nil(encoding.TryParsingCustomErrorFromReceipt(ctx, p.rpc.L1, p.proposerAddress, receipt)) } - - var resCh = make(chan []types.Transactions, 1) - go func() { - defer sub.Unsubscribe() - - txLst := make([]types.Transactions, 0, n) - tick := time.After(timeout) - for len(txLst) < cap(txLst) { - select { - case event := <-sink: - txs, err := parseTxs(s.RPCClient, event) - if err != nil { - log.Error("failed to parse txs", "error", err) - } - txLst = append(txLst, txs) - case <-tick: - return - } - } - resCh <- txLst - }() - - return resCh, nil } func (s *ProposerTestSuite) TestProposeOpNoEmptyBlock() { @@ -260,13 +189,9 @@ func (s *ProposerTestSuite) TestProposeOpNoEmptyBlock() { s.Nil(err) s.Equal(true, len(preBuiltTxList) > 0) - txsCh, err := s.getLatestProposedTxs(len(preBuiltTxList), time.Minute) - s.Nil(err) - var ( blockMinGasLimit uint64 = math.MaxUint64 blockMinTxListBytes uint64 = math.MaxUint64 - txLists = make([]types.Transactions, 0, len(preBuiltTxList)) ) for _, txs := range preBuiltTxList { if txs.EstimatedGasUsed <= blockMinGasLimit { @@ -279,7 +204,6 @@ func (s *ProposerTestSuite) TestProposeOpNoEmptyBlock() { } else { break } - txLists = append(txLists, txs.TxList) } // Start proposer @@ -289,11 +213,6 @@ func (s *ProposerTestSuite) TestProposeOpNoEmptyBlock() { p.ProposeInterval = time.Second p.MinProposingInternal = time.Minute s.Nil(p.ProposeOp(context.Background())) - - txs := <-txsCh - for i := 0; i < len(txLists); i++ { - s.Equal(txLists[i].Len(), txs[i].Len()) - } } func (s *ProposerTestSuite) TestName() { diff --git a/proposer/transaction_builder/common_test.go b/proposer/transaction_builder/common_test.go index 034236d2d..71e8b4db0 100644 --- a/proposer/transaction_builder/common_test.go +++ b/proposer/transaction_builder/common_test.go @@ -64,7 +64,7 @@ func (s *TransactionBuilderTestSuite) SetupTest() { common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), common.HexToAddress(os.Getenv("ASSIGNMENT_HOOK_ADDRESS")), - 0, + 10_000_000, "test", ) }