@@ -761,7 +761,7 @@ func TestTraceFilter(t *testing.T) {
761761 blockTime := 100 * time .Millisecond
762762 client , _ , ens := kit .EnsembleMinimal (t , kit .MockProofs (), kit .ThroughRPC ())
763763
764- ens .InterconnectAll ().BeginMining (blockTime )
764+ bms := ens .InterconnectAll ().BeginMining (blockTime )
765765
766766 ctx , cancel := context .WithTimeout (context .Background (), time .Minute )
767767 defer cancel ()
@@ -844,7 +844,7 @@ func TestTraceFilter(t *testing.T) {
844844 require .NotNil (t , tracesAddressFilter )
845845 require .NotEmpty (t , tracesAddressFilter )
846846
847- //we should only get our contract deploy transaction
847+ // we should only get our contract deploy transaction
848848 require .Len (t , tracesAddressFilter , 1 )
849849 require .Equal (t , 1 , tracesAddressFilter [0 ].TransactionPosition )
850850 require .Equal (t , hash , tracesAddressFilter [0 ].TransactionHash )
@@ -864,8 +864,32 @@ func TestTraceFilter(t *testing.T) {
864864 require .NotNil (t , traces )
865865 require .NotEmpty (t , traces )
866866
867- //we should only get the last two results from the first trace query
867+ // we should only get the last two results from the first trace query
868868 require .Len (t , tracesAfterCount , 2 )
869869 require .Equal (t , traces [1 ].TransactionHash , tracesAfterCount [0 ].TransactionHash )
870870 require .Equal (t , traces [2 ].TransactionHash , tracesAfterCount [1 ].TransactionHash )
871+
872+ // make sure we have null rounds in the chain
873+ bms [0 ].InjectNulls (2 )
874+ ch , err := client .ChainNotify (ctx )
875+ require .NoError (t , err )
876+ hc := <- ch // current
877+ require .Equal (t , store .HCCurrent , hc [0 ].Type )
878+ beforeNullHeight := hc [0 ].Val .Height ()
879+ hc = <- ch // wait for next block
880+ require .Equal (t , store .HCApply , hc [0 ].Type )
881+ afterNullHeight := hc [0 ].Val .Height ()
882+ require .Greater (t , afterNullHeight , beforeNullHeight + 1 )
883+ hc = <- ch // one more, so "latest" points to the block after nulls
884+ require .Equal (t , store .HCApply , hc [0 ].Type )
885+
886+ // define filter criteria that spans a null round so it has to at lest consider it
887+ toBlock = "latest"
888+ filter = ethtypes.EthTraceFilterCriteria {
889+ FromBlock : & fromBlock ,
890+ ToBlock : & toBlock ,
891+ }
892+ traces , err = client .EthTraceFilter (ctx , filter )
893+ require .NoError (t , err )
894+ require .Len (t , traces , 3 ) // still the same traces as before
871895}
0 commit comments