How does the NNS programmatically update its code upon approval of a proposal?

When a proposal is accepted, I’m trying to figure out how the NNS goes about programmatically pulling the updated code and then how it programmatically gets the .wasm file for that new code in order to install as the upgraded .wasm code for the canister it’s upgrading.

I’ll need to know how to do this for my own dapp that I’m building that is designed to be pretty much what @dominicwilliams described as a “wApp” in this Tweet

Hi @Jesse. The NNS doesn’t actually pull the code. The proposals to update the canisters include the WASM that will be installed if the proposal is executed.

On those proposals, a SHA is included of the artifact that is in the proposal, as well as instructions about how to reproduce the build from the GIT version referenced so that anyone can verify that the submitted WASM matches the advertised GIT version.

For SNS upgrades, however, the WASM is retrieved by the SNS governance canister from SNS-W via an inter-canister message, and then performs the upgrade (in the case of the root canister) or asks the root canister to perform the upgrade with the WASM.

Does that help at all?