mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-11-03 23:57:26 +00:00 
			
		
		
		
	fix invariant benchmarking
This commit is contained in:
		
							parent
							
								
									2be4506d31
								
							
						
					
					
						commit
						a13e8d0379
					
				@ -681,9 +681,11 @@ func BenchmarkInvariants(b *testing.B) {
 | 
			
		||||
	// their respective metadata which makes it useful for testing/benchmarking.
 | 
			
		||||
	for _, cr := range app.crisisKeeper.Routes() {
 | 
			
		||||
		b.Run(fmt.Sprintf("%s/%s", cr.ModuleName, cr.Route), func(b *testing.B) {
 | 
			
		||||
			if res, stop := cr.Invar(ctx); stop {
 | 
			
		||||
				fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, config.NumBlocks, res)
 | 
			
		||||
				b.FailNow()
 | 
			
		||||
			for n := 0; n < b.N; n++ {
 | 
			
		||||
				if res, stop := cr.Invar(ctx); stop {
 | 
			
		||||
					fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, config.NumBlocks, res)
 | 
			
		||||
					b.FailNow()
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user