mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-11-04 11:17:28 +00:00 
			
		
		
		
	feat: only run one seed in determinism tests
This commit is contained in:
		
							parent
							
								
									3ab264b5b7
								
							
						
					
					
						commit
						decbbd4c00
					
				@ -662,21 +662,17 @@ func TestAppStateDeterminism(t *testing.T) {
 | 
				
			|||||||
	config.OnOperation = false
 | 
						config.OnOperation = false
 | 
				
			||||||
	config.AllInvariants = false
 | 
						config.AllInvariants = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	numSeeds := 1
 | 
					 | 
				
			||||||
	numTimesToRunPerSeed := 2
 | 
						numTimesToRunPerSeed := 2
 | 
				
			||||||
	appHashList := make([]json.RawMessage, numTimesToRunPerSeed)
 | 
						appHashList := make([]json.RawMessage, numTimesToRunPerSeed)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for i := 0; i < numSeeds; i++ {
 | 
					 | 
				
			||||||
		config.Seed = rand.Int63()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for j := 0; j < numTimesToRunPerSeed; j++ {
 | 
						for j := 0; j < numTimesToRunPerSeed; j++ {
 | 
				
			||||||
		logger := log.NewNopLogger()
 | 
							logger := log.NewNopLogger()
 | 
				
			||||||
		db := dbm.NewMemDB()
 | 
							db := dbm.NewMemDB()
 | 
				
			||||||
		app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt())
 | 
							app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		fmt.Printf(
 | 
							fmt.Printf(
 | 
				
			||||||
				"running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n",
 | 
								"running non-determinism simulation; seed %d: attempt: %d/%d\n",
 | 
				
			||||||
				config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed,
 | 
								config.Seed, j+1, numTimesToRunPerSeed,
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		_, _, err := simulation.SimulateFromSeed(
 | 
							_, _, err := simulation.SimulateFromSeed(
 | 
				
			||||||
@ -691,11 +687,10 @@ func TestAppStateDeterminism(t *testing.T) {
 | 
				
			|||||||
		if j != 0 {
 | 
							if j != 0 {
 | 
				
			||||||
			require.Equal(
 | 
								require.Equal(
 | 
				
			||||||
				t, appHashList[0], appHashList[j],
 | 
									t, appHashList[0], appHashList[j],
 | 
				
			||||||
					"non-determinism in seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed,
 | 
									"non-determinism in seed %d: attempt: %d/%d\n", config.Seed, j+1, numTimesToRunPerSeed,
 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func BenchmarkInvariants(b *testing.B) {
 | 
					func BenchmarkInvariants(b *testing.B) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user