mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-01 11:33:41 +03:00
clean and add tests
This commit is contained in:
parent
6660d697ec
commit
0db24cf208
@ -77,7 +77,7 @@
|
||||
turf=(list turf) :: domains
|
||||
bloq=@ud :: block number
|
||||
node=(unit purl:eyre) :: gateway url
|
||||
snap=(unit snapshot:able:jael) :: head start
|
||||
snap=(unit snapshot:jael) :: head start
|
||||
== ::
|
||||
[%fake our=ship] :: boot fake
|
||||
:: XX wegh ::
|
||||
|
@ -2035,11 +2035,6 @@
|
||||
{$vine p/(list change)} :: all raw changes
|
||||
[%vent p=chain] :: ethereum changes
|
||||
== ::
|
||||
++ node-src :: ethereum node comms
|
||||
$: node=purl:eyre :: node url
|
||||
filter-id=@ud :: current filter
|
||||
poll-timer=@da :: next filter poll
|
||||
== ::
|
||||
:: ::
|
||||
++ note :: out request $->
|
||||
=, eyre ::
|
||||
@ -2079,22 +2074,6 @@
|
||||
[%j %vent p=chain] :: ethereum changes
|
||||
[%a %woot p=ship q=coop] :: message result
|
||||
== ::
|
||||
++ snapshot :: rewind point
|
||||
=, constitution:ethe ::
|
||||
$: eve=logs :: eth absolute state
|
||||
kyz=(map ship public) :: public key state
|
||||
$= eth ::
|
||||
$: dns=dnses :: on-chain dns state
|
||||
hul=(map ship hull) :: on-chain ship state
|
||||
== ::
|
||||
etn=state-eth-node :: eth connection state
|
||||
== ::
|
||||
++ state-eth-node :: node config + meta
|
||||
$: source=(each ship node-src) :: learning from
|
||||
heard=(set event-id:ethe) :: processed events
|
||||
latest-block=@ud :: last heard block
|
||||
foreign-block=@ud :: node's latest block
|
||||
== ::
|
||||
++ tally :: balance update
|
||||
%+ each balance :: complete
|
||||
action :: change
|
||||
@ -2127,7 +2106,31 @@
|
||||
[%west p=sack q=path r=*] :: remote request
|
||||
[%wind our=ship p=@ud] :: rewind before block
|
||||
== ::
|
||||
--
|
||||
-- ::
|
||||
:: ::
|
||||
:::: ::
|
||||
:: ::
|
||||
++ node-src :: ethereum node comms
|
||||
$: node=purl:eyre :: node url
|
||||
filter-id=@ud :: current filter
|
||||
poll-timer=@da :: next filter poll
|
||||
== ::
|
||||
++ snapshot :: rewind point
|
||||
=, constitution:ethe ::
|
||||
$: eve=logs:able :: eth absolute state
|
||||
kyz=(map ship public:able) :: public key state
|
||||
$= eth ::
|
||||
$: dns=dnses :: on-chain dns state
|
||||
hul=(map ship hull) :: on-chain ship state
|
||||
== ::
|
||||
etn=state-eth-node :: eth connection state
|
||||
== ::
|
||||
++ state-eth-node :: node config + meta
|
||||
$: source=(each ship node-src) :: learning from
|
||||
heard=(set event-id:ethe) :: processed events
|
||||
latest-block=@ud :: last heard block
|
||||
foreign-block=@ud :: node's latest block
|
||||
== ::
|
||||
:: ::
|
||||
:::: ++pki:jael :: (1h2) certificates
|
||||
:: ::::
|
||||
@ -8166,13 +8169,13 @@
|
||||
:: +bloq:snap:dawn: extract block number
|
||||
::
|
||||
++ bloq
|
||||
|= snap=snapshot:able:jael
|
||||
|= snap=snapshot:jael
|
||||
^- @ud
|
||||
latest-block.etn.snap
|
||||
:: +czar:snap:dawn: extract galaxy table
|
||||
::
|
||||
++ czar
|
||||
|= snap=snapshot:able:jael
|
||||
|= snap=snapshot:jael
|
||||
^- (map ship [=life =pass])
|
||||
%- malt
|
||||
%+ turn (gulf 0 255)
|
||||
@ -8184,7 +8187,7 @@
|
||||
:: +hull:snap:dawn: extract ship's contract state
|
||||
::
|
||||
++ hull
|
||||
|= [who=ship snap=snapshot:able:jael]
|
||||
|= [who=ship snap=snapshot:jael]
|
||||
^- hull:constitution:ethe
|
||||
=/ res (~(get by hul.eth.snap) who)
|
||||
?~ res
|
||||
@ -8194,7 +8197,7 @@
|
||||
:: +turf:snap:dawn: extract network domains
|
||||
::
|
||||
++ turf
|
||||
|= snap=snapshot:able:jael
|
||||
|= snap=snapshot:jael
|
||||
^- (list ^turf)
|
||||
%+ murn
|
||||
^- (list (pair))
|
||||
@ -8203,7 +8206,7 @@
|
||||
~[pri sec ter]:dns.eth.snap
|
||||
|= dom=@t
|
||||
^- (unit (pair))
|
||||
(rush pri.dns.eth.snap thos:de-purl:html)
|
||||
(rush dom thos:de-purl:html)
|
||||
|=([* a=*] ((soft ^turf) a))
|
||||
--
|
||||
:: +veri:dawn: validate keys, life, discontinuity, &c
|
||||
|
@ -17,7 +17,7 @@
|
||||
-8~kX.3ALiG.rQjOi.HZ9hj.84b6G.P5pCZ.UtNtt.Lh9TE.2DQJ2
|
||||
=/ url (de-purl:html 'http://localhost:8545')
|
||||
=/ dan
|
||||
[`seed:able:jael`[~nul 1 key ~] ~ ~ [/org/urbit ~] 0 url]
|
||||
[`seed:able:jael`[~nul 1 key ~] ~ ~ [/org/urbit ~] 0 url ~]
|
||||
::
|
||||
=^ results1 jael-gate
|
||||
=/ hen=duct
|
||||
|
@ -28,6 +28,21 @@
|
||||
%- crip
|
||||
%+ weld "0x"
|
||||
(render-hex-bytes:ethereum 20 `@`ships:contracts:constitution:ethe)
|
||||
:: snapshot
|
||||
::
|
||||
++ snap
|
||||
^- snapshot:jael
|
||||
:* *logs:able:jael
|
||||
~
|
||||
:* ['urbit.org' 'urbit.org' '']
|
||||
%- malt
|
||||
:* ~zod^hul
|
||||
~marzod^hul
|
||||
(turn (gulf 1 255) |=(gal=@ gal^hul))
|
||||
==
|
||||
==
|
||||
%*(. *state-eth-node:jael latest-block 4.230.000)
|
||||
==
|
||||
::
|
||||
++ test-give-bloq
|
||||
=/ oct
|
||||
@ -167,6 +182,26 @@
|
||||
!> [/org/urbit ~]
|
||||
!> (turf:take:dawn oct)
|
||||
::
|
||||
++ test-snap-bloq
|
||||
%+ expect-eq
|
||||
!> 4.230.000
|
||||
!> (bloq:snap:dawn snap)
|
||||
::
|
||||
++ test-snap-hull
|
||||
%+ expect-eq
|
||||
!> hul
|
||||
!> (hull:snap:dawn ~zod snap)
|
||||
::
|
||||
++ test-snap-czar
|
||||
%+ expect-eq
|
||||
!> 256
|
||||
!> ~(wyt by (czar:snap:dawn snap))
|
||||
::
|
||||
++ test-snap-turf
|
||||
%+ expect-eq
|
||||
!> `(list turf)`~[~['org' 'urbit'] ~['org' 'urbit']]
|
||||
!> (turf:snap:dawn snap)
|
||||
::
|
||||
++ test-veri-good
|
||||
=/ sed [~zod 1 sec ~]
|
||||
%+ expect-eq
|
||||
|
Loading…
Reference in New Issue
Block a user