h-REA / hREA

A ValueFlows / REA economic network coordination system implemented on Holochain and with supplied Javascript GraphQL libraries
https://docs.hrea.io
Other
142 stars 15 forks source link

#275 update to HDI and holochain 0.0.152 #340

Closed Connoropolous closed 1 year ago

Connoropolous commented 1 year ago

In case not using nix-shell, these are the package versions for this branch: cargo install holochain --version 0.0.152 cargo install holochain_cli --version 0.0.50 cargo install lair_keystore --version 0.0.11

additionally you will need the following:

Current HDK: 0.0.144

closes #275

Connoropolous commented 1 year ago

@pospi FYI @weswalla is back and they're taking over this from me

Connoropolous commented 1 year ago

we've just landed the migration on the Acorn project, so have learned a few lessons along the way and feel prepared for this

Connoropolous commented 1 year ago

@weswalla on this branch (just mirroring a change I made on sprout branch) delete the whole _templates and example folders? They're causing conflicts now, because I deleted them, but you changed them. Just delete them and we're fine.

weswalla commented 1 year ago

Does this general integrity zome pattern look right?

pospi commented 1 year ago

Made a lot of progress, but a couple of new problems left to resolve:

weswalla commented 1 year ago

the most recent commit (https://github.com/h-REA/hREA/pull/340/commits/e873e797ea545f9301b0226374ab46f9d4a76341) makes all crate compile, however, I think we will want to replicate the core/integrity split pattern of dna_auth_resolver (https://github.com/holochain-open-dev/dna-auth-resolver/blob/2c9951ae5cc567b7560773d94ec6c34a0afe0758/integrity/src/lib.rs#L9) because right now the __num_entry_types and __num_link_types callbacks are left out of the 2 crates listed below which I'm assuming will be an issue on the holochain side of things.

There are two places we will need to handle this:

  1. hc_zome_rea_agent_integrity crate
  2. hc_zome_rea_economic_event_integrity crate

With (1), the error occurs because we define a link type in the agent integrity zome, but the hdk_semantic_indexes_integrity crate already defines a LinkTypes. With (2), the error occurs because the hc_zome_rea_economic_event_lib crate depends on the hc_zome_rea_economic_resource_lib crate which leads to two separate entry type definitions using the #[hdk_entry_defs] macro.

One solution for (1) is to split the hdk_semantic_indexes_integrity crate into 2 crate, like in https://github.com/holochain-open-dev/dna-auth-resolver/blob/2c9951ae5cc567b7560773d94ec6c34a0afe0758/integrity/src/lib.rs#L9, however, this wouldn't address (2).

The other solution (that I can think of) is to do the split on the zome side rather than the lib side. Meaning both hc_zome_rea_agent_integrity and hc_zome_rea_economic_event_integrity are decomposed into 2 crates each (core/integrity), thus solving (1) and (2).

Connoropolous commented 1 year ago

I did the split on both sides, semantic and classes and for the classes I did all of them instead of being selective

Connoropolous commented 1 year ago

Next step is integration tests I think. Seeing how much we broke along the way

Connoropolous commented 1 year ago

Ok so,

cd test
TRYORAMA_LOG_LEVEL=debug WASM_LOG=debug RUST_LOG="debug,wasmer_compiler_cranelift=error,holochain::core::workflow=error" RUST_BACKTRACE=1 npx tape agent/**/*.js

results in all failures, and a wasm related 'host/guest' interface issue:

error during scenario.addPlayerWithHappBundle:  {
  type: 'error',
  data: {
    type: 'internal_error',
    data: 'Conductor returned an error while using a ConductorApi: RibosomeError(WasmRuntimeError(RuntimeError { source: User(WasmError { file: "/Users/connor/.cargo/registry/src/github.com-1ecc6299db9ec823/holochain-0.0.152/src/core/ribosome/real_ribosome.rs", line: 416, error: Compile("Error while importing \\"__wbindgen_placeholder__\\".\\"__wbindgen_describe\\": unknown import. Expected Function(FunctionType { params: [I32], results: [] })") }), wasm_trace: [], native_trace:    0: <unknown>\n'

looking into the line throwing it: https://github.com/holochain/holochain/blob/develop/crates/holochain/src/core/ribosome/real_ribosome.rs#L414

Connoropolous commented 1 year ago

Oh! Damien posted about this issue recently and discovered the fix. Woohoo! https://discord.com/channels/727959104777224303/728647693244694648/1005632262865432586 https://discord.com/channels/727959104777224303/728647693244694648/1005668887431487488

Connoropolous commented 1 year ago

Pushed the fix, that is letting us get the integration tests running

weswalla commented 1 year ago

It seems like the remaining errors (there may be others I haven't investigated yet) are related to dna_auth_resolver, as the following error is consistent across tests:

Err(Wasm(WasmError { file: "/Users/weswalla/.cargo/git/checkouts/dna-auth-resolver-bb2f8d37890db247/2c9951a/core/src/lib.rs", line: 32, error: Guest("AvailableCapability does not map to any ZomeId and LinkType that is in scope for this zome.") }))])

which is related to https://github.com/holochain-open-dev/dna-auth-resolver/blob/2c9951ae5cc567b7560773d94ec6c34a0afe0758/core/src/lib.rs#L32

where the error in generated in holochain: https://github.com/holochain/holochain/blob/29f7cf536c030c5d79c6595f4bdbcb0c61c3b9d1/crates/hdk_derive/src/link_types.rs#L71

Connoropolous commented 1 year ago

merrrrrrrging