DNA ADDRESS != DNA entry address

I see that the address of the dna entry is different from the “official” DNA ADDRESS.
So using hdk::link_entries(&*hdk::DNA_ADDRESS, ...) doesn’t work since that’s not a valid base address for a link.
Instead I have to do a workaround of querying for the dna entry with hdk::query(EntryType::Dna) and use that address when linking.

If its a bug, can it be fixed so we can do hdk::link_entries(&*hdk::DNA_ADDRESS, ...) ?
Otherwise can we add a global for it like DNA_ENTRY_ADDRESS, so I don’t have to query the entry everytime I need this base address?

(I’m using v0.0.47-alpha1)

@lucksus @maackle @zippy

It could be the same problem for agent address. I’ll check it out.

Edit: Actually not. Agent entry address is same as AGENT_ADDRESS

what are you using to determine the “official” DNA ADDRESS? hc hash?

I’m guessing this is a bug

In fact, it was a bug that wasn’t hard to find!
Look at this Damien!

This variable ultimately ends up referenced as hdk::DNA_ADDRESS I think. So that seems to have always been wrong.

I just created a GH issue… thinking about even creating a PR since its like a one-liner.

1 Like

Oops, gotta read on.

It should get updated here. :frowning:

I wanted to look into it, and ended up reproducing it to do that… so I am seeing what you are seeing, having written it up in a test, from a fresh hc-happ-create project folder.

I’ll add this with steps to reproduce to the GH issue

Looking ever deeper into this (dang curiousity!)

Looks like in a lot of the places where the DNA address is returned, it is dealing in the thing stored as content INSIDE the Entry::Dna … so the raw DNA.

The get_dna function which is called in many places returns

That returned dna struct is then used around the code to call dna.address()

This line makes it more obvious how that address will differ from the committed Entry::Dna(dna) entry, if we return its address using something like…

...
let dna_entry = Entry::Dna(dna);
let dna_address = dna_entry.address();

during initialization, the dna entry is committed to the chain as