Pin high usage Code IDs on Osmosis

This proposal would pin the code IDs underlying the contracts with the most executions and calls on Osmosis, resulting in lower gas costs per transaction interacting with them.

This will be a routine proposal that maintains the list of pinned contracts by pinning and unpinning specific Code IDs based on contract usage, as the Code IDs in use by a contract may change over time.

Proposed Code IDs:

Code ID Project Contract Executes
400 Levana Markets 2m+
162 CALC DCA 1.3m+
216 Mars Red Bank 140k+
308 Mars Credit Manager 78k+
326 Skip Skip Swap Entry Point 59k
429 Skip Skip Swap Entry Point2 31k
41 TFM Router 50k
6 Osmosis Rate Limiter 0 (Calls not visible but incur gas with every transfer)
148 Osmosis Transmuter v1 0 (Calls not visible but every transmuter swap incurs gas)
254 Osmosis Transmuter v2 0 (Calls not visible but every transmuter swap incurs gas)

Target On-Chain Date: 12th February 2024

1 Like

Is there an explanation of what pinning exactly does?

It causes those contracts to be held in the wasm cache so they can be accessed more quickly.

I’m unsure of the specification implications for validators, but as these are all frequently used contracts, they will often be loaded for each block anyway so they should be minimal.

Oddly, there doesn’t seem to be any documentation on this on the cosmwasm documentation, and this is the only information I can find on Git Hub.

When going to load this proposal, it turns out that any Code ID uploaded by Governance gets auto-pinned!

This means that I am dropping the two Swaprouter codes and the Pyth code from this list as they are already pinned.

It also confirms that we shouldn’t see significant performance impact for validators in other areas since we already have 31 contracts pinned.

When we next do a routine pinning proposal (since at least one of these is getting an update in the next few weeks!) then we should propose unpinning some of the obsolete contracts too.

Hmmm does it make sense to put forth a prop then?

Yes - it preloads these contracts and should reduce the costs.

I tested this on Testnet before loading with a couple of contracts and saw about a 25% gas reduction there.

1 Like

That is quite a lot and only improves UX.

If I understand this correctly this means that every contract with an ID uploaded through governance (so not the contracts uploaded at a later moment through a whitelisted address) are automatically pinned?

Upside, we should indeed not expend weird behaviour on the validator nodes since it is already a common practice. That is quite the relief imo, since it means we are not experimenting on the chain ^^

1 Like