I found a crappy corner case while running taq call.
I suppose that Taqueria works as it :
compile the parameter in ligo to a .tz Michelson
call octez-cli on default entrypoint with this Michelson parameter
It works on 99% of the time, because there is a corner case : the default entrypoint !
If we have a contract having multiple entrypoints and 1 of thses entrypoints is named default, then Taqueria will pass the compiled parameter as it to the default entrypoint like it will dispatch it (i.e the current behavior of a main function).
In our case it does not work , because the default entrypoint is not a main dispatcher function, but a real entrypoint with Unit as parameter for example, to be able to receive Tez... yes this is the way a contract can receive XTZ using a simple transfer command.
What happen ?
If I try to call any other entrypoint, the node will not like it as the param sent by Taq does not match the default entrypoint signature
Ex :
So what should be done instead ?
Call with the --entrypoint argument and skip the Right / Left directives on --arg , like below
octez-client transfer 0 from alice to KT1NKLZE9HkGJxjopowLqxA4pswutgMrrXyE --entrypoint attack --arg 'Unit' --burn-cap 1
๐ฅ Status (Internal Taqueria Team Use Only)
๐ What happened?
I found a crappy corner case while running
taq call
. I suppose that Taqueria works as it : compile the parameter in ligo to a .tz Michelson call octez-cli on default entrypoint with this Michelson parameter It works on 99% of the time, because there is a corner case : the default entrypoint ! If we have a contract having multiple entrypoints and 1 of thses entrypoints is nameddefault
, then Taqueria will pass the compiled parameter as it to the default entrypoint like it will dispatch it (i.e the current behavior of a main function). In our case it does not work , because the default entrypoint is not a main dispatcher function, but a real entrypoint with Unit as parameter for example, to be able to receive Tez... yes this is the way a contract can receive XTZ using a simple transfer command. What happen ? If I try to call any other entrypoint, the node will not like it as the param sent by Taq does not match the default entrypoint signature Ex :So what should be done instead ? Call with the --entrypoint argument and skip the Right / Left directives on --arg , like below octez-client transfer 0 from alice to KT1NKLZE9HkGJxjopowLqxA4pswutgMrrXyE --entrypoint attack --arg 'Unit' --burn-cap 1
๐ Steps to Reproduce?
It is part of my current work here : https://github.com/marigold-dev/training-security-2/blob/main/contracts/3-reentrancyMaliciousContract.parameterList.jsligo Look at the project Readme.md on Chapter 3 At the end , I will run the
octez-cli octez-client transfer 0 from alice to KT1NKLZE9HkGJxjopowLqxA4pswutgMrrXyE --entrypoint attack --arg 'Unit' --burn-cap 1
instead oftaq call
Taq call should be : taq call 3-reentrancyMaliciousContract --param 3-reentrancyMaliciousContract.parameter.default_parameter.tz -e testing Taqueria will work "as design" but the contract is a bit special here ... Look at line 21 (https://github.com/marigold-dev/training-security-2/blob/main/contracts/3-reentrancyMaliciousContract.jsligo#L21) If Taqueria is not passing the entrypoint name on the octez-cli , it will never work :/๐ชต Relevant log output
No response
๐ How impactful is this bug?
None
โฑ๏ธ Prevalance
No response
๐ป Operating System
None
๐ธ๏ธ System Architecture
None
๐ฎ Taqueria Version
No response
๐ฟ Node.js Version
No response
โ๏ธ Contact Details
No response
Code of Conduct