[Gym] Help needed! Offer/Request

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

I didn’t notice any problems with nix.

I did upgrade the dependencies, with give better errors. Which is very good, but the error I get with my current code (just committed to repo) gives me this error.
So now I’m wondering if I do anything wrong or if I’m running into a holochain bug?

ERROR wasm_trace: holochain_wasmer_guest:/home/holodev/holochain-gym/developer-exercises/basic/1.hashes/.cargo/registry/src/github.com-1ecc6299db9ec823/holochain_wasmer_guest-0.0.67/src/guest.rs:89 output_type = “holo_hash::hash::HoloHash<holo_hash::hash_type::primitive::Header>”; bytes = [196, 39, 132, 41, 36, 64, 246, 134, 67, 123, 40, 119, 15, 110, 98, 105, 157, 129, 191, 226, 1, 63, 140, 233, 35, 106, 26, 231, 154, 58, 86, 201, 246, 234, 33, 227, 101, 37, 208, 62, 62]; Deserialize(“wrong msgpack marker Bin8”)

Uaks no idea… Yeah I don’t think you’re doing anything wrong, it’s just the holochain versioning I think… Which to be honest right now is a mess, just before publishing the hdk. My hunch is that it’s better to spend our energy elsewhere for now, until that happens (should be today).

1 Like

Hi All, Not sure if this is the right place to post this but I just wanted to let you know that this link is dead -> https://github.com/holochain/holochain/blob/develop/crates/hdk3/src/prelude.rs . It’s referenced on the Get Ready section (https://holochain-gym.github.io/developers/basic/entries/) .

2 Likes

Hi @SQLEinstein,

Thanks for the feedback. Holochain is still in rapid development, so the hologym exercises might break more often than we would like. I’m currently trying to figure out how to pin the existing exercises to all the right versions.
The core concepts have not changed, so everything you read on hologym still holds true.

I will fix the link as soon as I figure the dependencies out. For now this is the right link.

Hdk3 was renamed to hdk :slight_smile:

2 Likes

I’m going to play around with a game for collective governance of and within small groups

Is there anything I can do to help the gym?

Sure :slight_smile: ! I think the best thing as of now is to try it out, give feedback and suggestions to improve it. Later if you see you have energy to implement exercises from the list that we have, you could also contribute that.

Hi @guillemcordoba, thank you so much for your efforts so far in making the holochain gym happen. If you’re after some feedback, I can give you my impressions on exercises 1 and 2 (entries, hashes) as well as my background knowledge to provide better context for my suggestions as a newcomer. :slight_smile:

I’m a Python dev with a bioinformatics background. I’m familiar enough with Rust to google what I need to google EDIT: but would still consider myself a beginner. It’s a cool language! My flow of understanding of what holochain is and how to use it went something like this:

Discover holochain → Read through the (stunningly good) core concepts page → Install holochain via nix-shell on a Ubuntu Linux subsystem for windows → Ready to code → No hello World tutorial for RSM → Google for tutorials but they’re all for pre-RSM → Find ‘migration’ page but it’s not clear how this helps me / some hc commands don’t work yet or haven’t been implemented → Go to dev forum → Find gym and holochain-dna tutorial

So for me, the Gym is my first exposure to actually seeing the core concepts being implemented in code-space. Pre-gym, I’d never seen a folder layout for a typical project, or where the DNA lives in wasm form, or how zomes are laid out, or what the default.nix is.

My first recommendation would be to, prior to ‘0.entries’, walk through a typical DNA layout a bit like holochain-dna tutorial and show where this type of package resides in relation to the Cell and Orchestrater. Tryorama can come later, and the higher order stuff can be suspended for now while the basics are laid down, but I think it’s important to show learners where their current exercise sits in the hierarchy of future knowledge they will learn and where in the Core Concepts their lesson sits.

Second recommendation - introduce the pertinent elements of hdk::prelude at the top of each exercise + show useful rust hdk code (or link to it). I think this will help the user understand where these commands come from and encourage them to dive into the crate documentation (which I had to do for Hashes). You probably don’t have to type it all out, but even just a link to the docs and a suggestion to go from there wouldn’t be amiss.

Third recommendation - I was working through the newly updated Hashes exercise last night and got a little stumped with 2 things (spoilers for solutions):

  1. use holo_hash::EntryHashB64
    I’m not sure where this came from, and not sure what I could have done to find it. I’ve never seen any mention of the holo_hash package before this, and thought I was limited to using the hdk exclusively. I think this feeds back into my first recommendation - tutorials are currently so scarce, coding with holochain is partly an exercise in figuring out what I need to do to then learn how to do it.

  2. Anything WebAssembly related needs explanation to me, eg this line on the get result (ExternResult<Option>)

    .ok_or(WasmError::Guest(String::from(“Could not find book”)))?

