@@ -212,267 +212,6 @@ func TestEdgeChallengeManager_ConfirmByOneStepProof(t *testing.T) {
212
212
)
213
213
require .ErrorContains (t , err , "execution reverted" )
214
214
})
215
- // t.Run("edge not pending", func(t *testing.T) {
216
- // bisectionScenario := setupBisectionScenario(t)
217
- // honestStateManager := bisectionScenario.honestStateManager
218
- // honestEdge := bisectionScenario.honestLevelZeroEdge
219
- // challengeManager, err := bisectionScenario.topLevelFork.Chains[1].SpecChallengeManager(ctx)
220
- // require.NoError(t, err)
221
-
222
- // honestBisectCommit, err := honestStateManager.HistoryCommitmentUpToBatch(ctx, 0, challenge_testing.LevelZeroBlockEdgeHeight/2, 1)
223
- // require.NoError(t, err)
224
- // honestProof, err := honestStateManager.PrefixProofUpToBatch(ctx, 0, challenge_testing.LevelZeroBlockEdgeHeight/2, challenge_testing.LevelZeroBlockEdgeHeight, 1)
225
- // require.NoError(t, err)
226
- // honestChildren1, honestChildren2, err := honestEdge.Bisect(ctx, honestBisectCommit.Merkle, honestProof)
227
- // require.NoError(t, err)
228
-
229
- // s1, err := honestChildren1.Status(ctx)
230
- // require.NoError(t, err)
231
- // require.Equal(t, protocol.EdgePending, s1)
232
- // s2, err := honestChildren2.Status(ctx)
233
- // require.NoError(t, err)
234
- // require.Equal(t, protocol.EdgePending, s2)
235
-
236
- // // Adjust well beyond a challenge period.
237
- // for i := 0; i < 200; i++ {
238
- // bisectionScenario.topLevelFork.Backend.Commit()
239
- // }
240
-
241
- // require.NoError(t, honestChildren1.ConfirmByTimer(ctx, []protocol.EdgeId{honestEdge.Id()}))
242
- // require.NoError(t, honestChildren2.ConfirmByTimer(ctx, []protocol.EdgeId{honestEdge.Id()}))
243
- // s1, err = honestChildren1.Status(ctx)
244
- // require.NoError(t, err)
245
- // require.Equal(t, protocol.EdgeConfirmed, s1)
246
- // s2, err = honestChildren2.Status(ctx)
247
- // require.NoError(t, err)
248
- // require.Equal(t, protocol.EdgeConfirmed, s2)
249
-
250
- // executionHash, _, wasmModuleRoot, err := bisectionScenario.topLevelFork.Chains[0].GenesisAssertionHashes(ctx)
251
- // require.NoError(t, err)
252
- // wasmModuleRootProof, err := statemanager.WasmModuleProofAbi.Pack(common.Hash{}, executionHash, common.Hash{})
253
- // require.NoError(t, err)
254
-
255
- // inboxMaxCountProof, err := statemanager.ExecutionStateAbi.Pack(
256
- // common.Hash{},
257
- // common.Hash{},
258
- // uint64(0),
259
- // uint64(0),
260
- // protocol.MachineStatusFinished,
261
- // )
262
- // require.NoError(t, err)
263
-
264
- // err = challengeManager.ConfirmEdgeByOneStepProof(
265
- // ctx,
266
- // honestChildren1.Id(),
267
- // &protocol.OneStepData{
268
- // BeforeHash: common.Hash{},
269
- // Proof: genesisOspData,
270
- // InboxMsgCountSeen: big.NewInt(1),
271
- // InboxMsgCountSeenProof: inboxMaxCountProof,
272
- // WasmModuleRoot: wasmModuleRoot,
273
- // WasmModuleRootProof: wasmModuleRootProof,
274
- // },
275
- // make([]common.Hash, 0),
276
- // make([]common.Hash, 0),
277
- // )
278
- // require.ErrorContains(t, err, "Edge not pending")
279
- // err = challengeManager.ConfirmEdgeByOneStepProof(
280
- // ctx,
281
- // honestChildren2.Id(),
282
- // &protocol.OneStepData{
283
- // BeforeHash: common.Hash{},
284
- // Proof: genesisOspData,
285
- // InboxMsgCountSeen: big.NewInt(1),
286
- // InboxMsgCountSeenProof: inboxMaxCountProof,
287
- // WasmModuleRoot: wasmModuleRoot,
288
- // WasmModuleRootProof: wasmModuleRootProof,
289
- // },
290
- // make([]common.Hash, 0),
291
- // make([]common.Hash, 0),
292
- // )
293
- // require.ErrorContains(t, err, "Edge not pending")
294
- // })
295
- // t.Run("edge not small step type", func(t *testing.T) {
296
- // bisectionScenario := setupBisectionScenario(t)
297
- // honestStateManager := bisectionScenario.honestStateManager
298
- // honestEdge := bisectionScenario.honestLevelZeroEdge
299
- // challengeManager, err := bisectionScenario.topLevelFork.Chains[1].SpecChallengeManager(ctx)
300
- // require.NoError(t, err)
301
-
302
- // honestBisectCommit, err := honestStateManager.HistoryCommitmentUpToBatch(ctx, 0, challenge_testing.LevelZeroBlockEdgeHeight/2, 1)
303
- // require.NoError(t, err)
304
- // honestProof, err := honestStateManager.PrefixProofUpToBatch(ctx, 0, challenge_testing.LevelZeroBlockEdgeHeight/2, challenge_testing.LevelZeroBlockEdgeHeight, 1)
305
- // require.NoError(t, err)
306
- // honestChildren1, honestChildren2, err := honestEdge.Bisect(ctx, honestBisectCommit.Merkle, honestProof)
307
- // require.NoError(t, err)
308
-
309
- // s1, err := honestChildren1.Status(ctx)
310
- // require.NoError(t, err)
311
- // require.Equal(t, protocol.EdgePending, s1)
312
- // s2, err := honestChildren2.Status(ctx)
313
- // require.NoError(t, err)
314
- // require.Equal(t, protocol.EdgePending, s2)
315
-
316
- // executionHash, _, wasmModuleRoot, err := bisectionScenario.topLevelFork.Chains[0].GenesisAssertionHashes(ctx)
317
- // require.NoError(t, err)
318
- // wasmModuleRootProof, err := statemanager.WasmModuleProofAbi.Pack(common.Hash{}, executionHash, common.Hash{})
319
- // require.NoError(t, err)
320
-
321
- // inboxMaxCountProof, err := statemanager.ExecutionStateAbi.Pack(
322
- // common.Hash{},
323
- // common.Hash{},
324
- // uint64(0),
325
- // uint64(0),
326
- // protocol.MachineStatusFinished,
327
- // )
328
-
329
- // require.NoError(t, err)
330
- // err = challengeManager.ConfirmEdgeByOneStepProof(
331
- // ctx,
332
- // honestChildren1.Id(),
333
- // &protocol.OneStepData{
334
- // BeforeHash: common.Hash{},
335
- // Proof: genesisOspData,
336
- // InboxMsgCountSeen: big.NewInt(1),
337
- // InboxMsgCountSeenProof: inboxMaxCountProof,
338
- // WasmModuleRoot: wasmModuleRoot,
339
- // WasmModuleRootProof: wasmModuleRootProof,
340
- // },
341
- // make([]common.Hash, 0),
342
- // make([]common.Hash, 0),
343
- // )
344
- // require.ErrorContains(t, err, "Edge is not a small step")
345
- // err = challengeManager.ConfirmEdgeByOneStepProof(
346
- // ctx,
347
- // honestChildren2.Id(),
348
- // &protocol.OneStepData{
349
- // BeforeHash: common.Hash{},
350
- // Proof: genesisOspData,
351
- // InboxMsgCountSeen: big.NewInt(1),
352
- // InboxMsgCountSeenProof: inboxMaxCountProof,
353
- // WasmModuleRoot: wasmModuleRoot,
354
- // WasmModuleRootProof: wasmModuleRootProof,
355
- // },
356
- // make([]common.Hash, 0),
357
- // make([]common.Hash, 0),
358
- // )
359
- // require.ErrorContains(t, err, "Edge is not a small step")
360
- // })
361
- // t.Run("before state not in history", func(t *testing.T) {
362
- // scenario := setupOneStepProofScenario(t)
363
- // honestEdge := scenario.smallStepHonestEdge
364
-
365
- // challengeManager, err := scenario.topLevelFork.Chains[1].SpecChallengeManager(ctx)
366
- // require.NoError(t, err)
367
-
368
- // honestStateManager := scenario.honestStateManager
369
- // fromAssertion := uint64(0)
370
- // toAssertion := uint64(1)
371
- // fromBigStep := uint64(0)
372
- // toBigStep := fromBigStep + 1
373
- // toSmallStep := uint64(0)
374
- // honestCommit, err := honestStateManager.SmallStepCommitmentUpTo(
375
- // ctx,
376
- // fromAssertion,
377
- // toAssertion,
378
- // fromBigStep,
379
- // toBigStep,
380
- // toSmallStep,
381
- // )
382
- // require.NoError(t, err)
383
-
384
- // executionHash, _, wasmModuleRoot, err := scenario.topLevelFork.Chains[0].GenesisAssertionHashes(ctx)
385
- // require.NoError(t, err)
386
- // wasmModuleRootProof, err := statemanager.WasmModuleProofAbi.Pack(common.Hash{}, executionHash, common.Hash{})
387
- // require.NoError(t, err)
388
-
389
- // inboxMaxCountProof, err := statemanager.ExecutionStateAbi.Pack(
390
- // common.Hash{},
391
- // common.Hash{},
392
- // uint64(0),
393
- // uint64(0),
394
- // protocol.MachineStatusFinished,
395
- // )
396
- // require.NoError(t, err)
397
-
398
- // err = challengeManager.ConfirmEdgeByOneStepProof(
399
- // ctx,
400
- // honestEdge.Id(),
401
- // &protocol.OneStepData{
402
- // BeforeHash: common.BytesToHash([]byte("foo")),
403
- // Proof: genesisOspData,
404
- // InboxMsgCountSeen: big.NewInt(1),
405
- // InboxMsgCountSeenProof: inboxMaxCountProof,
406
- // WasmModuleRoot: wasmModuleRoot,
407
- // WasmModuleRootProof: wasmModuleRootProof,
408
- // },
409
- // honestCommit.FirstLeafProof,
410
- // honestCommit.LastLeafProof,
411
- // )
412
- // require.ErrorContains(t, err, "Invalid inclusion proof")
413
- // })
414
- // t.Run("one step proof fails", func(t *testing.T) {
415
- // scenario := setupOneStepProofScenario(t)
416
- // evilEdge := scenario.smallStepEvilEdge
417
-
418
- // challengeManager, err := scenario.topLevelFork.Chains[1].SpecChallengeManager(ctx)
419
- // require.NoError(t, err)
420
-
421
- // evilStateManager := scenario.evilStateManager
422
- // fromAssertion := uint64(0)
423
- // toAssertion := uint64(1)
424
- // fromBigStep := uint64(0)
425
- // toBigStep := fromBigStep + 1
426
- // toSmallStep := uint64(0)
427
- // startCommit, err := evilStateManager.SmallStepCommitmentUpTo(
428
- // ctx,
429
- // fromAssertion,
430
- // toAssertion,
431
- // fromBigStep,
432
- // toBigStep,
433
- // toSmallStep,
434
- // )
435
- // require.NoError(t, err)
436
- // endCommit, err := evilStateManager.SmallStepCommitmentUpTo(
437
- // ctx,
438
- // fromAssertion,
439
- // toAssertion,
440
- // fromBigStep,
441
- // toBigStep,
442
- // toSmallStep,
443
- // )
444
- // require.NoError(t, err)
445
-
446
- // executionHash, _, wasmModuleRoot, err := scenario.topLevelFork.Chains[0].GenesisAssertionHashes(ctx)
447
- // require.NoError(t, err)
448
- // wasmModuleRootProof, err := statemanager.WasmModuleProofAbi.Pack(common.Hash{}, executionHash, common.Hash{})
449
- // require.NoError(t, err)
450
-
451
- // inboxMaxCountProof, err := statemanager.ExecutionStateAbi.Pack(
452
- // common.Hash{},
453
- // common.Hash{},
454
- // uint64(0),
455
- // uint64(0),
456
- // protocol.MachineStatusFinished,
457
- // )
458
- // require.NoError(t, err)
459
-
460
- // err = challengeManager.ConfirmEdgeByOneStepProof(
461
- // ctx,
462
- // evilEdge.Id(),
463
- // &protocol.OneStepData{
464
- // BeforeHash: startCommit.LastLeaf,
465
- // Proof: genesisOspData,
466
- // InboxMsgCountSeen: big.NewInt(1),
467
- // InboxMsgCountSeenProof: inboxMaxCountProof,
468
- // WasmModuleRoot: wasmModuleRoot,
469
- // WasmModuleRootProof: wasmModuleRootProof,
470
- // },
471
- // startCommit.LastLeafProof,
472
- // endCommit.LastLeafProof,
473
- // )
474
- // require.ErrorContains(t, err, "Invalid inclusion proof")
475
- // })
476
215
t .Run ("OK" , func (t * testing.T ) {
477
216
scenario := setupOneStepProofScenario (t )
478
217
honestEdge := scenario .smallStepHonestEdge
0 commit comments