Skip to content

Smart Contracts Incremental Deployment Technique

Didi edited this page Oct 3, 2023 · 2 revisions

The objective of the smart contracts incremental deployment is to avoid re-deploying logic contracts which haven't changed.

The core logic sits in ops-scripts/libs/common:codeChanged.

The major challenges are:

  • Immutable value holes set during construction time. Without handling this case, the logic contract will not match binary-wise the deployed contract. This is resolved by retroactively holing (replacing with zeroes) the values.
  • External library holes.
  • Imperfect algorithm: the current algorithm for detecting code changes can return wrong results in some cases, see https://github.com/superfluid-finance/protocol-monorepo/issues/1448

Also. the current detection logic will often flag a contract for deployment although no code was changed, e.g. because of a compiler update. This doesn't however cause any real harm, just makes an upgrade-deployment more expensive in tx fees than it had to be.
Until now, tx cost for deployments are significant only on Ethereum Mainnet.

We have not found ecosystem-wide tooling for this kind of optimization.

Clone this wiki locally