I have a function like this
@sp.entry_point
def _verifySigPersonalSign(self,req,sig):
sp.verify((req.deadline != sp.timestamp(0)) | (sp.now<=req.deadline), "request expired")
digest = sp.sha256(sp.pack(sp.record(sender=req.sender,to=req.to,token=req.token,txGas=req.txGas,tokenGasPrice=req.tokenGasPrice,batchId=req.batchId,nonce=self.data.nonces[req.sender][req.batchId],deadline=req.deadline,data=sp.sha256(req.data))));
signer=req.sender
sp.verify(sp.check_signature(req.sender,sig,digest))
and created a test for it :
req = sp.TRecord(sender=alice.public_key,to=bob.public_key,token=sp.address("tz1YtuZ4vhzzn7ssCt93Put8U9UJDdvCXci4"),txGas=1,tokenGasPrice=2,batchId=1,batchNonce=2,deadline=sp.timestamp(1),bytes=sp.pack('42'))
AliceSignature=sp.make_signature(secret_key=alice.secret_key,message=req,message_format="Raw")
secanrio += c1._verifySigPersonalSign(req,AliceSignature)
But I am receiving an error:
Error: Type Error
sp.TKey is not sp.TAddress
sp.check_signature (params.req.sender : sp.TAddress)
on the line last line of the code : sp.verify(sp.check_signature(req.sender,sig,digest))
.
I need this line in my contract and also tried some debugging and found if I comment out this line then I receive another error:
Error: : Cannot read property '$nat' of undefined
Traceback (most recent call last):
Can someone please help me resolve it?