Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BCD does not display contract's entrypoint name #716

Open
rognierbenoit opened this issue Jun 26, 2021 · 3 comments
Open

BCD does not display contract's entrypoint name #716

rognierbenoit opened this issue Jun 26, 2021 · 3 comments

Comments

@rognierbenoit
Copy link

rognierbenoit commented Jun 26, 2021

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

@m-kus
Copy link
Member

m-kus commented Jun 27, 2021

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.

@rognierbenoit
Copy link
Author

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.

@m-kus
Copy link
Member

m-kus commented Jul 7, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants