Hello, I am using this contract for testing ga accounts:
contract BlindAuth =
record state = { owner : address }
entrypoint init(owner' : address) = { owner = owner' }
stateful entrypoint authorize(r: int) : bool =
// r is a random number only used to make tx hashes unique
switch(Auth.tx_hash)
None => abort("Not in Auth context")
Some(tx_hash) => true
entrypoint to_sign(h : hash, n : int) : hash =
Crypto.blake2b((h, n))
I modified from the contract in the documentation at protocol/ga_explained.md at master · aeternity/protocol · GitHub
When I use the above contract for a GA account, the GAMetaTx(s) fail with the error in the node logs that says ... cannot be applied due to an error authentication_failed
when I change the contract to (omiting the switch on Auth.tx_hash
):
contract BlindAuth =
record state = { owner : address }
entrypoint init(owner' : address) = { owner = owner' }
stateful entrypoint authorize(r: int) : bool =
// r is a random number only used to make tx hashes unique
true
entrypoint to_sign(h : hash, n : int) : hash =
Crypto.blake2b((h, n))
the transaction goes trough. How would be the correct way to use the switch statement in this context?