From 94889841955c697412e1e79e64dc8e0c049f4097 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 28 Jun 2019 14:26:40 -0700 Subject: [PATCH 001/151] larva passes tests --- pkg/arvo/sys/vane/alef.hoon | 141 ++++++++++++++++++++---------- pkg/arvo/tests/sys/vane/alef.hoon | 52 ++++++----- 2 files changed, 125 insertions(+), 68 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index ad1c1e8520..e9180bee71 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -579,7 +579,12 @@ :: $move: output effect; either request or response :: +$ move [=duct card=(wind note gift)] +:: $queued-event: event to be handled after initial boot completes :: ++$ queued-event + $% [%call =duct type=* wrapped-task=(hobo task)] + [%take =wire =duct type=* =sign] + == :: $task: job for ames :: :: %born: process restart notification @@ -688,25 +693,18 @@ :: keys. :: +$ note - $% $: %a - $% [%memo sponsor=ship message=_[/a/ping ~]] - == == - $: %b + $~ [%b %wait *@da] + $% $: %b $% [%wait date=@da] [%rest date=@da] == == - $: %c - $% [%memo =ship =message] - == == - $: %g - $% [%memo =ship =message] - == == $: %j - $% [%memo =ship =message] - :: - [%private-keys ~] + $% [%private-keys ~] [%public-keys =ship] [%turf ~] + == == + $: @tas + $% [%memo =ship =message] == == == :: $sign: response from other vane :: @@ -722,27 +720,18 @@ :: triggers the next heartbeat message to be sent. :: +$ sign - $% $: %a - $% [%done error=(unit error)] - == == - $: %b + $~ [%b %wake ~] + $% $: %b $% [%wake error=(unit tang)] == == - $: %c - $% [%done error=(unit error)] - [%memo =message] - == == - $: %g - $% [%done error=(unit error)] - [%memo =message] - == == $: %j - $% [%done error=(unit error)] - [%memo =message] - :: - [%private-keys =life =private-key] + $% [%private-keys =life =private-key] [%public-keys =vent-result] [%turf turfs=(list turf)] + == == + $: @tas + $% [%done error=(unit error)] + [%memo =message] == == == :: $message-pump-task: job for |message-pump :: @@ -816,8 +805,79 @@ -- :: external vane interface :: -=< |= pit=vase +:: larval ames, before %born sets .unix-duct; wraps adult ames core +:: +=< =* adult-gate . + =| queued-events=(qeu queued-event) + :: + |= [our=ship eny=@ now=@da scry-gate=sley] + =* larval-gate . + =* adult-core (adult-gate +<) + |% + :: +call: handle request $task + :: + ++ call + |= [=duct type=* wrapped-task=(hobo task)] + :: %born: set .unix-duct and start draining .queued-events + :: + ?: ?=(%born -.wrapped-task) + :: process %born using wrapped adult ames + :: + =^ moves adult-gate (call:adult-core duct type wrapped-task) + :: if no events were queued up, metamorphose + :: + ?~ queued-events + [moves adult-gate] + :: kick off a timer to process the first of .queued-events + :: + =. moves :_(moves [duct %pass /larva %b %wait now]) + [moves larval-gate] + :: any other event: enqueue it until we have a .unix-duct + :: + =. queued-events (~(put to queued-events) %call duct type wrapped-task) + [~ larval-gate] + :: +take: handle response $sign + :: + ++ take + |= [=wire =duct type=* =sign] + :: enqueue event if not a larval drainage timer + :: + ?. =(/larva wire) + =. queued-events (~(put to queued-events) %take wire duct type sign) + [~ larval-gate] + :: larval event drainage timer; pop and process a queued event + :: + ?> ?=(%wake -.sign) + =^ first-event queued-events ~(get to queued-events) + =^ moves adult-gate + ?- -.first-event + %call (call:adult-core +.first-event) + %take (take:adult-core +.first-event) + == + :: .queued-events has been cleared; metamorphose + :: + ?~ queued-events + [moves adult-gate] + :: set timer to drain next event + :: + =. moves :_(moves [duct %pass /larva %b %wait now]) + [moves larval-gate] + :: lifecycle arms; mostly pass-throughs to the contained adult ames + :: + ++ scry scry:adult-core + ++ stay [queued-events stay:adult-core] + ++ load + |= old=_[queued-events stay:adult-core] + ^+ larval-gate + :: + =. queued-events -.old + =. adult-gate (load:adult-core +.old) + larval-gate + -- +:: adult ames, after metamorphosis from larva +:: +=< =| =ames-state |= [our=ship eny=@ now=@da scry-gate=sley] =* ames-gate . @@ -860,16 +920,10 @@ =^ moves ames-state =< abet ?- sign + [@ %done *] (on-take-done:event-core wire error.sign) + [@ %memo *] (on-take-memo:event-core wire message.sign) + :: [%b %wake *] (on-take-wake:event-core wire error.sign) - :: - [%a %done *] (on-take-done:event-core wire error.sign) - [%c %done *] (on-take-done:event-core wire error.sign) - [%g %done *] (on-take-done:event-core wire error.sign) - [%j %done *] (on-take-done:event-core wire error.sign) - :: - [%c %memo *] (on-take-memo:event-core wire message.sign) - [%g %memo *] (on-take-memo:event-core wire message.sign) - [%j %memo *] (on-take-memo:event-core wire message.sign) :: [%j %private-keys *] (on-priv:event-core [life private-key]:sign) [%j %public-keys *] (on-publ:event-core wire vent-result.sign) @@ -936,13 +990,8 @@ ++ on-hear |= [=lane =blob] ^+ event-core - :: register this duct as our new .unix-duct :: - =. unix-duct.ames-state duct - :: - =/ =packet (decode-packet blob) - :: - (on-hear-packet lane packet) + (on-hear-packet lane (decode-packet blob)) :: +on-hear-packet: handle mildly processed packet receipt :: ++ on-hear-packet @@ -1355,7 +1404,7 @@ :: +on-born: handle unix process restart :: +on-vega: handle kernel reload :: - ++ on-born event-core + ++ on-born event-core(unix-duct.ames-state duct) ++ on-vega event-core :: +enqueue-alien-todo: helper to enqueue a pending request :: diff --git a/pkg/arvo/tests/sys/vane/alef.hoon b/pkg/arvo/tests/sys/vane/alef.hoon index 626ff5b18d..6b07920a08 100644 --- a/pkg/arvo/tests/sys/vane/alef.hoon +++ b/pkg/arvo/tests/sys/vane/alef.hoon @@ -24,8 +24,8 @@ =/ bob-pub pub:ex:crypto-core.ames-state.bob =/ bob-sec sec:ex:crypto-core.ames-state.bob :: -=/ alice-sym (derive-symmetric-key:alef bob-pub alice-sec) -=/ bob-sym (derive-symmetric-key:alef alice-pub bob-sec) +=/ alice-sym (derive-symmetric-key:vane bob-pub alice-sec) +=/ bob-sym (derive-symmetric-key:vane alice-pub bob-sec) :: ?> =(alice-sym bob-sym) :: @@ -54,7 +54,13 @@ == =. route.peer-state `[direct=%.y `lane:alef`[%| `@`%lane-bar]] [%known peer-state] +:: metamorphose :: +=> .(alice +:(call:(alice) ~[//unix] ** %born ~)) +=> .(bob +:(call:(bob) ~[//unix] ** %born ~)) +:: helper core +:: +=> |% ++ move-to-packet |= =move:alef @@ -75,7 +81,25 @@ %- move-to-packet %+ snag index (skim moves is-move-send) +:: +++ call + |= [vane=_alice =duct =task:alef] + ^- [moves=(list move:alef) _alice] + :: + =/ vane-core (vane(now `@da`(add ~s1 now.vane))) + :: + (call:vane-core duct ** task) +:: +++ take + |= [vane=_alice =wire =duct =sign:alef] + ^- [moves=(list move:alef) _alice] + :: + =/ vane-core (vane(now `@da`(add ~s1 now.vane))) + :: + (take:vane-core wire duct ** sign) -- +:: test core +:: |% ++ test-packet-encoding ^- tang :: @@ -86,8 +110,8 @@ content=[12 13] == :: - =/ encoded (encode-packet:alef packet) - =/ decoded (decode-packet:alef encoded) + =/ encoded (encode-packet:vane packet) + =/ decoded (decode-packet:vane encoded) :: %+ expect-eq !> packet @@ -111,10 +135,10 @@ :* [sndr=~bus rcvr=~doznec-doznec] encrypted=%.y origin=~ - content=(encrypt:alef alice-sym shut-packet) + content=(encrypt:vane alice-sym shut-packet) == :: - =/ =blob:alef (encode-packet:alef packet) + =/ =blob:alef (encode-packet:vane packet) =^ moves1 bob (call bob ~[//unix] %hear lane-foo blob) =^ moves2 bob =/ =point:alef @@ -181,20 +205,4 @@ %+ expect-eq !> [~[/alice] %give %done `error] !> (snag 1 `(list move:alef)`moves5) -:: -++ call - |= [vane=_alice =duct =task:alef] - ^- [moves=(list move:alef) _alice] - :: - =/ vane-core (vane(now `@da`(add ~s1 now.vane))) - :: - (call:vane-core duct ** task) -:: -++ take - |= [vane=_alice =wire =duct =sign:alef] - ^- [moves=(list move:alef) _alice] - :: - =/ vane-core (vane(now `@da`(add ~s1 now.vane))) - :: - (take:vane-core wire duct ** sign) -- From 99134ef5b96e25a3cff705d7bc63e6d05900fa1b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 28 Jun 2019 15:27:59 -0700 Subject: [PATCH 002/151] zuse compiles --- pkg/arvo/sys/vane/alef.hoon | 185 ++++------- pkg/arvo/sys/zuse.hoon | 645 ++++++++---------------------------- 2 files changed, 201 insertions(+), 629 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index e9180bee71..5e8c7fd223 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1,3 +1,56 @@ +:: Ames extends Arvo's %pass/%give move semantics across the network. +:: +:: A "forward flow" message, which is like a request, is passed to +:: Ames from a local vane. Ames transmits the message to the peer's +:: Ames, which passes the message to the destination vane. +:: +:: Once the peer has processed the "forward flow" message, it sends a +:: message acknowledgment over the wire back to the local Ames. This +:: ack can either be positive or negative, in which case we call it a +:: "nack". (Don't confuse Ames nacks with TCP nacks, which are a +:: different concept). +:: +:: When the local Ames receives either a positive message ack or a +:: combination of a nack and nack-trace (explained in more detail +:: below), it gives an %done move to the local vane that had +:: requested the original "forward flow" message be sent. +:: +:: A "backward flow" message, which is similar to a response or a +:: subscription update, is given to Ames from a local vane. Ames +:: transmits the message to the peer's Ames, which gives the message +:: to the destination vane. +:: +:: Ames will give a %memo to a vane upon hearing the message from a +:: remote. This message is a "backward flow" message, forming one of +:: potentially many responses to a "forward flow" message that a +:: local vane had passed to our local Ames, and which local Ames had +:: relayed to the remote. Ames gives the %memo on the same duct the +:: local vane had originally used to pass Ames the "forward flow" +:: message. +:: +:: Backward flow messages are acked automatically by the receiver. +:: They cannot be nacked, and Ames only uses the ack internally, +:: without notifying the client vane. +:: +:: Forward flow messages can be nacked, in which case the peer will +:: send both a message-nack packet and a nack-trace message, which is +:: sent on a special diagnostic flow so as not to interfere with +:: normal operation. The nack-trace is sent as a full Ames message, +:: instead of just a packet, because the contained error information +:: can be arbitrarily large. +:: +:: Once the local Ames has received the nack-trace, it knows the peer +:: has received the full message and failed to process it. This +:: means if we later hear an ack packet on the failed message, we can +:: ignore it. +:: +:: Also, due to Ames's exactly-once delivery semantics, we know that +:: when we receive a nack-trace for message n, we know the peer has +:: positively acked all messages m+1 through n-1, where m is the last +:: message for which we heard a nack-trace. If we haven't heard acks +:: on all those messages, we apply positive acks when we hear the +:: nack-trace. +:: :: protocol-version: current version of the ames wire protocol :: =/ protocol-version=?(%0 %1 %2 %3 %4 %5 %6 %7) %0 @@ -239,8 +292,6 @@ :: +| %atomics :: -+$ address @uxaddress -+$ blob @uxblob +$ bone @udbone +$ fragment @uwfragment +$ fragment-num @udfragmentnum @@ -309,20 +360,6 @@ :: $dyad: pair of sender and receiver ships :: +$ dyad [sndr=ship rcvr=ship] -:: -+$ error [tag=@tas =tang] -:: $lane: ship transport address; either opaque $address or galaxy -:: -:: The runtime knows how to look up galaxies, so we don't need to -:: know their transport addresses. -:: -+$ lane (each @pC address) -:: $message: application-level message -:: -:: path: internal route on the receiving ship -:: payload: semantic message contents -:: -+$ message [=path payload=*] :: $packet: noun representation of an ames datagram packet :: :: Roundtrips losslessly through atom encoding and decoding. @@ -585,98 +622,6 @@ $% [%call =duct type=* wrapped-task=(hobo task)] [%take =wire =duct type=* =sign] == -:: $task: job for ames -:: -:: %born: process restart notification -:: %crud: crash report -:: %hear: packet from unix -:: %hole: report that packet handling crashed -:: %init: vane boot -:: %sunk: a ship breached and has a new .rift -:: %vega: kernel reload notification -:: %wegh: request for memory usage report -:: %memo: request to send message -:: -+$ task - $% [%born ~] - [%crud =error] - [%hear =lane =blob] - [%hole =lane =blob] - [%init =ship] - [%vega ~] - [%wegh ~] - [%memo =ship =message] - == -:: $gift: effect from ames -:: -:: Ames extends Arvo's %pass/%give move semantics across the network. -:: -:: A "forward flow" message, which is like a request, is passed to -:: Ames from a local vane. Ames transmits the message to the peer's -:: Ames, which passes the message to the destination vane. -:: -:: Once the peer has processed the "forward flow" message, it sends a -:: message acknowledgment over the wire back to the local Ames. This -:: ack can either be positive or negative, in which case we call it a -:: "nack". (Don't confuse Ames nacks with TCP nacks, which are a -:: different concept). -:: -:: When the local Ames receives either a positive message ack or a -:: combination of a nack and nack-trace (explained in more detail -:: below), it gives an %done move to the local vane that had -:: requested the original "forward flow" message be sent. -:: -:: A "backward flow" message, which is similar to a response or a -:: subscription update, is given to Ames from a local vane. Ames -:: transmits the message to the peer's Ames, which gives the message -:: to the destination vane. -:: -:: Ames will give a %memo to a vane upon hearing the message from a -:: remote. This message is a "backward flow" message, forming one of -:: potentially many responses to a "forward flow" message that a -:: local vane had passed to our local Ames, and which local Ames had -:: relayed to the remote. Ames gives the %memo on the same duct the -:: local vane had originally used to pass Ames the "forward flow" -:: message. -:: -:: Backward flow messages are acked automatically by the receiver. -:: They cannot be nacked, and Ames only uses the ack internally, -:: without notifying the client vane. -:: -:: Forward flow messages can be nacked, in which case the peer will -:: send both a message-nack packet and a nack-trace message, which is -:: sent on a special diagnostic flow so as not to interfere with -:: normal operation. The nack-trace is sent as a full Ames message, -:: instead of just a packet, because the contained error information -:: can be arbitrarily large. -:: -:: Once the local Ames has received the nack-trace, it knows the peer -:: has received the full message and failed to process it. This -:: means if we later hear an ack packet on the failed message, we can -:: ignore it. -:: -:: Also, due to Ames's exactly-once delivery semantics, we know that -:: when we receive a nack-trace for message n, we know the peer has -:: positively acked all messages m+1 through n-1, where m is the last -:: message for which we heard a nack-trace. If we haven't heard acks -:: on all those messages, we apply positive acks when we hear the -:: nack-trace. -:: -:: %memo: message to vane from peer -:: %send: packet to unix -:: %done: notify vane that peer (n)acked our message -:: -:: %mass: memory usage report -:: %turf: domain report, relayed from jael -:: -+$ gift - $% [%memo =message] - [%send =lane =blob] - [%done error=(unit error)] - :: - [%mass mass] - [%turf turfs=(list turf)] - == :: $note: request to other vane :: :: TODO: specialize gall interface for subscription management @@ -698,9 +643,9 @@ $% [%wait date=@da] [%rest date=@da] == == - $: %j + $: %k $% [%private-keys ~] - [%public-keys =ship] + [%public-keys ships=(set ship)] [%turf ~] == == $: @tas @@ -724,7 +669,7 @@ $% $: %b $% [%wake error=(unit tang)] == == - $: %j + $: %k $% [%private-keys =life =private-key] [%public-keys =vent-result] [%turf turfs=(list turf)] @@ -925,9 +870,9 @@ :: [%b %wake *] (on-take-wake:event-core wire error.sign) :: - [%j %private-keys *] (on-priv:event-core [life private-key]:sign) - [%j %public-keys *] (on-publ:event-core wire vent-result.sign) - [%j %turf *] (on-take-turf:event-core turfs.sign) + [%k %private-keys *] (on-priv:event-core [life private-key]:sign) + [%k %public-keys *] (on-publ:event-core wire vent-result.sign) + [%k %turf *] (on-take-turf:event-core turfs.sign) == :: [moves ames-gate] @@ -1170,9 +1115,9 @@ |= our=ship ^+ event-core :: - =~ (emit duct %pass /init/public-keys %j %public-keys our) - (emit duct %pass /init/private-keys %j %private-keys ~) - (emit duct %pass /init/turf %j %turf ~) + =~ (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) + (emit duct %pass /private-keys %k %private-keys ~) + (emit duct %pass /turf %k %turf ~) == :: +on-priv: set our private key to jael's response :: @@ -1430,7 +1375,7 @@ :: ?: already-pending event-core - (emit duct %pass /alien %j %public-keys ship) + (emit duct %pass /public-keys %k %public-keys [n=ship ~ ~]) :: +set-sponsor-heartbeat-timer: trigger sponsor ping after timeout :: ++ set-sponsor-heartbeat-timer @@ -1675,7 +1620,7 @@ |= [=message-num =message] ^+ peer-core :: - ?> ?=([?(%a %c %g %j) *] path.message) + ?> ?=([?(%a %c %g %k) *] path.message) :: odd .bone; "request" message to pass to vane before acking :: ?: =(1 (end 0 1 bone)) @@ -1692,7 +1637,7 @@ %a ~| %bad-ames-message^path.message^her.channel !! %c (emit client-duct %pass wire %c %memo her.channel message) %g (emit client-duct %pass wire %g %memo her.channel message) - %j (emit client-duct %pass wire %j %memo her.channel message) + %k (emit client-duct %pass wire %k %memo her.channel message) == :: even bone means backward flow; ack automatically :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 4e563f2add..0b638a820b 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1,3 +1,4 @@ +!: :: :: /van/zuse :: :: %reference/1 :: %zuse: arvo library. @@ -16,7 +17,7 @@ :: - %eyre: web ("fair") :: - %ford: build ("lord") :: - %gall: application ("ball") -:: - %jael: security ("jail") +:: - %kale: security ("jail") :: :: with %zuse in your core, the engines of any vane are :: available at `engine:vane`. the models (molds) are @@ -120,7 +121,7 @@ -- -- :: :::: -:::: ++ethereum-types :: eth surs for jael +:::: ++ethereum-types :: eth surs for kale :: :::: ++ ethereum-types |% @@ -134,7 +135,7 @@ ++ events (set event-id) -- :: :::: -:::: ++azimuth-types :: az surs for jael +:::: ++azimuth-types :: az surs for kale :: :::: ++ azimuth-types =, ethereum-types @@ -165,7 +166,7 @@ $= kid %- unit $: spawn-proxy=address - spawned=(set @p) ::TODO sparse range, pile, see old jael ++py + spawned=(set @p) ::TODO sparse range, pile, see old kale ++py == == :: @@ -214,7 +215,7 @@ [%wegh ~] :: receive message via %ames :: - [%west p=ship q=path r=*] + [%memo p=ship q=path r=*] == :: :::: :::: ++http :: @@ -374,32 +375,46 @@ :: :::: ++ able ^? |% - ++ gift :: out result <-$ - $% {$mack p/(unit tang)} :: acknowledgement - {$mass p/mass} :: memory usage - {$send p/lane q/@} :: transmit packet - {$turf p/(list turf)} :: bind to domains - $>(%west vane-task) :: for the outside - {$woot p/ship q/coop} :: reaction message - == :: - ++ task :: in request ->$ - $~ [%vega ~] :: - $% {$barn ~} :: new unix process - {$bonk ~} :: reset the timer - $>(%crud vane-task) :: error with trace - {$hear p/lane q/@} :: receive packet - {$halo p/lane q/@ r/ares} :: hole with trace - {$hole p/lane q/@} :: packet failed - $>(%init vane-task) :: report install - {$kick p/@da} :: wake up - {$nuke p/@p} :: toggle auto-block - $>(%sunk vane-task) :: report death - $>(%vega vane-task) :: report upgrade - {$wake ~} :: timer activate - $>(%wegh vane-task) :: report memory - $>(%west vane-task) :: network request - {$want p/ship q/path r/*} :: forward message - == :: + :: $task: job for ames + :: + :: %hear: packet from unix + :: %hole: report that packet handling crashed + :: + :: %born: process restart notification + :: %crud: crash report + :: %init: vane boot + :: %memo: request to send message + :: %vega: kernel reload notification + :: %wegh: request for memory usage report + :: + +$ task + $% [%hear =lane =blob] + [%hole =lane =blob] + :: + $>(%born vane-task) + $>(%crud vane-task) + $>(%init vane-task) + $>(%memo vane-task) + $>(%vega vane-task) + $>(%wegh vane-task) + == + :: $gift: effect from ames + :: + :: %memo: message to vane from peer + :: %send: packet to unix + :: %done: notify vane that peer (n)acked our message + :: + :: %mass: memory usage report + :: %turf: domain report, relayed from kale + :: + +$ gift + $% [%memo =message] + [%send =lane =blob] + [%done error=(unit error)] + :: + [%mass mass] + [%turf turfs=(list turf)] + == -- ::able :: :::: :: (1a2) @@ -427,131 +442,27 @@ ++ com |~(a/pass ^?(..nu)) :: from pass -- ::nu :: -- ::acru :: - ++ bait {p/skin q/@ud r/dove} :: fmt nrecvd spec - ++ bath :: convo per client - $: sop/shed :: not stalled - raz/(map path race) :: statements inbound - ryl/(map path rill) :: statements outbound - == :: - ++ boon :: fort output - $% [%beer p=ship] :: request public keys - [%bock ~] :: bind to domains - [%brew ~] :: request domains - [%cake p=ship q=soap r=coop s=duct] :: e2e message result - [%mead p=lane q=rock] :: accept packet - [%milk p=ship q=soap r=*] :: e2e pass message - [%ouzo p=lane q=rock] :: transmit packet - [%pito p=@da] :: timeout - [%raki p=ship q=life r=pass] :: neighbor'd - [%sake ~] :: our private keys - [%wine p=ship q=tape] :: notify user - == :: - ++ cake {p/sock q/skin r/@} :: top level packet - ++ cape :: end-to-end result - $? $good :: delivered - $dead :: rejected - == :: - ++ clot :: symmetric record - $: yed/(unit {p/hand q/code}) :: outbound - heg/(map hand code) :: proposed - qim/(map hand code) :: inbound - == :: - ++ code @uvI :: symmetric key - ++ corn :: flow by server - $: nys/(map flap bait) :: packets incoming - olz/(map flap cape) :: packets completed - wab/(map ship bath) :: relationship - == :: - +$ deed [=life =pass oath=(unit oath:pki:jael)] :: life/pub/sig - ++ dore :: foreign contact - $: wod/road :: connection to - caq/clot :: symmetric key state - == :: - ++ dove {p/@ud q/(map @ud @)} :: count hash 13-blocks - ++ flap @uvH :: network packet id - ++ flow :: packet connection - $: rtt/@dr :: decaying avg rtt - wid/@ud :: logical wdow msgs - == :: - ++ fort :: formal state - $: $1 :: version - gad/duct :: client interface - tim/(unit @da) :: pending timer - tuf/(list turf) :: domains - hop/@da :: network boot date - bad/(set @p) :: bad ships - ton/town :: security - zac/corn :: flows by server - == :: - ++ hand @uvH :: 128-bit hash - ++ lane :: packet route - $% {$if p/@da q/@ud r/@if} :: IP4/public UDP/addr - {$is p/@ud q/(unit lane) r/@is} :: IPv6 w+alternates - {$ix p/@da q/@ud r/@if} :: IPv4 provisional - == :: - ++ meal :: payload - $% {$back p/coop q/flap r/@dr} :: ack - {$bond p/path q/@ud r/*} :: message - {$carp p/@ q/@ud r/@ud s/flap t/@} :: skin+inx+cnt+hash - {$fore p/ship q/(unit lane) r/@} :: forwarded packet - == :: - ++ name {p/@t q/(unit @t) r/(unit @t) s/@t} :: first mid+nick last - ++ putt :: outgoing message - $: ski/snow :: sequence acked+sent - wyv/(list rock) :: packet list XX gear - == :: - ++ race :: inbound stream - $: did/@ud :: filled sequence - dod/? :: not processing - bum/(map @ud ares) :: nacks - mis/(map @ud {p/cape q/lane r/flap s/(unit)}) :: misordered - == :: - ++ rill :: outbound stream - $: sed/@ud :: sent - san/(map @ud duct) :: outstanding - == :: - ++ road :: secured oneway route - $: exp/@da :: expiration date - lun/(unit lane) :: route to friend - lew/(unit deed) :: deed of friend - == :: - ++ rock @uvO :: packet - ++ shed :: packet flow - $: $: rtt/@dr :: smoothed rtt - rto/@dr :: retransmit timeout - rtn/(unit @da) :: next timeout - rue/(unit @da) :: last heard from - == :: - $: nus/@ud :: number sent - nif/@ud :: number live - nep/@ud :: next expected - caw/@ud :: logical window - cag/@ud :: congest thresh - == :: - $: diq/(map flap @ud) :: packets sent - pyz/(map soup @ud) :: message+unacked - puq/(qeu {p/@ud q/soul}) :: packet queue - == :: - == :: - ++ skin ?($none $open $fast $full) :: encoding stem - ++ snow {p/@ud q/@ud r/(set @ud)} :: window exceptions - ++ soap {p/{p/life q/life} q/path r/@ud} :: statement id - ++ soup {p/path q/@ud} :: new statement id - ++ soul :: packet in travel - $: gom/soup :: message identity - nux/@ud :: xmission count - liv/? :: deemed live - lys/@da :: last sent - pac/rock :: packet data - == :: - ++ town :: all security state - $: any/@ :: entropy - val/wund :: private keys - law/deed :: server deed - seh/(map hand {p/ship q/@da}) :: key cache - hoc/(map ship dore) :: neighborhood - == :: - ++ wund (list {p/life q/ring r/acru}) :: secrets in action + :: $address: opaque atomic transport address to or from unix + :: + +$ address @uxaddress + :: $blob: raw atom to or from unix, representing a packet + :: + +$ blob @uxblob + :: $error: tagged diagnostic trace + :: + +$ error [tag=@tas =tang] + :: $lane: ship transport address; either opaque $address or galaxy + :: + :: The runtime knows how to look up galaxies, so we don't need to + :: know their transport addresses. + :: + +$ lane (each @pC address) + :: $message: application-level message + :: + :: path: internal route on the receiving ship + :: payload: semantic message contents + :: + +$ message [=path payload=*] -- ::ames :: :::: :::: ++behn :: (1b) timekeeping @@ -598,13 +509,13 @@ {$dirk p/@tas} :: mark mount dirty {$ergo p/@tas q/mode} :: version update {$hill p/(list @tas)} :: mount points - {$mack p/(unit tang)} :: ack + [%done error=(unit error:ames)] :: message (n)ack + [%memo =message:ames] :: send ames message {$mass p/mass} :: memory usage {$mere p/(each (set path) (pair term tang))} :: merge result {$note p/@tD q/tank} :: debug message {$ogre p/@tas} :: delete mount point {$rule red/dict wit/dict} :: node r+w permissions - {$send p/lane:ames q/@} :: transmit packet {$writ p/riot} :: response {$wris p/{$da p/@da} q/(set (pair care path))} :: many changes == :: @@ -633,7 +544,7 @@ {$warp wer/ship rif/riff} :: internal file req {$werp who/ship wer/ship rif/riff} :: external file req $>(%wegh vane-task) :: report memory - $>(%west vane-task) :: network request + $>(%memo vane-task) :: network request == :: -- ::able :: @@ -869,10 +780,10 @@ ++ eyre ^? |% ++ bale :: driver state - |* a/_* :: %jael keys type + |* a/_* :: %kale keys type $: {our/ship now/@da eny/@uvJ byk/beak} :: base info {usr/user dom/(list @t)} :: req user, domain - key/a :: secrets from %jael + key/a :: secrets from %kale == :: :: ++ cred :: credential @@ -1725,9 +1636,9 @@ ++ gift :: outgoing result $% {$mass p/mass} :: memory usage {$onto p/(each suss tang)} :: about agent - {$rend p/path q/*} :: network request {$unto p/cuft} :: - {$mack p/(unit tang)} :: message ack + [%done error=(unit error:ames)] :: message (n)ack + [%memo =message:ames] :: send ames message == :: ++ task :: incoming request $~ [%vega ~] :: @@ -1736,7 +1647,7 @@ {$deal p/sock q/cush} :: full transmission $>(%sunk vane-task) :: report death $>(%vega vane-task) :: report upgrade - $>(%west vane-task) :: network request + $>(%memo vane-task) :: network request $>(%wegh vane-task) :: report memory == :: -- ::able @@ -1794,239 +1705,6 @@ ++ well (pair desk term) :: -- ::gall :: :::: -:::: ++jael :: (1h) security - :: :::: -++ jael ^? - |% - :: :: - :::: ++able:jael :: (1h1) arvo moves - :: :::: - ++ able ^? - =, pki - =, rights - |% - :: %jael has two general kinds of task: changes - :: and change subscriptions. - :: - :: change tasks are designed to match high-level - :: operations - for instance, we have %burn, %mint, - :: and %move, not just a single delta operation. - :: more of these operations will probably be added, - :: and invariants enforced at transaction end. - :: - :: subscriptions are also user-focused - for instance, - :: %vein sends all the information needed to maintain - :: the secure channel, both rights and certificates. - :: the security-critical tasks (%veil, %vein, %vine) - :: should probably be bound to a whitelisted duct set. - :: (all secrets are redacted from %vest gifts.) - :: - :: %jael only talks to %ames and %behn. we send messages - :: through %ames and use %behn timers. - :: - ++ logs :: on-chain changes - %+ map event-id:ethereum-types :: per event log - diff-azimuth:azimuth-types :: the change - ++ action :: balance change - %+ pair ship :: partner - %+ each bump :: &/liability change - bump :: |/asset change - :: :: - ++ balance :: balance sheet - %+ pair :: - (map ship safe) :: liabilities - (map ship safe) :: assets - :: :: - ++ vent-result :: %vent result - $% [%snap snap=snapshot:jael] :: restore snapshot - [%chain can=chain] :: get new events - == :: - :: :: - ++ chain :: batch of changes - %+ each logs :: & all events - logs :: | new events - ++ change :: urbit change - $% [%ethe can=chain] :: on-chain change - [%meet who=ship =life =pass] :: meet in new era - $: %rite :: rights change - rex/ship :: issuer - pal/ship :: issued to - del/bump :: change - == == :: - ++ gift :: out result <-$ - $% [%init p=ship] :: report install unix - [%mass p=mass] :: memory usage report - [%mack p=(unit tang)] :: message n/ack - [%pubs public] :: public keys - [%turf turf=(list turf)] :: domains - [%vest p=tally] :: balance update - [%vein =life vein=(map life ring)] :: private keys - [%vine p=(list change)] :: all raw changes - [%vent p=vent-result] :: ethereum changes - == :: - :: :: - ++ public :: public key state - $: life=life :: current key number - pubs=(map life pass) :: pubkeys by number - == :: - ++ remote :: remote notification - %+ each safe :: &/addition - safe :: |/replacement - :: +seed: private boot parameters - :: - +$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)] - :: - ++ tally :: balance update - %+ each balance :: complete - action :: change - :: - += task :: in request ->$ - $~ [%vega ~] :: - $% [%burn p=ship q=safe] :: destroy rights - [%hail p=ship q=remote] :: remote update - $: %dawn :: boot from keys - =seed:able:jael :: identity params - spon=ship :: sponsor - czar=(map ship [=life =pass]) :: galaxy table - turf=(list turf) :: domains - bloq=@ud :: block number - node=(unit purl:eyre) :: gateway url - snap=(unit snapshot) :: head start - == :: - [%fake =ship] :: fake boot - [%look src=(each ship purl:eyre)] :: set ethereum source - [%mint p=ship q=safe] :: create rights - [%move p=ship q=ship r=safe] :: transfer from=to - ::TODO %next for generating/putting new private key - [%nuke ~] :: cancel tracker from - [%pubs =ship] :: view public keys - [%meet =ship =life =pass] :: met after breach - [%snap snap=snapshot kick=?] :: load snapshot - [%turf ~] :: view domains - $>(%vega vane-task) :: report upgrade - [%vein ~] :: view signing keys - [%vent ~] :: view ethereum events - [%vest ~] :: view public balance - [%vine ~] :: view secret history - $>(%wegh vane-task) :: memory usage request - $>(%west vane-task) :: remote request - [%wind p=@ud] :: rewind before block - == :: - -- :: - :: :: - :::: :: - :: :: - ++ node-src :: ethereum node comms - $: node=purl:eyre :: node url - filter-id=@ud :: current filter - poll-timer=@da :: next filter poll - == :: - ++ snapshot :: rewind point - =, azimuth-types :: - $: kyz=(map ship public:able) :: public key state - $= eth :: - $: dns=dnses :: on-chain dns state - pos=(map ship point) :: on-chain ship state - == :: - eth-bookmark - == - :: +eth-bookmark: cursor into the ethereum chain - :: - ++ eth-bookmark - $: heard=(set event-id:ethereum-types) - latest-block=@ud - == - :: +state-eth-node: state of a connection to an ethereum node - :: - ++ state-eth-node :: node config + meta - $: source=(each ship node-src) :: learning from - foreign-block=@ud :: node's latest block - eth-bookmark - == :: - :: :: - :::: ++pki:jael :: (1h2) certificates - :: :::: - ++ pki ^? - |% - ::TODO update to fit azimuth-style keys - :: the urbit meta-certificate (++will) is a sequence - :: of certificates (++cert). each cert in a will - :: revokes and replaces the previous cert. the - :: version number of a ship is a ++life. - :: - :: the deed contains an ++arms, a definition - :: of cosmetic identity; a semi-trusted parent, - :: which signs the initial certificate and provides - :: routing services; and a dirty bit. if the dirty - :: bit is set, the new life of this ship may have - :: lost information that the old life had. - :: - ++ hand @uvH :: 128-bit hash - ++ mind {who/ship lyf/life} :: key identifier - ++ name (pair @ta @t) :: ascii / unicode - ++ oath @ :: signature - -- :: pki - :: :: - :::: ++rights:jael :: (1h3) claims - :: :::: - ++ rights ^? - =, pki - |% - :: %jael tracks promises (++rite) from ship to ship. - :: a rite may be any right, badge, asset, secret, etc. - :: un-shared secret or private asset is stored as a - :: rite from self to self. - :: - :: each rite is really a class of rights, and often - :: has its own internal set or map structure. - :: - :: present kinds of rite: - :: - :: %apple: application secret for a web api. - :: %block: the promisee is banned. - :: %email: email tied to promissee's ship. - :: %final: ship/ticket pair, ready to launch. - :: %fungi: fungible, countable asset. - :: %guest: permission to adopt foreign child. - :: %hotel: block of unissued children. - :: %jewel: urbit private keys. - :: %login: user's login passcode. - :: %pword: password for a website/api. - :: %token: user access token for a web api. - :: %urban: symmetric key for urbit networking. - :: - :: %fungi keys can be anything, but don't reuse - :: currency codes. codes for urbit invitations: - :: %ugl == galaxy, %usr == star, %upl == planet - :: - :: you can think of [our her rite] as an rdf triple. - :: - ++ bill (pair @da @) :: expiring value - ++ bump :: rights change - $: mor/safe :: add rights - les/safe :: lose rights - == :: - ++ dorm (pair ship bloq) :: issuing group - ++ pile (tree (pair @ @)) :: efficient ship set - ++ rite :: urbit commitment - $% {$apple p/(map site @)} :: web api key - {$block ~} :: banned - {$email p/(set @t)} :: email addresses - {$final p/(map ship @pG)} :: ticketed ships - {$fungi p/(map term @ud)} :: fungibles - {$guest ~} :: refugee visa - {$hotel p/(map dorm pile)} :: reserved block - {$jewel p/(map life ring)} :: private keyring - {$login p/(set @pG)} :: login secret - {$pword p/(map site (map @t @t))} :: web passwd by user - {$token p/(map site (map @t @t))} :: app tokens by user - {$urban p/(map hand bill)} :: urbit symmetric keys - == :: - ++ site (list @ta) :: [%com %yahoo %www ~] - ++ safe (tree rite) :: rights set - -- :: rights - -- :: jael -:: :::: :::: ++kale :: (1h) security :: :::: ++ kale ^? @@ -2075,7 +1753,8 @@ ++ gift :: out result <-$ $% [%init p=ship] :: report install unix [%mass p=mass] :: memory usage report - [%mack p=(unit tang)] :: message n/ack + [%done error=(unit error:ames)] :: message (n)ack + [%memo =message:ames] :: send ames message [%source whos=(set ship) src=source] :: [%turf turf=(list turf)] :: domains [%private-keys =life vein=(map life ring)] :: private keys @@ -2109,7 +1788,7 @@ [%vent-update =vent-result] :: update from app $>(%vega vane-task) :: report upgrade $>(%wegh vane-task) :: memory usage request - $>(%west vane-task) :: remote request + $>(%memo vane-task) :: remote request [%wind p=@ud] :: rewind before block == :: -- :: @@ -2442,56 +2121,6 @@ =request:http == -- -:: :::: -:::: ++xmas :: (1i) new network - :: :::: -++ xmas ^? - :: :: - :::: ++able:xmas :: (1i1) arvo moves - :: :::: - |% - ++ able ^? - |% - ++ gift :: - $% {$east p/*} :: response message - {$home p/lane q/@} :: process forward - {$send p/lane q/@} :: send packet - {$rest p/coop} :: acknowledgment - == :: - ++ task :: in request ->$ - $% {$hear p/lane q/@} :: - {$mess p/ship q/path r/*} :: send message - {$wake ~} :: - == :: - ++ card :: out cards - $% {$west p/ship q/path r/*} :: network request - == :: - ++ sign :: in response $-< - $: $g :: - $% {$rend p/path q/*} :: network request - {$mack p/(unit tang)} :: message ack - == == :: - ++ note :: out request $-> - $% {$c $west p/ship q/path r/*} :: to %clay - {$e $west p/ship q/path r/*} :: to %eyre - {$g $west p/ship q/path r/*} :: to %gall - $: $j :: to %jael - $% {$line p/ship q/@da r/code} :: - {$link p/ship q/@da r/code} :: - {$veil p/ship} :: - {$west p/ship q/path r/*} :: to %gall - == == == :: - -- :: able - :: - :::: :: (1i2) - :: - ++ code @uvI :: symmetric key - ++ lane :: packet route - $% {$if p/@da q/@ud r/@if} :: IP4/public UDP/addr - {$is p/@ud q/(unit lane) r/@is} :: IPv6 w+alternates - {$ix p/@da q/@ud r/@if} :: IPv4 provisional - == :: - -- ::xmas -- :: :: :: :: :::: :: :: (2) engines @@ -7021,14 +6650,14 @@ ++ saxo :: autocanon |= [our=ship now=@da who=ship] .^ (list ship) - %j + %k /(scot %p our)/saxo/(scot %da now)/(scot %p who) == :: :: ++sein:title ++ sein :: autoboss |= [our=ship now=@da who=ship] .^ ship - %j + %k /(scot %p our)/sein/(scot %da now)/(scot %p who) == :: :: ++team:title @@ -7602,7 +7231,7 @@ gift:able:dill gift:able:ford gift:able:gall - gift:able:jael + gift:able:kale gift:able:http-client gift:able:http-server == @@ -7613,19 +7242,19 @@ task:able:dill task:able:ford task:able:gall - task:able:jael + task:able:kale task:able:http-client task:able:http-server == ++ note-arvo :: out request $-> - $~ [%a %wake ~] + $~ [%b %wake ~] $% {$a task:able:ames} {$b task:able:behn} {$c task:able:clay} {$d task:able:dill} {$f task:able:ford} {$g task:able:gall} - {$j task:able:jael} + {$k task:able:kale} [%l task:able:http-client] [%r task:able:http-server] {@tas $meta vase} @@ -7641,17 +7270,14 @@ {$d gift:able:dill} {$f gift:able:ford} {$g gift:able:gall} - {$j gift:able:jael} + {$k gift:able:kale} [%l gift:able:http-client] [%r gift:able:http-server] == :: +$ unix-task :: input from unix $~ [%wake ~] - $% :: %ames: new process - :: - $>(%barn task:able:ames) - :: %dill: keyboard input + $% :: %dill: keyboard input :: $>(%belt task:able:dill) :: %dill: configure terminal (resized) @@ -7700,7 +7326,7 @@ $>(%wake task:able:behn) :: %ames: send message :: - $>(%want task:able:ames) + $>(%memo task:able:ames) == :: :: :::: ++azimuth :: (2az) azimuth @@ -8928,7 +8554,7 @@ ?> ?=(%king (clan:title i.tar)) $(tar t.tar, stars (~(put in stars) i.tar)) :: - |- ^- seed:able:jael + |- ^- seed:able:kale =/ cub=acru:ames (pit:nu:crub:crypto 512 eny) =/ who=ship `@`fig:ex:cub ?: (~(has in stars) (^sein:title who)) @@ -9122,56 +8748,57 @@ :: ++ snap !: - |% - :: +bloq:snap:dawn: extract block number - :: - ++ bloq - |= snap=snapshot:jael - ^- (unit @ud) - =- ?:(?=(%| -.out) ~ (some p.out)) - ^= out %- mule |. - latest-block.snap - :: +czar:snap:dawn: extract galaxy table - :: - ++ czar - |= snap=snapshot:jael - ^- (unit (map ship [=life =pass])) - =- ?:(?=(%| -.out) ~ (some p.out)) - ^= out %- mule |. - %- ~(gas by *(map ship [=life =pass])) - %+ turn (gulf 0 255) - |= gal=@ - ^- [ship [life pass]] - :- gal - ~| czar-gal=gal - [life pass]:(need net:(~(got by pos.eth.snap) gal)) - :: +point:snap:dawn: extract ship's contract state - :: - ++ point - |= [who=ship snap=snapshot:jael] - ^- (unit point:azimuth) - (~(get by pos.eth.snap) who) - :: +turf:snap:dawn: extract network domains - :: - ++ turf - |= snap=snapshot:jael - ^- (unit (list ^turf)) - =- ?:(?=(%| -.out) ~ (some p.out)) - ^= out %- mule |. - %+ murn - ^- (list host:eyre) - %+ murn - ^- (list @t) - ~[pri sec ter]:dns.eth.snap - |= dom=@t - ^- (unit host:eyre) - (rush dom thos:de-purl:html) - |=(a=host:eyre ?:(?=(%| -.a) ~ (some p.a))) - -- + !! +:: |% +:: :: +bloq:snap:dawn: extract block number +:: :: +:: ++ bloq +:: |= snap=snapshot:kale +:: ^- (unit @ud) +:: =- ?:(?=(%| -.out) ~ (some p.out)) +:: ^= out %- mule |. +:: latest-block.snap +:: :: +czar:snap:dawn: extract galaxy table +:: :: +:: ++ czar +:: |= snap=snapshot:kale +:: ^- (unit (map ship [=life =pass])) +:: =- ?:(?=(%| -.out) ~ (some p.out)) +:: ^= out %- mule |. +:: %- ~(gas by *(map ship [=life =pass])) +:: %+ turn (gulf 0 255) +:: |= gal=@ +:: ^- [ship [life pass]] +:: :- gal +:: ~| czar-gal=gal +:: [life pass]:(need net:(~(got by pos.eth.snap) gal)) +:: :: +point:snap:dawn: extract ship's contract state +:: :: +:: ++ point +:: |= [who=ship snap=snapshot:kale] +:: ^- (unit point:azimuth) +:: (~(get by pos.eth.snap) who) +:: :: +turf:snap:dawn: extract network domains +:: :: +:: ++ turf +:: |= snap=snapshot:kale +:: ^- (unit (list ^turf)) +:: =- ?:(?=(%| -.out) ~ (some p.out)) +:: ^= out %- mule |. +:: %+ murn +:: ^- (list host:eyre) +:: %+ murn +:: ^- (list @t) +:: ~[pri sec ter]:dns.eth.snap +:: |= dom=@t +:: ^- (unit host:eyre) +:: (rush dom thos:de-purl:html) +:: |=(a=host:eyre ?:(?=(%| -.a) ~ (some p.a))) +:: -- :: +veri:dawn: validate keys, life, discontinuity, &c :: ++ veri - |= [=seed:able:jael =point:azimuth =live] + |= [=seed:able:kale =point:azimuth =live] ^- (each sponsor=ship error=term) =/ rac (clan:title who.seed) =/ cub (nol:nu:crub:crypto key.seed) From 889c300092f6d7a2c1520bcede812f7d03b17f54 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 28 Jun 2019 16:43:52 -0700 Subject: [PATCH 003/151] clay, alef, and zuse compile --- pkg/arvo/sys/vane/alef.hoon | 6 +- pkg/arvo/sys/vane/clay.hoon | 106 +++++++++++++++++++----------------- pkg/arvo/sys/zuse.hoon | 3 +- 3 files changed, 64 insertions(+), 51 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 5e8c7fd223..f589937965 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -53,8 +53,12 @@ :: :: protocol-version: current version of the ames wire protocol :: +!: =/ protocol-version=?(%0 %1 %2 %3 %4 %5 %6 %7) %0 +=, ames +=, able :: +=> |% +| %generics :: $mk-item: constructor for +ordered-map item type @@ -847,7 +851,7 @@ %crud !! %hear (on-hear:event-core [lane blob]:task) %hole !! - %init (on-init:event-core ship.task) + %init (on-init:event-core ship=p.task) %vega on-vega:event-core %wegh on-wegh:event-core %memo (on-memo:event-core [ship message]:task) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 2e7553b30f..d541c23b39 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -471,7 +471,7 @@ ++ note :: out request $-> $~ [%b %wait *@da] :: $% $: %a :: to %ames - $>(%want task:able:ames) :: + $>(%memo task:able:ames) :: == :: $: %b :: to %behn $> $? %drip :: @@ -505,8 +505,8 @@ $% [%init-clad ~] :: == == :: $: %a :: by %ames - $> $? %send :: XX strange - %woot :: + $> $? %memo :: + %done :: == :: gift:able:ames :: == :: @@ -2790,8 +2790,13 @@ :: Transfer a request to another ship's clay. :: ++ send-over-ames - |= {a/duct b/path c/ship d/{p/@ud q/riff}} - (emit a %pass b %a %want c [%c %question p.q.d (scot %ud p.d) ~] q.d) + |= [=duct =ship index=@ud =riff] + ^+ +> + :: + =/ =desk p.riff + =/ =wire /warp-index/(scot %p ship)/(scot %tas desk)/(scot %ud index) + =/ =path [%c %question desk (scot %ud index) ~] + (emit duct %pass wire %a %memo ship path riff) :: :: Create a request that cannot be filled immediately. :: @@ -2815,7 +2820,7 @@ =+ inx=nix.u.ref =. +>+.$ =< ?>(?=(^ ref) .) - (send-over-ames hen [(scot %ud inx) ~] her inx syd ~ rave) + (send-over-ames hen her inx syd `rave) %= +>+.$ nix.u.ref +(nix.u.ref) bom.u.ref (~(put by bom.u.ref) inx [hen rave]) @@ -2913,12 +2918,12 @@ ?: |(?=(%& -.w) (~(has by cez) p.w)) s (~(put in s) p.w) ?^ mis - =- (emit hen %give %mack `[%leaf "No such group(s): {-}"]~) + =- (emit hen %give %done `[%perm-fail [%leaf "No such group(s): {-}"]~]) %+ roll ~(tap in `(set @ta)`mis) |= {g/@ta t/tape} ?~ t (trip g) :(weld t ", " (trip g)) - =< (emit hen %give %mack ~) + =< (emit hen %give %done ~) ?- -.rit $r wake(per (put-perm per pax red.rit)) $w wake(pew (put-perm pew pax wit.rit)) @@ -2969,7 +2974,7 @@ =: fod.u.ref (~(del by fod.u.ref) hen) bom.u.ref (~(del by bom.u.ref) u.nux) == - (send-over-ames hen [(scot %ud u.nux) ~] her u.nux syd ~) + (send-over-ames hen her u.nux syd ~) :: :: Handles a request. :: @@ -4105,7 +4110,7 @@ =| mos/(list move) =/ des ~(tap in ~(key by dos.rom.ruf)) |- - ?~ des [[[hen %give %mack ~] mos] ..^^$] + ?~ des [[[hen %give %done ~] mos] ..^^$] =/ den ((de our now ski hen ruf) our i.des) =^ mor ruf =< abet:wake @@ -4352,25 +4357,19 @@ (start-request:den for u.q.rif) [mos ..^$] :: - %west - =* wer p.req - =* pax q.req - =* res r.req - ?: ?=({%question *} pax) - =+ ryf=;;(riff res) - :_ ..^$ - :~ [hen %give %mack ~] - =/ =wire - [(scot %p our) (scot %p wer) t.pax] - [hen %pass wire %c %werp wer our ryf] - == - ?> ?=({%answer @ @ ~} pax) - =+ syd=(slav %tas i.t.pax) - =+ inx=(slav %ud i.t.t.pax) - =^ mos ruf - =/ den ((de our now ski hen ruf) wer syd) - abet:(take-foreign-answer:den inx ;;((unit rand) res)) - [[[hen %give %mack ~] mos] ..^$] + %memo + =* her ship.req + =* pax path.message.req + =* res payload.message.req + :: + ?> ?=({%question *} pax) + =+ ryf=;;(riff res) + :_ ..^$ + :~ [hen %give %done ~] + =/ =wire + [%foreign-warp (scot %p her) t.pax] + [hen %pass wire %c %werp her our ryf] + == :: %wegh :_ ..^$ :_ ~ @@ -4430,6 +4429,7 @@ ++ take :: accept response |= {tea/wire hen/duct hin/(hypo sign)} ^+ [*(list move) ..^$] + :: ?: ?=({$commit @ *} tea) =* syd i.t.tea =^ mos ruf @@ -4451,6 +4451,11 @@ abet:(take-mount:den q.hin) [mos ..^$] :: + ?: ?=([%foreign-warp *] tea) + ?> ?=(%writ +<.q.hin) + :_ ..^$ + [hen %give %memo /remove-me (bind `riot`p.q.hin rant-to-rand)]~ + :: ?: ?=({%foreign-request @ @ @ *} tea) =/ her (slav %p i.t.tea) =/ syd (slav %tas i.t.t.tea) @@ -4484,6 +4489,21 @@ `cage`(result-to-cage:ford build-result.result.q.hin) == == :: + ?: ?=([%warp-index @ @ @ ~] tea) + ?> ?=(%memo +<.q.hin) + ?> ?=([%remove-me ~] path.message.q.hin) + :: + =+ ;; res=(unit rand) payload.message.q.hin + :: + =/ her=ship (slav %p i.t.tea) + =/ =desk (slav %tas i.t.t.tea) + =/ index=@ud (slav %ud i.t.t.t.tea) + :: + =^ mos ruf + =/ den ((de our now ski hen ruf) her desk) + abet:(take-foreign-answer:den index res) + [mos ..^$] + :: ?- -.+.q.hin %init-clad ~|(%clad-not-real !!) @@ -4534,28 +4554,16 @@ :: (handle-task hen queued-task) :: - %writ - ?> ?=({@ @ *} tea) - ~| i=i.tea - ~| it=i.t.tea - =+ him=(slav %p i.t.tea) - :_ ..^$ - :~ :* hen %pass /writ-want %a - %want him [%c %answer t.t.tea] - (bind p.+.q.hin rant-to-rand) - == - == + :: handled in the wire dispatcher + :: + %memo !! + %writ !! :: - %send - [[[hen %give +.q.hin] ~] ..^$] - :: - %woot - ?~ q.q.hin + %done + ?~ error=error.q.hin [~ ..^$] - ~& [%clay-lost p.q.hin tea] - ?~ u.q.q.hin - [~ ..^$] - %- (slog >p.u.u.q.q.hin< q.u.u.q.q.hin) + ~& [%clay-lost u.error tea] + %- (slog >tag.u.error< tang.u.error) [~ ..^$] == :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 0b638a820b..50d00b212a 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -195,6 +195,7 @@ :: +vane-task: general tasks shared across vanes :: +$ vane-task + $~ [%born ~] $% :: i/o device replaced (reset state) :: [%born ~] @@ -215,7 +216,7 @@ [%wegh ~] :: receive message via %ames :: - [%memo p=ship q=path r=*] + [%memo =ship =message:ames] == :: :::: :::: ++http :: From 3a1a3e30cc75fdfc3fc5089de020998a79daf29a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 28 Jun 2019 18:13:32 -0700 Subject: [PATCH 004/151] gall compiles --- pkg/arvo/sys/vane/gall.hoon | 200 ++++++++++-------------------------- pkg/arvo/sys/zuse.hoon | 1 - 2 files changed, 53 insertions(+), 148 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 57456d4cac..1393f5a856 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -11,7 +11,7 @@ ++ torc $@(?($iron $gold) {$lead p/ship}) :: security control ++ roon :: reverse ames msg $% {$d p/mark q/*} :: diff (diff) - {$x ~} :: + {$x ~} :: quit == :: ++ rook :: forward ames msg $% {$m p/mark q/*} :: message @@ -42,7 +42,6 @@ ++ gest :: subscriber data $: sup/bitt :: incoming subscribers neb/boat :: outgoing subscribers - qel/(map bone @ud) :: queue meter == :: ++ mast :: ship state $: mak/* :: (deprecated) @@ -211,16 +210,6 @@ ~/ %mo-away |= {him/ship caz/cush} :: ^+ +> - :: ~& [%mo-away him caz] - ?: ?=($pump -.q.caz) - :: - :: you'd think this would send an ack for the diff - :: that caused this pump. it would, but we already - :: sent it when we got the diff in ++mo-cyst. then - :: we'd have to save the network duct and connect it - :: to this returning pump. - :: - +> ?: ?=($peer-not -.q.caz) :: short circuit error (mo-give %unto %reap (some p.q.caz)) @@ -235,25 +224,20 @@ $peer [%s p.q.caz] == %+ mo-pass - [%sys %way -.q.caz ~] - `note-arvo`[%a %want him [%g %ge p.caz ~] [num roc]] - :: - ++ mo-baal :: error convert a - |= art/(unit ares) - ^- ares - ?~(art ~ ?~(u.art `[%blank ~] u.art)) + [%sys %way (scot %p him) p.caz -.q.caz ~] + `note-arvo`[%a %memo him [%g %ge p.caz ~] [num roc]] :: ++ mo-baba :: error convert b - |= ars/ares + |= error=(unit error:ames) ^- (unit tang) - ?~ ars ~ - `[[%leaf (trip p.u.ars)] q.u.ars] + ?~ error ~ + `[[%leaf (trip tag.u.error)] tang.u.error] :: ++ mo-awed :: foreign response - |= {him/ship why/?($peer $peel $poke $pull) art/(unit ares)} + |= {him/ship why/?($peer $peel $poke $pull) art/(unit error:ames)} ^+ +> :: ~& [%mo-awed him why art] - =+ tug=(mo-baba (mo-baal art)) + =+ tug=(mo-baba art) ?- why $peel (mo-give %unto %reap tug) $peer (mo-give %unto %reap tug) @@ -277,6 +261,7 @@ r (~(put by r.sad) p.sad hen) == == + :: TODO try to delete me :: ++ mo-ball :: outbone by index |= {him/ship num/@ud} @@ -325,28 +310,6 @@ (mo-give %unto %coup `message.build-result) :: (mo-give %unto %diff (result-to-cage:ford build-result)) - :: - $red :: diff ack - ?> ?=({@ @ @ ~} t.pax) - ?. ?=({$a $woot *} sih) - ~& [%red-went pax] - +>.$ - =+ :* him=(slav %p i.t.pax) - dap=i.t.t.pax - num=(slav %ud i.t.t.t.pax) - == - => .(pax `path`[%req t.pax]) - ?~ q.+>.sih - (mo-pass [%sys pax] %g %deal [him our] dap %pump ~) - :: should not happen (XX wat mean?) - :: - %- ?. ?=([~ ~ %mack *] q.+>.sih) - ~& [%diff-bad-ack q.+>.sih] - same - ~& [%diff-bad-ack %mack] - (slog (flop q.,.+>.q.+>.sih)) - =. +>.$ (mo-pass [%sys pax] %g %deal [him our] dap %pull ~) - (mo-pass [%sys pax] %a %want him [%g %gh dap ~] [num %x ~]) :: %rep :: reverse request ?> ?=({@ @ @ ~} t.pax) @@ -358,18 +321,18 @@ :: ?: ?=([%incomplete *] result.sih) :: "XX should crash" - (mo-give %mack `tang.result.sih) + %- (slog >%gall-sys-rep-incomplete< tang.result.sih) + +>.$ :: =/ build-result build-result.result.sih :: ?: ?=([%error *] build-result) :: "XX should crash" - (mo-give %mack `message.build-result) + %- (slog >%gall-sys-rep-error< message.build-result) + +>.$ :: - :: "XX pump should ack" - =. +>.$ (mo-give %mack ~) =* result-cage (result-to-cage:ford build-result) - (mo-give(hen (mo-ball him num)) %unto %diff result-cage) + (mo-give %unto %diff result-cage) :: $req :: inbound request ?> ?=({@ @ @ ~} t.pax) @@ -377,28 +340,28 @@ dap=i.t.t.pax num=(slav %ud i.t.t.t.pax) == + :: seems unreachable, probably delete + :: ?: ?=({$f $made *} sih) ?: ?=([%incomplete *] result.sih) :: "XX should crash" - (mo-give %mack `tang.result.sih) + (mo-give %done `[%gall-ford-incomplete tang.result.sih]) :: =/ build-result build-result.result.sih :: ?: ?=([%error *] build-result) :: "XX should crash" - (mo-give %mack `message.build-result) + (mo-give %done `[%gall-ford-error message.build-result]) =/ cay/cage (result-to-cage:ford build-result) (mo-pass [%sys pax] %g %deal [him our] i.t.t.pax %poke cay) - ?: ?=({$a $woot *} sih) +>.$ :: quit ack, boring + :: ?> ?=({$g $unto *} sih) =+ cuf=`cuft`+>.sih ?- -.cuf - $coup (mo-give %mack p.cuf) - $diff %+ mo-pass [%sys %red t.pax] - [%a %want him [%g %gh dap ~] [num %d p.p.cuf q.q.p.cuf]] - $quit %+ mo-pass [%sys pax] - [%a %want him [%g %gh dap ~] [num %x ~]] - $reap (mo-give %mack p.cuf) + %coup (mo-give %done ?~(p.cuf ~ `[%gall-coup u.p.cuf])) + %reap (mo-give %done ?~(p.cuf ~ `[%gall-reap u.p.cuf])) + %diff (mo-give %memo /remove-me num %d p.p.cuf q.q.p.cuf) + %quit (mo-give %memo /remove-me num %x ~) :: we send http-responses, we don't receive them. :: $http-response !! @@ -421,13 +384,18 @@ (mo-clip dap `prey`[%high ~ him] [%poke result-cage]) :: $way :: outbound request - ?> ?=({$a $woot *} sih) - ?> ?=({@ ~} t.pax) - %- mo-awed - :* `ship`p.+>.sih - ;;(?($peer $peel $poke $pull) i.t.pax) - +>+.sih - == + :: + ?> ?=([@ @ @ ~] t.pax) + =/ him (slav %p i.t.pax) + =/ dap i.t.t.pax + =/ cub ;;(?($peer $peel $poke $pull) i.t.t.t.pax) + :: + ?: ?=([%a %done *] sih) + (mo-awed him cub error.sih) + :: + ?> ?=([%a %memo *] sih) + =+ mes=;;([@ud roon] payload.message.sih) + (mo-gawd:(mo-abed:mo hen) him dap mes) == :: ++ mo-cook :: take in /use @@ -510,7 +478,7 @@ :: ++ mo-gawk :: ames forward |= {him/@p dap/dude num/@ud rok/rook} - =. +> ?.(?=($u -.rok) +> (mo-give %mack ~)) + =. +> ?.(?=($u -.rok) +> (mo-give %done ~)) %+ mo-pass [%sys %req (scot %p him) dap (scot %ud num) ~] ^- note-arvo @@ -525,13 +493,11 @@ ++ mo-gawd :: ames backward |= {him/@p dap/dude num/@ud ron/roon} ?- -.ron + $x (mo-give %unto %quit ~) $d %+ mo-pass [%sys %rep (scot %p him) dap (scot %ud num) ~] [%f %build live=%.n [%vale [p q]:(mo-beak dap) p.ron q.ron]] - :: - $x =. +> (mo-give %mack ~) :: XX should crash - (mo-give(hen (mo-ball him num)) %unto %quit ~) == :: ++ ap :: agent engine @@ -569,29 +535,11 @@ :: ++ ap-abet :: resolve ^+ +> - => ap-abut %_ +> bum.mas (~(put by bum.mas) dap +<+) moz :(weld (turn zip ap-aver) (turn dub ap-avid) moz) == :: - ++ ap-abut :: track queue - ^+ . - =+ [pyz=zip ful=*(set bone)] - |- ^+ +> - ?^ pyz - ?. ?=({$give $diff *} q.i.pyz) - $(pyz t.pyz) - =^ vad +> ap-fill(ost p.i.pyz) - $(pyz t.pyz, ful ?:(vad ful (~(put in ful) p.i.pyz))) - =+ ded=~(tap in ful) - |- ^+ +>.^$ - ?~ ded +>.^$ - => %*(. $(ded t.ded) ost i.ded) - =+ tib=(~(get by sup.ged) ost) - ?~ tib ~&([%ap-abut-bad-bone dap ost] ..ap-kill) - ap-kill(q.q.pry p.u.tib) - :: ++ ap-aver :: cove to move ~/ %ap-aver |= cov/cove @@ -677,7 +625,6 @@ $punk !! $peer-not !! $pull ap-pull - $pump ap-fall == :: ++ ap-diff :: pour a diff @@ -686,7 +633,7 @@ :: =. q.cag (sped q.cag) =^ cug +>.$ (ap-find [%diff p.cag +.pax]) ?~ cug - %. [| her +.pax] + %. [her +.pax] ap-pump:(ap-lame %diff (ap-suck "diff: no {<`path`[p.cag +.pax]>}")) =+ ^= arg ^- vase %- slop @@ -694,9 +641,9 @@ [!>(`path`+.pax) (ap-cage cag)] [!>((slag (dec p.u.cug) `path`+.pax)) q.cag] =^ cam +>.$ (ap-call q.u.cug arg) - ?^ cam - (ap-pump:(ap-lame q.u.cug u.cam) | her pax) - (ap-pump & her pax) + ?~ cam + +>.$ + (ap-pump:(ap-lame q.u.cug u.cam) her pax) :: ++ ap-cage :: cage to tagged vase |= cag/cage @@ -705,25 +652,10 @@ :: ++ ap-pump :: update subscription ~/ %ap-pump - |= {oak/? her/ship pax/path} + |= [her/ship pax/path] =+ way=[(scot %p her) %out pax] - ?: oak - (ap-pass way %send her -.pax %pump ~) (ap-pass:(ap-give %quit ~) way %send her -.pax %pull ~) :: - ++ ap-fall :: drop from queue - ^+ . - ?. (~(has by sup.ged) ost) . - =+ soy=(~(get by qel.ged) ost) - ?: |(?=(~ soy) =(0 u.soy)) - :: ~& [%ap-fill-under [our dap] q.q.pry ost] - + - =. u.soy (dec u.soy) - :: ~& [%ap-fill-sub [[our dap] q.q.pry ost] u.soy] - ?: =(0 u.soy) - +(qel.ged (~(del by qel.ged) ost)) - +(qel.ged (~(put by qel.ged) ost u.soy)) - :: ++ ap-farm :: produce arm ~/ %ap-farm |= cog/term @@ -739,25 +671,6 @@ $2 [%| p.ton] == :: - ++ ap-fill :: add to queue - ^- {? _.} - =+ suy=(fall (~(get by qel.ged) ost) 0) - =/ subscriber=(unit (pair ship path)) - (~(get by sup.ged) ost) - ?: ?& =(20 suy) - ?| ?=(~ subscriber) - !=(our p.u.subscriber) - == - == - ~& [%gall-pulling-20 ost (~(get by sup.ged) ost) (~(get by r.zam) ost)] - [%| ..ap-fill] - :: ~& :* %gall-pushing-20 - :: ost - :: suy=suy - :: (~(get by r.zam) ost) - :: == - [%& ..ap-fill(qel.ged (~(put by qel.ged) ost +(suy)))] - :: ++ ap-find :: general arm ~/ %ap-find |= {cog/term pax/path} @@ -1199,15 +1112,12 @@ ?~ wim + %_ + sup.ged (~(del by sup.ged) ost) - qel.ged (~(del by qel.ged) ost) == :: ++ ap-pull :: load delete =+ wim=(~(get by sup.ged) ost) ?~ wim + :: ~&(%ap-pull-none +) - =: sup.ged (~(del by sup.ged) ost) - qel.ged (~(del by qel.ged) ost) - == + =. sup.ged (~(del by sup.ged) ost) =^ cug ..ap-pull (ap-find %pull q.u.wim) ?~ cug +> =^ cam +> @@ -1373,21 +1283,17 @@ $init [~ ..^$(sys.mast.all hen)] :: - $sunk [~ ..^$] - :: - $vega [~ ..^$] - :: - $west - ?> ?=({?($ge $gh) @ ~} q.q.hic) - =* dap i.t.q.q.hic - =* him p.q.hic - ?: ?=($ge i.q.q.hic) - =+ mes=;;({@ud rook} r.q.hic) - =< mo-abet - (mo-gawk:(mo-abed:mo hen) him dap mes) - =+ mes=;;({@ud roon} r.q.hic) + %memo + ?> ?=([%ge @ ~] path.message.q.hic) + =/ him=ship ship.q.hic + =* dap i.t.path.message.q.hic + :: + =+ mes=;;([@ud rook] payload.message.q.hic) =< mo-abet - (mo-gawd:(mo-abed:mo hen) him dap mes) + (mo-gawk:(mo-abed:mo hen) him dap mes) + :: + $sunk [~ ..^$] + $vega [~ ..^$] :: $wegh =/ =mass diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 50d00b212a..f42bc2c722 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -1677,7 +1677,6 @@ {$puff p/mark q/noun} :: unchecked poke {$pull ~} :: unsubscribe {$punk p/mark q/cage} :: translated poke - {$pump ~} :: pump yes+no {$peer-not p/tang} :: poison pill peer == :: ++ cuft :: internal gift From ed4d477ba0369303f0648e35a8d2bdffec33e9ed Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 9 Jul 2019 17:48:07 -0700 Subject: [PATCH 005/151] Initial vere test passes on ames lane codec --- pkg/urbit/Makefile | 11 ++++++--- pkg/urbit/include/vere/vere.h | 16 +++++++++++++ pkg/urbit/tests/ames_tests.c | 42 +++++++++++++++++++++++++++++++++++ pkg/urbit/vere/ames.c | 22 +++++++++++++++++- 4 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 pkg/urbit/tests/ames_tests.c diff --git a/pkg/urbit/Makefile b/pkg/urbit/Makefile index 985f05a1b9..ab9bec709d 100644 --- a/pkg/urbit/Makefile +++ b/pkg/urbit/Makefile @@ -15,7 +15,7 @@ worker_objs = $(shell echo $(worker) | sed 's/\.c/.o/g') all_objs = $(common_objs) $(daemon_objs) $(worker_objs) all_srcs = $(common) $(daemon) $(worker) -all_exes = ./mug_tests jam_tests ./hashtable_tests ./urbit ./urbit-worker +all_exes = ./ames_tests ./mug_tests jam_tests ./hashtable_tests ./urbit ./urbit-worker # -Werror promotes all warnings that are enabled into errors (this is on) @@ -29,9 +29,10 @@ CFLAGS := $(CFLAGS) ################################################################################ -all: urbit urbit-worker hashtable_tests jam_tests mug_tests +all: urbit urbit-worker ames_tests hashtable_tests jam_tests mug_tests -test: hashtable_tests jam_tests mug_tests +test: ames_tests hashtable_tests jam_tests mug_tests + ./ames_tests ./hashtable_tests ./jam_tests ./mug_tests @@ -44,6 +45,10 @@ mrproper: clean ################################################################################ +ames_tests: $(common_objs) tests/ames_tests.o + @echo CC -o $@ + @$(CC) $^ $(LDFLAGS) -o $@ + hashtable_tests: $(common_objs) tests/hashtable_tests.o @echo CC -o $@ @$(CC) $^ $(LDFLAGS) -o $@ diff --git a/pkg/urbit/include/vere/vere.h b/pkg/urbit/include/vere/vere.h index 708adf3cb0..6b80428808 100644 --- a/pkg/urbit/include/vere/vere.h +++ b/pkg/urbit/include/vere/vere.h @@ -248,6 +248,13 @@ c3_c* dns_c; // galaxy fqdn (optional) } u3_pact; + /* u3_lane: ames lane (IP address and port) + */ + typedef struct _u3_lane { + c3_w pip_w; // target IPv4 address + c3_s por_s; // target port + } u3_lane; + /* u3_poke: poke callback function. */ typedef void (*u3_poke)(void*, u3_noun); @@ -983,6 +990,15 @@ void u3_ames_io_exit(u3_pier* pir_u); + /* u3_ames_decode_lane(): destructure lane from noun + */ + u3_lane + u3_ames_decode_lane(u3_noun); + + /* u3_ames_encode_lane(): encode lane as noun + */ + u3_noun + u3_ames_encode_lane(u3_lane); /** Autosave. **/ diff --git a/pkg/urbit/tests/ames_tests.c b/pkg/urbit/tests/ames_tests.c new file mode 100644 index 0000000000..582bec4d1e --- /dev/null +++ b/pkg/urbit/tests/ames_tests.c @@ -0,0 +1,42 @@ +#include "all.h" +#include "vere/vere.h" + +/* _setup(): prepare for tests. +*/ +static void +_setup(void) +{ + u3m_init(); + u3m_pave(c3y, c3n); +} + +/* _test_ames(): spot check ames helpers +*/ +static void +_test_ames(void) +{ + u3_lane lan_u; + lan_u.pip_w = 0x7f000001; + lan_u.por_s = 12345; + + u3_lane nal_u = u3_ames_decode_lane(u3_ames_encode_lane(lan_u)); + + if ( !(lan_u.pip_w == nal_u.pip_w && lan_u.por_s == nal_u.por_s) ) { + fprintf(stderr, "ames: lane fail (a)\r\n"); + fprintf(stderr, "pip: %d, por: %d\r\n", nal_u.pip_w, nal_u.por_s); + exit(1); + } +} + +/* main(): run all test cases. +*/ +int +main(int argc, char* argv[]) +{ + _setup(); + + _test_ames(); + + fprintf(stderr, "ames ok"); + return 0; +} diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index a7c2540be9..baac2acdbc 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -185,6 +185,26 @@ _ames_czar_cb(uv_getaddrinfo_t* adr_u, uv_freeaddrinfo(aif_u); } +u3_lane +u3_ames_decode_lane(u3_noun lan) { + u3_noun cud, pip, por; + + cud = u3ke_cue(lan); + u3x_cell(cud, &pip, &por); + + u3_lane lan_u; + lan_u.pip_w = u3r_word(0, pip); + lan_u.por_s = por; + + u3z(pip); u3z(por); + return lan_u; +} + +u3_noun +u3_ames_encode_lane(u3_lane lan) { + return u3ke_jam(u3nc(u3i_words(1, &lan.pip_w), lan.por_s)); +} + /* _ames_czar(): galaxy address resolution. */ @@ -259,7 +279,7 @@ _ames_czar(u3_pact* pac_u, c3_c* bos_c) } } -/* _ames_lane_ipv4(): IPv4 address/ from lane. +/* _ames_lane_ipv4(): IPv4 address from noun. */ u3_noun _ames_lane_ip(u3_noun lan, c3_s* por_s, c3_w* pip_w) From f104f4115b1f79eb6f01b59c3a1064ac7760425d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 10 Jul 2019 17:05:05 -0700 Subject: [PATCH 006/151] add %ipv4 tag to vere lane --- pkg/urbit/vere/ames.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index baac2acdbc..0563da6366 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -185,12 +185,15 @@ _ames_czar_cb(uv_getaddrinfo_t* adr_u, uv_freeaddrinfo(aif_u); } +/* u3_ames_decode_lane(): deserialize noun to lane +*/ u3_lane -u3_ames_decode_lane(u3_noun lan) { - u3_noun cud, pip, por; +u3_ames_decode_lane(u3_atom lan) { + u3_noun cud, tag, pip, por; cud = u3ke_cue(lan); - u3x_cell(cud, &pip, &por); + u3x_trel(cud, &tag, &pip, &por); + c3_assert( c3__ipv4 == tag ); u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); @@ -200,12 +203,13 @@ u3_ames_decode_lane(u3_noun lan) { return lan_u; } -u3_noun +/* u3_ames_encode_lane(): serialize lane to jammed noun +*/ +u3_atom u3_ames_encode_lane(u3_lane lan) { - return u3ke_jam(u3nc(u3i_words(1, &lan.pip_w), lan.por_s)); + return u3ke_jam(u3nt(c3__ipv4, u3i_words(1, &lan.pip_w), lan.por_s)); } - /* _ames_czar(): galaxy address resolution. */ static void From 6e3b4534a5076fa05f6510193d38ad5d617c0ba4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 11 Jul 2019 11:44:00 -0700 Subject: [PATCH 007/151] rewrote u3_ames_ef_send() to use new lanes --- pkg/urbit/tests/ames_tests.c | 2 +- pkg/urbit/vere/ames.c | 88 ++++++++++++++---------------------- 2 files changed, 34 insertions(+), 56 deletions(-) diff --git a/pkg/urbit/tests/ames_tests.c b/pkg/urbit/tests/ames_tests.c index 582bec4d1e..a8cdafc662 100644 --- a/pkg/urbit/tests/ames_tests.c +++ b/pkg/urbit/tests/ames_tests.c @@ -37,6 +37,6 @@ main(int argc, char* argv[]) _test_ames(); - fprintf(stderr, "ames ok"); + fprintf(stderr, "ames okeedokee"); return 0; } diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 0563da6366..d284a58d6c 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -283,34 +283,6 @@ _ames_czar(u3_pact* pac_u, c3_c* bos_c) } } -/* _ames_lane_ipv4(): IPv4 address from noun. -*/ -u3_noun -_ames_lane_ip(u3_noun lan, c3_s* por_s, c3_w* pip_w) -{ - switch ( u3h(lan) ) { - case c3__if: { - *por_s= (c3_s) u3h(u3t(u3t(lan))); - *pip_w = u3r_word(0, u3t(u3t(u3t(lan)))); - - return c3y; - } break; - case c3__is: { - u3_noun pq_lan = u3h(u3t(u3t(lan))); - - if ( u3_nul == pq_lan ) return c3n; - else return _ames_lane_ip(u3t(pq_lan), por_s, pip_w); - } break; - case c3__ix: { - *por_s = (c3_s) u3h(u3t(u3t(lan))); - *pip_w = u3r_word(0, u3t(u3t(u3t(lan)))); - - return c3y; - } break; - } - return c3n; -} - /* u3_ames_ef_bake(): notify %ames that we're live. */ void @@ -326,44 +298,50 @@ u3_ames_ef_bake(u3_pier* pir_u) void u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) { - u3_ames* sam_u = pir_u->sam_u; - if ( u3_Host.ops_u.fuz_w && ((rand() % 100) < u3_Host.ops_u.fuz_w) ) { u3z(lan); u3z(pac); return; } + u3_ames* sam_u = pir_u->sam_u; u3_pact* pac_u = c3_calloc(sizeof(*pac_u)); + pac_u->len_w = u3r_met(3, pac); + pac_u->hun_y = c3_malloc(pac_u->len_w); - if ( c3y == _ames_lane_ip(lan, &pac_u->por_s, &pac_u->pip_w) ) { - pac_u->len_w = u3r_met(3, pac); - pac_u->hun_y = c3_malloc(pac_u->len_w); + u3_noun tag, val; + u3x_cell(lan, &tag, &val); + c3_assert( (c3y == tag) || (c3n == tag) ); - u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac); - - if ( 0 == pac_u->pip_w ) { - pac_u->pip_w = 0x7f000001; - pac_u->por_s = pir_u->por_s; - } - - if ( (0 == (pac_u->pip_w >> 16)) && (1 == (pac_u->pip_w >> 8)) ) { - pac_u->imp_y = (pac_u->pip_w & 0xff); - - _ames_czar(pac_u, sam_u->dns_c); - } - else if ( (c3y == u3_Host.ops_u.net) || (0x7f000001 == pac_u->pip_w) ) { - _ames_send(pac_u); - } - else { - // networking disabled + // galaxy lane; do DNS lookup and send packet + // + if ( c3y == tag ) { + c3_assert( c3y == u3a_is_cat(val) ); + c3_assert( val < 256 ); + + _ames_czar(pac_u, sam_u->dns_c); + } + // non-galaxy lane + // + else { + u3_lane lan_u = u3_ames_decode_lane(lan); + // convert incoming localhost to outgoing localhost + // + lan_u.pip_w = ( 0 == lan_u.pip_w )? 0x7f000001 : lan_u.pip_w; + // if in local-only mode, don't send remote packets + // + if ( (c3n == u3_Host.ops_u.net) && (0x7f000001 != lan_u.pip_w) ) { _ames_pact_free(pac_u); } - } - else { - _ames_pact_free(pac_u); - } + // otherwise, mutate destination and send packet + // + else { + pac_u->pip_w = lan_u.pip_w; + pac_u->por_s = lan_u.por_s; - u3z(lan); u3z(pac); + _ames_send(pac_u); + } + } + u3z(tag); u3z(val); } /* _ames_recv_cb(): receive callback. From e6e2b6d197172994a96caeccb2f32e529233bef8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 11 Jul 2019 11:47:02 -0700 Subject: [PATCH 008/151] fix _ames_recv_cb() to use new lanes --- pkg/urbit/vere/ames.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index d284a58d6c..1dd1022cdb 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -366,15 +366,16 @@ _ames_recv_cb(uv_udp_t* wax_u, #if 0 u3z(msg); #else + u3_lane lan_u; struct sockaddr_in* add_u = (struct sockaddr_in *)adr_u; - c3_s por_s = ntohs(add_u->sin_port); - c3_w pip_w = ntohl(add_u->sin_addr.s_addr); + + lan_u.por_s = ntohs(add_u->sin_port); + lan_u.pip_w = ntohl(add_u->sin_addr.s_addr); + u3_noun lan = u3_ames_encode_lane(lan_u); u3_pier_plan (u3nt(u3_blip, c3__ames, u3_nul), - u3nt(c3__hear, - u3nq(c3__if, u3k(u3A->now), por_s, u3i_words(1, &pip_w)), - msg)); + u3nt(c3__hear, lan, msg)); #endif } _ames_free(buf_u->base); From 08fdb67063a7a815068b78cc2124403d199939c0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 11 Jul 2019 14:38:47 -0700 Subject: [PATCH 009/151] begin kale integration; won't compile --- pkg/arvo/sys/vane/kale.hoon | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index 17712eb4ce..7a36a02456 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -78,9 +78,9 @@ [p=duct q=card] :: :: :: +$ note :: out request $-> - $~ [%a %want *ship *path **] :: + $~ [%a %memo *ship *message:ames] :: $% $: %a :: to %ames - $>(%want task:able:ames) :: send message + $>(%memo task:able:ames) :: send message == :: $: %k :: to self $>(%look task) :: set ethereum source @@ -90,8 +90,9 @@ == == == :: :: :: +$ sign :: in result $<- - $~ [%a %woot *ship ~] :: - $% [%a $>(%woot gift:able:ames)] :: message result + $~ [%a %done ~] :: + $% [%a $>(%memo gift:able:ames)] :: message result + [%a $>(%done gift:able:ames)] :: message ack == :: -- :: :: :::: From 38bbabf1b0a6c946b6f5a4d2f0ef65c6b6fa4519 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 12 Jul 2019 11:19:09 -0700 Subject: [PATCH 010/151] WIP kale integration; doesn't quite work --- pkg/arvo/sys/vane/kale.hoon | 60 ++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index 7a36a02456..abf90fa12f 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -69,7 +69,9 @@ +$ message :: message to her kale $% [%nuke whos=(set ship)] :: cancel trackers [%public-keys whos=(set ship)] :: view ethereum events - [%public-keys-result who=ship =vent-result] :: tmp workaround + == :: ++$ message-response :: kale ames response + $% [%public-keys-result =vent-result] :: tmp workaround == :: +$ card :: i/o action (wind note gift) :: @@ -92,7 +94,7 @@ +$ sign :: in result $<- $~ [%a %done ~] :: $% [%a $>(%memo gift:able:ames)] :: message result - [%a $>(%done gift:able:ames)] :: message ack + [%a $>(%done gift:able:ames)] :: message (n)ack == :: -- :: :: :::: @@ -435,33 +437,26 @@ == :: :: authenticated remote request - :: {$west p/ship q/path r/*} + :: [%memo =ship =message:ames] :: - $west - =* her p.tac - =/ mes (message r.tac) + %memo + =* her ship.tac + =/ mes (message message.tac) ?- -.mes :: :: cancel trackers :: [%nuke whos=(set ship)] :: %nuke - =. moz [[hen %give %mack ~] moz] + =. moz [[hen %give %done ~] moz] $(tac mes) :: :: view ethereum events :: [%public-keys whos=(set ship)] :: %public-keys - =. moz [[hen %give %mack ~] moz] + =. moz [[hen %give %done ~] moz] $(tac mes) - :: - :: receive keys result - :: [%public-keys-result =vent-result] - :: - %public-keys-result - =. moz [[hen %give %mack ~] moz] - $(tac [%vent-update vent-result.mes]) == :: :: rewind to snapshot @@ -476,14 +471,18 @@ ^+ +> ?> ?=([@ *] tea) =* wir t.tea - ?- hin - [%a %woot *] - ?~ q.hin +>.$ - ?~ u.q.hin ~&(%ares-fine +>.$) - ~& [%woot-bad p.u.u.q.hin] - ~_ q.u.u.q.hin + ?- hin + [%a %done *] + ?~ error.hin +>.$ + ~& [%kale-ames-nack u.error.hin] + ~_ tang.u.error.hin ::TODO fail:et +>.$ + :: + [%a %memo *] + =. moz [[hen %give %done ~] moz] + =+ ;; =message-response message.hin + (call hen %vent-update vent-result.message) == :: :: ++curd:of ++ curd :: relative moves @@ -563,19 +562,12 @@ |- ^+ this-su ?~ yez this-su =* d i.yez - ?. ?=([[%a @ @ *] *] d) - %- emit - [d %give %public-keys vent-result] - =/ our (slav %p i.t.i.d) - =/ who (slav %p i.t.t.i.d) - =/ =message [%public-keys-result who vent-result] =. this-su - %- emit - :^ d - %pass - /public-keys-result - ^- note - [%a %want who /k/public-keys-result message] + :: TODO: stop looking at the duct + :: + ?. ?=([[%a *] *] d) + (emit d %give %public-keys vent-result) + (emit d %give %memo /k/remove-me %public-keys-result vent-result) $(yez t.yez) :: ++ get-source @@ -746,7 +738,7 @@ ?: ?=(%& -.source) =/ send-message |= =message - [hen %pass /public-keys %a %want p.source /k/public-keys message] + [hen %pass /public-keys %a %memo p.source /k/public-keys message] =. ..feel (emit (send-message %nuke whos)) (emit (send-message %public-keys whos)) From 56598ee8569da4c7b11a14284809ec58e32fde90 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 15 Jul 2019 13:17:27 -0700 Subject: [PATCH 011/151] zuse, alef, and kale compile --- pkg/arvo/sys/vane/kale.hoon | 10 ++++------ pkg/arvo/sys/zuse.hoon | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index abf90fa12f..aba6f485fc 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -482,7 +482,7 @@ [%a %memo *] =. moz [[hen %give %done ~] moz] =+ ;; =message-response message.hin - (call hen %vent-update vent-result.message) + (call hen %vent-update vent-result.message-response) == :: :: ++curd:of ++ curd :: relative moves @@ -897,8 +897,7 @@ =/ cub (nol:nu:crub:crypto sec) =/ sig (sign:as:cub (shaf %self (sham [u.who 1 pub:ex:cub]))) :^ ~ ~ %noun - !> ^- deed:ames - [1 pub:ex:cub `sig] + !> [1 pub:ex:cub `sig] :: ?: ?=(%earl rac) ?. =(u.who p.why) @@ -910,8 +909,7 @@ =/ sec (~(got by jaw.own.pki.lex) u.lyf) =/ cub (nol:nu:crub:crypto sec) :^ ~ ~ %noun - !> ^- deed:ames - [u.lyf pub:ex:cub sig.own.pki.lex] + !> [u.lyf pub:ex:cub sig.own.pki.lex] :: =/ pub (~(get by pos.zim.pki.lex) u.who) ?~ pub @@ -922,7 +920,7 @@ ?~ pas ~ :^ ~ ~ %noun - !> `deed:ames`[u.lyf pass.u.pas ~] + !> [u.lyf pass.u.pas ~] :: %earl ?. ?=([@ @ @ ~] tyl) [~ ~] diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 1acddfe46f..92d76e1d61 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -2078,7 +2078,7 @@ [%vest ~] :: view public balance [%vine ~] :: view secret history $>(%wegh vane-task) :: memory usage request - $>(%west vane-task) :: remote request + $>(%memo vane-task) :: remote request [%wind p=@ud] :: rewind before block == :: -- :: @@ -2331,6 +2331,7 @@ ++ oath @ :: signature -- :: pki -- :: kale +-- :: :: :: :::: :: :: (2) engines :: :: :: From 793fc5c213c13e1c7eefb6f8edb7786edcb68965 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 15 Jul 2019 14:23:34 -0700 Subject: [PATCH 012/151] all vanes compile, at least individually --- bin/solid.pill | 4 +-- pkg/arvo/lib/pill.hoon | 8 +++--- pkg/arvo/sys/arvo.hoon | 13 +++------- pkg/arvo/sys/vane/clay.hoon | 4 +-- pkg/arvo/sys/vane/dill.hoon | 49 ++++++++++++++----------------------- pkg/arvo/sys/vane/gall.hoon | 8 +++--- pkg/arvo/sys/zuse.hoon | 2 +- 7 files changed, 36 insertions(+), 52 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 6098adcab7..948f0a3205 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:980cc9a756e49e6ba600ebfef91d09735eae1239da265cbc78fb6f783eab0f4c -size 8481672 +oid sha256:b7135ab911304fd1d884d2ee7d6c4c1b84f576dbe320abf4ec2672997074445a +size 6105223 diff --git a/pkg/arvo/lib/pill.hoon b/pkg/arvo/lib/pill.hoon index f7018bd663..38d2f5ef1a 100644 --- a/pkg/arvo/lib/pill.hoon +++ b/pkg/arvo/lib/pill.hoon @@ -14,9 +14,9 @@ :~ :: sys/zuse: standard library :: [%$ /zuse] - :: sys/vane/ames: network + :: sys/vane/alef: network :: - [%a /vane/ames] + [%a /vane/alef] :: sys/vane/behn: timer :: [%b /vane/behn] @@ -38,9 +38,9 @@ :: sys/vane/iris: http client :: [%i /vane/iris] - :: sys/vane/jael: security + :: sys/vane/kale: security :: - [%j /vane/jael] + [%k /vane/kale] == |= [=term =path] =/ pax (weld sys path) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 7f8e241d9d..340f472dbc 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -241,14 +241,10 @@ ++ slur-e ~/(%slur-e |=({gat/vase hil/mill} =+(%e (slur gat hil)))) ++ slur-f ~/(%slur-f |=({gat/vase hil/mill} =+(%f (slur gat hil)))) ++ slur-g ~/(%slur-g |=({gat/vase hil/mill} =+(%g (slur gat hil)))) + ++ slur-i ~/(%slur-i |=({gat/vase hil/mill} =+(%i (slur gat hil)))) ++ slur-j ~/(%slur-j |=({gat/vase hil/mill} =+(%j (slur gat hil)))) + ++ slur-k ~/(%slur-k |=({gat/vase hil/mill} =+(%k (slur gat hil)))) ++ slur-z ~/(%slur-z |=({gat/vase hil/mill} =+(%z (slur gat hil)))) - ++ slur-r - ~/ %slur-r - |=({gat/vase hil/mill} =+(%r (slur gat hil))) - ++ slur-l - ~/ %slur-l - |=({gat/vase hil/mill} =+(%l (slur gat hil))) :: ++ slur-pro :: profiling slur ~/ %slur-pro @@ -261,10 +257,9 @@ $e (slur-e gat hil) $f (slur-f gat hil) $g (slur-g gat hil) + $i (slur-i gat hil) $j (slur-j gat hil) - :: - %l (slur-l gat hil) - %r (slur-r gat hil) + $k (slur-k gat hil) == :: ++ song :: reduce metacard diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 547c36bd0b..5b45a7872f 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2670,7 +2670,7 @@ %- (sloy-light ski) =/ pur=spur /(scot %p who) - [[151 %noun] %j our %rift da+now pur] + [[151 %noun] %k our %rift da+now pur] :: :: Handle `%sing` requests :: @@ -4623,5 +4623,5 @@ %- (sloy-light ski) =/ pur=spur /(scot %p who) - [[151 %noun] %j our %rift da+now pur] + [[151 %noun] %k our %rift da+now pur] -- diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index 80472e7cd3..efc578ce79 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -20,7 +20,7 @@ f/(unit mass) :: g/(unit mass) :: i/(unit mass) :: - j/(unit mass) :: + k/(unit mass) :: == :: == :: ++ axon :: dill per duct @@ -79,15 +79,15 @@ $: %i :: $>(%wegh task:able:iris) :: == :: - $: %j :: + $: %k :: $> $? %dawn :: %fake :: %wegh :: == :: - task:able:jael :: + task:able:kale :: == == :: ++ sign :: in result $<- - $~ [%j %init *@p] :: + $~ [%k %init *@p] :: $% $: %a :: $% [%nice ~] :: XX obsolete $> $? %mass :: @@ -100,8 +100,7 @@ $>(%writ gift:able:clay) :: XX %slip == == :: $: %c :: - $> $? %mack :: XX strange - %mass :: + $> $? %mass :: %mere :: %note :: %writ :: @@ -127,11 +126,11 @@ $: %i :: $>(%mass gift:able:iris) :: == :: - $: %j :: + $: %k :: $> $? %init :: %mass :: == :: - gift:able:jael :: + gift:able:kale :: == == :: :::::::: :: dill tiles -- @@ -283,7 +282,7 @@ [hen %pass /heft/ford %f %wegh ~] [hen %pass /heft/gall %g %wegh ~] [hen %pass /heft/iris %i %wegh ~] - [hen %pass /heft/jael %j %wegh ~] + [hen %pass /heft/jael %k %wegh ~] moz == == @@ -294,7 +293,7 @@ ;; ship %- need %- need %- (sloy-light ski) - [[151 %noun] %j our %sein da+now /(scot %p who)] + [[151 %noun] %k our %sein da+now /(scot %p who)] :: ++ init :: initialize ~& [%dill-init our ram] @@ -375,24 +374,18 @@ == == :: - ++ pump :: send diff ack - %_ . - moz - :_(moz [hen %pass ~ %g %deal [our our] ram %pump ~]) - == - :: ++ take :: receive |= sih/sign ^+ +> ?- sih - {?($a $b $c $e $f $g $i $j) $mass *} + {?($a $b $c $e $f $g $i $k) $mass *} (wegh -.sih p.sih) :: {$a $nice *} :: ~& [%take-nice-ames sih] +> :: - [%j %init *] + [%k %init *] :: pass thru to unix :: +>(moz :_(moz [hen %give +.sih])) @@ -415,7 +408,7 @@ $reap ?~ p.p.+>.sih +>.$ (dump:(crud %reap u.p.p.+>.sih) %logo ~) - $diff pump:(from ;;(dill-blit q:`vase`+>+>.sih)) + $diff (from ;;(dill-blit q:`vase`+>+>.sih)) $http-response !! == :: @@ -429,10 +422,6 @@ ?: ?=(%& -.p.sih) mere (mean >%dill-mere-fail< >p.p.p.sih< q.p.p.sih) - :: - {$c $mack *} - ?~ p.sih +>.$ - (mean >%dill-clay-nack< u.p.sih) :: {$d $blit *} (done +.sih) @@ -440,7 +429,7 @@ :: +wegh: receive a memory report from a vane and maybe emit full report :: ++ wegh - |= [lal=?(%a %b %c %e %f %g %i %j) mas=mass] + |= [lal=?(%a %b %c %e %f %g %i %k) mas=mass] ^+ +> :: update our listing of vane responses with this new one :: @@ -453,7 +442,7 @@ %f ~?(?=(^ f.hef.all) %double-mass-f hef.all(f `mas)) %g ~?(?=(^ g.hef.all) %double-mass-g hef.all(g `mas)) %i ~?(?=(^ i.hef.all) %double-mass-i hef.all(i `mas)) - %j ~?(?=(^ j.hef.all) %double-mass-j hef.all(j `mas)) + %k ~?(?=(^ k.hef.all) %double-mass-k hef.all(k `mas)) == :: if not all vanes have responded yet, no-op :: @@ -464,7 +453,7 @@ ?=(^ f.hef.all) ?=(^ g.hef.all) ?=(^ i.hef.all) - ?=(^ j.hef.all) + ?=(^ k.hef.all) == +>.$ :: clear vane reports from our state before weighing ourself @@ -472,7 +461,7 @@ :: Otherwise, the state of vanes printed after this one get absorbed :: into Dill's %dot catchall report. :: - =/ ven=(list mass) ~[u.a u.b u.c u.e u.f u.g u.i u.j]:hef.all + =/ ven=(list mass) ~[u.a u.b u.c u.e u.f u.g u.i u.k]:hef.all => .(hef.all [~ ~ ~ ~ ~ ~ ~ ~]) :: wegh ourself now that our state doesn't include other masses :: @@ -512,10 +501,10 @@ ?> =(~ hey.all) =. hey.all `hen =/ boot - ((soft $>($?(%dawn %fake) task:able:jael)) p.task) + ((soft $>($?(%dawn %fake) task:able:kale)) p.task) ?~ boot ~| invalid-boot-event+hen !! - :_(..^$ [hen %pass / %j u.boot]~) + :_(..^$ [hen %pass / %k u.boot]~) :: we are subsequently initialized. single-home :: ?: ?=(%init -.task) @@ -539,7 +528,7 @@ =? p.task ?=([%crud %hax-heft ~] p.task) [%heft ~] :: $(hen u.hey.all, wrapped-task p.task) - :: a %sunk notification from %jail comes in on an unfamiliar duct + :: a %sunk notification from %kale in on an unfamiliar duct :: ?: ?=(%sunk -.task) [~ ..^$] diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index b84d9e8f07..19e1beaca8 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1237,19 +1237,19 @@ %info `%c %keep `%f %kill `%f - %look `%j + %look `%k %merg `%c - %mint `%j + %mint `%k %mont `%c %nuke `%a %ogre `%c %perm `%c %rest `%b - %snap `%j + %snap `%k %wait `%b %want `%a %warp `%c - %wind `%j + %wind `%k %wipe `%f :: %request `%i diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 92d76e1d61..f40929ec17 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -413,7 +413,7 @@ [%send =lane =blob] [%done error=(unit error)] :: - [%mass mass] + [%mass p=mass] [%turf turfs=(list turf)] == -- ::able From 75bb2d554efe2fd8ceee7ead914f67e6960a527d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 15 Jul 2019 14:44:10 -0700 Subject: [PATCH 013/151] fix dill/ames interaction --- pkg/arvo/sys/vane/dill.hoon | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index efc578ce79..189d5e2242 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -89,11 +89,7 @@ ++ sign :: in result $<- $~ [%k %init *@p] :: $% $: %a :: - $% [%nice ~] :: XX obsolete - $> $? %mass :: - %send :: XX strange - == :: - gift:able:ames :: + $% $>(%mass gift:able:ames) :: == == :: $: %b :: $% $>(%mass gift:able:behn) :: From 86da8e903302f1abd31796fa9ff058d8ae152088 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 15 Jul 2019 16:11:22 -0700 Subject: [PATCH 014/151] made a pill that boots without error --- pkg/arvo/sys/vane/clay.hoon | 11 ++++++++++- pkg/arvo/sys/vane/dill.hoon | 7 ------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 5b45a7872f..b7ff5baabd 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2918,12 +2918,21 @@ ?: |(?=(%& -.w) (~(has by cez) p.w)) s (~(put in s) p.w) ?^ mis + :: TODO remove this nasty hack + :: + ?. ?=([[%a *] *] hen) + +>.$ =- (emit hen %give %done `[%perm-fail [%leaf "No such group(s): {-}"]~]) %+ roll ~(tap in `(set @ta)`mis) |= {g/@ta t/tape} ?~ t (trip g) :(weld t ", " (trip g)) - =< (emit hen %give %done ~) + :: TODO remove this nasty hack + :: + =< ?. ?=([[%a *] *] hen) + . + (emit hen %give %done ~) + :: ?- -.rit $r wake(per (put-perm per pax red.rit)) $w wake(pew (put-perm pew pax wit.rit)) diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index 189d5e2242..216f213bca 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -376,18 +376,11 @@ ?- sih {?($a $b $c $e $f $g $i $k) $mass *} (wegh -.sih p.sih) - :: - {$a $nice *} - :: ~& [%take-nice-ames sih] - +> :: [%k %init *] :: pass thru to unix :: +>(moz :_(moz [hen %give +.sih])) - :: - {$a $send *} - +>(moz :_(moz [hen %give +.sih])) :: {$g $onto *} :: ~& [%take-gall-onto +>.sih] From 5531cbd5e64f55fb90a0100d40bc8ee853914cc7 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 15 Jul 2019 17:02:21 -0700 Subject: [PATCH 015/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 948f0a3205..7ab8c194e6 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7135ab911304fd1d884d2ee7d6c4c1b84f576dbe320abf4ec2672997074445a -size 6105223 +oid sha256:b334f2a5834dde920f02d6f35eb15a087f95a6a61c5156d61ae5705a036fede3 +size 8319602 From 490341bac610a6db47de39c4afdd2fe74d19192a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 22 Jul 2019 19:14:18 -0700 Subject: [PATCH 016/151] Fixed %barn to %born in vere.c --- pkg/urbit/vere/ames.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index c6d4504218..24d519e83a 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -290,7 +290,7 @@ u3_ames_ef_bake(u3_pier* pir_u) { u3_noun pax = u3nq(u3_blip, c3__newt, u3k(u3A->sen), u3_nul); - u3_pier_plan(pax, u3nc(c3__barn, u3_nul)); + u3_pier_plan(pax, u3nc(c3__born, u3_nul)); } /* u3_ames_ef_send(): send packet to network (v4). From 043f508f27a6e6ffd3c44b5d943e4bbac05aa222 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 22 Jul 2019 19:15:16 -0700 Subject: [PATCH 017/151] deleted old ames --- pkg/arvo/sys/vane/ames.hoon | 1668 ----------------------------------- 1 file changed, 1668 deletions(-) delete mode 100644 pkg/arvo/sys/vane/ames.hoon diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon deleted file mode 100644 index 67cfa59b65..0000000000 --- a/pkg/arvo/sys/vane/ames.hoon +++ /dev/null @@ -1,1668 +0,0 @@ -!: :: ames (4a), networking -:: - |= pit=vase - => =~ -:: structures -=, ames -:: this number needs to be below 8 -:: -=+ protocol-version=3 -|% -+$ move [p=duct q=(wind note gift:able)] :: local move -+$ note :: out request $-> - $~ [%b %wait *@da] :: - $% $: %b :: to %behn - $> $? %rest :: cancel timer - %wait :: set timer - == :: - task:able:behn :: - == :: - $: %d :: to %dill - $>(%flog task:able:dill) :: log output - == :: - $: %j :: to %jael - $> $? %meet :: neighbor - %pubs :: view public keys - %turf :: view domains - %vein :: view private keys - == :: - task:able:jael :: - == :: - $: @tas :: to any - $>(%west task:able) :: deliver message - == == :: -+$ sign :: in result _<- - $~ [%b %wake ~] :: - $% $: %b :: from %behn - $>(%wake gift:able:behn) :: timer activate - == :: - $: %j :: from %jael - $> $? %pubs :: public keys - %turf :: bind to domains - %vein :: private keys - == :: - gift:able:jael :: - == :: - $: %g :: from %gall - $% [%mean p=ares] :: XX obsolete - [%nice ~] :: XX obsolete - $>(%unto gift:able:gall) :: application ack - == == :: - $: @tas :: from any - $% $>(%crud vane-task) :: XX strange - $> $? %mack :: message ack - %woot :: reaction message - == :: - gift:able :: - == == == :: -:: |pact: internal packet structures -:: -++ pact - |% - +$ full [lyf=[to=life from=life] law=(unit deed) txt=@] - +$ open [lyf=[to=~ from=life] law=(unit deed) txt=@] - -- --- - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aA, identity logic :: - :: removed in favor of jael/ethereum :: - :: - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aB, packet format :: - :: - |% - ++ bite :: packet to cake - |= pac=rock - ^- (unit cake) - =+ [mag=(end 5 1 pac) bod=(rsh 5 1 pac)] - =+ :* vez=(end 0 3 mag) :: protocol version - chk=(cut 0 [3 20] mag) :: checksum - wix=(bex +((cut 0 [23 2] mag))) :: width of receiver - vix=(bex +((cut 0 [25 2] mag))) :: width of sender - tay=(cut 0 [27 5] mag) :: message type - == - :: XX these packets should be firewalled in vere so that they don't - :: make it into the event log - :: - ?. =(protocol-version vez) ~ - ?. =(chk (end 0 20 (mug bod))) ~ - %- some - :+ [(end 3 wix bod) (cut 3 [wix vix] bod)] - (kins tay) - (rsh 3 (add wix vix) bod) - :: - ++ kins |=(tay=@ (snag tay `(list skin)`[%none %open %fast %full ~])) - ++ ksin |=(sin=skin `@`?-(sin %none 0, %open 1, %fast 2, %full 3)) - ++ spit :: cake to packet - |= kec=cake ^- @ - =+ wim=(met 3 p.p.kec) - =+ dum=(met 3 q.p.kec) - =+ yax=?:((lte wim 2) 0 ?:((lte wim 4) 1 ?:((lte wim 8) 2 3))) - =+ qax=?:((lte dum 2) 0 ?:((lte dum 4) 1 ?:((lte dum 8) 2 3))) - =+ wix=(bex +(yax)) - =+ vix=(bex +(qax)) - =+ bod=:(mix p.p.kec (lsh 3 wix q.p.kec) (lsh 3 (add wix vix) r.kec)) - =+ tay=(ksin q.kec) - %+ mix - %+ can 0 - :~ [3 protocol-version] - [20 (mug bod)] - [2 yax] - [2 qax] - [5 tay] - == - (lsh 5 1 bod) - -- - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aC, PKI engine :: - :: - |% - ++ go :: go - |_ ton=town :: ames state - ++ as :: as:go - |_ our=ship :: per server - ++ lax :: lax:as:go - |_ [her=ship dur=dore] :: per client - ++ cluy :: cluy:lax:as:go - ^- [lyf=life cub=acru] :: client crypto - ?> ?=(^ lew.wod.dur) - [life.u.lew.wod.dur (com:nu:crub:crypto pass.u.lew.wod.dur)] - :: - ++ clon - ^- life - :: if we don't have a +deed for :her, we guess 1 - :: - ?~(lew.wod.dur 1 life.u.lew.wod.dur) - :: - ++ griz :: griz:lax:as:go - |= now=@da :: generate key for - ^- [p=code q=_+>] - =+ key=(shas %enty (mix now any.ton)) - :- key - %= +>.$ - any.ton (shax (mix now any.ton)) - heg.caq.dur (~(put by heg.caq.dur) (shaf %hand key) key) - == - :: - ++ pode :: pode:lax:as:go - |= now=@da :: timeout route - ^+ +> - ?: (lth her 256) +>(lun.wod.dur [~ %if ~2000.1.1 0 (mix her .0.0.1.0)]) - +>(lun.wod.dur ~) - :: - ++ kuch :: kuch:lax:as:go - |= had=hand :: hear key tag - ^- (unit [code _+>]) - =+ wey=(~(get by heg.caq.dur) had) - ?^ wey - =+ key=u.wey - :+ ~ key - %= ..kuch - yed.caq.dur [~ had u.wey] - heg.caq.dur (~(del by heg.caq.dur) had) - qim.caq.dur (~(put by qim.caq.dur) had key) - == - =+ dyv=(~(get by qim.caq.dur) had) - ?~ dyv ~ - [~ u.dyv ..kuch] - :: - ++ wasc :: wasc:lax:as:go - |= key=code :: hear foreign code - ^+ +> - =+ had=(shaf %hand key) - %_ ..wasc - yed.caq.dur [~ had key] - qim.caq.dur (~(put by qim.caq.dur) had key) - == - :: - ++ wast :: wast:lax:as:go - |= ryn=lane :: set route - ^+ +> - %= +> - lun.wod.dur - ?: ?=([%ix *] ryn) - ?: ?| ?=(~ lun.wod.dur) - ?=([%ix *] u.lun.wod.dur) - ?& ?=([%if *] u.lun.wod.dur) - (gth p.ryn (add ~s10 p.u.lun.wod.dur)) - == - == - [~ ryn] - lun.wod.dur - [~ ryn] - == - :: - ++ wist :: wist:lax:as:go - |= $: now=@da :: route via - waz=(list @p) - ryn=(unit lane) - pac=rock - == - ^- (list boon) - ?: =(our her) [[%ouzo *lane pac] ~] - ?~ waz ~ - =+ dyr=?:(=(her i.waz) dur (gur i.waz)) - ?. ?& !=(our i.waz) - ?=(^ lun.wod.dyr) - == - $(waz t.waz) - :_ ?: ?=(%ix -.u.lun.wod.dyr) - $(waz t.waz) - ~ - :+ %ouzo u.lun.wod.dyr - ?: &(=(i.waz her) =(~ ryn)) pac - =+ mal=(jam `meal`[%fore her ryn pac]) - %- spit - ^- cake - :* [our i.waz] - ?~ yed.caq.dyr [%none mal] - :- %fast - %^ cat 7 - p.u.yed.caq.dyr - (en:crub:crypto q.u.yed.caq.dyr mal) - == - :: - ++ zuul :: zuul:lax:as:go - |= [now=@da seg=ship ham=meal] :: encode message - ^- [p=(list rock) q=_+>] - =< weft - |% - ++ wasp :: null security - ^-([p=skin q=@] [%none (jam ham)]) - :: - ++ weft :: fragment message - ^- [p=(list rock) q=_+>.$] - =^ gim ..weft wisp - :_ +>.$ - ^- (list rock) - =+ wit=(met 13 q.gim) - ?< =(0 wit) - ?: =(1 wit) - =+ yup=(spit [our her] p.gim q.gim) - [yup ~] - =+ ruv=(rip 13 q.gim) - =+ gom=(shaf %thug q.gim) - =+ inx=0 - |- ^- (list rock) - ?~ ruv ~ - =+ ^= vie - %+ spit - [our her] - wasp(ham [%carp (ksin p.gim) inx wit gom i.ruv]) - :- vie - $(ruv t.ruv, inx +(inx)) - :: - ++ wisp :: generate message - ^- [[p=skin q=@] q=_..wisp] - ?: =(%carp -.ham) - [wasp ..wisp] - ?: !=(~ yed.caq.dur) - ?> ?=(^ yed.caq.dur) - :_ ..wisp - :- %fast - %^ cat 7 - p.u.yed.caq.dur - (en:cub:cluy q.u.yed.caq.dur (jam ham)) - ?: &(=(~ lew.wod.dur) =(%back -.ham)) - [wasp ..wisp] - :: we include our deed in asymmetric skins (%open and %full) - :: if we're a comet or moon, or if we're sponsoring her - :: - =/ bil=(unit deed) - =/ rac (clan:title our) - ?. ?| ?=(?(%earl %pawn) rac) - &(!?=(%czar rac) =(our seg)) - == - ~ - `law.ton - =/ yig sen - =/ hom (jam ham) - ?: =(~ lew.wod.dur) - :_ ..wisp - :- %open - %- jam - ^- open:pact - :+ [~ lyf.yig] - bil - (sign:as:cub.yig hom) - =/ cay cluy - :: :tuy: symmetric key proposal - :: - =^ tuy +>.$ (griz now) - :_ ..wisp - :- %full - %- jam - ^- full:pact - :+ [lyf.cay lyf.yig] - bil - (seal:as:cub.yig pub:ex:cub.cay (jam tuy hom)) - -- :: --zuul:lax:as:go - -- :: --lax:as:go - :: - ++ gur :: default dore - |= her=ship - ^- dore - =+ def=?.((lth her 256) ~ [~ %if ~2000.1.1 0 (mix her .0.0.1.0)]) - [[~2100.1.1 def ~] *clot] - :: - ++ myx :: dore by ship - |= her=ship - ^+ lax - =/ fod=dore - (~(gut by hoc.ton) her (gur her)) - ~(. lax [her fod]) - :: - ++ nux :: install dore - |= new=_lax - ^+ +> - +>(hoc.ton (~(put by hoc.ton) her.new dur.new)) - :: - ++ sen :: current crypto - ^- [lyf=life cub=acru] - ?~(val.ton !! [p.i.val.ton r.i.val.ton]) - :: - ++ sev :: crypto by life - |= mar=life - ^- [p=? q=acru] - ?~ val.ton !! - ?: =(mar p.i.val.ton) - [& r.i.val.ton] - ?> (lth mar p.i.val.ton) - :- | - |- ^- acru - ?> ?=(^ t.val.ton) - ?: =(mar p.i.t.val.ton) - r.i.t.val.ton - $(t.val.ton t.t.val.ton) - -- :: --as:go - :: - ++ su :: install safe - |=(new=_as `town`ton.new) - :: - ++ ti :: expire by time - |= now=@da - ^- town - !! - :: - ++ us :: produce safe - |=(our=ship `_as`~(. as our)) - -- :: --go - -- - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aF, packet pump :: - |% - ++ pu :: packet pump - |_ shed - ++ abet +< - ++ ahoy :: ahoy:pu - ^+ . :: initialize - %_ . - rtt ~s1 - rto ~s4 - rtn ~ - rue ~ - nus 0 - nif 0 - nep 0 - caw 2 - cag 64 - diq ~ - pyz ~ - puq ~ - == - :: - ++ bick :: bick:pu - |= [now=@da fap=flap] :: ack by hash - ^- [[p=(unit soup) q=(list rock)] _+>] - =+ sun=(~(get by diq) fap) - ?~ sun - :: ~& [%bick-none `@p`(mug fap)] :: not a real error - [[~ ~] +>.$] - :: ~& [%bick-good `@p`(mug fap) u.sun] - =. diq (~(del by diq) fap) - =^ gub +>.$ (bock now u.sun) - =^ yop +>.$ (harv now) - [[gub yop] +>.$] - :: - ++ bilk :: bilk:pu - |= now=@da :: inbound packet - ^+ +> - =+ trt=(mul 2 rtt) - %= +>.$ - rue [~ now] - rto trt - rtn ?~(puq ~ [~ (add now trt)]) - == - :: - ++ boom :: boom:pu - |= now=@da ^- ? :: address timeout - |(?=(~ rue) (gte (sub now u.rue) ~m1)) - :: - ++ bust :: bust:pu - ^- ? :: not responding - &(?=(^ rtn) (gte rto ~s16)) - :: - ++ bike :: bike:pu - ^+ . :: check stats - ?> .= nif - |- ^- @ - ?~ puq 0 - :(add !liv.q.n.puq $(puq l.puq) $(puq r.puq)) - . - :: - ++ beet :: beet:pu - ^+ . :: advance unacked - =- +(nep ?~(foh nus u.foh)) - ^= foh - |- ^- (unit @ud) - ?~ puq ~ - ?: (lte p.n.puq nep) $(puq l.puq) - =+ rig=$(puq r.puq) - ?^(rig rig [~ p.n.puq]) - :: - ++ bine :: bine:pu - |= [now=@da num=@ud] :: apply ack - ^- [(unit soup) _+>] - ?~ puq !! - ?. =(num p.n.puq) - ?: (gth num p.n.puq) - =+ lef=$(puq l.puq) - [-.lef +.lef(puq [n.puq puq.lef r.puq])] - =+ rig=$(puq r.puq) - [-.rig +.rig(puq [n.puq l.puq puq.rig])] - =: rtt ?. &(liv.q.n.puq =(1 nux.q.n.puq)) rtt - =+ gap=(sub now lys.q.n.puq) - :: ~& [%bock-trip num (div gap (div ~s1 1.000))] - (div (add (mul 2 rtt) gap) 3) - nif (sub nif !liv.q.n.puq) - == - =+ lez=(dec (need (~(get by pyz) gom.q.n.puq))) - =^ gub pyz - ?: =(0 lez) - [[~ gom.q.n.puq] (~(del by pyz) gom.q.n.puq)] - [~ (~(put by pyz) gom.q.n.puq lez)] - :- gub - +>.$(puq ~(nap to puq)) - :: - ++ bock :: bock:pu - |= [now=@da num=@ud] :: ack by sequence - ^- [(unit soup) _+>] - =^ gym +> (bine now num) - :- gym - ?: (gth num nep) - =+ cam=(max 2 (div caw 2)) - :: ~& [%bock-hole num nep cam] - beet:(wept(nep num, cag cam, caw cam) nep num) - =. caw ?: (lth caw cag) +(caw) - (add caw !=(0 (mod (mug now) caw))) - ?: =(num nep) - :: ~& [%bock-fine num nif caw cag] - beet - :: ~& [%bock-fill num nif caw cag] - +>.$ - :: - ++ harv :: harv:pu - |= now=@da :: harvest queue - ^- [(list rock) _+>] - ?: =(~ puq) [~ +>(rtn ~)] - ?. (gth caw nif) [~ +>] - =+ wid=(sub caw nif) - =| rub=(list rock) - =< abet =< apse - |% - ++ abet - ?~ rub [~ +>.$] - [(flop rub) +>.$(rtn [~ (add rto now)])] - :: - ++ apse - ^+ . - ?~ puq . - ?: =(0 wid) . - => rigt =< left - ?> ?=(^ puq) - ?: =(0 wid) . - ?. =(| liv.q.n.puq) . - :: ~& [%harv nux.q.n.puq p.n.puq] - %_ . - wid (dec wid) - rub [pac.q.n.puq rub] - nif +(nif) - liv.q.n.puq & - nux.q.n.puq +(nux.q.n.puq) - lys.q.n.puq now - == - :: - ++ left - ?> ?=(^ puq) - ^+(. =+(lef=apse(puq l.puq) lef(puq [n.puq puq.lef r.puq]))) - ++ rigt - ?> ?=(^ puq) - ^+(. =+(rig=apse(puq r.puq) rig(puq [n.puq l.puq puq.rig]))) - -- - :: - ++ wack :: wack:pu - |= now=@da :: wakeup (timeout) - ^- [(list rock) _+>] - ?. &(!=(~ rtn) ?>(?=(^ rtn) (gte now u.rtn))) [~ +>] - :: ~& [%slow (div rto (div ~s1 1.000))] - =. +> (wept 0 nus) - ?> =(0 nif) - =: caw 2 - rto ;: min - (mul 2 rto) - ~m2 - (mul ~s16 ?~(rue 1 +((div (sub now u.rue) ~d1)))) - == - == - (harv now) - :: - ++ wept :: wept:pu - |= [fip=@ud lap=@ud] :: fip thru lap-1 - =< abet =< apse - |% - ++ abet +>.$ - ++ apse - ^+ . - ?~ puq . - ?: (lth p.n.puq fip) ?~(l.puq . left) - ?: (gte p.n.puq lap) ?~(r.puq . rigt) - => rigt =< left - ?> ?=(^ puq) - ?.(liv.q.n.puq . .(nif (dec nif), liv.q.n.puq |)) - :: - ++ left - ?> ?=(^ puq) - ^+(. =+(lef=apse(puq l.puq) lef(puq [n.puq puq.lef r.puq]))) - ++ rigt - ?> ?=(^ puq) - ^+(. =+(rig=apse(puq r.puq) rig(puq [n.puq l.puq puq.rig]))) - -- - :: - ++ whap :: whap:pu - |= [now=@da gom=soup wyv=(list rock)] :: send a message - ^- [(list rock) _+>] - =. pyz (~(put by pyz) gom (lent wyv)) - =. +> - |- ^+ +>.^$ - ?~ wyv +>.^$ - %= $ - wyv t.wyv - nus +(nus) - diq (~(put by diq) (shaf %flap i.wyv) nus) - puq (~(put to puq) [nus `soul`[gom 0 | ~2000.1.1 i.wyv]]) - == - (harv now) - -- - -- - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aG, protocol engine :: - :: - |% - ++ am :: am - ~% %ames-am ..is ~ - |_ [our=ship now=@da fox=fort ski=sley] :: protocol engine - :: +deed-scry: for a +deed at a +life - :: - ++ deed-scry - ~/ %deed-scry - |= [who=ship lyf=life] - ^- (unit deed) - =; ded - ?~(ded ~ u.ded) - ;; (unit (unit deed)) - %- (sloy-light ski) - =/ pur=spur - /(scot %ud lyf)/(scot %p who) - [[151 %noun] %j our %deed da+now pur] - :: +life-scry: for a +life - :: - ++ life-scry - ~/ %life-scry - |= who=ship - ^- (unit life) - =; lyf - ?~(lyf ~ u.lyf) - ;; (unit (unit life)) - %- (sloy-light ski) - =/ pur=spur - /(scot %p who) - [[151 %noun] %j our %life da+now pur] - :: +sein-scry: for sponsor - :: - ++ sein-scry - ~/ %sein - |= who=ship - ;; ship - %- need %- need - %- (sloy-light ski) - [[151 %noun] %j our %sein da+now /(scot %p who)] - :: +saxo-scry: for sponsorship chain - :: - ++ saxo-scry - ~/ %saxo - |= who=ship - ;; (list ship) - %- need %- need - %- (sloy-light ski) - [[151 %noun] %j our %saxo da+now /(scot %p who)] - :: +turf-scry: for network domains - :: - ++ turf-scry - =< $ - ~% %turf + ~ - |. ;; (list turf) - %- need %- need - %- (sloy-light ski) - [[151 %noun] %j our %turf da+now ~] - :: - ++ vein :: vein:am - ~/ %vein - |= [=life vein=(map life ring)] :: new private keys - ^- fort - :: - ?. ?& (~(has by vein) life) - =(life (roll ~(tap in ~(key by vein)) max)) - == - ~| [%vein-mismatch +<] !! - %= fox - hoc.ton - :: reset connections - :: - (~(run by hoc.ton.fox) |=(=dore dore(caq *clot))) - :: - seh.ton - :: reset symmetric key cache - :: - ~ - :: - :: save our secrets, ready for action - law.ton - :: save our deed (for comet/moon communication) - :: - (need (deed-scry our life)) - :: - val.ton - :: save our secrets, ready for action - :: - ^- wund - %+ turn - %+ sort - ~(tap by vein) - |= [a=[=^life =ring] b=[=^life =ring]] - (gth life.a life.b) - |= [=^life =ring] - [life ring (nol:nu:crub:crypto ring)] - == - :: - ++ gnaw :: gnaw:am - ~/ %gnaw - |= [kay=cape ryn=lane pac=rock] :: process packet - ^- [p=(list boon) q=fort] - =/ kec=(unit cake) (bite pac) - ?~ kec [~ fox] - ?: (goop p.p.u.kec) - [~ fox] - ?. =(our q.p.u.kec) - [~ fox] - =; zap=[p=(list boon) q=fort] - [(weld p.zap next) q.zap] - =< zork - =< zank - :: ~& [%hear p.p.u.kec ryn `@p`(mug (shaf %flap pac))] - %- ~(chew la:(ho:um p.p.u.kec) kay ryn %none (shaf %flap pac)) - [q.u.kec r.u.kec] - :: - ++ goop :: blacklist - |= him=ship - | - :: - ++ kick :: kick:am - |= hen=duct :: refresh net - ^- [p=(list boon) q=fort] - zork:(kick:um hen) - :: - ++ next - ^- (list boon) - =/ doz=(unit @da) [~ (add now ~s32)] - =. doz - |- ^+ doz - ?~ wab.zac.fox doz - =. doz $(wab.zac.fox l.wab.zac.fox) - =. doz $(wab.zac.fox r.wab.zac.fox) - =+ bah=q.n.wab.zac.fox - (hunt lth doz rtn.sop.bah) - =/ nex (hunt lth doz tim.fox) - ?: =(tim.fox nex) - ~ - [%pito (need nex)]~ - :: - ++ rack :: rack:am - ~/ %rack - |= [her=ship cha=path cop=coop] :: e2e ack - =/ oh (ho:um her) - =^ gud oh (cook:oh cop cha ~) - ?. gud oh - (cans:oh cha) - :: - ++ wake :: wake:am - ~/ %wake - |= hen=duct :: harvest packets - ^- [p=(list boon) q=fort] - =. tim.fox ~ - =/ neb=(list ship) ~(tap in ~(key by wab.zac.fox)) - =| bin=(list boon) - |- ^- [p=(list boon) q=fort] - ?~ neb - =^ ban fox (kick hen) - [:(weld bin p.ban next) fox] - =/ fro=(list ship) (saxo-scry our) - =/ hoz (ho:um i.neb) - =^ bun fox zork:zank:(thaw:hoz fro) - $(neb t.neb, bin (weld p.bun bin)) - :: - ++ wise :: wise:am - |= [hen=duct her=ship cha=path val=*] :: send a statement - ^- [p=(list boon) q=fort] - =^ ban fox zork:zank:(wool:(ho:um her) hen cha val) - [(weld p.ban next) fox] - :: - ++ um :: per server - =/ gus (~(us go ton.fox) our) - =/ weg=corn zac.fox - =| bin=(list boon) - |% - ++ ho :: ho:um:am - |= her=ship :: per friend - =+ diz=(myx:gus her) - =+ bah=(~(get by wab.weg) her) - =+ puz=?~(bah ahoy:pu %*(. pu +< sop.u.bah)) - => .(bah `bath`?~(bah [abet:puz ~ ~] u.bah)) - |% - ++ busk :: busk:ho:um:am - |= [waz=(list ship) pax=(list rock)] :: send packets - %_ +> - bin - |- ^+ bin - ?~ pax bin - $(pax t.pax, bin (weld (flop (wist:diz now waz ~ i.pax)) bin)) - == - :: - ++ cans :: cans:ho:um:am - |= cha=path - =+ rum=(need (~(get by raz.bah) cha)) - =. rum - %= rum - did +(did.rum) - mis (~(del by mis.rum) did.rum) - == - (coat cha rum) - :: - ++ coat :: coat:ho:um:am - |= [cha=path rum=race] :: update input race - ^+ +> - =+ cun=(~(get by mis.rum) did.rum) - ?: |(!dod.rum ?=(~ cun)) - :: - :: if we have not yet received the current message, - :: or if we are not idle, just wait. - :: - +>.$(raz.bah (~(put by raz.bah) cha rum)) - ?. =(%good p.u.cun) - :: - :: if we are recording a failed message, acknowledge - :: it now, since it obviously won't be processed. - :: - ~& [%fail-ack did.rum] - =^ gud +>.$ - (cook ``[%dead-message ~] cha `[q.u.cun r.u.cun]) - ?. gud +>.$ - %= +>.$ - raz.bah - %+ ~(put by raz.bah) cha - %= rum - did +(did.rum) - mis (~(del by mis.rum) did.rum) - == - == - :: - :: the message is good. send it to be processed. - :: - ?> ?=(^ s.u.cun) - %= +>.$ - raz.bah (~(put by raz.bah) cha rum(dod |)) - bin - :_ bin - :^ %milk - her - `soap`[[lyf:sen:gus clon:diz] cha did.rum] - u.s.u.cun - == - :: - ++ cook :: cook:ho:um:am - |= [cop=coop cha=path ram=(unit [ryn=lane dam=flap])] - ^- [gud=? con=_+>] :: acknowledgment - :: ~& [%ames-cook cop cha ram] - =+ rum=(need (~(get by raz.bah) cha)) - =+ lat=(~(get by mis.rum) did.rum) - ?: &(?=(~ lat) ?=(~ ram)) - ~& %ack-late-or-redundant - [%| +>.$] - :- %& - =+ ^- [ryn=lane dam=flap] - ?^ ram [ryn.u.ram dam.u.ram] - ?< ?=(~ lat) - [q r]:u.lat - =. raz.bah - ?^ ram raz.bah - %+ ~(put by raz.bah) cha - rum(dod &, bum ?~(cop bum.rum (~(put by bum.rum) did.rum u.cop))) - =/ seg (sein-scry her) - =^ roc diz (zuul:diz now seg [%back cop dam ~s0]) - =/ fro=(list ship) (saxo-scry our) - (busk(diz (wast:diz ryn)) (xong fro) roc) - :: XX move this logic into %zuse, namespaced under %jael? - :: - ++ deng :: deng:ho:um:am - |= law=(unit deed) :: accept inline deed - ^+ diz - ?: |(=(~ law) =(lew.wod.dur.diz law)) - diz - ~| [%deng-fail her] - ?> ?=(^ law) - =* wed u.law - ?> ^- ? - ?- (clan:title her) - %earl - :: signed by parent - :: - =/ seg (^sein:title her) - =/ yig - ?: =(our seg) - sen:gus - cluy:(myx:gus seg) - ?& =(lyf.yig life.wed) - ?=(^ oath.wed) - .= (need (sure:as:cub.yig u.oath.wed)) - (shaf %earl (sham [her life.wed pass.wed])) - == - :: - %pawn - :: self-signed, life 1, address is fingerprint - :: - =/ cub=acru (com:nu:crub:crypto pass.wed) - ?& =(`@`fig:ex:cub her) - ?=(%1 life.wed) - ?=(^ oath.wed) - :: XX do we care about this signature at all? - :: - .= (need (sure:as:cub u.oath.wed)) - (shaf %self (sham [her life.wed pass.wed])) - == - :: - * - :: our sponsor - :: - ?& !?=(%czar (clan:title our)) - =(her (sein-scry our)) - == - == - diz(lew.wod.dur law) - :: - ++ done :: done:ho:um:am - |= [cha=path num=@ud] :: complete outgoing - ^- [(unit duct) _+>] - :: ~& [%ames-done cha num] - =+ rol=(need (~(get by ryl.bah) cha)) - =+ rix=(~(get by san.rol) num) - ?~ rix [~ +>.$] - :- rix - %_ +>.$ - ryl.bah - (~(put by ryl.bah) cha rol(san (~(del by san.rol) num))) - == - :: - ++ la :: la:ho:um:am - |_ [kay=cape ryn=lane aut=skin dam=flap] :: per packet - :: - ++ chew :: chew:la:ho:um:am - |= [sin=skin msg=@] :: receive - ^+ +> - =< abed - |% - :: +abed: check that we have the keys to communicate with :her - :: - ++ abed - ^+ +>.$ - :: if we don't have a deed, subscribe for public key updates - :: - :: XX update state so we only ask once? - :: - =? +>.$ ?=(~ lew.wod.dur.diz) - (emit %beer her) - :: if we don't have a deed, scry for it - :: (to avoid dropping the packet, if possible). - :: - =? lew.wod.dur.diz ?=(~ lew.wod.dur.diz) - =/ life (life-scry her) - ?~(life ~ (deed-scry her u.life)) - :: if we have a deed, proceed - :: - ?^ lew.wod.dur.diz - apse - :: if :her is our initial sponsor, proceed (TOFU) - :: - :: XX TOFU is unnecessary if we include keys - :: for the full sponsorship chain in the boot event - :: - ?: =(her (sein-scry our)) - apse - :: if :her is a comet, or a moon of a known ship, proceed - :: - =/ =rank:title (clan:title her) - ?: ?| ?=(%pawn rank) - ?& ?=(%earl rank) - !=(~ lew.wod.dur:(myx:gus (sein-scry her))) - == == - apse - :: otherwise, drop the packet - :: - +>.$ - :: +apse: process the packet, notify if :her status changed - :: - ++ apse - ^+ +>.$ - =/ oub bust:puz - =/ neg =(~ yed.caq.dur.diz) - =. +>.$ east - =/ eng =(~ yed.caq.dur.diz) - =/ bou bust:puz - =? +>.$ &(oub !bou) - (emit [%wine her " is ok"]) - :: the presence of a symmetric key indicates neighboring - :: XX use deed instead? - :: - =? +>.$ &(neg !eng) - %- emir :~ - [%wine her " is your neighbor"] - ?> ?=(^ lew.wod.dur.diz) - [%raki her [life pass]:u.lew.wod.dur.diz] - == - +>.$ - :: - ++ east - ^+ +>.$ - ?- sin - %none - :: ~& %chew-none - =. puz (bilk:puz now) - (chow ;;(meal (cue msg))) - :: - %fast - :: ~& %chew-fast - =+ [mag=`hand`(end 7 1 msg) bod=(rsh 7 1 msg)] - =/ dey (kuch:diz mag) - :: ignore unknown key - :: - ?~ dey +>.$ - =. puz (bilk:puz now) - =^ key diz u.dey - (chow(aut sin) ;;(meal (cue (dy:cub:sen:gus key bod)))) - :: - %full - :: ~& %chew-full - =/ mex ;;(full:pact (cue msg)) - =. diz (deng law.mex) - =/ wug cluy:diz - ?> =(lyf.wug from.lyf.mex) - =/ gey (sev:gus to.lyf.mex) - =/ sem (need (tear:as:q.gey pub:ex:cub.wug txt.mex)) - =/ mes ;;((pair @ @) (cue sem)) - =. diz (wasc:diz p.mes) - =. puz (bilk:puz now) - (west(msg q.mes)) - :: - %open - :: ~& %chew-open - =/ mex ;;(open:pact (cue msg)) - =. diz (deng law.mex) - =/ wug cluy:diz - ?> =(lyf.wug from.lyf.mex) - =/ mes (need (sure:as:cub.wug txt.mex)) - =. puz (bilk:puz now) - (west(msg mes)) - == - ++ west - |= ~ - =+ vib=(cue msg) - =+ mal=(meal vib) - ?. =(mal vib) - ~& [%bad-meal her] - +>.^$ - (chow(aut sin) mal) - -- - :: - ++ chow :: chow:la:ho:um:am - |= fud=meal :: interpret meal - ^+ +> - =. diz ?:(=(%none aut) diz (wast:diz ryn)) - (dine fud) - :: - ++ cock :: cock:la:ho:um:am - ^+ . :: send new ack - :: ~& [%back kay dam] - =* cop `coop`?:(=(%good kay) ~ ``[%dead-packet ~]) - =/ seg (sein-scry her) - =^ pax diz (zuul:diz now seg [%back cop dam ~s0]) - =/ fro=(list ship) (saxo-scry our) - ..cock(+> (busk(diz (wast:diz ryn)) (xong fro) pax)) - :: - ++ deer :: deer:la:ho:um:am - |= [cha=path num=@ud dut=(unit)] :: interpret message - ^+ +> - =+ rum=(~(gut by raz.bah) cha *race) - :: ~& [%rx kay cha num [dod.rum did.rum] ?=(~ dut)] - =* bad (~(has in bad.fox) her) - =. kay ?.((~(has in bad.fox) her) kay ~&(%blocked %dead)) - %= +>.$ - +> - ?: (lth num did.rum) - :: - :: this message already acknowledged; repeat old ack, - :: or negative ack if this ship is blocked - :: - =* cop ^- coop - %+ ~(gut by bum.rum) num - ?:(bad ~ ``[%blocked ~]) - con:(cook (~(get by bum.rum) num) cha `[ryn dam]) - :: - :: insert this message in unprocessed set - :: - =. mis.rum (~(put by mis.rum) num [kay ryn dam dut]) - :: - :: if ship is blocked, advance pointer to latest message - :: - =. did.rum ?.(bad did.rum num) - :: - :: process update - :: - (coat cha rum) - == - :: - ++ dine :: dine:la:ho:um:am - |= fud=meal :: interpret meal - ^+ +> - ?- -.fud - %back - =. +> ?.(=(%full aut) +> cock) :: finish handshake - +>(..la (tock p.fud q.fud r.fud)) - :: - %bond - :: ~& [%bond p.fud q.fud] - (deer p.fud q.fud ?-(kay %dead ~, %good [~ r.fud])) - :: - %carp - :: =+ zol=(~(get by olz.weg) s.fud) - :: ?^ zol cock(kay u.zol) - =^ neb nys.weg - =+ neb=(~(get by nys.weg) s.fud) - ?^ neb [u.neb nys.weg] - =+ neb=`bait`[(kins p.fud) 0 r.fud ~] - [neb (~(put by nys.weg) s.fud neb)] - ?> (lth q.fud p.r.neb) - ?> =((kins p.fud) p.neb) - ?> =(r.fud p.r.neb) - =+ doy=`(unit @)`(~(get by q.r.neb) q.fud) - ?^ doy cock - => ^+ . %= . - q.r.neb (~(put by q.r.neb) q.fud t.fud) - q.neb +(q.neb) - == - :: ~& [%carp q.fud s.fud q.neb p.r.neb] - ?: =(q.neb p.r.neb) - =: nys.weg (~(del by nys.weg) s.fud) - :: olz.weg (~(put by olz.weg) s.fud kay) - == - (golf p.neb r.neb) - =. +>.$ cock - +>.$(nys.weg (~(put by nys.weg) s.fud neb)) - :: - %fore - =+ ^= lyn ^- lane - ?~ q.fud ryn - ?. ?=(%if -.u.q.fud) u.q.fud - [%ix +.u.q.fud] - :: u.q.fud - ?: =(our p.fud) - (emit %mead lyn r.fud) - =/ zid (myx:gus p.fud) - =/ zon %*(xong ..xong her p.fud) - =/ fro=(list ship) (saxo-scry our) - (emir (wist:zid now (zon fro) [~ lyn] r.fud)) - == - :: - ++ emir :: emir:la:ho:um:am - |= ben=(list boon) :: emit boons - ^+ +> - ?~(ben +> $(ben t.ben, bin [i.ben bin])) - :: - ++ emit :: emit:la:ho:um:am - |= bun=boon :: emit a boon - +>(bin [bun bin]) - :: - ++ golf :: golf:la:ho:um:am - |= [sin=skin duv=dove] :: assemble fragments - ^+ +> - %+ chew sin - =+ [nix=0 rax=*(list @)] - |- ^- @ - ?: =(p.duv nix) - (can 13 (turn (flop rax) |=(a=@ [1 a]))) - $(nix +(nix), rax [(need (~(get by q.duv) nix)) rax]) - -- :: --la:ho:um:am - :: - ++ pong :: pong:ho:um:am - |= hen=duct :: test connection - ^+ +> - ?. ?& =(~ puq.puz) - ?| bust:puz - ?=(~ rue.puz) - (gth now (add ~s32 u.rue.puz)) - :: XX hop.fox is never set, nothing sends %kick - :: - :: (lth u.rue.puz hop.fox) - == - == - +>.$ - (wool [/a/ping hen] /a/pi ~ |) - :: - ++ thaw :: thaw:ho:um:am - |= fro=(list ship) - ^+ +> :: wakeup bomb - =+ oub=bust:puz - =^ yem puz (wack:puz now) - =+ bou=bust:puz - =. bin - ?. &(bou !oub) bin - :_(bin [%wine her " not responding still trying"]) - =. diz ?:((boom:puz now) (pode:diz now) diz) - (busk (xong fro) yem) - :: - ++ tock :: tock:ho:um:am - |= [cop=coop fap=flap cot=@dr] :: e2e ack by hash - ^+ +> - =^ yoh puz (bick:puz now fap) - =. +>.$ - ?~ p.yoh +>.$ - =^ hud +>.$ - (done p.u.p.yoh q.u.p.yoh) - ?~ hud +>.$ - %= +>.$ - bin - :_ bin - `boon`[%cake her [[lyf:sen:gus clon:diz] u.p.yoh] cop u.hud] - == - =/ fro=(list ship) (saxo-scry our) - (busk (xong fro) q.yoh) - :: - ++ wind :: wind:ho:um:am - |= [gom=soup ham=meal] - :: ~& [%wind her gom] - ^+ +> - =/ seg (sein-scry her) - =^ wyv diz (zuul:diz now seg ham) - =^ feh puz (whap:puz now gom wyv) - =/ fro=(list ship) (saxo-scry our) - (busk (xong fro) feh) - :: - ++ wool :: wool:ho:um:am - |= [hen=duct cha=path val=*] :: send a statement - ^+ +> - =/ rol=rill (~(gut by ryl.bah) cha *rill) - =/ sex=@ud sed.rol - :: ~& [%tx [our her] cha sex] - :: if we don't have a public key for :her, - :: subscribe to %jael for keys and proceed - :: - :: XX update state so we only ask once? - :: - =? bin =(~ lew.wod.dur.diz) :_(bin [%beer her]) - :: if we don't have a public key for :her, - :: scry into %jael for them. - :: (skin will only be %open if the scry is ~) - :: - =? lew.wod.dur.diz =(~ lew.wod.dur.diz) - =/ life (life-scry her) - ?~(life ~ (deed-scry her u.life)) - =. ryl.bah - %+ ~(put by ryl.bah) cha - %= rol - sed +(sed.rol) - san (~(put by san.rol) sex hen) - == - %+ wind [cha sex] - [%bond cha sex val] - :: - ++ zest :: zest:ho:um:am - :~ :~ :* [%rtt rtt.sop.bah] - [%rto rto.sop.bah] - [%rtn rtn.sop.bah] - [%rue rue.sop.bah] - == - :* [%nus nus.sop.bah] - [%nif nif.sop.bah] - [%nep nep.sop.bah] - [%caw caw.sop.bah] - [%cag cag.sop.bah] - == - =+ qup=~(tap to puq.sop.bah) - :- %qup - %+ turn qup - |= [a=@ud b=soul] - :* a - nux.b - liv.b - lys.b - `@p`(mug (shaf %flap pac.b)) - gom.b - == - == - :: - :- %raz - =+ zar=~(tap by raz.bah) - %+ turn zar - |= [a=path b=race] - :+ a - did.b - =+ ciy=~(tap by mis.b) - %+ turn ciy - |= [c=@ud d=[p=cape q=lane r=flap s=(unit)]] - [c p.d r.d] - :: - [%ryl ~(tap to ryl.bah)] - [%lun lun.wod.dur.diz] - [%caq caq.dur.diz] - [%lew lew.wod.dur.diz] - == - :: - ++ zank :: zank:ho:um:am - %= +>.$ :: resolve - gus (nux:gus diz) - wab.weg (~(put by wab.weg) her bah(sop abet:puz)) - == - :: - ++ xong :: xong:ho:um:am - |= fro=(list ship) - ^- (list ship) :: route unto - =/ too (saxo-scry her) - =+ ^= oot ^- (list ship) - =| oot=(list ship) - |- ^+ oot - ?~ too ~ - ?: (lien fro |=(a=ship =(a i.too))) ~ - [i.too $(too t.too)] - :: ~& [%xong-to [our her] (weld oot ?>(?=(^ fro) t.fro))] - (weld oot ?>(?=(^ fro) t.fro)) - -- :: --ho:um:am - :: - ++ kick :: kick:um:am - |= hen=duct :: test connection - ^+ +> - =/ hoy (tail (saxo-scry our)) - |- ^+ +>.^$ - ?~ hoy - +>.^$ - $(hoy t.hoy, +>.^$ (pong i.hoy hen)) - :: - ++ pals :: pals:um:am - ^- (list @p) :: active neighbors - %+ turn - %+ skim ~(tap by wab.weg) - |= [a=ship b=bath] - !(~(boom pu sop.b) now) - |=([a=ship b=bath] a) - :: - ++ pong :: pong:um:am - |= [her=ship hen=duct] :: test neighbor - ^+ +> - zank:(pong:(ho her) hen) - :: - ++ zork :: zork:um:am - ^- [p=(list boon) q=fort] :: resolve - :- (flop bin) - %_ fox - ton (~(su go ton.fox) gus) - zac weg - == - -- :: --um:am - -- :: --am - -- - . == - :::::::::::::::::::::::::::::::::::::::::::::::::::::::: - :: section 4aH, protocol vane :: - :: - =| $: fox=fort :: kernel state - == :: - |= [our=ship now=@da eny=@uvJ ski=sley] :: current invocation - ^? :: opaque core - =< - ~% %ames-protocol ..is ~ - |% :: vane interface - ++ call :: handle request - ~/ %call - |= $: hen=duct - type=* - wrapped-task=(hobo task:able) - == - ^- [(list move) _..^$] - =/ task=task:able - ?. ?=(%soft -.wrapped-task) - wrapped-task - ;;(task:able p.wrapped-task) - =. any.ton.fox eny - =^ duy ..knob (knob hen task) - [duy ..^$] - :: - ++ load - |= old=fort - ..^$(fox old) - :: - ++ scry - |= [fur=(unit (set monk)) ren=@tas why=shop syd=desk lot=coin tyl=path] - ^- (unit (unit cage)) - ?. ?=(%& -.why) [~ ~] - ?~ tyl [~ ~] - =+ hun=(slaw %p i.tyl) - ?~ hun [~ ~] - ?. =(`@`0 ren) ~ - ?. ?=([$$ %da @] lot) - ~ - ?. =(now q.p.lot) ~ - (temp u.hun [syd t.tyl]) - :: - ++ stay fox - ++ take :: accept response - ~/ %take - |= [tea=wire hen=duct hin=(hypo sign)] - ^- [(list move) _..^$] - =. any.ton.fox eny - =^ duy ..knap - (knap tea hen q.hin) - [duy ..^$] - -- - ~% %ames-impl ..is ~ - |% - ++ clop - ~/ %clop - |= [now=@da hen=duct bon=boon] - ^- [(list move) fort] - ?- -.bon - %beer - =/ =wire /pubs/(scot %p p.bon) - :_ fox [hen [%pass wire %j %pubs p.bon]]~ - :: - %bock - :: ignore %turf if we haven't yet learned a unix duct - :: - :: Only happens during first boot. - :: - ?~ gad.fox - [~ fox] - :_ fox - [gad.fox %give %turf tuf.fox]~ - :: - %brew - :_ fox [hen [%pass / %j %turf ~]]~ - :: - %cake - :: ~? ?=(^ r.bon) [%cake-woot-bad hen r.bon] - :_ fox - :~ [s.bon %give %woot p.bon r.bon] - == - :: - %mead - =^ moz +>.$ (knob hen [%hear p.bon q.bon]) - [moz fox] - :: - %milk - :: ~& [%milk p.bon q.bon] - ?> ?=([@ @ *] q.q.bon) - ?> ?=(?(%a %c %e %g %j) i.q.q.bon) - =/ =wire [(scot %p our) (scot %p p.bon) q.q.bon] - :_ fox [hen %pass wire i.q.q.bon %west p.bon t.q.q.bon r.bon]~ - :: - %ouzo - :: drop packet if we haven't yet learned a unix duct - :: - :: Only happens during first boot. - :: - ?~ gad.fox - [~ fox] - :: ~& [%send now p.bon `@p`(mug (shaf %flap q.bon))] - :_ fox - [[gad.fox [%give %send p.bon q.bon]] ~] - :: - %pito - :_ fox(tim `p.bon) - %- flop - ^- (list move) - :: XX should this be the unix duct (gad.fox)? - :: - :: It seems far more important that the duct be always - :: predictable than that it be the unix duct, which - :: may change, or be unset during first boot. - :: - :- [gad.fox %pass /ames %b %wait p.bon] - ?~ tim.fox ~ - [gad.fox %pass /ames %b %rest u.tim.fox]~ - :: - %raki - :_ fox - [hen [%pass / %j %meet who=p.bon life=q.bon pass=r.bon]]~ - :: - %sake - =/ =wire /our/(scot %p our) - :_ fox [hen [%pass wire %j %vein ~]]~ - :: - %wine - :_ fox - =+ fom=~(rend co %$ %p p.bon) - :~ :- hen - :+ %slip %d - :+ %flog %text - ;: weld - "; " - fom - q.bon - == - == - == - :: - ++ knap - ~/ %knap - |= [tea=wire hen=duct sih=sign] - ^- [(list move) _+>] - :: if we got an error from behn, report it to %dill; TODO handle errors - :: - ?: ?=([%wake ^] +.sih) - =/ =flog:dill [%crud %wake u.error.sih] - [[hen %slip %d %flog flog]~ +>.$] - :: - ?- +<.sih - %crud [[[hen [%slip %d %flog +.sih]] ~] +>] - :: - %mack ?~ +>.sih $(sih [%g %nice ~]) :: XX using old code - $(sih [%g %mean `[%mack +>+.sih]]) - :: - %pubs - ?. ?=([%pubs @ ~] tea) - ~& [%strange-pubs tea] - [~ +>] - =/ her=ship (slav %p i.t.tea) - =/ gus (~(us go ton.fox) our) - =/ diz (myx:gus her) - ?: =(0 life.sih) - :: this should clear lew.wod.dur.diz because it means - :: we no longer trust that their public key came to - :: us honestly (becuse of a %jael snapshot restore). - :: in practice, that crashes in ++cluy:las:as:go, so - :: we ignore for now. - ~& [%ames-hear-empty-pub her] - [~ +>.$] - =/ ded=deed - [life.sih (~(got by pubs.sih) life.sih) oath=~] - =. lew.wod.dur.diz `ded - =. ton.fox (~(su go ton.fox) (nux:gus diz)) - [~ +>.$] - :: - %unto [~ +>] - :: - %vein - ?. ?=([%our @ ~] tea) - ~& [%strange-vein tea] - [~ +>] - =. fox (~(vein am [our now fox ski]) life.sih vein.sih) - [~ +>.$] - :: - %woot [~ +>] - :: - * - =+ ^= fuy - ^- [p=(list boon) q=fort] - ?- +<.sih - :: - :: only handles the non-error %wake case; error case above - :: - %wake - (~(wake am [our now fox ski]) hen) - :: - %turf - ?: =(tuf.fox turf.sih) - [~ fox] - =. tuf.fox turf.sih - [[%bock ~]~ fox] - :: - ?(%mean %nice) :: XX obsolete - ?: ?=([%ye ~] tea) - [~ fox] - ?> ?=([@ @ @ *] tea) - =/ her (slav %p i.t.tea) - =* pax t.t.tea - =< zork =< zank - %^ ~(rack am [our now fox ski]) her pax - :: ~& [%knap-ack ?-(+<.sih %mean `p.+.sih, %nice ~)] - ?-(+<.sih %mean `p.+.sih, %nice ~) - == - => %_(. fox q.fuy) - =| out=(list move) - |- ^- [p=(list move) q=_+>.^$] - ?~ p.fuy - [(flop out) +>.^$] - =^ toe fox (clop now hen i.p.fuy) - $(p.fuy t.p.fuy, out (weld (flop toe) out)) - == - :: - ++ knob - ~/ %knob - |= [hen=duct kyz=task:able] - ^- [(list move) _+>] - ?: ?=(%crud -.kyz) - [[[hen [%slip %d %flog kyz]] ~] +>] - ?: ?=(%west -.kyz) - :: a .cha path of /a/give/* is immediately acknowledged and - :: routed directly out to unix - :: - ?: ?=([%give *] q.kyz) - ~| [%ames-bad-duct %give from=p.kyz route=q.kyz] - ?> ?=(^ gad.fox) - :_ +>.$ - [[gad.fox %give kyz] [hen %give %mack ~] ~] - :: a .cha path of /a/pi is just a ping, immediately acknowledged - :: - ?> ?=([%pi ~] q.kyz) - :_ +>.$ - [[hen %give %mack ~] ~] - ?: ?=(%wegh -.kyz) - ~& %ames-weighing - [[hen %give %mass wegh]~ +>] - =+ ^= fuy - ^- [p=(list boon) q=fort] - ?- -.kyz - %barn - =: gad.fox hen - tuf.fox ~(turf-scry am [our now fox ski]) - == - [[%bock ~]~ fox] - :: - %bonk - :_ fox - ?~ tim.fox - ~& %ames-bonk-e - ~ - [%pito u.tim.fox]~ - :: - %hear - (~(gnaw am [our now fox ski]) %good p.kyz q.kyz) - :: - %halo - (~(gnaw am [our now fox ski]) %dead p.kyz q.kyz) - :: - %hole - (~(gnaw am [our now fox ski]) %dead p.kyz q.kyz) - :: - %init - :_ fox [[%sake ~] [%brew ~] ~] - :: - %kick - =^ ban fox (~(kick am [our now fox(hop p.kyz) ski]) hen) - :: +next:am called here because +wake calls +kick in a loop - :: - [(weld p.ban ~(next am [our now fox ski])) fox] - :: - %nuke - :- ~ - ?: (~(has in bad.fox) p.kyz) - ~& [%unblock p.kyz] - fox(bad (~(del in bad.fox) p.kyz)) - ~& [%block p.kyz] - fox(bad (~(put in bad.fox) p.kyz)) - :: - %sunk - =* who p.kyz - =* lyf q.kyz - ?: =(our who) - ?: (lth lyf p:(head val.ton.fox)) - :: replaying our old sinkage, ignore - :: XX review - :: - [~ fox] - :: XX include some helpful instructions here - :: - :_ fox - [%wine who ", you have sunk"]~ - :: - =: hoc.ton.fox (~(del by hoc.ton.fox) who) - wab.zac.fox (~(del by wab.zac.fox) who) - == - [[%wine who " has sunk"]~ fox] - :: - %vega - :: re-initialize our cryptosuite B cores - :: - =/ =wund - %+ turn - val.ton.fox - |= [=life =ring *] - [life ring (nol:nu:crub:crypto ring)] - [~ fox(val.ton wund)] - :: - %wake - (~(wake am [our now fox ski]) hen) - :: - %want - (~(wise am [our now fox ski]) hen p.kyz q.kyz r.kyz) - == - => %_(. fox q.fuy) - =| out=(list move) - |- ^- [p=(list move) q=_+>.^$] - ?~ p.fuy - [(flop out) +>.^$] - =^ toe fox (clop now hen i.p.fuy) - $(p.fuy t.p.fuy, out (weld (flop toe) out)) - :: - ++ temp - ~/ %temp - |= [his=ship tyl=path] - ^- (unit (unit cage)) - ?: ?=([?(%show %tell) *] tyl) - ?^ t.tyl [~ ~] - =+ zet=zest:(ho:~(um am [our now fox ski]) his) - ``[%noun ?:(=(%show i.tyl) !>(>zet<) !>(zet))] - ?: ?=([%pals ~] tyl) - ?. =(our his) - ~ - ``[%noun !>(pals:~(um am [our now fox ski]))] - ?: ?=([%time ~] tyl) - ?. =(our his) - ~ - ``[%noun !>(tim.fox)] - ~ - :: - ++ wegh - ^- mass - :+ %ames %| - :~ :+ %town %| - => ton.fox - :~ wund+&+val - deed+&+law - fast+&+seh - them+&+hoc - == - :+ %corn %| - => zac.fox - :~ incoming+&+nys - complete+&+olz - neighbor+&+wab - == - dot+&+fox - == - -- From 9d58e88c17c59de2edc43eecd93979d158b62937 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 22 Jul 2019 19:16:19 -0700 Subject: [PATCH 018/151] Fixed some larval bugs and kale integration --- pkg/arvo/sys/vane/alef.hoon | 116 ++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index a2a7302c2d..f02159f6c5 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -57,6 +57,8 @@ =/ protocol-version=?(%0 %1 %2 %3 %4 %5 %6 %7) %0 =, ames =, able +=* point point:able:kale +=* vent-result vent-result:able:kale :: => |% @@ -314,35 +316,6 @@ +$ rank ?(%0 %1 %2 %3) :: +| %kinetics -:: -:: $point: TODO move to jael -:: -+$ point - $: =rift - =life - crypto-suite=@ud - encryption-key=pass - authentication-key=pass - sponsor=(unit @p) - == -:: $diff-point: TODO move to jael -:: -+$ diff-point - $% [%changed-continuity rift=@ud] - $: %changed-keys - =life - crypto-suite=@ud - continuity-number=@ud - encryption-key=@ud - == - [%new-sponsor sponsor=(unit @p)] - == -:: $vent-result: TODO move to jael -:: -+$ vent-result - $% [%full points=(map ship point)] - [%diff =ship diff-point] - == :: $channel: combined sender and receiver identifying data :: +$ channel @@ -674,7 +647,7 @@ $% [%wake error=(unit tang)] == == $: %k - $% [%private-keys =life =private-key] + $% [%private-keys =life vein=(map life ring)] [%public-keys =vent-result] [%turf turfs=(list turf)] == == @@ -760,7 +733,7 @@ =< =* adult-gate . =| queued-events=(qeu queued-event) :: - |= [our=ship eny=@ now=@da scry-gate=sley] + |= [our=ship now=@da eny=@ scry-gate=sley] =* larval-gate . =* adult-core (adult-gate +<) |% @@ -768,23 +741,31 @@ :: ++ call |= [=duct type=* wrapped-task=(hobo task)] + :: + =/ =task + ?. ?=(%soft -.wrapped-task) + wrapped-task + ;;(task p.wrapped-task) :: %born: set .unix-duct and start draining .queued-events :: - ?: ?=(%born -.wrapped-task) + ?: ?=(%born -.task) :: process %born using wrapped adult ames :: - =^ moves adult-gate (call:adult-core duct type wrapped-task) + =^ moves adult-gate (call:adult-core duct type task) :: if no events were queued up, metamorphose :: ?~ queued-events + ~& %alef-larva-metamorphose [moves adult-gate] + ~& %alef-larva-kick :: kick off a timer to process the first of .queued-events :: =. moves :_(moves [duct %pass /larva %b %wait now]) [moves larval-gate] + ~& %alef-larva-call :: any other event: enqueue it until we have a .unix-duct :: - =. queued-events (~(put to queued-events) %call duct type wrapped-task) + =. queued-events (~(put to queued-events) %call duct type task) [~ larval-gate] :: +take: handle response $sign :: @@ -793,11 +774,15 @@ :: enqueue event if not a larval drainage timer :: ?. =(/larva wire) + ~& %alef-larva-take =. queued-events (~(put to queued-events) %take wire duct type sign) [~ larval-gate] :: larval event drainage timer; pop and process a queued event :: - ?> ?=(%wake -.sign) + ?. ?=([%b %wake *] sign) + ~& %alef-larva-wtf^sign + [~ larval-gate] + ~& %alef-larva-wake =^ first-event queued-events ~(get to queued-events) =^ moves adult-gate ?- -.first-event @@ -807,18 +792,24 @@ :: .queued-events has been cleared; metamorphose :: ?~ queued-events + ~& %alef-metamorphosis [moves adult-gate] + ~& %alef-larva-drain :: set timer to drain next event :: =. moves :_(moves [duct %pass /larva %b %wait now]) [moves larval-gate] :: lifecycle arms; mostly pass-throughs to the contained adult ames :: + :: TODO: don't coerce the old state + :: ++ scry scry:adult-core - ++ stay [queued-events stay:adult-core] + ++ stay ~& %alef-larva-stay [queued-events ames-state.adult-gate] ++ load - |= old=_[queued-events stay:adult-core] + |= old=* ^+ larval-gate + ~& %alef-larva-load + => .(old ;;(_[queued-events ames-state.adult-gate] old)) :: =. queued-events -.old =. adult-gate (load:adult-core +.old) @@ -828,11 +819,13 @@ :: =< =| =ames-state -|= [our=ship eny=@ now=@da scry-gate=sley] +|= [our=ship now=@da eny=@ scry-gate=sley] =* ames-gate . |% :: +call: handle request $task :: +:: TODO: better %crud and %hole handling +:: ++ call |= [=duct type=* wrapped-task=(hobo task)] ^- [(list move) _ames-gate] @@ -842,15 +835,18 @@ wrapped-task ;;(task p.wrapped-task) :: - =/ event-core (per-event [our eny now scry-gate] duct ames-state) + =/ event-core (per-event [our now eny scry-gate] duct ames-state) :: =^ moves ames-state =< abet ?- -.task %born on-born:event-core - %crud !! + %crud ~| %ames-crud^p.task + %- (slog q.task) + event-core %hear (on-hear:event-core [lane blob]:task) - %hole !! + %hole ~| %ames-hole + event-core %init (on-init:event-core ship=p.task) %vega on-vega:event-core %wegh on-wegh:event-core @@ -864,7 +860,7 @@ |= [=wire =duct type=* =sign] ^- [(list move) _ames-gate] :: - =/ event-core (per-event [our eny now scry-gate] duct ames-state) + =/ event-core (per-event [our now eny scry-gate] duct ames-state) :: =^ moves ames-state =< abet @@ -874,7 +870,7 @@ :: [%b %wake *] (on-take-wake:event-core wire error.sign) :: - [%k %private-keys *] (on-priv:event-core [life private-key]:sign) + [%k %private-keys *] (on-priv:event-core [life vein]:sign) [%k %public-keys *] (on-publ:event-core wire vent-result.sign) [%k %turf *] (on-take-turf:event-core turfs.sign) == @@ -901,7 +897,7 @@ |% ++ per-event =| moves=(list move) - |= [[our=ship eny=@ now=@da scry-gate=sley] =duct =ames-state] + |= [[our=ship now=@da eny=@ scry-gate=sley] =duct =ames-state] |% ++ event-core . ++ abet [(flop moves) ames-state] @@ -1126,9 +1122,10 @@ :: +on-priv: set our private key to jael's response :: ++ on-priv - |= [=life =private-key] + |= [=life vein=(map life private-key)] ^+ event-core :: + =/ =private-key (~(got by vein) life) =. life.ames-state life =. crypto-core.ames-state (nol:nu:crub:crypto private-key) :: recalculate each peer's symmetric key @@ -1157,14 +1154,17 @@ :: |^ ^+ event-core ?- vent-result - [%diff @ %changed-continuity *] - (on-publ-breach [ship rift]:vent-result) + [%diff @ * %rift *] + (on-publ-breach [who rift.udiff]:vent-result) :: - [%diff @ %changed-keys *] - (on-publ-rekey [ship +>+]:vent-result) + [%diff @ * %keys *] + (on-publ-rekey [who +>.udiff]:vent-result) :: - [%diff @ %new-sponsor *] - (on-publ-sponsor [ship sponsor]:vent-result) + [%diff @ * %spon *] + (on-publ-sponsor [who sponsor.udiff]:vent-result) + :: + [%diff @ * %disavow ~] + (on-publ-sponsor [who ~]:vent-result) :: [%full *] (on-publ-full points.vent-result) == @@ -1190,12 +1190,11 @@ |= $: =ship =life crypto-suite=@ud - continuity-number=@ud - encryption-key=@ud + =public-key == ^+ event-core :: - (insert-peer-state ship (got-peer-state ship) life `@`encryption-key) + (insert-peer-state ship (got-peer-state ship) life public-key) :: +on-publ-sponsor: handle new or lost sponsor for self or peer :: :: TODO: handle sponsor loss @@ -1243,14 +1242,16 @@ |= [=ship =point] ^+ event-core :: - (insert-peer-state ship *peer-state [life `@`encryption-key]:point) + =/ =public-key pass:(~(got by keys.point) life.point) + (insert-peer-state ship *peer-state life.point public-key) :: ++ meet-alien |= [=ship =point todos=pending-requests] ^+ event-core :: + =/ =public-key pass:(~(got by keys.point) life.point) =. event-core - (insert-peer-state ship *peer-state [life `@`encryption-key]:point) + (insert-peer-state ship *peer-state life.point public-key) :: apply incoming packets :: =. event-core @@ -1310,7 +1311,8 @@ |= [=ship =point =peer-state] ^+ event-core :: - (insert-peer-state ship peer-state [life `@`encryption-key]:point) + =/ =public-key pass:(~(got by keys.point) life.point) + (insert-peer-state ship peer-state life.point public-key) -- :: ++ insert-peer-state From 4123674c9d0211e031614309866fceedc2f01c34 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 22 Jul 2019 19:26:38 -0700 Subject: [PATCH 019/151] WIP temporary changes to hoon and arvo --- pkg/arvo/sys/arvo.hoon | 3 ++- pkg/arvo/sys/hoon.hoon | 25 +++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 340f472dbc..cbb74c780d 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -467,7 +467,7 @@ == :: ++ hurl :: start loop - |= {lac/? ovo/ovum} + |= {lac/_| ovo/ovum} ~? &(!lac !=(%belt -.q.ovo)) ["" %unix -.q.ovo p.ovo now] :: ^- {p/(list ovum) q/(pair worm (list {p/@tas q/vase}))} ^- {p/(list ovum) q=(list [label=@tas =vane])} @@ -755,6 +755,7 @@ :: In either case, they fall through here to be handled :: after the fact in +feck. :: + ~& %arvo-poke^-.q.ovo^p.ovo ?: ?=(?(%veer %verb %wack %warn) -.q.ovo) [[ovo ~] +>.$] :: diff --git a/pkg/arvo/sys/hoon.hoon b/pkg/arvo/sys/hoon.hoon index 6eaf61d46a..dd88b8d2d7 100644 --- a/pkg/arvo/sys/hoon.hoon +++ b/pkg/arvo/sys/hoon.hoon @@ -14886,7 +14886,7 @@ ^= gen ^- hoon [%cnsg [%$ ~] [%$ 2] [%$ 3] ~] =+ gun=(~(mint ut typ) %noun gen) - [p.gun .*([q.gat q.sam] q.gun)] + [p.gun (slum q.gat q.sam)] :: ++ slab :: test if contains |= {cog/@tas typ/type} @@ -17268,36 +17268,49 @@ ~> %slog.[0 foo] [| +>+<.$] [& +>+<.$(nes (~(put in nes) [sut ref]))] + :: +play: +play:ut, cached :: - ++ play :: play:ut + ++ play |= {sut/type gen/hoon} ^- {type worm} =+ old=(~(get by pay) [sut gen]) ?^ old [u.old +>+<.$] =+ new=(~(play ut sut) gen) [new +>+<.$(pay (~(put by pay) [sut gen] new))] + :: +mint: +mint:ut to noun, cached :: - ++ mint :: mint:ut to noun + ++ mint |= {sut/type gen/hoon} ^- {(pair type nock) worm} =+ old=(~(get by mit) [sut gen]) ?^ old [u.old +>+<.$] =+ new=(~(mint ut sut) %noun gen) [new +>+<.$(mit (~(put by mit) [sut gen] new))] + :: +slam: +slam:ut, cached :: - ++ slap :: ++slap, cached + ++ slam + |= [gat=vase sam=vase] + =/ sut=type [%cell p.gat p.sam] + =/ gen=hoon [%cnsg [%$ ~] [%$ 2] [%$ 3] ~] + =^ new=type +>+<.$ (play sut gen) + [[new (slum q.gat q.sam)] +>+<.$] + :: +slap: +slap:ut, cached + :: + ++ slap |= {vax/vase gen/hoon} ^- {vase worm} =^ gun +>+< (mint p.vax gen) [[p.gun .*(q.vax q.gun)] +>+<.$] + :: +slot: +slot:ut, cached :: - ++ slot :: ++slot, cached + ++ slot |= {axe/@ vax/vase} ^- {vase worm} =^ gun +>+< (mint p.vax [%$ axe]) [[p.gun .*(q.vax [0 axe])] +>+<.$] + :: +slym: +slym:ut, cached :: - ++ slym :: ++slym, cached + ++ slym |= {gat/vase sam/*} ^- [vase worm] (slap gat(+<.q sam) [%limb %$]) From 39ae901c7b7717ba15c9d96804d4a278dde6e105 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 23 Jul 2019 14:36:01 -0700 Subject: [PATCH 020/151] wip moar prints --- pkg/arvo/sys/arvo.hoon | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 4 ++-- pkg/arvo/sys/vane/behn.hoon | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index cbb74c780d..8be9845cf9 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -467,7 +467,7 @@ == :: ++ hurl :: start loop - |= {lac/_| ovo/ovum} + |= {lac/? ovo/ovum} ~? &(!lac !=(%belt -.q.ovo)) ["" %unix -.q.ovo p.ovo now] :: ^- {p/(list ovum) q/(pair worm (list {p/@tas q/vase}))} ^- {p/(list ovum) q=(list [label=@tas =vane])} @@ -650,7 +650,7 @@ :: =/ pit=vase !>(..is) :: =/ vil=vile (viol p.pit) :: cached reflexives -=| $: lac=_& :: laconic bit +=| $: lac=_| :: laconic bit eny=@ :: entropy our=ship :: identity bud=vase :: %zuse diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index f02159f6c5..dd313f363d 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -841,11 +841,11 @@ =< abet ?- -.task %born on-born:event-core - %crud ~| %ames-crud^p.task + %crud ~& %ames-crud^p.task %- (slog q.task) event-core %hear (on-hear:event-core [lane blob]:task) - %hole ~| %ames-hole + %hole ~& %ames-hole event-core %init (on-init:event-core ship=p.task) %vega on-vega:event-core diff --git a/pkg/arvo/sys/vane/behn.hoon b/pkg/arvo/sys/vane/behn.hoon index 2dba6d5012..9f9fc6f2fa 100644 --- a/pkg/arvo/sys/vane/behn.hoon +++ b/pkg/arvo/sys/vane/behn.hoon @@ -63,6 +63,8 @@ :: ?: =(~ timers.state) ~| %behn-crud-no-timer^tag^error !! :: + ~& %behn-crud-tag^tag + %- (slog error) (wake `error) :: +rest: cancel the timer at :date, then adjust unix wakeup :: +wait: set a new timer at :date, then adjust unix wakeup From 3f9148ac4c83730135c1b2afb8d3c948a690cb3d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 23 Jul 2019 16:20:21 -0700 Subject: [PATCH 021/151] alef boot better and kill direct routes better; still has bug in +send-blob --- pkg/arvo/sys/vane/alef.hoon | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index dd313f363d..476c2c07be 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1084,9 +1084,11 @@ =/ ship-state (~(get by peers.ames-state) ship) :: ?. ?=([~ %known *] ship-state) + ~& %alef-on-memo-enqueue-alien %+ enqueue-alien-todo ship |= todos=pending-requests todos(snd-messages [[duct message] snd-messages.todos]) + ~& %alef-on-memo-known :: =/ =peer-state +.u.ship-state =/ =channel [[our ship] now +>.ames-state -.peer-state] @@ -1115,8 +1117,8 @@ |= our=ship ^+ event-core :: - =~ (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) - (emit duct %pass /private-keys %k %private-keys ~) + =~ (emit duct %pass /private-keys %k %private-keys ~) + (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) (emit duct %pass /turf %k %turf ~) == :: +on-priv: set our private key to jael's response @@ -1248,6 +1250,7 @@ ++ meet-alien |= [=ship =point todos=pending-requests] ^+ event-core + ~& %alef-meet-alien^ship :: =/ =public-key pass:(~(got by keys.point) life.point) =. event-core @@ -1407,26 +1410,34 @@ =/ ship-state (~(get by peers.ames-state) ship) :: ?. ?=([~ %known *] ship-state) + ~& %alef-send-blob-alien %+ enqueue-alien-todo ship |= todos=pending-requests todos(snd-packets (~(put in snd-packets.todos) blob)) + ~& %alef-send-blob-known :: =/ =peer-state +.u.ship-state =/ =channel [[our ship] now +>.ames-state -.peer-state] :: =* try-next-sponsor ?: =(ship her-sponsor.channel) + ~& %alef-send-blob-ship-eq-her-sponsor event-core + ~& %alef-send-blob-try-next-recurse $(ship her-sponsor.channel) :: ?~ route=route.peer-state + ~& %alef-send-blob-no-route try-next-sponsor :: + ~& %alef-send-blob-emit-to^ship =. event-core (emit unix-duct.ames-state %give %send lane.u.route blob) :: ?: direct.u.route + ~& %alef-send-blob-direct-done event-core + ~& %alef-send-blob-indirect-try-next try-next-sponsor :: +got-peer-state: lookup .her state or crash :: @@ -1486,7 +1497,9 @@ :: transport address has changed and this lane is no longer :: valid. :: - =. route.peer-state `[direct=%.n lane:(need route.peer-state)] + =? route.peer-state + &(?=(^ route.peer-state) direct.u.route.peer-state) + route.peer-state(direct.u %.n) :: (run-message-pump bone %wake ~) :: +run-message-pump: process $message-pump-task and its effects @@ -1510,6 +1523,7 @@ |^ ^+ peer-core ?~ pump-gifts peer-core =* gift i.pump-gifts + ~& %alef-on-pump-gift^-.gift =. peer-core ?- -.gift %done (on-pump-done [message-num ok]:gift) @@ -1552,7 +1566,7 @@ =. nax.peer-state (~(put in nax.peer-state) nax-key) :: peer-core - :: +on-pump-send: emit ack packet requested by |message-pump + :: +on-pump-send: emit message fragment requested by |message-pump :: ++ on-pump-send |= =static-fragment @@ -1975,9 +1989,11 @@ ++ feed |= fragments=(list static-fragment) ^+ [fragments gifts state] + ~& %alef-feed^(lent fragments) :: return unsent back to caller and reverse effects to finalize :: - =- [unsent (flop gifts) state] + =- ~& %alef-feed-unsent^(lent unsent) + [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] :: resend lost packets first, possibly adjusting congestion control @@ -2462,6 +2478,8 @@ |= [=public-key =private-key] ^- symmetric-key :: + ~| [public-key=public-key private-key=private-key] + :: ?> =('b' (end 3 1 public-key)) =. public-key (rsh 8 1 (rsh 3 1 public-key)) :: From 22c26414c11b70d0686013173a61b9130e5532c6 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 23 Jul 2019 16:55:35 -0700 Subject: [PATCH 022/151] more fixes to routing and sending --- pkg/arvo/sys/vane/alef.hoon | 40 +++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 476c2c07be..8c889b337b 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -804,16 +804,26 @@ :: TODO: don't coerce the old state :: ++ scry scry:adult-core - ++ stay ~& %alef-larva-stay [queued-events ames-state.adult-gate] + ++ stay ~& %alef-larva-stay [%larva queued-events ames-state.adult-gate] ++ load - |= old=* - ^+ larval-gate + |= old-raw=* ~& %alef-larva-load - => .(old ;;(_[queued-events ames-state.adult-gate] old)) :: - =. queued-events -.old - =. adult-gate (load:adult-core +.old) - larval-gate + =/ old + ;; $% [%larva events=_queued-events state=_ames-state.adult-gate] + [%adult state=_ames-state.adult-gate] + == + old-raw + :: + ?- -.old + %adult + (load:adult-core state.old) + :: + %larva + =. queued-events events.old + =. adult-gate (load:adult-core state.old) + larval-gate + == -- :: adult ames, after metamorphosis from larva :: @@ -833,6 +843,7 @@ =/ =task ?. ?=(%soft -.wrapped-task) wrapped-task + ~| %alef-bad-task^p.wrapped-task ;;(task p.wrapped-task) :: =/ event-core (per-event [our now eny scry-gate] duct ames-state) @@ -878,12 +889,12 @@ [moves ames-gate] :: +stay: extract state before reload :: -++ stay ames-state +++ stay [%adult ames-state] :: +load: load in old state after reload :: ++ load - |= old=^ames-state - ames-gate(ames-state old) + |= old-state=_ames-state + ames-gate(ames-state old-state) :: +scry: dereference namespace :: ++ scry @@ -1328,6 +1339,10 @@ =. life.peer-state life =. public-key.peer-state public-key =. symmetric-key.peer-state symmetric-key + :: automatically set galaxy route, since unix handles lookup + :: + =? route.peer-state ?=(%czar (clan:title ship)) + `[direct=%.y lane=[%& ship]] :: =. peers.ames-state (~(put by peers.ames-state) ship %known peer-state) @@ -1498,7 +1513,10 @@ :: valid. :: =? route.peer-state - &(?=(^ route.peer-state) direct.u.route.peer-state) + ?& ?=(^ route.peer-state) + direct.u.route.peer-state + !=(%czar (clan:title her.channel)) + == route.peer-state(direct.u %.n) :: (run-message-pump bone %wake ~) From bccfb2a94bb42f37dbf4a201b9d051344bda27ad Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 23 Jul 2019 17:31:35 -0700 Subject: [PATCH 023/151] fix vere lane recv --- pkg/urbit/vere/ames.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 24d519e83a..f1c2809d24 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -375,7 +375,7 @@ _ames_recv_cb(uv_udp_t* wax_u, u3_pier_plan (u3nt(u3_blip, c3__ames, u3_nul), - u3nt(c3__hear, lan, msg)); + u3nt(c3__hear, u3nc(c3n, lan), msg)); #endif } _ames_free(buf_u->base); From 05f65a454cc334633a8f3c84d4888b1e716a75dc Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 23 Jul 2019 17:31:51 -0700 Subject: [PATCH 024/151] filter out packets to self --- pkg/arvo/sys/vane/alef.hoon | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 8c889b337b..d01fb9b84b 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -954,13 +954,20 @@ |= [=lane =packet] ^+ event-core :: + ?: =(our sndr.packet) + ~& %alef-self + event-core + :: %. [lane packet] :: ?. =(our rcvr.packet) + ~& %alef-on-hear-forward on-hear-forward :: ?: encrypted.packet + ~& %alef-on-hear-shut on-hear-shut + ~& %alef-on-hear-open on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: @@ -1425,34 +1432,26 @@ =/ ship-state (~(get by peers.ames-state) ship) :: ?. ?=([~ %known *] ship-state) - ~& %alef-send-blob-alien %+ enqueue-alien-todo ship |= todos=pending-requests todos(snd-packets (~(put in snd-packets.todos) blob)) - ~& %alef-send-blob-known :: =/ =peer-state +.u.ship-state =/ =channel [[our ship] now +>.ames-state -.peer-state] :: =* try-next-sponsor ?: =(ship her-sponsor.channel) - ~& %alef-send-blob-ship-eq-her-sponsor event-core - ~& %alef-send-blob-try-next-recurse $(ship her-sponsor.channel) :: ?~ route=route.peer-state - ~& %alef-send-blob-no-route try-next-sponsor :: - ~& %alef-send-blob-emit-to^ship =. event-core (emit unix-duct.ames-state %give %send lane.u.route blob) :: ?: direct.u.route - ~& %alef-send-blob-direct-done event-core - ~& %alef-send-blob-indirect-try-next try-next-sponsor :: +got-peer-state: lookup .her state or crash :: From f09d7a4d7cd32b37332fdc63987221a1c706304b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 24 Jul 2019 15:55:43 -0700 Subject: [PATCH 025/151] ames.c now works; fixed multiple bugs with help from @joemfb --- pkg/urbit/vere/ames.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index f1c2809d24..96f9a796a4 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -88,7 +88,6 @@ _ames_send(u3_pact* pac_u) add_u.sin_port = htons(pac_u->por_s); uv_buf_t buf_u = uv_buf_init((c3_c*)pac_u->hun_y, pac_u->len_w); - c3_i sas_i; if ( 0 != (sas_i = uv_udp_send(&pac_u->snd_u, @@ -197,6 +196,8 @@ u3_ames_decode_lane(u3_atom lan) { u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); + c3_assert( _(u3a_is_cat(por)) ); + c3_assert( por < 65536 ); lan_u.por_s = por; u3z(pip); u3z(por); @@ -308,6 +309,8 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) pac_u->len_w = u3r_met(3, pac); pac_u->hun_y = c3_malloc(pac_u->len_w); + u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac); + u3_noun tag, val; u3x_cell(lan, &tag, &val); c3_assert( (c3y == tag) || (c3n == tag) ); @@ -317,7 +320,8 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) if ( c3y == tag ) { c3_assert( c3y == u3a_is_cat(val) ); c3_assert( val < 256 ); - + + pac_u->imp_y = val; _ames_czar(pac_u, sam_u->dns_c); } // non-galaxy lane @@ -372,10 +376,9 @@ _ames_recv_cb(uv_udp_t* wax_u, lan_u.por_s = ntohs(add_u->sin_port); lan_u.pip_w = ntohl(add_u->sin_addr.s_addr); u3_noun lan = u3_ames_encode_lane(lan_u); + u3_noun mov = u3nt(c3__hear, u3nc(c3n, lan), msg); - u3_pier_plan - (u3nt(u3_blip, c3__ames, u3_nul), - u3nt(c3__hear, u3nc(c3n, lan), msg)); + u3_pier_plan(u3nt(u3_blip, c3__ames, u3_nul), mov); #endif } _ames_free(buf_u->base); @@ -563,6 +566,7 @@ u3_ames_io_init(u3_pier* pir_u) void u3_ames_io_talk(u3_pier* pir_u) { + _ames_io_start(pir_u); } /* u3_ames_io_exit(): terminate ames I/O. From 221ae19b58b074d15c9b4334cf3cff9b461f5efb Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 24 Jul 2019 15:56:13 -0700 Subject: [PATCH 026/151] todo on alef born --- pkg/arvo/sys/vane/alef.hoon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index d01fb9b84b..cc225157cd 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1378,9 +1378,12 @@ dot+&+ames-state == :: +on-born: handle unix process restart - :: +on-vega: handle kernel reload + :: + :: TODO: scry into jael and emit turf on %born :: ++ on-born event-core(unix-duct.ames-state duct) + :: +on-vega: handle kernel reload + :: ++ on-vega event-core :: +enqueue-alien-todo: helper to enqueue a pending request :: From c7c0c6334f703c06b97846951cf786af340b61a5 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 24 Jul 2019 18:01:01 -0700 Subject: [PATCH 027/151] serial experiments lane; fixed some bugs but still bail:fouls --- pkg/urbit/include/vere/vere.h | 1 - pkg/urbit/vere/ames.c | 25 +++++++------------------ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/pkg/urbit/include/vere/vere.h b/pkg/urbit/include/vere/vere.h index dd40067b11..953669ee18 100644 --- a/pkg/urbit/include/vere/vere.h +++ b/pkg/urbit/include/vere/vere.h @@ -337,7 +337,6 @@ uv_udp_t wax_u; uv_handle_t had_u; }; - uv_timer_t tim_u; // XX temporary timer c3_o liv; // listener on c3_o alm; // alarm on c3_s por_s; // public IPv4 port diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 96f9a796a4..5bee06610c 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -190,17 +190,20 @@ u3_lane u3_ames_decode_lane(u3_atom lan) { u3_noun cud, tag, pip, por; + c3_assert( _(u3a_is_atom(lan)) ); + u3m_p("to-cue", lan); cud = u3ke_cue(lan); u3x_trel(cud, &tag, &pip, &por); c3_assert( c3__ipv4 == tag ); u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); + u3z(pip); + c3_assert( _(u3a_is_cat(por)) ); c3_assert( por < 65536 ); lan_u.por_s = por; - u3z(pip); u3z(por); return lan_u; } @@ -311,6 +314,8 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac); + u3m_p("lan", lan); + u3_noun tag, val; u3x_cell(lan, &tag, &val); c3_assert( (c3y == tag) || (c3n == tag) ); @@ -327,7 +332,7 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) // non-galaxy lane // else { - u3_lane lan_u = u3_ames_decode_lane(lan); + u3_lane lan_u = u3_ames_decode_lane(val); // convert incoming localhost to outgoing localhost // lan_u.pip_w = ( 0 == lan_u.pip_w )? 0x7f000001 : lan_u.pip_w; @@ -345,7 +350,6 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) _ames_send(pac_u); } } - u3z(tag); u3z(val); } /* _ames_recv_cb(): receive callback. @@ -385,15 +389,6 @@ _ames_recv_cb(uv_udp_t* wax_u, } } -/* _ames_timer_cb(): wake up ames -*/ -static void -_ames_timer_cb(uv_timer_t* tim_u) -{ - u3_pier_plan(u3nt(u3_blip, c3__ames, u3_nul), - u3nc(c3__wake, u3_nul)); -} - /* _ames_io_start(): initialize ames I/O. */ static void @@ -463,8 +458,6 @@ _ames_io_start(u3_pier* pir_u) sam_u->liv = c3y; u3z(rac); u3z(who); - - uv_timer_start(&sam_u->tim_u, _ames_timer_cb, 300 * 1000, 300 * 1000); } /* _cttp_mcut_char(): measure/cut character. @@ -557,8 +550,6 @@ u3_ames_io_init(u3_pier* pir_u) { u3_ames* sam_u = pir_u->sam_u; sam_u->liv = c3n; - - uv_timer_init(u3L, &sam_u->tim_u); } /* u3_ames_io_talk(): start receiving ames traffic. @@ -580,6 +571,4 @@ u3_ames_io_exit(u3_pier* pir_u) // XX remove had_u/wax_u union, cast and close wax_u uv_close(&sam_u->had_u, 0); } - - uv_close((uv_handle_t*)&sam_u->tim_u, 0); } From de9ff11560ab72f3857b19e3647a5e1d322ed947 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 25 Jul 2019 14:50:08 -0700 Subject: [PATCH 028/151] |hi ~nec successful --- pkg/arvo/sys/vane/alef.hoon | 29 ++++++++++++++++++++++++----- pkg/arvo/sys/vane/gall.hoon | 5 ++++- pkg/urbit/tests/ames_tests.c | 4 +++- pkg/urbit/vere/ames.c | 6 +++++- pkg/urbit/vere/reck.c | 3 +++ 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index cc225157cd..5fefce8555 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -856,8 +856,7 @@ %- (slog q.task) event-core %hear (on-hear:event-core [lane blob]:task) - %hole ~& %ames-hole - event-core + %hole (on-hole:event-core [lane blob]:task) %init (on-init:event-core ship=p.task) %vega on-vega:event-core %wegh on-wegh:event-core @@ -912,7 +911,12 @@ |% ++ event-core . ++ abet [(flop moves) ames-state] - ++ emit |=(=move event-core(moves [move moves])) + :: TODO reenable after debug + ::++ emit |=(=move event-core(moves [move moves])) + ++ emit + |= =move + ~& %alef-emit^move + event-core(moves [move moves]) :: +on-take-done: handle notice from vane that it processed a message :: ++ on-take-done @@ -948,6 +952,16 @@ ^+ event-core :: (on-hear-packet lane (decode-packet blob)) + :: +on-hole: handle packet crash notification + :: + :: TODO: retry processing and nack if possible + :: + ++ on-hole + |= [=lane =blob] + ^+ event-core + :: + ~& %ames-hole + event-core :: +on-hear-packet: handle mildly processed packet receipt :: ++ on-hear-packet @@ -1077,6 +1091,9 @@ ?> =(rcvr-life.shut-packet our-life.channel) :: set .lane as new route to peer since packet is valid :: + :: TODO: enable (only disabled for testing) + ::=? route.peer-state !=(%czar (clan:title her.channel)) + :: `[direct=%.y lane] =. route.peer-state `[direct=%.y lane] :: =/ peer-core (make-peer-core peer-state channel) @@ -1659,8 +1676,10 @@ ++ on-still-memo |= [=message-num =message] ^+ peer-core + :: pop first element off .path.message as .target-vane :: - ?> ?=([?(%a %c %g %k) *] path.message) + =^ target-vane path.message + ?>(?=([?(%a %c %g %k) *] path.message) path.message) :: odd .bone; "request" message to pass to vane before acking :: ?: =(1 (end 0 1 bone)) @@ -1673,7 +1692,7 @@ =^ client-duct ossuary.peer-state (get-duct ossuary.peer-state bone duct) :: - ?- i.path.message + ?- target-vane %a ~| %bad-ames-message^path.message^her.channel !! %c (emit client-duct %pass wire %c %memo her.channel message) %g (emit client-duct %pass wire %g %memo her.channel message) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 7f9c740f8a..2f2f9bcf88 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -484,8 +484,9 @@ :: ++ mo-gawk :: ames forward |= {him/@p dap/dude num/@ud rok/rook} - =. +> ?.(?=($u -.rok) +> (mo-give %done ~)) + =? +> ?=(%u -.rok) (mo-give %done ~) %+ mo-pass + =- ~& %gall-pass^- - [%sys %req (scot %p him) dap (scot %ud num) ~] ^- note-arvo ?- -.rok @@ -1290,11 +1291,13 @@ [~ ..^$(sys.mast.all hen)] :: %memo + ~& %gall-memo-path^path.message.q.hic ?> ?=([%ge @ ~] path.message.q.hic) =/ him=ship ship.q.hic =* dap i.t.path.message.q.hic :: =+ mes=;;([@ud rook] payload.message.q.hic) + ~& %gall-memo-coerced =< mo-abet (mo-gawk:(mo-abed:mo hen) him dap mes) :: diff --git a/pkg/urbit/tests/ames_tests.c b/pkg/urbit/tests/ames_tests.c index a8cdafc662..8fecb209de 100644 --- a/pkg/urbit/tests/ames_tests.c +++ b/pkg/urbit/tests/ames_tests.c @@ -19,7 +19,9 @@ _test_ames(void) lan_u.pip_w = 0x7f000001; lan_u.por_s = 12345; - u3_lane nal_u = u3_ames_decode_lane(u3_ames_encode_lane(lan_u)); + u3_noun lan = u3_ames_encode_lane(lan_u); + u3_lane nal_u = u3_ames_decode_lane(u3k(lan)); + u3_lane nal_u2 = u3_ames_decode_lane(lan); if ( !(lan_u.pip_w == nal_u.pip_w && lan_u.por_s == nal_u.por_s) ) { fprintf(stderr, "ames: lane fail (a)\r\n"); diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 5bee06610c..9213449bd1 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -191,6 +191,7 @@ u3_ames_decode_lane(u3_atom lan) { u3_noun cud, tag, pip, por; c3_assert( _(u3a_is_atom(lan)) ); + u3l_log("refcount %d\n", u3a_use(lan)); u3m_p("to-cue", lan); cud = u3ke_cue(lan); u3x_trel(cud, &tag, &pip, &por); @@ -198,6 +199,7 @@ u3_ames_decode_lane(u3_atom lan) { u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); + u3l_log("pip_w %ull\n", lan_u.pip_w); u3z(pip); c3_assert( _(u3a_is_cat(por)) ); @@ -315,6 +317,7 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac); u3m_p("lan", lan); + u3l_log("lan-ref %d\n", u3a_use(lan)); u3_noun tag, val; u3x_cell(lan, &tag, &val); @@ -332,7 +335,8 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) // non-galaxy lane // else { - u3_lane lan_u = u3_ames_decode_lane(val); + u3l_log("val-ref %d\n", u3a_use(val)); + u3_lane lan_u = u3_ames_decode_lane(u3k(val)); // convert incoming localhost to outgoing localhost // lan_u.pip_w = ( 0 == lan_u.pip_w )? 0x7f000001 : lan_u.pip_w; diff --git a/pkg/urbit/vere/reck.c b/pkg/urbit/vere/reck.c index 74556acd6d..7b5c3ecca7 100644 --- a/pkg/urbit/vere/reck.c +++ b/pkg/urbit/vere/reck.c @@ -200,6 +200,9 @@ _reck_kick_newt(u3_pier* pir_u, u3_noun pox, u3_noun fav) default: break; case c3__send: { + u3m_p("fav", fav); + u3l_log("fav-ref %d\n", u3a_use(fav)); + u3_noun lan = u3k(u3h(u3t(fav))); u3_noun pac = u3k(u3t(u3t(fav))); From 1f1c75ccb07183fbc3956d41af278bbd62542996 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 25 Jul 2019 15:56:33 -0700 Subject: [PATCH 029/151] Cleanup, remove printfs --- pkg/arvo/sys/arvo.hoon | 3 +-- pkg/arvo/sys/vane/alef.hoon | 16 +++++----------- pkg/urbit/vere/ames.c | 8 -------- pkg/urbit/vere/reck.c | 3 --- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 8be9845cf9..340f472dbc 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -650,7 +650,7 @@ :: =/ pit=vase !>(..is) :: =/ vil=vile (viol p.pit) :: cached reflexives -=| $: lac=_| :: laconic bit +=| $: lac=_& :: laconic bit eny=@ :: entropy our=ship :: identity bud=vase :: %zuse @@ -755,7 +755,6 @@ :: In either case, they fall through here to be handled :: after the fact in +feck. :: - ~& %arvo-poke^-.q.ovo^p.ovo ?: ?=(?(%veer %verb %wack %warn) -.q.ovo) [[ovo ~] +>.$] :: diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 5fefce8555..987b278e9b 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -911,12 +911,7 @@ |% ++ event-core . ++ abet [(flop moves) ames-state] - :: TODO reenable after debug - ::++ emit |=(=move event-core(moves [move moves])) - ++ emit - |= =move - ~& %alef-emit^move - event-core(moves [move moves]) + ++ emit |=(=move event-core(moves [move moves])) :: +on-take-done: handle notice from vane that it processed a message :: ++ on-take-done @@ -1091,10 +1086,8 @@ ?> =(rcvr-life.shut-packet our-life.channel) :: set .lane as new route to peer since packet is valid :: - :: TODO: enable (only disabled for testing) - ::=? route.peer-state !=(%czar (clan:title her.channel)) - :: `[direct=%.y lane] - =. route.peer-state `[direct=%.y lane] + =? route.peer-state !=(%czar (clan:title her.channel)) + `[direct=%.y lane] :: =/ peer-core (make-peer-core peer-state channel) abet:(on-hear-shut-packet:peer-core lane shut-packet) @@ -1522,7 +1515,8 @@ :: TODO: handle error :: ?^ error - !! + ~| %ames-wake-error + (mean u.error) :: expire direct route :: :: Since a packet's timer expired, mark the .lane.route as diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 9213449bd1..1156cb67b9 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -190,16 +190,12 @@ u3_lane u3_ames_decode_lane(u3_atom lan) { u3_noun cud, tag, pip, por; - c3_assert( _(u3a_is_atom(lan)) ); - u3l_log("refcount %d\n", u3a_use(lan)); - u3m_p("to-cue", lan); cud = u3ke_cue(lan); u3x_trel(cud, &tag, &pip, &por); c3_assert( c3__ipv4 == tag ); u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); - u3l_log("pip_w %ull\n", lan_u.pip_w); u3z(pip); c3_assert( _(u3a_is_cat(por)) ); @@ -316,9 +312,6 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) u3r_bytes(0, pac_u->len_w, pac_u->hun_y, pac); - u3m_p("lan", lan); - u3l_log("lan-ref %d\n", u3a_use(lan)); - u3_noun tag, val; u3x_cell(lan, &tag, &val); c3_assert( (c3y == tag) || (c3n == tag) ); @@ -335,7 +328,6 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) // non-galaxy lane // else { - u3l_log("val-ref %d\n", u3a_use(val)); u3_lane lan_u = u3_ames_decode_lane(u3k(val)); // convert incoming localhost to outgoing localhost // diff --git a/pkg/urbit/vere/reck.c b/pkg/urbit/vere/reck.c index 7b5c3ecca7..74556acd6d 100644 --- a/pkg/urbit/vere/reck.c +++ b/pkg/urbit/vere/reck.c @@ -200,9 +200,6 @@ _reck_kick_newt(u3_pier* pir_u, u3_noun pox, u3_noun fav) default: break; case c3__send: { - u3m_p("fav", fav); - u3l_log("fav-ref %d\n", u3a_use(fav)); - u3_noun lan = u3k(u3h(u3t(fav))); u3_noun pac = u3k(u3t(u3t(fav))); From fdb20a7528b8de2b25984cac0981c8f7c5dded65 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 28 Jul 2019 00:50:32 -0700 Subject: [PATCH 030/151] %plea and %boon; might not compile --- pkg/arvo/sys/vane/alef.hoon | 254 +++++++++++++++++++++--------------- pkg/arvo/sys/zuse.hoon | 42 +++--- 2 files changed, 167 insertions(+), 129 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 987b278e9b..210e59485f 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -301,6 +301,7 @@ +$ bone @udbone +$ fragment @uwfragment +$ fragment-num @udfragmentnum ++$ message-blob @udmessageblob +$ message-num @udmessagenum +$ private-key @uwprivatekey +$ public-key @uwpublickey @@ -410,11 +411,12 @@ :: $pending-requests: what to do when we learn a peer's life and keys :: :: rcv-packets: packets we've received from unix -:: snd-messages: messages local vanes have asked us to send +:: snd-messages: pleas local vanes have asked us to send +:: snd-packets: packets we've tried to send :: +$ pending-requests $: rcv-packets=(list [=lane =packet]) - snd-messages=(list [=duct =message]) + snd-messages=(list [=duct =plea]) snd-packets=(set =blob) == :: $peer-state: state for a peer with known life and keys @@ -511,7 +513,7 @@ +$ message-pump-state $: current=_`message-num`1 next=_`message-num`1 - unsent-messages=(qeu message) + unsent-messages=(qeu message-blob) unsent-fragments=(list static-fragment) queued-message-acks=(map message-num ok=?) =packet-pump-state @@ -572,7 +574,7 @@ +$ message-still-state $: last-acked=message-num last-heard=message-num - pending-vane-ack=(qeu [=message-num =message]) + pending-vane-ack=(qeu [=message-num message=*]) live-messages=(map message-num partial-rcv-message) nax=(set message-num) == @@ -603,11 +605,11 @@ :: :: TODO: specialize gall interface for subscription management :: -:: Ames passes a %memo note to another vane when it receives a +:: Ames passes a %plea note to another vane when it receives a :: message on a "forward flow" from a peer, originally passed from :: one of the peer's vanes to the peer's Ames. :: -:: Ames passes a %memo to itself to trigger a heartbeat message to +:: Ames passes a %plea to itself to trigger a heartbeat message to :: our sponsor. :: :: Ames passes a %private-keys to Jael to request our private keys. @@ -626,11 +628,11 @@ [%turf ~] == == $: @tas - $% [%memo =ship =message] + $% [%plea =ship =plea] == == == :: $sign: response from other vane :: -:: A vane gives a %memo sign to Ames on a duct on which it had +:: A vane gives a %boon sign to Ames on a duct on which it had :: previously received a message on a "forward flow". Ames will :: transmit the message to the peer that had originally sent the :: message on the forward flow. The peer's Ames will then give the @@ -653,7 +655,7 @@ == == $: @tas $% [%done error=(unit error)] - [%memo =message] + [%boon payload=*] == == == :: $message-pump-task: job for |message-pump :: @@ -662,7 +664,7 @@ :: %wake: handle timer firing :: +$ message-pump-task - $% [%memo =message] + $% [%memo =message-blob] [%hear =message-num =ack-meat] [%wake ~] == @@ -716,12 +718,11 @@ == :: $message-still-gift: effect from |message-still :: -:: %memo: $message assembled from received packets, -:: to be sent to a local vane for processing +:: %memo: assembled from received packets :: %send: emit an ack packet :: +$ message-still-gift - $% [%memo =message-num =message] + $% [%memo =message-num message=*] [%send =message-num =ack-meat] == -- @@ -860,7 +861,7 @@ %init (on-init:event-core ship=p.task) %vega on-vega:event-core %wegh on-wegh:event-core - %memo (on-memo:event-core [ship message]:task) + %plea (on-plea:event-core [ship plea]:task) == :: [moves ames-gate] @@ -876,7 +877,7 @@ =< abet ?- sign [@ %done *] (on-take-done:event-core wire error.sign) - [@ %memo *] (on-take-memo:event-core wire message.sign) + [@ %boon *] (on-take-boon:event-core wire payload.sign) :: [%b %wake *] (on-take-wake:event-core wire error.sign) :: @@ -925,21 +926,24 @@ :: =/ =peer-state (got-peer-state her) =/ =channel [[our her] now +>.ames-state -.peer-state] - =/ peer-core (make-peer-core peer-state channel) - =/ ok=? ?=(~ error) - :: send message (n)ack packet + :: if processing succeded, send positive ack packet and exit :: - =. event-core abet:(run-message-still:peer-core bone %done ok) - :: if positive ack, we're done + ?~ error + =/ peer-core (make-peer-core peer-state channel) + abet:(run-message-still:peer-core bone %done ok=%.y) + :: failed; send message nack packet :: - ?: ok - event-core - :: send nack-trace message on designated bone + =. event-core abet:(run-message-still:peer-core bone %done ok=%.n) + :: construct nack-trace message, referencing .failed $message-num :: + =/ failed=message-num last-acked:(~(got by rcv.peer-state) bone) + =/ =message-blob (jam [failed u.error]) + :: send nack-trace message on associated .nack-trace-bone + :: + =/ peer-core (make-peer-core peer-state channel) =/ nack-trace-bone=^bone (mix 0b10 bone) - =. peer-core (make-peer-core peer-state channel) :: - abet:(run-message-pump:peer-core nack-trace-bone %memo /a/nax error) + abet:(run-message-pump:peer-core nack-trace-bone %boon message-blob) :: +on-hear: handle raw packet receipt :: ++ on-hear @@ -967,7 +971,7 @@ ~& %alef-self event-core :: - %. [lane packet] + %. +< :: ?. =(our rcvr.packet) ~& %alef-on-hear-forward @@ -1091,10 +1095,10 @@ :: =/ peer-core (make-peer-core peer-state channel) abet:(on-hear-shut-packet:peer-core lane shut-packet) - :: +on-take-memo: receive request to give message to peer + :: +on-take-boon: receive request to give message to peer :: - ++ on-take-memo - |= [=wire =message] + ++ on-take-boon + |= [=wire payload=*] ^+ event-core :: =+ ^- [her=ship =bone] (parse-bone-wire wire) @@ -1102,28 +1106,26 @@ =/ =peer-state (got-peer-state her) =/ =channel [[our her] now +>.ames-state -.peer-state] :: - abet:(on-memo:(make-peer-core peer-state channel) bone message) - :: +on-memo: handle request to send message + abet:(on-memo:(make-peer-core peer-state channel) bone payload) + :: +on-plea: handle request to send message :: - ++ on-memo - |= [=ship =message] + ++ on-plea + |= [=ship =plea] ^+ event-core :: =/ ship-state (~(get by peers.ames-state) ship) :: ?. ?=([~ %known *] ship-state) - ~& %alef-on-memo-enqueue-alien %+ enqueue-alien-todo ship |= todos=pending-requests - todos(snd-messages [[duct message] snd-messages.todos]) - ~& %alef-on-memo-known + todos(snd-messages [[duct plea] snd-messages.todos]) :: =/ =peer-state +.u.ship-state =/ =channel [[our ship] now +>.ames-state -.peer-state] :: =^ =bone ossuary.peer-state (get-bone ossuary.peer-state duct) :: - abet:(on-memo:(make-peer-core peer-state channel) bone message) + abet:(on-memo:(make-peer-core peer-state channel) bone plea) :: +on-take-wake: receive wakeup or error notification from behn :: ++ on-take-wake @@ -1431,7 +1433,7 @@ ++ ping-sponsor ^+ event-core :: - (emit duct %pass /ping %a %memo sponsor.ames-state /a/ping ~) + (emit duct %pass /ping %a %plea sponsor.ames-state /ping ~) :: +send-blob: fire packet at .ship and maybe sponsors :: :: Send to .ship and sponsors until we find a direct lane. @@ -1503,10 +1505,11 @@ :: +on-memo: handle request to send message :: ++ on-memo - |= [=bone =message] + |= [=bone payload=*] ^+ peer-core :: - (run-message-pump bone %memo message) + =/ =message-blob (jam payload) + (run-message-pump bone %memo message-blob) :: +on-wake: handle timer expiration :: ++ on-wake @@ -1533,6 +1536,21 @@ route.peer-state(direct.u %.n) :: (run-message-pump bone %wake ~) + :: +send-shut-packet: fire encrypted packet at rcvr and maybe sponsors + :: + ++ send-shut-packet + |= =shut-packet + ^+ peer-core + :: swizzle bone just before sending; TODO document + :: + =. bone.shut-packet (mix 1 bone.shut-packet) + :: + =/ content (encrypt symmetric-key.channel shut-packet) + =/ =packet [[our her.channel] encrypted=%.y origin=~ content] + =/ =blob (encode-packet packet) + :: + =. event-core (send-blob her.channel blob) + peer-core :: +run-message-pump: process $message-pump-task and its effects :: ++ run-message-pump @@ -1648,8 +1666,8 @@ =* gift i.still-gifts =. peer-core ?- -.gift - %send (on-still-send [message-num ack-meat]:gift) %memo (on-still-memo [message-num message]:gift) + %send (on-still-send [message-num ack-meat]:gift) == $(still-gifts t.still-gifts) :: +on-still-send: emit ack packet as requested by |message-still @@ -1665,55 +1683,57 @@ message-num %| ack-meat == - :: +on-still-memo: handle message received by |message-still + :: +on-still-memo: dispatch message received by |message-still + :: + :: odd bone: %plea request message + :: even bone, 0 second bit: %boon response message + :: even bone, 1 second bit: nack-trace %boon message :: ++ on-still-memo - |= [=message-num =message] - ^+ peer-core - :: pop first element off .path.message as .target-vane - :: - =^ target-vane path.message - ?>(?=([?(%a %c %g %k) *] path.message) path.message) - :: odd .bone; "request" message to pass to vane before acking - :: ?: =(1 (end 0 1 bone)) - =/ =wire (make-bone-wire her.channel bone) - :: /a/ping means sponsor ping timer; no-op - :: - ?: =(`path`/a/ping path.message) - peer-core - :: - =^ client-duct ossuary.peer-state - (get-duct ossuary.peer-state bone duct) - :: - ?- target-vane - %a ~| %bad-ames-message^path.message^her.channel !! - %c (emit client-duct %pass wire %c %memo her.channel message) - %g (emit client-duct %pass wire %g %memo her.channel message) - %k (emit client-duct %pass wire %k %memo her.channel message) - == - :: even bone means backward flow; ack automatically - :: - :: Only messages from forward flows can be nacked. - :: Note: reentrant. + on-still-plea + ?: =(0 (end 0 1 (rsh 0 1 bone))) + on-still-boon + on-still-nack-trace + :: +on-still-boon: handle response message received by |message-still + :: + ++ on-still-boon + |= [=message-num message=*] + ^+ peer-core + :: send message ack packet unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) - :: is .bone a nack-trace flow? check the second bit + :: if no .client-duct, bone is invalid; don't send to vane :: - ?: =(0 (end 0 1 (rsh 0 1 bone))) - :: not a nack-trace; give message to local "subscriber" vane - :: - =/ client-duct (~(got by by-bone.ossuary.peer-state) bone) - :: - (emit client-duct %give %memo message) - :: .bone is a nack-trace; validate message + :: Future Ames should emit a security alert to local + :: subscribers if it can't find the duct for a %boon message. :: - ?> =(/a/nax `path`path.message) - =+ ;; [=target=^message-num =error] payload.message + ?~ client-duct=(~(get by by-bone.ossuary.peer-state) bone) + ~& %ames-bogus-boon-target^her.channel + peer-core + :: valid bone; give message to vane + :: + (emit u.client-duct %give %boon message) + :: +on-still-nack-trace: handle nack-trace received by |message-still + :: + ++ on-still-nack-trace + |= [=message-num message=*] + ^+ peer-core + :: + =+ ;; [=failed=message-num =error] message :: flip .bone's second bit to find referenced flow :: =/ target-bone=^bone (mix 0b10 bone) - =/ nax-key [target-bone target-message-num] + :: if no .target-duct, malformed message; don't ack + :: + ?~ target-duct=(~(get by by-bone.ossuary.peer-state) target-bone) + ~& %ames-bogus-nack-trace-target^her.channel + peer-core + :: valid .target-duct; ack + :: + =. peer-core (run-message-still bone %done ok=%.y) + :: + =/ nax-key [target-bone failed-message-num] :: if we haven't heard a message nack, pretend we have :: :: The nack-trace message counts as a valid message nack on @@ -1726,29 +1746,46 @@ :: =? peer-core !(~(has in nax.peer-state) nax-key) %- run-message-pump - [target-bone %hear target-message-num %| ok=%.n lag=`@dr`0] + [target-bone %hear failed-message-num %| ok=%.n lag=`@dr`0] :: clear the nack from our state and relay to vane :: =. nax.peer-state (~(del in nax.peer-state) nax-key) - =/ target-duct (~(got by by-bone.ossuary.peer-state) target-bone) :: - (emit target-duct %give %done `error) + (emit u.target-duct %give %done `error) + :: +on-still-plea: handle request message received by |message-still + :: + ++ on-still-plea + |= [=message-num message=*] + ^+ peer-core + :: don't accept requests for arbitrary vanes + :: + =+ ;; [vane=?(%a %c %g %k) =plea] message + :: %a /ping means sponsor ping timer; send ack + :: + ?: ?=(%a vane) + :: validate ping message and send ack + :: + :: TODO: treat ames as client vane and go through arvo? + :: removes reentrancy and could nack more easily + :: + =/ error=(unit error) + ?: =([/ping ~] plea) ~ + `[%ping [%leaf "ames: invalid ping"]~] + :: + (run-message-still bone %done ok=%.y) + :: not a sponsor ping; relay .plea to .vane + :: + =/ =wire (make-bone-wire her.channel bone) + :: + =^ client-duct ossuary.peer-state + (get-duct ossuary.peer-state bone duct) + :: + ?- vane + %c (emit client-duct %pass wire %c %plea her.channel plea) + %g (emit client-duct %pass wire %g %plea her.channel plea) + %k (emit client-duct %pass wire %k %plea her.channel plea) + == -- - :: +send-shut-packet: fire encrypted packet at rcvr and maybe sponsors - :: - ++ send-shut-packet - |= =shut-packet - ^+ peer-core - :: swizzle bone just before sending; TODO document - :: - =. bone.shut-packet (mix 1 bone.shut-packet) - :: - =/ content (encrypt symmetric-key.channel shut-packet) - =/ =packet [[our her.channel] encrypted=%.y origin=~ content] - =/ =blob (encode-packet packet) - :: - =. event-core (send-blob her.channel blob) - peer-core -- -- :: +make-message-pump: constructor for |message-pump @@ -1779,7 +1816,7 @@ ^+ message-pump :: ?- -.task - %memo (on-memo message.task) + %memo (on-memo message-blob.task) %wake (run-packet-pump task) %hear ?- -.ack-meat.task @@ -1789,10 +1826,10 @@ :: +on-memo: handle request to send a message :: ++ on-memo - |= =message + |= =message-blob ^+ message-pump :: - =. unsent-messages.state (~(put to unsent-messages.state) message) + =. unsent-messages.state (~(put to unsent-messages.state) message-blob) message-pump :: +on-hear: handle packet acknowledgment :: @@ -1899,10 +1936,10 @@ message-pump :: .unsent-messages is nonempty; pop a message off and feed it :: - =^ message unsent-messages.state ~(get to unsent-messages.state) + =^ =message-blob unsent-messages.state ~(get to unsent-messages.state) :: break .message into .chunks and set as .unsent-fragments :: - =. unsent-fragments.state (split-message next.state message) + =. unsent-fragments.state (split-message next.state message-blob) :: try to feed packets from the next message :: =. next.state +(next.state) @@ -2320,7 +2357,8 @@ :: u.existing :: - =/ already-heard=? (~(has by fragments.partial-rcv-message) `^fragment-num``@`seq) + =/ already-heard=? + (~(has by fragments.partial-rcv-message) `^fragment-num``@`seq) :: ack dupes except for the last fragment, in which case drop :: ?: already-heard @@ -2361,14 +2399,14 @@ =. last-heard.state +(last-heard.state) =. live-messages.state (~(del by live-messages.state) seq) :: - =/ =message (assemble-fragments [num-fragments fragments]:u.live) + =/ message=* (assemble-fragments [num-fragments fragments]:u.live) =. message-still (enqueue-to-vane seq message) :: $(seq +(seq)) :: +enqueue-to-vane: enqueue message to be sent to local vane :: ++ enqueue-to-vane - |= [seq=message-num =message] + |= [seq=message-num message=*] ^+ message-still :: =/ empty=? =(~ pending-vane-ack.state) @@ -2402,10 +2440,10 @@ :: +split-message: split message into kilobyte-sized fragments :: ++ split-message - |= [=message-num =message] + |= [=message-num =message-blob] ^- (list static-fragment) :: - =/ fragments=(list fragment) (rip 13 (jam message)) + =/ fragments=(list fragment) (rip 13 message-blob) =/ num-fragments=fragment-num (lent fragments) =| counter=@ :: diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 7d4745ff93..4adb73bbd8 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -216,7 +216,7 @@ [%wegh ~] :: receive message via %ames :: - [%memo =ship =message:ames] + [%plea =ship =plea:ames] == :: :::: :::: ++http :: @@ -395,23 +395,23 @@ $>(%born vane-task) $>(%crud vane-task) $>(%init vane-task) - $>(%memo vane-task) + $>(%plea vane-task) $>(%vega vane-task) $>(%wegh vane-task) == :: $gift: effect from ames :: - :: %memo: message to vane from peer - :: %send: packet to unix + :: %boon: response message from remote ship :: %done: notify vane that peer (n)acked our message + :: %send: packet to unix :: :: %mass: memory usage report :: %turf: domain report, relayed from kale :: +$ gift - $% [%memo =message] - [%send =lane =blob] + $% [%boon payload=*] [%done error=(unit error)] + [%send =lane =blob] :: [%mass p=mass] [%turf turfs=(list turf)] @@ -458,12 +458,13 @@ :: know their transport addresses. :: +$ lane (each @pC address) - :: $message: application-level message + :: $plea: application-level message, as a %pass :: + :: vane: destination vane on remote ship :: path: internal route on the receiving ship :: payload: semantic message contents :: - +$ message [=path payload=*] + +$ plea [vane=@tas =path payload=*] -- ::ames :: :::: :::: ++behn :: (1b) timekeeping @@ -505,13 +506,13 @@ ++ able ^? |% ++ gift :: out result <-$ - $% {$croz rus/(map desk {r/regs w/regs})} :: rules for group + $% [%boon payload=*] :: ames response + {$croz rus/(map desk {r/regs w/regs})} :: rules for group {$cruz cez/(map @ta crew)} :: permission groups {$dirk p/@tas} :: mark mount dirty {$ergo p/@tas q/mode} :: version update {$hill p/(list @tas)} :: mount points - [%done error=(unit error:ames)] :: message (n)ack - [%memo =message:ames] :: send ames message + [%done error=(unit error:ames)] :: ames message (n)ack {$mass p/mass} :: memory usage {$mere p/(each (set path) (pair term tang))} :: merge result {$note p/@tD q/tank} :: debug message @@ -545,7 +546,7 @@ {$warp wer/ship rif/riff} :: internal file req {$werp who/ship wer/ship rif/riff} :: external file req $>(%wegh vane-task) :: report memory - $>(%memo vane-task) :: network request + $>(%plea vane-task) :: ames request == :: -- ::able :: @@ -1780,20 +1781,20 @@ ++ able ^? |% ++ gift :: outgoing result - $% {$mass p/mass} :: memory usage + $% [%boon payload=*] :: ames response + [%done error=(unit error:ames)] :: ames message (n)ack + {$mass p/mass} :: memory usage {$onto p/(each suss tang)} :: about agent {$unto p/cuft} :: - [%done error=(unit error:ames)] :: message (n)ack - [%memo =message:ames] :: send ames message == :: ++ task :: incoming request $~ [%vega ~] :: $% {$conf p/dock q/culm} :: configure app - $>(%init vane-task) :: set owner {$deal p/sock q/cush} :: full transmission + $>(%init vane-task) :: set owner + $>(%plea vane-task) :: ames request $>(%sunk vane-task) :: report death $>(%vega vane-task) :: report upgrade - $>(%memo vane-task) :: network request $>(%wegh vane-task) :: report memory == :: -- ::able @@ -2078,7 +2079,6 @@ [%vest ~] :: view public balance [%vine ~] :: view secret history $>(%wegh vane-task) :: memory usage request - $>(%memo vane-task) :: remote request [%wind p=@ud] :: rewind before block == :: -- :: @@ -2335,8 +2335,8 @@ ++ gift :: out result <-$ $% [%init p=ship] :: report install unix [%mass p=mass] :: memory usage report - [%done error=(unit error:ames)] :: message (n)ack - [%memo =message:ames] :: send ames message + [%done error=(unit error:ames)] :: ames message (n)ack + [%boon payload=*] :: ames response [%source whos=(set ship) src=source] :: [%turf turf=(list turf)] :: domains [%private-keys =life vein=(map life ring)] :: private keys @@ -2370,7 +2370,7 @@ [%vent-update =vent-result] :: update from app $>(%vega vane-task) :: report upgrade $>(%wegh vane-task) :: memory usage request - $>(%memo vane-task) :: remote request + $>(%plea vane-task) :: ames request [%wind p=@ud] :: rewind before block == :: -- :: From 5b0ee61a6427a2a61a9b02cb5c13ac74bf0b594c Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 28 Jul 2019 23:37:49 -0700 Subject: [PATCH 031/151] Boots without error and sends and receives talk messages --- pkg/arvo/sys/vane/alef.hoon | 28 +++++++++++++++------------- pkg/arvo/sys/vane/clay.hoon | 23 +++++++++++------------ pkg/arvo/sys/vane/gall.hoon | 22 +++++++++++----------- pkg/arvo/sys/vane/kale.hoon | 20 ++++++++++---------- pkg/arvo/sys/zuse.hoon | 6 ++---- 5 files changed, 49 insertions(+), 50 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 210e59485f..7e97f01fd4 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -926,10 +926,10 @@ :: =/ =peer-state (got-peer-state her) =/ =channel [[our her] now +>.ames-state -.peer-state] + =/ peer-core (make-peer-core peer-state channel) :: if processing succeded, send positive ack packet and exit :: ?~ error - =/ peer-core (make-peer-core peer-state channel) abet:(run-message-still:peer-core bone %done ok=%.y) :: failed; send message nack packet :: @@ -940,10 +940,10 @@ =/ =message-blob (jam [failed u.error]) :: send nack-trace message on associated .nack-trace-bone :: - =/ peer-core (make-peer-core peer-state channel) + =. peer-core (make-peer-core peer-state channel) =/ nack-trace-bone=^bone (mix 0b10 bone) :: - abet:(run-message-pump:peer-core nack-trace-bone %boon message-blob) + abet:(run-message-pump:peer-core nack-trace-bone %memo message-blob) :: +on-hear: handle raw packet receipt :: ++ on-hear @@ -1304,8 +1304,8 @@ ?~ snd-messages.todos event-core :: =. event-core - %- on-memo(duct duct.i.snd-messages.todos) - [ship message.i.snd-messages.todos] + %- on-plea(duct duct.i.snd-messages.todos) + [ship plea.i.snd-messages.todos] :: $(snd-messages.todos t.snd-messages.todos) :: apply outgoing packet blobs @@ -1433,7 +1433,7 @@ ++ ping-sponsor ^+ event-core :: - (emit duct %pass /ping %a %plea sponsor.ames-state /ping ~) + (emit duct %pass /ping %a %plea sponsor.ames-state %a /ping ~) :: +send-blob: fire packet at .ship and maybe sponsors :: :: Send to .ship and sponsors until we find a direct lane. @@ -1720,7 +1720,7 @@ |= [=message-num message=*] ^+ peer-core :: - =+ ;; [=failed=message-num =error] message + =+ ;; [=failed=^message-num =error] message :: flip .bone's second bit to find referenced flow :: =/ target-bone=^bone (mix 0b10 bone) @@ -1759,17 +1759,18 @@ ^+ peer-core :: don't accept requests for arbitrary vanes :: - =+ ;; [vane=?(%a %c %g %k) =plea] message + =+ ;; =plea message :: %a /ping means sponsor ping timer; send ack :: - ?: ?=(%a vane) + ?: ?=(%a vane.plea) :: validate ping message and send ack :: :: TODO: treat ames as client vane and go through arvo? :: removes reentrancy and could nack more easily :: =/ error=(unit error) - ?: =([/ping ~] plea) ~ + ?: =([/ping ~] +.plea) + ~ `[%ping [%leaf "ames: invalid ping"]~] :: (run-message-still bone %done ok=%.y) @@ -1780,7 +1781,7 @@ =^ client-duct ossuary.peer-state (get-duct ossuary.peer-state bone duct) :: - ?- vane + ?+ vane.plea ~| %ames-evil-vane^vane.plea !! %c (emit client-duct %pass wire %c %plea her.channel plea) %g (emit client-duct %pass wire %g %plea her.channel plea) %k (emit client-duct %pass wire %k %plea her.channel plea) @@ -2121,7 +2122,9 @@ =- :: if no sent packet matches the ack, don't apply mutations or effects :: ?. found.- + ~& %alef-hear-noop packet-pump + ~& %alef-hear-ack^message-num^fragment-num :: =. metrics.state metrics.- =. live.state live.- @@ -2457,7 +2460,7 @@ :: ++ assemble-fragments |= [num-fragments=fragment-num fragments=(map fragment-num fragment)] - ^- message + ^- * :: =| sorted=(list fragment) =. sorted @@ -2467,7 +2470,6 @@ sorted $(index +(index), sorted [(~(got by fragments) index) sorted]) :: - ;; message %- cue %+ can 13 %+ turn (flop sorted) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 38d98d02c2..b676cf3950 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -471,7 +471,7 @@ ++ note :: out request $-> $~ [%b %wait *@da] :: $% $: %a :: to %ames - $>(%memo task:able:ames) :: + $>(%plea task:able:ames) :: == :: $: %b :: to %behn $> $? %drip :: @@ -505,7 +505,7 @@ $% [%init-clad ~] :: == == :: $: %a :: by %ames - $> $? %memo :: + $> $? %boon :: %done :: == :: gift:able:ames :: @@ -2795,8 +2795,8 @@ :: =/ =desk p.riff =/ =wire /warp-index/(scot %p ship)/(scot %tas desk)/(scot %ud index) - =/ =path [%c %question desk (scot %ud index) ~] - (emit duct %pass wire %a %memo ship path riff) + =/ =path [%question desk (scot %ud index) ~] + (emit duct %pass wire %a %plea ship %c path riff) :: :: Create a request that cannot be filled immediately. :: @@ -4369,10 +4369,10 @@ (start-request:den for u.q.rif) [mos ..^$] :: - %memo + %plea =* her ship.req - =* pax path.message.req - =* res payload.message.req + =* pax path.plea.req + =* res payload.plea.req :: ?> ?=({%question *} pax) =+ ryf=;;(riff res) @@ -4466,7 +4466,7 @@ ?: ?=([%foreign-warp *] tea) ?> ?=(%writ +<.q.hin) :_ ..^$ - [hen %give %memo /remove-me (bind `riot`p.q.hin rant-to-rand)]~ + [hen %give %boon (bind `riot`p.q.hin rant-to-rand)]~ :: ?: ?=({%foreign-request @ @ @ *} tea) =/ her (slav %p i.t.tea) @@ -4502,10 +4502,9 @@ == == :: ?: ?=([%warp-index @ @ @ ~] tea) - ?> ?=(%memo +<.q.hin) - ?> ?=([%remove-me ~] path.message.q.hin) + ?> ?=(%boon +<.q.hin) :: - =+ ;; res=(unit rand) payload.message.q.hin + =+ ;; res=(unit rand) payload.q.hin :: =/ her=ship (slav %p i.t.tea) =/ =desk (slav %tas i.t.t.tea) @@ -4568,7 +4567,7 @@ :: :: handled in the wire dispatcher :: - %memo !! + %boon !! %writ !! :: %done diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 2f2f9bcf88..370b77176b 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -225,7 +225,7 @@ == %+ mo-pass [%sys %way (scot %p him) p.caz -.q.caz ~] - `note-arvo`[%a %memo him [%g %ge p.caz ~] [num roc]] + `note-arvo`[%a %plea him %g [%ge p.caz ~] [num roc]] :: ++ mo-baba :: error convert b |= error=(unit error:ames) @@ -360,8 +360,8 @@ ?- -.cuf %coup (mo-give %done ?~(p.cuf ~ `[%gall-coup u.p.cuf])) %reap (mo-give %done ?~(p.cuf ~ `[%gall-reap u.p.cuf])) - %diff (mo-give %memo /remove-me num %d p.p.cuf q.q.p.cuf) - %quit (mo-give %memo /remove-me num %x ~) + %diff (mo-give %boon num %d p.p.cuf q.q.p.cuf) + %quit (mo-give %boon num %x ~) :: we send http-responses, we don't receive them. :: $http-response !! @@ -393,8 +393,8 @@ ?: ?=([%a %done *] sih) (mo-awed him cub error.sih) :: - ?> ?=([%a %memo *] sih) - =+ mes=;;([@ud roon] payload.message.sih) + ?> ?=([%a %boon *] sih) + =+ mes=;;([@ud roon] payload.sih) (mo-gawd:(mo-abed:mo hen) him dap mes) == :: @@ -1290,14 +1290,14 @@ $init [~ ..^$(sys.mast.all hen)] :: - %memo - ~& %gall-memo-path^path.message.q.hic - ?> ?=([%ge @ ~] path.message.q.hic) + %plea + ~& %gall-plea-path^path.plea.q.hic + ?> ?=([%ge @ ~] path.plea.q.hic) =/ him=ship ship.q.hic - =* dap i.t.path.message.q.hic + =* dap i.t.path.plea.q.hic :: - =+ mes=;;([@ud rook] payload.message.q.hic) - ~& %gall-memo-coerced + =+ mes=;;([@ud rook] payload.plea.q.hic) + ~& %gall-plea-coerced =< mo-abet (mo-gawk:(mo-abed:mo hen) him dap mes) :: diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index a8616e875a..ed50403b4d 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -80,9 +80,9 @@ [p=duct q=card] :: :: :: +$ note :: out request $-> - $~ [%a %memo *ship *message:ames] :: + $~ [%a %plea *ship *plea:ames] :: $% $: %a :: to %ames - $>(%memo task:able:ames) :: send message + $>(%plea task:able:ames) :: send request message == :: $: %k :: to self $>(%look task) :: set ethereum source @@ -93,7 +93,7 @@ :: :: +$ sign :: in result $<- $~ [%a %done ~] :: - $% [%a $>(%memo gift:able:ames)] :: message result + $% [%a $>(%boon gift:able:ames)] :: message response [%a $>(%done gift:able:ames)] :: message (n)ack == :: -- :: @@ -437,11 +437,11 @@ == :: :: authenticated remote request - :: [%memo =ship =message:ames] + :: [%plea =ship =plea:ames] :: - %memo + %plea =* her ship.tac - =/ mes (message message.tac) + =/ mes (message payload.plea.tac) ?- -.mes :: :: cancel trackers @@ -479,9 +479,9 @@ ::TODO fail:et +>.$ :: - [%a %memo *] + [%a %boon *] =. moz [[hen %give %done ~] moz] - =+ ;; =message-response message.hin + =+ ;; =message-response payload.hin (call hen %vent-update vent-result.message-response) == :: :: ++curd:of @@ -567,7 +567,7 @@ :: ?. ?=([[%a *] *] d) (emit d %give %public-keys vent-result) - (emit d %give %memo /k/remove-me %public-keys-result vent-result) + (emit d %give %boon %public-keys-result vent-result) $(yez t.yez) :: ++ get-source @@ -742,7 +742,7 @@ ?: ?=(%& -.source) =/ send-message |= =message - [hen %pass /public-keys %a %memo p.source /k/public-keys message] + [hen %pass /public-keys %a %plea p.source %k /public-keys message] =. ..feel (emit (send-message %nuke whos)) (emit (send-message %public-keys whos)) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 4adb73bbd8..b372a8c495 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -7579,8 +7579,9 @@ {$j gift:able:jael} {$k gift:able:kale} == +:: $unix-task: input from unix :: -+$ unix-task :: input from unix ++$ unix-task $~ [%wake ~] $% :: %dill: keyboard input :: @@ -7627,9 +7628,6 @@ :: %behn: wakeup :: $>(%wake task:able:behn) - :: %ames: send message - :: - $>(%memo task:able:ames) == :: :: :::: ++azimuth :: (2az) azimuth From c7c964b5077212404254ea434cadd931815dfdc0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 28 Jul 2019 23:38:18 -0700 Subject: [PATCH 032/151] update solid pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index a161162e5c..452678d4b1 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f02a70b0cae5370c8c2f8c450836ebbc590d50a96a5f6bb2e7dd8b299f35791d -size 8731129 +oid sha256:77d45ad7db4dff40691a2145e4cd02fc6264973e0f874133e8ed70dd14632d06 +size 9908218 From e04d2c8570d724354888743a16efa27cbb948202 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 00:14:39 -0700 Subject: [PATCH 033/151] worker printfs --- pkg/urbit/worker/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/urbit/worker/main.c b/pkg/urbit/worker/main.c index 840c44fbc4..595bf9b082 100644 --- a/pkg/urbit/worker/main.c +++ b/pkg/urbit/worker/main.c @@ -374,6 +374,21 @@ _worker_send_slog(u3_noun hod) _worker_send(u3nt(c3__slog, u3i_chubs(1, &u3V.sen_d), hod)); } +/* _worker_send_tang(): send list of hoon tanks as hint outputs. +*/ +static void +_worker_send_tang(c3_y pri_y, u3_noun tan) +{ + u3_noun i_tan, t_tan; + while ( u3_nul != tan ) { + i_tan = u3k(u3h(tan)); + t_tan = u3k(u3t(tan)); + u3z(tan); + _worker_send_slog(u3nc(pri_y, i_tan)); + tan = t_tan; + } +} + /* _worker_lame(): event failed, replace with error event. */ static void @@ -393,6 +408,7 @@ _worker_lame(c3_d evt_d, u3_noun now, u3_noun ovo, u3_noun why, u3_noun tan) // with a crypto failure, just drop the packet. // if ( (c3__hear == tag) && (c3__exit == why) ) { + _worker_send_tang(1, u3k(tan)); rep = u3nt(u3k(wir), c3__hole, u3k(cad)); } // failed event notifications (%crud) are replaced with @@ -404,6 +420,7 @@ _worker_lame(c3_d evt_d, u3_noun now, u3_noun ovo, u3_noun why, u3_noun tan) else if ( c3__crud == tag ) { u3_noun lef = u3nc(c3__leaf, u3i_tape("crude crashed!")); u3_noun nat = u3kb_weld(u3k(u3t(cad)), u3nc(lef, u3k(tan))); + _worker_send_tang(1, u3k(nat)); rep = u3nc(u3nt(u3_blip, c3__arvo, u3_nul), u3nt(c3__warn, u3k(u3h(cad)), nat)); } @@ -423,6 +440,7 @@ _worker_lame(c3_d evt_d, u3_noun now, u3_noun ovo, u3_noun why, u3_noun tan) u3_noun lef = u3nc(c3__leaf, u3kb_weld(u3i_tape("bail: "), u3qc_rip(3, why))); u3_noun nat = u3kb_weld(u3k(tan), u3nc(lef, u3_nul)); + _worker_send_tang(1, u3k(nat)); rep = u3nc(u3k(wir), u3nt(c3__crud, u3k(tag), nat)); } From 505c0eb4d548d9ab08c54ea8988500fa979f9361 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 02:08:26 -0700 Subject: [PATCH 034/151] clay |sync works; fixed ack bug and clay bug --- pkg/arvo/sys/vane/alef.hoon | 47 +++++++++++++++++++------------------ pkg/arvo/sys/vane/clay.hoon | 9 +++++++ 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 7e97f01fd4..6320a12a96 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -57,8 +57,8 @@ =/ protocol-version=?(%0 %1 %2 %3 %4 %5 %6 %7) %0 =, ames =, able -=* point point:able:kale -=* vent-result vent-result:able:kale +=* point point:able:kale +=* public-keys-result public-keys-result:able:kale :: => |% @@ -650,7 +650,7 @@ == == $: %k $% [%private-keys =life vein=(map life ring)] - [%public-keys =vent-result] + [%public-keys =public-keys-result] [%turf turfs=(list turf)] == == $: @tas @@ -881,9 +881,9 @@ :: [%b %wake *] (on-take-wake:event-core wire error.sign) :: - [%k %private-keys *] (on-priv:event-core [life vein]:sign) - [%k %public-keys *] (on-publ:event-core wire vent-result.sign) [%k %turf *] (on-take-turf:event-core turfs.sign) + [%k %private-keys *] (on-priv:event-core [life vein]:sign) + [%k %public-keys *] (on-publ:event-core wire public-keys-result.sign) == :: [moves ames-gate] @@ -974,13 +974,10 @@ %. +< :: ?. =(our rcvr.packet) - ~& %alef-on-hear-forward on-hear-forward :: ?: encrypted.packet - ~& %alef-on-hear-shut on-hear-shut - ~& %alef-on-hear-open on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: @@ -1181,24 +1178,22 @@ :: +on-publ: update pki data for peer or self :: ++ on-publ - |= [=wire =vent-result] + |= [=wire =public-keys-result] ^+ event-core :: |^ ^+ event-core - ?- vent-result - [%diff @ * %rift *] - (on-publ-breach [who rift.udiff]:vent-result) :: - [%diff @ * %keys *] - (on-publ-rekey [who +>.udiff]:vent-result) + ?- public-keys-result + [%diff @ %rift *] + (on-publ-breach [who to.diff]:public-keys-result) :: - [%diff @ * %spon *] - (on-publ-sponsor [who sponsor.udiff]:vent-result) + [%diff @ %keys *] + (on-publ-rekey [who to.diff]:public-keys-result) :: - [%diff @ * %disavow ~] - (on-publ-sponsor [who ~]:vent-result) + [%diff @ %spon *] + (on-publ-sponsor [who to.diff]:public-keys-result) :: - [%full *] (on-publ-full points.vent-result) + [%full *] (on-publ-full points.public-keys-result) == :: +on-publ-breach: handle continuity breach of .ship; wipe its state :: @@ -1572,7 +1567,6 @@ |^ ^+ peer-core ?~ pump-gifts peer-core =* gift i.pump-gifts - ~& %alef-on-pump-gift^-.gift =. peer-core ?- -.gift %done (on-pump-done [message-num ok]:gift) @@ -1700,6 +1694,7 @@ ++ on-still-boon |= [=message-num message=*] ^+ peer-core + ~& %ames-still-boon :: send message ack packet unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) @@ -1719,6 +1714,7 @@ ++ on-still-nack-trace |= [=message-num message=*] ^+ peer-core + ~& %ames-still-nack-trace :: =+ ;; [=failed=^message-num =error] message :: flip .bone's second bit to find referenced flow @@ -1757,6 +1753,7 @@ ++ on-still-plea |= [=message-num message=*] ^+ peer-core + ~& %ames-still-plea :: don't accept requests for arbitrary vanes :: =+ ;; =plea message @@ -2060,10 +2057,9 @@ ++ feed |= fragments=(list static-fragment) ^+ [fragments gifts state] - ~& %alef-feed^(lent fragments) :: return unsent back to caller and reverse effects to finalize :: - =- ~& %alef-feed-unsent^(lent unsent) + =- ~& %alef-feed^(lent fragments)^%unsent^(lent unsent) [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] @@ -2331,10 +2327,12 @@ ?. is-last-fragment :: single packet ack :: + ~& %send-dupe-ack^fragment-num (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) + ~& %send-dupe-ack-whole-message (give %send seq %| ok lag=`@dr`0) :: last-acked ?=(%boon +<.q.hin) :: =+ ;; res=(unit rand) payload.q.hin From 558eee35f0fb2da184251d6a6cae8788a6f2d459 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 02:08:54 -0700 Subject: [PATCH 035/151] update solid pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 452678d4b1..a0a7a19be8 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77d45ad7db4dff40691a2145e4cd02fc6264973e0f874133e8ed70dd14632d06 -size 9908218 +oid sha256:c076e86f295e4e0a25bc2c5310b9abf64da945fe5eff462516aa6c24e8f333fd +size 9850171 From 14dba1d4ac24d1166ded4f3e8ee1d5aa518febb0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 04:05:52 -0700 Subject: [PATCH 036/151] all tests pass --- bin/solid.pill | 4 +- pkg/arvo/lib/ring.hoon | 17 ++- pkg/arvo/sys/vane/alef.hoon | 2 +- pkg/arvo/sys/vane/jael.hoon | 46 ++++---- pkg/arvo/sys/zuse.hoon | 97 +++++++++-------- pkg/arvo/tests/sys/vane/alef.hoon | 24 ++-- pkg/arvo/tests/sys/vane/ames.hoon | 175 ------------------------------ 7 files changed, 96 insertions(+), 269 deletions(-) delete mode 100644 pkg/arvo/tests/sys/vane/ames.hoon diff --git a/bin/solid.pill b/bin/solid.pill index a0a7a19be8..a32cb8a230 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c076e86f295e4e0a25bc2c5310b9abf64da945fe5eff462516aa6c24e8f333fd -size 9850171 +oid sha256:a1b00e99a32486b872d79d110ffac2fa2c0d0a3cb42e5d7748df8a32bbe5bb13 +size 9857182 diff --git a/pkg/arvo/lib/ring.hoon b/pkg/arvo/lib/ring.hoon index 75effd06cf..b51b584186 100644 --- a/pkg/arvo/lib/ring.hoon +++ b/pkg/arvo/lib/ring.hoon @@ -349,8 +349,15 @@ |= [our=@p now=@da ship=@p =life] ^- @udpoint :: - =/ d=deed:ames - .^(deed:ames j+/(scot %p our)/deed/(scot %da now)/(scot %p ship)/(scot %ud life)) + =/ d=[=^life =pass] + =/ scry-path=path + :~ %k + (scot %p our) + (scot %da now) + (scot %p ship) + (scot %ud life) + == + .^([^life pass] scry-path) :: we have the deed which has pass, which is several numbers +cat-ed :: together; pull out the keys :: @@ -370,7 +377,7 @@ [participants keys] :: =/ =life - .^(life j+/(scot %p our)/life/(scot %da now)/(scot %p i.invited)) + .^(life k+/(scot %p our)/life/(scot %da now)/(scot %p i.invited)) :: ?: =(life 0) $(invited t.invited) @@ -429,11 +436,11 @@ :: get our ships' current life :: =/ our-life=life - .^(life %j /(scot %p our)/life/(scot %da now)/(scot %p our)) + .^(life %k /(scot %p our)/life/(scot %da now)/(scot %p our)) :: get our ships' secret keyfile ring :: =/ secret-ring=ring - .^(ring %j /(scot %p our)/vein/(scot %da now)/(scot %ud our-life)) + .^(ring %k /(scot %p our)/vein/(scot %da now)/(scot %ud our-life)) :: fetch the encoded auth seed from the ring :: =/ secret-auth-seed=@ diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 6320a12a96..18e89d0531 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2366,7 +2366,7 @@ ?: already-heard ?: is-last-fragment message-still - ~& %send-dupe-ack-fragment + ~& %send-dupe-ack-fragment^fragment (give %send seq %& fragment-num) :: new fragment; store in state and check if message is done :: diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 749e18c573..cf65f9aa3d 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -108,7 +108,7 @@ task:able:behn :: == :: $: %a :: to %ames - $>(%want task:able:ames) :: send message + $>(%plea task:able:ames) :: send request message == :: $: %i :: to %iris $>(%request task:able:iris) :: http request @@ -125,7 +125,7 @@ $~ [%b %wake ~] :: $% [%b $>(%wake gift:able:behn)] :: wakeup [%j $>(%vent gift)] :: ethereum changes - [%a $>(%woot gift:able:ames)] :: message result + [%a $>(%done gift:able:ames)] :: message result [%i $>(%http-response gift:able:iris)] :: http response == :: -- :: @@ -555,7 +555,7 @@ |=((map @ta @) (~(run by +<) |=(@ (shax +<)))) :: $urban - [%urban (~(run by p.rys) |=({@da code:ames} [+<- (shax +<+)]))] + [%urban (~(run by p.rys) |=({@da @} [+<- (shax +<+)]))] == :: :: ++remove:up ++ remove :: pig minus gob @@ -911,7 +911,7 @@ :: [%vent ~] :: %vent - =. moz [[hen %give %mack ~] moz] + =. moz [[hen %give %done ~] moz] (curd abet:~(vent ~(feed su hen our urb sub etn sap) hen)) :: :: monitor assets @@ -946,9 +946,9 @@ :: authenticated remote request :: {$west p/ship q/path r/*} :: - $west - =* her p.tac - =/ mes (message r.tac) + %plea + =* her ship.tac + =/ mes ;;(message payload.plea.tac) ?- -.mes :: :: reset remote rights @@ -975,7 +975,7 @@ :: ignore if not from currently configured source. ?. &(-.source.etn =(her p.source.etn)) +>.$ - =. moz [[hen %give %mack ~] moz] + =. moz [[hen %give %done ~] moz] %+ cute hen =< abet (~(hear-vent et hen our now urb.lex sub.lex etn.lex sap.lex) p.mes) == @@ -993,11 +993,10 @@ ?> ?=([@ *] tea) =* wir t.tea ?- hin - [%a %woot *] - ?~ q.hin +>.$ - ?~ u.q.hin ~&(%ares-fine +>.$) - ~& [%woot-bad p.u.u.q.hin] - ~_ q.u.u.q.hin + [%a %done *] + ?~ error.hin ~&(%ares-fine +>.$) + ~& [%done-bad tag.u.error.hin] + %- (slog tang.u.error.hin) ::TODO fail:et +>.$ :: @@ -1162,7 +1161,7 @@ :+ %pass /(scot %p our)/vent-result ^- note - [%a %want who /j/(scot %p our)/vent-result %vent-result res] + [%a %plea who %j /(scot %p our)/vent-result %vent-result res] $(yez t.yez) :: ++ extract-snap :: extract rewind point @@ -1275,9 +1274,8 @@ moz :_ moz :^ *duct %pass /vest/(scot %p p.hug) - :+ %a %want - :+ p.hug /j - ^- message + :+ %a %plea + :^ p.hug %j / [%hail |+pig] == :: @@ -1771,7 +1769,7 @@ |= [our=ship who=ship] %- put-move(source &+who) %+ wrap-note /vent/(scot %p who) - [%a %want who /j/(scot %p our)/vent `*`[%vent ~]] + [%a %plea who %j /(scot %p our)/vent `*`[%vent ~]] :: :: +unsubscribe-from-source: stop listening to current source ship :: @@ -1782,7 +1780,7 @@ %+ wrap-note /vent/(scot %p p.source) ::TODO should we maybe have a %nuke-vent, :: or do we have a unique duct here? - [%a %want p.source /j/(scot %p our)/vent `*`[%nuke ~]] + [%a %plea p.source %j /(scot %p our)/vent `*`[%nuke ~]] :: :: +listen-to-node: start syncing from a node :: @@ -2270,7 +2268,7 @@ :+ %pass /(scot %p our)/vent-result ^- note - [%a %want who /j/(scot %p our)/vent-result %vent-result res] + [%a %plea who %j /(scot %p our)/vent-result %vent-result res] :: :: ++feed:su -- -- @@ -2410,8 +2408,7 @@ =/ cub (nol:nu:crub:crypto sec) =/ sig (sign:as:cub (shaf %self (sham [u.who 1 pub:ex:cub]))) :^ ~ ~ %noun - !> ^- deed:ames - [1 pub:ex:cub `sig] + !> [1 pub:ex:cub `sig] :: ?: ?=(%earl rac) ?. =(u.who p.why) @@ -2423,8 +2420,7 @@ =/ sec (~(got by jaw.own.sub.lex) u.lyf) =/ cub (nol:nu:crub:crypto sec) :^ ~ ~ %noun - !> ^- deed:ames - [u.lyf pub:ex:cub sig.own.sub.lex] + !> [u.lyf pub:ex:cub sig.own.sub.lex] :: =/ pub (~(get by kyz.puk.sub.lex) u.who) ?~ pub @@ -2435,7 +2431,7 @@ ?~ pas ~ :^ ~ ~ %noun - !> `deed:ames`[u.lyf u.pas ~] + !> [u.lyf u.pas ~] :: %earl ?. ?=([@ @ @ ~] tyl) [~ ~] diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index f907b3b547..b5027fb4b2 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -2024,7 +2024,8 @@ del/bump :: change == == :: ++ gift :: out result <-$ - $% [%init p=ship] :: report install unix + $% [%done error=(unit error:ames)] :: ames (n) ack + [%init p=ship] :: report install unix [%mass p=mass] :: memory usage report [%mack p=(unit tang)] :: message n/ack [%pubs public] :: public keys @@ -2080,6 +2081,7 @@ [%vine ~] :: view secret history $>(%wegh vane-task) :: memory usage request [%wind p=@ud] :: rewind before block + $>(%plea vane-task) :: ames request message == :: -- :: :: :: @@ -9089,53 +9091,52 @@ :: ++ snap !: - !! -:: |% -:: :: +bloq:snap:dawn: extract block number -:: :: -:: ++ bloq -:: |= snap=snapshot:kale -:: ^- (unit @ud) -:: =- ?:(?=(%| -.out) ~ (some p.out)) -:: ^= out %- mule |. -:: latest-block.snap -:: :: +czar:snap:dawn: extract galaxy table -:: :: -:: ++ czar -:: |= snap=snapshot:kale -:: ^- (unit (map ship [=life =pass])) -:: =- ?:(?=(%| -.out) ~ (some p.out)) -:: ^= out %- mule |. -:: %- ~(gas by *(map ship [=life =pass])) -:: %+ turn (gulf 0 255) -:: |= gal=@ -:: ^- [ship [life pass]] -:: :- gal -:: ~| czar-gal=gal -:: [life pass]:(need net:(~(got by pos.eth.snap) gal)) -:: :: +point:snap:dawn: extract ship's contract state -:: :: -:: ++ point -:: |= [who=ship snap=snapshot:kale] -:: ^- (unit point:azimuth) -:: (~(get by pos.eth.snap) who) -:: :: +turf:snap:dawn: extract network domains -:: :: -:: ++ turf -:: |= snap=snapshot:kale -:: ^- (unit (list ^turf)) -:: =- ?:(?=(%| -.out) ~ (some p.out)) -:: ^= out %- mule |. -:: %+ murn -:: ^- (list host:eyre) -:: %+ murn -:: ^- (list @t) -:: ~[pri sec ter]:dns.eth.snap -:: |= dom=@t -:: ^- (unit host:eyre) -:: (rush dom thos:de-purl:html) -:: |=(a=host:eyre ?:(?=(%| -.a) ~ (some p.a))) -:: -- + |% + :: +bloq:snap:dawn: extract block number + :: + ++ bloq + |= snap=snapshot:jael + ^- (unit @ud) + =- ?:(?=(%| -.out) ~ (some p.out)) + ^= out %- mule |. + latest-block.snap + :: +czar:snap:dawn: extract galaxy table + :: + ++ czar + |= snap=snapshot:jael + ^- (unit (map ship [=life =pass])) + =- ?:(?=(%| -.out) ~ (some p.out)) + ^= out %- mule |. + %- ~(gas by *(map ship [=life =pass])) + %+ turn (gulf 0 255) + |= gal=@ + ^- [ship [life pass]] + :- gal + ~| czar-gal=gal + [life pass]:(need net:(~(got by pos.eth.snap) gal)) + :: +point:snap:dawn: extract ship's contract state + :: + ++ point + |= [who=ship snap=snapshot:jael] + ^- (unit point:azimuth) + (~(get by pos.eth.snap) who) + :: +turf:snap:dawn: extract network domains + :: + ++ turf + |= snap=snapshot:jael + ^- (unit (list ^turf)) + =- ?:(?=(%| -.out) ~ (some p.out)) + ^= out %- mule |. + %+ murn + ^- (list host:eyre) + %+ murn + ^- (list @t) + ~[pri sec ter]:dns.eth.snap + |= dom=@t + ^- (unit host:eyre) + (rush dom thos:de-purl:html) + |=(a=host:eyre ?:(?=(%| -.a) ~ (some p.a))) + -- :: +veri:dawn: validate keys, life, discontinuity, &c :: ++ veri diff --git a/pkg/arvo/tests/sys/vane/alef.hoon b/pkg/arvo/tests/sys/vane/alef.hoon index 6b07920a08..9da66c3f74 100644 --- a/pkg/arvo/tests/sys/vane/alef.hoon +++ b/pkg/arvo/tests/sys/vane/alef.hoon @@ -121,14 +121,14 @@ :: =/ lane-foo=lane:alef [%| `@ux``@`%lane-foo] :: - =/ =message:alef [/g/talk [%first %post]] + =/ =plea:ames [%g /talk [%first %post]] :: =/ =shut-packet:alef :* sndr-life=4 rcvr-life=3 bone=1 message-num=1 - [%& num-fragments=1 fragment-num=0 (jam message)] + [%& num-fragments=1 fragment-num=0 (jam plea)] == :: =/ =packet:alef @@ -144,36 +144,34 @@ =/ =point:alef :* rift=1 life=4 - crypto-suite=1 - encryption-key=`@`alice-pub - authentication-key=`@`0 + keys=[[life=4 [crypto-suite=1 `@`alice-pub]] ~ ~] sponsor=`~bus == %- take - :^ bob /alien ~[//unix] + :^ bob /public-keys ~[//unix] ^- sign:alef - [%j %public-keys %full [n=[~bus point] ~ ~]] + [%k %public-keys %full [n=[~bus point] ~ ~]] :: ;: weld %+ expect-eq - !> [~[//unix] %pass /alien %j %public-keys ~bus]~ + !> [~[//unix] %pass /public-keys %k %public-keys [~bus ~ ~]]~ !> moves1 :: %+ expect-eq - !> [~[//unix] %pass /bone/~bus/1 %g %memo ~bus /g/talk [%first %post]]~ + !> [~[//unix] %pass /bone/~bus/1 %g %plea ~bus %g /talk [%first %post]]~ !> moves2 == :: ++ test-message-flow ^- tang :: =^ moves1 alice - (call alice ~[/alice] %memo ~doznec-doznec /g/talk [%get %post]) + (call alice ~[/alice] %plea ~doznec-doznec %g /talk [%get %post]) :: =^ moves2 bob (call bob ~[/bob] %hear (snag-packet 0 moves1)) =^ moves3 bob (take bob /bone/~nec/1 ~[/bob] %g %done ~) =^ moves4 alice (call alice ~[/alice] %hear (snag-packet 0 moves3)) =^ moves5 bob - (take bob /bone/~nec/1 ~[/bob] %g %memo /g/talk [%post 'first1!!']) + (take bob /bone/~nec/1 ~[/bob] %g %boon [%post 'first1!!']) :: =^ moves6 alice (call alice ~[/alice] %hear (snag-packet 0 moves5)) =^ moves7 bob (call bob ~[/bob] %hear (snag-packet 0 moves6)) @@ -187,13 +185,13 @@ !> moves4 :: %+ expect-eq - !> [~[/alice] %give %memo /g/talk %post 'first1!!'] + !> [~[/alice] %give %boon [%post 'first1!!']] !> (snag 1 `(list move:alef)`moves6) == :: ++ test-nack ^- tang =^ moves1 alice - (call alice ~[/alice] %memo ~doznec-doznec /g/talk [%get %post]) + (call alice ~[/alice] %plea ~doznec-doznec %g /talk [%get %post]) :: =^ moves2 bob (call bob ~[/bob] %hear (snag-packet 0 moves1)) =/ =error:alef [%flub [%leaf "sinusoidal repleneration"]~] diff --git a/pkg/arvo/tests/sys/vane/ames.hoon b/pkg/arvo/tests/sys/vane/ames.hoon deleted file mode 100644 index 14d17a8f4d..0000000000 --- a/pkg/arvo/tests/sys/vane/ames.hoon +++ /dev/null @@ -1,175 +0,0 @@ -/+ *test -:: -/= ames-raw /: /===/sys/vane/ames - /!noun/ -=/ type-spear -:!>(ames-raw) -:: -=/ test-pit=vase !>(.) -=/ ames-gate (ames-raw test-pit) -:: -|% -:: tests that %ames asks for private keys on %init -:: -++ test-init - =^ results1 ames-gate - =/ =duct [/ /term/1 / ~] - =/ =wire /our/~nul - %: ames-call - ames-gate - now=~1234.5.6 - call-args=[duct type=*type %soft %init ~nul] - expected-moves=[[duct %pass wire %j %vein ~] [duct %pass / %j %turf ~] ~] - == - :: - results1 -:: -:: tests that %ames sends a message to itself -:: -++ test-send - =/ now ~1234.5.6 - =/ =duct [/ /term/1 / ~] - =/ =wire /our/~nul - =/ pact1 - 0wHfb.1hdCh.0oxed.Ta7-f.4IIDV.4ku6J.PoJe7.AiyMS.w~mfu.V04ja.iXj8d.E3nq7. - gcW-a.0II6T.vb5zH.FHEkp.J7wgT.XTnuu.KaUiu.xZ6dg.qgWSH.3ovaO.dETNQ.5YAOR. - Lw8Mj.iQCrM.-TcjY.gFysP.XCfdx.52ack.MN~yA.0CNFU.0eL1M.Un-ey.CZyf9.Omk2p. - -Wbar.-w2bs.02sNg.340cg.okHUP - =/ pact2 - 0w78EWp.7898D.odZ3b.7iLvr.vyjzn.XBNaN.vxTZj.b4BFp.EHHvW.IjvpB.j0~87. - t06D0.SbrGK.QlIeE.1Xj1v.CX~YY.c9cAE.eUPSb.gj8-M.e15TJ.EPPXN.efms-.8y9og. - IdyLr.lkZJ5.KMB-F.S7mwd.t5rmo.CEYCp.3zC4n.HYh2T.RgVI8.0eT1z.Jxj9c.m1Sm5. - SaYrP.0LKO3.-w2cA.02sNg.340cg.oi9Nj - =/ vein-data - [life=1 (my [1 sec:ex:(pit:nu:crub:crypto 512 ~nul)] ~)] - :: - =^ results1 ames-gate - %: ames-call - ames-gate - now - call-args=[duct type=*type %soft [%barn ~]] - expected-moves=[[duct %give %turf ~] ~] - == - :: - =. now (add ~m1 now) - :: ~& [%fox1 now fox.ames-gate] - =^ results2 ames-gate - %: ames-take - ames-gate - now - take-args=[wire duct -:!>([%j %vein vein-data]) [%j %vein vein-data]] - expected-moves=~ - == - :: - =. now (add ~m1 now) - :: ~& [%fox2 now fox.ames-gate] - =^ results3 ames-gate - %: ames-call - ames-gate - now - call-args=[duct type=*type %soft [%want ~nul /foo 1]] - :~ [duct %pass /pubs/~nul %j %pubs ~nul] - [duct %give %send *lane:ames pact1] - :: XX why ~s4 ?? - :: - [duct %pass /ames %b %wait (add ~s4 now)] - == - == - :: - =. now (add ~m1 now) - :: ~& [%fox3 now fox.ames-gate] - =^ results4 ames-gate - %: ames-call - ames-gate - now - call-args=[duct type=*type %soft [%want ~nul /foo 2]] - expected-moves=[[duct %give %send *lane:ames pact2] ~] - == - :: - =. now (add ~m1 now) - :: ~& [%fox4 now fox.ames-gate] - =^ results5 ames-gate - %: ames-take - ames-gate - now - take-args=[wire duct -:!>([%b %wake ~]) [%b %wake ~]] - :~ [duct %give %send *lane:ames pact1] - [duct %give %send *lane:ames pact2] - [duct %pass /ames %b %wait (add ~s8 now)] - == - == - :: - :: ~& [%fox5 now fox.ames-gate] - :(weld results1 results2 results3 results4 results5) -:: -++ ames-scry - ^- sley - |= [* (unit (set monk)) =term =beam] - ^- (unit (unit cage)) - ?: =(%turf q.beam) - (some (some %noun !>(~))) - :: - ?: ?& =(%life q.beam) - =(/~nul s.beam) - == - (some (some %atom !>(1))) - :: - ?: ?& =(%saxo q.beam) - =(/~nul s.beam) - == - (some (some %noun !>([~nul ~]))) - :: - ?: ?& =(%sein q.beam) - =(/~nul s.beam) - == - (some (some %atom !>(~nul))) - :: - ?: ?& =(%deed q.beam) - =(/1/~nul s.beam) - == - =/ =deed:ames - [life=1 pub:ex:(pit:nu:crub:crypto 512 ~nul) ~] - (some (some %noun !>(deed))) - :: - ~& [%ames-scry-fail +<] - ~ -:: -++ ames-call - |= $: ames-gate=_ames-gate - now=@da - call-args=[=duct wrapped-task=(hypo (hobo task:able:ames-gate))] - expected-moves=(list move:ames-gate) - == - ^- [tang _ames-gate] - :: - =/ ames (ames-gate our=~nul now=now eny=`@`0xdead.beef ames-scry) - :: - =^ moves ames-gate - (call:ames call-args) - :: - =/ output=tang - %+ expect-eq - !> expected-moves - !> moves - :: - [output ames-gate] -:: -++ ames-take - |= $: ames-gate=_ames-gate - now=@da - take-args=[=wire =duct wrapped-sign=(hypo sign:ames-gate)] - expected-moves=(list move:ames-gate) - == - ^- [tang _ames-gate] - :: - =/ ames (ames-gate our=~nul now=now eny=`@`0xdead.beef ames-scry) - :: - =^ moves ames-gate - (take:ames take-args) - :: - =/ output=tang - %+ expect-eq - !> expected-moves - !> moves - :: - [output ames-gate] --- From 197ed0f2d4e6d6dc3adc8a84cdd191813be859bb Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 14:53:19 -0700 Subject: [PATCH 037/151] no more memory leaks --- pkg/urbit/vere/ames.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/urbit/vere/ames.c b/pkg/urbit/vere/ames.c index 1156cb67b9..83281cbea3 100644 --- a/pkg/urbit/vere/ames.c +++ b/pkg/urbit/vere/ames.c @@ -196,12 +196,12 @@ u3_ames_decode_lane(u3_atom lan) { u3_lane lan_u; lan_u.pip_w = u3r_word(0, pip); - u3z(pip); c3_assert( _(u3a_is_cat(por)) ); c3_assert( por < 65536 ); lan_u.por_s = por; + u3z(cud); return lan_u; } @@ -346,6 +346,7 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac) _ames_send(pac_u); } } + u3z(lan); u3z(pac); } /* _ames_recv_cb(): receive callback. From 27ed2bff781dd8e240b3d416424d0dabd60a718f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 18:03:40 -0700 Subject: [PATCH 038/151] resend comet attestation on packet timeout --- pkg/arvo/sys/vane/alef.hoon | 59 ++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 18e89d0531..f3168ca502 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1314,26 +1314,6 @@ $(blobs t.blobs) :: event-core - :: +attestation-packet: generate signed self-attestation for .her - :: - ++ attestation-packet - |= [her=ship =her=life] - ^- blob - :: - =/ signed=_+:*open-packet - :* ^= public-key pub:ex:crypto-core.ames-state - ^= sndr our - ^= sndr-life life.ames-state - ^= rcvr her - ^= rcvr-life her-life - == - :: - =/ =private-key sec:ex:crypto-core.ames-state - =/ =signature (sign-open-packet private-key signed) - =/ =open-packet [signature signed] - =/ =packet [[our her] encrypted=%.n origin=~ open-packet] - :: - (encode-packet packet) :: ++ update-known |= [=ship =point =peer-state] @@ -1463,6 +1443,28 @@ ?: direct.u.route event-core try-next-sponsor + :: +attestation-packet: generate signed self-attestation for .her + :: + :: Sent by a comet on first contact with a peer. Not acked. + :: + ++ attestation-packet + |= [her=ship =her=life] + ^- blob + :: + =/ signed=_+:*open-packet + :* ^= public-key pub:ex:crypto-core.ames-state + ^= sndr our + ^= sndr-life life.ames-state + ^= rcvr her + ^= rcvr-life her-life + == + :: + =/ =private-key sec:ex:crypto-core.ames-state + =/ =signature (sign-open-packet private-key signed) + =/ =open-packet [signature signed] + =/ =packet [[our her] encrypted=%.n origin=~ open-packet] + :: + (encode-packet packet) :: +got-peer-state: lookup .her state or crash :: ++ got-peer-state @@ -1523,12 +1525,29 @@ :: transport address has changed and this lane is no longer :: valid. :: + :: If .her is a galaxy, the lane will always remain direct. + :: =? route.peer-state ?& ?=(^ route.peer-state) direct.u.route.peer-state !=(%czar (clan:title her.channel)) == route.peer-state(direct.u %.n) + :: resend comet attestation packet if first message times out + :: + :: The attestation packet doesn't get acked, so if we tried to + :: send a packet but it timed out, maybe they didn't get our + :: attestation. + :: + :: Only resend on timeout of packets in the first message we + :: send them, since they should remember forever. + :: + =? event-core + ?& ?=(%pawn (clan:title our)) + =(1 current:(~(got by snd.peer-state) bone)) + == + (send-blob her.channel (attestation-packet [her her-life]:channel)) + :: maybe resend some timed out packets :: (run-message-pump bone %wake ~) :: +send-shut-packet: fire encrypted packet at rcvr and maybe sponsors From f32331cb380737670f9784b614e86deb8696abcf Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 29 Jul 2019 22:21:35 -0700 Subject: [PATCH 039/151] benchmarking printfs --- pkg/arvo/sys/vane/alef.hoon | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index f3168ca502..e6ed266b76 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2078,7 +2078,7 @@ ^+ [fragments gifts state] :: return unsent back to caller and reverse effects to finalize :: - =- ~& %alef-feed^(lent fragments)^%unsent^(lent unsent) + =- ::~& %alef-feed^(lent fragments)^%unsent^(lent unsent) [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] @@ -2139,7 +2139,7 @@ ?. found.- ~& %alef-hear-noop packet-pump - ~& %alef-hear-ack^message-num^fragment-num + ::~& %alef-hear-ack^message-num^fragment-num :: =. metrics.state metrics.- =. live.state live.- @@ -2362,7 +2362,7 @@ message-still :: ack all other packets :: - ~& %send-ack^fragment-num + ::~& %send-ack^fragment-num (give %send seq %& fragment-num) :: last-heard Date: Tue, 30 Jul 2019 16:11:19 -0700 Subject: [PATCH 040/151] behn fix crash from missing timer --- pkg/arvo/sys/vane/behn.hoon | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/behn.hoon b/pkg/arvo/sys/vane/behn.hoon index 9f9fc6f2fa..54f54e211a 100644 --- a/pkg/arvo/sys/vane/behn.hoon +++ b/pkg/arvo/sys/vane/behn.hoon @@ -103,8 +103,11 @@ ++ wake |= error=(unit tang) ^+ [moves state] + :: no-op on spurious but innocuous unix wakeups :: - ?~ timers.state ~| %behn-wake-no-timer^error !! + ?~ timers.state + ~? ?=(^ error) %behn-wake-no-timer^u.error + [moves state] :: if we errored, pop the timer and notify the client vane of the error :: ?^ error @@ -113,7 +116,6 @@ :: if unix woke us too early, retry by resetting the unix wakeup timer :: ?: (gth date.i.timers.state now) - ~? debug=%.n [%behn-wake-too-soon `@dr`(sub date.i.timers.state now)] set-unix-wake(next-wake.state ~) :: pop first timer, tell vane it has elapsed, and adjust next unix wakeup :: @@ -199,7 +201,6 @@ :: ignore duplicates :: ?: =(t i.timers) - ~? debug=%.n [%behn-set-duplicate t] timers :: timers at the same date form a fifo queue :: @@ -216,7 +217,6 @@ :: if we don't have this timer, no-op :: ?~ timers - ~? debug=%.n [%behn-unset-missing t] ~ ?: =(i.timers t) t.timers @@ -266,7 +266,7 @@ ^+ behn-gate :: ~| %behn-load-fail - behn-gate(state (behn-state old)) + behn-gate(state ;;(behn-state old)) :: +scry: view timer state :: :: TODO: not referentially transparent w.r.t. elapsed timers, From 43b35d7a0045cdda81a163ba0e8774adb693cae7 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 30 Jul 2019 19:31:15 -0700 Subject: [PATCH 041/151] ames %turf on %born --- pkg/arvo/sys/vane/alef.hoon | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index e6ed266b76..0fc993fff5 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -808,7 +808,6 @@ ++ stay ~& %alef-larva-stay [%larva queued-events ames-state.adult-gate] ++ load |= old-raw=* - ~& %alef-larva-load :: =/ old ;; $% [%larva events=_queued-events state=_ames-state.adult-gate] @@ -818,9 +817,11 @@ :: ?- -.old %adult + ~& %alef-load (load:adult-core state.old) :: %larva + ~& %alef-load-larva =. queued-events events.old =. adult-gate (load:adult-core state.old) larval-gate @@ -894,6 +895,7 @@ :: ++ load |= old-state=_ames-state + ^+ ames-gate ames-gate(ames-state old-state) :: +scry: dereference namespace :: @@ -1366,9 +1368,17 @@ == :: +on-born: handle unix process restart :: - :: TODO: scry into jael and emit turf on %born - :: - ++ on-born event-core(unix-duct.ames-state duct) + ++ on-born + ^+ event-core + :: + =. unix-duct.ames-state duct + :: + =/ turfs + ;; (list turf) + =< q.q %- need %- need + (scry-gate [%141 %noun] ~ %k `beam`[[our %turf %da now] /]) + :: + (emit unix-duct.ames-state %give %turf turfs) :: +on-vega: handle kernel reload :: ++ on-vega event-core From b1aa926fd9f9bc78eadfe6a0275916674a47b45d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 30 Jul 2019 22:56:58 -0700 Subject: [PATCH 042/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index a32cb8a230..e926598c6e 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1b00e99a32486b872d79d110ffac2fa2c0d0a3cb42e5d7748df8a32bbe5bb13 -size 9857182 +oid sha256:4c1b511e67f557ce6d59da29a70f7c6a305e12aef9abcefa217f99a16ac26aad +size 9870738 From bdd1aaf87d4a5ca764dd9567394e736eb2431881 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 11:23:12 -0700 Subject: [PATCH 043/151] fix test scry --- pkg/arvo/tests/sys/vane/alef.hoon | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/tests/sys/vane/alef.hoon b/pkg/arvo/tests/sys/vane/alef.hoon index 9da66c3f74..42e904f482 100644 --- a/pkg/arvo/tests/sys/vane/alef.hoon +++ b/pkg/arvo/tests/sys/vane/alef.hoon @@ -8,13 +8,15 @@ =/ alice vane =/ bob vane :: -=. our.alice ~nec -=. now.alice ~1111.1.1 -=. eny.alice 0xdead.beef +=. our.alice ~nec +=. now.alice ~1111.1.1 +=. eny.alice 0xdead.beef +=. scry-gate.alice |=(* ``[%noun !>(*(list turf))]) :: -=. our.bob ~doznec-doznec -=. now.bob ~1111.1.1 -=. eny.bob 0xbeef.dead +=. our.bob ~doznec-doznec +=. now.bob ~1111.1.1 +=. eny.bob 0xbeef.dead +=. scry-gate.bob |=(* ``[%noun !>(*(list turf))]) :: =. crypto-core.ames-state.alice (pit:nu:crub:crypto 512 (shaz 'alice')) =. crypto-core.ames-state.bob (pit:nu:crub:crypto 512 (shaz 'bob')) From 0c632e88118a949c14a4219719ee7bd63e9ba5d9 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 11:51:31 -0700 Subject: [PATCH 044/151] fix |reload %a --- pkg/arvo/sys/vane/alef.hoon | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 0fc993fff5..94c17991db 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -807,13 +807,10 @@ ++ scry scry:adult-core ++ stay ~& %alef-larva-stay [%larva queued-events ames-state.adult-gate] ++ load - |= old-raw=* - :: - =/ old - ;; $% [%larva events=_queued-events state=_ames-state.adult-gate] - [%adult state=_ames-state.adult-gate] - == - old-raw + |= $= old + $% [%larva events=_queued-events state=_ames-state.adult-gate] + [%adult state=_ames-state.adult-gate] + == :: ?- -.old %adult From c578d3282a7b469db699201bcb60e09c5e839998 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 13:55:05 -0700 Subject: [PATCH 045/151] testnet config --- bin/ivory.pill | 4 ++-- bin/solid.pill | 4 ++-- pkg/arvo/app/acme.hoon | 2 +- pkg/arvo/sys/zuse.hoon | 7 ++++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/ivory.pill b/bin/ivory.pill index b8eb687de6..45499f9ea5 100644 --- a/bin/ivory.pill +++ b/bin/ivory.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0e520b9ab0232d1765e1dacde96a1210845768e7334a334b5705d1c40348c82b -size 4464201 +oid sha256:44dac7f4c8d7940e86eaf0ee8d9bab06bef68ded19aa82182315eb9970bcaf73 +size 5071926 diff --git a/bin/solid.pill b/bin/solid.pill index e926598c6e..ab1dba0849 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c1b511e67f557ce6d59da29a70f7c6a305e12aef9abcefa217f99a16ac26aad -size 9870738 +oid sha256:e92f44aa9c55cbe0a3f5ae9b6eebf99fd806ef20b4e3b4f52bb2198343430d59 +size 9945488 diff --git a/pkg/arvo/app/acme.hoon b/pkg/arvo/app/acme.hoon index bb0df2ae4f..b61795b6af 100644 --- a/pkg/arvo/app/acme.hoon +++ b/pkg/arvo/app/acme.hoon @@ -344,7 +344,7 @@ :: =/ directory-base=purl =- (need (de-purl:html -)) - 'https://acme-v02.api.letsencrypt.org/directory' + 'https://acme-staging-v02.api.letsencrypt.org/directory' :: mov: list of outgoing moves for the current transaction :: =| mov=(list move) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index b5027fb4b2..1f341dea07 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -7736,8 +7736,8 @@ |% :: azimuth: data contract :: - ++ azimuth 0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb :: mainnet - :: ++ azimuth 0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579 :: ropsten + :: ++ azimuth 0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb :: mainnet + ++ azimuth 0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579 :: ropsten :: ++ azimuth 0x863d.9c2e.5c4c.1335.96cf.ac29.d552.55f0.d0f8.6381 :: local bridge :: ++ linear-star-release @@ -7748,7 +7748,8 @@ :: :: launch: block number of azimuth deploy :: - ++ launch 6.784.800 + :: ++ launch 6.784.800 + ++ launch 4.601.630 :: :: public: block number of azimuth becoming independent :: From 8fd260f9f88bd4e279ea7b85758243226dde8062 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 14:21:07 -0700 Subject: [PATCH 046/151] print more --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index ab1dba0849..ff4583b501 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e92f44aa9c55cbe0a3f5ae9b6eebf99fd806ef20b4e3b4f52bb2198343430d59 -size 9945488 +oid sha256:2e22d240ac19848f8d7a24bfc58c546d98237e4041c9007d48ba636de76b3bcc +size 9947077 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 94c17991db..4ddf412ecb 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2541,6 +2541,7 @@ |= =wire ^- [her=ship =bone] :: + ~| %ames-wire-bone^wire ?> ?=([%bone @ @ ~] wire) [`@p`(slav %p i.t.wire) `@ud`(slav %ud i.t.t.wire)] :: +make-pump-timer-wire: construct wire for |packet-pump timer @@ -2555,6 +2556,7 @@ |= =wire ^- [her=ship =bone] :: + ~| %ames-wire-timer^wire ?> ?=([%pump @ @ ~] wire) [`@p`(slav %p i.t.wire) `@ud`(slav %ud i.t.t.wire)] :: +sign-open-packet: sign the contents of an $open-packet @@ -2658,14 +2660,18 @@ =/ rcvr-size (decode-ship-size (cut 0 [25 2] header)) =/ encrypted ?+((cut 0 [27 5] header) !! %0 %.y, %1 %.n) :: - ?> =(protocol-version version) - ?> =(checksum (end 0 20 (mug body))) - :: =/ =dyad :- sndr=(end 3 sndr-size body) rcvr=(cut 3 [sndr-size rcvr-size] body) :: - =+ ;; [origin=(unit lane) content=*] + ?. =(protocol-version version) + ~| %ames-protocol^version^dyad !! + ?. =(checksum (end 0 20 (mug body))) + ~| %ames-checksum^dyad !! + :: + =+ ~| %ames-invalid-packet + ;; [origin=(unit lane) content=*] + ~| %ames-invalid-noun %- cue (rsh 3 (add rcvr-size sndr-size) body) :: From 2068b41140977a23e82c94413ed3bb61eaaa2bb9 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 19:51:11 -0700 Subject: [PATCH 047/151] fix kale ducts --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/kale.hoon | 191 ++++++++++++++++++++---------------- 2 files changed, 109 insertions(+), 86 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index ff4583b501..01ad2c787f 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e22d240ac19848f8d7a24bfc58c546d98237e4041c9007d48ba636de76b3bcc -size 9947077 +oid sha256:bacb35feea08c3f18e39ecbd06b5c941e1db9cf63d1a5c64aa79e5d283302ca8 +size 9950726 diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index bd97fdb2ca..61c2b65993 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -43,7 +43,7 @@ == :: +$ state-pki :: urbit metadata $: $= own :: vault (vein) - $: yen=(set duct) :: trackers + $: yen=(set tracker) :: trackers sig=(unit oath) :: for a moon tuf=(list turf) :: domains boq=@ud :: boot block @@ -53,8 +53,8 @@ jaw=(map life ring) :: private keys == :: $= zim :: public - $: yen=(jug duct ship) :: trackers - ney=(jug ship duct) :: reverse trackers + $: yen=(jug tracker ship) :: trackers + ney=(jug ship tracker) :: reverse trackers dns=dnses :: on-chain dns state pos=(map ship point) :: on-chain ship state == :: @@ -73,6 +73,9 @@ +$ message-response :: response from her kale $% [%public-keys-result =public-keys-result] :: %public-keys response == +:: $tracker: client; either domestic (here=%.y) or foreign +:: ++$ tracker [here=? =duct] +$ card :: i/o action (wind note gift) :: :: :: @@ -93,9 +96,10 @@ :: :: +$ sign :: in result $<- $~ [%a %done ~] :: - $% [%a $>(%boon gift:able:ames)] :: message response - [%a $>(%done gift:able:ames)] :: message (n)ack - == :: + $% $: %a + $% $>(%boon gift:able:ames) :: message response + $>(%done gift:able:ames) :: message (n)ack + == == == -- :: :: :::: :::: # light :: light cores @@ -194,9 +198,11 @@ [who ?:(=(who dad) ~ $(who dad))] :: :: ++call:of ++ call :: invoke - |= $: :: hen: event cause + |= $: :: hyr: domestic? or foreign + :: hen: event cause :: tac: event data :: + hyr=? hen/duct tac/task == @@ -261,7 +267,7 @@ +>.^$ =. +>.^$ %- curd =< abet - %- public-keys:~(feel su hen our pki etn sap) + %- public-keys:~(feel su hyr hen our pki etn sap) [%diff ship diff]:i.diffs $(diffs t.diffs) :: @@ -340,39 +346,17 @@ %listen ~& [%kale-listen whos source]:tac %- curd =< abet - (sources:~(feel su hen our pki etn sap) [whos source]:tac) + (sources:~(feel su hyr hen our pki etn sap) [whos source]:tac) :: :: cancel all trackers from duct :: {$nuke whos=(set ship)} :: - $nuke - =/ ships=(list ship) - %~ tap in - %- ~(int in whos.tac) - (~(get ju yen.zim.pki) hen) - =. ney.zim.pki - |- ^- (jug ship duct) - ?~ ships - ney.zim.pki - (~(del ju $(ships t.ships)) i.ships hen) - =. yen.zim.pki - |- ^- (jug duct ship) - ?~ ships - yen.zim.pki - (~(del ju $(ships t.ships)) hen i.ships) - ?^ whos.tac - +>.$ - %_ +>.$ - yen.own.pki (~(del in yen.own.pki) hen) - yen.etn (~(del in yen.etn) hen) - == + $nuke (on-nuke [hyr hen] whos.tac) :: :: watch public keys :: [%public-keys ships=(set ship)] :: - %public-keys - %- curd =< abet - (~(public-keys ~(feed su hen our pki etn sap) hen) ships.tac) + %public-keys (on-public-keys [hyr hen] ships.tac) :: :: seen after breach :: [%meet our=ship who=ship] @@ -392,7 +376,7 @@ :: %sources ~& [%kale-sources] - (curd abet:~(sources ~(feed su hen our pki etn sap) hen)) + (curd abet:~(sources ~(feed su hyr hen our pki etn sap) hyr hen)) :: :: XX should be a subscription :: XX reconcile with .dns.eth @@ -412,7 +396,7 @@ %new-event ~& [%kale-new-event ship udiff]:tac %- curd =< abet - (~(new-event su hen our pki etn sap) ship.tac udiff.tac) + (~(new-event su hyr hen our pki etn sap) ship.tac udiff.tac) :: :: learn of kernel upgrade :: [%vega ~] @@ -424,7 +408,7 @@ :: {$private-keys $~} :: %private-keys - (curd abet:~(private-keys ~(feed su hen our pki etn sap) hen)) + (curd abet:~(private-keys ~(feed su hyr hen our pki etn sap) hyr hen)) :: %wegh %_ +> @@ -445,23 +429,15 @@ :: [%plea =ship =plea:ames] :: %plea - =* her ship.tac - =/ mes (message payload.plea.tac) - ?- -.mes + :: send ack immediately :: - :: cancel trackers - :: [%nuke whos=(set ship)] + =. moz [[hen %give %done ~] moz] + :: coerce and handle message :: - %nuke - =. moz [[hen %give %done ~] moz] - $(tac mes) - :: - :: view ethereum events - :: [%public-keys whos=(set ship)] - :: - %public-keys - =. moz [[hen %give %done ~] moz] - $(tac mes) + =/ mes ;;(message payload.plea.tac) + ?- -.mes + %nuke (on-nuke [hyr hen] whos.mes) + %public-keys (on-public-keys [hyr hen] whos.mes) == :: :: rewind to snapshot @@ -470,10 +446,46 @@ %wind (wind hen p.tac) == + :: +on-nuke: cancel trackers + :: + ++ on-nuke + |= [=tracker whos=(set ship)] + ^+ +> + :: + =/ ships=(list ship) + %~ tap in + %- ~(int in whos) + (~(get ju yen.zim.pki) tracker) + =. ney.zim.pki + |- ^- (jug ship ^tracker) + ?~ ships + ney.zim.pki + (~(del ju $(ships t.ships)) i.ships tracker) + =. yen.zim.pki + |- ^- (jug ^tracker ship) + ?~ ships + yen.zim.pki + (~(del ju $(ships t.ships)) tracker i.ships) + ?^ whos + +>.$ + %_ +>.$ + yen.own.pki (~(del in yen.own.pki) tracker) + yen.etn (~(del in yen.etn) tracker) + == + :: + ++ on-public-keys + |= [=tracker whos=(set ship)] + ^+ +> + :: + =/ feeder ~(feed su here.tracker duct.tracker our pki etn sap) + (curd abet:(~(public-keys feeder tracker) whos)) :: ++ take - |= [tea=wire hen=duct hin=sign] + |= [tea=wire hyr=? hen=duct hin=sign] ^+ +> + :: at the moment, we only get a +sign from ames + :: + ?> hyr ?> ?=([@ *] tea) =* wir t.tea ?- hin @@ -490,7 +502,7 @@ ?> ?=(%public-keys-result -.res) :: %- curd =< abet - (public-keys:~(feel su hen our pki etn sap) public-keys-result.res) + (public-keys:~(feel su hyr hen our pki etn sap) public-keys-result.res) == :: :: ++curd:of ++ curd :: relative moves @@ -535,7 +547,8 @@ :: any subscribers. :: =| moz=(list move) - =| $: hen=duct + =| $: hyr=? + hen=duct our=ship state-pki state-eth-node @@ -544,9 +557,9 @@ :: moz: moves in reverse order :: pki: relative urbit state :: - =* pki ->+< - =* etn ->+>- - =* sap ->+>+ + =* pki &4.- + =* etn &5.- + =* sap |5.- |% ++ this-su . :: :: ++abet:su @@ -565,17 +578,15 @@ $(noy t.noy, moz [[i.noy cad] moz]) :: ++ public-keys-give - |= [yen=(set duct) =public-keys-result] + |= [yen=(set tracker) =public-keys-result] =+ yez=~(tap in yen) |- ^+ this-su ?~ yez this-su - =* d i.yez + =* t i.yez =. this-su - :: TODO: stop looking at the duct - :: - ?. ?=([[%a *] *] d) - (emit d %give %public-keys public-keys-result) - (emit d %give %boon %public-keys-result public-keys-result) + ?: here.t + (emit duct.t %give %public-keys public-keys-result) + (emit duct.t %give %boon %public-keys-result public-keys-result) $(yez t.yez) :: ++ get-source @@ -613,20 +624,24 @@ ~ :: :: ++feed:su ++ feed :: subscribe to view - |_ :: hen: subscription source + |_ :: hyr: domestic? or foreign + :: hen: subscription source :: - hen/duct + $: hyr=? + hen=duct + == :: ++ public-keys |= whos=(set ship) + ^+ ..feed ?: fak.own.pki (public-keys:fake whos) =. ney.zim =/ whol=(list ship) ~(tap in whos) - |- ^- (jug ship duct) + |- ^- (jug ship tracker) ?~ whol ney.zim - (~(put ju $(whol t.whol)) i.whol hen) + (~(put ju $(whol t.whol)) i.whol [hyr hen]) =/ =public-keys-result :- %full ?: =(~ whos) @@ -644,14 +659,14 @@ %- ~(gas ju yen.zim) %+ turn ~(tap in whos) |= who=ship - [hen who] - =. ..feed (public-keys-give (sy hen ~) public-keys-result) + [[hyr hen] who] + =. ..feed (public-keys-give (sy [hyr hen] ~) public-keys-result) ..feed :: ++ private-keys :: private keys %_ ..feed moz [[hen %give %private-keys [lyf jaw]:own] moz] - yen.own (~(put in yen.own) hen) + yen.own (~(put in yen.own) hyr hen) == :: ++ sources @@ -693,14 +708,14 @@ :: :: ++pubs:feel:su ++ public-keys |= =public-keys-result - ^+ ..feel + ^+ this-su ?: ?=(%full -.public-keys-result) =. pos.zim (~(uni by pos.zim) points.public-keys-result) =/ pointl=(list [who=ship =point]) ~(tap by points.public-keys-result) - |- ^+ ..feel + |- ^+ this-su ?~ pointl - ..feel + this-su %+ public-keys-give (~(get ju ney.zim) who.i.pointl) [%full (my i.pointl ~)] @@ -734,27 +749,30 @@ :: :: ++vein:feel:su ++ private-keys :: kick private keys |= [=life =ring] - ^+ ..feel + ^+ this-su ?: &(=(lyf.own life) =((~(get by jaw.own) life) `ring)) - ..feel + this-su =. lyf.own life =. jaw.own (~(put by jaw.own) life ring) - (exec yen.own [%give %private-keys lyf.own jaw.own]) + =/ yen (~(run in yen.own) tail) + (exec yen [%give %private-keys lyf.own jaw.own]) :: ++ sources |= [whos=(set ship) =source] - ^+ ..feel + ^+ this-su ?: ?=(%& -.source) =/ send-message |= =message [hen %pass /public-keys %a %plea p.source %k /public-keys message] - =. ..feel + =. this-su (emit (send-message %nuke whos)) (emit (send-message %public-keys whos)) =^ =source-id this-su (get-source-id source) - =. ..feed + =. this-su ?~ whos - ..feed(default-source.etn source-id) + :: + =. default-source.etn source-id + this-su =/ whol=(list ship) ~(tap in `(set ship)`whos) =. ship-sources.etn |- ^- (map ship ^source-id) @@ -764,7 +782,7 @@ =. ship-sources-reverse %- ~(gas ju ship-sources-reverse) (turn whol |=(=ship [source-id ship])) - ..feed + this-su (exec yen.etn [%give %source whos source]) -- :: :: ++meet:su @@ -808,8 +826,9 @@ ?. ?=($soft -.q.hic) q.hic (task:able p.q.hic) + =/ here=? !=(%plea -.task) =^ did lex - abet:(~(call of [our now eny] lex) hen task) + abet:(~(call of [our now eny] lex) here hen task) [did ..^$] :: :: ++load ++ load :: upgrade @@ -1007,6 +1026,10 @@ hin/(hypo sign) == ^- [(list move) _..^$] - =^ did lex abet:(~(take of [our now eny] lex) tea hen q.hin) + =/ =sign q.hin + ?> ?=(%a -.sign) + ?> ?=(?(%boon %done) +<.sign) + =/ here=? %.y + =^ did lex abet:(~(take of [our now eny] lex) tea here hen sign) [did ..^$] -- From 83500256d87789dab5d4080922f2d7f26c6110bb Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 20:14:28 -0700 Subject: [PATCH 048/151] debug printfs --- pkg/arvo/sys/arvo.hoon | 2 +- pkg/arvo/sys/vane/alef.hoon | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 0d53a7cfed..6202c597ab 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -649,7 +649,7 @@ :: =/ pit=vase !>(..is) :: =/ vil=vile (viol p.pit) :: cached reflexives -=| $: lac=_& :: laconic bit +=| $: lac=_| :: laconic bit eny=@ :: entropy our=ship :: identity bud=vase :: %zuse diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 4ddf412ecb..ca05153767 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -973,10 +973,13 @@ %. +< :: ?. =(our rcvr.packet) + ~& %on-hear-forward on-hear-forward :: ?: encrypted.packet + ~& %on-hear-shut on-hear-shut + ~& %on-hear-open on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: @@ -1504,7 +1507,9 @@ =/ =bone bone.shut-packet :: ?: ?=(%& -.meat.shut-packet) + ~& %run-message-still (run-message-still bone %hear lane shut-packet) + ~& %run-message-pump (run-message-pump bone %hear [message-num +.meat]:shut-packet) :: +on-memo: handle request to send message :: @@ -2344,6 +2349,7 @@ :: ignore messages from far future; limit to 10 in progress :: ?: (gte seq (add 10 last-acked.state)) + ~& %ignoring-message-from-future^seq^last-acked.state message-still :: =/ is-last-fragment=? =(+(fragment-num) num-fragments) @@ -2366,10 +2372,11 @@ ?: is-last-fragment :: drop last packet since we don't know whether to ack or nack :: + ~& %repeat-last-unprocessed^seq^last-heard.state message-still :: ack all other packets :: - ::~& %send-ack^fragment-num + ~& %send-ack^fragment-num (give %send seq %& fragment-num) :: last-heard Date: Wed, 31 Jul 2019 20:21:54 -0700 Subject: [PATCH 049/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 01ad2c787f..a431f0f47a 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bacb35feea08c3f18e39ecbd06b5c941e1db9cf63d1a5c64aa79e5d283302ca8 -size 9950726 +oid sha256:fc161e969f17fcaf42534bf9b224e3400f7a39ec17686202aed03cfec2966f73 +size 9950706 From 503d53a55efabd5d3eeb39609e80199555dc867c Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 20:33:18 -0700 Subject: [PATCH 050/151] actually make a new pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index a431f0f47a..abc5d81889 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fc161e969f17fcaf42534bf9b224e3400f7a39ec17686202aed03cfec2966f73 -size 9950706 +oid sha256:6d111552699d22e06bf7fbba7b48c596410271ce3a0a4498bd5e7d78c9b46e59 +size 9952998 From c9af213e77155e3433d8b57f495b1275fad25037 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 31 Jul 2019 21:24:54 -0700 Subject: [PATCH 051/151] moar printfs --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index abc5d81889..dedb69d404 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6d111552699d22e06bf7fbba7b48c596410271ce3a0a4498bd5e7d78c9b46e59 -size 9952998 +oid sha256:a75f2f65ec572711902550a1f1cd03ded180bf3afb0b9865acf70c69dec83d2d +size 9951118 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index ca05153767..70d946752a 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1259,10 +1259,13 @@ :: =. event-core ?~ ship-state=(~(get by peers.ames-state) ship) + ~& %alef-fresh-peer^ship^point (fresh-peer ship point) :: ?: ?=([~ %alien *] ship-state) + ~& %alef-meet-alien^ship^point (meet-alien ship point +.u.ship-state) + ~& %alef-update-known^ship^point (update-known ship point +.u.ship-state) :: $(points t.points) @@ -1277,7 +1280,6 @@ ++ meet-alien |= [=ship =point todos=pending-requests] ^+ event-core - ~& %alef-meet-alien^ship :: =/ =public-key pass:(~(got by keys.point) life.point) =. event-core @@ -1507,9 +1509,7 @@ =/ =bone bone.shut-packet :: ?: ?=(%& -.meat.shut-packet) - ~& %run-message-still (run-message-still bone %hear lane shut-packet) - ~& %run-message-pump (run-message-pump bone %hear [message-num +.meat]:shut-packet) :: +on-memo: handle request to send message :: @@ -2349,7 +2349,7 @@ :: ignore messages from far future; limit to 10 in progress :: ?: (gte seq (add 10 last-acked.state)) - ~& %ignoring-message-from-future^seq^last-acked.state + ~& %ignoring-packet-from-future^seq^last-acked.state message-still :: =/ is-last-fragment=? =(+(fragment-num) num-fragments) @@ -2359,12 +2359,12 @@ ?. is-last-fragment :: single packet ack :: - ~& %send-dupe-ack^fragment-num + ~& %send-dupe-ack^seq^fragment-num (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) - ~& %send-dupe-ack-whole-message + ~& %send-dupe-ack-whole-message^seq (give %send seq %| ok lag=`@dr`0) :: last-acked Date: Wed, 31 Jul 2019 21:45:31 -0700 Subject: [PATCH 052/151] print even more --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index dedb69d404..a88dbf1af0 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a75f2f65ec572711902550a1f1cd03ded180bf3afb0b9865acf70c69dec83d2d -size 9951118 +oid sha256:ec30f9b4fdc9c540a7ef41a8f5d7668acf26990baf4fa5507dd66aac33b3532c +size 9951869 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 70d946752a..2cac238b94 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1209,6 +1209,7 @@ |= [=ship =rift] ^+ event-core :: + ~& %alef-breach^ship^rift =. peers.ames-state (~(del by peers.ames-state) ship) event-core :: +on-publ-rekey: handle new key for peer @@ -1223,6 +1224,7 @@ == ^+ event-core :: + ~& %alef-rekey^ship^life^public-key (insert-peer-state ship (got-peer-state ship) life public-key) :: +on-publ-sponsor: handle new or lost sponsor for self or peer :: @@ -1250,6 +1252,7 @@ ++ on-publ-full |= points=(map ship point) ^+ event-core + ~& %alef-on-publ-full :: => .(points ~(tap by points)) |^ ^+ event-core From e16fb70512bf34975f5394393fdd0feacac8dd1d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 1 Aug 2019 16:27:04 -0700 Subject: [PATCH 053/151] fix kale gall take bug --- pkg/arvo/sys/vane/kale.hoon | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index 764838738a..790c271a17 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -522,11 +522,11 @@ (curd abet:(~(public-keys feeder tracker) whos)) :: ++ take - |= [tea=wire hyr=? hen=duct hin=sign] + |= [tea=wire hen=duct hin=sign] ^+ +> :: at the moment, we only get a +sign from ames :: - ?> hyr + =/ hyr=? %.y ?> ?=([@ *] tea) =* wir t.tea ?- hin @@ -1153,9 +1153,6 @@ == ^- [(list move) _..^$] =/ =sign q.hin - ?> ?=(%a -.sign) - ?> ?=(?(%boon %done) +<.sign) - =/ here=? %.y - =^ did lex abet:(~(take of [our now eny] lex) tea here hen sign) + =^ did lex abet:(~(take of [our now eny] lex) tea hen sign) [did ..^$] -- From 71ff3e5bd0da2af7af83bce5a9c393fc16a454f2 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 1 Aug 2019 16:27:33 -0700 Subject: [PATCH 054/151] fix alef aqua tests --- pkg/arvo/app/aqua-ames.hoon | 2 +- pkg/arvo/app/aqua.hoon | 2 +- pkg/arvo/app/ph.hoon | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/aqua-ames.hoon b/pkg/arvo/app/aqua-ames.hoon index 96e77f8092..6db84b86f4 100644 --- a/pkg/arvo/app/aqua-ames.hoon +++ b/pkg/arvo/app/aqua-ames.hoon @@ -68,7 +68,7 @@ ++ handle-restore |= who=@p %- emit-aqua-events - [%event who [//newt/0v1n.2m9vh %barn ~]]~ + [%event who [//newt/0v1n.2m9vh %born ~]]~ :: ++ handle-send |= [way=wire %send lan=lane:ames pac=@] diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index 38686c89fa..fe576fa6fe 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -429,7 +429,7 @@ ^- (list unix-event) :~ [/ %wack 0] :: eny [/ %whom who.ae] :: eny - [//newt/0v1n.2m9vh %barn ~] + [//newt/0v1n.2m9vh %born ~] [//behn/0v1n.2m9vh %born ~] :+ //term/1 %boot ?~ keys.ae diff --git a/pkg/arvo/app/ph.hoon b/pkg/arvo/app/ph.hoon index caebee4f91..34ece13b74 100644 --- a/pkg/arvo/app/ph.hoon +++ b/pkg/arvo/app/ph.hoon @@ -125,6 +125,19 @@ ~& > %bud-done (send-hi ~bud ~dev) (pure:m ~) + :: + :+ %hi-marbud-az + ~[~bud ~marbud] + =. eth-node (spawn:eth-node ~marbud) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud)) + ~& > 'MARBUD-DONE' + ;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud)) + ~& > 'BUD-DONE' + (send-hi ~bud ~marbud) + (pure:m ~) :: :+ %breach-hi ~[~bud ~dev] From 20b1ec9d5679c6604a2bcc18097c1eb6e03872d8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 1 Aug 2019 16:27:52 -0700 Subject: [PATCH 055/151] turn off |verb --- pkg/arvo/sys/arvo.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index b4bb9f9de3..a9f11e0113 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -649,7 +649,7 @@ :: =/ pit=vase !>(..is) :: =/ vil=vile (viol p.pit) :: cached reflexives -=| $: lac=_| :: laconic bit +=| $: lac=_& :: laconic bit eny=@ :: entropy our=ship :: identity bud=vase :: %zuse From fce0e555ebddb59dce7f6f15ee31ecfaba8eac25 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 1 Aug 2019 16:29:09 -0700 Subject: [PATCH 056/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 0779de5875..f38b5d6a95 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65c2ea4e7acacc3fb89a4aa91fb7d3c5e02c9026e88b8af15e0046c72299c6ed -size 10211870 +oid sha256:f2d5d15da203868617d88f3fbd412136cb99515d7366cc7cb3908c4ef15fa9d5 +size 10283885 From 5b9efe3c4fe085c9f54a6847d81edd4019e32f51 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 1 Aug 2019 16:46:36 -0700 Subject: [PATCH 057/151] remove the most annoying alef printfs --- pkg/arvo/sys/vane/alef.hoon | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 2cac238b94..2d0a254471 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -967,19 +967,16 @@ ^+ event-core :: ?: =(our sndr.packet) - ~& %alef-self + ::~& %alef-self event-core :: %. +< :: ?. =(our rcvr.packet) - ~& %on-hear-forward on-hear-forward :: ?: encrypted.packet - ~& %on-hear-shut on-hear-shut - ~& %on-hear-open on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: @@ -2379,7 +2376,7 @@ message-still :: ack all other packets :: - ~& %send-ack^seq^fragment-num + ::~& %send-ack^seq^fragment-num (give %send seq %& fragment-num) :: last-heard Date: Thu, 1 Aug 2019 16:47:41 -0700 Subject: [PATCH 058/151] remove spammy azimuth-tracker printfs --- pkg/arvo/app/azimuth-tracker.hoon | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/arvo/app/azimuth-tracker.hoon b/pkg/arvo/app/azimuth-tracker.hoon index 15d68c84f9..8cb3aba1b1 100644 --- a/pkg/arvo/app/azimuth-tracker.hoon +++ b/pkg/arvo/app/azimuth-tracker.hoon @@ -148,7 +148,6 @@ =/ m (async:stdio ,block) ^- form:m ;< =json bind:m (request-rpc url `'block number' %eth-block-number ~) - ~& [%block-number json (parse-eth-block-number:rpc:ethereum json)] (get-block-by-number url (parse-eth-block-number:rpc:ethereum json)) :: ++ get-block-by-number @@ -297,7 +296,6 @@ ;< state=app-state bind:m (zoom state number.id.latest-block) |- ^- form:m =* walk-loop $ - ~& [%walk-loop number.state] ?: (gth number.state number.id.latest-block) ;< now=@da bind:m get-time:stdio ;< ~ bind:m (wait-effect:stdio (add now ~s10)) @@ -318,7 +316,6 @@ |= [url=@ta whos=(set ship) =a=pending-udiffs =block blocks=(list block)] =/ m (async:stdio ,[pending-udiffs (lest ^block)]) ^- form:m - ~& [%taking id.block] ?: &(?=(^ blocks) !=(parent-hash.block hash.id.i.blocks)) ~& %rewinding (rewind url a-pending-udiffs block blocks) From 3d31a2ecb9a60bcbe2ca76f018350a411906b055 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 13:04:57 -0700 Subject: [PATCH 059/151] fix aqua for alef --- pkg/arvo/app/aqua.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index fe576fa6fe..cf0282c70a 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -359,7 +359,7 @@ %^ slum installed.boot-ova.pil now.hid =/ vane ?+ v ~|([%unknown-vane v] !!) - %a %ames + %a %alef %b %behn %c %clay %d %dill From 53d9b41a802204176e9f2261b4b0ce39cd9881cd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 13:58:53 -0700 Subject: [PATCH 060/151] fixed alef bone<->duct mapping and therefore %breah-sudden ph test --- pkg/arvo/sys/vane/alef.hoon | 129 ++++++++++++++++-------------------- pkg/arvo/sys/vane/clay.hoon | 27 +++++++- 2 files changed, 81 insertions(+), 75 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 2d0a254471..2841a44e00 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -747,6 +747,7 @@ ?. ?=(%soft -.wrapped-task) wrapped-task ;;(task p.wrapped-task) + ~& %ames-call^our^-.task :: %born: set .unix-duct and start draining .queued-events :: ?: ?=(%born -.task) @@ -772,6 +773,7 @@ :: ++ take |= [=wire =duct type=* =sign] + ~& %ames-take^our^-.sign :: enqueue event if not a larval drainage timer :: ?. =(/larva wire) @@ -781,7 +783,7 @@ :: larval event drainage timer; pop and process a queued event :: ?. ?=([%b %wake *] sign) - ~& %alef-larva-wtf^sign + ~& %alef-larva-wtf [~ larval-gate] ~& %alef-larva-wake =^ first-event queued-events ~(get to queued-events) @@ -851,7 +853,7 @@ =< abet ?- -.task %born on-born:event-core - %crud ~& %ames-crud^p.task + %crud ~& %ames-crud^our^p.task %- (slog q.task) event-core %hear (on-hear:event-core [lane blob]:task) @@ -911,7 +913,9 @@ |% ++ event-core . ++ abet [(flop moves) ames-state] - ++ emit |=(=move event-core(moves [move moves])) + ++ emit + |= =move + event-core(moves [move moves]) :: +on-take-done: handle notice from vane that it processed a message :: ++ on-take-done @@ -1101,6 +1105,7 @@ :: =/ =peer-state (got-peer-state her) =/ =channel [[our her] now +>.ames-state -.peer-state] + ~& %ames-take-boon^our^her^bone=bone :: abet:(on-memo:(make-peer-core peer-state channel) bone payload) :: +on-plea: handle request to send message @@ -1119,7 +1124,8 @@ =/ =peer-state +.u.ship-state =/ =channel [[our ship] now +>.ames-state -.peer-state] :: - =^ =bone ossuary.peer-state (get-bone ossuary.peer-state duct) + =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) + ~& %ames-plea^our^ship^[bone=bone]^vane.plea^path.plea :: abet:(on-memo:(make-peer-core peer-state channel) bone plea) :: +on-take-wake: receive wakeup or error notification from behn @@ -1206,7 +1212,7 @@ |= [=ship =rift] ^+ event-core :: - ~& %alef-breach^ship^rift + ~& %alef-breach^our^ship^rift =. peers.ames-state (~(del by peers.ames-state) ship) event-core :: +on-publ-rekey: handle new key for peer @@ -1221,7 +1227,7 @@ == ^+ event-core :: - ~& %alef-rekey^ship^life^public-key + ~& %alef-rekey^our^ship^life^public-key (insert-peer-state ship (got-peer-state ship) life public-key) :: +on-publ-sponsor: handle new or lost sponsor for self or peer :: @@ -1238,7 +1244,7 @@ =/ =peer-state (got-peer-state ship) :: ?~ sponsor - ~| %lost-sponsor^ship !! + ~| %lost-sponsor^our^ship !! :: =. sponsor.peer-state u.sponsor :: @@ -1249,7 +1255,7 @@ ++ on-publ-full |= points=(map ship point) ^+ event-core - ~& %alef-on-publ-full + ~& %alef-on-publ-full^our :: => .(points ~(tap by points)) |^ ^+ event-core @@ -1577,6 +1583,13 @@ :: =. event-core (send-blob her.channel blob) peer-core + :: +got-duct: look up $duct by .bone, asserting already bound + :: + ++ got-duct + |= =bone + ^- ^duct + ~| %dangling-bone^her.channel^bone + (~(got by by-bone.ossuary.peer-state) bone) :: +run-message-pump: process $message-pump-task and its effects :: ++ run-message-pump @@ -1587,9 +1600,6 @@ =/ =message-pump-state (~(gut by snd.peer-state) bone *message-pump-state) :: - =^ client-duct ossuary.peer-state - (get-duct ossuary.peer-state bone duct) - :: =/ message-pump (make-message-pump message-pump-state channel) =^ pump-gifts message-pump-state (work:message-pump task) =. snd.peer-state (~(put by snd.peer-state) bone message-pump-state) @@ -1626,16 +1636,14 @@ :: not a nack-trace bone; positive ack gets emitted trivially :: ?: ok - (emit client-duct %give %done error=~) + (emit (got-duct bone) %give %done error=~) :: nack; enqueue, pending nack-trace message :: + :: The pump must never emit duplicate acks. If we heard the + :: nack-trace message already, the pump should not generate a + :: duplicate %done event when we hear a message nack packet. + :: =/ nax-key [bone message-num] - :: sanity check - :: - :: The pump must never emit duplicate acks, and if we've - :: heard the nack-trace, that should have cleared this - :: message from the pump. - :: ?< (~(has in nax.peer-state) nax-key) =. nax.peer-state (~(put in nax.peer-state) nax-key) :: @@ -1661,7 +1669,7 @@ ^+ peer-core :: =/ =wire (make-pump-timer-wire her.channel bone) - (emit client-duct %pass wire %b %wait date) + (emit duct %pass wire %b %wait date) :: +on-pump-rest: relay |message-pump's unset-timer request :: ++ on-pump-rest @@ -1669,7 +1677,7 @@ ^+ peer-core :: =/ =wire (make-pump-timer-wire her.channel bone) - (emit client-duct %pass wire %b %rest date) + (emit duct %pass wire %b %rest date) -- :: +run-message-still: process $message-still-task and its effects :: @@ -1722,45 +1730,36 @@ on-still-nack-trace :: +on-still-boon: handle response message received by |message-still :: + :: .bone must be mapped in .ossuary.peer-state, or we crash. + :: This means a malformed message will kill a channel. We + :: could change this to a no-op if we had some sort of security + :: reporting. + :: ++ on-still-boon |= [=message-num message=*] ^+ peer-core - ~& %ames-still-boon - :: send message ack packet unconditionally + ~& %ames-still-boon^our^bone=bone + :: send ack unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) - :: if no .client-duct, bone is invalid; don't send to vane + :: give message to client vane :: - :: Future Ames should emit a security alert to local - :: subscribers if it can't find the duct for a %boon message. - :: - ?~ client-duct=(~(get by by-bone.ossuary.peer-state) bone) - ~& %ames-bogus-boon-target^her.channel - peer-core - :: valid bone; give message to vane - :: - (emit u.client-duct %give %boon message) + (emit (got-duct bone) %give %boon message) :: +on-still-nack-trace: handle nack-trace received by |message-still :: ++ on-still-nack-trace |= [=message-num message=*] ^+ peer-core - ~& %ames-still-nack-trace + ~& %ames-still-nack-trace^our^bone=bone :: =+ ;; [=failed=^message-num =error] message + :: ack nack-trace message (only applied if we don't later crash) + :: + =. peer-core (run-message-still bone %done ok=%.y) :: flip .bone's second bit to find referenced flow :: =/ target-bone=^bone (mix 0b10 bone) - :: if no .target-duct, malformed message; don't ack - :: - ?~ target-duct=(~(get by by-bone.ossuary.peer-state) target-bone) - ~& %ames-bogus-nack-trace-target^her.channel - peer-core - :: valid .target-duct; ack - :: - =. peer-core (run-message-still bone %done ok=%.y) - :: - =/ nax-key [target-bone failed-message-num] + =/ nax-key [target-bone failed-message-num] :: if we haven't heard a message nack, pretend we have :: :: The nack-trace message counts as a valid message nack on @@ -1778,13 +1777,13 @@ :: =. nax.peer-state (~(del in nax.peer-state) nax-key) :: - (emit u.target-duct %give %done `error) + (emit (got-duct target-bone) %give %done `error) :: +on-still-plea: handle request message received by |message-still :: ++ on-still-plea |= [=message-num message=*] ^+ peer-core - ~& %ames-still-plea + ~& %ames-still-plea^our^bone=bone :: don't accept requests for arbitrary vanes :: =+ ;; =plea message @@ -1806,13 +1805,10 @@ :: =/ =wire (make-bone-wire her.channel bone) :: - =^ client-duct ossuary.peer-state - (get-duct ossuary.peer-state bone duct) - :: ?+ vane.plea ~| %ames-evil-vane^vane.plea !! - %c (emit client-duct %pass wire %c %plea her.channel plea) - %g (emit client-duct %pass wire %g %plea her.channel plea) - %k (emit client-duct %pass wire %k %plea her.channel plea) + %c (emit duct %pass wire %c %plea her.channel plea) + %g (emit duct %pass wire %g %plea her.channel plea) + %k (emit duct %pass wire %k %plea her.channel plea) == -- -- @@ -2359,12 +2355,12 @@ ?. is-last-fragment :: single packet ack :: - ~& %send-dupe-ack^seq^fragment-num + ~& %send-dupe-ack^our.channel^seq^fragment-num (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) - ~& %send-dupe-ack-whole-message^seq + ~& %send-dupe-ack-whole-message^our.channel^seq (give %send seq %| ok lag=`@dr`0) :: last-acked+.$ =/ =rave (rove-to-rave rove.wov) @@ -2835,6 +2844,7 @@ =+ inx=nix.u.ref =. +>+.$ =< ?>(?=(^ ref) .) + ~& %clay-duce-plea (send-over-ames hen her inx syd `rave) %= +>+.$ nix.u.ref +(nix.u.ref) @@ -2987,6 +2997,7 @@ |= {{a/wove b/(set duct)} c/(list wove)} ?.((~(has in b) hen) c [a c]) ?~ ref + ~& %clay-cancel-future => .(ref `(unit rind)`ref) :: XX TMI ?: =(~ wos) + :: XX handle? |- ^+ +> @@ -2998,6 +3009,7 @@ =: fod.u.ref (~(del by fod.u.ref) hen) bom.u.ref (~(del by bom.u.ref) u.nux) == + ~& %clay-cancel-plea (send-over-ames hen her u.nux syd ~) :: :: Handles a request. @@ -4442,9 +4454,10 @@ [mos ..^$] :: ?: ?=([%foreign-warp *] tea) + ~& %clay-take-foreign-warp^our^tea ?> ?=(%writ +<.q.hin) :_ ..^$ - [hen %give %boon (bind `riot`p.q.hin rant-to-rand)]~ + [hen %give %boon `(unit rand)`(bind `riot`p.q.hin rant-to-rand)]~ :: ?: ?=([%foreign-request @ @ @ *] tea) =/ her (slav %p i.t.tea) @@ -4456,6 +4469,7 @@ [mos ..^$] :: ?: ?=([%foreign-update @ @ *] tea) + ~& %clay-take-foreign-update^tea =/ her (slav %p i.t.tea) =/ syd (slav %tas i.t.t.tea) =^ mos ruf @@ -4482,16 +4496,23 @@ ?: ?=([%warp-index @ @ @ ~] tea) ?: ?=(%done +<.q.hin) ?~ error.q.hin + ~& %clay-take-warp-index-ok^our^tea [~ ..^$] :: TODO better error handling :: - ~& %clay-take-warp-index-error^tag.u.error.q.hin + ~& %clay-take-warp-index-error^our^tea^tag.u.error.q.hin %- (slog tang.u.error.q.hin) [~ ..^$] :: ?> ?=(%boon +<.q.hin) :: - =+ ;; res=(unit rand) payload.q.hin + =/ res=(unit rand) + ?^ v=((soft ,(unit rand)) payload.q.hin) + ~& %clay-take-boon^our^tea + u.v + ~| %clay-take-boon-fail^our^payload.q.hin + !! + ::=+ ;; res=(unit rand) payload.q.hin :: =/ her=ship (slav %p i.t.tea) =/ =desk (slav %tas i.t.t.tea) From 849ff5f9d9fc6f451be27a7cec85e35fe638dd19 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 14:34:53 -0700 Subject: [PATCH 061/151] remove a couple printfs --- pkg/arvo/sys/vane/alef.hoon | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 2841a44e00..29444f6f02 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2513,10 +2513,8 @@ ^+ [next-bone.ossuary ossuary] :: ?^ existing=(~(get by by-duct.ossuary) duct) - ~& %ames-existing-bone^u.existing [u.existing ossuary] :: - ~& %ames-next-bone^next-bone.ossuary :- next-bone.ossuary :+ (add 4 next-bone.ossuary) (~(put by by-duct.ossuary) duct next-bone.ossuary) From 035e4930033e48d86a79ec3f600462ac5edeac12 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 14:39:40 -0700 Subject: [PATCH 062/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index f38b5d6a95..139d498af9 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2d5d15da203868617d88f3fbd412136cb99515d7366cc7cb3908c4ef15fa9d5 -size 10283885 +oid sha256:3016c17bac2299e88dfb6e6f034a1477fa69072f1c47f3df9ff4662898f6dbd7 +size 10285104 From b13266cf69b1473f667528d586dc436e3304b7e7 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 14:48:25 -0700 Subject: [PATCH 063/151] update pill again --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 139d498af9..7b540a19f8 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3016c17bac2299e88dfb6e6f034a1477fa69072f1c47f3df9ff4662898f6dbd7 -size 10285104 +oid sha256:30fbb38ab062b6180166252956a5a2d9d6f1e9d86d7063a2898a9ffb339d72cf +size 10284117 From ff9547f196f644f193e635e1ee3004bc00fc4083 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 16:05:40 -0700 Subject: [PATCH 064/151] wrote error handling pathways --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/alef.hoon | 75 +++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 7b540a19f8..1baf613365 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:30fbb38ab062b6180166252956a5a2d9d6f1e9d86d7063a2898a9ffb339d72cf -size 10284117 +oid sha256:495cc6e23d6805366048ef1451deeb3f4836411999ffd4e3329f1434085b72a3 +size 10287843 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 29444f6f02..0643dff063 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -710,11 +710,12 @@ :: %done: receive confirmation from vane of processing or failure :: %drop: clear .message-num from .nax.state :: %hear: handle receiving a message fragment packet +:: .ok: %.y unless previous failed attempt :: +$ message-still-task $% [%done ok=?] [%drop =message-num] - [%hear =lane =shut-packet] + [%hear =lane =shut-packet ok=?] == :: $message-still-gift: effect from |message-still :: @@ -953,21 +954,19 @@ |= [=lane =blob] ^+ event-core :: - (on-hear-packet lane (decode-packet blob)) + (on-hear-packet lane (decode-packet blob) ok=%.y) :: +on-hole: handle packet crash notification :: - :: TODO: retry processing and nack if possible - :: ++ on-hole |= [=lane =blob] ^+ event-core :: ~& %ames-hole - event-core + (on-hear-packet lane (decode-packet blob) ok=%.n) :: +on-hear-packet: handle mildly processed packet receipt :: ++ on-hear-packet - |= [=lane =packet] + |= [=lane =packet ok=?] ^+ event-core :: ?: =(our sndr.packet) @@ -987,7 +986,7 @@ :: TODO: filter for transitive closure of sponsors/sponsees. :: ++ on-hear-forward - |= [=lane =packet] + |= [=lane =packet ok=?] ^+ event-core :: =/ ship-state (~(get by peers.ames-state) rcvr.packet) @@ -1007,7 +1006,7 @@ :: +on-hear-open: handle receipt of plaintext comet self-attestation :: ++ on-hear-open - |= [=lane =packet] + |= [=lane =packet ok=?] ^+ event-core :: if we already know .sndr, ignore duplicate attestation :: @@ -1059,7 +1058,7 @@ :: +on-hear-shut: handle receipt of encrypted packet :: ++ on-hear-shut - |= [=lane =packet] + |= [=lane =packet ok=?] ^+ event-core :: encrypted packet content must be an encrypted atom :: @@ -1094,7 +1093,7 @@ `[direct=%.y lane] :: =/ peer-core (make-peer-core peer-state channel) - abet:(on-hear-shut-packet:peer-core lane shut-packet) + abet:(on-hear-shut-packet:peer-core lane shut-packet ok) :: +on-take-boon: receive request to give message to peer :: ++ on-take-boon @@ -1296,7 +1295,9 @@ |- ^+ event-core ?~ rcv-packets.todos event-core :: - =. event-core (on-hear-packet i.rcv-packets.todos) + =. event-core + (on-hear-packet [lane packet ok=%.y]:i.rcv-packets.todos) + :: $(rcv-packets.todos t.rcv-packets.todos) :: we're a comet; send self-attestation packet first :: @@ -1420,12 +1421,14 @@ ++ set-sponsor-heartbeat-timer ^+ event-core :: + ~& %ames-set-sponsor-timer^now (emit duct %pass /ping %b %wait `@da`(add now ~m1)) :: +ping-sponsor: message our sponsor so they know our lane :: ++ ping-sponsor ^+ event-core :: + ~& %ames-ping-sponsor^now (emit duct %pass /ping %a %plea sponsor.ames-state %a /ping ~) :: +send-blob: fire packet at .ship and maybe sponsors :: @@ -1509,13 +1512,15 @@ :: +on-hear-shut-packet: handle receipt of ack or message fragment :: ++ on-hear-shut-packet - |= [=lane =shut-packet] + |= [=lane =shut-packet ok=?] ^+ peer-core :: =/ =bone bone.shut-packet :: ?: ?=(%& -.meat.shut-packet) - (run-message-still bone %hear lane shut-packet) + (run-message-still bone %hear lane shut-packet ok) + :: ignore .ok for |message-pump; just try again on error + :: (run-message-pump bone %hear [message-num +.meat]:shut-packet) :: +on-memo: handle request to send message :: @@ -1530,11 +1535,11 @@ ++ on-wake |= [=bone error=(unit tang)] ^+ peer-core - :: TODO: handle error + :: if we previously errored out, print and try again :: - ?^ error - ~| %ames-wake-error - (mean u.error) + %- ?~ error + same + (slog >%ames-wake-fail< u.error) :: expire direct route :: :: Since a packet's timer expired, mark the .lane.route as @@ -1795,21 +1800,33 @@ :: TODO: treat ames as client vane and go through arvo? :: removes reentrancy and could nack more easily :: - =/ error=(unit error) - ?: =([/ping ~] +.plea) - ~ - `[%ping [%leaf "ames: invalid ping"]~] + ~& ?: =([/ping ~] +.plea) + %ames-ping + %ames-ping-lame :: (run-message-still bone %done ok=%.y) :: not a sponsor ping; relay .plea to .vane :: =/ =wire (make-bone-wire her.channel bone) + :: is this the first time we're trying to process this message? :: - ?+ vane.plea ~| %ames-evil-vane^vane.plea !! - %c (emit duct %pass wire %c %plea her.channel plea) - %g (emit duct %pass wire %g %plea her.channel plea) - %k (emit duct %pass wire %k %plea her.channel plea) - == + ?. ?=([%hear * * ok=%.n] task) + :: fresh plea; pass to client vane + :: + ?+ vane.plea ~| %ames-evil-vane^vane.plea !! + %c (emit duct %pass wire %c %plea her.channel plea) + %g (emit duct %pass wire %g %plea her.channel plea) + %k (emit duct %pass wire %k %plea her.channel plea) + == + :: we previously crashed on this message; send nack + :: + =. peer-core (run-message-still bone %done ok=%.n) + :: also send nack-trace + :: + =/ nack-trace-bone=^bone (mix 0b10 bone) + =/ =message-blob (jam [message-num ~]) + :: + (run-message-pump nack-trace-bone %memo message-blob) -- -- -- @@ -2311,7 +2328,7 @@ ^- pump-metrics metrics -- -:: +:: +make-message-still: construct |message-still message receiver core :: ++ make-message-still |= [state=message-still-state =channel] @@ -2328,12 +2345,12 @@ ?- -.task %done (on-done ok.task) %drop (on-drop message-num.task) - %hear (on-hear [lane shut-packet]:task) + %hear (on-hear [lane shut-packet ok]:task) == :: +on-hear: receive message fragment, possibly completing message :: ++ on-hear - |= [=lane =shut-packet] + |= [=lane =shut-packet ok=?] ^+ message-still :: we know this is a fragment, not an ack; expose into namespace :: From 290276f108879b57c38a8e89827e6879596ae3bd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 17:00:04 -0700 Subject: [PATCH 065/151] try to fix sponsor pinging --- bin/solid.pill | 4 +-- pkg/arvo/sys/vane/alef.hoon | 69 ++++++++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 23 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 1baf613365..389dff37bf 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:495cc6e23d6805366048ef1451deeb3f4836411999ffd4e3329f1434085b72a3 -size 10287843 +oid sha256:52447461c64b4abf79b6daafa9e693077e3342101f1d451f280d5bd145ac544e +size 10290998 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 0643dff063..1da77ae611 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -395,6 +395,7 @@ +$ ames-state $: peers=(map ship ship-state) =unix=duct + sponsor-ping-timer=(unit [=duct date=@da]) =life sponsor=ship crypto-core=acru:ames @@ -924,12 +925,13 @@ ^+ event-core :: ?: =(/ping wire) - set-sponsor-heartbeat-timer + ~& %ames-take-ping-done + set-sponsor-ping-timer :: =+ ^- [her=ship =bone] (parse-bone-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now +>.ames-state -.peer-state] + =/ =channel [[our her] now |3.ames-state -.peer-state] =/ peer-core (make-peer-core peer-state channel) :: if processing succeded, send positive ack packet and exit :: @@ -1078,7 +1080,7 @@ :: and their public key using elliptic curve Diffie-Hellman. :: =/ =peer-state +.u.sndr-state - =/ =channel [[our sndr.packet] now +>.ames-state -.peer-state] + =/ =channel [[our sndr.packet] now |3.ames-state -.peer-state] =/ =shut-packet (decrypt symmetric-key.channel content.packet) :: ward against replay attacks :: @@ -1103,7 +1105,7 @@ =+ ^- [her=ship =bone] (parse-bone-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now +>.ames-state -.peer-state] + =/ =channel [[our her] now |3.ames-state -.peer-state] ~& %ames-take-boon^our^her^bone=bone :: abet:(on-memo:(make-peer-core peer-state channel) bone payload) @@ -1121,7 +1123,7 @@ todos(snd-messages [[duct plea] snd-messages.todos]) :: =/ =peer-state +.u.ship-state - =/ =channel [[our ship] now +>.ames-state -.peer-state] + =/ =channel [[our ship] now |3.ames-state -.peer-state] :: =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) ~& %ames-plea^our^ship^[bone=bone]^vane.plea^path.plea @@ -1134,12 +1136,13 @@ ^+ event-core :: ?: =(/ping wire) + =. sponsor-ping-timer.ames-state ~ ping-sponsor :: =+ ^- [her=ship =bone] (parse-pump-timer-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now +>.ames-state -.peer-state] + =/ =channel [[our her] now |3.ames-state -.peer-state] :: abet:(on-wake:(make-peer-core peer-state channel) bone error) :: +on-init: first boot; subscribe to our info from jael @@ -1236,15 +1239,16 @@ |= [=ship sponsor=(unit ship)] ^+ event-core :: + ?~ sponsor + ~| %lost-sponsor^our^ship !! + :: ?: =(our ship) - =. sponsor.ames-state ship + =. sponsor.ames-state u.sponsor + =. event-core set-sponsor-ping-timer ping-sponsor :: =/ =peer-state (got-peer-state ship) :: - ?~ sponsor - ~| %lost-sponsor^our^ship !! - :: =. sponsor.peer-state u.sponsor :: =. peers.ames-state (~(put by peers.ames-state) ship %known peer-state) @@ -1260,7 +1264,13 @@ |^ ^+ event-core ?~ points event-core :: - =+ [ship point]=i.points + =+ ^- [=ship =point] i.points + :: (re)start sponsor ping on new sponsor + :: + =? event-core &(=(our ship) ?=(^ sponsor.point)) + =. sponsor.ames-state u.sponsor.point + =. event-core set-sponsor-ping-timer + ping-sponsor :: =. event-core ?~ ship-state=(~(get by peers.ames-state) ship) @@ -1270,6 +1280,7 @@ ?: ?=([~ %alien *] ship-state) ~& %alef-meet-alien^ship^point (meet-alien ship point +.u.ship-state) + :: ~& %alef-update-known^ship^point (update-known ship point +.u.ship-state) :: @@ -1416,13 +1427,29 @@ ?: already-pending event-core (emit duct %pass /public-keys %k %public-keys [n=ship ~ ~]) - :: +set-sponsor-heartbeat-timer: trigger sponsor ping after timeout + :: +set-sponsor-ping-timer: trigger sponsor ping after timeout :: - ++ set-sponsor-heartbeat-timer + ++ set-sponsor-ping-timer + ^+ event-core + :: make sure there's never more than one timer + :: + =. event-core unset-sponsor-ping-timer + :: set new timer in state and emit request to behn + :: + =/ date=@da (add now ~m1) + =. sponsor-ping-timer.ames-state `[duct date] + :: + ~& %ames-set-sponsor-timer^now^date + (emit duct %pass /ping %b %wait date) + :: +unset-sponsor-ping-timer: cancel timer to ping sponsor + :: + ++ unset-sponsor-ping-timer ^+ event-core :: - ~& %ames-set-sponsor-timer^now - (emit duct %pass /ping %b %wait `@da`(add now ~m1)) + ?~ timer=sponsor-ping-timer.ames-state + event-core + ~& %ames-unset-sponsor-ping-timer + (emit duct.u.timer %pass /ping %b %rest date.u.timer) :: +ping-sponsor: message our sponsor so they know our lane :: ++ ping-sponsor @@ -1448,22 +1475,22 @@ todos(snd-packets (~(put in snd-packets.todos) blob)) :: =/ =peer-state +.u.ship-state - =/ =channel [[our ship] now +>.ames-state -.peer-state] + =/ =channel [[our ship] now |3.ames-state -.peer-state] :: - =* try-next-sponsor + ?~ route=route.peer-state ?: =(ship her-sponsor.channel) event-core $(ship her-sponsor.channel) :: - ?~ route=route.peer-state - try-next-sponsor - :: =. event-core (emit unix-duct.ames-state %give %send lane.u.route blob) :: ?: direct.u.route event-core - try-next-sponsor + :: + ?: =(ship her-sponsor.channel) + event-core + $(ship her-sponsor.channel) :: +attestation-packet: generate signed self-attestation for .her :: :: Sent by a comet on first contact with a peer. Not acked. From 2157995bb0c89bc1496bc2ab205295448a86174f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 17:21:00 -0700 Subject: [PATCH 066/151] stop pinging yourself, zod --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 389dff37bf..d8fd98f41c 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:52447461c64b4abf79b6daafa9e693077e3342101f1d451f280d5bd145ac544e -size 10290998 +oid sha256:91878e1cf47f40528ff924771938927b69e7672ef5c9e314ef1b26e1857a0186 +size 10291667 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 1da77ae611..170b74b829 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1147,12 +1147,19 @@ abet:(on-wake:(make-peer-core peer-state channel) bone error) :: +on-init: first boot; subscribe to our info from jael :: + :: A non-galaxy ship makes a %public-keys subscription to stay + :: updated about its sponsor. A galaxy is its own sponsor, so it + :: does not make such a request. + :: ++ on-init |= our=ship ^+ event-core :: - =~ (emit duct %pass /private-keys %k %private-keys ~) + =~ ?: =(%czar (clan:title our)) + event-core(sponsor.ames-state our) (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) + :: + (emit duct %pass /private-keys %k %private-keys ~) (emit duct %pass /turf %k %turf ~) == :: +on-priv: set our private key to jael's response From 2c652647fa85ced8ed808a741b9a28d6805f228f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 18:19:17 -0700 Subject: [PATCH 067/151] try to fix jael initialization request order --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index d8fd98f41c..148614adee 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91878e1cf47f40528ff924771938927b69e7672ef5c9e314ef1b26e1857a0186 -size 10291667 +oid sha256:0aca97b9f69b65bf0606fc4538ac6809ed09454959373d5bc6f73031b21e5a6c +size 10291742 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 170b74b829..229a255d97 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1155,13 +1155,12 @@ |= our=ship ^+ event-core :: - =~ ?: =(%czar (clan:title our)) - event-core(sponsor.ames-state our) - (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) + =. event-core (emit duct %pass /turf %k %turf ~) + =. event-core (emit duct %pass /private-keys %k %private-keys ~) :: - (emit duct %pass /private-keys %k %private-keys ~) - (emit duct %pass /turf %k %turf ~) - == + ?: =(%czar (clan:title our)) + event-core(sponsor.ames-state our) + (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) :: +on-priv: set our private key to jael's response :: ++ on-priv From e7f4859fd452b9ca338302ead72ee4bcf0cf6b63 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 21:12:01 -0700 Subject: [PATCH 068/151] try again to get ~zod to stop pinging itself --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 148614adee..905eaaca48 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0aca97b9f69b65bf0606fc4538ac6809ed09454959373d5bc6f73031b21e5a6c -size 10291742 +oid sha256:c53e0f4465b1807da125dc535eec6bbda202b0227aad7cac174bfc8f8849bfa3 +size 10292159 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 229a255d97..a11db0b742 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1248,7 +1248,7 @@ ?~ sponsor ~| %lost-sponsor^our^ship !! :: - ?: =(our ship) + ?: &(=(our ship) !=(our u.sponsor)) =. sponsor.ames-state u.sponsor =. event-core set-sponsor-ping-timer ping-sponsor @@ -1273,7 +1273,8 @@ =+ ^- [=ship =point] i.points :: (re)start sponsor ping on new sponsor :: - =? event-core &(=(our ship) ?=(^ sponsor.point)) + =? event-core + &(=(our ship) ?=(^ sponsor.point) !=(our u.sponsor.point)) =. sponsor.ames-state u.sponsor.point =. event-core set-sponsor-ping-timer ping-sponsor From b4935c50c095c937f73ba0c0b7551bb460d4e47e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 5 Aug 2019 21:42:51 -0700 Subject: [PATCH 069/151] fix kale->dill %done --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/kale.hoon | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 905eaaca48..f10a192d42 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c53e0f4465b1807da125dc535eec6bbda202b0227aad7cac174bfc8f8849bfa3 -size 10292159 +oid sha256:b7b50f915b1a081dd82d4a409b48bcddec51a1842c37b54fdbaa25c7e18b6f79 +size 10292045 diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index 790c271a17..0d0995e543 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -538,7 +538,6 @@ +>.$ :: [%a %boon *] - =. moz [[hen %give %done ~] moz] =+ ;; res=message-response payload.hin ?> ?=(%public-keys-result -.res) :: From 2767765835e33763cb6060f7abbac47fd9350d1e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 7 Aug 2019 22:18:25 -0700 Subject: [PATCH 070/151] fix undead ames crash --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 61965ad821..575cb5eaa6 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:332ec24cf9347844fb77d75484a2f2b93b9281d331af06f4351910b74e5771d9 -size 10373689 +oid sha256:aff0bad3374ea6a5e88e80a4e307620daa762bbfce062d65db8b64e240ad4018 +size 10373055 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 12734deb23..e2bc6dcaca 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1587,12 +1587,7 @@ ^+ peer-core :: update and print connection status :: - =. peer-core %- update-qos - ?- -.qos.peer-state - %unborn [%live last-contact=now] - %live [%live last-contact=now] - %dead ~| %undead-peer^her.channel !! - == + =. peer-core (update-qos %live last-contact=now) :: =/ =bone bone.shut-packet :: From f21533cc19bccd3a2159cf278c58b976e722860e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 7 Aug 2019 22:40:33 -0700 Subject: [PATCH 071/151] ping sponsor on %born --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 575cb5eaa6..291c174ad3 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aff0bad3374ea6a5e88e80a4e307620daa762bbfce062d65db8b64e240ad4018 -size 10373055 +oid sha256:4f6ce501f6f7e164aab23c347790664bc6075994c9bf950a7f57b39d7be90a5a +size 10373580 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index e2bc6dcaca..67ab6f9ec8 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1424,6 +1424,11 @@ ^+ event-core :: =. unix-duct.ames-state duct + :: clear sponsor ping timer and ping now + :: + =? event-core !=(%czar (clan:title our)) + => unset-sponsor-ping-timer + ping-sponsor :: =/ turfs ;; (list turf) From 0b24c5be0b16042a4a0e2cc36a4e5d6ba79e6bcb Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 7 Aug 2019 23:13:23 -0700 Subject: [PATCH 072/151] stop pinging yourself, round two --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 291c174ad3..df821add95 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f6ce501f6f7e164aab23c347790664bc6075994c9bf950a7f57b39d7be90a5a -size 10373580 +oid sha256:58e38755647e95f705c77cceff5a111fe44b3688d7400d194e82a378c9fee69e +size 10373733 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 67ab6f9ec8..e3a31e8355 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1133,9 +1133,9 @@ ++ on-plea |= [=ship =plea] ^+ event-core - :: if .plea is a sponsor ping; ack it + :: if .plea is a sponsor ping, ack it :: - ?: =([%a /ping ~] plea) + ?: =([our %a /ping ~] [ship plea]) ~& %ames-ack-ping^our^ship (emit duct %give %done ~) :: .plea is from local vane to foreign ship From 9961f2946b328413a03fb58badb1bacbdd63bc99 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 14:20:16 -0700 Subject: [PATCH 073/151] remove all sponsor logic from ames in preparation for moving to an app --- bin/solid.pill | 4 +- pkg/arvo/sys/vane/alef.hoon | 96 +++++-------------------------------- 2 files changed, 14 insertions(+), 86 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index df821add95..ccaa0f8a8d 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:58e38755647e95f705c77cceff5a111fe44b3688d7400d194e82a378c9fee69e -size 10373733 +oid sha256:ba52227fca803f06c6b1dc7b344bc013dee518c3a68e9bd58a1da2d6fdd1fc96 +size 10363694 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index e3a31e8355..b663e67169 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -325,7 +325,6 @@ :: our data, common to all dyads :: $: =our=life - our-sponsor=ship crypto-core=acru:ames == :: her data, specific to this dyad @@ -395,9 +394,7 @@ +$ ames-state $: peers=(map ship ship-state) =unix=duct - sponsor-ping-timer=(unit [=duct date=@da]) =life - sponsor=ship crypto-core=acru:ames == :: $ship-state: all we know about a peer @@ -653,10 +650,6 @@ :: message to the remote vane from which the forward flow message :: originated. :: -:: Ames gives a %done sign to itself when our sponsor acks a -:: heartbeat message we sent it. This triggers a timer, which then -:: triggers the next heartbeat message to be sent. -:: +$ sign $~ [%b %wake ~] $% $: %b @@ -932,17 +925,12 @@ ++ on-take-done |= [=wire error=(unit error)] ^+ event-core - :: if /ping wire, sponsor acked our ping; reset timer - :: - ?: =(/ping wire) - ~& %ames-take-ping-done - set-sponsor-ping-timer - :: otherwise, we need to relay the vane ack to the foreign peer + :: relay the vane ack to the foreign peer :: =+ ^- [her=ship =bone] (parse-bone-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now |3.ames-state -.peer-state] + =/ =channel [[our her] now |2.ames-state -.peer-state] =/ peer-core (make-peer-core peer-state channel) :: if processing succeded, send positive ack packet and exit :: @@ -1096,7 +1084,7 @@ :: and their public key using elliptic curve Diffie-Hellman. :: =/ =peer-state +.u.sndr-state - =/ =channel [[our sndr.packet] now |3.ames-state -.peer-state] + =/ =channel [[our sndr.packet] now |2.ames-state -.peer-state] =/ =shut-packet (decrypt symmetric-key.channel content.packet) :: ward against replay attacks :: @@ -1124,7 +1112,7 @@ =+ ^- [her=ship =bone] (parse-bone-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now |3.ames-state -.peer-state] + =/ =channel [[our her] now |2.ames-state -.peer-state] ~& %ames-take-boon^our^her^bone=bone :: abet:(on-memo:(make-peer-core peer-state channel) bone payload) @@ -1133,11 +1121,6 @@ ++ on-plea |= [=ship =plea] ^+ event-core - :: if .plea is a sponsor ping, ack it - :: - ?: =([our %a /ping ~] [ship plea]) - ~& %ames-ack-ping^our^ship - (emit duct %give %done ~) :: .plea is from local vane to foreign ship :: =/ ship-state (~(get by peers.ames-state) ship) @@ -1148,7 +1131,7 @@ todos(snd-messages [[duct plea] snd-messages.todos]) :: =/ =peer-state +.u.ship-state - =/ =channel [[our ship] now |3.ames-state -.peer-state] + =/ =channel [[our ship] now |2.ames-state -.peer-state] :: =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) ~& %ames-plea^our^ship^[bone=bone]^vane.plea^path.plea @@ -1160,14 +1143,10 @@ |= [=wire error=(unit tang)] ^+ event-core :: - ?: =(/ping wire) - =. sponsor-ping-timer.ames-state ~ - ping-sponsor - :: =+ ^- [her=ship =bone] (parse-pump-timer-wire wire) :: =/ =peer-state (got-peer-state her) - =/ =channel [[our her] now |3.ames-state -.peer-state] + =/ =channel [[our her] now |2.ames-state -.peer-state] :: abet:(on-wake:(make-peer-core peer-state channel) bone error) :: +on-init: first boot; subscribe to our info from jael @@ -1180,12 +1159,9 @@ |= our=ship ^+ event-core :: - =. event-core (emit duct %pass /turf %k %turf ~) - =. event-core (emit duct %pass /private-keys %k %private-keys ~) - :: - ?: =(%czar (clan:title our)) - event-core(sponsor.ames-state our) - (emit duct %pass /public-keys %k %public-keys [n=our ~ ~]) + =~ (emit duct %pass /turf %k %turf ~) + (emit duct %pass /private-keys %k %private-keys ~) + == :: +on-priv: set our private key to jael's response :: ++ on-priv @@ -1262,7 +1238,7 @@ :: ~& %alef-rekey^our^ship^life^public-key (insert-peer-state ship (got-peer-state ship) life public-key) - :: +on-publ-sponsor: handle new or lost sponsor for self or peer + :: +on-publ-sponsor: handle new or lost sponsor for peer :: :: TODO: handle sponsor loss :: @@ -1273,13 +1249,7 @@ ?~ sponsor ~| %lost-sponsor^our^ship !! :: - ?: &(=(our ship) !=(our u.sponsor)) - =. sponsor.ames-state u.sponsor - =. event-core set-sponsor-ping-timer - ping-sponsor - :: - =/ =peer-state (got-peer-state ship) - :: + =/ =peer-state (got-peer-state ship) =. sponsor.peer-state u.sponsor :: =. peers.ames-state (~(put by peers.ames-state) ship %known peer-state) @@ -1296,13 +1266,6 @@ ?~ points event-core :: =+ ^- [=ship =point] i.points - :: (re)start sponsor ping on new sponsor - :: - =? event-core - &(=(our ship) ?=(^ sponsor.point) !=(our u.sponsor.point)) - =. sponsor.ames-state u.sponsor.point - =. event-core set-sponsor-ping-timer - ping-sponsor :: =. event-core ?~ ship-state=(~(get by peers.ames-state) ship) @@ -1424,11 +1387,6 @@ ^+ event-core :: =. unix-duct.ames-state duct - :: clear sponsor ping timer and ping now - :: - =? event-core !=(%czar (clan:title our)) - => unset-sponsor-ping-timer - ping-sponsor :: =/ turfs ;; (list turf) @@ -1464,36 +1422,6 @@ ?: already-pending event-core (emit duct %pass /public-keys %k %public-keys [n=ship ~ ~]) - :: +set-sponsor-ping-timer: trigger sponsor ping after timeout - :: - ++ set-sponsor-ping-timer - ^+ event-core - :: make sure there's never more than one timer - :: - =. event-core unset-sponsor-ping-timer - :: set new timer in state and emit request to behn - :: - =/ date=@da (add now ~m1) - =. sponsor-ping-timer.ames-state `[duct date] - :: - ~& %ames-set-sponsor-timer^now^date - (emit duct %pass /ping %b %wait date) - :: +unset-sponsor-ping-timer: cancel timer to ping sponsor - :: - ++ unset-sponsor-ping-timer - ^+ event-core - :: - ?~ timer=sponsor-ping-timer.ames-state - event-core - ~& %ames-unset-sponsor-ping-timer - (emit duct.u.timer %pass /ping %b %rest date.u.timer) - :: +ping-sponsor: message our sponsor so they know our lane - :: - ++ ping-sponsor - ^+ event-core - :: - ~& %ames-ping-sponsor^now - (emit duct %pass /ping %a %plea sponsor.ames-state %a /ping ~) :: +send-blob: fire packet at .ship and maybe sponsors :: :: Send to .ship and sponsors until we find a direct lane. @@ -1512,7 +1440,7 @@ todos(snd-packets (~(put in snd-packets.todos) blob)) :: =/ =peer-state +.u.ship-state - =/ =channel [[our ship] now |3.ames-state -.peer-state] + =/ =channel [[our ship] now |2.ames-state -.peer-state] :: ?~ route=route.peer-state ?: =(ship her-sponsor.channel) From 6682f2d0ef63ee33a33802225bea4bf1af5e35c0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 18:24:47 -0700 Subject: [PATCH 074/151] %ping app --- bin/solid.pill | 4 +- pkg/arvo/app/ping.hoon | 94 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 pkg/arvo/app/ping.hoon diff --git a/bin/solid.pill b/bin/solid.pill index ccaa0f8a8d..bc3646bdb1 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ba52227fca803f06c6b1dc7b344bc013dee518c3a68e9bd58a1da2d6fdd1fc96 -size 10363694 +oid sha256:ebc712b448f1f1029a89c30db70c90d40238e33e693a3293c54df8d7151024b1 +size 10365770 diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon new file mode 100644 index 0000000000..ed8907daf8 --- /dev/null +++ b/pkg/arvo/app/ping.hoon @@ -0,0 +1,94 @@ +=* point point:able:kale +:: +=> |% + +$ app-state ~ + +$ move [=bone =card] + +$ card + $% [%poke =wire [=ship app=term] =action] + [%wait =wire date=@da] + == + +$ action + $% [%ping ~] + == + -- +:: +=> |% + :: +print-error: maybe +slog + :: + ++ print-error + |= [=tape error=(unit tang)] + ^+ same + ?~ error same + %- (slog leaf+tape u.error) same + -- +:: +|_ [=bowl:gall state=app-state] +:: ++| %entry-points +:: +:: +prep: (re)load, initializing on startup +:: +++ prep + |= old=(unit app-state) + ^- [(list move) _app-core] + :: reload; no-op + :: + ?^ old + [~ app-core(state u.old)] + :: first load; galaxies no-op; everyone else pings sponsor + :: + ?: =(%czar (clan:title our.bowl)) + [~ app-core] + send-ping +:: +coup-ping-send: handle ames ack +:: +++ coup-ping-send + |= error=(unit tang) + ^- [(list move) _app-core] + :: + %- (print-error "ping: coup" error) + set-timer +:: +wake: handle timer firing +:: +++ wake + |= [=wire error=(unit tang)] + ^- [(list move) _app-core] + :: + ?> =(/ping-wait wire) + %- (print-error "ping: wake" error) + send-ping +:: +poke-noun: handle request; no-op to ack, crash to nack +:: +++ poke-noun + |= input=* + ^- [(list move) _app-core] + :: + ?> ?=([%ping ~] input) + [~ app-core] +:: ++| %helpers +:: +++ app-core . +:: +set-timer: send a move to behn to set a timer +:: +++ set-timer + ^- [(list move) _app-core] + :: + :_ app-core + [ost.bowl %wait /ping-wait `@da`(add ~s30 now.bowl)]~ +:: +send-ping: scry our sponsor from jael and poke their %ping app +:: +++ send-ping + ^- [(list move) _app-core] + :: + =/ our=@ta (scot %p our.bowl) + =/ now=@ta (scot %da now.bowl) + =/ =life .^(life %k /[our]/life/[now]/[our]) + =/ =point .^(point %k /[our]/deed/[now]/[our]/(scot %ud life)) + :: TODO: handle missing sponsor case + :: + =/ sponsor=ship (need sponsor.point) + :: + :_ app-core + [ost.bowl %poke /ping-send [sponsor %ping] %ping ~]~ +-- From 87fc52fd459176542eaf6464670ee4233536ae2e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 18:55:04 -0700 Subject: [PATCH 075/151] use +sein:title in ping app --- bin/solid.pill | 4 ++-- pkg/arvo/app/ping.hoon | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index bc3646bdb1..33188617c2 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ebc712b448f1f1029a89c30db70c90d40238e33e693a3293c54df8d7151024b1 -size 10365770 +oid sha256:863aa8546990db6d31091bb414913b63dff3a959d561828b0739c3008862a4a4 +size 10367556 diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index ed8907daf8..d66d3bfcdb 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -81,13 +81,7 @@ ++ send-ping ^- [(list move) _app-core] :: - =/ our=@ta (scot %p our.bowl) - =/ now=@ta (scot %da now.bowl) - =/ =life .^(life %k /[our]/life/[now]/[our]) - =/ =point .^(point %k /[our]/deed/[now]/[our]/(scot %ud life)) - :: TODO: handle missing sponsor case - :: - =/ sponsor=ship (need sponsor.point) + =/ sponsor=ship (sein:title [our now our]:bowl) :: :_ app-core [ost.bowl %poke /ping-send [sponsor %ping] %ping ~]~ From 08961feb7fb834d5088b3b05be36c53e93335d35 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 19:08:31 -0700 Subject: [PATCH 076/151] add wire to +coup-ping-send sample --- pkg/arvo/app/ping.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index d66d3bfcdb..b9d206d871 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -43,9 +43,10 @@ :: +coup-ping-send: handle ames ack :: ++ coup-ping-send - |= error=(unit tang) + |= [=wire error=(unit tang)] ^- [(list move) _app-core] :: + ?> =(/send-ping wire) %- (print-error "ping: coup" error) set-timer :: +wake: handle timer firing From f88221d65bff0133e333090c3d9ca1d69fa2e5e0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 19:14:20 -0700 Subject: [PATCH 077/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 33188617c2..ce6a6a7218 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:863aa8546990db6d31091bb414913b63dff3a959d561828b0739c3008862a4a4 -size 10367556 +oid sha256:ed3663db57d2ea737af797c38ea64654550fdd27fe24a03121abada5f2414cc7 +size 10365547 From ea718bcc87acd27242b4eca054e54388ba0414da Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 19:26:39 -0700 Subject: [PATCH 078/151] make the wires match --- bin/solid.pill | 2 +- pkg/arvo/app/ping.hoon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index ce6a6a7218..33ffe954ee 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ed3663db57d2ea737af797c38ea64654550fdd27fe24a03121abada5f2414cc7 +oid sha256:d210b3672e4d1fe4422839876e110b90e21e0fcca407a22ff589ce0bad3b3d1a size 10365547 diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index b9d206d871..67028934e5 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -46,7 +46,7 @@ |= [=wire error=(unit tang)] ^- [(list move) _app-core] :: - ?> =(/send-ping wire) + ?> =(/ping-send wire) %- (print-error "ping: coup" error) set-timer :: +wake: handle timer firing From 23e2cc7f3c58a4ca7c27e416859e539f38e43367 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 19:40:45 -0700 Subject: [PATCH 079/151] try harder to make wires match --- bin/solid.pill | 4 ++-- pkg/arvo/app/ping.hoon | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 33ffe954ee..d81a2e6fba 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d210b3672e4d1fe4422839876e110b90e21e0fcca407a22ff589ce0bad3b3d1a -size 10365547 +oid sha256:93e213c1f3e4773a88172948c985f5c0b57c83bc7bdfd1d78c0e852f56f11258 +size 10365516 diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 67028934e5..581e6ae2a7 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -46,16 +46,14 @@ |= [=wire error=(unit tang)] ^- [(list move) _app-core] :: - ?> =(/ping-send wire) %- (print-error "ping: coup" error) set-timer :: +wake: handle timer firing :: -++ wake +++ wake-ping-wait |= [=wire error=(unit tang)] ^- [(list move) _app-core] :: - ?> =(/ping-wait wire) %- (print-error "ping: wake" error) send-ping :: +poke-noun: handle request; no-op to ack, crash to nack From 096942a25e3fe9164f3ec479951ed72068997a1f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 9 Aug 2019 19:57:58 -0700 Subject: [PATCH 080/151] try again --- bin/solid.pill | 4 ++-- pkg/arvo/app/ping.hoon | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index d81a2e6fba..744ccc03bd 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:93e213c1f3e4773a88172948c985f5c0b57c83bc7bdfd1d78c0e852f56f11258 -size 10365516 +oid sha256:bfc81c03d15c990cde6e0d5798fbcd9a39fa2eb0318d952cd31a0b032c81310e +size 10365474 diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 581e6ae2a7..ad097b7984 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -8,7 +8,7 @@ [%wait =wire date=@da] == +$ action - $% [%ping ~] + $% [%noun ~] == -- :: @@ -59,10 +59,7 @@ :: +poke-noun: handle request; no-op to ack, crash to nack :: ++ poke-noun - |= input=* - ^- [(list move) _app-core] - :: - ?> ?=([%ping ~] input) + |= * [~ app-core] :: +| %helpers @@ -83,5 +80,5 @@ =/ sponsor=ship (sein:title [our now our]:bowl) :: :_ app-core - [ost.bowl %poke /ping-send [sponsor %ping] %ping ~]~ + [ost.bowl %poke /ping-send [sponsor %ping] %noun ~]~ -- From 3f5a96485b6e339c4a6bb22d4561d91759267761 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 10 Aug 2019 11:48:40 -0700 Subject: [PATCH 081/151] printing cleanup --- bin/solid.pill | 4 +-- pkg/arvo/sys/vane/alef.hoon | 62 ++++++++++++++++--------------------- pkg/arvo/sys/vane/clay.hoon | 16 ---------- pkg/arvo/sys/vane/gall.hoon | 3 -- 4 files changed, 28 insertions(+), 57 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 744ccc03bd..d73b977f9d 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bfc81c03d15c990cde6e0d5798fbcd9a39fa2eb0318d952cd31a0b032c81310e -size 10365474 +oid sha256:cf66821fdfe8dde68c995ef3bfcd51853e7a26571b1b1f6489cc4cbe70eb6143 +size 10137135 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index b663e67169..45c1b0856c 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -755,7 +755,6 @@ ?. ?=(%soft -.wrapped-task) wrapped-task ;;(task p.wrapped-task) - ~& %ames-call^our^-.task :: %born: set .unix-duct and start draining .queued-events :: ?: ?=(%born -.task) @@ -765,14 +764,12 @@ :: if no events were queued up, metamorphose :: ?~ queued-events - ~& %alef-larva-metamorphose + ~> %slog.0^leaf/"ames: metamorphosis" [moves adult-gate] - ~& %alef-larva-kick :: kick off a timer to process the first of .queued-events :: =. moves :_(moves [duct %pass /larva %b %wait now]) [moves larval-gate] - ~& %alef-larva-call :: any other event: enqueue it until we have a .unix-duct :: =. queued-events (~(put to queued-events) %call duct type task) @@ -781,19 +778,16 @@ :: ++ take |= [=wire =duct type=* =sign] - ~& %ames-take^our^-.sign :: enqueue event if not a larval drainage timer :: ?. =(/larva wire) - ~& %alef-larva-take =. queued-events (~(put to queued-events) %take wire duct type sign) [~ larval-gate] :: larval event drainage timer; pop and process a queued event :: ?. ?=([%b %wake *] sign) - ~& %alef-larva-wtf + ~> %slog.0^leaf/"ames: larva: strange sign" [~ larval-gate] - ~& %alef-larva-wake =^ first-event queued-events ~(get to queued-events) =^ moves adult-gate ?- -.first-event @@ -803,9 +797,9 @@ :: .queued-events has been cleared; metamorphose :: ?~ queued-events - ~& %alef-metamorphosis + ~> %slog.0^leaf/"ames: metamorphosis" [moves adult-gate] - ~& %alef-larva-drain + ~> %slog.0^leaf/"ames: larva: drain" :: set timer to drain next event :: =. moves :_(moves [duct %pass /larva %b %wait now]) @@ -815,7 +809,7 @@ :: TODO: don't coerce the old state :: ++ scry scry:adult-core - ++ stay ~& %alef-larva-stay [%larva queued-events ames-state.adult-gate] + ++ stay [%larva queued-events ames-state.adult-gate] ++ load |= $= old $% [%larva events=_queued-events state=_ames-state.adult-gate] @@ -824,11 +818,10 @@ :: ?- -.old %adult - ~& %alef-load (load:adult-core state.old) :: %larva - ~& %alef-load-larva + ~> %slog.0^leaf/"ames: larva: load" =. queued-events events.old =. adult-gate (load:adult-core state.old) larval-gate @@ -967,7 +960,7 @@ |= [=lane =blob] ^+ event-core :: - ~& %ames-hole + ~> %slog.0^leaf/"ames: %hole" (on-hear-packet lane (decode-packet blob) ok=%.n) :: +on-hear-packet: handle mildly processed packet receipt :: @@ -976,7 +969,6 @@ ^+ event-core :: ?: =(our sndr.packet) - ::~& %alef-self event-core :: %. +< @@ -1113,7 +1105,6 @@ :: =/ =peer-state (got-peer-state her) =/ =channel [[our her] now |2.ames-state -.peer-state] - ~& %ames-take-boon^our^her^bone=bone :: abet:(on-memo:(make-peer-core peer-state channel) bone payload) :: +on-plea: handle request to send message @@ -1134,7 +1125,7 @@ =/ =channel [[our ship] now |2.ames-state -.peer-state] :: =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) - ~& %ames-plea^our^ship^[bone=bone]^vane.plea^path.plea + ~> %slog.0^leaf/"ames: plea {}" :: abet:(on-memo:(make-peer-core peer-state channel) bone plea) :: +on-take-wake: receive wakeup or error notification from behn @@ -1221,7 +1212,7 @@ |= [=ship =rift] ^+ event-core :: - ~& %alef-breach^our^ship^rift + ~> %slog.0^leaf/"ames: breach {}" =. peers.ames-state (~(del by peers.ames-state) ship) event-core :: +on-publ-rekey: handle new key for peer @@ -1236,7 +1227,7 @@ == ^+ event-core :: - ~& %alef-rekey^our^ship^life^public-key + ~> %slog.0^leaf/"ames: rekey {}" (insert-peer-state ship (got-peer-state ship) life public-key) :: +on-publ-sponsor: handle new or lost sponsor for peer :: @@ -1247,7 +1238,7 @@ ^+ event-core :: ?~ sponsor - ~| %lost-sponsor^our^ship !! + ~| %ames-lost-sponsor^our^ship !! :: =/ =peer-state (got-peer-state ship) =. sponsor.peer-state u.sponsor @@ -1259,7 +1250,6 @@ ++ on-publ-full |= points=(map ship point) ^+ event-core - ~& %alef-on-publ-full^our :: => .(points ~(tap by points)) |^ ^+ event-core @@ -1269,14 +1259,14 @@ :: =. event-core ?~ ship-state=(~(get by peers.ames-state) ship) - ~& %alef-fresh-peer^ship^point + ~> %slog.0^leaf/"ames: new peer {}" (fresh-peer ship point) :: ?: ?=([~ %alien *] ship-state) - ~& %alef-meet-alien^ship^point + ~> %slog.0^leaf/"ames: met alien {}" (meet-alien ship point +.u.ship-state) :: - ~& %alef-update-known^ship^point + ~> %slog.0^leaf/"ames: update peer {}" (update-known ship point +.u.ship-state) :: $(points t.points) @@ -1757,7 +1747,7 @@ ++ on-still-boon |= [=message-num message=*] ^+ peer-core - ~& %ames-still-boon^our^bone=bone + ~> %slog.0^leaf/"ames: %boon {}" :: send ack unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) @@ -1769,7 +1759,7 @@ ++ on-still-nack-trace |= [=message-num message=*] ^+ peer-core - ~& %ames-still-nack-trace^our^bone=bone + ~> %slog.0^leaf/"ames: nack trace {}" :: =+ ;; [=failed=^message-num =error] message :: ack nack-trace message (only applied if we don't later crash) @@ -1802,7 +1792,7 @@ ++ on-still-plea |= [=message-num message=*] ^+ peer-core - ~& %ames-still-plea^our^bone=bone + ~> %slog.0^leaf/"ames: rcvd %plea {}" :: is this the first time we're trying to process this message? :: ?. ?=([%hear * * ok=%.n] task) @@ -1919,7 +1909,7 @@ =? unsent-fragments.state &(=(current next) ?=(^ unsent-fragments)):state :: - ~& %early-message-ack^ok^her.channel + ~> %slog.0^leaf/"ames: early message ack {}" ~ :: clear all packets from this message from the packet pump :: @@ -2162,7 +2152,7 @@ =- :: if no sent packet matches the ack, don't apply mutations or effects :: ?. found.- - ~& %alef-hear-noop + ~> %slog.0^leaf/"ames: hear: no-op" packet-pump ::~& %alef-hear-ack^message-num^fragment-num :: @@ -2362,7 +2352,7 @@ :: ignore messages from far future; limit to 10 in progress :: ?: (gte seq (add 10 last-acked.state)) - ~& %ignoring-packet-from-future^seq^last-acked.state + ~> %slog.0^leaf/"ames: future %hear {}" message-still :: =/ is-last-fragment=? =(+(fragment-num) num-fragments) @@ -2372,12 +2362,12 @@ ?. is-last-fragment :: single packet ack :: - ~& %send-dupe-ack^our.channel^seq^fragment-num + ~> %slog.0^leaf/"ames: send dupe ack {}" (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) - ~& %send-dupe-ack-whole-message^our.channel^seq + ~> %slog.0^leaf/"ames: send dupe message ack { %slog.0^leaf/"ames: %hear last {}" message-still :: ack all other packets :: @@ -2411,9 +2401,9 @@ :: ?: already-heard-fragment ?: is-last-fragment - ~& %already-heard-last-fragment^our.channel^seq^fragment-num + ~> %slog.0^leaf/"ames: %hear last dupe {}" message-still - ~& %send-dupe-ack-fragment^our.channel^seq^fragment-num + ~> %slog.0^leaf/"ames: dupe {}" (give %send seq %& fragment-num) :: new fragment; store in state and check if message is done :: @@ -2450,7 +2440,7 @@ =. last-heard.state +(last-heard.state) =. live-messages.state (~(del by live-messages.state) seq) :: - ~& %ames-still-rcv-kb-on^our.channel^%from^her.channel^seq^num-fragments.u.live + ~> %slog.0^leaf/"ames: rcv {}kb from {}" =/ message=* (assemble-fragments [num-fragments fragments]:u.live) =. message-still (enqueue-to-vane seq message) :: diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 9fde740e73..6661a577f9 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2811,14 +2811,6 @@ =/ =desk p.riff =/ =wire /warp-index/(scot %p ship)/(scot %tas desk)/(scot %ud index) =/ =path [%question desk (scot %ud index) ~] - ~& :* %clay-send-plea - our=our - ship=ship - wire=wire - duct=duct - path=path - riff=-.riff - == (emit duct %pass wire %a %plea ship %c path riff) :: :: Create a request that cannot be filled immediately. @@ -2834,7 +2826,6 @@ =. wov (dedupe wov) =. qyx (~(put ju qyx) wov hen) ?~ ref - ~& %clay-duce-future (run-if-future rove.wov |=(@da (bait hen +<))) |- ^+ +>+.$ =/ =rave (rove-to-rave rove.wov) @@ -2844,7 +2835,6 @@ =+ inx=nix.u.ref =. +>+.$ =< ?>(?=(^ ref) .) - ~& %clay-duce-plea (send-over-ames hen her inx syd `rave) %= +>+.$ nix.u.ref +(nix.u.ref) @@ -2997,7 +2987,6 @@ |= {{a/wove b/(set duct)} c/(list wove)} ?.((~(has in b) hen) c [a c]) ?~ ref - ~& %clay-cancel-future => .(ref `(unit rind)`ref) :: XX TMI ?: =(~ wos) + :: XX handle? |- ^+ +> @@ -3009,7 +2998,6 @@ =: fod.u.ref (~(del by fod.u.ref) hen) bom.u.ref (~(del by bom.u.ref) u.nux) == - ~& %clay-cancel-plea (send-over-ames hen her u.nux syd ~) :: :: Handles a request. @@ -4454,7 +4442,6 @@ [mos ..^$] :: ?: ?=([%foreign-warp *] tea) - ~& %clay-take-foreign-warp^our^tea ?> ?=(%writ +<.q.hin) :_ ..^$ [hen %give %boon `(unit rand)`(bind `riot`p.q.hin rant-to-rand)]~ @@ -4469,7 +4456,6 @@ [mos ..^$] :: ?: ?=([%foreign-update @ @ *] tea) - ~& %clay-take-foreign-update^tea =/ her (slav %p i.t.tea) =/ syd (slav %tas i.t.t.tea) =^ mos ruf @@ -4496,7 +4482,6 @@ ?: ?=([%warp-index @ @ @ ~] tea) ?: ?=(%done +<.q.hin) ?~ error.q.hin - ~& %clay-take-warp-index-ok^our^tea [~ ..^$] :: TODO better error handling :: @@ -4508,7 +4493,6 @@ :: =/ res=(unit rand) ?^ v=((soft ,(unit rand)) payload.q.hin) - ~& %clay-take-boon^our^tea u.v ~| %clay-take-boon-fail^our^payload.q.hin !! diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index f3e11786dc..2e20c90877 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -486,7 +486,6 @@ |= {him/@p dap/dude num/@ud rok/rook} =? +> ?=(%u -.rok) (mo-give %done ~) %+ mo-pass - =- ~& %gall-pass^- - [%sys %req (scot %p him) dap (scot %ud num) ~] ^- note-arvo ?- -.rok @@ -1292,13 +1291,11 @@ [~ ..^$(sys.mast.all hen)] :: %plea - ~& %gall-plea-path^path.plea.q.hic ?> ?=([%ge @ ~] path.plea.q.hic) =/ him=ship ship.q.hic =* dap i.t.path.plea.q.hic :: =+ mes=;;([@ud rook] payload.plea.q.hic) - ~& %gall-plea-coerced =< mo-abet (mo-gawk:(mo-abed:mo hen) him dap mes) :: From 65bea91f9d95d53ca41b5fd7d16b514bdcd07332 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 10 Aug 2019 11:58:08 -0700 Subject: [PATCH 082/151] start %ping on startup; fix printing bugs --- bin/solid.pill | 4 ++-- pkg/arvo/lib/hood/drum.hoon | 14 ++++++++------ pkg/arvo/sys/vane/alef.hoon | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index d73b977f9d..ccac15bbea 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf66821fdfe8dde68c995ef3bfcd51853e7a26571b1b1f6489cc4cbe70eb6143 -size 10137135 +oid sha256:459bdb70844deebd48f5eb2317babf5cc62678db691d3eb028fa942c929dbd80 +size 10362724 diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index ed61c9e990..4a84b63dcb 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -79,16 +79,18 @@ =+ myr=(clan:title our) :: ?: ?=($pawn myr) - :~ [%home %lens] - [%base %hall] - [%base %talk] - [%base %dojo] - [%base %modulo] - == + :~ [%home %lens] + [%base %hall] + [%base %talk] + [%base %dojo] + [%base %ping] + [%base %modulo] + == :~ [%home %lens] [%home %acme] [%home %dns] [%home %dojo] + [%home %ping] [%home %hall] [%home %talk] [%home %modulo] diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 45c1b0856c..16f4d72b93 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2367,7 +2367,7 @@ :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) - ~> %slog.0^leaf/"ames: send dupe message ack { %slog.0^leaf/"ames: send dupe message ack {}" (give %send seq %| ok lag=`@dr`0) :: last-acked %slog.0^leaf/"ames: rcv {}kb from {}" + ~> %slog.0^leaf/"ames: rcv {}kb from {}" =/ message=* (assemble-fragments [num-fragments fragments]:u.live) =. message-still (enqueue-to-vane seq message) :: From 173b3f84af5fcfe3753d664add15ed2560419e89 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 10 Aug 2019 13:46:53 -0700 Subject: [PATCH 083/151] more printf cleaning --- pkg/arvo/sys/vane/alef.hoon | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 16f4d72b93..ad655c986a 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -845,7 +845,7 @@ =/ =task ?. ?=(%soft -.wrapped-task) wrapped-task - ~| %alef-bad-task^p.wrapped-task + ~| %ames-bad-task^p.wrapped-task ;;(task p.wrapped-task) :: =/ event-core (per-event [our now eny scry-gate] duct ames-state) @@ -1747,7 +1747,7 @@ ++ on-still-boon |= [=message-num message=*] ^+ peer-core - ~> %slog.0^leaf/"ames: %boon {}" + ~> %slog.0^leaf/"ames: boon {}" :: send ack unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) @@ -1759,7 +1759,7 @@ ++ on-still-nack-trace |= [=message-num message=*] ^+ peer-core - ~> %slog.0^leaf/"ames: nack trace {}" + ~> %slog.0^leaf/"ames: nack trace {}" :: =+ ;; [=failed=^message-num =error] message :: ack nack-trace message (only applied if we don't later crash) @@ -1792,7 +1792,7 @@ ++ on-still-plea |= [=message-num message=*] ^+ peer-core - ~> %slog.0^leaf/"ames: rcvd %plea {}" + ~> %slog.0^leaf/"ames: plea {}" :: is this the first time we're trying to process this message? :: ?. ?=([%hear * * ok=%.n] task) @@ -2093,7 +2093,7 @@ ^+ [fragments gifts state] :: return unsent back to caller and reverse effects to finalize :: - =- ::~& %alef-feed^(lent fragments)^%unsent^(lent unsent) + =- ::~& %ames-feed^(lent fragments)^%unsent^(lent unsent) [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] @@ -2154,7 +2154,7 @@ ?. found.- ~> %slog.0^leaf/"ames: hear: no-op" packet-pump - ::~& %alef-hear-ack^message-num^fragment-num + ::~& %ames-hear-ack^message-num^fragment-num :: =. metrics.state metrics.- =. live.state live.- @@ -2362,12 +2362,12 @@ ?. is-last-fragment :: single packet ack :: - ~> %slog.0^leaf/"ames: send dupe ack {}" + ~> %slog.0^leaf/"ames: send dupe ack {}" (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? (~(has in nax.state) seq) - ~> %slog.0^leaf/"ames: send dupe message ack {}" + ~> %slog.0^leaf/"ames: send dupe message ack {}" (give %send seq %| ok lag=`@dr`0) :: last-acked %slog.0^leaf/"ames: %hear last {}" + ~> %slog.0^leaf/"ames: hear last in-progress {}" message-still :: ack all other packets :: @@ -2401,9 +2401,9 @@ :: ?: already-heard-fragment ?: is-last-fragment - ~> %slog.0^leaf/"ames: %hear last dupe {}" + ~> %slog.0^leaf/"ames: hear last dupe {}" message-still - ~> %slog.0^leaf/"ames: dupe {}" + ~> %slog.0^leaf/"ames: send dupe ack {}" (give %send seq %& fragment-num) :: new fragment; store in state and check if message is done :: @@ -2440,7 +2440,7 @@ =. last-heard.state +(last-heard.state) =. live-messages.state (~(del by live-messages.state) seq) :: - ~> %slog.0^leaf/"ames: rcv {}kb from {}" + ~> %slog.0^leaf/"ames: hear {} {}kb" =/ message=* (assemble-fragments [num-fragments fragments]:u.live) =. message-still (enqueue-to-vane seq message) :: From b890831d8235465b2ec6a96e27c61a77dacce2e4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 14:30:15 -0700 Subject: [PATCH 084/151] fixed alef tests --- pkg/arvo/tests/sys/vane/alef.hoon | 158 +++++++++++++++++------------- 1 file changed, 90 insertions(+), 68 deletions(-) diff --git a/pkg/arvo/tests/sys/vane/alef.hoon b/pkg/arvo/tests/sys/vane/alef.hoon index 42e904f482..97d2f1004c 100644 --- a/pkg/arvo/tests/sys/vane/alef.hoon +++ b/pkg/arvo/tests/sys/vane/alef.hoon @@ -5,61 +5,61 @@ :: =/ vane (alef !>(..zuse)) :: -=/ alice vane -=/ bob vane +=/ nec vane +=/ bud vane :: -=. our.alice ~nec -=. now.alice ~1111.1.1 -=. eny.alice 0xdead.beef -=. scry-gate.alice |=(* ``[%noun !>(*(list turf))]) +=. our.nec ~nec +=. now.nec ~1111.1.1 +=. eny.nec 0xdead.beef +=. scry-gate.nec |=(* ``[%noun !>(*(list turf))]) :: -=. our.bob ~doznec-doznec -=. now.bob ~1111.1.1 -=. eny.bob 0xbeef.dead -=. scry-gate.bob |=(* ``[%noun !>(*(list turf))]) +=. our.bud ~bud +=. now.bud ~1111.1.1 +=. eny.bud 0xbeef.dead +=. scry-gate.bud |=(* ``[%noun !>(*(list turf))]) :: -=. crypto-core.ames-state.alice (pit:nu:crub:crypto 512 (shaz 'alice')) -=. crypto-core.ames-state.bob (pit:nu:crub:crypto 512 (shaz 'bob')) +=. crypto-core.ames-state.nec (pit:nu:crub:crypto 512 (shaz 'nec')) +=. crypto-core.ames-state.bud (pit:nu:crub:crypto 512 (shaz 'bud')) :: -=/ alice-pub pub:ex:crypto-core.ames-state.alice -=/ alice-sec sec:ex:crypto-core.ames-state.alice -=/ bob-pub pub:ex:crypto-core.ames-state.bob -=/ bob-sec sec:ex:crypto-core.ames-state.bob +=/ nec-pub pub:ex:crypto-core.ames-state.nec +=/ nec-sec sec:ex:crypto-core.ames-state.nec +=/ bud-pub pub:ex:crypto-core.ames-state.bud +=/ bud-sec sec:ex:crypto-core.ames-state.bud :: -=/ alice-sym (derive-symmetric-key:vane bob-pub alice-sec) -=/ bob-sym (derive-symmetric-key:vane alice-pub bob-sec) +=/ nec-sym (derive-symmetric-key:vane bud-pub nec-sec) +=/ bud-sym (derive-symmetric-key:vane nec-pub bud-sec) :: -?> =(alice-sym bob-sym) +?> =(nec-sym bud-sym) :: -=. life.ames-state.alice 2 -=. peers.ames-state.alice - %+ ~(put by peers.ames-state.alice) ~doznec-doznec +=. life.ames-state.nec 2 +=. peers.ames-state.nec + %+ ~(put by peers.ames-state.nec) ~bud =| =peer-state:alef =. -.peer-state - :* symmetric-key=bob-sym + :* symmetric-key=bud-sym life=3 - public-key=bob-pub - sponsor=~marzod + public-key=bud-pub + sponsor=~nec == =. route.peer-state `[direct=%.y `lane:alef`[%& ~nec]] [%known peer-state] :: -=. life.ames-state.bob 3 -=. peers.ames-state.bob - %+ ~(put by peers.ames-state.bob) ~nec +=. life.ames-state.bud 3 +=. peers.ames-state.bud + %+ ~(put by peers.ames-state.bud) ~nec =| =peer-state:alef =. -.peer-state - :* symmetric-key=alice-sym + :* symmetric-key=nec-sym life=2 - public-key=alice-pub + public-key=nec-pub sponsor=~nec == =. route.peer-state `[direct=%.y `lane:alef`[%| `@`%lane-bar]] [%known peer-state] :: metamorphose :: -=> .(alice +:(call:(alice) ~[//unix] ** %born ~)) -=> .(bob +:(call:(bob) ~[//unix] ** %born ~)) +=> .(nec +:(call:(nec) ~[//unix] ** %born ~)) +=> .(bud +:(call:(bud) ~[//unix] ** %born ~)) :: helper core :: => @@ -85,16 +85,16 @@ (skim moves is-move-send) :: ++ call - |= [vane=_alice =duct =task:alef] - ^- [moves=(list move:alef) _alice] + |= [vane=_nec =duct =task:alef] + ^- [moves=(list move:alef) _nec] :: =/ vane-core (vane(now `@da`(add ~s1 now.vane))) :: (call:vane-core duct ** task) :: ++ take - |= [vane=_alice =wire =duct =sign:alef] - ^- [moves=(list move:alef) _alice] + |= [vane=_nec =wire =duct =sign:alef] + ^- [moves=(list move:alef) _nec] :: =/ vane-core (vane(now `@da`(add ~s1 now.vane))) :: @@ -106,7 +106,7 @@ ++ test-packet-encoding ^- tang :: =/ =packet:alef - :* [sndr=~nec rcvr=~doznec-doznec] + :* [sndr=~nec rcvr=~bud] encrypted=%.n origin=~ content=[12 13] @@ -134,23 +134,23 @@ == :: =/ =packet:alef - :* [sndr=~bus rcvr=~doznec-doznec] + :* [sndr=~bus rcvr=~bud] encrypted=%.y origin=~ - content=(encrypt:vane alice-sym shut-packet) + content=(encrypt:vane nec-sym shut-packet) == :: =/ =blob:alef (encode-packet:vane packet) - =^ moves1 bob (call bob ~[//unix] %hear lane-foo blob) - =^ moves2 bob + =^ moves1 bud (call bud ~[//unix] %hear lane-foo blob) + =^ moves2 bud =/ =point:alef :* rift=1 life=4 - keys=[[life=4 [crypto-suite=1 `@`alice-pub]] ~ ~] + keys=[[life=4 [crypto-suite=1 `@`nec-pub]] ~ ~] sponsor=`~bus == %- take - :^ bob /public-keys ~[//unix] + :^ bud /public-keys ~[//unix] ^- sign:alef [%k %public-keys %full [n=[~bus point] ~ ~]] :: @@ -160,49 +160,71 @@ !> moves1 :: %+ expect-eq - !> [~[//unix] %pass /bone/~bus/1 %g %plea ~bus %g /talk [%first %post]]~ - !> moves2 + !> %- sy + :~ :^ ~[//unix] %pass /bone/~bus/1 + [%g %plea ~bus %g /talk [%first %post]] + :: + :^ ~[//unix] %pass /qos + [%d %flog %text "; ~bus is your neighbor"] + == + !> (sy ,.moves2) == :: ++ test-message-flow ^- tang + :: ~nec -> %plea -> ~bud :: - =^ moves1 alice - (call alice ~[/alice] %plea ~doznec-doznec %g /talk [%get %post]) + =^ 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 :: - =^ moves2 bob (call bob ~[/bob] %hear (snag-packet 0 moves1)) - =^ moves3 bob (take bob /bone/~nec/1 ~[/bob] %g %done ~) - =^ moves4 alice (call alice ~[/alice] %hear (snag-packet 0 moves3)) - =^ moves5 bob - (take bob /bone/~nec/1 ~[/bob] %g %boon [%post 'first1!!']) + =^ moves3 bud (take bud /bone/~nec/1 ~[//unix] %g %done ~) + =^ moves4 nec (call nec ~[//unix] %hear (snag-packet 0 moves3)) + :: ~bud -> %boon -> ~nec :: - =^ moves6 alice (call alice ~[/alice] %hear (snag-packet 0 moves5)) - =^ moves7 bob (call bob ~[/bob] %hear (snag-packet 0 moves6)) + =^ moves5 bud (take bud /bone/~nec/1 ~[//unix] %g %boon [%post 'first1!!']) + =^ moves6 nec (call nec ~[//unix] %hear (snag-packet 0 moves5)) + :: ~nec -> %done -> ~bud (just make sure ~bud doesn't crash on ack) + :: + =^ moves7 bud (call bud ~[//unix] %hear (snag-packet 0 moves6)) :: ;: weld %+ expect-eq - !> :~ :+ ~[/alice] %give [%done error=~] - :+ ~[/alice] %pass - [/pump/~doznec-doznec/0 %b %rest ~1111.1.1..00.00.06] + !> :~ [~[//unix] %pass /qos %d %flog %text "; ~nec is your neighbor"] + [~[//unix] %pass /bone/~nec/1 %g %plea ~nec %g /talk [%get %post]] == - !> moves4 + !> moves2 :: %+ expect-eq - !> [~[/alice] %give %boon [%post 'first1!!']] + !> %- sy + :~ [~[//unix] %pass /qos %d %flog %text "; ~bud is your neighbor"] + [~[//unix] %pass /pump/~bud/0 %b %rest ~1111.1.1..00.00.06] + [~[/g/talk] %give %done error=~] + == + !> (sy ,.moves4) + :: + %+ expect-eq + !> [~[/g/talk] %give %boon [%post 'first1!!']] !> (snag 1 `(list move:alef)`moves6) == :: ++ test-nack ^- tang - =^ moves1 alice - (call alice ~[/alice] %plea ~doznec-doznec %g /talk [%get %post]) + :: ~nec -> %plea -> ~bud :: - =^ moves2 bob (call bob ~[/bob] %hear (snag-packet 0 moves1)) - =/ =error:alef [%flub [%leaf "sinusoidal repleneration"]~] - =^ moves3 bob (take bob /bone/~nec/1 ~[/bob] %g %done `error) - =^ moves4 alice (call alice ~[/alice] %hear (snag-packet 0 moves3)) - =^ moves5 alice (call alice ~[/alice] %hear (snag-packet 1 moves3)) - =^ moves6 bob (call bob ~[/bob] %hear (snag-packet 0 moves5)) + =^ moves1 nec (call nec ~[/g/talk] %plea ~bud %g /talk [%get %post]) + =^ moves2 bud (call bud ~[//unix] %hear (snag-packet 0 moves1)) + :: ~bud -> nack -> ~nec + :: + =/ =error:alef [%flub [%leaf "sinusoidal repleneration"]~] + =^ moves3 bud (take bud /bone/~nec/1 ~[/bud] %g %done `error) + =^ moves4 nec (call nec ~[//unix] %hear (snag-packet 0 moves3)) + :: ~bud -> nack-trace -> ~nec + :: + =^ moves5 nec (call nec ~[//unix] %hear (snag-packet 1 moves3)) + :: ~nec -> ack nack-trace -> ~bud + :: + =^ moves6 bud (call bud ~[//unix] %hear (snag-packet 0 moves5)) :: %+ expect-eq - !> [~[/alice] %give %done `error] + !> [~[/g/talk] %give %done `error] !> (snag 1 `(list move:alef)`moves5) -- From f28c011ed43ecd95982820d95384a6c1abc28a8b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 17:55:10 -0700 Subject: [PATCH 085/151] TEMP turn off extraneous apps on boot for dev --- pkg/arvo/lib/hood/drum.hoon | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index 4a84b63dcb..fb2b667c1e 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -79,26 +79,26 @@ =+ myr=(clan:title our) :: ?: ?=($pawn myr) - :~ [%home %lens] - [%base %hall] - [%base %talk] + :~ ::[%home %lens] + ::[%base %hall] + ::[%base %talk] [%base %dojo] [%base %ping] - [%base %modulo] + ::[%base %modulo] == - :~ [%home %lens] - [%home %acme] - [%home %dns] + :~ ::[%home %lens] + ::[%home %acme] + ::[%home %dns] [%home %dojo] [%home %ping] - [%home %hall] - [%home %talk] - [%home %modulo] - [%home %launch] - [%home %chat] - [%home %publish] - [%home %clock] - [%home %weather] + ::[%home %hall] + ::[%home %talk] + ::[%home %modulo] + ::[%home %launch] + ::[%home %chat] + ::[%home %publish] + ::[%home %clock] + ::[%home %weather] [%home %azimuth-tracker] == :: @@ -106,7 +106,8 @@ |= our/ship %- ~(gas in *(set gill:gall)) ^- (list gill:gall) - [[our %talk] [our %dojo] ~] + ::[[our %talk] [our %dojo] ~] + [[our %dojo] ~] :: ++ make :: initial part |= our/ship From d7199c63e9d17a238865d646a468eaa07b5b98e4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 17:55:35 -0700 Subject: [PATCH 086/151] TEMP speed up azimuth-tracker timeout --- pkg/arvo/app/azimuth-tracker.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/app/azimuth-tracker.hoon b/pkg/arvo/app/azimuth-tracker.hoon index 5fcb450a2d..5e5cd849b7 100644 --- a/pkg/arvo/app/azimuth-tracker.hoon +++ b/pkg/arvo/app/azimuth-tracker.hoon @@ -299,7 +299,7 @@ =* walk-loop $ ?: (gth number.state number.id.latest-block) ;< now=@da bind:m get-time:stdio - ;< ~ bind:m (wait-effect:stdio (add now ~m5)) + ;< ~ bind:m (wait-effect:stdio (add now ~s5)) (pure:m state) ;< =block bind:m (get-block-by-number url.state number.state) ;< [=new=pending-udiffs new-blocks=(lest ^block)] bind:m From eb654e1a9de84c3fb76469c75bf3471e358ee8b8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 17:56:08 -0700 Subject: [PATCH 087/151] ph: another planet test --- pkg/arvo/app/ph.hoon | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/arvo/app/ph.hoon b/pkg/arvo/app/ph.hoon index ea85e1af90..fa50c4ae18 100644 --- a/pkg/arvo/app/ph.hoon +++ b/pkg/arvo/app/ph.hoon @@ -144,6 +144,24 @@ ~[~bud ~marbud ~linnup-torsyx] =. eth-node (spawn:eth-node ~marbud) =. eth-node (spawn:eth-node ~linnup-torsyx) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx) + ~& > 'LINNUP DONE' + ;< ~ bind:m (send-hi ~linnup-torsyx ~marbud) + ~& > 'HI DONE-------------------------------' + (pure:m ~) + (pure:m ~) + :: + :+ %hi-linnup-az-backward + ~[~bud ~marbud ~linnup-torsyx] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~linnup-torsyx) ;< [eth-node=_eth-node ~] bind:m %+ (wrap-philter ,_eth-node ,~) router:eth-node From 3c8a0164cee2630ea97f4195674738938edea4e1 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 17:56:37 -0700 Subject: [PATCH 088/151] %ping: print on ping --- pkg/arvo/app/ping.hoon | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index ad097b7984..c59518e087 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -39,6 +39,7 @@ :: ?: =(%czar (clan:title our.bowl)) [~ app-core] + ~> %slog.0^leaf/"ping: prep {}" send-ping :: +coup-ping-send: handle ames ack :: @@ -79,6 +80,7 @@ :: =/ sponsor=ship (sein:title [our now our]:bowl) :: + ~> %slog.0^leaf/"ping: {} -> {}" :_ app-core [ost.bowl %poke /ping-send [sponsor %ping] %noun ~]~ -- From 66e62f1edb53ead11dbde75a1d3a2c44aa7bc046 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 13 Aug 2019 17:56:56 -0700 Subject: [PATCH 089/151] (hopefully) fix alef alien encounter --- pkg/arvo/sys/vane/alef.hoon | 73 +++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index ad655c986a..c67b35a169 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1228,7 +1228,27 @@ ^+ event-core :: ~> %slog.0^leaf/"ames: rekey {}" - (insert-peer-state ship (got-peer-state ship) life public-key) + :: + =/ ship-state (~(get by peers.ames-state) ship) + ?. ?=([~ %known *] ship-state) + =| =point + =. life.point life + =. keys.point (my [life crypto-suite public-key]~) + =. sponsor.point `(^sein:title ship) + :: + (on-publ-full (my [ship point]~)) + :: + =/ =peer-state +.u.ship-state + :: + =/ =private-key sec:ex:crypto-core.ames-state + =. symmetric-key.peer-state + (derive-symmetric-key public-key private-key) + :: + =. life.peer-state life + =. public-key.peer-state public-key + :: + =. peers.ames-state (~(put by peers.ames-state) ship %known peer-state) + event-core :: +on-publ-sponsor: handle new or lost sponsor for peer :: :: TODO: handle sponsor loss @@ -1257,34 +1277,18 @@ :: =+ ^- [=ship =point] i.points :: - =. event-core - ?~ ship-state=(~(get by peers.ames-state) ship) - ~> %slog.0^leaf/"ames: new peer {}" - (fresh-peer ship point) - :: - ?: ?=([~ %alien *] ship-state) - ~> %slog.0^leaf/"ames: met alien {}" - (meet-alien ship point +.u.ship-state) - :: - ~> %slog.0^leaf/"ames: update peer {}" - (update-known ship point +.u.ship-state) + =/ old-ship-state (~(get by peers.ames-state) ship) + :: + =. event-core (insert-peer-state ship point) + :: + =? event-core ?=([~ %alien *] old-ship-state) + (meet-alien ship point +.u.old-ship-state) :: $(points t.points) :: - ++ fresh-peer - |= [=ship =point] - ^+ event-core - :: - =/ =public-key pass:(~(got by keys.point) life.point) - (insert-peer-state ship *peer-state life.point public-key) - :: ++ meet-alien |= [=ship =point todos=pending-requests] ^+ event-core - :: - =/ =public-key pass:(~(got by keys.point) life.point) - =. event-core - (insert-peer-state ship *peer-state life.point public-key) :: apply incoming packets :: =. event-core @@ -1321,25 +1325,21 @@ $(blobs t.blobs) :: event-core - :: - ++ update-known - |= [=ship =point =peer-state] - ^+ event-core - :: - =/ =public-key pass:(~(got by keys.point) life.point) - (insert-peer-state ship peer-state life.point public-key) -- :: ++ insert-peer-state - |= [=ship =peer-state =life =public-key] + |= [=ship =point] ^+ event-core :: + =/ =peer-state (gut-peer-state ship) + =/ =public-key pass:(~(got by keys.point) life.point) =/ =private-key sec:ex:crypto-core.ames-state =/ =symmetric-key (derive-symmetric-key public-key private-key) :: - =. life.peer-state life + =. life.peer-state life.point =. public-key.peer-state public-key =. symmetric-key.peer-state symmetric-key + =. sponsor.peer-state (fall sponsor.point (^sein:title ship)) :: automatically set galaxy route, since unix handles lookup :: =? route.peer-state ?=(%czar (clan:title ship)) @@ -1477,6 +1477,15 @@ ~| %freaky-alien^her =- ?>(?=(%known -<) ->) (~(got by peers.ames-state) her) + :: +gut-peer-state: lookup .her state or default + :: + ++ gut-peer-state + |= her=ship + ^- peer-state + =/ ship-state (~(get by peers.ames-state) her) + ?. ?=([~ %known *] ship-state) + *peer-state + +.u.ship-state :: +make-peer-core: create nested |peer-core for per-peer processing :: ++ make-peer-core From 1cde58b960ae9289005d6df8cacd9ff045830c78 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 15 Aug 2019 20:09:48 -0700 Subject: [PATCH 090/151] plug alien queue space leak --- pkg/arvo/sys/vane/alef.hoon | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index c67b35a169..991b90d716 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1068,6 +1068,10 @@ ?. ?=([~ %known *] sndr-state) %+ enqueue-alien-todo sndr.packet |= todos=pending-requests + :: only enqueue one packet from an alien, to plug space leak + :: + ?. =(~ rcv-packets.todos) + todos todos(rcv-packets [[lane packet] rcv-packets.todos]) :: decrypt packet contents using symmetric-key.channel :: From f26b71aa069830a4e9719e6fb685deb968d3ca50 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 15 Aug 2019 21:12:59 -0700 Subject: [PATCH 091/151] ames: only forward downward --- pkg/arvo/sys/vane/alef.hoon | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 991b90d716..5b83bb7783 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -754,6 +754,7 @@ =/ =task ?. ?=(%soft -.wrapped-task) wrapped-task + ~| our^%ames-fail-soft ;;(task p.wrapped-task) :: %born: set .unix-duct and start draining .queued-events :: @@ -981,11 +982,28 @@ on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: - :: TODO: filter for transitive closure of sponsors/sponsees. + :: Only forward downward, to limit DDoS amplification vectors: + :: Galaxies forward to stars and below. + :: Stars forward to planets and below. + :: Planets forward to moons. + :: + :: Also, only stars forward to comets, since only a star can be a + :: comet's sponsor. :: ++ on-hear-forward |= [=lane =packet ok=?] ^+ event-core + :: only forward downward + :: + ?: %+ lte + rank:(encode-ship-metadata sndr.packet) + rank:(encode-ship-metadata our) + :: + event-core + :: only stars forward to comets + :: + ?: &(=(%pawn (clan:title sndr.packet)) !=(%king (clan:title our))) + event-core :: =/ ship-state (~(get by peers.ames-state) rcvr.packet) :: ignore packets to unfamiliar ships From 25e04c208442a069fb90dccd8303eb227476e64e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 16 Aug 2019 01:37:20 -0700 Subject: [PATCH 092/151] aqua: stop DDoS'ing yourslef --- pkg/arvo/app/aqua-ames.hoon | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/app/aqua-ames.hoon b/pkg/arvo/app/aqua-ames.hoon index 6db84b86f4..078d1238c0 100644 --- a/pkg/arvo/app/aqua-ames.hoon +++ b/pkg/arvo/app/aqua-ames.hoon @@ -61,7 +61,7 @@ =. this ?+ -.q.i.ufs.afs this %restore (handle-restore who.afs) - %send (handle-send i.ufs.afs) + %send (handle-send who.afs i.ufs.afs) == $(ufs.afs t.ufs.afs) :: @@ -71,13 +71,30 @@ [%event who [//newt/0v1n.2m9vh %born ~]]~ :: ++ handle-send - |= [way=wire %send lan=lane:ames pac=@] + |= [sndr=ship way=wire %send lan=lane:ames pac=@] ^+ this - =/ hear [//newt/0v1n.2m9vh %hear lan pac] - =? ships =(~ ships) - .^((list ship) %gx /(scot %p our)/aqua/(scot %da now)/ships/noun) + =/ rcvr=ship (lane-to-ship lan) + =/ hear-lane (ship-to-lane sndr) + ::~> %slog.0^leaf/"aqua: {(scow %p sndr)} -> {(scow %p rcvr)}" %- emit-aqua-events - %+ turn ships - |= who=ship - [%event who hear] + [%event rcvr //newt/0v1n.2m9vh %hear hear-lane pac]~ +:: +lane-to-ship: decode a ship from an aqua lane +:: +++ lane-to-ship + |= =lane:ames + ^- ship + :: + ?- -.lane + %& p.lane + %| `ship``@`p.lane + == +:: +ship-to-lane: encode a lane to look like it came from .ship +:: +:: Never shows up as a galaxy, because Vere wouldn't know that either. +:: +++ ship-to-lane + |= =ship + ^- lane:ames + :: + [%| `address:ames``@`ship] -- From 77987d292d6064100d9d7b63006c3ef57c6e41df Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 16 Aug 2019 02:26:03 -0700 Subject: [PATCH 093/151] ames: redo forwarding logic --- pkg/arvo/sys/vane/alef.hoon | 91 ++++++++++++++----------------------- 1 file changed, 35 insertions(+), 56 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 5b83bb7783..6f8715ae49 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -982,43 +982,14 @@ on-hear-open :: +on-hear-forward: maybe forward a packet to someone else :: - :: Only forward downward, to limit DDoS amplification vectors: - :: Galaxies forward to stars and below. - :: Stars forward to planets and below. - :: Planets forward to moons. - :: - :: Also, only stars forward to comets, since only a star can be a - :: comet's sponsor. + :: TODO: DDoS protection, possibly in Vere :: ++ on-hear-forward |= [=lane =packet ok=?] ^+ event-core - :: only forward downward - :: - ?: %+ lte - rank:(encode-ship-metadata sndr.packet) - rank:(encode-ship-metadata our) - :: - event-core - :: only stars forward to comets - :: - ?: &(=(%pawn (clan:title sndr.packet)) !=(%king (clan:title our))) - event-core - :: - =/ ship-state (~(get by peers.ames-state) rcvr.packet) - :: ignore packets to unfamiliar ships - :: - ?. ?=([~ %known *] ship-state) - event-core - :: if we don't have a lane to .rcvr, give up - :: - ?~ rcvr-lane=route.+.u.ship-state - event-core :: set .origin.packet, re-encode, and send :: - =/ =blob (encode-packet packet(origin `lane)) - :: - (emit unix-duct.ames-state %give %send lane.u.rcvr-lane blob) + (send-blob rcvr.packet (encode-packet packet(origin `lane))) :: +on-hear-open: handle receipt of plaintext comet self-attestation :: ++ on-hear-open @@ -1111,7 +1082,7 @@ :: =? route.peer-state !=(%czar (clan:title her.channel)) ?~ origin.packet - `[direct=%.n lane] + `[direct=%.y lane] `[direct=%.n u.origin.packet] :: perform peer-specific handling of packet :: @@ -1436,38 +1407,46 @@ (emit duct %pass /public-keys %k %public-keys [n=ship ~ ~]) :: +send-blob: fire packet at .ship and maybe sponsors :: - :: Send to .ship and sponsors until we find a direct lane. + :: Send to .ship and sponsors until we find a direct lane or + :: encounter .our in the sponsorship chain. + :: :: If we have no PKI data for a recipient, enqueue the packet and :: request the information from Jael if we haven't already. :: ++ send-blob |= [=ship =blob] - ^+ event-core :: - =/ ship-state (~(get by peers.ames-state) ship) + |^ ^+ event-core + :: + =/ ship-state (~(get by peers.ames-state) ship) + :: + ?. ?=([~ %known *] ship-state) + %+ enqueue-alien-todo ship + |= todos=pending-requests + todos(snd-packets (~(put in snd-packets.todos) blob)) + :: + =/ =peer-state +.u.ship-state + :: + ?~ route=route.peer-state + (try-next-sponsor sponsor.peer-state) + :: + =. event-core + (emit unix-duct.ames-state %give %send lane.u.route blob) + :: + ?: direct.u.route + event-core + (try-next-sponsor sponsor.peer-state) :: - ?. ?=([~ %known *] ship-state) - %+ enqueue-alien-todo ship - |= todos=pending-requests - todos(snd-packets (~(put in snd-packets.todos) blob)) - :: - =/ =peer-state +.u.ship-state - =/ =channel [[our ship] now |2.ames-state -.peer-state] - :: - ?~ route=route.peer-state - ?: =(ship her-sponsor.channel) + ++ try-next-sponsor + |= sponsor=^ship + ^+ event-core + :: + ?: =(ship sponsor) event-core - $(ship her-sponsor.channel) - :: - =. event-core - (emit unix-duct.ames-state %give %send lane.u.route blob) - :: - ?: direct.u.route - event-core - :: - ?: =(ship her-sponsor.channel) - event-core - $(ship her-sponsor.channel) + ?: =(our sponsor) + event-core + ^$(ship sponsor) + -- :: +attestation-packet: generate signed self-attestation for .her :: :: Sent by a comet on first contact with a peer. Not acked. From 98c6254d662c417bded33e6ba8611d15337a56da Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 19 Aug 2019 16:40:57 -0700 Subject: [PATCH 094/151] fix jael after merge --- pkg/arvo/sys/vane/jael.hoon | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 90a02e4810..37335be07c 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -61,8 +61,10 @@ +$ message :: message to her jael $% [%nuke whos=(set ship)] :: cancel trackers [%public-keys whos=(set ship)] :: view ethereum events - [%public-keys-result =public-keys-result] :: tmp workaround == :: ++$ message-result + $% [%public-keys-result =public-keys-result] :: public keys boon + == +$ card :: i/o action (wind note gift) :: :: :: @@ -492,14 +494,6 @@ %public-keys =. moz [[hen %give %done ~] moz] $(tac mes) - :: - :: receive keys result - :: [%public-keys-result =public-keys-result] - :: - %public-keys-result - =. moz [[hen %give %done ~] moz] - %- curd =< abet - (public-keys:~(feel su hen our pki etn) public-keys-result.mes) == == :: @@ -513,6 +507,11 @@ %- (slog tang.u.error.hin) ::TODO fail:et +>.$ + :: + [%a %boon *] + =+ ;; [%public-keys-result =public-keys-result] payload.hin + %- curd =< abet + (public-keys:~(feel su hen our pki etn) public-keys-result) :: [%g %onto *] ~& [%jael-onto tea hin] @@ -538,8 +537,6 @@ ?> ?=([@ *] tea) =* app i.tea =/ =peer-sign ;;(peer-sign q.q.p.p.+>.hin) - %. [hen tea app] - =< pump %- curd =< abet (~(new-event su hen our pki etn) peer-sign) == @@ -551,10 +548,6 @@ etn/state-eth-node == +>(pki pki, etn etn, moz (weld (flop moz) ^moz)) - :: :: ++wind:of - ++ pump - |= [hen=duct =wire app=term] - (emit [hen %pass wire %g %deal [our our] app %pump ~]) -- :: :: ++su :::: ## relative^heavy :: subjective engine @@ -632,9 +625,9 @@ [d %give %public-keys public-keys-result] =/ our (slav %p i.t.i.d) =/ who (slav %p i.t.t.i.d) - =/ =message [%public-keys-result public-keys-result] + =/ =message-result [%public-keys-result public-keys-result] %- emit - [d %give %boon message] + [d %give %boon message-result] $(yez t.yez) :: ++ get-source @@ -988,7 +981,7 @@ ?: fak.own.pki.lex =/ cub (pit:nu:crub:crypto 512 u.who) :^ ~ ~ %noun - !> `deed:ames`[1 pub:ex:cub ~] + !> [1 pub:ex:cub ~] :: =/ rac (clan:title u.who) ?: ?=(%pawn rac) From 6b1e7e441d158c895c2a9e8f26e7671627985b26 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 19 Aug 2019 16:41:05 -0700 Subject: [PATCH 095/151] update solid pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index ccac15bbea..9c39eabacd 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:459bdb70844deebd48f5eb2317babf5cc62678db691d3eb028fa942c929dbd80 -size 10362724 +oid sha256:958ec9a401990f8ba90233edad19fb3d11c5828153679cda0b5f81a6054704d6 +size 13061779 From 45b22cd0a783e07acb36561fc7b2a33e7adb54fc Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 19 Aug 2019 16:54:30 -0700 Subject: [PATCH 096/151] do not look into the duct --- pkg/arvo/sys/vane/jael.hoon | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 37335be07c..5d353c2d6f 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -623,11 +623,8 @@ ?. &(?=([[%a @ @ *] *] d) !=(%pubs i.t.i.d)) %- emit [d %give %public-keys public-keys-result] - =/ our (slav %p i.t.i.d) - =/ who (slav %p i.t.t.i.d) - =/ =message-result [%public-keys-result public-keys-result] %- emit - [d %give %boon message-result] + [d %give %boon %public-keys-result public-keys-result] $(yez t.yez) :: ++ get-source From 137be0ffde0b0bb34751fe5b401df5cbebfeaa3a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 20 Aug 2019 14:44:44 -0700 Subject: [PATCH 097/151] alef: fix .origin.packet and a printf --- pkg/arvo/app/aqua-ames.hoon | 7 ++++++- pkg/arvo/sys/vane/alef.hoon | 10 ++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/app/aqua-ames.hoon b/pkg/arvo/app/aqua-ames.hoon index 078d1238c0..b8c1306f34 100644 --- a/pkg/arvo/app/aqua-ames.hoon +++ b/pkg/arvo/app/aqua-ames.hoon @@ -75,7 +75,12 @@ ^+ this =/ rcvr=ship (lane-to-ship lan) =/ hear-lane (ship-to-lane sndr) - ::~> %slog.0^leaf/"aqua: {(scow %p sndr)} -> {(scow %p rcvr)}" + => ?. ?| =(rcvr ~linnup-torsyx-linnup-torsyx) + =(sndr ~linnup-torsyx-linnup-torsyx) + == + . + ~> %slog.0^leaf/"aqua: {(scow %p sndr)} -> {(scow %p rcvr)}" + . %- emit-aqua-events [%event rcvr //newt/0v1n.2m9vh %hear hear-lane pac]~ :: +lane-to-ship: decode a ship from an aqua lane diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 9772fe5513..cea1bef33b 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -987,9 +987,11 @@ ++ on-hear-forward |= [=lane =packet ok=?] ^+ event-core - :: set .origin.packet, re-encode, and send + :: set .origin.packet if it doesn't already have one, re-encode, and send :: - (send-blob rcvr.packet (encode-packet packet(origin `lane))) + =? origin.packet ?=(~ origin.packet) `lane + =/ =blob (encode-packet packet) + (send-blob rcvr.packet blob) :: +on-hear-open: handle receipt of plaintext comet self-attestation :: ++ on-hear-open @@ -2376,8 +2378,8 @@ (give %send seq %& fragment-num) :: whole message (n)ack :: - =/ ok=? (~(has in nax.state) seq) - ~> %slog.0^leaf/"ames: send dupe message ack {}" + =/ ok=? !(~(has in nax.state) seq) + ~> %slog.0^leaf/"ames: send dupe message ack {} ok={}" (give %send seq %| ok lag=`@dr`0) :: last-acked Date: Thu, 22 Aug 2019 19:51:51 -0700 Subject: [PATCH 098/151] alef: preserve peer pki data on breach --- pkg/arvo/sys/vane/alef.hoon | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index cea1bef33b..bda6abc261 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1203,12 +1203,38 @@ :: TODO: cancel all timers? otherwise we'll get spurious firings :: from behn :: + :: TODO: cancel gall subscriptions on breach + :: ++ on-publ-breach |= [=ship =rift] ^+ event-core :: ~> %slog.0^leaf/"ames: breach {}" - =. peers.ames-state (~(del by peers.ames-state) ship) + =/ ship-state (~(get by peers.ames-state) ship) + :: we shouldn't be hearing about ships we don't care about + :: + ?~ ship-state + ~> %slog.0^leaf/"ames: unknown breach {}" + event-core + :: if an alien breached, this doesn't affect us + :: + ?: ?=([~ %alien *] ship) + event-core + :: a peer breached; drop messaging state + :: + =/ =peer-state +.u.ship-state + =. peers.ames-state + %+ ~(put by peers.ames-state) ship + :: reset all peer state other than pki data + :: + =. +.peer-state +:*^peer-state + :: reinitialize galaxy route if applicable + :: + =? route.peer-state =(%czar (clan:title ship)) + `[direct=%.y lane=[%& ship]] + :: + peer-state + :: event-core :: +on-publ-rekey: handle new key for peer :: From bad425660ce867fe865f763a845c7bb080179af8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 22 Aug 2019 20:53:45 -0700 Subject: [PATCH 099/151] alef: %breach-hi aqua test passes --- pkg/arvo/sys/vane/alef.hoon | 40 +++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index bda6abc261..169a0b2a8a 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1197,7 +1197,7 @@ == :: +on-publ-breach: handle continuity breach of .ship; wipe its state :: - :: Abandon all pretense of continuity and delete all state + :: Abandon all pretense of continuity and delete all messaging state :: associated with .ship, including sent and unsent messages. :: :: TODO: cancel all timers? otherwise we'll get spurious firings @@ -1209,31 +1209,38 @@ |= [=ship =rift] ^+ event-core :: - ~> %slog.0^leaf/"ames: breach {}" =/ ship-state (~(get by peers.ames-state) ship) :: we shouldn't be hearing about ships we don't care about :: ?~ ship-state - ~> %slog.0^leaf/"ames: unknown breach {}" + ~> %slog.0^leaf/"ames: breach unknown {}" event-core :: if an alien breached, this doesn't affect us :: - ?: ?=([~ %alien *] ship) + ?: ?=([~ %alien *] ship-state) + ~> %slog.0^leaf/"ames: breach alien {}" event-core + ~> %slog.0^leaf/"ames: breach peer {}" :: a peer breached; drop messaging state :: =/ =peer-state +.u.ship-state + =/ old-qos=qos qos.peer-state + :: reset all peer state other than pki data + :: + =. +.peer-state +:*^peer-state + :: print change to quality of service, if any + :: + =/ text=(unit tape) (qos-update-text ship old-qos qos.peer-state) + :: + =? event-core ?=(^ text) + (emit duct %pass /qos %d %flog %text u.text) + :: reinitialize galaxy route if applicable + :: + =? route.peer-state =(%czar (clan:title ship)) + `[direct=%.y lane=[%& ship]] + :: =. peers.ames-state - %+ ~(put by peers.ames-state) ship - :: reset all peer state other than pki data - :: - =. +.peer-state +:*^peer-state - :: reinitialize galaxy route if applicable - :: - =? route.peer-state =(%czar (clan:title ship)) - `[direct=%.y lane=[%& ship]] - :: - peer-state + (~(put by peers.ames-state) ship [%known peer-state]) :: event-core :: +on-publ-rekey: handle new key for peer @@ -1577,6 +1584,8 @@ :: update and print connection state :: =. peer-core %- update-qos + ?: ?=(%unborn -.qos.peer-state) + [%dead now] ?. ?& ?=(%live -.qos.peer-state) (gte now (add ~s30 last-contact.qos.peer-state)) == @@ -2525,8 +2534,9 @@ :: ?+ [-.old -.new] ~ [%unborn %live] `"; {(scow %p ship)} is your neighbor" - [%live %dead] `"; {(scow %p ship)} not responding still trying" [%dead %live] `"; {(scow %p ship)} is ok" + [%live %dead] `"; {(scow %p ship)} not responding still trying" + [%unborn %dead] `"; {(scow %p ship)} not responding still trying" [%live %unborn] `"; {(scow %p ship)} is dead" [%dead %unborn] `"; {(scow %p ship)} is dead" == From 507a5f722fb4d727d2e608b4c49c740dd9e424ce Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 22 Aug 2019 22:53:38 -0700 Subject: [PATCH 100/151] alef: stop queueing alien packets; %breach-sudden passes --- pkg/arvo/app/ph.hoon | 6 ++++-- pkg/arvo/sys/vane/alef.hoon | 30 +++++++----------------------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/pkg/arvo/app/ph.hoon b/pkg/arvo/app/ph.hoon index fa50c4ae18..d1e0629ecb 100644 --- a/pkg/arvo/app/ph.hoon +++ b/pkg/arvo/app/ph.hoon @@ -345,9 +345,11 @@ ;< [eth-node=_eth-node ~] bind:m %+ (wrap-philter ,_eth-node ,~) router:eth-node - ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ;< ~ bind:m (raw-real-ship:eth-node ~bud) ~& > 'BUD RE DONE' - ;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this")) + ;< ~ bind:m (send-hi ~bud ~marbud) + ~& > 'BUD HI MARBUD' + ;< ~ 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' diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 169a0b2a8a..1d88687ab8 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -408,13 +408,11 @@ == :: $pending-requests: what to do when we learn a peer's life and keys :: -:: rcv-packets: packets we've received from unix :: snd-messages: pleas local vanes have asked us to send :: snd-packets: packets we've tried to send :: +$ pending-requests - $: rcv-packets=(list [=lane =packet]) - snd-messages=(list [=duct =plea]) + $: snd-messages=(list [=duct =plea]) snd-packets=(set =blob) == :: $peer-state: state for a peer with known life and keys @@ -1054,16 +1052,10 @@ ?> ?=(@ content.packet) :: =/ sndr-state (~(get by peers.ames-state) sndr.packet) - :: if we don't know them, enqueue the packet to be handled later + :: if we don't know them, maybe enqueue a jael %public-keys request :: ?. ?=([~ %known *] sndr-state) - %+ enqueue-alien-todo sndr.packet - |= todos=pending-requests - :: only enqueue one packet from an alien, to plug space leak - :: - ?. =(~ rcv-packets.todos) - todos - todos(rcv-packets [[lane packet] rcv-packets.todos]) + (enqueue-alien-todo sndr.packet (bake same pending-requests)) :: decrypt packet contents using symmetric-key.channel :: :: If we know them, we have a $channel with them, which we've @@ -1120,7 +1112,7 @@ =/ =channel [[our ship] now |2.ames-state -.peer-state] :: =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) - ~> %slog.0^leaf/"ames: plea {}" + ~> %slog.0^leaf/"ames: plea {<[our our-life.channel]^[ship her-life.channel]^bone^vane.plea^path.plea>}" :: abet:(on-memo:(make-peer-core peer-state channel) bone plea) :: +on-take-wake: receive wakeup or error notification from behn @@ -1317,17 +1309,7 @@ ++ meet-alien |= [=ship =point todos=pending-requests] ^+ event-core - :: apply incoming packets - :: - =. event-core - |- ^+ event-core - ?~ rcv-packets.todos event-core - :: - =. event-core - (on-hear-packet [lane packet ok=%.y]:i.rcv-packets.todos) - :: - $(rcv-packets.todos t.rcv-packets.todos) - :: we're a comet; send self-attestation packet first + :: if we're a comet, send self-attestation packet first :: =? event-core =(%pawn (clan:title our)) (send-blob ship (attestation-packet ship life.point)) @@ -2132,6 +2114,8 @@ =. sent-date.val now.channel =. retried.val %.y :: + ~& [%ames-resend [our our-life her her-life]:channel key] + :: [`val stop=%.n (dec num-slots.acc) packet-pump] :: +feed: try to send a list of packets, returning unsent and effects :: From a50181b65cd3db99a50a164e5466c985e1521c5e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 23 Aug 2019 18:19:50 -0700 Subject: [PATCH 101/151] fix old jael subscription bug; aqua %hi-cousin-az passes --- pkg/arvo/app/ph.hoon | 63 +++++++++++++++++++++++++++++++++++++ pkg/arvo/sys/vane/jael.hoon | 8 +++-- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/ph.hoon b/pkg/arvo/app/ph.hoon index d1e0629ecb..1d67604908 100644 --- a/pkg/arvo/app/ph.hoon +++ b/pkg/arvo/app/ph.hoon @@ -139,6 +139,60 @@ ~& > 'BUD-DONE' (send-hi ~bud ~marbud) (pure:m ~) + :: + :+ %hi-uncle-az + ~[~bud ~marbud ~dev] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~dev) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > 'BUD-DONE' + (send-hi ~marbud ~dev) + ~& > 'HI DONE' + (pure:m ~) + :: + :+ %hi-nephew-az + ~[~bud ~marbud ~dev] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~dev) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > 'BUD-DONE' + (send-hi ~dev ~marbud) + ~& > 'HI DONE' + (pure:m ~) + :: + :+ %hi-cousin-az + ~[~bud ~marbud ~dev ~mardev] + =. eth-node (spawn:eth-node ~marbud) + =. eth-node (spawn:eth-node ~dev) + =. eth-node (spawn:eth-node ~mardev) + ;< [eth-node=_eth-node ~] bind:m + %+ (wrap-philter ,_eth-node ,~) + router:eth-node + ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > 'BUD-DONE' + ;< ~ bind:m (raw-real-ship:eth-node ~mardev) + ~& > 'MARDEV-DONE' + (send-hi ~mardev ~marbud) + ~& > 'HI DONE' + (pure:m ~) :: :+ %hi-linnup-az ~[~bud ~marbud ~linnup-torsyx] @@ -240,18 +294,27 @@ %+ (wrap-philter ,_eth-node ,~) router:eth-node ;< ~ bind:m (raw-real-ship:eth-node ~bud) + ~& > 'BUD DONE' ;< ~ bind:m (raw-real-ship:eth-node ~dev) + ~& > 'DEV DONE' ;< ~ bind:m (raw-real-ship:eth-node ~marbud) + ~& > 'MARBUD DONE' ;< ~ bind:m (raw-real-ship:eth-node ~mardev) + ~& > 'MARDEV DONE' (send-hi ~marbud ~mardev) + ~& > 'HI MARBUD MARDEV' ;< eth-node=_eth-node bind:m (breach-and-hear:eth-node our.hid ~mardev ~marbud) + ~& > 'BREACH MARDEV' ;< [eth-node=_eth-node ~] bind:m %+ (wrap-philter ,_eth-node ,~) router:eth-node ;< ~ bind:m (send-hi-not-responding ~marbud ~mardev) + ~& > 'HI NOT RESPONDING' ;< ~ bind:m (raw-real-ship:eth-node ~mardev) + ~& > 'MARDEV RE DONE' (wait-for-dojo ~marbud "hi ~mardev successful") + ~& > 'DONE' (pure:m ~) :: :+ %breach-sync diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index fad6b7cfcb..52bd0ae4fd 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -791,9 +791,11 @@ |- ^+ ..feel ?~ pointl ..feel - %+ public-keys-give - (subscribers-on-ship who.i.pointl) - [%full (my i.pointl ~)] + =. ..feel + %+ public-keys-give + (subscribers-on-ship who.i.pointl) + [%full (my i.pointl ~)] + $(pointl t.pointl) =* who who.public-keys-result =/ a-diff=diff:point diff.public-keys-result =/ maybe-point (~(get by pos.zim) who) From fc9e382cf157c48c5b5b7d29da8d3183828ae3ab Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 13:54:16 -0700 Subject: [PATCH 102/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 9c39eabacd..5d1dad8ff9 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:958ec9a401990f8ba90233edad19fb3d11c5828153679cda0b5f81a6054704d6 -size 13061779 +oid sha256:d7b16544b9ab01bc185e85831b8054f69af58fbe27daa6d8b68263432c376dc1 +size 13150031 From dff9d6eba34064735985927e63f87233c59cbbd4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 14:18:46 -0700 Subject: [PATCH 103/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 5d1dad8ff9..f357ab8bac 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7b16544b9ab01bc185e85831b8054f69af58fbe27daa6d8b68263432c376dc1 -size 13150031 +oid sha256:0cc9b2acf33f76f0a41fda2522fc2b90c5f5d00b16230c2d4c4b8fd4dd55a074 +size 13155446 From 4ff5302c3d98b09187c62b65f71b4e50d4ce4f0a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 15:56:24 -0700 Subject: [PATCH 104/151] update ivory pill --- bin/ivory.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ivory.pill b/bin/ivory.pill index 3ffbd083f7..0df4a6f22d 100644 --- a/bin/ivory.pill +++ b/bin/ivory.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eb747c039645dc647a919a4f26f216b46fcfbb5964f667da329369b5798d3839 -size 5309578 +oid sha256:ca25931cd5e915a250884f0bd54a02b02b59378ba7026e4da0f3008330f186cb +size 5609666 From 7a58bcd50e7ef740b38f13b4ae8778b49ad5728a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 16:09:56 -0700 Subject: [PATCH 105/151] fix testnet config in zuse --- pkg/arvo/sys/zuse.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 141f41f057..bec64013a3 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -7457,7 +7457,7 @@ :: # constants :: :: contract addresses - ++ contracts mainnet-contracts + ++ contracts ropsten-contracts ++ mainnet-contracts |% :: azimuth: data contract From 33ebf6c1a5178f9fb115aebfa347a092676a794e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 16:10:07 -0700 Subject: [PATCH 106/151] update pills --- bin/ivory.pill | 2 +- bin/solid.pill | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/ivory.pill b/bin/ivory.pill index 0df4a6f22d..3eee6b0e6f 100644 --- a/bin/ivory.pill +++ b/bin/ivory.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ca25931cd5e915a250884f0bd54a02b02b59378ba7026e4da0f3008330f186cb +oid sha256:04ed9fd682f427f8bb419e2b75a6fdbdbb62b06d3341589ec7ac9e74ca3050f4 size 5609666 diff --git a/bin/solid.pill b/bin/solid.pill index f357ab8bac..98e4c6401f 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0cc9b2acf33f76f0a41fda2522fc2b90c5f5d00b16230c2d4c4b8fd4dd55a074 -size 13155446 +oid sha256:433ae52c22061f5cab5fcf5862702986614b7ff371058afd2853c3368741b5b2 +size 13227933 From ca00d89286381ad731c5f06a48f10135ef680c6f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 20:12:56 -0700 Subject: [PATCH 107/151] %lost ames gift and stub handlers in vanes --- pkg/arvo/sys/vane/alef.hoon | 15 +++++++++++--- pkg/arvo/sys/vane/clay.hoon | 39 ++++++++++++++++++++----------------- pkg/arvo/sys/vane/gall.hoon | 20 ++++++++++++------- pkg/arvo/sys/vane/jael.hoon | 7 +++++++ pkg/arvo/sys/zuse.hoon | 2 ++ 5 files changed, 55 insertions(+), 28 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 1d88687ab8..1811e4d555 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1773,16 +1773,25 @@ :: could change this to a no-op if we had some sort of security :: reporting. :: + :: TODO: This handles a previous crash in the client vane, but not in + :: Ames itself. + :: ++ on-still-boon |= [=message-num message=*] ^+ peer-core - ~> %slog.0^leaf/"ames: boon {}" :: send ack unconditionally :: =. peer-core (run-message-still bone %done ok=%.y) - :: give message to client vane :: - (emit (got-duct bone) %give %boon message) + ?. ?=([%hear * * ok=%.n] task) + :: fresh boon; give message to client vane + :: + ~> %slog.0^leaf/"ames: boon {}" + (emit (got-duct bone) %give %boon message) + :: we previously crashed on this message; notify client vane + :: + ~> %slog.1^leaf/"ames: crashed on boon {}" + (emit (got-duct bone) %give %lost ~) :: +on-still-nack-trace: handle nack-trace received by |message-still :: ++ on-still-nack-trace diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 5c6951db67..fd4f38c704 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -508,8 +508,9 @@ $% [%init-clad ~] :: == == :: $: %a :: by %ames - $> $? %boon :: - %done :: + $> $? %boon :: response + %done :: (n)ack + %lost :: lost boon == :: gift:able:ames :: == :: @@ -4478,7 +4479,8 @@ == == :: ?: ?=([%warp-index @ @ @ ~] tea) - ?: ?=(%done +<.q.hin) + ?+ +<.q.hin ~| %clay-warp-index-strange !! + %done ?~ error.q.hin [~ ..^$] :: TODO better error handling @@ -4487,23 +4489,23 @@ %- (slog tang.u.error.q.hin) [~ ..^$] :: - ?> ?=(%boon +<.q.hin) - :: - =/ res=(unit rand) - ?^ v=((soft ,(unit rand)) payload.q.hin) - u.v - ~| %clay-take-boon-fail^our^payload.q.hin + %lost + ~| %clay-take-lost^our + :: TODO better error handling !! - ::=+ ;; res=(unit rand) payload.q.hin :: - =/ her=ship (slav %p i.t.tea) - =/ =desk (slav %tas i.t.t.tea) - =/ index=@ud (slav %ud i.t.t.t.tea) - :: - =^ mos ruf - =/ den ((de our now ski hen ruf) her desk) - abet:(take-foreign-answer:den index res) - [mos ..^$] + %boon + =+ ;; res=(unit rand) payload.q.hin + :: + =/ her=ship (slav %p i.t.tea) + =/ =desk (slav %tas i.t.t.tea) + =/ index=@ud (slav %ud i.t.t.t.tea) + :: + =^ mos ruf + =/ den ((de our now ski hen ruf) her desk) + abet:(take-foreign-answer:den index res) + [mos ..^$] + == :: ?: ?=([%sinks ~] tea) ?> ?=(%public-keys +<.q.hin) @@ -4603,6 +4605,7 @@ :: handled in the wire dispatcher :: %boon !! + %lost !! %writ !! :: %done diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 6346e81c32..b1ee5e6126 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -393,9 +393,12 @@ ?: ?=([%a %done *] sih) (mo-awed him cub error.sih) :: - ?> ?=([%a %boon *] sih) - =+ mes=;;([@ud roon] payload.sih) - (mo-gawd:(mo-abed:mo hen) him dap mes) + ?: ?=([%a %boon *] sih) + =+ mes=;;([@ud roon] payload.sih) + (mo-gawd:(mo-abed:mo hen) him dap %& mes) + :: + ?> ?=([%a %lost *] sih) + (mo-gawd:(mo-abed:mo hen) him dap %| [%leaf "ames: lost boon"]~) == :: ++ mo-cook :: take in /use @@ -497,13 +500,16 @@ == :: ++ mo-gawd :: ames backward - |= {him/@p dap/dude num/@ud ron/roon} - ?- -.ron + |= {him/@p dap/dude ron/(each [num=@ud =roon] tang)} + :: + ?: ?=(%| -.ron) + (mo-give %unto %quit ~) + ?- -.roon.p.ron $x (mo-give %unto %quit ~) $d %+ mo-pass - [%sys %rep (scot %p him) dap (scot %ud num) ~] - [%f %build live=%.n [%vale [p q]:(mo-beak dap) p.ron q.ron]] + [%sys %rep (scot %p him) dap (scot %ud num.p.ron) ~] + [%f %build live=%.n [%vale [p q]:(mo-beak dap) [p q]:roon.p.ron]] == :: ++ ap :: agent engine diff --git a/pkg/arvo/sys/vane/jael.hoon b/pkg/arvo/sys/vane/jael.hoon index 52bd0ae4fd..dc2cb50c27 100644 --- a/pkg/arvo/sys/vane/jael.hoon +++ b/pkg/arvo/sys/vane/jael.hoon @@ -94,6 +94,7 @@ $% $: %a $% $>(%boon gift:able:ames) :: message response $>(%done gift:able:ames) :: message (n)ack + $>(%lost gift:able:ames) :: lost boon == == $: %g :: $> $? %onto :: @@ -522,6 +523,12 @@ =+ ;; [%public-keys-result =public-keys-result] payload.hin %- curd =< abet (public-keys:~(feel su hen our pki etn) public-keys-result) + :: + [%a %lost *] + :: TODO: better error handling + :: + ~| %jael-ames-lost + !! :: [%g %onto *] ~& [%jael-onto tea hin] diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index bec64013a3..e3080bce09 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -400,6 +400,7 @@ :: :: %boon: response message from remote ship :: %done: notify vane that peer (n)acked our message + :: %lost: notify vane that we crashed on %boon :: %send: packet to unix :: :: %mass: memory usage report @@ -408,6 +409,7 @@ +$ gift $% [%boon payload=*] [%done error=(unit error)] + [%lost ~] [%send =lane =blob] :: [%mass p=mass] From ffdaa1694a4acdbcc8daff82fa73a1b09feb9dae Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 20:53:19 -0700 Subject: [PATCH 108/151] ames: first attempt at congestion control --- pkg/arvo/sys/vane/alef.hoon | 43 ++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 1811e4d555..ffcf197d58 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -547,11 +547,9 @@ :: +$ pump-metrics $: num-live=@ud - num-lost=@ud last-sent-at=@da - last-dead-at=@da - rtt=@dr - max-live=_7 + rtt=_~s1 + max-live=_2 == +$ live-packet-key [=message-num =fragment-num] +$ live-packet-val @@ -2303,14 +2301,13 @@ :: ++ next-expiry ^- @da - :: - (add now ~s5) + (add now (mul 2 rtt)) :: +next-retry-expiry: when should a resent packet time out? :: ++ next-retry-expiry |= sent-packet-state ^- @da - (add now ~s10) + next-expiry :: +has-slot: can we send a packet right now? :: ++ has-slot @@ -2330,33 +2327,49 @@ max-live :: +on-skipped-packet: adjust metrics based on a misordered ack :: - :: TODO: decrease .max-live - :: ++ on-skipped-packet |= sent-packet-state - metrics + ^- pump-metrics + :: + %_ metrics + max-live (max 1 (dec max-live)) + == :: +on-ack: adjust metrics based on a packet getting acknowledged :: - :: TODO: adjust .rtt and .max-live - :: ++ on-ack |= sent-packet-state ^- pump-metrics :: - metrics(num-live (dec num-live)) + %_ metrics + num-live ?:(=(0 num-live) 0 (dec num-live)) + max-live +(max-live) + rtt smooth-rtt + == :: +on-sent: adjust metrics based on sending .num-sent fresh packets :: ++ on-sent |= num-sent=@ud ^- pump-metrics :: - metrics(num-live (add num-sent num-live)) + %_ metrics + last-sent-at now + num-live (add num-sent num-live) + == :: +on-resent: adjust metrics based on retrying an expired packet :: ++ on-resent |= sent-packet-state ^- pump-metrics - metrics + :: + %_ metrics + last-sent-at now + max-live (max 1 (div max-live 2)) + == + :: +smooth-rtt: apply a low-pass-filtered update to .rtt + :: + ++ smooth-rtt + ^+ rtt + (div (add rtt (sub now last-sent-at)) 2) -- :: +make-message-still: construct |message-still message receiver core :: From 64fb29d3eeeff3e4523c07be5002359fd1e5723c Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 20:53:49 -0700 Subject: [PATCH 109/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 98e4c6401f..9ebda35c0f 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:433ae52c22061f5cab5fcf5862702986614b7ff371058afd2853c3368741b5b2 -size 13227933 +oid sha256:9ec3055a657862467d589a5e7fa59886f9408cc813d4667a86037fe6ba6fb7fb +size 13233650 From 46f0e6c1ae13fb612aa0c2a904e2b63b82935996 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:12:12 -0700 Subject: [PATCH 110/151] ames: congestion control backoff --- pkg/arvo/sys/vane/alef.hoon | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index ffcf197d58..3b01fd90d5 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2341,9 +2341,9 @@ ^- pump-metrics :: %_ metrics - num-live ?:(=(0 num-live) 0 (dec num-live)) + num-live (dec (max 1 num-live)) max-live +(max-live) - rtt smooth-rtt + rtt (smooth-rtt-since sent-date) == :: +on-sent: adjust metrics based on sending .num-sent fresh packets :: @@ -2364,12 +2364,16 @@ %_ metrics last-sent-at now max-live (max 1 (div max-live 2)) + rtt (smooth-rtt-since sent-date) == - :: +smooth-rtt: apply a low-pass-filtered update to .rtt + :: +smooth-rtt-since: calculate new low-passed roundtrip time :: - ++ smooth-rtt - ^+ rtt - (div (add rtt (sub now last-sent-at)) 2) + ++ smooth-rtt-since + |= start=@da + %+ min ~s30 + =- (div - 2) + %+ add rtt + (sub now start) -- :: +make-message-still: construct |message-still message receiver core :: From badd3eacbaedaeb028f7896812a81f4e9eb9b2ba Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:12:17 -0700 Subject: [PATCH 111/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 9ebda35c0f..fe0f2eb8a6 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9ec3055a657862467d589a5e7fa59886f9408cc813d4667a86037fe6ba6fb7fb -size 13233650 +oid sha256:78731c85a8d67a9fbb2fd0033aa95eb1823165a219f7ebf4c16f03e3d0fa7a2b +size 13234161 From 88cfba3bf1dc85ecdc0492264893a298c2c42a81 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:25:35 -0700 Subject: [PATCH 112/151] ames: print and smoother RTT --- pkg/arvo/sys/vane/alef.hoon | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 3b01fd90d5..92f3cb0af8 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2331,6 +2331,8 @@ |= sent-packet-state ^- pump-metrics :: + ~& %skipped^max-live + :: %_ metrics max-live (max 1 (dec max-live)) == @@ -2339,6 +2341,7 @@ ++ on-ack |= sent-packet-state ^- pump-metrics + =- ~& %ack^rtt^%to^rtt.- - :: %_ metrics num-live (dec (max 1 num-live)) @@ -2360,6 +2363,7 @@ ++ on-resent |= sent-packet-state ^- pump-metrics + =- ~& %resent^rtt^%to^rtt.- - :: %_ metrics last-sent-at now @@ -2371,8 +2375,8 @@ ++ smooth-rtt-since |= start=@da %+ min ~s30 - =- (div - 2) - %+ add rtt + =- (div - 4) + %+ add (mul 3 rtt) (sub now start) -- :: +make-message-still: construct |message-still message receiver core From 1edaf89ae0bad89bc91975483c64b91faa122525 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:25:42 -0700 Subject: [PATCH 113/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index fe0f2eb8a6..44cbfee50d 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:78731c85a8d67a9fbb2fd0033aa95eb1823165a219f7ebf4c16f03e3d0fa7a2b -size 13234161 +oid sha256:39eae010ffe1ff0c3363ee32a2da24fec2db009e9442fcc2e6e2fe5095e206ec +size 13235323 From 84742025e73f80f188fbcbf31db96feb2bbcd0b4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:41:32 -0700 Subject: [PATCH 114/151] ames: slow multiplicatively on skipped packet --- pkg/arvo/sys/vane/alef.hoon | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 92f3cb0af8..38e05d7ff8 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2331,17 +2331,17 @@ |= sent-packet-state ^- pump-metrics :: - ~& %skipped^max-live + =- ~& %skipped^max-live^%to^max-live.- - :: %_ metrics - max-live (max 1 (dec max-live)) + max-live (max 1 (div max-live 2)) == :: +on-ack: adjust metrics based on a packet getting acknowledged :: ++ on-ack |= sent-packet-state ^- pump-metrics - =- ~& %ack^rtt^%to^rtt.- - + =- ~& %ack^(mul rtt 1.000)^%to^(mul rtt.- 1.000) - :: %_ metrics num-live (dec (max 1 num-live)) @@ -2363,7 +2363,7 @@ ++ on-resent |= sent-packet-state ^- pump-metrics - =- ~& %resent^rtt^%to^rtt.- - + =- ~& %resent^(mul rtt 1.000)^%to^(mul rtt.- 1.000) - :: %_ metrics last-sent-at now From 38c2822bbbe8812a4a64cf4b7d981d4c11b7326a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 21:41:40 -0700 Subject: [PATCH 115/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 44cbfee50d..fa9598c31c 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:39eae010ffe1ff0c3363ee32a2da24fec2db009e9442fcc2e6e2fe5095e206ec -size 13235323 +oid sha256:8458aa05a6849e0c6d83d2a472e654aa2b5fa99bd26668c310522801d7720e68 +size 13236148 From 461495658fb51195449702311dbdadd00465383b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 22:35:01 -0700 Subject: [PATCH 116/151] don't resend as much; print differently --- pkg/arvo/sys/vane/alef.hoon | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 38e05d7ff8..6a045cc3c3 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -550,6 +550,7 @@ last-sent-at=@da rtt=_~s1 max-live=_2 + skipped=@ud == +$ live-packet-key [=message-num =fragment-num] +$ live-packet-val @@ -2078,6 +2079,7 @@ :: =- =. packet-pump core.- =. live.state live.- + ~? !=(0 num-sent.-) %resent^num-sent.- packet-pump :: acc: state to thread through traversal :: @@ -2085,6 +2087,7 @@ :: =| $= acc $: num-slots=_num-retry-slots:gauge + num-sent=@ud core=_packet-pump == :: @@ -2115,15 +2118,15 @@ :: =. packet-pump (give %send static-fragment) =. metrics.state (on-resent:gauge -.val) + =. num-sent.acc +(num-sent.acc) + =. num-slots.acc (dec num-slots.acc) :: update $sent-packet-state in .val and continue :: =. expiry.val (next-retry-expiry:gauge -.val) =. sent-date.val now.channel =. retried.val %.y :: - ~& [%ames-resend [our our-life her her-life]:channel key] - :: - [`val stop=%.n (dec num-slots.acc) packet-pump] + [`val stop=%.n acc] :: +feed: try to send a list of packets, returning unsent and effects :: ++ feed @@ -2192,7 +2195,7 @@ ?. found.- ~> %slog.0^leaf/"ames: hear: no-op" packet-pump - ::~& %ames-hear-ack^message-num^fragment-num + ~& %ames-hear-ack^message-num^fragment-num :: =. metrics.state metrics.- =. live.state live.- @@ -2235,6 +2238,7 @@ =- =. metrics.state metrics.- =. live.state live.- :: + ~& %done^metrics.state resend-lost :: ^- $: metrics=pump-metrics @@ -2324,24 +2328,22 @@ :: ++ num-retry-slots ^- @ud - max-live + (max 1 (div max-live 10)) :: +on-skipped-packet: adjust metrics based on a misordered ack :: ++ on-skipped-packet |= sent-packet-state ^- pump-metrics :: - =- ~& %skipped^max-live^%to^max-live.- - - :: %_ metrics max-live (max 1 (div max-live 2)) + skipped +(skipped) == :: +on-ack: adjust metrics based on a packet getting acknowledged :: ++ on-ack |= sent-packet-state ^- pump-metrics - =- ~& %ack^(mul rtt 1.000)^%to^(mul rtt.- 1.000) - :: %_ metrics num-live (dec (max 1 num-live)) @@ -2363,7 +2365,6 @@ ++ on-resent |= sent-packet-state ^- pump-metrics - =- ~& %resent^(mul rtt 1.000)^%to^(mul rtt.- 1.000) - :: %_ metrics last-sent-at now From dccdfd7684d54c4cf6836cd2d4eb4083465d5508 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Tue, 27 Aug 2019 22:38:12 -0700 Subject: [PATCH 117/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index fa9598c31c..62886cab08 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8458aa05a6849e0c6d83d2a472e654aa2b5fa99bd26668c310522801d7720e68 -size 13236148 +oid sha256:fd3cd5653571daf9fc20843daacaae8d8fff6adfe426fa147b4dd2ff4ec53fab +size 13235699 From e6e919b9bfb865f711b9031883a97594063f7e72 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 17:28:31 -0700 Subject: [PATCH 118/151] moar gauge changes --- pkg/arvo/sys/vane/alef.hoon | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 6a045cc3c3..850d055164 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2199,7 +2199,6 @@ :: =. metrics.state metrics.- =. live.state live.- - :: resend-lost :: ^- $: [found=? metrics=pump-metrics] @@ -2328,7 +2327,7 @@ :: ++ num-retry-slots ^- @ud - (max 1 (div max-live 10)) + max-live :: +on-skipped-packet: adjust metrics based on a misordered ack :: ++ on-skipped-packet @@ -2336,8 +2335,7 @@ ^- pump-metrics :: %_ metrics - max-live (max 1 (div max-live 2)) - skipped +(skipped) + skipped +(skipped) == :: +on-ack: adjust metrics based on a packet getting acknowledged :: @@ -2345,8 +2343,15 @@ |= sent-packet-state ^- pump-metrics :: + =? metrics (gth skipped 0) + ~& %skipped^skipped + %_ metrics + skipped 0 + max-live (max 1 (div max-live 2)) + == + :: %_ metrics - num-live (dec (max 1 num-live)) + num-live (dec num-live) max-live +(max-live) rtt (smooth-rtt-since sent-date) == From 5975699c43548cc20f2372f2e553b6a1201e8ef8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 17:28:36 -0700 Subject: [PATCH 119/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 62886cab08..e10b70088d 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fd3cd5653571daf9fc20843daacaae8d8fff6adfe426fa147b4dd2ff4ec53fab -size 13235699 +oid sha256:9ab988d645c38dc4c92088a74ceeeffb0cda22a99f6b6d8daf6c43db04b13e7c +size 13235913 From 0fe443fc7c9c2246a334d46e7421531edc99302d Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 17:44:36 -0700 Subject: [PATCH 120/151] print to figure out why this is broken --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index e10b70088d..2356f806f4 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9ab988d645c38dc4c92088a74ceeeffb0cda22a99f6b6d8daf6c43db04b13e7c -size 13235913 +oid sha256:1fe1521148d4c43e1b822a02bd41d420945427060cfc86cdcc61604d3a65d849 +size 13236589 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 850d055164..970198a568 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1908,7 +1908,9 @@ :: pass to |packet-pump unless duplicate or future ack :: ?. (is-message-num-in-range message-num) + ~& %hear-pump-out-of-range message-pump + ~& %hear-pump (run-packet-pump %hear message-num fragment-num) :: +on-done: handle message acknowledgment :: @@ -2079,7 +2081,7 @@ :: =- =. packet-pump core.- =. live.state live.- - ~? !=(0 num-sent.-) %resent^num-sent.- + ~? !=(0 num-sent.-) %resent-lost^num-sent.- packet-pump :: acc: state to thread through traversal :: @@ -2409,6 +2411,7 @@ ++ on-hear |= [=lane =shut-packet ok=?] ^+ message-still + ~& %on-hear-message-still^ok=ok :: we know this is a fragment, not an ack; expose into namespace :: ?> ?=(%& -.meat.shut-packet) From 4334b25ac611dccf11ec3dd4b227207aef841804 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 17:58:44 -0700 Subject: [PATCH 121/151] hopefully fix packet sending --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 2356f806f4..74644f0a54 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1fe1521148d4c43e1b822a02bd41d420945427060cfc86cdcc61604d3a65d849 -size 13236589 +oid sha256:d3b353adb8d5316b3a8d958ca206e942e0a6a6fc00ed68e2a99ef5fdb264c967 +size 13236307 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 970198a568..ac4dd9ef80 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1908,9 +1908,8 @@ :: pass to |packet-pump unless duplicate or future ack :: ?. (is-message-num-in-range message-num) - ~& %hear-pump-out-of-range + ~> %slog.0^leaf/"ames: hear pump out of range" message-pump - ~& %hear-pump (run-packet-pump %hear message-num fragment-num) :: +on-done: handle message acknowledgment :: @@ -2118,15 +2117,18 @@ => [key val] [message-num num-fragments fragment-num fragment] :: - =. packet-pump (give %send static-fragment) - =. metrics.state (on-resent:gauge -.val) - =. num-sent.acc +(num-sent.acc) - =. num-slots.acc (dec num-slots.acc) + =. packet-pump (give %send static-fragment) + =. metrics.state (on-resent:gauge -.val) :: update $sent-packet-state in .val and continue :: =. expiry.val (next-retry-expiry:gauge -.val) =. sent-date.val now.channel =. retried.val %.y + :: update .acc, writing back .packet-pump + :: + =. num-sent.acc +(num-sent.acc) + =. num-slots.acc (dec num-slots.acc) + =. core.acc packet-pump :: [`val stop=%.n acc] :: +feed: try to send a list of packets, returning unsent and effects @@ -2411,7 +2413,6 @@ ++ on-hear |= [=lane =shut-packet ok=?] ^+ message-still - ~& %on-hear-message-still^ok=ok :: we know this is a fragment, not an ack; expose into namespace :: ?> ?=(%& -.meat.shut-packet) From 99b98ca744fbb6be4a3063578717d7772b3c22f4 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 18:09:05 -0700 Subject: [PATCH 122/151] ames: print duplicate acks --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 74644f0a54..60be01789a 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d3b353adb8d5316b3a8d958ca206e942e0a6a6fc00ed68e2a99ef5fdb264c967 -size 13236307 +oid sha256:2e36bab49d8c7829d373037bba00dc67785024d45cfc73bec70104917ec9fa40 +size 13236816 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index ac4dd9ef80..1f30c90aa5 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2197,7 +2197,7 @@ =- :: if no sent packet matches the ack, don't apply mutations or effects :: ?. found.- - ~> %slog.0^leaf/"ames: hear: no-op" + ~> %slog.0^leaf/"ames: hear: no-op {(scow %ud message-num)} {(scow %ud fragment-num)}" packet-pump ~& %ames-hear-ack^message-num^fragment-num :: From 72b2dbe19e5eaf678e37391b2e5bdbf51075b51f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 28 Aug 2019 18:30:31 -0700 Subject: [PATCH 123/151] don't back off on skipped packet --- bin/solid.pill | 4 ++-- pkg/arvo/sys/vane/alef.hoon | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 60be01789a..e287c162b1 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e36bab49d8c7829d373037bba00dc67785024d45cfc73bec70104917ec9fa40 -size 13236816 +oid sha256:81cbdadd4bca830243762c097a7c85c24b8b7dc2b5b02e38448f2aafac925cbf +size 13237282 diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 1f30c90aa5..04151fa9f6 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2179,6 +2179,7 @@ :: |- ^+ packet-pump ?~ sent packet-pump + ~& %sent^[message-num fragment-num]:i.sent =. packet-pump (give %send i.sent) $(sent t.sent) :: +on-hear: handle ack on a live packet @@ -2351,7 +2352,6 @@ ~& %skipped^skipped %_ metrics skipped 0 - max-live (max 1 (div max-live 2)) == :: %_ metrics @@ -2450,7 +2450,7 @@ message-still :: ack all other packets :: - ::~& %send-ack^seq^fragment-num + ~& %send-ack^seq^fragment-num (give %send seq %& fragment-num) :: last-heard Date: Mon, 16 Sep 2019 22:04:56 -0400 Subject: [PATCH 124/151] turn off some debug printfs for benchmarking --- pkg/arvo/sys/vane/alef.hoon | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 04151fa9f6..e8feabcd2c 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2138,7 +2138,7 @@ ^+ [fragments gifts state] :: return unsent back to caller and reverse effects to finalize :: - =- ::~& %ames-feed^(lent fragments)^%unsent^(lent unsent) + =- ::::::::~&~&~& %ames-feed^(lent fragments)^%unsent^(lent unsent) [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] @@ -2179,7 +2179,7 @@ :: |- ^+ packet-pump ?~ sent packet-pump - ~& %sent^[message-num fragment-num]:i.sent + ::::::~&~&~& %sent^[message-num fragment-num]:i.sent =. packet-pump (give %send i.sent) $(sent t.sent) :: +on-hear: handle ack on a live packet @@ -2198,9 +2198,9 @@ =- :: if no sent packet matches the ack, don't apply mutations or effects :: ?. found.- - ~> %slog.0^leaf/"ames: hear: no-op {(scow %ud message-num)} {(scow %ud fragment-num)}" + ::~> %slog.0^leaf/"ames: hear: no-op {(scow %ud message-num)} {(scow %ud fragment-num)}" packet-pump - ~& %ames-hear-ack^message-num^fragment-num + ::::::~&~&~& %ames-hear-ack^message-num^fragment-num :: =. metrics.state metrics.- =. live.state live.- @@ -2242,7 +2242,7 @@ =- =. metrics.state metrics.- =. live.state live.- :: - ~& %done^metrics.state + ::::::~&~&~& %done^metrics.state resend-lost :: ^- $: metrics=pump-metrics @@ -2299,8 +2299,6 @@ -- :: +make-pump-gauge: construct |pump-gauge congestion control core :: -:: TODO: actual congestion control -:: ++ make-pump-gauge |= [now=@da pump-metrics] =* metrics +<+ @@ -2349,7 +2347,7 @@ ^- pump-metrics :: =? metrics (gth skipped 0) - ~& %skipped^skipped + ::::::~&~&~& %skipped^skipped %_ metrics skipped 0 == @@ -2433,12 +2431,12 @@ ?. is-last-fragment :: single packet ack :: - ~> %slog.0^leaf/"ames: send dupe ack {}" + ::~> %slog.0^leaf/"ames: send dupe ack {}" (give %send seq %& fragment-num) :: whole message (n)ack :: =/ ok=? !(~(has in nax.state) seq) - ~> %slog.0^leaf/"ames: send dupe message ack {} ok={}" + ::~> %slog.0^leaf/"ames: send dupe message ack {} ok={}" (give %send seq %| ok lag=`@dr`0) :: last-acked %slog.0^leaf/"ames: hear last in-progress {}" + ::~> %slog.0^leaf/"ames: hear last in-progress {}" message-still :: ack all other packets :: - ~& %send-ack^seq^fragment-num + ::::::~&~&~& %send-ack^seq^fragment-num (give %send seq %& fragment-num) :: last-heard %slog.0^leaf/"ames: hear last dupe {}" + ::~> %slog.0^leaf/"ames: hear last dupe {}" message-still - ~> %slog.0^leaf/"ames: send dupe ack {}" + ::~> %slog.0^leaf/"ames: send dupe ack {}" (give %send seq %& fragment-num) :: new fragment; store in state and check if message is done :: @@ -2489,7 +2487,7 @@ :: ack any packet other than the last one, and continue either way :: =? message-still !is-last-fragment - ~& %send-ack^seq^fragment-num + ::::::~&~&~& %send-ack^seq^fragment-num (give %send seq %& fragment-num) :: enqueue all completed messages starting at +(last-heard.state) :: From 7f3917107be7e25edd6325e5aba9279797937aac Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 16 Sep 2019 22:05:30 -0400 Subject: [PATCH 125/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index e287c162b1..9130be7a4e 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81cbdadd4bca830243762c097a7c85c24b8b7dc2b5b02e38448f2aafac925cbf -size 13237282 +oid sha256:db46624b8e5f95578fc11fc178e6ecbd72cd4e799266980e1da65e6b4ace7631 +size 13232377 From 087adacc15156c725ea4bb101a6ad093326e2fcd Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 27 Sep 2019 07:45:22 -0400 Subject: [PATCH 126/151] alef: reno-style congestion control (todo: misordered acks) --- pkg/arvo/sys/vane/alef.hoon | 350 +++++++++++++++++------------------- 1 file changed, 163 insertions(+), 187 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index e8feabcd2c..815ad73a59 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -160,6 +160,24 @@ ?: |(?=(~ rest.l) (mor key.n.a key.n.rest.l)) a(l rest.l) rest.l(r a(r r.rest.l)) + :: +del: delete .key from .a if it exists, producing value iff deleted + :: + ++ del + |= [a=(tree item) =key] + ^- [(unit val) (tree item)] + :: + ?~ a [~ ~] + :: we found .key at the root; delete and rebalance + :: + ?: =(key key.n.a) + [`val.n.a (nip a)] + :: recurse left or right to find .key + :: + ?: (compare key key.n.a) + =+ [found lef]=$(a l.a) + [found a(l lef)] + =+ [found rig]=$(a r.a) + [found a(r rig)] :: +nip: remove root; for internal use :: ++ nip @@ -524,11 +542,16 @@ queued-message-acks=(map message-num ok=?) =packet-pump-state == ++$ static-fragment + $: =message-num + num-fragments=fragment-num + =fragment-num + =fragment + == :: $packet-pump-state: persistent state for |packet-pump :: :: next-wake: last timer we've set, or null :: live: packets in flight; sent but not yet acked -:: lost: packets to retry, since they timed out with no ack :: metrics: congestion control information :: +$ packet-pump-state @@ -536,38 +559,44 @@ live=(tree [live-packet-key live-packet-val]) metrics=pump-metrics == -:: $pump-metrics: congestion control statistics for the |pump-gauge +:: $pump-metrics: congestion control state for a |packet-pump :: -:: num-live: number of sent packets in flight -:: num-lost: number of expired packets -:: last-sent-at: last date at which we sent a packet -:: last-dead-at: most recently packet expiry -:: rtt: roundtrip time estimate -:: max-live: current window size +:: This is an Ames adaptation of TCP's Reno congestion control +:: algorithm. The information signals and their responses are +:: identical to Reno's; the implementation differs because Ames +:: acknowledgments differ from TCP's and because we're using +:: functional data structures. +:: +:: If .skips reaches 3, we perform a fast retransmit and fast +:: recovery. This corresponds to Reno's handling of "three duplicate +:: acks". +:: +:: rto: retransmission timeout +:: rtt: roundtrip time estimate, low-passed using EWMA +:: rttvar: mean deviation of .rtt, also low-passed with EWMA +:: num-live: how many packets sent, awaiting ack +:: ssthresh: slow-start threshold +:: cwnd: congestion window; max unacked packets +:: skips: how many misordered acks we've received :: +$ pump-metrics - $: num-live=@ud - last-sent-at=@da + $: rto=_~s1 rtt=_~s1 - max-live=_2 - skipped=@ud + rttvar=_~s1 + ssthresh=_1.000.000 + cwnd=_1 + num-live=@ud + num-skips=@ud == +$ live-packet-key [=message-num =fragment-num] +$ live-packet-val - $: sent-packet-state + $: packet-state num-fragments=fragment-num =fragment == -+$ sent-packet-state - $: expiry=@da - sent-date=@da - retried=? - == -+$ static-fragment - $: =message-num - num-fragments=fragment-num - =fragment-num - =fragment ++$ packet-state + $: last-sent=@da + retries=@ud == :: $message-still-state: state of |message-still to assemble messages :: @@ -1706,6 +1735,7 @@ ^+ peer-core :: =/ =wire (make-pump-timer-wire her.channel bone) + =/ duct ~[/ames] (emit duct %pass wire %b %wait date) :: +on-pump-rest: relay |message-pump's unset-timer request :: @@ -1714,6 +1744,7 @@ ^+ peer-core :: =/ =wire (make-pump-timer-wire her.channel bone) + =/ duct ~[/ames] (emit duct %pass wire %b %rest date) -- :: +run-message-still: process $message-still-task and its effects @@ -2070,29 +2101,29 @@ ?- -.task %hear (on-hear [message-num fragment-num]:task) %done (on-done message-num.task) - %wake resend-lost(next-wake.state ~) + %wake on-wake %halt set-wake == - :: +resend-lost: resend as many lost packets as .gauge will allow + :: +on-wake: handle packet timeout :: - ++ resend-lost + ++ on-wake ^+ packet-pump + :: assert temporal coherence :: - =- =. packet-pump core.- - =. live.state live.- - ~? !=(0 num-sent.-) %resent-lost^num-sent.- + ?< =(~ next-wake.state) + ?> (gte now.channel (need next-wake.state)) + =. next-wake.state ~ + :: tell congestion control a packet timed out + :: + =. metrics.state on-timeout:gauge + :: re-send first packet and update its state in-place + :: + =- =. live.state live.- + =. packet-pump (give %send static-fragment.-) packet-pump - :: acc: state to thread through traversal :: - :: num-slots: start with max retries; decrement on each resend - :: - =| $= acc - $: num-slots=_num-retry-slots:gauge - num-sent=@ud - core=_packet-pump - == - :: - ^+ [acc live=live.state] + =| acc=static-fragment + ^+ [static-fragment=acc live=live.state] :: %^ (traverse:packet-queue _acc) live.state acc |= $: acc=_acc @@ -2100,37 +2131,15 @@ val=live-packet-val == ^- [new-val=(unit live-packet-val) stop=? _acc] - :: load mutant environment + :: packet has expired; update it in-place, stop, and produce it :: - =. packet-pump core.acc - :: if we can't send any more packets, we're done - :: - ?: =(0 num-slots.acc) - [`val stop=%.y acc] - :: if the packet hasn't expired, we're done - :: - ?: (gte expiry.val now.channel) - [`val stop=%.y acc] - :: packet has expired so re-send it + =. last-sent.val now.channel + =. retries.val +(retries.val) :: =/ =static-fragment - => [key val] - [message-num num-fragments fragment-num fragment] + [message-num num-fragments fragment-num fragment]:[key val] :: - =. packet-pump (give %send static-fragment) - =. metrics.state (on-resent:gauge -.val) - :: update $sent-packet-state in .val and continue - :: - =. expiry.val (next-retry-expiry:gauge -.val) - =. sent-date.val now.channel - =. retried.val %.y - :: update .acc, writing back .packet-pump - :: - =. num-sent.acc +(num-sent.acc) - =. num-slots.acc (dec num-slots.acc) - =. core.acc packet-pump - :: - [`val stop=%.n acc] + [`val stop=%.y static-fragment] :: +feed: try to send a list of packets, returning unsent and effects :: ++ feed @@ -2138,13 +2147,9 @@ ^+ [fragments gifts state] :: return unsent back to caller and reverse effects to finalize :: - =- ::::::::~&~&~& %ames-feed^(lent fragments)^%unsent^(lent unsent) - [unsent (flop gifts) state] + =- [unsent (flop gifts) state] :: ^+ [unsent=fragments packet-pump] - :: resend lost packets first, possibly adjusting congestion control - :: - =. packet-pump resend-lost :: bite off as many fragments as we can send :: =/ num-slots num-slots:gauge @@ -2164,9 +2169,7 @@ ^- [key=live-packet-key val=live-packet-val] :: :- [message-num fragment-num] - :- :+ expiry=next-expiry:gauge - sent-date=now.channel - retried=%.n + :- [sent-date=now.channel retries=0] [num-fragments fragment] :: update .live and .metrics :: @@ -2179,60 +2182,27 @@ :: |- ^+ packet-pump ?~ sent packet-pump - ::::::~&~&~& %sent^[message-num fragment-num]:i.sent + :: =. packet-pump (give %send i.sent) $(sent t.sent) :: +on-hear: handle ack on a live packet :: - :: Traverse .live from the head, marking packets as lost until we - :: find the acked packet. Then delete the acked packet and try to - :: resend lost packets. - :: - :: If we don't find the acked packet, no-op: no mutations, effects, - :: or resending of lost packets. + :: If the packet was in our queue, delete it and update our + :: metrics. Otherwise, no-op. :: ++ on-hear - |= [=message-num =fragment-num] + |= key=live-packet-key ^+ packet-pump :: - =- :: if no sent packet matches the ack, don't apply mutations or effects - :: - ?. found.- - ::~> %slog.0^leaf/"ames: hear: no-op {(scow %ud message-num)} {(scow %ud fragment-num)}" - packet-pump - ::::::~&~&~& %ames-hear-ack^message-num^fragment-num - :: - =. metrics.state metrics.- - =. live.state live.- - resend-lost + :: TODO handle misordered ack + =^ packet=(unit live-packet-val) live.state + (del:packet-queue live.state key) :: - ^- $: [found=? metrics=pump-metrics] - live=(tree [live-packet-key live-packet-val]) - == + ?~ packet + packet-pump :: - =/ acc=[found=? metrics=pump-metrics] [%.n metrics.state] - :: - %^ (traverse:packet-queue _acc) live.state acc - |= $: acc=_acc - key=live-packet-key - val=live-packet-val - == - ^- [new-val=(unit live-packet-val) stop=? _acc] - :: - =/ gauge (make-pump-gauge now.channel metrics.acc) - :: is this the acked packet? - :: - ?: =(key [message-num fragment-num]) - :: delete acked packet, update metrics, and stop traversal - :: - :+ new-val=~ - stop=%.y - [found=%.y metrics=(on-ack:gauge -.val)] - :: ack was out of order; mark expired, tell gauge, and continue - :: - :+ new-val=`val(expiry `@da`0) - stop=%.n - [found=%.n metrics=(on-skipped-packet:gauge -.val)] + =. metrics.state (on-ack:gauge -.u.packet) + packet-pump :: +on-done: apply ack to all packets from .message-num :: ++ on-done @@ -2242,8 +2212,7 @@ =- =. metrics.state metrics.- =. live.state live.- :: - ::::::~&~&~& %done^metrics.state - resend-lost + packet-pump :: ^- $: metrics=pump-metrics live=(tree [live-packet-key live-packet-val]) @@ -2258,9 +2227,10 @@ :: =/ gauge (make-pump-gauge now.channel metrics) :: if ack was out of order, mark expired and continue + :: TODO redo skipped packet logic :: ?: (lth message-num.key message-num) - :+ new-val=`val(expiry `@da`0) + :+ new-val=`val stop=%.n metrics=(on-skipped-packet:gauge -.val) :: if packet was from acked message, delete it and continue @@ -2279,7 +2249,7 @@ =/ new-wake=(unit @da) ?~ head=(peek:packet-queue live.state) ~ - `expiry.val.u.head + `next-expiry:gauge :: no-op if no change :: ?: =(new-wake next-wake.state) packet-pump @@ -2305,87 +2275,93 @@ |% :: +next-expiry: when should a newly sent fresh packet time out? :: + :: Use rtt + 4*sigma, where sigma is the mean deviation of rtt. + :: This should make it unlikely that a packet would time out from a + :: delay, as opposed to an actual packet loss. + :: ++ next-expiry ^- @da - (add now (mul 2 rtt)) - :: +next-retry-expiry: when should a resent packet time out? - :: - ++ next-retry-expiry - |= sent-packet-state - ^- @da - next-expiry - :: +has-slot: can we send a packet right now? - :: - ++ has-slot - ^- ? - (gth num-slots 0) + (add now rto) :: +num-slots: how many packets can we send right now? :: ++ num-slots ^- @ud - ?. (gth max-live num-live) - 0 - (sub max-live num-live) - :: +num-retry-slots: how many lost packets can we resend right now? - :: - ++ num-retry-slots - ^- @ud - max-live - :: +on-skipped-packet: adjust metrics based on a misordered ack - :: - ++ on-skipped-packet - |= sent-packet-state - ^- pump-metrics - :: - %_ metrics - skipped +(skipped) - == - :: +on-ack: adjust metrics based on a packet getting acknowledged - :: - ++ on-ack - |= sent-packet-state - ^- pump-metrics - :: - =? metrics (gth skipped 0) - ::::::~&~&~& %skipped^skipped - %_ metrics - skipped 0 - == - :: - %_ metrics - num-live (dec num-live) - max-live +(max-live) - rtt (smooth-rtt-since sent-date) - == + (sub-safe cwnd num-live) :: +on-sent: adjust metrics based on sending .num-sent fresh packets :: ++ on-sent |= num-sent=@ud ^- pump-metrics :: - %_ metrics - last-sent-at now - num-live (add num-sent num-live) - == - :: +on-resent: adjust metrics based on retrying an expired packet + =. num-live (add num-live num-sent) + ?> (lte num-live cwnd) + metrics + :: +on-ack: adjust metrics based on a packet getting acknowledged :: - ++ on-resent - |= sent-packet-state + ++ on-ack + |= =packet-state ^- pump-metrics :: - %_ metrics - last-sent-at now - max-live (max 1 (div max-live 2)) - rtt (smooth-rtt-since sent-date) - == - :: +smooth-rtt-since: calculate new low-passed roundtrip time + =. num-live (dec num-live) + :: if below congestion threshold, add 1; else, add avg. 1 / cwnd + :: + =. cwnd + ?: in-slow-start + +(cwnd) + (add cwnd !=(0 (mod (mug now) cwnd))) + :: if this was a re-send, don't adjust rtt or downstream state + :: + ?. =(0 retries.packet-state) + metrics + :: rtt-datum: new rtt measurement based on this packet roundtrip + :: + =/ rtt-datum=@dr (sub-safe now last-sent.packet-state) + :: rtt-error: difference between this rtt measurement and expected + :: + =/ rtt-error=@dr + ?: (gte rtt-datum rtt) + (sub rtt-datum rtt) + (sub rtt rtt-datum) + :: exponential weighting ratio for .rtt and .rttvar + :: + =. rtt (div (add rtt-datum (mul rtt 7)) 8) + =. rttvar (div (add rtt-error (mul rttvar 7)) 8) + =. rto (clamp-rto (add rtt (mul 4 rttvar))) + :: + metrics + :: +on-skipped-packet: TODO :: - ++ smooth-rtt-since - |= start=@da - %+ min ~s30 - =- (div - 4) - %+ add (mul 3 rtt) - (sub now start) + ++ on-skipped-packet + |= packet-state + ^- pump-metrics + metrics + :: +on-timeout: (re)enter slow-start mode on packet loss + :: + ++ on-timeout + ^- pump-metrics + :: + =: ssthresh (div cwnd 2) + cwnd 1 + rto (clamp-rto (mul rto 2)) + == + metrics + :: +clamp-rto: apply min and max to an .rto value + :: + ++ clamp-rto + |= rto=@dr + ^+ rto + (min ~m2 (max ^~((div ~s1 5)) rto)) + :: +in-slow-start: produces %.y iff we're in "slow-start" mode + :: + ++ in-slow-start + ^- ? + (lth cwnd ssthresh) + :: +sub-safe: subtract with underflow protection + :: + ++ sub-safe + |= [a=@ b=@] + ^- @ + ?:((lte a b) 0 (sub a b)) -- :: +make-message-still: construct |message-still message receiver core :: From 4188acde315bb565ab8166f08dd3a9f18229bdc9 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 27 Sep 2019 07:57:35 -0400 Subject: [PATCH 127/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 9130be7a4e..c9806cc367 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:db46624b8e5f95578fc11fc178e6ecbd72cd4e799266980e1da65e6b4ace7631 -size 13232377 +oid sha256:e60129f7ddf2921181c7615068df4b2731ea0ab3c51ccc113fc4710905ec9312 +size 13302691 From ed0483bd63a83ea628b113827865b5dc81655511 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 02:21:05 -0400 Subject: [PATCH 128/151] alef: preparing for misordered ack handling --- pkg/arvo/sys/vane/alef.hoon | 88 ++++++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 17 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 815ad73a59..3d90004bad 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -577,7 +577,6 @@ :: num-live: how many packets sent, awaiting ack :: ssthresh: slow-start threshold :: cwnd: congestion window; max unacked packets -:: skips: how many misordered acks we've received :: +$ pump-metrics $: rto=_~s1 @@ -586,7 +585,7 @@ ssthresh=_1.000.000 cwnd=_1 num-live=@ud - num-skips=@ud + counter=@ud == +$ live-packet-key [=message-num =fragment-num] +$ live-packet-val @@ -597,6 +596,7 @@ +$ packet-state $: last-sent=@da retries=@ud + skips=@ud == :: $message-still-state: state of |message-still to assemble messages :: @@ -2169,7 +2169,7 @@ ^- [key=live-packet-key val=live-packet-val] :: :- [message-num fragment-num] - :- [sent-date=now.channel retries=0] + :- [sent-date=now.channel retries=0 skips=0] [num-fragments fragment] :: update .live and .metrics :: @@ -2191,18 +2191,46 @@ :: metrics. Otherwise, no-op. :: ++ on-hear - |= key=live-packet-key + |= [=message-num =fragment-num] ^+ packet-pump :: - :: TODO handle misordered ack - =^ packet=(unit live-packet-val) live.state - (del:packet-queue live.state key) + =- :: if no sent packet matches the ack, don't apply mutations or effects + :: + ?. found.- + packet-pump + :: + =. metrics.state metrics.- + =. live.state live.- + :: + packet-pump :: - ?~ packet - packet-pump + ^- $: [found=? metrics=pump-metrics] + live=(tree [live-packet-key live-packet-val]) + == :: - =. metrics.state (on-ack:gauge -.u.packet) - packet-pump + =/ acc=[found=? metrics=pump-metrics] [%.n metrics.state] + :: + %^ (traverse:packet-queue _acc) live.state acc + |= $: acc=_acc + key=live-packet-key + val=live-packet-val + == + ^- [new-val=(unit live-packet-val) stop=? _acc] + :: + =/ gauge (make-pump-gauge now.channel metrics.acc) + :: is this the acked packet? + :: + ?: =(key [message-num fragment-num]) + :: delete acked packet, update metrics, and stop traversal + :: + :+ new-val=~ + stop=%.y + [found=%.y metrics=(on-ack:gauge -.val)] + :: ack was out of order; mark skipped, tell gauge, and continue + :: + :+ new-val=`val(skips +(skips.val)) + stop=%.n + [found=%.n metrics=(on-skipped-packet:gauge -.val)] :: +on-done: apply ack to all packets from .message-num :: ++ on-done @@ -2226,13 +2254,19 @@ ^- [new-val=(unit live-packet-val) stop=? pump-metrics] :: =/ gauge (make-pump-gauge now.channel metrics) - :: if ack was out of order, mark expired and continue - :: TODO redo skipped packet logic + :: if we get an out-of-order ack for a message, no-op + :: + :: We need to receive message acks in order, so if we get an ack + :: for anything other than the first unacked message, pretend we + :: never heard it. If the other end is correct, the first + :: message will get acked, and we'll re-send the second message + :: once it times out. + :: + :: This arrangement could probably be optimized, but it isn't + :: very likely to happen, so it's more important we stay correct. :: ?: (lth message-num.key message-num) - :+ new-val=`val - stop=%.n - metrics=(on-skipped-packet:gauge -.val) + [new-val=`val stop=%.y metrics] :: if packet was from acked message, delete it and continue :: ?: =(message-num.key message-num) @@ -2302,6 +2336,7 @@ |= =packet-state ^- pump-metrics :: + =. counter +(counter) =. num-live (dec num-live) :: if below congestion threshold, add 1; else, add avg. 1 / cwnd :: @@ -2312,6 +2347,8 @@ :: if this was a re-send, don't adjust rtt or downstream state :: ?. =(0 retries.packet-state) + :: + ~? =(0 (mod counter 100)) show metrics :: rtt-datum: new rtt measurement based on this packet roundtrip :: @@ -2328,22 +2365,26 @@ =. rttvar (div (add rtt-error (mul rttvar 7)) 8) =. rto (clamp-rto (add rtt (mul 4 rttvar))) :: + ~? =(0 (mod counter 100)) show + :: metrics :: +on-skipped-packet: TODO :: ++ on-skipped-packet |= packet-state ^- pump-metrics + ~& 'SKIPPED'^show metrics :: +on-timeout: (re)enter slow-start mode on packet loss :: ++ on-timeout ^- pump-metrics :: - =: ssthresh (div cwnd 2) + =: ssthresh (max 1 (div cwnd 2)) cwnd 1 rto (clamp-rto (mul rto 2)) == + ~& 'TIMEOUT'^show metrics :: +clamp-rto: apply min and max to an .rto value :: @@ -2362,6 +2403,19 @@ |= [a=@ b=@] ^- @ ?:((lte a b) 0 (sub a b)) + :: + :: + ++ show + =/ ms (div ~s1 1.000) + :: + :* rto=(div rto ms) + rtt=(div rtt ms) + rttvar=(div rttvar ms) + ssthresh=ssthresh + cwnd=cwnd + num-live=num-live + counter=counter + == -- :: +make-message-still: construct |message-still message receiver core :: From 86f2163410fdc8afdb51c8707dc8ae94a3f40116 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 02:21:31 -0400 Subject: [PATCH 129/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index c9806cc367..78274c78aa 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e60129f7ddf2921181c7615068df4b2731ea0ab3c51ccc113fc4710905ec9312 -size 13302691 +oid sha256:392583b445bdcec51946b3e62513b02b154437ed84cbdfde9dcd1cfcc218bfc9 +size 13310149 From c480d12995efc2afc265d56ad9900318bed5fd6a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 02:38:56 -0400 Subject: [PATCH 130/151] adjust printing --- pkg/arvo/sys/vane/alef.hoon | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 3d90004bad..409506002b 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2197,10 +2197,12 @@ =- :: if no sent packet matches the ack, don't apply mutations or effects :: ?. found.- + ~& 'MISS'^show:gauge packet-pump :: =. metrics.state metrics.- =. live.state live.- + ~? =(0 (mod counter.metrics.state 20)) [fragment-num show:gauge] :: packet-pump :: @@ -2347,8 +2349,6 @@ :: if this was a re-send, don't adjust rtt or downstream state :: ?. =(0 retries.packet-state) - :: - ~? =(0 (mod counter 100)) show metrics :: rtt-datum: new rtt measurement based on this packet roundtrip :: @@ -2365,8 +2365,6 @@ =. rttvar (div (add rtt-error (mul rttvar 7)) 8) =. rto (clamp-rto (add rtt (mul 4 rttvar))) :: - ~? =(0 (mod counter 100)) show - :: metrics :: +on-skipped-packet: TODO :: From 850f7b392bee2c31a76db1dee921be0ba439bb41 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 02:47:45 -0400 Subject: [PATCH 131/151] tweak printing --- pkg/arvo/sys/vane/alef.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 409506002b..b8f8c6d2a0 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2242,6 +2242,7 @@ =- =. metrics.state metrics.- =. live.state live.- :: + ~& 'DONE'^[fragment-num show:gauge] packet-pump :: ^- $: metrics=pump-metrics From b5644ba23f7bb9a41195f44fe6fbcdd718d3d118 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 02:55:10 -0400 Subject: [PATCH 132/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 78274c78aa..47b2e81123 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:392583b445bdcec51946b3e62513b02b154437ed84cbdfde9dcd1cfcc218bfc9 -size 13310149 +oid sha256:e8ea169a13eac81fce101a21f95bae11ef404ff2cdb51dc068fb4453a11af328 +size 13381963 From f04e5b9f977c2fde733bf2ed1e693312bb33f960 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:13:11 -0400 Subject: [PATCH 133/151] alef: print more --- pkg/arvo/sys/vane/alef.hoon | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index b8f8c6d2a0..004d028431 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -586,6 +586,7 @@ cwnd=_1 num-live=@ud counter=@ud + start=@da == +$ live-packet-key [=message-num =fragment-num] +$ live-packet-val @@ -2203,6 +2204,7 @@ =. metrics.state metrics.- =. live.state live.- ~? =(0 (mod counter.metrics.state 20)) [fragment-num show:gauge] + =? start.metrics.state =(0 fragment-num) now :: packet-pump :: @@ -2242,7 +2244,8 @@ =- =. metrics.state metrics.- =. live.state live.- :: - ~& 'DONE'^[fragment-num show:gauge] + =/ elapsed=@dr (sub now start.metrics.state) + ~& 'DONE'^[message-num seconds=(div elapsed ~s1) show:gauge] packet-pump :: ^- $: metrics=pump-metrics From dbafe99332baccdcb4e53026b679756e21710d25 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:13:15 -0400 Subject: [PATCH 134/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 47b2e81123..c9a5da6c41 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e8ea169a13eac81fce101a21f95bae11ef404ff2cdb51dc068fb4453a11af328 -size 13381963 +oid sha256:002f037da7d8b8400b9bb6169fc3717c5f20ca445c4259265f131cfc947c8647 +size 13381994 From 59ac079488c43a32028d487ac461e2c7abd40eee Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:20:19 -0400 Subject: [PATCH 135/151] alef: tweak printing --- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 004d028431..60e7bb9756 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2204,7 +2204,7 @@ =. metrics.state metrics.- =. live.state live.- ~? =(0 (mod counter.metrics.state 20)) [fragment-num show:gauge] - =? start.metrics.state =(0 fragment-num) now + =? start.metrics.state =(0 fragment-num) now.channel :: packet-pump :: @@ -2244,7 +2244,7 @@ =- =. metrics.state metrics.- =. live.state live.- :: - =/ elapsed=@dr (sub now start.metrics.state) + =/ elapsed=@dr (sub now.channel start.metrics.state) ~& 'DONE'^[message-num seconds=(div elapsed ~s1) show:gauge] packet-pump :: From 86ef9c78616c1326bbec6e70aefc12e59ce81b82 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:23:50 -0400 Subject: [PATCH 136/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index c9a5da6c41..e0d196745f 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:002f037da7d8b8400b9bb6169fc3717c5f20ca445c4259265f131cfc947c8647 -size 13381994 +oid sha256:c8850fd0c3b1519958a9e439c2fed8e71f470e6a3b5c5efc55a039ea1ab09e54 +size 13383045 From 04bd18054266beccf3b2e6e1842e66f02dea6e00 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:37:56 -0400 Subject: [PATCH 137/151] alef: cap cwnd --- pkg/arvo/sys/vane/alef.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 60e7bb9756..aba4d7a13d 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2334,7 +2334,6 @@ ^- pump-metrics :: =. num-live (add num-live num-sent) - ?> (lte num-live cwnd) metrics :: +on-ack: adjust metrics based on a packet getting acknowledged :: @@ -2347,6 +2346,7 @@ :: if below congestion threshold, add 1; else, add avg. 1 / cwnd :: =. cwnd + %+ min 200 ?: in-slow-start +(cwnd) (add cwnd !=(0 (mod (mug now) cwnd))) From 5e93b33835bb512d345fb762af118bbd09c5be1a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:38:05 -0400 Subject: [PATCH 138/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index e0d196745f..8cf83df75e 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8850fd0c3b1519958a9e439c2fed8e71f470e6a3b5c5efc55a039ea1ab09e54 -size 13383045 +oid sha256:193d5f5e99787f3041ea8b30dfaf9ef3a55afaa523c0d8900c8937a9c5eff45a +size 13382948 From 895927e5835b8d21b330f6d1ca5d714702f5d489 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:46:34 -0400 Subject: [PATCH 139/151] print more --- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index aba4d7a13d..95aa01b12c 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -2116,11 +2116,12 @@ =. next-wake.state ~ :: tell congestion control a packet timed out :: - =. metrics.state on-timeout:gauge + =. metrics.state on-timeout:gauge :: re-send first packet and update its state in-place :: =- =. live.state live.- =. packet-pump (give %send static-fragment.-) + ~& 'DEAD'^fragment-num.static-fragment.-^show:gauge packet-pump :: =| acc=static-fragment @@ -2386,7 +2387,6 @@ cwnd 1 rto (clamp-rto (mul rto 2)) == - ~& 'TIMEOUT'^show metrics :: +clamp-rto: apply min and max to an .rto value :: From a3dbe2181e496eae9900e917147ef83c1614e7b6 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 2 Oct 2019 03:54:07 -0400 Subject: [PATCH 140/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 8cf83df75e..19154e2ecb 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:193d5f5e99787f3041ea8b30dfaf9ef3a55afaa523c0d8900c8937a9c5eff45a -size 13382948 +oid sha256:ba6825d46dd669342d77cc8618f5f2f3f4d7fb8de9b5a9ada635f469a7c7088d +size 13383141 From 32360c2e5a58fbc2e2159b60444aca0790db668a Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:21:29 -0400 Subject: [PATCH 141/151] try misordered acks --- pkg/arvo/sys/vane/alef.hoon | 123 +++++++++++++++++++++--------------- 1 file changed, 71 insertions(+), 52 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 95aa01b12c..52c3b8270f 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -586,9 +586,15 @@ cwnd=_1 num-live=@ud counter=@ud - start=@da == -+$ live-packet-key [=message-num =fragment-num] ++$ live-packet + $: key=live-packet-key + val=live-packet-val + == ++$ live-packet-key + $: =message-num + =fragment-num + == +$ live-packet-val $: packet-state num-fragments=fragment-num @@ -1345,23 +1351,15 @@ :: apply outgoing messages :: =. event-core - |- ^+ event-core - ?~ snd-messages.todos event-core - :: - =. event-core - %- on-plea(duct duct.i.snd-messages.todos) - [ship plea.i.snd-messages.todos] - :: - $(snd-messages.todos t.snd-messages.todos) + %+ roll snd-messages.todos + |= [[=^duct =plea] core=_event-core] + (on-plea:core(duct duct) ship plea) :: apply outgoing packet blobs :: =. event-core - =/ blobs ~(tap in snd-packets.todos) - |- ^+ event-core - ?~ blobs event-core - :: - =. event-core (send-blob ship i.blobs) - $(blobs t.blobs) + %+ roll ~(tap in snd-packets.todos) + |= [=blob core=_event-core] + (send-blob:core ship blob) :: event-core -- @@ -2138,10 +2136,7 @@ =. last-sent.val now.channel =. retries.val +(retries.val) :: - =/ =static-fragment - [message-num num-fragments fragment-num fragment]:[key val] - :: - [`val stop=%.y static-fragment] + [`val stop=%.y (to-static-fragment key val)] :: +feed: try to send a list of packets, returning unsent and effects :: ++ feed @@ -2182,11 +2177,9 @@ => .(sent `(list static-fragment)`sent) :: emit a $packet-pump-gift for each packet to send :: - |- ^+ packet-pump - ?~ sent packet-pump - :: - =. packet-pump (give %send i.sent) - $(sent t.sent) + %+ roll sent + |= [packet=static-fragment core=_packet-pump] + (give:core %send packet) :: +on-hear: handle ack on a live packet :: :: If the packet was in our queue, delete it and update our @@ -2204,16 +2197,23 @@ :: =. metrics.state metrics.- =. live.state live.- - ~? =(0 (mod counter.metrics.state 20)) [fragment-num show:gauge] - =? start.metrics.state =(0 fragment-num) now.channel + ~? ?| =(0 fragment-num) + =(0 (mod counter.metrics.state 20)) + == + [fragment-num show:gauge] + :: .resends is backward, so fold backward and emit :: - packet-pump + %+ reel resends.- + |= [packet=static-fragment core=_packet-pump] + (give:core %send packet) :: - ^- $: [found=? metrics=pump-metrics] - live=(tree [live-packet-key live-packet-val]) - == + =/ acc + :* found=`?`%.n + resends=*(list static-fragment) + metrics=metrics.state + == :: - =/ acc=[found=? metrics=pump-metrics] [%.n metrics.state] + ^+ [acc live=live.state] :: %^ (traverse:packet-queue _acc) live.state acc |= $: acc=_acc @@ -2228,14 +2228,20 @@ ?: =(key [message-num fragment-num]) :: delete acked packet, update metrics, and stop traversal :: - :+ new-val=~ - stop=%.y - [found=%.y metrics=(on-ack:gauge -.val)] - :: ack was out of order; mark skipped, tell gauge, and continue + =. found.acc %.y + =. metrics.acc (on-ack:gauge -.val) + [new-val=~ stop=%.y acc] + :: ack was on later packet; mark skipped, tell gauge, and continue :: - :+ new-val=`val(skips +(skips.val)) - stop=%.n - [found=%.n metrics=(on-skipped-packet:gauge -.val)] + =. skips.val +(skips.val) + =^ resend metrics.acc (on-skipped-packet:gauge -.val) + ?. resend + [new-val=`val stop=%.n acc] + :: + =. last-sent.val now.channel + =. retries.val +(retries.val) + =. resends.acc [(to-static-fragment key val) resends.acc] + [new-val=`val stop=%.n acc] :: +on-done: apply ack to all packets from .message-num :: ++ on-done @@ -2245,13 +2251,10 @@ =- =. metrics.state metrics.- =. live.state live.- :: - =/ elapsed=@dr (sub now.channel start.metrics.state) - ~& 'DONE'^[message-num seconds=(div elapsed ~s1) show:gauge] + ~& 'DONE'^[message-num show:gauge] packet-pump :: - ^- $: metrics=pump-metrics - live=(tree [live-packet-key live-packet-val]) - == + ^+ [metrics=metrics.state live=live.state] :: %^ (traverse:packet-queue pump-metrics) live.state acc=metrics.state |= $: metrics=pump-metrics @@ -2308,6 +2311,12 @@ :: packet-pump -- +:: +to-static-fragment: convenience function for |packet-pump +:: +++ to-static-fragment + |= [live-packet-key live-packet-val] + ^- static-fragment + [message-num num-fragments fragment-num fragment] :: +make-pump-gauge: construct |pump-gauge congestion control core :: ++ make-pump-gauge @@ -2347,7 +2356,6 @@ :: if below congestion threshold, add 1; else, add avg. 1 / cwnd :: =. cwnd - %+ min 200 ?: in-slow-start +(cwnd) (add cwnd !=(0 (mod (mug now) cwnd))) @@ -2371,12 +2379,17 @@ =. rto (clamp-rto (add rtt (mul 4 rttvar))) :: metrics - :: +on-skipped-packet: TODO + :: +on-skipped-packet: handle misordered ack :: ++ on-skipped-packet |= packet-state - ^- pump-metrics - ~& 'SKIPPED'^show + ^- [resend=? pump-metrics] + :: + =/ resend=? &(=(0 retries) |(in-recovery (gte skips 3))) + :- resend + :: + =? cwnd !in-recovery (max 2 (div cwnd 2)) + ~& ['SKIPPED' resend=resend in-recovery=in-recovery show] metrics :: +on-timeout: (re)enter slow-start mode on packet loss :: @@ -2394,18 +2407,26 @@ |= rto=@dr ^+ rto (min ~m2 (max ^~((div ~s1 5)) rto)) - :: +in-slow-start: produces %.y iff we're in "slow-start" mode + :: +in-slow-start: %.y iff we're in "slow-start" mode :: ++ in-slow-start ^- ? (lth cwnd ssthresh) + :: +in-recovery: %.y iff we're recovering from a skipped packet + :: + :: We finish recovering when .num-live finally dips back down to + :: .cwnd. + :: + ++ in-recovery + ^- ? + (gth num-live cwnd) :: +sub-safe: subtract with underflow protection :: ++ sub-safe |= [a=@ b=@] ^- @ ?:((lte a b) 0 (sub a b)) - :: + :: +show: produce a printable version of .metrics :: ++ show =/ ms (div ~s1 1.000) @@ -2694,8 +2715,6 @@ |= [=public-key =private-key] ^- symmetric-key :: - ~| [public-key=public-key private-key=private-key] - :: ?> =('b' (end 3 1 public-key)) =. public-key (rsh 8 1 (rsh 3 1 public-key)) :: From ce75ae779adc0e0d09a7aa779d4bb5a2a9a86a16 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:21:51 -0400 Subject: [PATCH 142/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 19154e2ecb..2b5699a936 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ba6825d46dd669342d77cc8618f5f2f3f4d7fb8de9b5a9ada635f469a7c7088d -size 13383141 +oid sha256:59abbbef272e029ce6fb23aa3e7c839a2539570f6dfed45fad38ad7ae19a1323 +size 13385791 From 6bae84fbe4811e80b0e486776bf6a60da3b10285 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:38:32 -0400 Subject: [PATCH 143/151] fix enqueued message order --- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 52c3b8270f..f6ca01e490 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -1348,10 +1348,10 @@ :: =? event-core =(%pawn (clan:title our)) (send-blob ship (attestation-packet ship life.point)) - :: apply outgoing messages + :: apply outgoing messages, reversing for FIFO order :: =. event-core - %+ roll snd-messages.todos + %+ reel snd-messages.todos |= [[=^duct =plea] core=_event-core] (on-plea:core(duct duct) ship plea) :: apply outgoing packet blobs From eed3d8ce369c491ddd5b80e8848b44dee322d51c Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:39:51 -0400 Subject: [PATCH 144/151] try slowing down once cwnd > 200 --- pkg/arvo/sys/vane/alef.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index f6ca01e490..9c197f6912 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -582,7 +582,7 @@ $: rto=_~s1 rtt=_~s1 rttvar=_~s1 - ssthresh=_1.000.000 + ssthresh=_200 cwnd=_1 num-live=@ud counter=@ud From 0abea7eb25636b1a3e44625ebd093d053f78e906 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:46:20 -0400 Subject: [PATCH 145/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 2b5699a936..1631202eba 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:59abbbef272e029ce6fb23aa3e7c839a2539570f6dfed45fad38ad7ae19a1323 -size 13385791 +oid sha256:1e0003a43376106e2c79dcfa51f890122f01cdb44d15c1689ee8fa9ac0766d8b +size 13385807 From 8749fc7f136cc61f09f6d60eba691a41aa630cf8 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:54:09 -0400 Subject: [PATCH 146/151] try slowing down once cwnd > 1.000; 200 was too slow --- pkg/arvo/sys/vane/alef.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 9c197f6912..4f834f5abb 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -582,7 +582,7 @@ $: rto=_~s1 rtt=_~s1 rttvar=_~s1 - ssthresh=_200 + ssthresh=_1.000 cwnd=_1 num-live=@ud counter=@ud From d1a7a339b757fce9c1fb7cf2ef89aac33b8a5926 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 4 Oct 2019 23:55:45 -0400 Subject: [PATCH 147/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 1631202eba..8547b1fa0f 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e0003a43376106e2c79dcfa51f890122f01cdb44d15c1689ee8fa9ac0766d8b -size 13385807 +oid sha256:b87cabc7a36d1b713446595ae2d558b1aab3b2f4697ef05f5a899523240f2175 +size 13385779 From cc5e2c9564d9a59068804bd3b26b43605d8e283f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 5 Oct 2019 00:41:18 -0400 Subject: [PATCH 148/151] temporary fast start for testing --- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 4f834f5abb..3d4881aaac 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -582,8 +582,8 @@ $: rto=_~s1 rtt=_~s1 rttvar=_~s1 - ssthresh=_1.000 - cwnd=_1 + ssthresh=_1.000.000 + cwnd=_1.000.000 num-live=@ud counter=@ud == From e6cefceb7ef06da9db79cab452a82dcc69d6ec41 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 5 Oct 2019 00:43:34 -0400 Subject: [PATCH 149/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 8547b1fa0f..6f27dae8e9 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b87cabc7a36d1b713446595ae2d558b1aab3b2f4697ef05f5a899523240f2175 -size 13385779 +oid sha256:1c0997870a6d110b172328dd49325e7f79f620d9e2885d074c6dc99d8cd6a521 +size 13385805 From 5fcdb02db9e99fd864c85837e8b41b3cbf55bc53 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 5 Oct 2019 01:00:20 -0400 Subject: [PATCH 150/151] ames: reset congestion control params to 'reasonable' values --- pkg/arvo/sys/vane/alef.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/alef.hoon b/pkg/arvo/sys/vane/alef.hoon index 3d4881aaac..95650c41d6 100644 --- a/pkg/arvo/sys/vane/alef.hoon +++ b/pkg/arvo/sys/vane/alef.hoon @@ -582,8 +582,8 @@ $: rto=_~s1 rtt=_~s1 rttvar=_~s1 - ssthresh=_1.000.000 - cwnd=_1.000.000 + ssthresh=_10.000 + cwnd=_1 num-live=@ud counter=@ud == From 81cab03610a293adcfc027ffb315b61c6b9acd38 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sat, 5 Oct 2019 01:16:31 -0400 Subject: [PATCH 151/151] update pill --- bin/solid.pill | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 6f27dae8e9..554950afda 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c0997870a6d110b172328dd49325e7f79f620d9e2885d074c6dc99d8cd6a521 -size 13385805 +oid sha256:ca29c74e14f13b3e3e4c7853666cad4f5aea73d4839673b7add4083e9a6ad707 +size 13385789