This WasmError pattern is foreign to me (you should have seen the double matching code I originally had for handling the nested Option, it was gloriously terrible :sob:)

Where does the WasmError come from, why is it necessary, what code needs to be handled in WASM, etc.

That’s where I’m at so far. I think a general improvement I can recommend is this: within a chapter page, after the graph/interactive examples (which are so good), introduce a code pattern with a simple, complete example, and then end the chapter with a more complicated test. While I’m having a lot of fun learning on my own and figuring stuff out, it’s taking a while, and I think ultimately I’m scrambling for patterns and reading docs and only half understanding the core concepts because I have no baseline to check my knowledge against with simple examples. I’d really benefit from a pattern introduction → visual example–> complete example → test.

And with all of those suggestions aside, let me also say this: thank you :handshake:. This has been amazing fun so far, and your gym is hands down the best dev introduction currently out there. I would love to continue to learn more, and to that end, I offer myself as a beta tester and second pair of eyes for your upcoming chapters, if you’ll have me. Maybe it would be useful for someone like me to come in and ask seemingly dumb questions to help refine and target the message of the chapters so that the gym can be a stronger place for newcomer and holochain enthusiasts alike.

Let me know - send me a message or reply here. Otherwise, just happy to provide feedback as I go.

5 Likes

This is so cool! I’m amazed :smiley:

Thank you for your clear and sensible feedback. You make a lot of good points, and this kind of interaction is what I want for the gym - group co-creation, more than one person doing all the exercises.

I think for now this forum is a good enough place to do the feedback, this way other people also have visibility. It may also be good to create a tag for it to group the different posts.

As far as your individual suggestions, two things come to mind:

  • Creation of a FAQs page (to address the WasmError thing for example)
  • Having the first step of the gym be cloning the dna build tutorial repo and playing around with it
    • I also know there are people that prefer to start with the details and expand the vision bigger afterwards, but we can just offer the option to go to the dna build tutorial if they want
  • Removing EntryHashB64, as it doesn’t add any new thing here and it isn’t worth to explain in this exercise

In the recent hashes exercise, I loved how @tixel made the participants play with the hashes of the entries, as it forced you to see how they work by playing with them. How was your experience with that interaction?

We need more beta testers, so that’s awesome. Even if you want to learn more about a particular concept and would want to create an exercise by yourself, that would be even more awesome :smiley: . I can offer help with the concepts to guide you in that process.

1 Like

This is so cool! I’m amazed :smiley:

Thank you for your clear and sensible feedback. You make a lot of good points, and this kind of interaction is what I want for the gym - group co-creation, more than one person doing all the exercises.

I think for now this forum is a good enough place to do the feedback, this way other people also have visibility. It may also be good to create a tag for it to group the different posts.

My pleasure! When future updates are pushed I’ll also provide more feedback here; perhaps a google doc with comments so you can get a line-by-line approach in addition to overview-level suggestions.

As far as your individual suggestions, two things come to mind…

All that sounds good to me.

In the recent hashes exercise, I loved how @tixel made the participants play with the hashes of the entries, as it forced you to see how they work by playing with them. How was your experience with that interaction?

Yes that was cool, well done @tixel - the effort that goes into those visual examples pays off, I think. There’s nothing quite like seeing it in action. I was actually a little surprised by the quite detailed explanation of hashing, though, not in that it was unwelcome, but rather that I was struggling to understand other things but I already knew basically what hashing was and why we did it. If the same level of explanation went into the other elements of holochain as went into explaining simple hashing, that would be amazing.

Oh one thing I can mention about the “Getting Ready” section. Maybe a brief explanation of the different hashes in the signed_header would be good: header::content::entry_hash, author, prev_header and the header::hash. This would help the user in differentiating which hash they should be searching for in their own code (the header hash, not the content hash). In the subsequent Test section, it’d then be good to remind/show the user in tests\src\index.tswhat that entryHash is (the header::hash from before) and how the get_book() code plays with that type of hash, which can be traced back to what we just learned.

We need more beta testers , so that’s awesome. Even if you want to learn more about a particular concept and would want to create an exercise by yourself, that would be even more awesome :smiley: . I can offer help with the concepts to guide you in that process.

I’d love to help write something, or learn enough about it to then write it up for others. Although I tend to work better with ‘let’s make a simple X’ kind of approach, maybe exploring a solo concept wouldn’t be a bad start. Is there one you can recommend? Neighborhoods and verification come to mind, but I wonder if that’s too advanced for now.

1 Like