-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
(deftest scratch-passing
(common/deployed-valid-invariant? backend schema)
(let [txn [[:db.fn/call + 1 :account/balance -1]
[:db.fn/call + 2 :account/balance +1]
[:db/add 1 :transaction/signed-by 1]]]
(is (not (common/balance-mismatch? backend txn schema)))))
(defn balance [u]
(:account/balance (d/entity @conn u)))
(deftest scratch-failing
(common/deployed-valid-invariant? backend schema)
(let [txn [[:db/add 1 :account/balance (dec (balance 1))]
[:db/add 2 :account/balance (inc (balance 2))]
[:db/add 1 :transaction/signed-by 1]]]
(is (not (common/balance-mismatch? backend txn schema)))))@whilo It looks like ?balance-change is equivalent to ?balance-after in the second case, so the tx is rejected, though it's equivalent to the first (passing) tx. For commutativity etc. there's reasons why the first is preferable, and I may be missing something - but it seems like the second form ought to be acceptable?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels