@@ -15,6 +15,7 @@ import (
1515 "github.com/evstack/ev-node/block/internal/cache"
1616 "github.com/evstack/ev-node/block/internal/common"
1717 "github.com/evstack/ev-node/block/internal/da"
18+ "github.com/evstack/ev-node/core/execution"
1819 "github.com/evstack/ev-node/pkg/config"
1920 datypes "github.com/evstack/ev-node/pkg/da/types"
2021 "github.com/evstack/ev-node/pkg/genesis"
@@ -23,6 +24,21 @@ import (
2324 "github.com/evstack/ev-node/types"
2425)
2526
27+ // setupFilterTxsMock sets up the FilterTxs mock to return FilterOK for all transactions.
28+ // This is the default behavior for tests that don't specifically test filtering.
29+ func setupFilterTxsMock (mockExec * testmocks.MockExecutor ) {
30+ mockExec .On ("FilterTxs" , mock .Anything , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).Return (
31+ func (ctx context.Context , txs [][]byte , maxBytes , maxGas uint64 , hasForceIncludedTransaction bool ) []execution.FilterStatus {
32+ result := make ([]execution.FilterStatus , len (txs ))
33+ for i := range result {
34+ result [i ] = execution .FilterOK
35+ }
36+ return result
37+ },
38+ nil ,
39+ ).Maybe ()
40+ }
41+
2642func TestCalculateBlockFullness_HalfFull (t * testing.T ) {
2743 s := & Syncer {}
2844
@@ -363,6 +379,7 @@ func TestVerifyForcedInclusionTxs_AllTransactionsIncluded(t *testing.T) {
363379 mockExec := testmocks .NewMockExecutor (t )
364380 mockExec .EXPECT ().InitChain (mock .Anything , mock .Anything , uint64 (1 ), "tchain" ).
365381 Return ([]byte ("app0" ), nil ).Once ()
382+ setupFilterTxsMock (mockExec )
366383
367384 client := testmocks .NewMockClient (t )
368385 client .On ("GetHeaderNamespace" ).Return ([]byte (cfg .DA .Namespace )).Maybe ()
@@ -437,6 +454,7 @@ func TestVerifyForcedInclusionTxs_MissingTransactions(t *testing.T) {
437454 mockExec := testmocks .NewMockExecutor (t )
438455 mockExec .EXPECT ().InitChain (mock .Anything , mock .Anything , uint64 (1 ), "tchain" ).
439456 Return ([]byte ("app0" ), nil ).Once ()
457+ setupFilterTxsMock (mockExec )
440458
441459 client := testmocks .NewMockClient (t )
442460 client .On ("GetHeaderNamespace" ).Return ([]byte (cfg .DA .Namespace )).Maybe ()
@@ -541,6 +559,7 @@ func TestVerifyForcedInclusionTxs_PartiallyIncluded(t *testing.T) {
541559 mockExec := testmocks .NewMockExecutor (t )
542560 mockExec .EXPECT ().InitChain (mock .Anything , mock .Anything , uint64 (1 ), "tchain" ).
543561 Return ([]byte ("app0" ), nil ).Once ()
562+ setupFilterTxsMock (mockExec )
544563
545564 client := testmocks .NewMockClient (t )
546565 client .On ("GetHeaderNamespace" ).Return ([]byte (cfg .DA .Namespace )).Maybe ()
@@ -649,6 +668,7 @@ func TestVerifyForcedInclusionTxs_NoForcedTransactions(t *testing.T) {
649668 mockExec := testmocks .NewMockExecutor (t )
650669 mockExec .EXPECT ().InitChain (mock .Anything , mock .Anything , uint64 (1 ), "tchain" ).
651670 Return ([]byte ("app0" ), nil ).Once ()
671+ setupFilterTxsMock (mockExec )
652672
653673 client := testmocks .NewMockClient (t )
654674 client .On ("GetHeaderNamespace" ).Return ([]byte (cfg .DA .Namespace )).Maybe ()
@@ -716,6 +736,7 @@ func TestVerifyForcedInclusionTxs_NamespaceNotConfigured(t *testing.T) {
716736 mockExec := testmocks .NewMockExecutor (t )
717737 mockExec .EXPECT ().InitChain (mock .Anything , mock .Anything , uint64 (1 ), "tchain" ).
718738 Return ([]byte ("app0" ), nil ).Once ()
739+ setupFilterTxsMock (mockExec )
719740
720741 client := testmocks .NewMockClient (t )
721742 client .On ("GetHeaderNamespace" ).Return ([]byte (cfg .DA .Namespace )).Maybe ()
@@ -783,6 +804,7 @@ func TestVerifyForcedInclusionTxs_DeferralWithinEpoch(t *testing.T) {
783804 mockExec := testmocks .NewMockExecutor (t )
784805 mockExec .EXPECT ().InitChain (mock .Anything , mock .Anything , uint64 (1 ), "tchain" ).
785806 Return ([]byte ("app0" ), nil ).Once ()
807+ setupFilterTxsMock (mockExec )
786808
787809 client := testmocks .NewMockClient (t )
788810 client .On ("GetHeaderNamespace" ).Return ([]byte (cfg .DA .Namespace )).Maybe ()
@@ -907,6 +929,7 @@ func TestVerifyForcedInclusionTxs_MaliciousAfterEpochEnd(t *testing.T) {
907929 mockExec := testmocks .NewMockExecutor (t )
908930 mockExec .EXPECT ().InitChain (mock .Anything , mock .Anything , uint64 (1 ), "tchain" ).
909931 Return ([]byte ("app0" ), nil ).Once ()
932+ setupFilterTxsMock (mockExec )
910933
911934 client := testmocks .NewMockClient (t )
912935 client .On ("GetHeaderNamespace" ).Return ([]byte (cfg .DA .Namespace )).Maybe ()
@@ -996,6 +1019,7 @@ func TestVerifyForcedInclusionTxs_SmoothingExceedsEpoch(t *testing.T) {
9961019 mockExec := testmocks .NewMockExecutor (t )
9971020 mockExec .EXPECT ().InitChain (mock .Anything , mock .Anything , uint64 (1 ), "tchain" ).
9981021 Return ([]byte ("app0" ), nil ).Once ()
1022+ setupFilterTxsMock (mockExec )
9991023
10001024 client := testmocks .NewMockClient (t )
10011025 client .On ("GetHeaderNamespace" ).Return ([]byte (cfg .DA .Namespace )).Maybe ()
0 commit comments