Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhodl committed Dec 5, 2024
1 parent dd08ac6 commit c81b9dc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions op-node/rollup/derive/blob_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestDataAndHashesFromTxs(t *testing.T) {
}
calldataTx, _ := types.SignNewTx(privateKey, signer, txData)
txs := types.Transactions{calldataTx}
data, blobHashes := dataAndHashesFromTxs(txs, &config, batcherAddr, logger, map[common.Hash]bool{calldataTx.Hash(): true})
data, blobHashes := dataAndHashesFromTxs(txs, &config, batcherAddr, logger)
require.Equal(t, 1, len(data))
require.Equal(t, 0, len(blobHashes))

Expand All @@ -60,22 +60,22 @@ func TestDataAndHashesFromTxs(t *testing.T) {
}
blobTx, _ := types.SignNewTx(privateKey, signer, blobTxData)
txs = types.Transactions{blobTx}
data, blobHashes = dataAndHashesFromTxs(txs, &config, batcherAddr, logger, map[common.Hash]bool{blobTx.Hash(): true})
data, blobHashes = dataAndHashesFromTxs(txs, &config, batcherAddr, logger)
require.Equal(t, 1, len(data))
require.Equal(t, 1, len(blobHashes))
require.Nil(t, data[0].calldata)

// try again with both the blob & calldata transactions and make sure both are picked up
txs = types.Transactions{blobTx, calldataTx}
data, blobHashes = dataAndHashesFromTxs(txs, &config, batcherAddr, logger, map[common.Hash]bool{blobTx.Hash(): true, calldataTx.Hash(): true})
data, blobHashes = dataAndHashesFromTxs(txs, &config, batcherAddr, logger)
require.Equal(t, 2, len(data))
require.Equal(t, 1, len(blobHashes))
require.NotNil(t, data[1].calldata)

// make sure blob tx to the batch inbox is ignored if not signed by the batcher
blobTx, _ = types.SignNewTx(testutils.RandomKey(), signer, blobTxData)
txs = types.Transactions{blobTx}
data, blobHashes = dataAndHashesFromTxs(txs, &config, batcherAddr, logger, map[common.Hash]bool{blobTx.Hash(): true})
data, blobHashes = dataAndHashesFromTxs(txs, &config, batcherAddr, logger)
require.Equal(t, 0, len(data))
require.Equal(t, 0, len(blobHashes))

Expand All @@ -84,7 +84,7 @@ func TestDataAndHashesFromTxs(t *testing.T) {
blobTxData.To = testutils.RandomAddress(rng)
blobTx, _ = types.SignNewTx(privateKey, signer, blobTxData)
txs = types.Transactions{blobTx}
data, blobHashes = dataAndHashesFromTxs(txs, &config, batcherAddr, logger, map[common.Hash]bool{blobTx.Hash(): true})
data, blobHashes = dataAndHashesFromTxs(txs, &config, batcherAddr, logger)
require.Equal(t, 0, len(data))
require.Equal(t, 0, len(blobHashes))
}
Expand Down

0 comments on commit c81b9dc

Please sign in to comment.