bcdhub
bcdhub copied to clipboard
BCD does not display contract's entrypoint name
Hi, when an entrypoint has one parameter of type OR, BCD does not find the entrypoint name.
For example : https://better-call.dev/florencenet/KT1DHT7AQog7Ybnxm3yHSGUk2B1oY75zuKym/code
The entrypoint's name is displayed as entrypoint_2
while it should be second
(this is because its argument type OR nat string
is confused with the OR structure that describes entrypoints).
The archetype source code of this contract :
archetype test
entry first() {
()
}
entry second(a : or<nat, string>) {
()
}
Regards, Ben
Hey @rognierbenoit, BCD does not display intermediate entrypoints indeed, only the terminating ones, and moreover tries to "normalize" transaction parameters in case a contract is called with default/intermediate entrypoint.
thank you Michael for your feedback.
I don't know what an "intermediate endpoint" is.
The parameter type is or (unit %first) (or %second nat string)
:
I think that the algo that searchs for entrypoints should stop when an annotation is met: here it should consider the second branch of the first or
as an entrypoint because it has the annotation %second
. I believe this is the purpose of annotations, otherwise it would mean that an entrypoint cannot have one or
typed parameter.
In your case you have the following nested sum type:
or %default unit (or nat string)
/ \
unit %first or %second nat string
/ \
nat string
There is a root (you can call your contract with the following params: (entrypoint: default, value: Left Unit
)
There are three terminal nodes, but only one named (entrypoint first, value: Unit
)
And one intermediate node (entrypoint second, value: Left 42
)
BCD recognizes only terminal nodes and since they are not named it will use inferred names entrypoint_1
, entrypoint_2
, etc