USER STORY: User can select a compiler version in LIGO Web IDE
As a user, I would like to select the compiler that I want to use in LIGO Web IDE, so that I can try different versions including stable ligo compiler versions, and bleeding edge or beta versions.
Acceptance criteria:
- Display a selector for compiler version to the user of Web IDE in the Configure area above the actions.
- Selector includes available compiler versions (last and previous(?) released versions, and several future versions as well)
- Last released version is selected by default
- Once a particular compiler is selected, it is used in user actions
NOTE: If Selector for the network is added already, Compiler selector should be below it.
Other considerations
Q: How do we know which compiler versions to run on the backend?
A: We will add a compilers.json
file with a list of compilers. There will be an additional property to specify which version is the default compiler version users will get when they start a new file.
--
Q: What happens when I open a share link that was created before different compiler versions was introduced?
A: The compiler should be set to the "default" version as defined in compilers.json
. (should we alert the user?? TBD).
--
Q: What happens when a user is using (fore example) v0.8.0 and makes a share link?
A: The compiler version should be recorded in the ligo share state file that is saved to google cloud storage
--
Q: What happens when a user opens a share link such as v0.5.0 but that version is no longer available (it has been removed from compilers.json
) on the server side?
A: The users compiler should be set to the "default" compiler, and user should get a Notice message stating:
Your share link was created using
{$version}
of the Ligo compiler, but{$version}
is no longer available on this web IDE. We have set your compiler to our latest stable version${stable_version}
but you may have to update your code. Please see our release notes at${URL_TO_RELEASE_NOTES}
to learn about new features and breaking changes that may affect your code.
The Plan
-
create compilers.json
-
Update CI/CD to deploy all compiler versions + latest -
Deploy script should make a route /${version}/
for each version appearing incompilers.json
/0.5.0/
/0.6.0/
/0.7.0/
/0.8.0/
-
-
Add a new endpoint to the server called /versions
that returns a list of compiler versions and the "default" compiler. This endpoint is to be consumed by the front end compiler -
Add a compiler selection UI element. The values of this UI will be generated from the data returned from the /version
end point. When the user selects, for example,0.7.0
and clicksCompile
the front-end will send a post request to/0.7.0/compile-contract
-
Add a compilerVersion
property to share link data state, so that when a ligo share link is generated, that compiler version is set to the same version that the author intended. -
As we are adding compilerVersion
property to share state, on the backed, add a new share schema version and hook it intosrc/schemas/migration.ts
that appropriately transforms schema to the new version