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

OCT-2327: Adds migration for nullifying uq score for sybil accounts #632

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions backend/app/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
"0x51c1c7f1e168a36bf1fabfd91e98b43476a6b14d",
"0x3df13b9bd79158f0cccddd0833cf774178e3d2e9",
"0xb9573982875b83aadc1296726e2ae77d13d9b98f",
"0xe862e2c1ca94eacfede3c95a217c15ef0086a29d",
"0x0442a9abbc93058a873c371f21cc366338254a88",
"0x0194325bf525be0d4fbb0856894ced74da3b8356",
"0x399e0ae23663f27181ebb4e66ec504b3aab25541",
Expand Down Expand Up @@ -262,7 +261,6 @@
"0x6eeb37b9757dca963120f61c7e0e0160469a44d3",
"0x616cad18642f45d3fa5fcaad0a2d81764a9cba84",
"0xdc1d963d21c9c1bff7b6bea6e10080daa9b4fc51",
"0x8073639b11994c549eda58fc3cd7132a72aadf10",
"0xe52c39327ff7576baec3dbfef0787bd62db6d726",
"0x8f21bd39fcaea3a729d46339a383081ecb7e84e0",
"0x8fb7087336678f36e42313f6130567a109a8e73d",
Expand Down Expand Up @@ -541,7 +539,6 @@
"0xFd37f4625CA5816157D55a5b3F7Dd8DD5F8a0C2F",
"0x2D4ac9c27ffFCd87D7fA2619F537C7Eb0db96fb7",
"0x9E6cdAfF95f4Bb1A21Ce2f81F7655E2aaC53840a",
"0x9dcba70b2dfe5807e2a847e065ebb666791f8b8a",
"0xff6d6a7718a234a84f740480dbb07f6c09cf1cd5",
"0x69DC230B06A15796e3f42bAF706e0e55d4D5eAA1",
"0x535b3FC92C40823B5b28DF471491F6b5dD5fc4e8",
Expand Down Expand Up @@ -622,7 +619,6 @@
"0x072001B736B049934eb1e66bcBBc281d010Fe7b6",
"0x8d4C0ebB98b259f40f783924A78c1b1affde200e",
"0xEe549CC0a0Ab1AEEa4bB326A1DE9fD1684dD83b6",
"0x4D5B28d08e8c00e041053b0dc584e00e6997Daa3",
"0x72337D25034d5a27fC10DcE0C893FD29C1301D5b",
"0x65C20b3E50Fc7575FDEa5a76F99a2c4140155531",
"0x58F7ff14700A754a652B3E6F5Edcb51e617C4e86",
Expand Down Expand Up @@ -787,7 +783,6 @@
"0x2b88fD6240E0ce71e3048B612088e76Ab8D7d634",
"0xc8b0D32bc09Fb11C12C82582825C1e6b624822b8",
"0xb749A586080436e616f097f193Ba9CB6A25E7Ea6",
"0xF3Ad97364bcCC3eA0582Ede58C363888f8C4ec85",
"0x63C3329720B993DEC8aF0018FB083dcBa94E49e5",
"0x99C9bC20D9F57a0c19136E10987fB234abdF3A5C",
"0x7986DEBCbc2709435461CBe6E0D73f62c19bFa95",
Expand Down Expand Up @@ -828,7 +823,6 @@
"0x7Bc48221928F11184b376dA7A57650768DFd3332",
"0x23C0C5e0D894d006E4fE4520B6c3d91b7F9EF7Ab",
"0x1e90474d2e83e7b7dd45553156beb316845e66a4",
"0x9f000bfb33b0b63fce685b538b1a8af079b57d93",
"0x99e94142353411264731105Fe38Ff02dfe1f3c3A",
"0xb22981ba3fe1de2325935c91a3b717168fb86714",
"0xa61ed6d962af39adda5c405ce76f625b5c3f81dd",
Expand All @@ -843,8 +837,6 @@
"0xde0e98F0Ffb36Ec69DF57B8cC7Ac886f506E9AE6",
"0x4Ef22A7356D96dbf95a7FdEaD4a196A668e75B38",
"0x7D2e4D645c0Acc5A6Bf596B612caB351864f4090",
"0xa64f2228ccec96076c82abb903021c33859082f8",
"0xbaba775a0400a5e442335ceaa4820edb1ded8f73",
"0xd6fcd2f85fe975bb9b0f3c1b1c6802bb09d33e43",
"0xc583789751910E39Fd2Ddb988AD05567Bcd81334",
"0x745F933c33ab89d8f8437eaCF176A2C8c0DD63a0",
Expand Down Expand Up @@ -961,11 +953,24 @@
"0xe04f0abe1933499ff1d075fa10738ce7aad26b1a",
"0xadd7b1e78f0e59d96135c5240e1175d5a7dc210d",
"0x094b75eedf58a83af4d37694b7532691fb26570e",
"0xf3ad97364bccc3ea0582ede58c363888f8c4ec85",
"0xbaba775a0400a5e442335ceaa4820edb1ded8f73",
"0x9dcba70b2dfe5807e2a847e065ebb666791f8b8a",
"0x63b1efc5602c0023bbb373f2350cf34c2e5f8669",
"0xa64f2228ccec96076c82abb903021c33859082f8",
"0x8073639b11994c549eda58fc3cd7132a72aadf10",
"0x4d5b28d08e8c00e041053b0dc584e00e6997daa3",
"0xe862e2c1ca94eacfede3c95a217c15ef0086a29d",
"0x8682bddfb5fd9484a0a19a85ca4274caa084106d",
"0x9f000bfb33b0b63fce685b538b1a8af079b57d93",
}
TIMEOUT_LIST_NOT_MAINNET = {
"0xdf486eec7b89c390569194834a2f7a71da05ee13",
"0x689f1a51c177cce66e3afdca4b1ded7721f531f9",
"0x018d43ac91432d00c4ad1531c98b6ccd2b352538",
"0xd0a7c12f82bf981009a1f1cc525d64c123002ba0",
"0xca50c6c165d19ab38cc7935ff84f214a483a5494",
"0x747e6abc102222f1df65c662540ddf471241a644",
}

