Skip to content

fix(smart_contracts): detect removed procedures in refresh script#174

Merged
sallymoc merged 2 commits into
devfrom
fix/refresh-smart-contracts-detect-removed-methods
Jun 14, 2026
Merged

fix(smart_contracts): detect removed procedures in refresh script#174
sallymoc merged 2 commits into
devfrom
fix/refresh-smart-contracts-detect-removed-methods

Conversation

@sallymoc

Copy link
Copy Markdown
Contributor

Problem

The refresh-smart-contracts workflow detects changes by comparing a checksum of data/smart_contracts.json before/after running scripts/update_smart_contracts.py. When methods were removed from a contract upstream (e.g. methods 5 & 6 in qRWA.h), the JSON never changed, the checksum matched, and no PR was opened.

Root cause: merge_contracts() was additive-only for procedures — it added/updated procedures but never deleted ones that disappeared from the source ("in case they were manually added").

Fix

  • Prune a procedure when it has a sourceIdentifier (i.e. it was script-generated) and is absent from a successfully-fetched source — it was removed upstream.
  • Preserve procedures without a sourceIdentifier (genuine manual additions).
  • Guard pruning on fetch success so a transient GitHub outage can't wipe procedures.
  • Add run-log lines for new contracts, new procedures, and removed procedures so the GitHub Actions run log shows exactly what changed.

Data change

Running the script removes the two methods that were deleted from qRWA.h:

  • id 5CreateAssetReleasePoll
  • id 6VoteAssetRelease

sallymoc added 2 commits June 14, 2026 22:01
The merge logic was additive-only for procedures: methods removed
upstream were never deleted from smart_contracts.json, so the refresh
workflow's checksum never changed and no PR was opened.

Now a script-generated procedure (one with a sourceIdentifier) that is
absent from a successfully-fetched source is pruned. Manual procedures
(no sourceIdentifier) are preserved, and pruning is guarded on fetch
success so a transient GitHub outage cannot wipe procedures.

Also log new contracts, new procedures, and removed procedures so the
GitHub Actions run log shows what changed.

Applying the fix removes qRWA methods 5 (CreateAssetReleasePoll) and
6 (VoteAssetRelease), which were removed from qRWA.h.
Address code review: a 200 response with a truncated/garbage body parses
to zero procedures, which would wipe a contract's entire procedure list.
Only prune when the fresh fetch yielded at least one procedure
(fresh_has_procs); individually removed procedures are still pruned.

Also update the module docstring to describe the now-destructive merge
behavior and the fetch-failure guard.
@sallymoc sallymoc merged commit 1075de5 into dev Jun 14, 2026
1 check passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.27.1-rc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.27.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant