Merge remote-tracking branch 'origin/philip/naive' into naive/roller

This commit is contained in:
yosoyubik 2021-10-31 15:14:15 +01:00
commit 27576e272b
5 changed files with 28 additions and 117 deletions

View File

@ -64,14 +64,16 @@
contract=@ux
chain-id=@
==
:: orp: ordered points in naive state by parent ship
::
++ orp ((on ship point:naive) por:naive)
:: ors: ordered sending map by (increasing) L1 nonce
::
++ ors ((on l1-tx-pointer send-tx) nonce-order:dice)
++ orh ((on time roll-tx) gth)
+$ ini [nas=^state:naive own=owners]
+$ net ?(%mainnet %ropsten %local)
:: orh: ordered tx history by (decreasing) timestamp
::
+$ l2-status
?(%confirmed %failed [=time =address:ethereum])
++ orh ((on time roll-tx) gth)
+$ net ?(%mainnet %ropsten %local)
::
+$ config
$% [%frequency frequency=@dr]
@ -264,7 +266,7 @@
:+ ~ ~
:- %noun
!> ^- (unit @)
?~ point=(get:orm:naive points.pre u.who)
?~ point=(get:orp points.pre u.who)
~
=/ nonce=@
=< nonce
@ -282,11 +284,10 @@
?~ star=(slaw %p wat) ~
=; range
(turn range head)
=, orm:naive
:: range exclusive [star first-moon-last-planet]
::
%- tap
(lot points.pre [`u.star `(cat 3 u.star 0x1.ffff)])
%- tap:orp
(lot:orp points.pre [`u.star `(cat 3 u.star 0x1.ffff)])
::
++ unspawned
|= wat=@t
@ -297,9 +298,8 @@
=/ spawned=(set @p)
=; points
(~(gas in *(set @p)) (turn points head))
=, orm:naive
%- tap
(lot points.pre [`u.star `(cat 3 u.star 0x1.ffff)])
%- tap:orp
(lot:orp points.pre [`u.star `(cat 3 u.star 0x1.ffff)])
=/ children=(list @p)
(turn (gulf 0x1 0xffff) |=(a=@ (cat 3 u.star a)))
%+ murn children
@ -311,7 +311,7 @@
|= wat=@t
?~ ship=(rush wat ;~(pfix sig fed:ag))
``noun+!>(*(unit point:naive))
``noun+!>((get:orm:naive points.pre u.ship))
``noun+!>((get:orp points.pre u.ship))
::
++ ships
|= wat=@t
@ -404,7 +404,7 @@
%+ roll ~(tap in (~(get ju own) [proxy u.addr]))
|= [=ship points=_points]
%+ snoc points
[ship (need (get:orm:naive points.pre ship))]
[ship (need (get:orp points.pre ship))]
::
++ give-txs
|= wat=@t
@ -492,7 +492,8 @@
~& > %received-azimuth-state
:: cache naive and ownership state
::
=^ nas own.state !<(ini q.cage.sign)
=^ nas own.state
!<([^state:naive owners] q.cage.sign)
=^ effects state
(predicted-state:do nas)
[(emit effects) this]
@ -760,7 +761,7 @@
++ get-l1-address
|= [=tx:naive nas=^state:naive]
^- (unit address:ethereum)
?~ point=(get:orm:naive points.nas ship.from.tx) ~
?~ point=(get:orp points.nas ship.from.tx) ~
=< `address
(proxy-from-point:naive proxy.from.tx u.point)
::

View File

@ -366,11 +366,13 @@
^- json
|^
%- pairs
:~ ['points' (points (tap:orm:naive points.state))]
:~ ['points' (points (tap:orp points.state))]
['operators' (operators operators.state)]
['dns' a+(turn dns.state (lead %s))]
==
::
++ orp ((on ^ship point:naive) por:naive)
::
++ operators
|= =operators:naive
^- json

View File

@ -1,4 +1,5 @@
/+ tiny
!.
=> => tiny
:: Laconic bit
::
@ -147,7 +148,8 @@
== == ==
::
+$ state
$: =points
$: %0
=points
=operators
dns=(list @t)
==
@ -246,7 +248,7 @@
`[[[from-ship proxy] skim-tx.u.res] pos.u.res]
^- res=(unit [=skim-tx pos=@ud])
=^ op pos (take 0 7)
?+ op ~>(%slog.[0 %strange-opcode] ~)
?+ op (debug %strange-opcode ~)
%0
=^ reset=@ pos (take 0)
=^ =address pos (take 3 20)
@ -419,7 +421,7 @@
`u.existing
=| =point
=. who.sponsor.net.point (sein ship)
?+ (ship-rank ship) ~>(%slog.[0 %strange-point] ~)
?+ (ship-rank ship) (debug %strange-point ~)
%0 `point(dominion %l1)
?(%1 %2)
=/ existing-parent $(ship (sein ship))
@ -454,7 +456,7 @@
=* one &5.words
=* two &3.words
=* tri &1.words
=/ domains (turn ~[one two tri] |=(a=@ (swp 3 a)))
=/ domains ~[(swp 3 one) (swp 3 two) (swp 3 tri)]
:- [%dns domains]~
state(dns domains)
::
@ -595,8 +597,7 @@
:+ ~ [%point ship %voting-proxy to]~
point(address.voting-proxy.own to)
::
~> %slog.[0 %unknown-log]
~
(debug %unknown-log ~)
::
:: Receive batch of L2 transactions
::

