Skip to content

Commit fe2f80c

Browse files
committed
cleanups
1 parent d96c74c commit fe2f80c

3 files changed

Lines changed: 0 additions & 73 deletions

File tree

apps/testapp/kv/kvexecutor.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ func (k *KVExecutor) ExecuteTxs(ctx context.Context, txs [][]byte, blockHeight u
249249

250250
parts := strings.SplitN(string(tx), "=", 2)
251251
if len(parts) != 2 {
252-
// Log but don't fail - this is gibberish that should be filtered out
253252
fmt.Printf("Warning: filtering out malformed transaction at index %d in block %d (expected format key=value): %s\n", i, blockHeight, string(tx))
254253
invalidTxCount++
255254
continue

execution/evm/execution.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,8 @@ func (c *EngineClient) GetTxs(ctx context.Context) ([][]byte, error) {
252252
// ExecuteTxs executes the given transactions at the specified block height and timestamp
253253
func (c *EngineClient) ExecuteTxs(ctx context.Context, txs [][]byte, blockHeight uint64, timestamp time.Time, prevStateRoot []byte) (updatedStateRoot []byte, maxBytes uint64, err error) {
254254
// Filter out invalid transactions to handle gibberish gracefully
255-
// According to Executor interface: "Must handle gracefully gibberish transactions"
256255
validTxs := make([]string, 0, len(txs))
257256
for i, tx := range txs {
258-
// Skip empty transactions
259257
if len(tx) == 0 {
260258
c.logger.Debug().
261259
Int("tx_index", i).
@@ -267,7 +265,6 @@ func (c *EngineClient) ExecuteTxs(ctx context.Context, txs [][]byte, blockHeight
267265
// Validate that the transaction can be parsed as an Ethereum transaction
268266
var ethTx types.Transaction
269267
if err := ethTx.UnmarshalBinary(tx); err != nil {
270-
// Log but don't fail - this is gibberish that should be filtered out
271268
c.logger.Warn().
272269
Int("tx_index", i).
273270
Uint64("block_height", blockHeight).
@@ -277,11 +274,9 @@ func (c *EngineClient) ExecuteTxs(ctx context.Context, txs [][]byte, blockHeight
277274
continue
278275
}
279276

280-
// Transaction is valid, add it to the payload
281277
validTxs = append(validTxs, "0x"+hex.EncodeToString(tx))
282278
}
283279

284-
// Log filtering results
285280
if len(validTxs) < len(txs) {
286281
c.logger.Info().
287282
Int("total_txs", len(txs)).
@@ -290,7 +285,6 @@ func (c *EngineClient) ExecuteTxs(ctx context.Context, txs [][]byte, blockHeight
290285
Uint64("block_height", blockHeight).
291286
Msg("filtered out invalid transactions")
292287
}
293-
294288
txsPayload := validTxs
295289

296290
prevBlockHash, _, prevGasLimit, _, err := c.getBlockInfo(ctx, blockHeight-1)

execution/evm/execution_status_test.go

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -251,69 +251,3 @@ func TestRetryWithBackoffOnPayloadStatus_WrappedRPCErrors(t *testing.T) {
251251
// Should fail immediately without retries on non-syncing errors
252252
assert.Equal(t, 1, attempts, "expected exactly 1 attempt, got %d", attempts)
253253
}
254-
255-
// TestExecuteTxs_GibberishTransactions tests that the EVM executor handles invalid/gibberish transactions gracefully
256-
// According to the Executor interface requirements: "Must handle gracefully gibberish transactions"
257-
func TestExecuteTxs_GibberishTransactions(t *testing.T) {
258-
t.Parallel()
259-
260-
tests := []struct {
261-
name string
262-
transactions [][]byte
263-
description string
264-
}{
265-
{
266-
name: "completely invalid transaction data",
267-
transactions: [][]byte{
268-
[]byte("not a valid transaction"),
269-
[]byte("gibberish"),
270-
{0x00, 0x01, 0x02, 0x03},
271-
},
272-
description: "random bytes that don't form valid RLP-encoded transactions",
273-
},
274-
{
275-
name: "empty transactions",
276-
transactions: [][]byte{{}, {}},
277-
description: "empty byte slices",
278-
},
279-
{
280-
name: "mix of invalid and potentially valid looking data",
281-
transactions: [][]byte{
282-
[]byte("0xinvalidhex"),
283-
{0xff, 0xff, 0xff, 0xff},
284-
[]byte("random string"),
285-
},
286-
description: "various forms of invalid transaction data",
287-
},
288-
{
289-
name: "empty transaction list",
290-
transactions: [][]byte{},
291-
description: "no transactions at all should still produce a valid block",
292-
},
293-
}
294-
295-
for _, tt := range tests {
296-
tt := tt
297-
t.Run(tt.name, func(t *testing.T) {
298-
t.Parallel()
299-
300-
// Note: This test documents the expected behavior but cannot run without a real EVM client
301-
// The EVM executor should:
302-
// 1. Filter out invalid transactions before submitting to engine API
303-
// 2. OR handle INVALID payload status gracefully
304-
// 3. Still produce a valid block (possibly empty) and return a valid state root
305-
// 4. NOT return an error that crashes the node
306-
307-
t.Logf("Testing gibberish transaction handling: %s", tt.description)
308-
t.Logf("Transactions count: %d", len(tt.transactions))
309-
310-
// The actual implementation should ensure that when ExecuteTxs is called with
311-
// gibberish transactions, it either:
312-
// - Filters them out and creates an empty block
313-
// - Wraps them in a way the engine accepts
314-
// - Catches INVALID status and continues with a valid empty block
315-
//
316-
// It should NOT propagate the error up as a critical failure
317-
})
318-
}
319-
}

0 commit comments

Comments
 (0)