[Gym] Help needed! Offer/Request

Hi all,

So in the near future I will be adding exercises to the holochain gym. I just finished my first “complete exercise” with interactive simulations, you can find it here: Intermediate: Paths: Holochain Gym. It’s about the new path mechanism that we have available in RSM.

If anybody is learning holochain development & RSM right now, it would be of great help if you wanted to try out these exercises to learn about the concepts described there, and give feedback about the exercises themselves so that the gym evolves to be as useful as possible.

To start with this first paths exercise, I’d love to know:

  • Do the interactive simulations on the gym make sense and help to ground the concept?
  • Is the code exercise is too difficult?
  • Does it help to have the entry design as part of the problem statement to help begin with the code?

Thanks a lot in advance :smiley:

ping @tixel

12 Likes

I’m diving in :diving_mask:
I’ll document my experiences/remarks here:

I will give you a ping when I resurface

1 Like

Oh yeah, please do document the setup portion too… Suddenly I’m having problems with setting up holonix (raised a Github issue too, on https://github.com/holochain/holochain/issues/595). With every new Holochain commit, my whole setup seems to break apart… So sad…

@guillemcordoba

I read the Path section on github.io. It’s very good. The graph visualisations are really useful. I still have to tackle rust exercises, but that’s for tomorrow.

I went through the github.io pages and video for the elements section. I might have some ideas to improve this section. Maybe we can discuss this if you have the time.

2 Likes

You are awesome :smiley:

Really grateful for what you are doing, yes ping me when you want to chat!

Hi @guillemcordoba

I’m trying to run the tests in the paths exercises, but I’m a bit confused.
The main test is, I presume, running the node tests.
Do I run: npm test of hc test
And am I supposted to work with the nix-shell https://holochain.love
?

Hi @tixel, you’re right in that I don’t have the holochain setup itself very well documented, and that’s mainly because it’s not stable yet and it will change very soon. Can you try running nix-shell https://nightly.holochain.love and then running the tests in the test folder?

Hi @guillemcordoba,

I get two errors when I run ‘npm test’ from the tests folder in the nix-shell https://nightly.holochain.love

At the beginning of the test

08:00:41 info:
☉☉☉ {{{CONDUCTOR c0}}}
☉ Jan 26 08:00:41.148 ERROR lair_keystore_client: error=Other(OtherError(“version mismatch, expected 0.0.1-alpha.10, got 0.0.1-alpha.8”)) file="/build/holochain-vendor.tar.gz/lair_keystore_client/src/lib.rs" line=42

08:00:43 info:
★★★ {{{CONDUCTOR c0}}}
★ Jan 26 08:00:43.161 ERROR lair_keystore_client: error=Other(OtherError(“timout waiting for lair-keystore ready”)) file="/build/holochain-vendor.tar.gz/lair_keystore_client/src/lib.rs" line=49

and at the end:

08:12:01 [tryorama] error: Test error: ‘Conductor exited before starting interface (code 101)’
not ok 1 Test threw an exception. See output for details.
operator: fail
at: (/home/holodev/developer-exercises/intermediate/1.paths/tests/node_modules/@holochain/tryorama/src/middleware.ts:137:13)
stack: |-
Error: Test threw an exception. See output for details.
at Test.assert [as _assert] (/home/holodev/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:269:54)
at Test.bound [as _assert] (/home/holodev/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:90:32)
at Test.fail (/home/holodev/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:363:10)
at Test.bound [as fail] (/home/holodev/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:90:32)
at /home/holodev/developer-exercises/intermediate/1.paths/tests/node_modules/@holochain/tryorama/src/middleware.ts:137:13
at processTicksAndRejections (internal/process/task_queues.js:97:5)

got an error for test ‘create posts and retrieve them’: Conductor exited before starting interface (code 101)

Any suggestions? If not I will do some dry testing, meaning that I will try to implement the zome and making it compile.

Huh that’s interesting, I would think that nix-shell would take care of fixing that. @steveeJ any suggestions?

Other than that, the tests are not supposed to work until you’ve coded and compiled the DNA, i will make that clearer on the instructions. To confirm that you have the environment correctly setup, you can try switching to the solution branch and running the tests there, they should all pass.

I don’t think I compile the dna, that surely is a step I missed.
Also, I’m messing around in the same environment where I was trying to test the conductor doing and trying all kinds of stuff.

So I will test in a new and fresh user (and a faster laptop) and I will try to run the solution branch first to validate my setup.

1 Like

Quick update
In a fresh environment inside nix-shell https://nightly.holochain.love I can run the tests on solution git branch. The tests are successful.

If I want to compile and run the master branch (freshly checkout, no code added) I get a compile error concerning unused imports. You can get around that with the right flags, which are written down in my google doc notes a the top of this thread.

TLDR; I can compile working tests and failing tests!
So I’m diving back in to the exercises.
@guillemcordoba thanks for making this exercises. It’s fun to learn and figure out Rust and zomes this way.

1 Like

Hi @tixel, you warm my heart with this :smiley:

The imports are there for you to quickly get started, and in this exercise it’s important because of the chrono import, but I understand that you want to see the thing compiling before actually editing the code. How important is it for you that the zome compiles without editing it? Do you see a way of having both benefits?

Euraka!! I made it :slight_smile: 9 tests, all green.

Rust is a language with some concepts that you don’t find in Java or Python. Given I’m new to Rust, this what took the most time to get around.

@guillemcordoba I’ll contact you tomorrow to see when you have time to talk!

1 Like

@guillemcordoba a fews question on the github.io part:

How do you run the github.io site locally?

When I follow the default github pages instructions I get this error together with a blank page:

   ~/holochain-gym/holochain-gym.github.io$ bundle exec jekyll serve
   Configuration file: none
   Source: /home/holodev/holochain-gym/holochain-gym.github.io
       Destination: /home/holodev/holochain-gym/holochain-gym.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
     Build Warning: Layout 'home.njk' requested in docs/index.md does not exist.
                    done in 0.02 seconds.
                    Auto-regeneration may not work on some Windows versions.
                    Please see: https://github.com/Microsoft/BashOnWindows/issues/216
                    If it does not work, please upgrade Bash on Windows or run Jekyll with --no-watch.
 Auto-regeneration: enabled for '/home/holodev/holochain-gym/holochain-gym.github.io'
    Server address: http://127.0.0.1:4000
  Server running... press ctrl-c to stop.

I see some rocket.config.mjs /…? Do I need this?
And is the theme (home.njk) included or do I need to install it and if so where do I find it?

Hi @tixel! So you actually do this:

npm install
npm start

I’ll answer more later :slight_smile:

I’m trying to come up with an exercise for adding an entry in a zome and retrieving it based on its entryhash, but I’m stuck on how to get the entry hash from the zome to the typescript test.

Anyone any ideas? Code is located here:

Interesting. I see you passing hashes inside strings. Why don’t we use EntryHash as input parameter in the get_book fn call? If you want it to serialize to string, you can use WrappedEntryHash from hc_utils, example here.

What is the error you are seeing? Otherwise code looks right to me.

I’m running in to error below. I already learned that you need to be make sure the fieldnames match in typescript and rust. But I cannot find the cause of this error.

got an error for test ‘add and retrieve a book’: {
type: ‘error’,
data: {
type: ‘ribosome_error’,
data: ‘Wasm error while working with Ribosome: Deserialize([0])’
}
}

And thanks; I didn’t know about hc_utils. Very handy.

Okey, let me try to reproduce and maybe upgrade the holochain version to get a clearer error.

Well I feel embarrassed. The nix files were not appropriately setup, so they were downloading the latest develop branch from holochain, which is not the one with which the zome was compiled.

Fixing it now