Hosted compiler July scheduled update

Last week the latest compiler version, the 3.2.0 has been released. It brings a few new built-in functions, squashes some bugs and it introduces an important change (from the changelog):

Public contract functions must now be declared as entrypoints

contract Example =
  // Exported
  entrypoint exported_fun(x) = local_fun(x)
  // Not exported
  function local_fun(x) = x

This welcomed change improves the security and readabiltiy of the contracts, but it will require a changes on the existing contracts source code.

This change will not impact the Js/Py/Go SDKs (and likely other SDK implementations) but you are affected if you are using the hosted compiler.

The good news is that the hosted compiler now supports multiple versions of the sophia compiler, that means that you can already test the changes to your sophia contract but by default the hosted compiler will still use the v3.1.0.

This will change though on 2019-07-17 where we will set the default compiler to v3.2.0 unless there are objections and there is a request to postpone this update.

For more informations on how to use the compilers check the compiler page: compiler.aepps.com

1 Like

Why this entrypoint syntax ?

1 Like

It does change the event name hashes as well, and as they are just passed through the JS-SDK this could affect their users as well.

It is mainly a safety thing, we want to avoid exposing functions by accident so you need to explicitly tag them with entrypoint. We could have kept private/public, but thought that entrypoint is more obvious what it means.

2 Likes

So we are dumping the public function and replacing it by entrypoint.

How is a private function going to be defined: private entrypoint or it stays private function?

How about just function for private/local functions and entrypoint for functions that should be accessible in contract call transactions?

And then add stateful if the function/entrypoint is stateful.

I can see that the require function has been added in 3.2.0 compiler version. Wouldn’t it better to recognize and reserve require as a potential keyword (to require modules or other stuff) and use assert instead?:

function assert(b, err) = if(!b) abort(err)

There seems to be no objections regarding the update, so we’ll carry on the changes sometimes around 7PM UTC

2 Likes

Is this change widely supported by Sophia lang architects? Has anybody been against? It would be nice to know internal comments.

This is just an update to the latest release of the Sophia compiler/language, it should not be very controversial.

The update was executed at 6:54PM UTC and went well, check it out at compiler.aepps.com

You can test the new compiler from the online contract editor where the sample contract has also been updated.

2 Likes