Closed Connoropolous closed 1 year ago
@pospi FYI @weswalla is back and they're taking over this from me
we've just landed the migration on the Acorn project, so have learned a few lessons along the way and feel prepared for this
@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.
Does this general integrity zome pattern look right?
Made a lot of progress, but a couple of new problems left to resolve:
hc_zome_rea_unit_lib
isn't compiling and complains that its LinkType
s aren't convertible to ScopedZomeType<LinkType>
. I think this might be due to incorrect trait bounds in anchored_record_helpers.rs
.hc_zome_dna_auth_resolver_integrity
are causing linker errors about duplicate definitions of entry_defs
. Two possible solutions, both requiring changes to the lib which you are welcome to make on its main branch:
hc_zome_rea_resource_specification_integrity::EntryTypes
). In this case you will probably need to parameterise hdk_records::rpc::call_zome_method
and its dependencies/dependants in order to specify the entry type struct.dna-auth-resolver
to use the built-in capability storage functionality of the HDK and do away with its integrity zome entirely.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:
hc_zome_rea_agent_integrity
cratehc_zome_rea_economic_event_integrity
crateWith (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).
I did the split on both sides, semantic and classes and for the classes I did all of them instead of being selective
Next step is integration tests I think. Seeing how much we broke along the way
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
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
Pushed the fix, that is letting us get the integration tests running
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
merrrrrrrging
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:
wasm32-unknown-unknown
target:rustup target add wasm32-unknown-unknown
Current HDK: 0.0.144
closes #275
Header
toAction
Element
toRecord
IndexSegment
entry type and its method implementations in the integrity zome, or removehdk_records
, along with integrity zome crate (or define in link type in each object type integrity zome and pass in the type to hdk_records functions)