Skip to content

Conversation

@elizabethengelman
Copy link
Collaborator

@elizabethengelman elizabethengelman commented Sep 10, 2025

What

Update the parsing done in stellar contract restore cmd to allow for more LedgerEntryChange patterns.

Why

We previously had a select few patterns that we were matching from the restore tx's changes, to get the updated TTL to return to the user on the CLI. However, we were missing some valid matches i.e.

[Restored(LedgerEntry { 
	last_modified_ledger_seq: 3895, 
	data: Ttl(TtlEntry { 
		key_hash: Hash(83a1270ef2b7bbe3e14e5c4b4538d071ad0a436ab4ef22a5f16a5dda26604b53),
		live_until_ledger_seq: 4694 }), 
	ext: V0 }),

 Restored(LedgerEntry { 
	last_modified_ledger_seq: 247, 
	data: ContractData(ContractDataEntry { 
			ext: V0, 
			contract: Contract(ContractId(Hash(bcb0fd9dfa6eadbf03049c1469716ac103ce5a37e917d9a4efde75b3cae0b5a1))), 
			key: Symbol(ScSymbol(StringM(COUNTER))), 
			durability: Persistent,
			val: U32(1)
		 }), 
	ext: V0 })]

Known limitations

I did a refactor that would allow for any LedgerEntryChange types, as long as the data field is a ttl entry (LedgerEntryData::Ttl), and then take the largest live_until_ledger_seq value of the change set. I would love another set of eyes on this for confirmation that this is ok. Since this is just impacting parsing and displaying the tx's result it should be fairly safe, as it won't effect the tx or restore logic at all.

@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Sep 10, 2025
@elizabethengelman elizabethengelman moved this from Backlog (Not Ready) to In Progress in DevX Sep 11, 2025
@elizabethengelman elizabethengelman marked this pull request as ready for review September 11, 2025 16:00
@elizabethengelman elizabethengelman enabled auto-merge (squash) September 15, 2025 15:58
@elizabethengelman elizabethengelman merged commit 3d999a7 into main Sep 15, 2025
31 checks passed
@elizabethengelman elizabethengelman deleted the fix/restore branch September 15, 2025 19:00
@github-project-automation github-project-automation bot moved this from In Progress to Done in DevX Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants