CreatePair should snapshot factory discount registry so new pairs are not unwired #536
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#536
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Parent: #535. Immediate ops (wire the three live economic pairs) stay there.
Pair
instantiatealways savesDISCOUNT_REGISTRY = None. FactoryCreatePairdoes not pass a registry, and factoryConfigdoes not even store one —SetDiscountRegistry*only forwards to already indexed pairs. Any listing after the last governance sweep is unwired until a manual tx (this is how UST1/cUSTC, UST1/USTR, and cLUNC/UST1 launched).Direction (agreed)
Do not rely on operators remembering a post-create sweep. Persist the canonical registry on the factory and copy it into new pairs at instantiate. Existing pairs are not fixed by this issue — that is #535.
Scope (deploy + migrate)
Config: adddiscount_registry: Option<Addr>with serde defaultNoneso existing columbus-5 state migrates.SetDiscountRegistryAll/SetDiscountRegistryBatchwithSome(registry)also write the factory pointer (so the nextCreatePairinherits it). Clearing via All/Batch (None) should clear the factory pointer. Single-pairSetDiscountRegistryshould not change the factory default.UpdateConfig { discount_registry }so governance can set the pointer without touching pairs.CreatePaircopiesconfig.discount_registryintoPairInstantiateMsg.msg.discount_registryinstead of hardcodedNone(optional field, defaultNone).GetDiscountRegistry(today it is indocs/contracts-terraclassic.mdbut not inQueryMsg— live wasm returnsunknown variant). Needed so the dApp can stop assuming every pair is wired (#535 note).set_discount_registryas belt-and-suspenders until this ships; then it is optional.Tests
CreatePairafter All/Batch inherit the registry (raw/GetDiscountRegistry).CreatePairbefore any factory pointer remainsNone.discount_registryfield →None.SetDiscountRegistrydoes not change factory config pointer.GetDiscountRegistryreturns the storedOption<Addr>.Verify
make test-contracts. After migrate on LocalTerra: create a pair, confirm registry is set without a follow-upSetDiscountRegistry.Out of scope
marked as related to #535
mentioned in issue #535
mentioned in commit
4d62c40091mentioned in merge request !1065
marked as related to #538
mentioned in issue #538
mentioned in commit
651cb642a7!1065 merged to
main(651cb642). In-scope #536 AC is onmain(factory pointer + CreatePair inherit +GetDiscountRegistry;make verify-issue-5365/5 after merge).Remaining work stays on #538 (do not close that issue):
config.discount_registryafter columbus-5 / LocalTerra migrate (All/Batch orUpdateConfig)SetDiscountRegistry)GetDiscountRegistry(Swap/Pool still assume wired unless #537 raw probe)UpdateConfigcan set but not clear the pointer; clear via All/Batch withnull.mentioned in commit ea2e48b6911463f3a54457bcb92f93dc63abb228
mentioned in commit
e6d407f490mentioned in merge request !1072
columbus-5 factory 1.8.0 + pair 1.14.0 store/migrate is complete (#538 ops).
1E031782200FDA99FB6FA75844D164E55594B0AE330EEA76B17619BA8FC8F240→ code 11585,data_hash4BD5A8D9…3298454C3254261008D77CBF94CC091C08E2B85C3A232E8095F0EC967D62DAF9C3D5AA→ code 11586,data_hashBD4AD1A1…ED87BFconfig.pair_code_id11586;config.discount_registry=terra1wcczsdk7jwj99n3my6wx8wr4ee0hn6yaapgd792lgx5elrdtrn2scfnecz{"get_discount_registry":{}}returns that registry addressIn-scope #536 AC was already on main via !1065. Remaining LocalTerra inherit check + optional dApp query stay on #538.
mentioned in merge request !1075