Unexpected token in JSON - oz compile -> oz create build bug


I found a new bug, similar to the one I already mentioned before:

Again, the oz compile command seems to generate a buggy build artifact.

See the problem in the JSON:

See the contract/interface code:

This time, I do not have duplicate names anywhere in my project. I only have this one file called IGelatoAction.sol and I only declare this one interface in that one file and import it elsewhere.

I can manually remove the unexpected token and this way continue my work (oz create the contract). But it is a weird bug I wanted to draw your attention to.

Bug is als there in new oz --version 2.6

1 Like

Hi @gitpusha,

Sorry to hear that you are having this issue.

Any thoughts on how to reproduce?

I have tried compiling with optimizer enabled/disabled and also commenting out one of the function declarations but haven’t seen the issue.

Hi, I have no clue yet on how to reproduce. I will play around a little once and report back, once I had some more time. Dont worry till then. Thank you!

1 Like

Hi @gitpusha,

I saw it a couple of times when I was trying different things with the Gelato repo to identify the node 12 oz compile issue, though nothing that I could reproduce consistently.

1 Like

Hi @abcoathup,

I noticed that the oz compile issue consistently (always) creeps up only in this file: build/IGelatoAction.json (not in version management).

Could it be that this happens due to the way IGelatoAction.sol is imported in our contracts:

Imported here:

Not imported directly here, but via inheritance:

used here:

1 Like

Hi @gitpusha,

Thank you for this.
That looks like a potential cause. I can try to reproduce now.

1 Like

Hi @abcoathup, I solved it.

Somehow the oz compile did not generate a compile warning for the fact that the import statement was invalid here https://github.com/gelatodigital/gelato/blob/c205a6a45118a90106bb1dda4b0d5339b2f247ba/contracts/gelato_core/GelatoCoreAccounting.sol#L3

it should have been
import '../interfaces/triggers_actions_interfaces/IGelatoAction.sol';
import './interfaces/triggers_actions_interfaces/IGelatoAction.sol';

Now that I have changed it, the compiler generates the correct builds.

1 Like