HomeProposalsProposal: Re-Enable Legacy Contract Execution

Proposal: Re-Enable Legacy Contract Execution

-

Summary

This proposal seeks approval for a patch to the chain core that will re-introduce support for legacy CosmWasm contract execution. The change consists of a small fix (~30–50 lines of code) that restores functionality broken during the v2.1.0 upgrade in 2022.

Affected contracts include not only a number of Astroport pools and potentially some remaining Terraswap pools. While re-enabling these contracts would make currently locked liquidity accessible again without requiring contract migration, the fix would also allow a lot more legacy contracts that include tax handling on chain to work again.

Context

During the v2.1.0 upgrade, custom Terra query support was changed, which caused contracts to stop working, which query the tax rate on chain or exchange rates from the oracle module. This affected several liquidity pools holding significant amounts of LUNC and USTC (besides other tokens).

Key findings from a node-level patch test:

  • The patch allows transactions against these contracts to succeed again.
  • Pools currently contain large amounts of locked liquidity.
  • Example balances (rounded):
    • LUNC/USTC pool: ~700M LUNC, ~6M USTC
    • bLUNA/LUNC pool: ~150M LUNC
    • MIR/USTC pool: ~6M USTC
    • ASTRO/USTC pool: ~3.9M USTC
    • kUST/USTC pool: ~2.9M USTC
  • Across 465 identified Astroport contracts:
    • ~27.4M USTC
    • ~959M LUNC

These tokens are currently unreachable due to the broken execution path. That means, traders can not use those pools at all (native ↔ native) or only in one direction (cw20 ← native).

Implications

Re-enabling execution is expected to instantly “re-open” these pools. This has two sides:

  • Positive: The chain and its users regain access to their liquidity. Tokens that should be in circulation become usable again. Further, there will be a lot more contracts that will start working again without the need of contract migration.
  • Negative: The affected pools are highly imbalanced. Immediately after activation, users and most likely arbitrage bots will drain the obvious opportunities. Example: the LUNC/USTC pool trades at roughly 2× the fair market ratio. This means large swings will happen within minutes of the fix going live. This could affect the price of LUNC and USTC both positive or negative on other DEXes/CEXes, too, in the short term.

Risks

  • Arbitrage drain: First movers (mostly bots) will capture outsized profits, not long-term holders.
  • Public perception: Can be framed as “unlocking” large amounts of USTC/LUNC supply, which may be viewed negatively, although these coins where always meant to be unlocked. The “locking” happened due to a core upgrade side-effect.
  • Timing: Liquidity providers in affected and currently disfunctional pools cannot “exit early” before the patch is applied.
  • Precedent: Some may argue this sets a precedent for L1 patches to support dApps. However, the breakage was originally caused by an L1 upgrade, and the fix is small and contained.

Conclusion

The patch restores functionality that was unintentionally broken. It unlocks liquidity for affected users and contracts, and will restore contract functionality for legacy contracts on chain.

Voting Options:

  • YES – Approve the patch to re-enable legacy contract execution.
  • NO – Do not apply the patch, legacy contracts remain unusable.
  • NO WITH VETO – Strong opposition.
  • ABSTAIN – No opinion.

Further information (not part of the proposal text)

The code changes have been done and can be seen here: fix: Legacy contracts using terra query variants by StrathCole · Pull Request #602 · classic-terra/core · GitHub

Additional test information:
I created a local test script which contains the original wasm (contract) code of four astroport contracts. The steps the test script does:

  1. Start a local chain with only one node using v1.1.0 of the chain
  2. deploy all four astroport pair contracts, instantiate them and test providing liquidity, swapping and withdrawing liquidity.
  3. go through all upgrades of the chain (i.e. v2.0.1, v2.1.1, v2.2.1, …, v3.5.1) and re-test liquidity and swap operations
  4. as expected from v2.1 on the liquidity providing still works, but swaps (native tokens) and withdrawal results in
Error: rpc error: code =Unknowndesc= rpc error: code =Unknowndesc= failed toexecute message; message index: 0: Generic error: Querier system error: Unsupported query type: unknown terra query variant: execute wasm contract failed [classic-terra/wasmd@v0.46.0-classic.3/x/wasm/keeper/keeper.go:396] With gas wanted: '18446744073709551615'and gas used: '187740' : unknown request
  1. upgrade to the local patched version and then re-run the tests. This confirmed that the swaps and withdrawals worked again afterwards:
{"height":"901","txhash":"9539ECA6A4B0622643BCA9C208741F2C0AB17AFBC931E4B489E657133A0
Adit 39
Adit 39https://www.adit39studio.com/
The world shall know PAIN

LEAVE A REPLY

Please enter your comment!
Please enter your name here

LATEST POSTS

The Benefits of Inclusive Terra Classic L1 Development Update v2.0 Proposal

The Terra Classic community has introduced a new governance proposal aimed at updating...

Does the Public Inquiry into Binance’s Custody of Terraform Labs Remaining LUNC and USTC Holdings Proposal Create Legal Problems?

Does the Public Inquiry into Binance’s Custody of Terraform Labs Remaining LUNC and USTC Holdings Proposal Create Legal Problems Overview This...

The Benefits of Final Burn of Remaining TFL Wallets Proposal

The Benefits of Final Burn of Remaining TFL Wallets Proposal Terraform Labs has fully left the crypto ecosystem. Most of the tokens connected to its past...

A Small Peek into the New LUNC Hyperlane UI Design

A Small Peek into the New LUNC Hyperlane UI Design The LUNCDaily team has...

Most Popular