mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 06:35:32 +03:00
Merge branch 'philip/kale' into alef-testnet and fix printing
This commit is contained in:
commit
ea2a3b0f67
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:03f7a95ef8e045bdc4c0c3a13098b5ec280ad4750929dbf9ced42985129188ba
|
||||
size 10291461
|
||||
oid sha256:332ec24cf9347844fb77d75484a2f2b93b9281d331af06f4351910b74e5771d9
|
||||
size 10373689
|
||||
|
@ -322,7 +322,6 @@
|
||||
;< =b=pending-udiffs bind:m
|
||||
(release-old-events a-pending-udiffs number.id.block)
|
||||
;< =new=udiffs:point bind:m (get-logs-by-hash url whos hash.id.block)
|
||||
~? !=(~ new-udiffs) [%adding-diffs new-udiffs]
|
||||
=. b-pending-udiffs (~(put by b-pending-udiffs) number.id.block new-udiffs)
|
||||
(pure:m b-pending-udiffs block blocks)
|
||||
::
|
||||
@ -332,7 +331,7 @@
|
||||
|= [=pending-udiffs =number:block]
|
||||
=/ m (async:stdio ,^pending-udiffs)
|
||||
^- form:m
|
||||
=/ rel-number (sub number 1)
|
||||
=/ rel-number (sub number 30)
|
||||
=/ =udiffs:point (~(get ja pending-udiffs) rel-number)
|
||||
;< ~ bind:m (jael-update udiffs)
|
||||
(pure:m (~(del by pending-udiffs) rel-number))
|
||||
|
@ -139,11 +139,30 @@
|
||||
~& > 'BUD-DONE'
|
||||
(send-hi ~bud ~marbud)
|
||||
(pure:m ~)
|
||||
::
|
||||
:+ %hi-linnup-az
|
||||
~[~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 ~linnup-torsyx)
|
||||
~& > 'LINNUP DONE'
|
||||
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
|
||||
~& > 'MARBUD-DONE'
|
||||
;< ~ bind:m (raw-real-ship:eth-node ~bud)
|
||||
~& > 'BUD-DONE'
|
||||
;< ~ bind:m (send-hi ~linnup-torsyx ~marbud)
|
||||
~& > 'HI DONE-------------------------------'
|
||||
(pure:m ~)
|
||||
(pure:m ~)
|
||||
::
|
||||
:+ %moon-az
|
||||
~[~bud ~marbud ~linnup-torsyx ~linnup-torsyx-linnup-torsyx ~dev]
|
||||
=. eth-node (spawn:eth-node ~marbud)
|
||||
=. eth-node (spawn:eth-node ~linnup-torsyx)
|
||||
=. eth-node (spawn:eth-node ~dev)
|
||||
;< [eth-node=_eth-node ~] bind:m
|
||||
%+ (wrap-philter ,_eth-node ,~)
|
||||
router:eth-node
|
||||
@ -159,12 +178,12 @@
|
||||
~& > 'HI DOWN DONE'
|
||||
;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~marbud)
|
||||
~& > 'HI UP DONE'
|
||||
:: ;< ~ bind:m (raw-real-ship:eth-node ~bud)
|
||||
:: ~& > 'DEV DONE'
|
||||
:: ;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~dev)
|
||||
:: ~& > 'HI OVER UP DONE'
|
||||
:: ;< ~ bind:m (send-hi ~dev ~linnup-torsyx-linnup-torsyx)
|
||||
:: ~& > 'HI OVER DOWN DONE'
|
||||
;< ~ bind:m (raw-real-ship:eth-node ~dev)
|
||||
~& > 'DEV DONE'
|
||||
;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~dev)
|
||||
~& > 'HI OVER UP DONE'
|
||||
;< ~ bind:m (send-hi ~dev ~linnup-torsyx-linnup-torsyx)
|
||||
~& > 'HI OVER DOWN DONE'
|
||||
(pure:m ~)
|
||||
(pure:m ~)
|
||||
::
|
||||
|
9
pkg/arvo/gen/aqua/pill.hoon
Normal file
9
pkg/arvo/gen/aqua/pill.hoon
Normal file
@ -0,0 +1,9 @@
|
||||
/+ pill
|
||||
::
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
arg=~
|
||||
~
|
||||
==
|
||||
:- %pill
|
||||
.^(pill:pill %gx /(scot %p p.bec)/aqua/(scot %da now)/pill/noun)
|
@ -1,7 +1,7 @@
|
||||
=> |%
|
||||
+$ src
|
||||
$% [%ship =ship ~]
|
||||
[%node url=@t ~]
|
||||
[%app =term ~]
|
||||
==
|
||||
--
|
||||
:- %say
|
||||
@ -9,6 +9,6 @@
|
||||
=/ =source:kale
|
||||
?- -.src
|
||||
%ship [%& ship.src]
|
||||
%node [%| ~|(%parsing-url (need (de-purl:html url.src))) *@ud *@da]
|
||||
%app [%| term.src]
|
||||
==
|
||||
[%azimuth-tracker-poke %listen whos source]
|
||||
|
@ -50,11 +50,7 @@
|
||||
:- %o
|
||||
=/ number (hex-to-num:ethereum (get-first-param req))
|
||||
=/ hash (number-to-hash number)
|
||||
~& who=who.pin
|
||||
~& number=number
|
||||
~& hash=hash
|
||||
=/ parent-hash (number-to-hash ?~(number number (dec number)))
|
||||
~& parent-hash=parent-hash
|
||||
%- malt
|
||||
^- (list (pair term json))
|
||||
:~ hash+s+(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 hash)))
|
||||
@ -202,7 +198,6 @@
|
||||
?: (lth to-block launch:contracts:azimuth)
|
||||
~
|
||||
%+ swag
|
||||
~& [%logs-by-range from-block to-block launch:contracts:azimuth]
|
||||
?: (lth from-block launch:contracts:azimuth)
|
||||
[0 +((sub to-block launch:contracts:azimuth))]
|
||||
:- (sub from-block launch:contracts:azimuth)
|
||||
@ -212,7 +207,7 @@
|
||||
++ logs-by-hash
|
||||
|= =hash:block:able:kale
|
||||
=/ =number:block:able:kale (hash-to-number hash)
|
||||
(logs-by-range number +(number))
|
||||
(logs-by-range number number)
|
||||
::
|
||||
++ logs-to-json
|
||||
|= [count=@ud selected-logs=(list az-log)]
|
||||
@ -325,21 +320,17 @@
|
||||
|= who=@p
|
||||
?< (~(has by lives) who)
|
||||
=. lives (~(put by lives) who [1 0])
|
||||
%- add-logs
|
||||
%+ welp
|
||||
?: =(%czar (clan:title who))
|
||||
~
|
||||
~[(spawned:lo (^sein:title who) who)]
|
||||
:~ (activated:lo who)
|
||||
(owner-changed:lo who 0xdead.beef)
|
||||
%- changed-keys:lo
|
||||
:* who
|
||||
(get-public who 1 %crypt)
|
||||
(get-public who 1 %auth)
|
||||
1
|
||||
1
|
||||
==
|
||||
==
|
||||
=. this-az
|
||||
%- add-logs
|
||||
:~ %- changed-keys:lo
|
||||
:* who
|
||||
(get-public who 1 %crypt)
|
||||
(get-public who 1 %auth)
|
||||
1
|
||||
1
|
||||
==
|
||||
==
|
||||
(spam-logs 30)
|
||||
::
|
||||
:: our: host ship
|
||||
:: who: cycle keys
|
||||
@ -412,9 +403,7 @@
|
||||
=/ rut +(rut.prev)
|
||||
=. lives (~(put by lives) who [lyfe.prev rut])
|
||||
=. this-az
|
||||
%- add-logs
|
||||
:_ ~
|
||||
(broke-continuity:lo who rut)
|
||||
(add-logs (broke-continuity:lo who rut) ~)
|
||||
(spam-logs 30)
|
||||
::
|
||||
++ spam-logs
|
||||
@ -443,11 +432,6 @@
|
||||
++ lo
|
||||
=, azimuth-events:azimuth
|
||||
|%
|
||||
++ activated
|
||||
|= who=ship
|
||||
^- az-log
|
||||
[~[^activated who] '']
|
||||
::
|
||||
++ broke-continuity
|
||||
|= [who=ship rut=rift]
|
||||
^- az-log
|
||||
@ -468,15 +452,5 @@
|
||||
(render-hex-bytes:ethereum 32 `@`crypto)
|
||||
(render-hex-bytes:ethereum 32 `@`lyfe)
|
||||
==
|
||||
::
|
||||
++ owner-changed
|
||||
|= [who=ship owner=@ux]
|
||||
^- az-log
|
||||
[~[^owner-changed who owner] '']
|
||||
::
|
||||
++ spawned
|
||||
|= [par=ship who=ship]
|
||||
^- az-log
|
||||
[~[^spawned par who] '']
|
||||
--
|
||||
--
|
||||
|
@ -423,6 +423,7 @@
|
||||
:: $peer-state: state for a peer with known life and keys
|
||||
::
|
||||
:: route: transport-layer destination for packets to peer
|
||||
:: qos: quality of service; connection status to peer
|
||||
:: ossuary: bone<->duct mapper
|
||||
:: snd: per-bone message pumps to send messages as fragments
|
||||
:: rcv: per-bone message stills to assemble messages from fragments
|
||||
@ -444,11 +445,20 @@
|
||||
sponsor=ship
|
||||
==
|
||||
route=(unit [direct=? =lane])
|
||||
=qos
|
||||
=ossuary
|
||||
snd=(map bone message-pump-state)
|
||||
rcv=(map bone message-still-state)
|
||||
nax=(set [=bone =message-num])
|
||||
==
|
||||
:: $qos: quality of service; how is our connection to a peer doing?
|
||||
::
|
||||
+$ qos
|
||||
$~ [%unborn ~]
|
||||
$% [%live last-contact=@da]
|
||||
[%dead last-contact=@da]
|
||||
[%unborn ~]
|
||||
==
|
||||
:: $ossuary: bone<->duct bijection and .next-bone to map to a duct
|
||||
::
|
||||
:: The first bone is 0. They increment by 4, since each flow includes
|
||||
@ -623,6 +633,9 @@
|
||||
$% [%wait date=@da]
|
||||
[%rest date=@da]
|
||||
== ==
|
||||
$: %d
|
||||
$% [%flog flog:dill]
|
||||
== ==
|
||||
$: %k
|
||||
$% [%private-keys ~]
|
||||
[%public-keys ships=(set ship)]
|
||||
@ -855,9 +868,7 @@
|
||||
=< abet
|
||||
?- -.task
|
||||
%born on-born:event-core
|
||||
%crud ~& %ames-crud^our^p.task
|
||||
%- (slog q.task)
|
||||
event-core
|
||||
%crud (on-crud:event-core [p q]:task)
|
||||
%hear (on-hear:event-core [lane blob]:task)
|
||||
%hole (on-hole:event-core [lane blob]:task)
|
||||
%init (on-init:event-core ship=p.task)
|
||||
@ -915,18 +926,18 @@
|
||||
|%
|
||||
++ 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
|
||||
|= [=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
|
||||
::
|
||||
=+ ^- [her=ship =bone] (parse-bone-wire wire)
|
||||
::
|
||||
@ -950,12 +961,17 @@
|
||||
=/ nack-trace-bone=^bone (mix 0b10 bone)
|
||||
::
|
||||
abet:(run-message-pump:peer-core nack-trace-bone %memo message-blob)
|
||||
:: +on-crud: handle event failure; print to dill
|
||||
::
|
||||
++ on-crud
|
||||
|= =error
|
||||
^+ event-core
|
||||
(emit duct %pass /crud %d %flog %crud error)
|
||||
:: +on-hear: handle raw packet receipt
|
||||
::
|
||||
++ on-hear
|
||||
|= [=lane =blob]
|
||||
^+ event-core
|
||||
::
|
||||
(on-hear-packet lane (decode-packet blob) ok=%.y)
|
||||
:: +on-hole: handle packet crash notification
|
||||
::
|
||||
@ -1089,10 +1105,13 @@
|
||||
::
|
||||
?> =(sndr-life.shut-packet her-life.channel)
|
||||
?> =(rcvr-life.shut-packet our-life.channel)
|
||||
:: set .lane as new route to peer since packet is valid
|
||||
:: non-galaxy: update route with heard lane or forwarded lane
|
||||
::
|
||||
=? route.peer-state !=(%czar (clan:title her.channel))
|
||||
`[direct=%.y lane]
|
||||
?~ origin.packet
|
||||
`[direct=%.n lane]
|
||||
`[direct=%.n u.origin.packet]
|
||||
:: perform peer-specific handling of packet
|
||||
::
|
||||
=/ peer-core (make-peer-core peer-state channel)
|
||||
abet:(on-hear-shut-packet:peer-core lane shut-packet ok)
|
||||
@ -1114,6 +1133,12 @@
|
||||
++ on-plea
|
||||
|= [=ship =plea]
|
||||
^+ event-core
|
||||
:: if .plea is a sponsor ping; ack it
|
||||
::
|
||||
?: =([%a /ping ~] 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)
|
||||
::
|
||||
@ -1536,6 +1561,7 @@
|
||||
|%
|
||||
++ peer-core .
|
||||
++ emit |=(move peer-core(event-core (^emit +<)))
|
||||
::
|
||||
++ abet
|
||||
^+ event-core
|
||||
::
|
||||
@ -1543,11 +1569,30 @@
|
||||
(~(put by peers.ames-state) her.channel %known peer-state)
|
||||
::
|
||||
event-core
|
||||
:: +update-qos: update and maybe print connection status
|
||||
::
|
||||
++ update-qos
|
||||
|= =new=qos
|
||||
^+ peer-core
|
||||
::
|
||||
=^ old-qos qos.peer-state [qos.peer-state new-qos]
|
||||
::
|
||||
?~ text=(qos-update-text her.channel old-qos new-qos)
|
||||
peer-core
|
||||
(emit duct %pass /qos %d %flog %text u.text)
|
||||
:: +on-hear-shut-packet: handle receipt of ack or message fragment
|
||||
::
|
||||
++ on-hear-shut-packet
|
||||
|= [=lane =shut-packet ok=?]
|
||||
^+ 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 !!
|
||||
==
|
||||
::
|
||||
=/ =bone bone.shut-packet
|
||||
::
|
||||
@ -1571,9 +1616,16 @@
|
||||
^+ peer-core
|
||||
:: if we previously errored out, print and try again
|
||||
::
|
||||
%- ?~ error
|
||||
same
|
||||
(slog >%ames-wake-fail< u.error)
|
||||
=? peer-core ?=(^ error)
|
||||
(emit duct %pass /wake-fail %d %flog %crud %ames-wake u.error)
|
||||
:: update and print connection state
|
||||
::
|
||||
=. peer-core %- update-qos
|
||||
?. ?& ?=(%live -.qos.peer-state)
|
||||
(gte now (add ~s30 last-contact.qos.peer-state))
|
||||
==
|
||||
qos.peer-state
|
||||
[%dead last-contact.qos.peer-state]
|
||||
:: expire direct route
|
||||
::
|
||||
:: Since a packet's timer expired, mark the .lane.route as
|
||||
@ -1823,31 +1875,17 @@
|
||||
|= [=message-num message=*]
|
||||
^+ peer-core
|
||||
~& %ames-still-plea^our^bone=bone
|
||||
:: don't accept requests for arbitrary vanes
|
||||
::
|
||||
=+ ;; =plea message
|
||||
:: %a /ping means sponsor ping timer; send ack
|
||||
::
|
||||
?: ?=(%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
|
||||
::
|
||||
~& ?: =([/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?
|
||||
::
|
||||
?. ?=([%hear * * ok=%.n] task)
|
||||
:: fresh plea; pass to client vane
|
||||
::
|
||||
?+ vane.plea ~| %ames-evil-vane^vane.plea !!
|
||||
=+ ;; =plea message
|
||||
::
|
||||
=/ =wire (make-bone-wire her.channel bone)
|
||||
::
|
||||
?+ vane.plea ~| %ames-evil-vane^our^her.channel^vane.plea !!
|
||||
%a (emit duct %pass wire %a %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)
|
||||
@ -2419,7 +2457,7 @@
|
||||
?: is-last-fragment
|
||||
:: drop last packet since we don't know whether to ack or nack
|
||||
::
|
||||
~& %repeat-last-unprocessed^our.channel^seq^last-heard.state
|
||||
~& %repeat-last-unprocessed^our.channel^her.channel^seq^last-heard.state^pending-vane-ack.state
|
||||
message-still
|
||||
:: ack all other packets
|
||||
::
|
||||
@ -2523,6 +2561,19 @@
|
||||
::
|
||||
message-still
|
||||
--
|
||||
:: +qos-update-text: notice text for if connection state changes
|
||||
::
|
||||
++ qos-update-text
|
||||
|= [=ship old=qos new=qos]
|
||||
^- (unit tape)
|
||||
::
|
||||
?+ [-.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 %unborn] `"; {(scow %p ship)} is dead"
|
||||
[%dead %unborn] `"; {(scow %p ship)} is dead"
|
||||
==
|
||||
:: +split-message: split message into kilobyte-sized fragments
|
||||
::
|
||||
++ split-message
|
||||
|
@ -419,8 +419,6 @@
|
||||
:: [%meet our=ship who=ship]
|
||||
::
|
||||
%meet
|
||||
:: XX what do
|
||||
~& %meet-kale
|
||||
+>.$
|
||||
::
|
||||
:: restore snapshot
|
||||
|
@ -685,7 +685,6 @@
|
||||
{$logo ~} :: logout
|
||||
{$lyra p/@t q/@t} :: upgrade kernel
|
||||
{$mass p/mass} :: memory usage
|
||||
{$send p/lane:ames q/@} :: transmit packet
|
||||
{$veer p/@ta q/path r/@t} :: install vane
|
||||
{$verb ~} :: verbose mode
|
||||
== ::
|
||||
|
@ -116,16 +116,34 @@
|
||||
'3defb87516f42ce4327820b588002aa53e52527af8d23bee4aa215fa296bdf5f'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000000'
|
||||
'0000000000000000000000000000000000000000000000000000000000000000'
|
||||
'0000000000000000000000000000000000000000000000000000000000000000'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000002'
|
||||
'"},{"id":"gal-1","jsonrpc":"2.0","result":"'
|
||||
'0xb727e38d031162e50913b2e37a2e29d4ba457eff4f7fd4ac47dc68fcb54260d3'
|
||||
'b8bfe4789483c171f7fa359438cdcc8d268d40fe08d6c1d8b36267748d2139f8'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000000'
|
||||
'0000000000000000000000000000000000000000000000000000000000000000'
|
||||
'0000000000000000000000000000000000000000000000000000000000000000'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000003'
|
||||
'"},{"id":"gal-2","jsonrpc":"2.0","result":"'
|
||||
'0x0000000000000000000000000000000000000000000000000000000000000000'
|
||||
'0000000000000000000000000000000000000000000000000000000000000000'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000000'
|
||||
'0000000000000000000000000000000000000000000000000000000000000000'
|
||||
'0000000000000000000000000000000000000000000000000000000000000000'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000001'
|
||||
'0000000000000000000000000000000000000000000000000000000000000004'
|
||||
'"}]'
|
||||
==
|
||||
=/ kyz
|
||||
@ -139,8 +157,8 @@
|
||||
823.313.739.767.009.446.819.531.923.255.637.798.148.055.143.938.146
|
||||
%+ expect-eq
|
||||
!> :- ~
|
||||
%- ~(gas by *(map ship [=life =pass]))
|
||||
[[~zod 1 zod.kyz] [~nec 1 nec.kyz] [~bud 0 'b'] ~]
|
||||
%- ~(gas by *(map ship [=rift =life =pass]))
|
||||
[[~zod 2 1 zod.kyz] [~nec 3 1 nec.kyz] [~bud 4 1 'b'] ~]
|
||||
!> (czar:take:dawn oct)
|
||||
::
|
||||
++ test-take-point
|
||||
|
Loading…
Reference in New Issue
Block a user