From 81bfe17f37763c7a0e6b0db496986d5c2a298bbc Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 12 Aug 2022 00:04:01 +0300 Subject: [PATCH] tests: WIP gall request queue tests --- pkg/arvo/lib/vane-test.hoon | 1 + pkg/arvo/tests/sys/grq.hoon | 16 ++++++++ pkg/base-dev/lib/vane-test.hoon | 65 +++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 120000 pkg/arvo/lib/vane-test.hoon create mode 100644 pkg/arvo/tests/sys/grq.hoon create mode 100644 pkg/base-dev/lib/vane-test.hoon diff --git a/pkg/arvo/lib/vane-test.hoon b/pkg/arvo/lib/vane-test.hoon new file mode 120000 index 0000000000..4fa05d3f70 --- /dev/null +++ b/pkg/arvo/lib/vane-test.hoon @@ -0,0 +1 @@ +/Users/ted/urbit/pkg/base-dev/lib/vane-test.hoon \ No newline at end of file diff --git a/pkg/arvo/tests/sys/grq.hoon b/pkg/arvo/tests/sys/grq.hoon new file mode 100644 index 0000000000..f0054cd546 --- /dev/null +++ b/pkg/arvo/tests/sys/grq.hoon @@ -0,0 +1,16 @@ +:: test gall request queue fix, which implicates ames and gall +:: +/+ *test, vane-test +|% +++ test-nec-bud + =+ ames-nec-bud:vane-test + ;: weld + %+ expect-eq + !> nec + !> nec + :: + %+ expect-eq + !> bud + !> bud + == +-- diff --git a/pkg/base-dev/lib/vane-test.hoon b/pkg/base-dev/lib/vane-test.hoon new file mode 100644 index 0000000000..7a1e9842d2 --- /dev/null +++ b/pkg/base-dev/lib/vane-test.hoon @@ -0,0 +1,65 @@ +/+ *test +/= ames /sys/vane/ames +/= jael /sys/vane/jael +:: +|% +++ ames-nec-bud + :: create ~nec + :: + =/ nec (ames ~nec) + =. now.nec ~1111.1.1 + =. eny.nec 0xdead.beef + =. life.ames-state.nec 2 + =. rof.nec |=(* ``[%noun !>(*(list turf))]) + =. 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 + :: create ~bud + :: + =/ bud (ames ~bud) + =. now.bud ~1111.1.1 + =. eny.bud 0xbeef.dead + =. life.ames-state.bud 3 + =. rof.bud |=(* ``[%noun !>(*(list turf))]) + =. crypto-core.ames-state.bud (pit:nu:crub:crypto 512 (shaz 'bud')) + =/ bud-pub pub:ex:crypto-core.ames-state.bud + =/ bud-sec sec:ex:crypto-core.ames-state.bud + :: + =/ nec-sym (derive-symmetric-key:ames bud-pub nec-sec) + =/ bud-sym (derive-symmetric-key:ames nec-pub bud-sec) + ?> =(nec-sym bud-sym) + :: tell ~nec about ~bud + :: + =. peers.ames-state.nec + %+ ~(put by peers.ames-state.nec) ~bud + =| =peer-state:ames + =. -.peer-state + :* symmetric-key=bud-sym + life=3 + rift=0 + public-key=bud-pub + sponsor=~nec + == + =. route.peer-state `[direct=%.y `lane:ames`[%& ~nec]] + [%known peer-state] + :: tell ~bud about ~nec + :: + =. peers.ames-state.bud + %+ ~(put by peers.ames-state.bud) ~nec + =| =peer-state:ames + =. -.peer-state + :* symmetric-key=nec-sym + life=2 + rift=0 + public-key=nec-pub + sponsor=~nec + == + =. route.peer-state `[direct=%.y `lane:ames`[%| `@`%lane-bar]] + [%known peer-state] + :: metamorphose + :: + => .(nec +:(call:(nec) ~[//unix] ~ %born ~)) + => .(bud +:(call:(bud) ~[//unix] ~ %born ~)) + :: + [nec=nec bud=bud] +--