jael: give private key to subscribers on keys diff

Triggering this event has been added to /app/azimuth's +on-load
This commit is contained in:
yosoyubik 2022-01-08 09:48:28 +01:00
parent 583d5f5063
commit 8535563de6
3 changed files with 47 additions and 22 deletions

View File

@ -21,7 +21,7 @@
=, jael =, jael
|% |%
+$ app-state +$ app-state
$: %3 $: %4
url=@ta url=@ta
=net =net
whos=(set ship) whos=(set ship)
@ -100,32 +100,41 @@
=^ cards-2 old-state =^ cards-2 old-state
?. ?=(%2 -.old-state) ?. ?=(%2 -.old-state)
`old-state `old-state
~& > '%azimuth: updating to state 3'
=. +.state +.old-state
:: replace naive state and indices with snapshot :: replace naive state and indices with snapshot
:: ::
=: nas.old-state nas.snap =: nas.state nas.snap
own.old-state owners.snap own.state owners.snap
spo.old-state sponsors.snap spo.state sponsors.snap
logs.old-state ~ logs.state ~
:: TODO: shouldn't be needed but have seen eth-watcher
:: threads use a url='' if this is not used
::
url.state 'http://eth-mainnet.urbit.org:8545'
== ==
=/ points=@ud ~(wyt by points.nas.old-state) =/ points=@ud ~(wyt by points.nas.state)
%- %- slog :_ ~ %- %- slog :_ ~
:- %leaf leaf+"ship: processing azimuth snapshot ({<points>} points)"
"ship: processing azimuth snapshot ({<points>} points)" =/ snap-cards=udiffs:point (run-state:do id.snap points.nas.state)
=/ snap-cards=udiffs:point (run-state:do id.snap points.nas.old-state) :_ [%3 +.state]
:_ [%3 +.old-state] %+ weld
;: welp
cards-1
(jael-update:do snap-cards) (jael-update:do snap-cards)
:: start getting new logs after the last id:block in the snapshot :: start getting new logs after the last id:block in the snapshot
:: ::
start:do start:do
== =^ cards-3 old-state
?> ?=(%3 -.old-state) ?. ?=(%3 -.old-state) [cards-2 old-state]
[cards-2 this(state old-state)] :_ old-state(- %4)
~& > '%azimuth: updating to state 4'
[%pass /resend-pk %arvo %j %resend ~]^cards-2
?> ?=(%4 -.old-state)
[cards-3 this(state old-state)]
:: ::
++ app-states $%(state-0 state-1-2 app-state) ++ app-states $%(state-0 state-1-2-3 app-state)
+$ state-1-2 ::
$: ?(%1 %2) +$ state-1-2-3
$: ?(%1 %2 %3)
url=@ta url=@ta
=net =net
whos=(set ship) whos=(set ship)
@ -257,6 +266,12 @@
%history (welp logs.state loglist.diff) %history (welp logs.state loglist.diff)
%logs (welp logs.state loglist.diff) %logs (welp logs.state loglist.diff)
== ==
:: doing :azimuth|watch caused a l2-sig-fail when using the eth-log
:: snapshot because we were not updating nas with the saved logs.
::
:: now (L: 189) nas.state is loaded with the contents of the snapshot,
:: if we are on the %default network.
::
=^ effects state (run-logs:do loglist.diff) =^ effects state (run-logs:do loglist.diff)
:_ this :_ this
%+ weld %+ weld

View File

@ -1906,6 +1906,7 @@
[%private-keys ~] :: sub to privates [%private-keys ~] :: sub to privates
[%public-keys ships=(set ship)] :: sub to publics [%public-keys ships=(set ship)] :: sub to publics
[%rekey =life =ring] :: update private keys [%rekey =life =ring] :: update private keys
[%resend ~] :: resend private key
[%ruin ships=(set ship)] :: pretend breach [%ruin ships=(set ship)] :: pretend breach
$>(%trim vane-task) :: trim state $>(%trim vane-task) :: trim state
[%turf ~] :: view domains [%turf ~] :: view domains

View File

@ -427,6 +427,13 @@
%- curd =< abet %- curd =< abet
(private-keys:~(feel su hen now pki etn) life.tac ring.tac) (private-keys:~(feel su hen now pki etn) life.tac ring.tac)
:: ::
:: resend private key to subscribers
::
%resend
%- curd =< abet
%- ~(exec su hen now pki etn)
[yen.own.pki [%give %private-keys [lyf jaw]:own.pki]]
::
:: register moon keys :: register moon keys
:: ::
%moon %moon
@ -740,7 +747,9 @@
?=(%keys -.u.a-diff) ?=(%keys -.u.a-diff)
(~(has by jaw.own) life.to.u.a-diff) (~(has by jaw.own) life.to.u.a-diff)
== ==
life.to.u.a-diff =* lyf life.to.u.a-diff
=. moz [[hen %give %private-keys lyf jaw:own] moz]
lyf
(public-keys:feel original-pos %diff ship.i.udiffs u.a-diff) (public-keys:feel original-pos %diff ship.i.udiffs u.a-diff)
$(udiffs t.udiffs) $(udiffs t.udiffs)
:: ::