2019-05-25 05:03:33 +03:00
|
|
|
/+ *test
|
2020-04-19 02:53:45 +03:00
|
|
|
/= ames /sys/vane/ames
|
2022-03-11 11:40:14 +03:00
|
|
|
/= jael /sys/vane/jael
|
2019-06-26 01:35:22 +03:00
|
|
|
:: construct some test fixtures
|
2019-05-25 05:03:33 +03:00
|
|
|
::
|
2022-02-01 02:32:05 +03:00
|
|
|
=/ nec (ames ~nec)
|
|
|
|
=/ bud (ames ~bud)
|
|
|
|
=/ marbud (ames ~marbud)
|
|
|
|
::
|
|
|
|
=/ our-comet ~bosrym-podwyl-magnes-dacrys--pander-hablep-masrym-marbud
|
|
|
|
=/ our-comet2 ~togdut-rosled-fadlev-siddys--botmun-wictev-sapfus-marbud
|
|
|
|
=/ comet (ames our-comet)
|
|
|
|
=/ comet2 (ames our-comet2)
|
2019-05-28 06:39:42 +03:00
|
|
|
::
|
2020-12-01 17:51:14 +03:00
|
|
|
=. now.nec ~1111.1.1
|
|
|
|
=. eny.nec 0xdead.beef
|
|
|
|
=. life.ames-state.nec 2
|
2020-12-01 22:14:36 +03:00
|
|
|
=. rof.nec |=(* ``[%noun !>(*(list turf))])
|
2019-08-14 00:30:15 +03:00
|
|
|
=. crypto-core.ames-state.nec (pit:nu:crub:crypto 512 (shaz 'nec'))
|
|
|
|
=/ nec-pub pub:ex:crypto-core.ames-state.nec
|
|
|
|
=/ nec-sec sec:ex:crypto-core.ames-state.nec
|
2020-12-01 17:51:14 +03:00
|
|
|
::
|
|
|
|
=. now.bud ~1111.1.1
|
|
|
|
=. eny.bud 0xbeef.dead
|
|
|
|
=. life.ames-state.bud 3
|
2020-12-01 22:14:36 +03:00
|
|
|
=. rof.bud |=(* ``[%noun !>(*(list turf))])
|
2020-12-01 17:51:14 +03:00
|
|
|
=. crypto-core.ames-state.bud (pit:nu:crub:crypto 512 (shaz 'bud'))
|
2019-11-27 09:15:05 +03:00
|
|
|
=/ bud-pub pub:ex:crypto-core.ames-state.bud
|
|
|
|
=/ bud-sec sec:ex:crypto-core.ames-state.bud
|
2019-06-26 01:35:22 +03:00
|
|
|
::
|
2022-02-01 02:32:05 +03:00
|
|
|
=. now.marbud ~1111.1.1
|
|
|
|
=. eny.marbud 0xbeef.beef
|
|
|
|
=. life.ames-state.marbud 4
|
|
|
|
=. rof.marbud |=(* ``[%noun !>(*(list turf))])
|
|
|
|
=. crypto-core.ames-state.marbud (pit:nu:crub:crypto 512 (shaz 'marbud'))
|
|
|
|
=/ marbud-pub pub:ex:crypto-core.ames-state.marbud
|
|
|
|
=/ marbud-sec sec:ex:crypto-core.ames-state.marbud
|
|
|
|
::
|
2020-12-01 17:51:14 +03:00
|
|
|
=. now.comet ~1111.1.1
|
|
|
|
=. eny.comet 0xbeef.cafe
|
2022-02-01 02:32:05 +03:00
|
|
|
=. life.ames-state.comet 1
|
2020-12-01 22:14:36 +03:00
|
|
|
=. rof.comet |=(* ``[%noun !>(*(list turf))])
|
2020-12-01 17:51:14 +03:00
|
|
|
=. crypto-core.ames-state.comet
|
|
|
|
%- nol:nu:crub:crypto
|
|
|
|
0w9N.5uIvA.Jg0cx.NCD2R.o~MtZ.uEQOB.9uTbp.6LHvg.0yYTP.
|
|
|
|
3q3td.T4UF0.d5sDL.JGpZq.S3A92.QUuWg.IHdw7.izyny.j9W92
|
|
|
|
=/ comet-pub pub:ex:crypto-core.ames-state.comet
|
|
|
|
=/ comet-sec sec:ex:crypto-core.ames-state.comet
|
2022-02-01 02:32:05 +03:00
|
|
|
::
|
|
|
|
=. now.comet2 ~1111.1.1
|
|
|
|
=. eny.comet2 0xcafe.cafe
|
|
|
|
=. life.ames-state.comet2 1
|
|
|
|
=. rof.comet2 |=(* ``[%noun !>(*(list turf))])
|
|
|
|
=. crypto-core.ames-state.comet2 (pit:nu:crub:crypto 512 0v1eb4)
|
|
|
|
=/ comet2-pub pub:ex:crypto-core.ames-state.comet2
|
|
|
|
=/ comet2-sec sec:ex:crypto-core.ames-state.comet2
|
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=/ nec-sym (derive-symmetric-key:ames bud-pub nec-sec)
|
|
|
|
=/ bud-sym (derive-symmetric-key:ames nec-pub bud-sec)
|
2019-08-14 00:30:15 +03:00
|
|
|
?> =(nec-sym bud-sym)
|
2022-02-01 02:32:05 +03:00
|
|
|
=/ nec-marbud-sym (derive-symmetric-key:ames marbud-pub nec-sec)
|
|
|
|
::
|
|
|
|
=/ marbud-sym (derive-symmetric-key:ames marbud-pub comet-sec)
|
|
|
|
=/ marbud2-sym (derive-symmetric-key:ames marbud-pub comet2-sec)
|
|
|
|
=/ bud-marbud-sym (derive-symmetric-key:ames bud-pub marbud-sec)
|
2019-06-26 01:35:22 +03:00
|
|
|
::
|
2022-03-11 11:40:14 +03:00
|
|
|
=/ comet-sym (derive-symmetric-key:ames bud-pub comet-sec)
|
2020-12-01 17:51:14 +03:00
|
|
|
::
|
2019-08-14 00:30:15 +03:00
|
|
|
=. peers.ames-state.nec
|
|
|
|
%+ ~(put by peers.ames-state.nec) ~bud
|
2019-11-27 11:25:56 +03:00
|
|
|
=| =peer-state:ames
|
2019-06-26 02:27:50 +03:00
|
|
|
=. -.peer-state
|
2019-08-14 00:30:15 +03:00
|
|
|
:* symmetric-key=bud-sym
|
2019-06-26 02:27:50 +03:00
|
|
|
life=3
|
2022-03-11 11:40:14 +03:00
|
|
|
rift=0
|
2019-08-14 00:30:15 +03:00
|
|
|
public-key=bud-pub
|
|
|
|
sponsor=~nec
|
2019-06-26 02:27:50 +03:00
|
|
|
==
|
2019-11-27 11:25:56 +03:00
|
|
|
=. route.peer-state `[direct=%.y `lane:ames`[%& ~nec]]
|
2019-06-26 02:29:17 +03:00
|
|
|
[%known peer-state]
|
2019-06-26 01:35:22 +03:00
|
|
|
::
|
2022-02-01 02:32:05 +03:00
|
|
|
=. peers.ames-state.nec
|
|
|
|
%+ ~(put by peers.ames-state.nec) ~marbud
|
|
|
|
=| =peer-state:ames
|
|
|
|
=. -.peer-state
|
|
|
|
:* symmetric-key=nec-marbud-sym
|
|
|
|
life=5
|
2022-05-15 08:05:39 +03:00
|
|
|
rift=0
|
2022-02-01 02:32:05 +03:00
|
|
|
public-key=marbud-pub
|
|
|
|
sponsor=~bud
|
|
|
|
==
|
|
|
|
=. route.peer-state `[direct=%.y `lane:ames`[%| `@`%lane-bar]]
|
|
|
|
[%known peer-state]
|
|
|
|
::
|
2019-08-14 00:30:15 +03:00
|
|
|
=. peers.ames-state.bud
|
|
|
|
%+ ~(put by peers.ames-state.bud) ~nec
|
2019-11-27 11:25:56 +03:00
|
|
|
=| =peer-state:ames
|
2019-06-26 02:27:50 +03:00
|
|
|
=. -.peer-state
|
2019-08-14 00:30:15 +03:00
|
|
|
:* symmetric-key=nec-sym
|
2019-06-26 02:27:50 +03:00
|
|
|
life=2
|
2022-03-11 11:40:14 +03:00
|
|
|
rift=0
|
2019-08-14 00:30:15 +03:00
|
|
|
public-key=nec-pub
|
2019-06-26 02:27:50 +03:00
|
|
|
sponsor=~nec
|
|
|
|
==
|
2019-11-27 11:25:56 +03:00
|
|
|
=. route.peer-state `[direct=%.y `lane:ames`[%| `@`%lane-bar]]
|
2019-06-26 02:29:17 +03:00
|
|
|
[%known peer-state]
|
2022-02-01 02:32:05 +03:00
|
|
|
::
|
|
|
|
=. peers.ames-state.comet
|
|
|
|
%+ ~(put by peers.ames-state.comet) ~marbud
|
|
|
|
=| =peer-state:ames
|
|
|
|
=. -.peer-state
|
|
|
|
:* symmetric-key=marbud-sym
|
|
|
|
life=5
|
2022-05-15 08:05:39 +03:00
|
|
|
rift=0
|
2022-02-01 02:32:05 +03:00
|
|
|
public-key=marbud-pub
|
|
|
|
sponsor=~bud
|
|
|
|
==
|
|
|
|
=. route.peer-state `[direct=%.y `lane:ames`[%| `@`%lane-bar]]
|
|
|
|
[%known peer-state]
|
|
|
|
=. peers.ames-state.comet
|
|
|
|
%+ ~(put by peers.ames-state.comet) ~bud
|
|
|
|
=| =peer-state:ames
|
|
|
|
=. -.peer-state
|
|
|
|
:* symmetric-key=bud-marbud-sym
|
|
|
|
life=3
|
2022-05-15 08:05:39 +03:00
|
|
|
rift=0
|
2022-02-01 02:32:05 +03:00
|
|
|
public-key=bud-pub
|
|
|
|
sponsor=~bud
|
|
|
|
==
|
|
|
|
=. route.peer-state `[direct=%.y `lane:ames`[%| `@`%lane-bar]]
|
|
|
|
[%known peer-state]
|
|
|
|
=. peers.ames-state.comet2
|
|
|
|
%+ ~(put by peers.ames-state.comet2) ~marbud
|
|
|
|
=| =peer-state:ames
|
|
|
|
=. -.peer-state
|
|
|
|
:* symmetric-key=marbud2-sym
|
|
|
|
life=5
|
2022-05-15 08:05:39 +03:00
|
|
|
rift=0
|
2022-02-01 02:32:05 +03:00
|
|
|
public-key=marbud-pub
|
|
|
|
sponsor=~bud
|
|
|
|
==
|
|
|
|
=. route.peer-state `[direct=%.y `lane:ames`[%| `@`%lane-bar]]
|
|
|
|
[%known peer-state]
|
|
|
|
=. peers.ames-state.comet2
|
|
|
|
%+ ~(put by peers.ames-state.comet2) ~bud
|
|
|
|
=| =peer-state:ames
|
|
|
|
=. -.peer-state
|
|
|
|
:* symmetric-key=bud-marbud-sym
|
|
|
|
life=3
|
2022-05-15 08:05:39 +03:00
|
|
|
rift=0
|
2022-02-01 02:32:05 +03:00
|
|
|
public-key=bud-pub
|
|
|
|
sponsor=~bud
|
|
|
|
==
|
|
|
|
=. route.peer-state `[direct=%.y `lane:ames`[%| `@`%lane-bar]]
|
|
|
|
[%known peer-state]
|
2019-06-29 00:26:40 +03:00
|
|
|
:: metamorphose
|
2019-06-26 01:35:22 +03:00
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=> .(nec +:(call:(nec) ~[//unix] ~ %born ~))
|
|
|
|
=> .(bud +:(call:(bud) ~[//unix] ~ %born ~))
|
2022-02-01 02:32:05 +03:00
|
|
|
=> .(comet +:(call:(comet) ~[//unix] ~ %born ~))
|
|
|
|
=> .(comet2 +:(call:(comet2) ~[//unix] ~ %born ~))
|
2019-06-29 00:26:40 +03:00
|
|
|
:: helper core
|
2022-02-01 02:32:05 +03:00
|
|
|
::
|
2019-06-29 00:26:40 +03:00
|
|
|
=>
|
2019-06-21 04:36:16 +03:00
|
|
|
|%
|
|
|
|
++ move-to-packet
|
2019-11-27 11:25:56 +03:00
|
|
|
|= =move:ames
|
|
|
|
^- [=lane:ames =blob:ames]
|
2019-06-21 04:36:16 +03:00
|
|
|
::
|
|
|
|
?> ?=([%give %send *] +.move)
|
|
|
|
[lane blob]:+>+.move
|
|
|
|
::
|
|
|
|
++ is-move-send
|
2019-11-27 11:25:56 +03:00
|
|
|
|= =move:ames
|
2019-06-21 04:36:16 +03:00
|
|
|
^- ?
|
|
|
|
?=([%give %send *] card.move)
|
2019-06-26 01:26:52 +03:00
|
|
|
::
|
|
|
|
++ snag-packet
|
2019-11-27 11:25:56 +03:00
|
|
|
|= [index=@ud moves=(list move:ames)]
|
|
|
|
^- [=lane:ames =blob:ames]
|
2019-06-26 01:26:52 +03:00
|
|
|
::
|
|
|
|
%- move-to-packet
|
|
|
|
%+ snag index
|
|
|
|
(skim moves is-move-send)
|
2019-06-29 00:26:40 +03:00
|
|
|
::
|
|
|
|
++ call
|
2019-11-27 11:25:56 +03:00
|
|
|
|= [vane=_nec =duct =task:ames]
|
|
|
|
^- [moves=(list move:ames) _nec]
|
2019-06-29 00:26:40 +03:00
|
|
|
::
|
|
|
|
=/ vane-core (vane(now `@da`(add ~s1 now.vane)))
|
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
(call:vane-core duct ~ task)
|
2019-06-29 00:26:40 +03:00
|
|
|
::
|
|
|
|
++ take
|
2019-11-27 11:25:56 +03:00
|
|
|
|= [vane=_nec =wire =duct =sign:ames]
|
|
|
|
^- [moves=(list move:ames) _nec]
|
2019-06-29 00:26:40 +03:00
|
|
|
::
|
|
|
|
=/ vane-core (vane(now `@da`(add ~s1 now.vane)))
|
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
(take:vane-core wire duct ~ sign)
|
2019-06-21 04:36:16 +03:00
|
|
|
--
|
2019-06-29 00:26:40 +03:00
|
|
|
:: test core
|
|
|
|
::
|
2019-05-25 05:03:33 +03:00
|
|
|
|%
|
|
|
|
++ test-packet-encoding ^- tang
|
|
|
|
::
|
2019-11-27 11:25:56 +03:00
|
|
|
=/ =packet:ames
|
2019-08-14 00:30:15 +03:00
|
|
|
:* [sndr=~nec rcvr=~bud]
|
2020-12-01 17:51:14 +03:00
|
|
|
sndr-tick=0b10
|
|
|
|
rcvr-tick=0b11
|
2019-05-25 05:03:33 +03:00
|
|
|
origin=~
|
2020-12-01 17:51:14 +03:00
|
|
|
content=0xdead.beef
|
2019-05-25 05:03:33 +03:00
|
|
|
==
|
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=/ encoded (encode-packet:ames packet)
|
|
|
|
=/ decoded (decode-packet:ames encoded)
|
2019-05-25 05:03:33 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> packet
|
|
|
|
!> decoded
|
2019-05-28 06:39:42 +03:00
|
|
|
::
|
2020-12-01 17:51:14 +03:00
|
|
|
++ test-origin-encoding ^- tang
|
|
|
|
::
|
|
|
|
=/ =packet:ames
|
|
|
|
:* [sndr=~nec rcvr=~bud]
|
|
|
|
sndr-tick=0b10
|
|
|
|
rcvr-tick=0b11
|
|
|
|
origin=`0xbeef.cafe.beef
|
|
|
|
content=0xdead.beef
|
|
|
|
==
|
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=/ encoded (encode-packet:ames packet)
|
|
|
|
=/ decoded (decode-packet:ames encoded)
|
2020-12-01 17:51:14 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> packet
|
|
|
|
!> decoded
|
|
|
|
::
|
|
|
|
++ test-shut-packet-encoding ^- tang
|
|
|
|
::
|
|
|
|
=/ =shut-packet:ames
|
|
|
|
:+ bone=17 message-num=18
|
|
|
|
[%& num-fragments=1 fragment-num=1 fragment=`@`0xdead.beef]
|
|
|
|
::
|
|
|
|
=/ =packet:ames
|
|
|
|
(encode-shut-packet:ames shut-packet nec-sym ~marnec ~marbud-marbud 3 17)
|
|
|
|
::
|
|
|
|
=/ decoded (decode-shut-packet:ames packet nec-sym 3 17)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> shut-packet
|
|
|
|
!> decoded
|
|
|
|
::
|
|
|
|
++ test-shut-packet-associated-data ^- tang
|
|
|
|
::
|
|
|
|
=/ =shut-packet:ames
|
|
|
|
:+ bone=17 message-num=18
|
|
|
|
[%& num-fragments=1 fragment-num=1 fragment=`@`0xdead.beef]
|
|
|
|
::
|
|
|
|
=/ =packet:ames
|
|
|
|
(encode-shut-packet:ames shut-packet nec-sym ~marnec ~marbud-marbud 3 1)
|
|
|
|
::
|
|
|
|
%- expect-fail
|
|
|
|
|.((decode-shut-packet:ames packet nec-sym 3 17))
|
|
|
|
::
|
2019-05-28 06:39:42 +03:00
|
|
|
++ test-alien-encounter ^- tang
|
2019-06-26 04:34:43 +03:00
|
|
|
::
|
2019-11-27 11:25:56 +03:00
|
|
|
=/ lane-foo=lane:ames [%| `@ux``@`%lane-foo]
|
2019-05-28 06:39:42 +03:00
|
|
|
::
|
2019-07-29 14:05:52 +03:00
|
|
|
=/ =plea:ames [%g /talk [%first %post]]
|
2019-06-26 04:52:50 +03:00
|
|
|
::
|
2019-11-27 11:25:56 +03:00
|
|
|
=/ =shut-packet:ames
|
2020-12-01 17:51:14 +03:00
|
|
|
:* bone=1
|
2019-06-26 04:52:50 +03:00
|
|
|
message-num=1
|
2019-07-29 14:05:52 +03:00
|
|
|
[%& num-fragments=1 fragment-num=0 (jam plea)]
|
2019-06-26 04:52:50 +03:00
|
|
|
==
|
|
|
|
::
|
2019-11-27 11:25:56 +03:00
|
|
|
=/ =packet:ames
|
2020-12-06 11:38:37 +03:00
|
|
|
%: encode-shut-packet:ames
|
2020-12-01 17:51:14 +03:00
|
|
|
shut-packet
|
|
|
|
nec-sym
|
|
|
|
~bus
|
|
|
|
~bud
|
|
|
|
sndr-life=4
|
|
|
|
rcvr-life=3
|
2019-05-28 06:39:42 +03:00
|
|
|
==
|
2019-06-22 03:07:19 +03:00
|
|
|
::
|
2020-12-06 11:38:37 +03:00
|
|
|
=/ =blob:ames (encode-packet:ames packet)
|
2019-08-14 00:30:15 +03:00
|
|
|
=^ moves1 bud (call bud ~[//unix] %hear lane-foo blob)
|
|
|
|
=^ moves2 bud
|
2019-11-27 11:25:56 +03:00
|
|
|
=/ =point:ames
|
2022-03-11 11:40:14 +03:00
|
|
|
:* rift=0
|
2019-06-26 04:52:50 +03:00
|
|
|
life=4
|
2019-08-14 00:30:15 +03:00
|
|
|
keys=[[life=4 [crypto-suite=1 `@`nec-pub]] ~ ~]
|
2019-06-26 04:52:50 +03:00
|
|
|
sponsor=`~bus
|
|
|
|
==
|
|
|
|
%- take
|
2019-08-14 00:30:15 +03:00
|
|
|
:^ bud /public-keys ~[//unix]
|
2019-11-27 11:25:56 +03:00
|
|
|
^- sign:ames
|
2020-12-08 06:12:20 +03:00
|
|
|
[%jael %public-keys %full [n=[~bus point] ~ ~]]
|
2019-11-20 01:45:41 +03:00
|
|
|
=^ moves3 bud (call bud ~[//unix] %hear lane-foo blob)
|
2019-05-28 06:39:42 +03:00
|
|
|
::
|
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
2019-11-20 01:45:41 +03:00
|
|
|
!> [~[//unix] %pass /public-keys %j %public-keys [~bus ~ ~]]~
|
2019-06-26 04:34:43 +03:00
|
|
|
!> moves1
|
2019-05-28 06:39:42 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
2019-08-14 00:30:15 +03:00
|
|
|
!> %- sy
|
2022-03-11 11:40:14 +03:00
|
|
|
:~ :^ ~[//unix] %pass /bone/~bus/0/1
|
2019-08-14 00:30:15 +03:00
|
|
|
[%g %plea ~bus %g /talk [%first %post]]
|
|
|
|
::
|
|
|
|
:^ ~[//unix] %pass /qos
|
|
|
|
[%d %flog %text "; ~bus is your neighbor"]
|
|
|
|
==
|
2019-11-20 01:45:41 +03:00
|
|
|
!> (sy ,.moves3)
|
2019-05-28 06:39:42 +03:00
|
|
|
==
|
2019-06-11 23:22:24 +03:00
|
|
|
::
|
2019-06-26 02:39:10 +03:00
|
|
|
++ test-message-flow ^- tang
|
2019-08-14 00:30:15 +03:00
|
|
|
:: ~nec -> %plea -> ~bud
|
2019-06-11 23:22:24 +03:00
|
|
|
::
|
2019-08-14 00:30:15 +03:00
|
|
|
=^ 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
|
2019-06-21 00:52:44 +03:00
|
|
|
::
|
2022-03-11 11:40:14 +03:00
|
|
|
=^ moves3 bud (take bud /bone/~nec/0/1 ~[//unix] %g %done ~)
|
2019-08-14 00:30:15 +03:00
|
|
|
=^ moves4 nec (call nec ~[//unix] %hear (snag-packet 0 moves3))
|
|
|
|
:: ~bud -> %boon -> ~nec
|
2019-06-21 00:52:44 +03:00
|
|
|
::
|
2022-04-14 17:36:01 +03:00
|
|
|
=^ moves5 bud (take bud /bone/~nec/0/1 ~[//unix] %g %boon [%post 'first1'])
|
2019-08-14 00:30:15 +03:00
|
|
|
=^ 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))
|
2019-06-21 00:52:44 +03:00
|
|
|
::
|
2019-06-26 02:39:10 +03:00
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
2019-08-14 00:30:15 +03:00
|
|
|
!> :~ [~[//unix] %pass /qos %d %flog %text "; ~nec is your neighbor"]
|
2022-04-14 17:36:01 +03:00
|
|
|
:^ ~[//unix] %pass /bone/~nec/0/1
|
|
|
|
[%g %plea ~nec %g /talk [%get %post]]
|
2019-06-26 02:39:10 +03:00
|
|
|
==
|
2019-08-14 00:30:15 +03:00
|
|
|
!> moves2
|
2019-06-26 02:39:10 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
2019-08-14 00:30:15 +03:00
|
|
|
!> %- sy
|
2019-11-20 01:45:41 +03:00
|
|
|
:~ [~[/ames] %pass /pump/~bud/0 %b %rest ~1111.1.1..00.00.02]
|
|
|
|
[~[//unix] %pass /qos %d %flog %text "; ~bud is your neighbor"]
|
2019-08-14 00:30:15 +03:00
|
|
|
[~[/g/talk] %give %done error=~]
|
|
|
|
==
|
|
|
|
!> (sy ,.moves4)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
2022-04-14 17:36:01 +03:00
|
|
|
!> [~[/g/talk] %give %boon [%post 'first1']]
|
2019-12-18 06:20:32 +03:00
|
|
|
!> (snag 0 `(list move:ames)`moves6)
|
2019-06-26 02:39:10 +03:00
|
|
|
==
|
2019-06-21 04:36:16 +03:00
|
|
|
::
|
2022-02-01 02:32:05 +03:00
|
|
|
++ test-comet-message-flow ^- tang
|
|
|
|
:: same as test-message-flow, but ~nec will send a sendkeys packet to request
|
|
|
|
:: comet's self-attestation directly
|
|
|
|
::
|
|
|
|
=^ moves0 nec (call nec ~[/g/talk] %plea our-comet %g /talk [%get %post])
|
|
|
|
=^ moves1 comet (call comet ~[//unix] %hear (snag-packet 0 moves0))
|
|
|
|
=^ moves2 comet
|
|
|
|
=/ =point:ames
|
|
|
|
:* rift=1
|
|
|
|
life=2
|
|
|
|
keys=[[life=2 [crypto-suite=1 `@`nec-pub]] ~ ~]
|
|
|
|
sponsor=`~nec
|
|
|
|
==
|
|
|
|
%- take
|
|
|
|
:^ comet /public-keys ~[//unix]
|
|
|
|
^- sign:ames
|
|
|
|
[%jael %public-keys %full [n=[~nec point] ~ ~]]
|
|
|
|
:: give comet's self-attestation to ~nec; at this point, we have established
|
|
|
|
:: a channel, and can proceed as usual
|
|
|
|
::
|
|
|
|
=^ moves3 nec (call nec ~[//unix] %hear (snag-packet 0 moves2))
|
|
|
|
=^ moves4 comet (call comet ~[//unix] %hear (snag-packet 0 moves3))
|
2022-05-15 06:59:01 +03:00
|
|
|
=^ moves5 comet (take comet /bone/~nec/0/1 ~[//unix] %g %done ~)
|
2022-02-01 02:32:05 +03:00
|
|
|
=^ moves6 nec (call nec ~[//unix] %hear (snag-packet 0 moves5))
|
2022-05-15 06:59:01 +03:00
|
|
|
=^ moves7 comet (take comet /bone/~nec/0/1 ~[//unix] %g %boon [%post 'first1!!'])
|
2022-02-01 02:32:05 +03:00
|
|
|
=^ moves8 nec (call nec ~[//unix] %hear (snag-packet 0 moves7))
|
|
|
|
::
|
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
|
|
|
!> [~[//unix] %pass /qos %d %flog %text "; ~nec is your neighbor"]
|
|
|
|
!> (snag 0 `(list move:ames)`moves4)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> [~[//unix] %pass /qos %d %flog %text "; {<our-comet>} is your neighbor"]
|
|
|
|
!> (snag 0 `(list move:ames)`moves6)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> [~[/g/talk] %give %boon [%post 'first1!!']]
|
|
|
|
!> (snag 0 `(list move:ames)`moves8)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ test-comet-comet-message-flow ^- tang
|
|
|
|
:: same as test-message-flow, but the comets need to exchange
|
|
|
|
:: self-attestations to establish a channel
|
|
|
|
::
|
|
|
|
=^ moves0 comet (call comet ~[/g/talk] %plea our-comet2 %g /talk [%get %post])
|
|
|
|
=^ moves1 comet2 (call comet2 ~[//unix] %hear (snag-packet 0 moves0))
|
|
|
|
=^ moves2 comet (call comet ~[//unix] %hear (snag-packet 0 moves1))
|
|
|
|
:: channel is now established; comet also emitted a duplicate
|
|
|
|
:: self-attestation, which we ignore
|
|
|
|
::
|
2022-05-21 04:28:20 +03:00
|
|
|
=^ moves3 comet2 (call comet2 ~[//unix] %hear (snag-packet 0 moves2))
|
|
|
|
=^ moves4 comet2 (call comet2 ~[//unix] %hear (snag-packet 1 moves2))
|
|
|
|
=^ moves5 comet2 (take comet2 /bone/(scot %p our-comet)/0/1 ~[//unix] %g %done ~)
|
2022-05-15 06:59:01 +03:00
|
|
|
=^ moves6 comet2 (take comet2 /bone/(scot %p our-comet)/0/1 ~[//unix] %g %boon [%post 'first1!!'])
|
2022-05-21 04:28:20 +03:00
|
|
|
=^ moves7 comet (call comet ~[//unix] %hear (snag-packet 0 moves5))
|
|
|
|
=^ moves8 comet (call comet ~[//unix] %hear (snag-packet 0 moves6))
|
2022-02-01 02:32:05 +03:00
|
|
|
::
|
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
|
|
|
!> [~[//unix] %pass /qos %d %flog %text "; {<our-comet>} is your neighbor"]
|
2022-05-21 04:28:20 +03:00
|
|
|
!> (snag 0 `(list move:ames)`moves4)
|
2022-02-01 02:32:05 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> [~[//unix] %pass /qos %d %flog %text "; {<our-comet2>} is your neighbor"]
|
2022-05-21 04:28:20 +03:00
|
|
|
!> (snag 0 `(list move:ames)`moves7)
|
2022-02-01 02:32:05 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> [~[/g/talk] %give %boon [%post 'first1!!']]
|
2022-05-21 04:28:20 +03:00
|
|
|
!> (snag 0 `(list move:ames)`moves8)
|
2022-02-01 02:32:05 +03:00
|
|
|
==
|
|
|
|
::
|
2019-06-21 04:36:16 +03:00
|
|
|
++ test-nack ^- tang
|
2019-08-14 00:30:15 +03:00
|
|
|
:: ~nec -> %plea -> ~bud
|
|
|
|
::
|
|
|
|
=^ moves1 nec (call nec ~[/g/talk] %plea ~bud %g /talk [%get %post])
|
|
|
|
=^ moves2 bud (call bud ~[//unix] %hear (snag-packet 0 moves1))
|
|
|
|
:: ~bud -> nack -> ~nec
|
|
|
|
::
|
2019-11-27 11:25:56 +03:00
|
|
|
=/ =error:ames [%flub [%leaf "sinusoidal repleneration"]~]
|
2022-03-11 11:40:14 +03:00
|
|
|
=^ moves3 bud (take bud /bone/~nec/0/1 ~[/bud] %g %done `error)
|
2019-08-14 00:30:15 +03:00
|
|
|
=^ 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
|
2019-06-21 04:36:16 +03:00
|
|
|
::
|
2019-08-14 00:30:15 +03:00
|
|
|
=^ moves6 bud (call bud ~[//unix] %hear (snag-packet 0 moves5))
|
2019-06-21 04:36:16 +03:00
|
|
|
::
|
2019-06-26 02:58:42 +03:00
|
|
|
%+ expect-eq
|
2019-08-14 00:30:15 +03:00
|
|
|
!> [~[/g/talk] %give %done `error]
|
2019-11-27 11:25:56 +03:00
|
|
|
!> (snag 1 `(list move:ames)`moves5)
|
2022-03-11 11:40:14 +03:00
|
|
|
::
|
|
|
|
++ test-old-ames-wire ^- tang
|
2022-04-14 17:36:01 +03:00
|
|
|
=^ moves0 bud (call bud ~[/g/hood] %spew [%odd]~)
|
|
|
|
=^ moves1 nec (call nec ~[/g/talk] %plea ~bud %g /talk [%get %post])
|
|
|
|
=^ moves2 bud (call bud ~[//unix] %hear (snag-packet 0 moves1))
|
|
|
|
=^ moves3 bud (take bud /bone/~nec/1 ~[//unix] %g %done ~)
|
2022-03-11 11:40:14 +03:00
|
|
|
%+ expect-eq
|
2022-04-22 11:06:53 +03:00
|
|
|
!> 1
|
|
|
|
!> (lent `(list move:ames)`moves3)
|
2022-04-14 17:36:01 +03:00
|
|
|
::
|
2022-03-11 11:40:14 +03:00
|
|
|
++ test-dangling-bone ^- tang
|
2022-04-14 17:36:01 +03:00
|
|
|
=^ moves0 bud (call bud ~[/g/hood] %spew [%odd]~)
|
2022-03-11 11:40:14 +03:00
|
|
|
:: ~nec -> %plea -> ~bud
|
|
|
|
::
|
|
|
|
=^ moves1 nec (call nec ~[/g/talk] %plea ~bud %g /talk [%get %post])
|
|
|
|
=^ moves2 bud (call bud ~[//unix] %hear (snag-packet 0 moves1))
|
|
|
|
:: ~bud receives a gift from %jael with ~nec's new rift
|
|
|
|
::
|
|
|
|
=^ moves3 bud
|
|
|
|
%- take
|
|
|
|
:^ bud /public-keys ~[//unix]
|
|
|
|
^- sign:ames
|
|
|
|
[%jael %public-keys %diff who=~nec %rift from=0 to=1]
|
|
|
|
:: %gall has a pending wire with the old rift, so sending a gift to
|
2022-04-22 11:06:53 +03:00
|
|
|
:: %ames on it will drop that request, not producing any moves
|
2022-03-11 11:40:14 +03:00
|
|
|
::
|
|
|
|
=^ moves3 bud (take bud /bone/~nec/0/1 ~[//unix] %g %done ~)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
2022-04-22 11:06:53 +03:00
|
|
|
!> ~
|
2022-03-11 11:40:14 +03:00
|
|
|
!> (sy ,.moves3)
|
|
|
|
::
|
|
|
|
++ test-ames-flow-with-new-rift ^- tang
|
2022-04-14 17:36:01 +03:00
|
|
|
:: ~nec receives a gift from %jael with ~bud's new rift
|
2022-03-11 11:40:14 +03:00
|
|
|
::
|
|
|
|
=^ moves1 nec
|
|
|
|
%- take
|
|
|
|
:^ nec /public-keys ~[//unix]
|
|
|
|
^- sign:ames
|
|
|
|
[%jael %public-keys %diff who=~bud %rift from=0 to=1]
|
|
|
|
:: now we try a normal message flow using the new rift in the wire
|
|
|
|
:: ~nec -> %plea -> ~bud
|
|
|
|
::
|
|
|
|
=^ moves2 nec (call nec ~[/g/talk] %plea ~bud %g /talk [%get %post])
|
|
|
|
=^ moves3 bud (call bud ~[//unix] %hear (snag-packet 0 moves2))
|
|
|
|
:: ~bud -> %done -> ~nec
|
|
|
|
::
|
|
|
|
=^ moves4 bud (take bud /bone/~nec/1/1 ~[//unix] %g %done ~)
|
|
|
|
=^ moves5 nec (call nec ~[//unix] %hear (snag-packet 0 moves4))
|
|
|
|
:: ~bud -> %boon -> ~nec
|
|
|
|
::
|
|
|
|
=^ moves6 bud (take bud /bone/~nec/1/1 ~[//unix] %g %boon [%post '¡hola!'])
|
|
|
|
=^ moves7 nec (call nec ~[//unix] %hear (snag-packet 0 moves6))
|
|
|
|
:: ~nec -> %done -> ~bud (just make sure ~bud doesn't crash on ack)
|
|
|
|
::
|
|
|
|
=^ moves8 bud (call bud ~[//unix] %hear (snag-packet 0 moves7))
|
|
|
|
::
|
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
|
|
|
!> :~ [~[//unix] %pass /qos %d %flog %text "; ~nec is your neighbor"]
|
2022-04-14 17:36:01 +03:00
|
|
|
:^ ~[//unix] %pass /bone/~nec/0/1
|
|
|
|
[%g %plea ~nec %g /talk [%get %post]]
|
2022-03-11 11:40:14 +03:00
|
|
|
==
|
|
|
|
!> moves3
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> %- sy
|
|
|
|
:~ [~[/ames] %pass /pump/~bud/0 %b %rest ~1111.1.1..00.00.03]
|
|
|
|
[~[//unix] %pass /qos %d %flog %text "; ~bud is your neighbor"]
|
|
|
|
[~[/g/talk] %give %done error=~]
|
|
|
|
==
|
|
|
|
!> (sy ,.moves5)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
!> [~[/g/talk] %give %boon [%post '¡hola!']]
|
|
|
|
!> (snag 0 `(list move:ames)`moves7)
|
|
|
|
==
|
2019-05-25 05:03:33 +03:00
|
|
|
--
|