I have a smart contract call that was returning an empty error, then I did a dry run to get a more specific error, and I got incorrect number of arguments error which is really weird, as I am passing the correct number of arguments (9)!
Sophia function that I am calling is:
public stateful entrypoint finalize(pubkey: address, sig: signature, logicVersion : int, nonce : int, functionName : string, ti : int, flancer : int, flancersScore : int, flancersText : string) =
…
(so as can be seen it takes 9 arguments)
And in js code I call it like this in a try block:
const resBc = await _contract.methods
.finalize.get(req.body.publicKey, req.body.sig, req.body.logicVersion, req.body.nonce, ‘finalize’, task.bcId, freelancer.bcId, req.body.rate, req.body.message);
I catch error and print exact calling arguments:
console.error(req.body.publicKey, req.body.sig, req.body.logicVersion, req.body.nonce, ‘finalize’, task.bcId, freelancer.bcId, req.body.rate, req.body.message);
console.error(err);
And I get output:
ak_M65JLCoTNWEiprJT9oTZWrhs5bJJ8mg9SyEdcm3UqW6snTmxK 3f2c42a32835f7fb6519b739c274e8304380d353f38e7b853cef297410cede60664e91ca6ea61aedef2f075749d95fadd29d17eef3154fdb2ef86781249ebc08 1 9 finalize 4 2 2 soso
Error: Invocation failed: cb_RXhwZWN0ZWQgOSBhcmd1bWVudHMsIGdvdCA4ls17fg==. Decoded: Expected 9 arguments, got 8��{~
…
returnType: ‘error’,
returnValue: ‘cb_RXhwZWN0ZWQgOSBhcmd1bWVudHMsIGdvdCA4ls17fg==’,
error: ‘cb_RXhwZWN0ZWQgOSBhcmd1bWVudHMsIGdvdCA4ls17fg==’,
decodedError: ‘Expected 9 arguments, got 8��{~’
So super weird…any ideas? @philipp.chain @bruteforce.chain @hanssv.chain
Is there some limit in Sophia on the number of arguments or size of all arguments combined? I am sure there are, but it would be weird if that limit was only 8 arguments (actually I tested the function through online Sophia IDE and it worked, so I don’t get what’s wrong with my JS calling procedure)