beaker icon indicating copy to clipboard operation
beaker copied to clipboard

Add method to check that you're interacting with an app that matches the spec

Open barnjamin opened this issue 2 years ago • 4 comments

In the case that something with the contract changes (schema, logic) it'd be good to offer a method to verify that the app being interacted with matches what you expect.

barnjamin avatar Aug 16 '22 13:08 barnjamin

How you can archive this without storing a hash or summary of the state of the contract? May be checking the approval hash? Do you have any thoughts on this?

ernestosperanza avatar Aug 22 '22 20:08 ernestosperanza

We should be able to generate the hash of the approval/clear programs you have locally. We can then retrieve the app id of the one you intend to interact with, hash it, and compare.

This will not account for simple things like scratch var index variance across compiles of the otherwise same contract

barnjamin avatar Aug 22 '22 21:08 barnjamin

Great, where it's been compiled the program to get the hash? It's generating a teal file? Or just text. And where should I place this feature? Thanks

ernestosperanza avatar Aug 23 '22 22:08 ernestosperanza

I think the application client is a reasonable spot, I've not thought much about the interface but for now just a method like verify_something that compares the local approval/clear binary and schemas with the remote one given the app Id. Wdyt?

barnjamin avatar Aug 23 '22 22:08 barnjamin