I want to verify on-chain that a contract (from a different chain) has a specific value on a variable. I am able to get the proof using eth_getProof and have access to the state root, so i have no problem actually verifying the proof itself.
What I'm having problem with is being convinced that the proof is for the specific contract at the specific address I want it to be from, since the leafs of the state trie don't contain the address of the account.
I understand that the sha3 hash of the account's address is encoded on the keys of each node on the proof, since that is how the trie DB is navigated, but the idea of having to reconstruct that key from the nibbles of each RLP encoded node seems really complex.
Is there an easier way to get the data of what address the proof is for? Are there any solidity libraries or resources that could solve this for me?