Example will be given current contract of Sputnik v2, to specify an accounts where this contract is deployed. Then script would spin up Sandbox, fork the state of the chain as of deployment of previous version of that contract and start applying all transactions again. For overall consistency all transactions from blockchain may need to be reapplied because there might be dependencies like sending NEAR or other tokens from another account to this accounts, etc.
Finally at the end state of the contract on MainNet and in the Sandbox is compared and shown to the developer in the diff. It’s possible there are expected differences, but majority of things should be the same.
Prerequisite: #39
See discussion: https://gov.near.org/t/discussion-smart-contract-upgrade-testing/4614