naive: batch test creator implemented

This commit is contained in:
drbeefsupreme 2021-08-11 11:52:22 -04:00 committed by yosoyubik
parent ac21fecf89
commit 2f6e60aa1c

View File

@ -698,7 +698,8 @@
-- --
:: ::
:: takes in a list of full-tx and turns them into a batch :: takes in a list of full-tx and turns them into a batch
:: to be submitted to +n :: to be submitted to +n. The ordering on the list is the order in which
:: the transactions are processed
++ tx-list-to-batch ++ tx-list-to-batch
|= =tx-list ^- @ |= =tx-list ^- @
:: ::
@ -710,7 +711,7 @@
=/ cur-tx i.tx-list =/ cur-tx i.tx-list
=/ cur-raw q:(gen-tx cur-tx) =/ cur-raw q:(gen-tx cur-tx)
$(batch-raw (snoc batch-raw cur-raw), tx-list t.tx-list) $(batch-raw (snoc batch-raw cur-raw), tx-list t.tx-list)
(roll tx-list-octs (cury cat 3)) (roll (flop tx-list-octs) (cury cat 3))
:: ::
-- :: end +l2-event-gen -- :: end +l2-event-gen
:: ::
@ -3009,6 +3010,23 @@
=^ f state (n state %bat q:signed-tx) =^ f state (n state %bat q:signed-tx)
transfer-proxy.own:(~(got by points.state) ~tasben-monbur) transfer-proxy.own:(~(got by points.state) ~tasben-monbur)
:: ::
++ test-batch-create
=, l2-event-gen
=/ marbud-transfer [marbud-own %transfer-point (addr %marbud-key-0) |]
=/ marbud-transfer-2 [marbud-own %transfer-point (addr %marbud-key-1) |]
::
=/ tx-1=full-tx [0 marbud-transfer %marbud-key-0]
=/ tx-2=full-tx [1 marbud-transfer-2 %marbud-key-0]
=/ txs=tx-list (limo ~[tx-1 tx-2])
%+ expect-eq
!> [(addr %marbud-key-1) 2]
::
!>
=| =^state:naive
=^ f state (init-marbud state)
=^ f state (n state %bat (tx-list-to-batch txs))
owner.own:(~(got by points.state) ~marbud)
::
:: TODO: signature format changed; regenerate :: TODO: signature format changed; regenerate
:: ::
:: ++ test-metamask-signature ^- tang :: ++ test-metamask-signature ^- tang