In YUL there are two opcodes to load and store immutables. Immutables are indexed so we can store them just as a byte array. Storing is only allowed in the constructor (in EVM they are constants in the runtime code). We'd instead store them tied to the contract before returning from the constructor; the contract can then load them lazily on the first access. Delegate calls prevent us from storing them in regular contract storage.
To make it work for upgradable contracts using set_code_hash we must require that the new code was uploaded and instantiated, otherwise the immutables are missing.
In YUL there are two opcodes to load and store immutables. Immutables are indexed so we can store them just as a byte array. Storing is only allowed in the constructor (in EVM they are constants in the runtime code). We'd instead store them tied to the contract before returning from the constructor; the contract can then load them lazily on the first access. Delegate calls prevent us from storing them in regular contract storage.
To make it work for upgradable contracts using
set_code_hash
we must require that the new code was uploaded and instantiated, otherwise the immutables are missing.