Resolve a Tezos global constant before comparing contract code

Two scripts can display different source text while one embeds a shared expression by hash. A global constant reference must be resolved in its chain context to compare expanded behavior.

Follow the expression hash

When a Michelson script contains the form below, copy the complete expr hash from the real script. Obtain the registered expression from a trusted source or its registration operation and verify its hash with the Octez script-expression hashing tools for that representation.

constant "expr…"

For example, a constant resolving to integer 999 can occur where the expanded Micheline expression contains that integer. Follow nested references before comparing expressions, retaining the original script for byte-level comparisons.

Keep network registration separate

A hash describes an expression, while registration makes it available in a particular chain context. Reusing an origination script on another network can fail if that context lacks a referenced constant. Check dependencies before constructing the replacement origination. octez.tezos.com Octez protocol documentation