View File

@ -30,10 +30,6 @@
::
++ jug |$ [key value] (map key (set value))
::
:: Biblical
::
++ ruth |=([a=* b=*] ?>(?=(@ b) b))
::
:: Bits
::
++ dec :: decrement
@ -311,23 +307,6 @@
+<-(+ $(+<- +<->))
--
::
++ turn :: transform
~/ %turn
|* [a=(list) b=$-(* *)]
=> .(a (homo a))
^- (list _?>(?=(^ a) (b i.a)))
|-
?~ a ~
[i=(b i.a) t=$(a t.a)]
::
++ levy :: all of
~/ %levy
|* [a=(list) b=$-(* ?)]
|- ^- ?
?~ a &
?. (b i.a) |
$(a t.a)
::
++ reap :: replicate
~/ %reap
|* [a=@ b=*]
@ -493,11 +472,6 @@
$(a l.a)
$(a r.a)
::
++ has
~/ %has
|* b=*
!=(~ (get b))
::
++ put
~/ %put
|* [b=* c=*]
@ -576,13 +550,6 @@
?~(r.a %.y &((mor key.n.a key.n.r.a) $(a r.a, r `key.n.a)))
==
::
++ gas
~/ %gas
|= [a=(tree item) b=(list item)]
^- (tree item)
?~ b a
$(b t.b, a (put a i.b))
::
++ get
~/ %get
|= [a=(tree item) b=key]
@ -600,58 +567,6 @@
^- ?
!=(~ (get a b))
::
++ lot
~/ %lot
|= $: tre=(tree item)
start=(unit key)
end=(unit key)
==
^- (tree item)
|^
?: ?&(?=(~ start) ?=(~ end))
tre
?~ start
(del-span tre %end end)
?~ end
(del-span tre %start start)
?> (compare u.start u.end)
=. tre (del-span tre %start start)
(del-span tre %end end)
::
++ del-span
|= [a=(tree item) b=?(%start %end) c=(unit key)]
^- (tree item)
?~ a a
?~ c a
?- b
%start
?: =(key.n.a u.c)
(nip a(l ~))
?: (compare key.n.a u.c)
$(a (nip a(l ~)))
a(l $(a l.a))
::
%end
?: =(u.c key.n.a)
(nip a(r ~))
?: (compare key.n.a u.c)
a(r $(a r.a))
$(a (nip a(r ~)))
==
--
::
++ nip
~/ %nip
|= a=(tree item)
^- (tree item)
?> ?=(^ a)
|- ^- (tree item)
?~ l.a r.a
?~ r.a l.a
?: (mor key.n.l.a key.n.r.a)
l.a(r $(l.a r.l.a))
r.a(l $(r.a l.r.a))
::
++ put
~/ %put
|= [a=(tree item) =key =val]
@ -669,15 +584,6 @@
?: (mor key.n.a key.n.r)
a(r r)
r(l a(r l.r))
::
++ tap
~/ %tap
|= a=(tree item)
^- (list item)
=| b=(list item)
|- ^+ b
?~ a b
$(a l.a, b [n.a $(a r.a)])
--
::
:: Sets

View File

@ -2326,6 +2326,7 @@
%+ expect-eq
!>
:- [%point ~bud %owner (addr %bud-key-0)]~
:- %0
:_ [~ ~] :_ [~ ~]
:- ~bud
%* . *point:naive