Skip to content

Commit 3103c23

Browse files
fix for one of the testnet prover failures (#4321)
* prover fix1 * run full-test for at least 2 epochs
1 parent 1926272 commit 3103c23

39 files changed

+133
-37
lines changed

.circleci/config.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,9 +675,6 @@ jobs:
675675
- run:
676676
name: Running test -- test_postake_split_snarkless:coda-shared-prefix-test -who-produces 1
677677
command: ./scripts/skip_if_only_frontend.sh bash -c 'source ~/.profile && ./scripts/test.py run "test_postake_split_snarkless:coda-shared-prefix-test -who-produces 1"'
678-
- run:
679-
name: Running test -- test_postake_split_snarkless:coda-restart-node-test
680-
command: ./scripts/skip_if_only_frontend.sh bash -c 'source ~/.profile && ./scripts/test.py run "test_postake_split_snarkless:coda-restart-node-test"'
681678
- run:
682679
name: Running test -- test_postake_split_snarkless:coda-change-snark-worker-test
683680
command: ./scripts/skip_if_only_frontend.sh bash -c 'source ~/.profile && ./scripts/test.py run "test_postake_split_snarkless:coda-change-snark-worker-test"'
@@ -717,6 +714,20 @@ jobs:
717714
command: ./scripts/skip_if_only_frontend.sh bash -c 'source ~/.profile && ./scripts/test.py run "test_postake_txns:coda-batch-payment-test"'
718715
- store_artifacts:
719716
path: test_logs
717+
test--test_postake_full_epoch:
718+
resource_class: xlarge
719+
docker:
720+
- image: codaprotocol/coda:toolchain-54430467ba429af285ea937d1c1da7d4b4cbde3e
721+
steps:
722+
- checkout
723+
- run:
724+
name: Update OPAM
725+
command: ./scripts/update-opam-in-docker.sh
726+
- run:
727+
name: Running test -- test_postake_full_epoch:full-test
728+
command: ./scripts/skip_if_only_frontend.sh bash -c 'source ~/.profile && ./scripts/test.py run "test_postake_full_epoch:full-test"'
729+
- store_artifacts:
730+
path: test_logs
720731
test--test_postake_medium_curves:
721732
resource_class: xlarge
722733
docker:
@@ -810,6 +821,7 @@ workflows:
810821
- /release\/.*/
811822
jobs:
812823
- test-unit--dev_medium_curves
824+
- test--test_postake_full_epoch
813825
- test--test_postake_medium_curves
814826
- test--test_postake_snarkless_medium_curves
815827
- test--test_postake_split_medium_curves

.circleci/config.yml.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ jobs:
509509
path: test_logs
510510
{%- endfor %}
511511

512-
{%- for profile in medium_curves_tests.keys() | sort %}
512+
{%- for profile in medium_curves_and_other_tests.keys() | sort %}
513513
test--{{profile}}:
514514
resource_class: xlarge
515515
docker:
@@ -519,7 +519,7 @@ jobs:
519519
- run:
520520
name: Update OPAM
521521
command: ./scripts/update-opam-in-docker.sh
522-
{%- for test in medium_curves_tests[profile] %}
522+
{%- for test in medium_curves_and_other_tests[profile] %}
523523
- run:
524524
name: Running test -- {{profile}}:{{test}}
525525
command: ./scripts/skip_if_only_frontend.sh bash -c 'source ~/.profile && ./scripts/test.py run "{{profile}}:{{test}}"'
@@ -569,6 +569,6 @@ workflows:
569569
{%- for profile in unit_test_profiles_medium_curves %}
570570
- test-unit--{{profile}}
571571
{%- endfor %}
572-
{%- for profile in medium_curves_tests.keys() | sort %}
572+
{%- for profile in medium_curves_and_other_tests.keys() | sort %}
573573
- test--{{profile}}
574574
{%- endfor %}

scripts/test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
'coda-block-production-test',
2929
'coda-shared-prefix-test -who-produces 0',
3030
'coda-shared-prefix-test -who-produces 1',
31-
'coda-restart-node-test',
3231
'coda-change-snark-worker-test',
3332
'coda-archive-node-test'
3433
]
@@ -58,13 +57,14 @@
5857
['coda-shared-prefix-multiproducer-test -num-block-producers 5 -payments'],
5958
}
6059

