Update tests for entrypoints

This commit is contained in:
Ulf Norell
2019-06-27 14:16:33 +02:00
parent 85408a12a2
commit 6a59e455ce
51 changed files with 465 additions and 446 deletions
+3 -3
View File
@@ -1,9 +1,9 @@
contract BitcoinAuth =
record state = { nonce : int, owner : bytes(64) }
function init(owner' : bytes(64)) = { nonce = 1, owner = owner' }
entrypoint init(owner' : bytes(64)) = { nonce = 1, owner = owner' }
stateful function authorize(n : int, s : signature) : bool =
stateful entrypoint authorize(n : int, s : signature) : bool =
require(n >= state.nonce, "Nonce too low")
require(n =< state.nonce, "Nonce too high")
put(state{ nonce = n + 1 })
@@ -11,6 +11,6 @@ contract BitcoinAuth =
None => abort("Not in Auth context")
Some(tx_hash) => Crypto.ecverify_secp256k1(to_sign(tx_hash, n), state.owner, s)
function to_sign(h : hash, n : int) : hash =
entrypoint to_sign(h : hash, n : int) : hash =
Crypto.blake2b((h, n))