From 78c1d6e647a9419164bd8055ada2a09febe16f82 Mon Sep 17 00:00:00 2001 From: morelazers Date: Tue, 2 May 2023 21:28:15 +0200 Subject: [PATCH 01/20] feat: noun to mime --- pkg/base-dev/mar/noun.hoon | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/base-dev/mar/noun.hoon b/pkg/base-dev/mar/noun.hoon index 5c798d3c2..f5aba873e 100644 --- a/pkg/base-dev/mar/noun.hoon +++ b/pkg/base-dev/mar/noun.hoon @@ -8,6 +8,9 @@ ++ grab |% ++ noun * -- +++ grow |% + ++ mime [/application/octet-stream (as-octs:mimes:html (jam non))] + -- ++ grad |% ++ form %noun From 270905e1539692e7cd2d84999ed0837dbb774736 Mon Sep 17 00:00:00 2001 From: morelazers Date: Fri, 5 May 2023 12:11:46 +0200 Subject: [PATCH 02/20] fix: x-urb-jam --- pkg/base-dev/mar/noun.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/base-dev/mar/noun.hoon b/pkg/base-dev/mar/noun.hoon index f5aba873e..ff5443ec4 100644 --- a/pkg/base-dev/mar/noun.hoon +++ b/pkg/base-dev/mar/noun.hoon @@ -9,7 +9,7 @@ ++ noun * -- ++ grow |% - ++ mime [/application/octet-stream (as-octs:mimes:html (jam non))] + ++ mime [/application/x-urb-jam (as-octs:mimes:html (jam non))] -- ++ grad |% From b427f1c321a32d29da76a594b39dedb1c9453847 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 22 May 2023 10:58:50 +0200 Subject: [PATCH 03/20] ames: early abet in |fi after route update Continuation of https://github.com/urbit/urbit/pull/6593 --- pkg/arvo/sys/vane/ames.hoon | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index dbcd1129c..a8b584e05 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -4373,6 +4373,10 @@ last-sent.u.want now == =. wan.keen (put:fi-mop wan.keen [fra .]:u.want) + :: required so that the following +send-blob in + :: +fi-send access up-to-date peer state + :: + =. event-core abet (fi-send `@ux`hoot.u.want) -- :: +ga: constructor for |pump-gauge congestion control core From 66b92800e3485b459622ecd70f5cf98fa54fe60d Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 22 May 2023 11:41:32 +0200 Subject: [PATCH 04/20] ames: don't retrieve ship-state in +send-blob --- pkg/arvo/sys/vane/ames.hoon | 50 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index a8b584e05..1c001dfb5 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1903,7 +1903,7 @@ `p.lane :: =/ =blob (etch-shot shot) - (send-blob & rcvr.shot blob) + (send-blob for=& rcvr.shot blob (~(get by peers.ames-state) rcvr.shot)) :: +on-hear-keys: handle receipt of attestion request :: ++ on-hear-keys @@ -1913,7 +1913,8 @@ |.("requested attestation") ?. =(%pawn (clan:title our)) event-core - (send-blob | sndr.shot (attestation-packet sndr.shot 1)) + =/ =blob (attestation-packet sndr.shot 1) + (send-blob for=| sndr.shot blob (~(get by peers.ames-state) sndr.shot)) :: +on-hear-open: handle receipt of plaintext comet self-attestation :: ++ on-hear-open @@ -2436,7 +2437,8 @@ :: if we're a comet, send self-attestation packet first :: =? event-core =(%pawn (clan:title our)) - (send-blob | ship (attestation-packet ship life.point)) + =/ =blob (attestation-packet ship life.point) + (send-blob for=| ship blob (~(get by peers.ames-state) ship)) :: save current duct :: =/ original-duct duct @@ -2459,7 +2461,7 @@ =. event-core %+ roll ~(tap in packets.todos) |= [=blob core=_event-core] - (send-blob:core | ship blob) + (send-blob:core for=| ship blob (~(get by peers.ames-state) ship)) :: apply remote scry requests :: =. event-core (meet-alien-fine keens.todos) @@ -2633,7 +2635,9 @@ |= =ship ^+ event-core =+ (ev-trace msg.veb ship |.("requesting attestion")) - =. event-core (send-blob | ship (sendkeys-packet ship)) + =. event-core + =/ =blob (sendkeys-packet ship) + (send-blob for=| ship blob (~(get by peers.ames-state) ship)) =/ =wire /alien/(scot %p ship) (emit duct %pass wire %b %wait (add now ~s30)) :: +send-blob: fire packet at .ship and maybe sponsors @@ -2646,15 +2650,12 @@ :: ++ send-blob ~/ %send-blob - |= [for=? =ship =blob] + |= [for=? =ship =blob ship-state=(unit ship-state)] :: =/ final-ship ship %- (ev-trace rot.veb final-ship |.("send-blob: to {}")) |- |^ ^+ event-core - :: - =/ ship-state (~(get by peers.ames-state) ship) - :: ?. ?=([~ %known *] ship-state) ?: ?=(%pawn (clan:title ship)) (try-next-sponsor (^sein:title ship)) @@ -2901,10 +2902,6 @@ :: expire direct route if the peer is not responding :: =. peer-state (update-peer-route her peer-state) - :: required so that the following +send-blob's (including - :: inside +call:mu), access up-to-date peer state - :: - =. event-core abet :: resend comet attestation packet if first message times out :: :: The attestation packet doesn't get acked, so if we tried to @@ -2918,7 +2915,8 @@ ?& ?=(%pawn (clan:title our)) =(1 current:(~(got by snd.peer-state) bone)) == - (send-blob | her (attestation-packet [her her-life]:channel)) + =/ =blob (attestation-packet [her her-life]:channel) + (send-blob for=| her blob `known/peer-state) ?: (is-corked bone) :: no-op if the bone (or, if a naxplanation, the reference bone) :: was corked, because the flow doesn't exist anymore @@ -3046,13 +3044,16 @@ :: here. :: =. event-core - %^ send-blob | her - %- etch-shot - %: etch-shut-packet - shut-packet(bone (mix 1 bone.shut-packet)) - symmetric-key.channel - our her - our-life.channel her-life.channel + %: send-blob for=| her + %- etch-shot + %: etch-shut-packet + shut-packet(bone (mix 1 bone.shut-packet)) + symmetric-key.channel + our her + our-life.channel her-life.channel + == + :: + ship-state=`known/peer-state == peer-core :: +recork-one: re-send the next %cork to the peer @@ -4161,7 +4162,8 @@ |=(frag=@ud `hoot``@`(etch-shot (make-shot %0 fi-full-path frag))) :: ++ fi-send - |=(=blob fine(event-core (send-blob for=| her blob))) + |= =blob + fine(event-core (send-blob for=| her blob `known/peer-state)) :: ++ fi-give-tune |= dat=(unit roar) @@ -4373,10 +4375,6 @@ last-sent.u.want now == =. wan.keen (put:fi-mop wan.keen [fra .]:u.want) - :: required so that the following +send-blob in - :: +fi-send access up-to-date peer state - :: - =. event-core abet (fi-send `@ux`hoot.u.want) -- :: +ga: constructor for |pump-gauge congestion control core From a765954cee188d186b943e5972528ef423f7af76 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 22 May 2023 12:49:00 +0200 Subject: [PATCH 05/20] ames: don't get ship-state in +enqueue-alien-todo ship-state is retrieved in +send-blob only for sponsors of the ship --- pkg/arvo/sys/vane/ames.hoon | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 1c001dfb5..b74e3f627 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -1819,7 +1819,7 @@ =/ ship-state (~(get by peers.ames-state) ship) ?: ?=([~ %known *] ship-state) abet:on-heed:(abed-peer:pe ship +.u.ship-state) - %+ enqueue-alien-todo ship + %^ enqueue-alien-todo ship ship-state |= todos=alien-agenda todos(heeds (~(put in heeds.todos) duct)) :: +on-jilt: handle request to stop tracking .ship's responsiveness @@ -1830,7 +1830,7 @@ =/ ship-state (~(get by peers.ames-state) ship) ?: ?=([~ %known *] ship-state) abet:on-jilt:(abed-peer:pe ship +.u.ship-state) - %+ enqueue-alien-todo ship + %^ enqueue-alien-todo ship ship-state |= todos=alien-agenda todos(heeds (~(del in heeds.todos) duct)) :: +on-hear: handle raw packet receipt @@ -1971,7 +1971,7 @@ :: will be resent. :: ?. ?=([~ %known *] sndr-state) - (enqueue-alien-todo sndr.shot |=(alien-agenda +<)) + (enqueue-alien-todo sndr.shot sndr-state |=(alien-agenda +<)) :: decrypt packet contents using symmetric-key.channel :: :: If we know them, we have a $channel with them, which we've @@ -2062,7 +2062,7 @@ =/ ship-state (~(get by peers.ames-state) ship) :: ?. ?=([~ %known *] ship-state) - %+ enqueue-alien-todo ship + %^ enqueue-alien-todo ship ship-state |= todos=alien-agenda todos(messages [[duct plea] messages.todos]) :: @@ -2084,7 +2084,7 @@ =/ =plea [%$ /flow [%cork ~]] =/ ship-state (~(get by peers.ames-state) ship) ?. ?=([~ %known *] ship-state) - %+ enqueue-alien-todo ship + %^ enqueue-alien-todo ship ship-state |= todos=alien-agenda todos(messages [[duct plea] messages.todos]) =/ =peer-state +.u.ship-state @@ -2578,7 +2578,7 @@ =/ ship-state (~(get by peers.ames-state) ship) ?: ?=([~ %known *] ship-state) abet:(on-keen:(abed-peer:pe ship +.u.ship-state) path duct) - %+ enqueue-alien-todo ship + %^ enqueue-alien-todo ship ship-state |= todos=alien-agenda todos(keens (~(put ju keens.todos) path duct)) :: @@ -2604,10 +2604,11 @@ :: If talking to a comet, requests attestation packet. :: ++ enqueue-alien-todo - |= [=ship mutate=$-(alien-agenda alien-agenda)] + |= $: =ship + ship-state=(unit ship-state) + mutate=$-(alien-agenda alien-agenda) + == ^+ event-core - :: - =/ ship-state (~(get by peers.ames-state) ship) :: create a default $alien-agenda on first contact :: =+ ^- [already-pending=? todos=alien-agenda] @@ -2659,7 +2660,7 @@ ?. ?=([~ %known *] ship-state) ?: ?=(%pawn (clan:title ship)) (try-next-sponsor (^sein:title ship)) - %+ enqueue-alien-todo ship + %^ enqueue-alien-todo ship ship-state |= todos=alien-agenda todos(packets (~(put in packets.todos) blob)) :: @@ -2708,7 +2709,7 @@ :: ?: =(ship sponsor) event-core - ^$(ship sponsor) + ^$(ship sponsor, ship-state (~(get by peers.ames-state) sponsor)) -- :: +attestation-packet: generate signed self-attestation for .her :: From 89da6d433b8caec60be26c6a18bb49c6ad3d3345 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 22 May 2023 15:05:18 +0200 Subject: [PATCH 06/20] ames: fix incorrect handling of acks in |pack --- pkg/arvo/sys/vane/ames.hoon | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index b74e3f627..6e4d89dbf 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3635,7 +3635,7 @@ =/ acc :* found=`?`%.n resends=*(list static-fragment) - metrics=metrics.state + metrics=metrics.state(num-live ~(wyt by live.state)) == :: ^+ [acc live=live.state] @@ -3647,14 +3647,15 @@ == ^- [new-val=(unit live-packet-val) stop=? _acc] :: - =/ gauge (ga metrics.acc ~(wyt by live.state)) + =/ gauge (ga metrics.acc num-live.metrics.acc) :: is this the acked packet? :: ?: =(key [message-num fragment-num]) :: delete acked packet, update metrics, and stop traversal :: - =. found.acc %.y - =. metrics.acc (on-ack:gauge -.val) + =. found.acc %.y + =. metrics.acc (on-ack:gauge -.val) + =. num-live.metrics.acc (dec num-live.metrics.acc) [new-val=~ stop=%.y acc] :: is this a duplicate ack? :: @@ -3686,6 +3687,9 @@ (pu-trace snd.veb |.("done {}")) :: ^+ [metrics=metrics.state live=live.state] + :: number of sent packets awaiting ack + :: + =. num-live.metrics.state ~(wyt by live.state) :: %^ (dip:packet-queue pump-metrics) live.state acc=metrics.state |= $: metrics=pump-metrics @@ -3694,7 +3698,7 @@ == ^- [new-val=(unit live-packet-val) stop=? pump-metrics] :: - =/ gauge (ga metrics ~(wyt by live.state)) + =/ gauge (ga metrics num-live.metrics) :: if we get an out-of-order ack for a message, skip until it :: ?: (lth message-num.key message-num) @@ -3702,7 +3706,8 @@ :: if packet was from acked message, delete it and continue :: ?: =(message-num.key message-num) - [new-val=~ stop=%.n metrics=(on-ack:gauge -.val)] + =. metrics (on-ack:gauge -.val) + [new-val=~ stop=%.n metrics(num-live (dec num-live.metrics))] :: we've gone past the acked message; we're done :: [new-val=`val stop=%.y metrics] From 1921fd277c9272127a5001cad0933623200ba65d Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 22 May 2023 17:38:31 +0200 Subject: [PATCH 07/20] ames: add comment --- pkg/arvo/sys/vane/ames.hoon | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 6e4d89dbf..4e146cb28 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3635,6 +3635,11 @@ =/ acc :* found=`?`%.n resends=*(list static-fragment) + :: num-live is still present in pump-metrics but not used + :: internally by |ga, so we reuse it the +dip traversal to + :: keep track of the number of packets waiting acks + :: (also used in the accumulator in +on-done:pu) + :: metrics=metrics.state(num-live ~(wyt by live.state)) == :: From e440a443e59ee7d6365c3962552cafc84832ea9c Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 22 May 2023 17:53:20 +0200 Subject: [PATCH 08/20] ames: don't no-op if getting %ack on nack bone --- pkg/arvo/sys/vane/ames.hoon | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index b74e3f627..3065daea5 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3365,20 +3365,17 @@ :: =. snd.peer-state (~(del by snd.peer-state) bone) peer-core - :: if odd bone, ack is on "subscription update" message; no-op - :: - ?: =(1 (end 0 bone)) peer-core - :: even bone; is this bone a nack-trace bone? - :: - ?: =(1 (end 0 (rsh 0 bone))) - :: nack-trace bone; assume .ok, clear nack from |message-sink + ?: =(1 (end 0 bone)) + :: ack is on "subscription update" message; no-op + :: + ?: =(0 (end 0 (rsh 0 bone))) peer-core + :: nack-trace bone; assume .ok, clear nack from |sink :: abet:(call:(abed:mi (mix 0b10 bone)) %drop message-num) - ?: &(closing ?=(%near -.task)) - :: if the bone belongs to a closing flow and we got a - :: naxplanation, don't relay ack to the client vane - :: - peer-core + :: if the bone belongs to a closing flow and we got a + :: naxplanation, don't relay ack to the client vane + :: + ?: &(closing ?=(%near -.task)) peer-core :: not a nack-trace bone; relay ack to client vane :: (pe-emit (got-duct bone) %give %done error) From d8e11b68c2e2b55f0be6c38a5ff19881816ee58c Mon Sep 17 00:00:00 2001 From: fang Date: Tue, 23 May 2023 22:10:17 +0200 Subject: [PATCH 09/20] ames: correctly %lose a %boon we crashed on Previously, if we noticed %boon handling had caused a crash, we would transform any existing %boons into %losts, but still emit a new %boon for the message we ostensibly crashed on. Now, we make sure to just directly send a %lost if sending the %boon caused a crash. We drop the existing-moves transformation entirely, assuming it to vestigial. --- pkg/arvo/sys/vane/ames.hoon | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index b74e3f627..0067a656f 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -4018,15 +4018,13 @@ :: =/ dat [her bone=bone message-num=message-num] ?:(ok "sink boon {}" "crashed on sink boon {}") - =? moves !ok - :: we previously crashed on this message; notify client vane - :: - %+ turn moves - |= =move - ?. ?=([* %give %boon *] move) move - [duct.move %give %lost ~] + :: if we previously crashed on this message; + :: notify client vane instead of making it try again :: - =. peer-core (pe-emit (got-duct bone) %give %boon message) + =. peer-core + %+ pe-emit (got-duct bone) + ?. ok [%give %lost ~] + [%give %boon message] :: send ack unconditionally :: (call %done ok=%.y) From 30cde41800e43ddea2208310dab0cbf44e8ae7d3 Mon Sep 17 00:00:00 2001 From: fang Date: Tue, 23 May 2023 22:12:21 +0200 Subject: [PATCH 10/20] tests: add ames test for crashing on %boon To detect regressions of the bug d8e11b6 fixed. --- tests/sys/vane/ames.hoon | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/sys/vane/ames.hoon b/tests/sys/vane/ames.hoon index b8b3042b2..b132a9633 100644 --- a/tests/sys/vane/ames.hoon +++ b/tests/sys/vane/ames.hoon @@ -503,6 +503,25 @@ !> [~[/g/talk] %give %done `error] !> (snag 0 `(list move:ames)`moves5) :: +++ test-boon-lost ^- tang + :: ~nec -> %plea -> ~bud + :: + =^ moves1 nec (call nec ~[/g/talk] %plea ~bud %g /talk [%get %post]) + =^ moves2 bud (call bud ~[//unix] %hear (snag-packet 0 moves1)) + :: ~bud -> %done -> ~nec + :: + =^ moves3 bud (take bud /bone/~nec/0/1 ~[//unix] %g %done ~) + =^ moves4 nec (call nec ~[//unix] %hear (snag-packet 0 moves3)) + :: ~bud -> %boon -> ~nec, but we tell ~nec it crashed during the handling + :: + =^ moves5 bud (take bud /bone/~nec/0/1 ~[//unix] %g %boon [%post 'first1']) + =^ moves6 nec + =/ vane-core (nec(now `@da`(add ~s1 now.nec))) + (call:vane-core ~[//unix] `[%test-error ~] %hear (snag-packet 0 moves5)) + %+ expect-eq + !> [~[/g/talk] %give %lost ~] + !> (snag 0 `(list move:ames)`moves6) +:: ++ test-fine-request ^- tang =/ want=path /c/z/1/kids/sys From f6101569f5ee7686cd526b4f7972ba6e0e150ae0 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Wed, 24 May 2023 12:35:38 +0200 Subject: [PATCH 11/20] ames: skip corks if pending acks for naxplanations --- pkg/arvo/sys/vane/ames.hoon | 49 ++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index b74e3f627..42c550623 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3775,19 +3775,50 @@ %done (done ok.task) :: %hear - ?. ?| corked + |^ ?: ?| corked ?& %*(corked sink bone (mix 0b10 bone)) =(%nack (received bone)) == == - (hear [lane shut-packet ok]:task) - :: if we %hear a task on a corked bone, always ack + ack-on-corked-bone :: - =. peer-core - %+ send-shut-packet bone - [message-num.shut-packet.task %| %| ok=& lag=*@dr] - %. sink - %+ pe-trace odd.veb - |.("hear {<(received bone)>} on corked bone={}") + ?> ?=(%& -.meat.shut-packet.task) + =+ [num-fragments fragment-num fragment]=+.meat.shut-packet.task + ?. &(=(num-fragments 1) =(fragment-num 0)) + (hear [lane shut-packet ok]:task) + (check-pending-acks fragment-num num-fragments fragment) + :: + ++ ack-on-corked-bone + :: if we %hear a fragment on a corked bone, always ack + :: + =. peer-core + %+ send-shut-packet bone + [message-num.shut-packet.task %| %| ok=& lag=*@dr] + %. sink + %+ pe-trace odd.veb + |.("hear {<(received bone)>} on corked bone={}") + :: + ++ check-pending-acks + :: if this is a %cork %plea and are still waiting to + :: hear %acks for previous naxplanation we sent, no-op + :: + |= [num=@ud frags=@ud frag=@uw] + ^+ sink + =/ message-blob=* + %+ assemble-fragments frags + (~(gas by *(map fragment-num fragment)) [num frag]~) + =/ cork-plea=? + ?=(^ ;;((soft [%$ path %cork ~]) message-blob)) + =/ pending-ack=? + =/ nax-bone=^bone (mix 0b10 bone) + =/ live-packets=@ud + ~(wyt by live.packet-pump-state.state:(abed:mu nax-bone)) + (gth live-packets 0) + ?. &(cork-plea pending-ack) + (hear [lane shut-packet ok]:task) + %. sink + %+ pe-trace odd.veb + |.("pending ack for naxplanation, skip %cork bone={}") + -- == :: +| %tasks From 2b9d6039514bcb14518470bc4aa58970e1a27cd1 Mon Sep 17 00:00:00 2001 From: fang Date: Wed, 24 May 2023 14:07:29 +0200 Subject: [PATCH 12/20] ames: turn all pending %boons into %losts This was the behavior prior to d8e11b6, except that we now correctly include the new %boon in the transformation also. --- pkg/arvo/sys/vane/ames.hoon | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 0067a656f..e88b6b5dd 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -4018,13 +4018,14 @@ :: =/ dat [her bone=bone message-num=message-num] ?:(ok "sink boon {}" "crashed on sink boon {}") - :: if we previously crashed on this message; - :: notify client vane instead of making it try again - :: - =. peer-core - %+ pe-emit (got-duct bone) - ?. ok [%give %lost ~] - [%give %boon message] + =. peer-core (pe-emit (got-duct bone) %give %boon message) + =? moves !ok + :: we previously crashed on this message; notify client vane + :: + %+ turn moves + |= =move + ?. ?=([* %give %boon *] move) move + [duct.move %give %lost ~] :: send ack unconditionally :: (call %done ok=%.y) From 48adc133e4a1afda17261b3ea5de9a25824d6f7d Mon Sep 17 00:00:00 2001 From: pkova Date: Wed, 24 May 2023 18:37:54 +0300 Subject: [PATCH 13/20] mar: add vere mark --- pkg/arvo/mar/vere.hoon | 1 + pkg/base-dev/mar/vere.hoon | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 120000 pkg/arvo/mar/vere.hoon create mode 100644 pkg/base-dev/mar/vere.hoon diff --git a/pkg/arvo/mar/vere.hoon b/pkg/arvo/mar/vere.hoon new file mode 120000 index 000000000..1fd0934f0 --- /dev/null +++ b/pkg/arvo/mar/vere.hoon @@ -0,0 +1 @@ +../../base-dev/mar/vere.hoon \ No newline at end of file diff --git a/pkg/base-dev/mar/vere.hoon b/pkg/base-dev/mar/vere.hoon new file mode 100644 index 000000000..18a8e125c --- /dev/null +++ b/pkg/base-dev/mar/vere.hoon @@ -0,0 +1,17 @@ +|_ v=vere +++ grab + |% + ++ noun vere + -- +++ grow + |% + ++ json + %- pairs:enjs:format + :- [%non s+non.v] + :- [%rev (path:enjs:format rev.v)] + %+ turn kel.v + |= w=weft + [lal.w (numb:enjs:format num.w)] + -- +++ grad %noun +-- From 599759cc383653a145727b182dea7bd558199e18 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 24 May 2023 11:40:45 -0400 Subject: [PATCH 14/20] Update CONTRIBUTING.md We no longer recommend creating an issue to correspond to a PR or using that issue's name in the branch name for the PR. That was useful when ZenHub was used for tracking PRs, but it's not anymore. --- CONTRIBUTING.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 59db35a6b..69cdb7006 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,15 +31,6 @@ them. "It would be cool if.." probably does not, in itself, constitute a good feature request; instead, try to be specific about what you're requesting, and what your desired feature would accomplish. -### Feature Branch Names - -Every branch that you intend to put up for review must adhere to the form -`i//<...>`, where `` is the number of the issue that the branch -corresponds to and `<...>` is an optional short description of the branch to aid -in readability. If `<...>` is omitted, the `/` should be omitted as well, which -makes `i/` a well-formed branch name. These feature branches should be based -off of `develop`. - ### Commits Commits should generally be relevant, atomic, and have descriptions formatted in From 1e6899660b0a6faad09169a9596a3108c214b155 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 24 May 2023 11:01:21 -0400 Subject: [PATCH 15/20] test: removes unused arms from fine tests, factors out duplicate paths --- tests/sys/fine.hoon | 41 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/tests/sys/fine.hoon b/tests/sys/fine.hoon index a36b1d4fd..7c9844a18 100644 --- a/tests/sys/fine.hoon +++ b/tests/sys/fine.hoon @@ -3,40 +3,17 @@ /+ *test, v=test-ames-gall /* kelvin %hoon /sys/kelvin => |% - ++ crypto-core - |% ++ nec (pit:nu:crub:crypto 512 (shaz 'nec')) - ++ bud (pit:nu:crub:crypto 512 (shaz 'bud')) - ++ sign - |= [=ship data=@ux] - %. data - ?:(=(ship ~nec) sigh:as:nec sigh:as:bud) - -- - :: - ++ n-frags - |= n=@ - ^- @ux - :: 6 chosen randomly to get some trailing zeros - :: - %+ rsh 10 - %+ rep 13 - %+ turn (gulf 1 n) - |=(x=@ (fil 3 1.024 (dis 0xff x))) - :: - ++ custom-roof + ++ kelvin-roof ^- roof :: |= [lyc=gang vis=view bem=beam] ^- (unit (unit cage)) + ?> =(s.bem /sys/kelvin) ?+ vis ~ %cp =/ black=dict:clay %*(. *dict:clay mod.rul %black) ``noun+!>([black black]) - :: - %cz - ?+ -.r.bem !! - %ud ``noun+!>((n-frags p.r.bem)) - == :: %cx ``hoon+!>(kelvin) == @@ -77,7 +54,7 @@ sndr-tick=0b1 rcvr-tick=0b1 origin=~ - content=(etch-request-content ~nec /~bud/1/1/c/x/1/kids/sys/kelvin 1) + content=(etch-request-content ~nec (weld /~bud/1/1 scry-path) 1) == ~& > 'poke requester %ames with a %keen task' =^ t1 ames.nec @@ -116,9 +93,9 @@ ~& > 'gives a remote scry response to listeners' =/ [sig=@ux meows=(list @ux)] %: ames-scry-hunk:v ames.bud - [~1111.1.2 0xbeef.dead custom-roof] + [~1111.1.2 0xbeef.dead kelvin-roof] ~bud - [1 16.384 /~bud/1/1/c/x/1/kids/sys/kelvin] + [1 16.384 (weld /~bud/1/1 scry-path)] == =/ response=shot:ames :* [sndr=~bud rcvr=~nec] @@ -132,7 +109,7 @@ == :: =/ roar=(unit roar:ames) - :+ ~ [/~bud/1/1/c/x/1/kids/sys/kelvin `hoon+kelvin] + :+ ~ [(weld /~bud/1/1 scry-path) `hoon+kelvin] [[~bud [1 sig]] ~ ~] =^ t4 ames.nec %: ames-check-call:v ames.nec @@ -155,7 +132,7 @@ sndr-tick=0b1 rcvr-tick=0b1 origin=~ - content=(etch-request-content ~nec /~bud/1/1/c/x/5/kids/sys/kelvin 1) + content=(etch-request-content ~nec (weld /~bud/1/1 future-path) 1) == ~& > 'poke requester %ames with a %keen task for a future case' =^ t5 ames.nec @@ -201,8 +178,8 @@ %: ames-check-call:v ames.nec [~1111.1.1 0xdead.beef *roof] [~[/wham-duct] %wham ~bud future-path] - :~ [~[/keen-duct-4] [%give %tune [~bud /c/x/5/kids/sys/kelvin] ~]] - [~[/keen-duct-5] [%give %tune [~bud /c/x/5/kids/sys/kelvin] ~]] + :~ [~[/keen-duct-4] [%give %tune [~bud future-path] ~]] + [~[/keen-duct-5] [%give %tune [~bud future-path] ~]] [~[//unix] %pass future-behn %b %rest ~1111.1.1..00.00.01] == == From ee8e2e997cfe9ddf0d8dcda3cfc679f96f206fb9 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 24 May 2023 12:48:03 -0400 Subject: [PATCH 16/20] tests: fixes +ames-scry-hunk in ames/gall test helper --- pkg/arvo/lib/test/ames-gall.hoon | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/lib/test/ames-gall.hoon b/pkg/arvo/lib/test/ames-gall.hoon index 3c1f58a4b..ec4f97223 100644 --- a/pkg/arvo/lib/test/ames-gall.hoon +++ b/pkg/arvo/lib/test/ames-gall.hoon @@ -188,7 +188,7 @@ %- need %- need (scry:(ames-gate now eny roof) ~ %x beam) :: - =/ paz=(list have:ames) + =/ paz=(list have:ames) %+ spun meows |= [blob=@ux num=_1] ^- [have:ames _num] @@ -196,9 +196,10 @@ [num (sift-meow:ames blob)] :: :- sig:(sift-roar:ames-raw (lent paz) (flop paz)) - %+ turn meows - |= meow=@ux - (can 3 4^lop 2^wid wid^`@`pat (met 3 meow)^meow ~) + %+ spun meows + |= [meow=@ux num=_1] + :_ +(num) + (can 3 4^num 2^wid wid^`@`pat (met 3 meow)^meow ~) :: :: ++ ames-scry-peer |= $: =ames-gate From 6443e80bdc49b09247de276ca0b95567653de3f3 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 24 May 2023 12:48:36 -0400 Subject: [PATCH 17/20] tests: adds failing misordered fine response test --- tests/sys/fine.hoon | 116 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/tests/sys/fine.hoon b/tests/sys/fine.hoon index 7c9844a18..3ee03c80c 100644 --- a/tests/sys/fine.hoon +++ b/tests/sys/fine.hoon @@ -18,6 +18,15 @@ %cx ``hoon+!>(kelvin) == :: + ++ bex-roof + ^- roof + |= [lyc=gang vis=view bem=beam] + ^- (unit (unit cage)) + ?> =(s.bem //some/data/atom) + ?+ vis ~ + %gx ``atom+!>((bex (bex 14))) + == + :: ++ etch-request-content |= [our=@p =path num=@ud] ^- @ @@ -192,4 +201,111 @@ listeners:u.keen ~& > 'checks no more listeners' (expect-eq !>(~) !>(listeners)) +:: +++ test-fine-misordered + %- run-chain + |. :- %| + =+ (nec-bud:v life=[nec=1 bud=1] rift=[nec=1 bud=1]) + :: uncomment to turn on verbose debug output + ::=^ * ames.nec + :: (ames-call:v ames.nec ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof) + ::=^ * ames.bud + :: (ames-call:v ames.bud ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof) + =/ scry-path=path /g/x/0/dap//some/data/atom + =/ fine-behn-wire=wire (weld /fine/behn/wake/~bud scry-path) + =/ =task:ames [%keen ~bud scry-path] + :: + =/ requests=(list shot:ames) + %+ turn (gulf 1 3) + |= frag=@ud + ^- shot:ames + :* [sndr=~nec rcvr=~bud] + req=& sam=| + sndr-tick=0b1 + rcvr-tick=0b1 + origin=~ + content=(etch-request-content ~nec (weld /~bud/1/1 scry-path) frag) + == + =+ ^= [req1 req2 req3] + ?> ?=([^ ^ ^ *] requests) + [i i.t i.t.t]:requests + ~& > 'poke requester %ames with a %keen task' + =^ t1 ames.nec + %: ames-check-call:v ames.nec + [~1111.1.1 0xdead.beef *roof] + [~[/keen-duct-1] task] + :~ [~[//unix] [%give %send [%& ~bud] (etch-shot:ames req1)]] + [~[//unix] %pass fine-behn-wire %b %wait ~1111.1.1..00.00.01] + == + == + :: + =/ [sig=@ux meows=(list @ux)] + %: ames-scry-hunk:v ames.bud + [~1111.1.1 0xbeef.dead bex-roof] + ~bud + [1 16.384 (weld /~bud/1/1 scry-path)] + == + =/ responses=(list shot:ames) + %+ turn meows + |= m=@ux + ^- shot:ames + :* [sndr=~bud rcvr=~nec] + req=| sam=| + sndr-tick=0b1 + rcvr-tick=0b1 + origin=~ + content=m + == + =+ ^= [resp1 resp2 resp3] + ?> ?=([^ ^ ^ *] responses) + [i i.t i.t.t]:responses + :: + =/ roar=(unit roar:ames) + :+ ~ [(weld /~bud/1/1 scry-path) `atom+(bex (bex 14))] + [[~bud [1 sig]] ~ ~] + :: + :- t1 |. :- %| + ~& > 'hear first response fragment' + =^ t2 ames.nec + %: ames-check-call:v ames.nec + [~1111.1.2 0xbeef.dead *roof] + :- ~[//fine] + :* %hear [%& ~bud] + (etch-shot:ames resp1) + == + :~ [~[//fine] %pass /qos %d %flog %text "; ~bud is your neighbor"] + [~[//unix] [%give %send [%& ~bud] (etch-shot:ames req2)]] + [~[//unix] [%give %send [%& ~bud] (etch-shot:ames req3)]] + [~[//unix] %pass fine-behn-wire %b %rest ~1111.1.1..00.00.01] + [~[//unix] %pass fine-behn-wire %b %wait ~1111.1.2..00.02.00] + == + == + :: + :- t2 |. :- %| + ~& > 'hear third response fragment' + =^ t3 ames.nec + %: ames-check-call:v ames.nec + [~1111.1.2 0xbeef.dead *roof] + :- ~[//fine] + :* %hear [%& ~bud] + (etch-shot:ames resp3) + == + :: + ~ + == + :- t3 |. :- %& + ~& > 'hear second response fragment' + =^ t4 ames.nec + %: ames-check-call:v ames.nec + [~1111.1.3 0xbeef.dead *roof] + :- ~[//fine] + :* %hear [%& ~bud] + (etch-shot:ames resp2) + == + :~ [~[/keen-duct-1] %give %tune [~bud scry-path] roar] + [~[//unix] %pass fine-behn-wire %b %rest ~1111.1.2..00.02.00] + == + == + :: + t4 -- From b0d2db25b5bc3349c126f304291bb91121ddd369 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 24 May 2023 12:52:21 -0400 Subject: [PATCH 18/20] fine: narrows error message scope on bad responses --- pkg/arvo/sys/vane/ames.hoon | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index b74e3f627..25bb03db3 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -293,8 +293,9 @@ :- sig =+ dat=(rsh 9 mes) ?~ dat ~ + =/ non ~|(%fine-cue (cue dat)) ~| [%fine %response-not-cask] - ;;((cask) (cue dat)) + ;;((cask) non) :: +etch-hunk: helper core to serialize a $hunk :: ++ etch-hunk @@ -4312,12 +4313,12 @@ :: ++ fi-sift-full =, keen - ~| %frag-mismatch - ~| have/num-received - ~| need/num-fragments - ~| path/path - ?> =(num-fragments num-received) - ?> =((lent hav) num-received) + ?. ?& =(num-fragments num-received) + =((lent hav) num-received) + == + ~| :- %frag-mismatch + [have/num-received need/num-fragments path/path] + !! (sift-roar num-fragments hav) :: ++ fi-fast-retransmit From fee0f604cc9595b31cd449f512dadc52c2fe0824 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 24 May 2023 13:01:29 -0400 Subject: [PATCH 19/20] fine: sort response fragments before deserializing --- pkg/arvo/sys/vane/ames.hoon | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 25bb03db3..401884c70 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -288,7 +288,9 @@ ^- [sig=@ux dat=$@(~ (cask))] =/ mes=@ %+ rep response-size - (roll hav |=([=have dat=(list @ux)] [dat.have dat])) + %+ turn + (sort hav |=([a=have b=have] (lth fra.a fra.b))) + |=(=have dat.have) =+ sig=(end 9 mes) :- sig =+ dat=(rsh 9 mes) From 1e74e8d19acd2cbf8da580e3dcb1afe1f6f9b0cb Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Fri, 26 May 2023 10:09:44 +0200 Subject: [PATCH 20/20] ames: simplify pending-acks conditional --- pkg/arvo/sys/vane/ames.hoon | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 42c550623..8d29a8e71 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3774,7 +3774,7 @@ %drop sink(nax.state (~(del in nax.state) message-num.task)) %done (done ok.task) :: - %hear + %hear |^ ?: ?| corked ?& %*(corked sink bone (mix 0b10 bone)) =(%nack (received bone)) @@ -3783,9 +3783,9 @@ :: ?> ?=(%& -.meat.shut-packet.task) =+ [num-fragments fragment-num fragment]=+.meat.shut-packet.task - ?. &(=(num-fragments 1) =(fragment-num 0)) - (hear [lane shut-packet ok]:task) - (check-pending-acks fragment-num num-fragments fragment) + ?: &(=(num-fragments 1) =(fragment-num 0)) + (check-pending-acks fragment) + (hear [lane shut-packet ok]:task) :: ++ ack-on-corked-bone :: if we %hear a fragment on a corked bone, always ack @@ -3798,22 +3798,16 @@ |.("hear {<(received bone)>} on corked bone={}") :: ++ check-pending-acks - :: if this is a %cork %plea and are still waiting to - :: hear %acks for previous naxplanation we sent, no-op + :: if this is a %cork %plea and we are still waiting to + :: hear %acks for previous naxplanations we sent, no-op :: - |= [num=@ud frags=@ud frag=@uw] + |= frag=@uw ^+ sink - =/ message-blob=* - %+ assemble-fragments frags - (~(gas by *(map fragment-num fragment)) [num frag]~) - =/ cork-plea=? - ?=(^ ;;((soft [%$ path %cork ~]) message-blob)) - =/ pending-ack=? - =/ nax-bone=^bone (mix 0b10 bone) - =/ live-packets=@ud - ~(wyt by live.packet-pump-state.state:(abed:mu nax-bone)) - (gth live-packets 0) - ?. &(cork-plea pending-ack) + =/ blob=* (cue (rep packet-size [frag]~)) + =+ pump=(abed:mu (mix 0b10 bone)) + ?. ?& ?=(^ ;;((soft [%$ path %cork ~]) blob)) + ?=(^ live.packet-pump-state.state.pump) + == (hear [lane shut-packet ok]:task) %. sink %+ pe-trace odd.veb