From 583da25e50c80f7060f6dbb3f9c59c04a2bfeb71 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Tue, 30 Jul 2019 16:53:40 -0700 Subject: [PATCH] add test for sudden breaches --- pkg/arvo/app/azimuth-tracker.hoon | 2 +- pkg/arvo/app/ph.hoon | 32 +++++++++++++++++++++++++++++++ pkg/arvo/lib/ph/azimuth.hoon | 9 +++++---- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/app/azimuth-tracker.hoon b/pkg/arvo/app/azimuth-tracker.hoon index abb05dbc2..15d68c84f 100644 --- a/pkg/arvo/app/azimuth-tracker.hoon +++ b/pkg/arvo/app/azimuth-tracker.hoon @@ -335,7 +335,7 @@ |= [=pending-udiffs =number:block] =/ m (async:stdio ,^pending-udiffs) ^- form:m - =/ rel-number (sub number 30) + =/ rel-number (sub number 1) =/ =udiffs:point (~(get ja pending-udiffs) rel-number) ;< ~ bind:m (jael-update udiffs) (pure:m (~(del by pending-udiffs) rel-number)) diff --git a/pkg/arvo/app/ph.hoon b/pkg/arvo/app/ph.hoon index 34038eaa4..caebee4f9 100644 --- a/pkg/arvo/app/ph.hoon +++ b/pkg/arvo/app/ph.hoon @@ -245,6 +245,38 @@ (check-file-touched ~marbud %home file) ~& > 'DONE DONE' (pure:m ~) + :: + :+ %breach-sudden + ~[~bud ~marbud] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~fipfes) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud)) + ~& > 'BUD DONE' + ;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud)) + ~& > 'MARBUD DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH FILE DONE' + (check-file-touched ~marbud %home file) + ~& > 'TOUCH FILE CHECK DONE' + =. eth-node (breach:eth-node ~bud) + ~& > 'BREACH EXECUTED' + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud)) + ~& > 'BUD RE DONE' + ;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this")) + ~& > 'THIS MERGE STARTED DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH-1 DONE' + ;< file=@t bind:m (touch-file ~bud %base) + ~& > 'TOUCH-2 DONE' + (check-file-touched ~marbud %home file) + ~& > 'DONE DONE' + (pure:m ~) == :: ++ install-tests diff --git a/pkg/arvo/lib/ph/azimuth.hoon b/pkg/arvo/lib/ph/azimuth.hoon index 74432ea87..67036a507 100644 --- a/pkg/arvo/lib/ph/azimuth.hoon +++ b/pkg/arvo/lib/ph/azimuth.hoon @@ -361,7 +361,6 @@ ++ breach-and-hear |= [our=@p who=@p her=@p] =. this-az (breach who) - =. this-az ?:((~(has by lives) ~fes) (cycle-keys ~fes) (spawn ~fes)) =/ new-rut rut:(~(got by lives) who) =/ m (ph ,_this-az) ;< [this-az=_this-az ~] bind:m @@ -385,9 +384,11 @@ =/ prev (~(got by lives) who) =/ rut +(rut.prev) =. lives (~(put by lives) who [lyfe.prev rut]) - %- add-logs - :_ ~ - (broke-continuity:lo who rut) + =. this-az + %- add-logs + :_ ~ + (broke-continuity:lo who rut) + ?:((~(has by lives) ~fes) (cycle-keys ~fes) (spawn ~fes)) :: ++ get-keys |= [who=@p lyfe=life]