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

eas assembles broken contracts when the body is split in multiple includes #114

Open
vyzo opened this issue Dec 14, 2022 · 1 comment
Open

Comments

@vyzo
Copy link

vyzo commented Dec 14, 2022

I am trying to compose a contract as follows:

%push(body_end - body_begin)
dup1
%push(body_begin)
push1 0x00
codecopy
push1 0x00
return

body_begin:
%include("A.eas")
%include("B.eas")
...
body_end:

Unfortunately the assembly is broken, as eas generates illegal jumps in the body.
If I lump all the includes together and do a single file, everything works fine.
So this is a bug in the assembly.

@gzanitti
Copy link
Contributor

gzanitti commented Oct 9, 2023

Hey Vyzo, thank you very much for your report. Your problem is mainly because the functionality you are looking for is given by the built-in %import, which inserts the code as if it was typed in the position where the built-in was called.

In the case of using %include, the new code is considered in a completely independent scope, and the labels start counting from zero again, hence your problem.

You can check the documentation for a more detailed explanation.

Thanks again!

P.S: @lightclient I think you can close this issue

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