Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(contract-verifier): Fix verifier data migration #3608

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

popzxc
Copy link
Member

@popzxc popzxc commented Feb 13, 2025

Recent data migration for contract verifier turned out to be broken. This PR consists of two parts:

  1. Fix the migration
  2. Restore the corrupted data in the migrated databases.

Fixing the migration

Turns out, when using CSV format in COPY FROM STDIN, you don't need to escape backslashes (e.g. you should use \x instead of \\x). When backslash is escaped, the value is being treated as a string, not bytea. This resulted in values like \xd8792c840591d437dac9bbdc6c8d2096b41800c0 being inserted as \x5c7864383739326338343035393164343337646163396262646336633864323039366234313830306330.

The fix is simple: remove the backslash.

Another problem was that in the sanity check I didn't make sure that count of matching rows is actually not zero 🤦 . I've made the check significantly more strict.

Fixing the data

The logic is explained in the migration file. Thanks to the fact that migration is done on SQL side without transferring any data, it completes almost immediately.

Testing

To test it, I've done the following:

  • Using the corrupted dump from testnet, ran the migration and checked that the problem was fixed.
  • Using the dump of contracts_verification_info from testnet, made sure that now table is being ported correctly.

@popzxc popzxc force-pushed the popzxc-fix-contract-verifier branch from e030493 to 3909163 Compare February 13, 2025 09:51
@popzxc popzxc requested a review from slowli February 13, 2025 09:53
@popzxc popzxc force-pushed the popzxc-fix-contract-verifier branch from 3909163 to 3c1a83d Compare February 13, 2025 10:02
@popzxc popzxc added this pull request to the merge queue Feb 13, 2025
Merged via the queue into main with commit 0bb0c88 Feb 13, 2025
33 checks passed
@popzxc popzxc deleted the popzxc-fix-contract-verifier branch February 13, 2025 12:00
github-merge-queue bot pushed a commit that referenced this pull request Feb 13, 2025
🤖 I have created a release *beep* *boop*
---


##
[26.4.0](core-v26.3.0...core-v26.4.0)
(2025-02-13)


### Features

* Avail gas relay upgrade
([#3601](#3601))
([e32fee0](e32fee0))


### Bug Fixes

* **contract-verifier:** Fix verifier data migration
([#3608](#3608))
([0bb0c88](0bb0c88))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants