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

rholang 1.1 -> 1.0 dev tool a la babel #48

Open
dckc opened this issue Nov 9, 2021 · 9 comments
Open

rholang 1.1 -> 1.0 dev tool a la babel #48

dckc opened this issue Nov 9, 2021 · 9 comments
Labels
enhancement New feature or request

Comments

@dckc
Copy link

dckc commented Nov 9, 2021

We have a rholang 1.1 implementation in the form of a source-to-source translation to rholang 1.0. Getting this integrated into validator nodes on mainnet involves lots of coordination that will understandably take time, but meanwhile, much like JavaScript developers use babel to translate new features to syntax understood by deployed browsers, we should expose the rholang 1.1 to 1.0 translator as tool so that developers can write rholang 1.1 and translate it rholang 1.0 automatically for deployment.

We could, for example, integrate that with the Rholang Playground - RChain.

ref:

@dckc dckc added the enhancement New feature or request label Nov 9, 2021
@tgrospic
Copy link
Collaborator

We could publish special pre-release with Rholang 1.1 which can be used in evaluated mode to get translation to desugared syntax.

For example this code evaluated with Rholang 1.1

let x <- 1 ; y <- 2 ; z <- 3 in {
  (*x, *y, *z)
}

produces this output

match [1] {
  [x0] => {
    match [2] {
      [x1] => {
        match [3] {
          [x2] => {
            (x0, x1, x2)
          }
        }
      }
    }
  }
}

@dckc
Copy link
Author

dckc commented Nov 25, 2021

Exactly.

I was thinking of a standalone jar a la
https://github.com/rchain/rchain/tree/dev/rholang#command-line-usage

But anything that can be used from a batch dev tool (npm script, makefile, ...) is fine.

@Bill-Kunj
Copy link

I'm glad someone finally brought this to the foreground. Rholang 1.0 is hard for newbies. Rholang 1.1 would be invaluable for new practitioners.
@tgrospic How hard will it be to publish a batch tool similar to what @dckc suggests? What can I do to help?

@tgrospic
Copy link
Collaborator

@Bill-Kunj I'm suggesting to publish a pre-release with all the artifacts (Docker image, deb package, ...) so it can be used in VSCode extension or with eval command like any other release.

@Bill-Kunj
Copy link

This sounds like a great start.

@Bill-Kunj
Copy link

@Bill-Kunj I'm suggesting to publish a pre-release with all the artifacts (Docker image, deb package, ...) so it can be used in VSCode extension or with eval command like any other release.

Not being pushy, but I really, really want to try this out. When can I start using it?

@tgrospic
Copy link
Collaborator

Rholang 1.1 pre-release (special build) is published: v0.12.4+rholang-1.1-rc1.

Docker image has tag name with __ instead of + and it's published here: v0.12.4__rholang-1.1-rc1.

It's based on v0.12.4 version with some small updates not related to Rholang.

These test can help to understand how the new syntax is desugared to Rholang 1.0.

Enjoy! 🥳

@dckc
Copy link
Author

dckc commented Dec 11, 2021

Rholang 1.1 pre-release (special build) is published

Thanks!

Enjoy!

I'm struggling to figure out how. Help, please?

I put the example above in r1.rho:

let x <- 1 ; y <- 2 ; z <- 3 in {
  (*x, *y, *z)
}

Now what? How do I convert it to rholang 1.0 using v0.12.4+rholang-1.1-rc1?

I tried:

$ docker run -v/tmp:/tmp -ti --rm rchain/rnode:v0.12.4__rholang-1.1-rc1 eval /tmp/r1.rho
Evaluating from /tmp/r1.rho

Result for /tmp/r1.rho:
Error: Connection refused: localhost/127.0.0.1:40401

then I tried:

$ docker run -d --net host -v/tmp:/tmp --rm rchain/rnode:v0.12.4__rholang-1.1-rc1
0233e39840af1cc97957c1f16e17054d6b3228245d1bbed5bf48d3f2628217f1
$ docker run --net host -v/tmp:/tmp -ti --rm rchain/rnode:v0.12.4__rholang-1.1-rc1 eval /tmp/r1.rho
Evaluating from /tmp/r1.rho

Result for /tmp/r1.rho:
Error: Connection refused: localhost/0:0:0:0:0:0:0:1:40401

@tgrospic
Copy link
Collaborator

@dckc You need to run an instance of RNode and call gRPC method eval. This is what CLI eval method is doing.

So first start standalone instance.

$ docker run --name rho -v $PWD/tmp:/tmp -ti --rm rchain/rnode:v0.12.4__rholang-1.1-rc1 run -s

When it's up (unfortunately after the blockchain part is ready) you can call eval to that instance with the same container, so escape all of networking setup. Eval is on private port, so port 40402.

docker exec rho bin/rnode --grpc-port 40402 eval /tmp/r1.rho

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

No branches or pull requests

3 participants