naive: nonce testing on

This commit is contained in:
drbeefsupreme 2021-06-17 17:17:03 -04:00
parent 7dbf0a28d2
commit 01328c03af
No known key found for this signature in database
GPG Key ID: B70D5683DE7F9EFC

View File

@ -587,18 +587,18 @@
=/ filter ;: cork =/ filter ;: cork
(cury filter-owner %.y) (cury filter-owner %.y)
(cury filter-proxy %own) (cury filter-proxy %own)
(cury filter-nonce %.y) (cury filter-nonce %.n)
(cury filter-rank %star) ::(cury filter-rank %star)
(cury filter-dominion %spawn) (cury filter-dominion %l2)
%- cury %- cury
:- filter-tx-type :- filter-tx-type
:* ::%spawn :* %spawn
::%transfer-point %transfer-point
::%configure-keys %configure-keys
::%set-management-proxy %set-management-proxy
%set-spawn-proxy :: planets can set spawn proxy atm :: set-spawn-proxy :: planets can set spawn proxy atm
::%set-transfer-proxy %set-transfer-proxy
::%escape %escape
~ ~
== ==
== ==
@ -836,6 +836,9 @@
:: ::
=/ cur-point (~(got by points.initial-state) cur-ship) =/ cur-point (~(got by points.initial-state) cur-ship)
=/ cur-nonce nonce.owner.own:(~(got by points.initial-state) cur-ship) =/ cur-nonce nonce.owner.own:(~(got by points.initial-state) cur-ship)
=/ new-nonce ?: nonce.cur-event :: wrong nonces do not increment nonce
+(cur-nonce)
cur-nonce
:: ::
=/ state initial-state =/ state initial-state
=/ expect-state initial-state =/ expect-state initial-state
@ -844,7 +847,7 @@
!> !>
|^ ^- ^state:naive |^ ^- ^state:naive
?. (~(got by suc-map) cur-event) ?. (~(got by suc-map) cur-event)
(alter-state cur-point(nonce.owner.own +(cur-nonce))) (alter-state cur-point(nonce.owner.own new-nonce))
?+ tx-type.cur-event !! ?+ tx-type.cur-event !!
%transfer-point set-xfer %transfer-point set-xfer
%configure-keys set-keys %configure-keys set-keys
@ -862,7 +865,7 @@
suite.keys.net suit suite.keys.net suit
auth.keys.net auth auth.keys.net auth
crypt.keys.net encr crypt.keys.net encr
nonce.owner.own +(cur-nonce) nonce.owner.own new-nonce
== ==
(alter-state new-keys) (alter-state new-keys)
:: ::
@ -870,7 +873,7 @@
=/ new-xfer =/ new-xfer
%= cur-point %= cur-point
address.owner.own (addr %transfer-test) address.owner.own (addr %transfer-test)
nonce.owner.own +(cur-nonce) nonce.owner.own new-nonce
== ==
(alter-state new-xfer) (alter-state new-xfer)
:: ::
@ -878,7 +881,7 @@
=/ new-mgmt =/ new-mgmt
%= cur-point %= cur-point
address.management-proxy.own (addr %proxy-test) address.management-proxy.own (addr %proxy-test)
nonce.owner.own +(cur-nonce) nonce.owner.own new-nonce
== ==
(alter-state new-mgmt) (alter-state new-mgmt)
:: ::
@ -886,7 +889,7 @@
=/ new-spwn =/ new-spwn
%= cur-point %= cur-point
address.spawn-proxy.own (addr %proxy-test) address.spawn-proxy.own (addr %proxy-test)
nonce.owner.own +(cur-nonce) nonce.owner.own new-nonce
== ==
(alter-state new-spwn) (alter-state new-spwn)
:: ::
@ -894,7 +897,7 @@
=/ new-xfer =/ new-xfer
%= cur-point %= cur-point
address.transfer-proxy.own (addr %proxy-test) address.transfer-proxy.own (addr %proxy-test)
nonce.owner.own +(cur-nonce) nonce.owner.own new-nonce
== ==
(alter-state new-xfer) (alter-state new-xfer)
:: ::
@ -903,7 +906,7 @@
=/ new-escp =/ new-escp
%= cur-point %= cur-point
escape.net (some ship) escape.net (some ship)
nonce.owner.own +(cur-nonce) nonce.owner.own new-nonce
== ==
(alter-state new-escp) (alter-state new-escp)
:: ::
@ -918,16 +921,16 @@
address.transfer-proxy.own (addr %spawn-test) address.transfer-proxy.own (addr %spawn-test)
sponsor.net [has=%.y who=cur-ship] sponsor.net [has=%.y who=cur-ship]
== ==
=/ new-nonce =/ new-point-nonce
%= cur-point %= cur-point
nonce.owner.own +(cur-nonce) nonce.owner.own new-nonce
== ==
=/ new-spawn=^state:naive =/ new-spawn=^state:naive
%= expect-state %= expect-state
points (~(put by points.expect-state) ship spawned) points (~(put by points.expect-state) ship spawned)
== ==
%= new-spawn %= new-spawn
points (~(put by points.new-spawn) cur-ship new-nonce) points (~(put by points.new-spawn) cur-ship new-point-nonce)
== ==
:: ::
++ alter-state ++ alter-state
@ -947,7 +950,9 @@
%bat %bat
=< q =< q
%- gen-tx %- gen-tx
:+ nonce.owner.own:(~(got by points.state) cur-ship) :+ ?: nonce.cur-event
cur-nonce
999 :: wrong nonce
:- :- cur-ship :- :- cur-ship
proxy.cur-event proxy.cur-event
def-args def-args