Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
timotree3 opened this issue Apr 30, 2021 · 0 comments
Open

Comments

@timotree3
Copy link
Contributor

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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant