holochain / holochain-rust

DEPRECATED. The Holochain framework implemented in rust with a redux style internal state-model.
GNU General Public License v3.0
1.12k stars 268 forks source link

Testing with `hc test` ErrorGeneric("No CapTokenGrant entry type in chain") #1258

Open Connoropolous opened 5 years ago

Connoropolous commented 5 years ago
Connors-MacBook-Pro:dev-camp-tests-rust connor$ hc --version
hc 0.0.11-alpha1
Connors-MacBook-Pro:dev-camp-tests-rust connor$ hc test
Packaging files for testing to file: "/Users/connor/code/holochain/dev-camp/dev-camp-tests-rust/dist/dev-camp-tests-rust.dna.json"
> cargo build --release --target=wasm32-unknown-unknown
    Finished release [optimized] target(s) in 0.15s
> cargo build --release --target=wasm32-unknown-unknown
    Finished release [optimized] target(s) in 0.14s
Created DNA package file at "/Users/connor/code/holochain/dev-camp/dev-camp-tests-rust/dist/dev-camp-tests-rust.dna.json"
DNA hash: QmRfh6tnHqXitFgN4tC55p1jQXrbezohPvFQHe9KMxLoBN
Running tests in test/index.js
> node test/index.js
TAP version 13
# use the commit_entry function to add a person entry
Reading DNA from ./dist/dev-camp-tests-rust.dna.json
Failed to load instance alice from storage: ErrorGeneric("State could not be loaded due to NoneError")
Initializing new chain...
2019-04-12 15:45:50:alice: dna/initialize: Couldn't get DNA and agent from chain: ErrorGeneric("Agent entry not found")
2019-04-12 15:45:50:alice: dna/initialize: Initializing new chain from given DNA...
Starting instance "alice"...
2019-04-12 15:45:51:alice: debug/conductor: Holochain App Name instantiated
2019-04-12 15:45:51:alice: debug/net/handle: HandleStoreEntry: EntryData { dna_address: HashString("QmRfh6tnHqXitFgN4tC55p1jQXrbezohPvFQHe9KMxLoBN"), provider_agent_id: "HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui", entry_address: HashString("HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui"), entry_content: Object({"entry": Object({"AgentId": Object({"nick": String("alice"), "pub_sign_key": String("HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui")})}), "header": Object({"entry_type": String("AgentId"), "entry_address": String("HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui"), "provenances": Array([Array([String("HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui"), String("nHhWNS1QvInhVoPYhRfZef28XWEjwtROfDUvOGrqblEl4jcImgQ0lxnYwzwVllcZX+IfGTZM5WtiUgmV1TuaBA==")])]), "link": String("QmNh2qkD3UanCyg1fKb3YBvDWbkRPaFhCi4WHbT97cemZY"), "link_same_type": Null, "link_update_delete": Null, "timestamp": String("2019-04-12T19:45:51+00:00")})}) }
2019-04-12 15:45:51:alice: debug/net/handle: HandleSendMessage: MessageData { dna_address: HashString("QmRfh6tnHqXitFgN4tC55p1jQXrbezohPvFQHe9KMxLoBN"), request_id: "puid-1-2", to_agent_id: "HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui", from_agent_id: "HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui", content: Object({"RequestValidationPackage": String("HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui")}) }
2019-04-12 15:45:51:alice: Sending validation package of entry HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui to agent HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui
2019-04-12 15:45:51:alice: debug/net/handle: SendMessageResult: MessageData { dna_address: HashString("QmRfh6tnHqXitFgN4tC55p1jQXrbezohPvFQHe9KMxLoBN"), request_id: "puid-1-2", to_agent_id: "HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui", from_agent_id: "HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui", content: Object({"ValidationPackage": Object({"chain_header": Object({"entry_type": String("AgentId"), "entry_address": String("HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui"), "provenances": Array([Array([String("HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui"), String("nHhWNS1QvInhVoPYhRfZef28XWEjwtROfDUvOGrqblEl4jcImgQ0lxnYwzwVllcZX+IfGTZM5WtiUgmV1TuaBA==")])]), "link": String("QmNh2qkD3UanCyg1fKb3YBvDWbkRPaFhCi4WHbT97cemZY"), "link_same_type": Null, "link_update_delete": Null, "timestamp": String("2019-04-12T19:45:51+00:00")}), "source_chain_entries": Null, "source_chain_headers": Null, "custom": Null})}) }
2019-04-12 15:45:51:alice: debug/workflow/hold_entry: got validation package
2019-04-12 15:45:51:alice: debug/workflow/hold_entry: is valid! HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui
2019-04-12 15:45:51:alice: debug/workflow/hold_entry: HOLDING: HcScjwO9ji9633ZYxa6IYubHJHW6ctfoufv5eq4F7ZOxay8wR76FP4xeG9pY3ui
Exception occurred while calling zome function:  Error: internal error in Neon module: called `Result::unwrap()` on an `Err` value: ErrorGeneric("No CapTokenGrant entry type in chain")
    at DnaInstance.call (/Users/connor/code/holochain/dev-camp/dev-camp-tests-rust/test/node_modules/@holochain/holochain-nodejs/index.js:99:40)
Connoropolous commented 5 years ago

I've discovered that this is a product of having a define_zome! that looks like this:

define_zome! {
    entries: []

    genesis: || { Ok(()) }

    functions: []

    traits: {}
}

I figured this out by adding the following, then it works!

define_zome! {
    entries: []

    genesis: || { Ok(()) }

    functions: []

    traits: {
        hc_public []
    }
}

@zippy drawing your attention to this one now, we just need some type of improved error message for this I think. I still believe in the value of an empty zome