Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions op-node/rollup/derive/span_batch_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ func (tx *spanBatchTx) convertToFullTx(nonce, gas uint64, to *common.Address, ch
S: S,
}
case types.SetCodeTxType:
if to == nil {
return nil, fmt.Errorf("to address is required for SetCodeTx")
}

setCodeTxInner := tx.inner.(*spanBatchSetCodeTxData)
inner = &types.SetCodeTx{
ChainID: uint256.MustFromBig(chainID),
Expand Down
8 changes: 8 additions & 0 deletions op-node/rollup/derive/span_batch_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,11 @@ func TestSpanBatchTxDecodeInvalid(t *testing.T) {
err = sbtx.UnmarshalBinary(invalidLegacyTxDecoded)
require.ErrorContains(t, err, "failed to decode spanBatchLegacyTxData")
}

func TestSpanBatchTxSetCodeInvalidTo(t *testing.T) {
// invalid to for setcode tx
var sbtx spanBatchTx
sbtx.inner = &spanBatchSetCodeTxData{}
_, err := sbtx.convertToFullTx(0, 0, nil, nil, nil, nil, nil)
require.ErrorContains(t, err, "to address is required for SetCodeTx")
}