GUEST_LIST_STAMP_PROVIDERS = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""Reduce UQ score for sybil accounts

Revision ID: f15bcdf982db
Revises: 976c7c2adb0f
Create Date: 2025-01-16 15:48:12.488871

"""
from alembic import op
import sqlalchemy as sa
from eth_utils import to_checksum_address


# revision identifiers, used by Alembic.
revision = "f15bcdf982db"
down_revision = "976c7c2adb0f"
branch_labels = None
depends_on = None


def upgrade():
epoch = 6
addresses = [
"0xf3ad97364bccc3ea0582ede58c363888f8c4ec85",
"0xbaba775a0400a5e442335ceaa4820edb1ded8f73",
"0x9dcba70b2dfe5807e2a847e065ebb666791f8b8a",
"0x63b1efc5602c0023bbb373f2350cf34c2e5f8669",
"0xa64f2228ccec96076c82abb903021c33859082f8",
"0x8073639b11994c549eda58fc3cd7132a72aadf10",
"0x4d5b28d08e8c00e041053b0dc584e00e6997daa3",
"0xe862e2c1ca94eacfede3c95a217c15ef0086a29d",
"0x8682bddfb5fd9484a0a19a85ca4274caa084106d",
"0x9f000bfb33b0b63fce685b538b1a8af079b57d93",
# Testing address
"0xd0a7c12f82bf981009a1f1cc525d64c123002ba0",
"0xca50c6c165d19ab38cc7935ff84f214a483a5494",
"0x747e6abc102222f1df65c662540ddf471241a644",
]
# INFO: remember to checksum addresses :)
checksum_addresses = [to_checksum_address(address) for address in addresses]

nullify_uq_scores_query = """\
UPDATE uniqueness_quotients
SET score = '0'
WHERE epoch = :epoch
AND user_id IN (SELECT id FROM users WHERE address IN :addresses);
"""

session = op.get_context().bind

session.execute(
sa.text(nullify_uq_scores_query),
{"epoch": epoch, "addresses": tuple(checksum_addresses)},
)

session.commit()


def downgrade():
pass