61-
medium_curves_tests = {
60+
medium_curves_and_other_tests = {
6261
'test_postake_medium_curves':
6362
simple_tests,
6463
'test_postake_snarkless_medium_curves':
6564
simple_tests,
6665
'test_postake_split_medium_curves':
6766
['coda-shared-prefix-multiproducer-test -num-block-producers 2'],
67+
'test_postake_full_epoch': ['full-test'],
6868
}
6969

7070
medium_curve_profiles_full = [
@@ -190,7 +190,7 @@ def do():
190190
build_targets = '%s %s' % (coda_exe, logproc_exe)
191191

192192
all_tests = small_curves_tests
193-
all_tests.update(medium_curves_tests)
193+
all_tests.update(medium_curves_and_other_tests)
194194
all_tests = filter_tests(all_tests, args.includes_patterns,
195195
args.excludes_patterns)
196196
if len(all_tests) == 0:
@@ -285,7 +285,7 @@ def render(args):
285285
unit_test_profiles=unit_test_profiles,
286286
unit_test_profiles_medium_curves=unit_test_profiles_medium_curves,
287287
small_curves_tests=tests,
288-
medium_curves_tests=medium_curves_tests,
288+
medium_curves_and_other_tests=medium_curves_and_other_tests,
289289
medium_curve_profiles=medium_curve_profiles_full)
290290

291291
if args.check:
@@ -319,7 +319,7 @@ def render(args):
319319

320320
def list_tests(_args):
321321
all_tests = small_curves_tests
322-
all_tests.update(medium_curves_tests)
322+
all_tests.update(medium_curves_and_other_tests)
323323
for profile in all_tests.keys():
324324
print('- ' + profile)
325325
for test in small_curves_tests[profile]:

src/app/cli/src/tests/full_test.ml

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ let setup_time_offsets () = ()
6666

6767
let heartbeat_flag = ref true
6868

69+
[%%inject
70+
"test_full_epoch", test_full_epoch]
71+
6972
let print_heartbeat logger =
7073
let rec loop () =
7174
if !heartbeat_flag then (
@@ -217,14 +220,14 @@ let run_test () : unit Deferred.t =
217220
(Coda_lib.validated_transitions coda)
218221
~f:ignore) ;
219222
let%bind () = Ivar.read @@ Coda_lib.initialization_finish_signal coda in
220-
let wait_until_cond ~(f : Coda_lib.t -> bool) ~(timeout : Float.t) =
223+
let wait_until_cond ~(f : Coda_lib.t -> bool) ~(timeout_min : Float.t) =
221224
let rec go () =
222225
if f coda then return ()
223226
else
224227
let%bind () = after (Time.Span.of_sec 10.) in
225228
go ()
226229
in
227-
Deferred.any [after (Time.Span.of_min timeout); go ()]
230+
Deferred.any [after (Time.Span.of_min timeout_min); go ()]
228231
in
229232
let balance_change_or_timeout ~initial_receiver_balance receiver_pk =
230233
let cond t =
@@ -238,7 +241,7 @@ let run_test () : unit Deferred.t =
238241
| _ ->
239242
false
240243
in
241-
wait_until_cond ~f:cond ~timeout:3.
244+
wait_until_cond ~f:cond ~timeout_min:3.
242245
in
243246
let assert_balance pk amount =
244247
match
@@ -374,11 +377,11 @@ let run_test () : unit Deferred.t =
374377
|> Participating_state.active_exn |> Protocol_state.consensus_state
375378
|> Consensus.Data.Consensus_state.blockchain_length
376379
in
377-
let wait_for_proof_or_timeout timeout () =
380+
let wait_for_proof_or_timeout timeout_min () =
378381
let cond t = Option.is_some @@ Coda_lib.staged_ledger_ledger_proof t in
379-
wait_until_cond ~f:cond ~timeout
382+
wait_until_cond ~f:cond ~timeout_min
380383
in
381-
let test_multiple_payments accounts ~txn_count timeout =
384+
let test_multiple_payments accounts ~txn_count timeout_min =
382385
let balance_sheet =
383386
Public_key.Compressed.Map.of_alist_exn
384387
(List.map accounts
@@ -391,7 +394,7 @@ let run_test () : unit Deferred.t =
391394
Currency.Amount.of_int ((i + 1) * 10) )
392395
in
393396
(*After mining a few blocks and emitting a ledger_proof (by the parallel scan), check if the balances match *)
394-
let%map () = wait_for_proof_or_timeout timeout () in
397+
let%map () = wait_for_proof_or_timeout timeout_min () in
395398
assert (Option.is_some @@ Coda_lib.staged_ledger_ledger_proof coda) ;
396399
Map.fold updated_balance_sheet ~init:() ~f:(fun ~key ~data () ->
397400
assert_balance key data ) ;
@@ -443,23 +446,40 @@ let run_test () : unit Deferred.t =
443446
else if with_snark then 15.
444447
else 7.
445448
in
449+
let wait_till_length =
450+
if medium_curves then Coda_numbers.Length.of_int 1
451+
else if test_full_epoch then
452+
(*Note: wait to produce (2*slots_per_epoch) blocks. This could take a while depending on what k and c are*)
453+
Coda_numbers.Length.of_int
454+
(Unsigned.UInt32.to_int
455+
Consensus.Constants.(
456+
Unsigned.UInt32.(mul slots_per_epoch (of_int 2))))
457+
else Coda_numbers.Length.of_int 5
458+
in
446459
let%map () =
447460
if with_snark then
448461
let accounts = List.take other_accounts 2 in
449462
let%bind blockchain_length' =
450463
test_multiple_payments accounts ~txn_count:2 timeout_mins
451464
in
452-
(*wait for a block after the ledger_proof is emitted*)
465+
(*wait for some blocks after the ledger_proof is emitted*)
453466
let%map () =
454467
wait_until_cond
455-
~f:(fun t -> blockchain_length t > blockchain_length')
456-
~timeout:
468+
~f:(fun t ->
469+
blockchain_length t
470+
> Coda_numbers.Length.add blockchain_length' wait_till_length
471+
)
472+
~timeout_min:
457473
( Consensus.Constants.(
458-
(delta + c) * Consensus.Constants.block_window_duration_ms)
474+
(delta + c)
475+
* ( block_window_duration_ms
476+
* (Coda_numbers.Length.to_int wait_till_length + 1) ))
459477
/ 1000 / 60
460478
|> Float.of_int )
461479
in
462-
assert (blockchain_length coda > blockchain_length')
480+
assert (
481+
blockchain_length coda
482+
> Coda_numbers.Length.add blockchain_length' wait_till_length )
463483
else if with_check then
464484
let%map _ =
465485
test_multiple_payments other_accounts

src/config/debug.mlh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323
[%%define print_versioned_types false]
2424

2525
[%%define daemon_expiry "never"]
26+
[%%define test_full_epoch false]
27+

src/config/dev.mlh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323
[%%define print_versioned_types false]
2424

2525
[%%define daemon_expiry "never"]
26+
[%%define test_full_epoch false]
27+

src/config/dev_frontend.mlh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323
[%%define print_versioned_types false]
2424

2525
[%%define daemon_expiry "never"]
26+
[%%define test_full_epoch false]
27+

src/config/dev_medium_curves.mlh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323
[%%define print_versioned_types false]
2424

2525
[%%define daemon_expiry "never"]
26+
[%%define test_full_epoch false]
27+

src/config/dev_snark.mlh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@
2323
[%%define print_versioned_types false]
2424

2525
[%%define daemon_expiry "never"]
26+
[%%define test_full_epoch false]
27+

src/config/fake_hash.mlh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
[%%define print_versioned_types false]
2424

2525
[%%define daemon_expiry "never"]
26+
[%%define test_full_epoch false]

0 commit comments

Comments
 (0)