Skip to content

Envoy assumes that each DNA hash corresponds to exactly one HHA hash #130

@timotree3

Description

@timotree3

This is not true if two people publish the exact same happ. In that case there are two HHA hashes which both have the same DNA hash.

holo-envoy/src/index.ts

Lines 1209 to 1231 in 898ad4b

async recordHha(hha_hash) {
// dna2hha is add-only
if (!this.hhaExists(hha_hash)) {
log.info("Retrieve the hosted app cell_data using the anonymous installed_app_id: '%s'", hha_hash);
const appInfo = await this.callConductor("app", { installed_app_id: hha_hash });
if (!appInfo) {
throw new Error(`No app found with installed_app_id: ${hha_hash}`);
}
// TODO but leave it for now: I am operating under the assumption that each dna_hash can be only in one app (identified by hha_hash)
// Does this need to change?
appInfo.cell_data.forEach(cell => {
let dna_hash_string = Codec.HoloHash.encode("dna", cell.cell_id[0]); // cell.cell_id[0] is binary buffer of dna_hash
this.dna2hha[dna_hash_string] = hha_hash;
});
}
}
hhaExists(hha_hash) {
return Object.values(this.dna2hha).includes(hha_hash);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions