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

Add scripts/sns/find-failed-neurons #6385

Merged
merged 2 commits into from
Feb 10, 2025
Merged

Add scripts/sns/find-failed-neurons #6385

merged 2 commits into from
Feb 10, 2025

Conversation

dskloetd
Copy link
Contributor

Motivation

A while ago there was a bug where we didn't enforce the minimum neuron stake for SNS neurons in the UI.
This caused some people to transfer tokens to a governance canister subaccount, after which they couldn't create a neuron because the stake wasn't enough.

At the time I created a script to find such transactions that didn't turn into neurons to get an idea of the magnitude of the problem. I never got around to adding the script to the repo but this is that.

Changes

  1. Add helper script scripts/get-transactions which gets a range of transactions from index and archive canisters.
  2. Add scripts/sns/find-failed-neurons which based on a date range and SNS looks for staking transactions that didn't result in a neuron. Outputs the amount and a link to the account on the dashboard.

Tests

Tested manually:

$ scripts/sns/find-failed-neurons --start_timestamp 1725055200 --end_timestamp 1725228000 ogy
Checking SNS ORIGYN
Start timestamp refers to Sat Aug 31 00:00:00 CEST 2024
Binary searching for timestamp 1725055200
Searching in range [0, 553703) of length 553703. 20 steps remaining.
Searching in range [0, 276851) of length 276851. 19 steps remaining.
Searching in range [0, 138425) of length 138425. 18 steps remaining.
Searching in range [69213, 138425) of length 69212. 17 steps remaining.
Searching in range [69213, 103819) of length 34606. 16 steps remaining.
Searching in range [69213, 86516) of length 17303. 15 steps remaining.
Searching in range [77865, 86516) of length 8651. 14 steps remaining.
Searching in range [82191, 86516) of length 4325. 13 steps remaining.
Searching in range [82191, 84353) of length 2162. 12 steps remaining.
Searching in range [82191, 83272) of length 1081. 11 steps remaining.
Searching in range [82191, 82731) of length 540. 10 steps remaining.
Searching in range [82191, 82461) of length 270. 9 steps remaining.
Searching in range [82327, 82461) of length 134. 8 steps remaining.
Searching in range [82395, 82461) of length 66. 7 steps remaining.
Searching in range [82395, 82428) of length 33. 6 steps remaining.
Searching in range [82395, 82411) of length 16. 5 steps remaining.
Searching in range [82395, 82403) of length 8. 4 steps remaining.
Searching in range [82395, 82399) of length 4. 3 steps remaining.
Searching in range [82398, 82399) of length 1. 1 steps remaining.
Found index: End timestamp refers to Mon Sep  2 00:00:00 CEST 2024
Binary searching for timestamp 1725228000
Searching in range [0, 553704) of length 553704. 20 steps remaining.
Searching in range [0, 276852) of length 276852. 19 steps remaining.
Searching in range [0, 138426) of length 138426. 18 steps remaining.
Searching in range [69214, 138426) of length 69212. 17 steps remaining.
Searching in range [69214, 103820) of length 34606. 16 steps remaining.
Searching in range [69214, 86517) of length 17303. 15 steps remaining.
Searching in range [77866, 86517) of length 8651. 14 steps remaining.
Searching in range [82192, 86517) of length 4325. 13 steps remaining.
Searching in range [84355, 86517) of length 2162. 12 steps remaining.
Searching in range [84355, 85436) of length 1081. 11 steps remaining.
Searching in range [84355, 84895) of length 540. 10 steps remaining.
Searching in range [84355, 84625) of length 270. 9 steps remaining.
Searching in range [84355, 84490) of length 135. 8 steps remaining.
Searching in range [84355, 84422) of length 67. 7 steps remaining.
Searching in range [84355, 84388) of length 33. 6 steps remaining.
Searching in range [84355, 84371) of length 16. 5 steps remaining.
Searching in range [84364, 84371) of length 7. 4 steps remaining.
Searching in range [84364, 84367) of length 3. 3 steps remaining.
Searching in range [84366, 84367) of length 1. 1 steps remaining.
Found index: Start index: 82399, end index: 84367
Minimum stake: 88800000000

start 82399, end 84367

6479700000	https://dashboard.internetcomputer.org/sns/leu43-oiaaa-aaaaq-aadgq-cai/account/lnxxh-yaaaa-aaaaq-aadha-cai-fgyylfy.766816422deb3bb1b9f5a3e289e6b9ac981cb3721ecf343bbab96a12ef1935a0
15292346630	https://dashboard.internetcomputer.org/sns/leu43-oiaaa-aaaaq-aadgq-cai/account/lnxxh-yaaaa-aaaaq-aadha-cai-mz2eklq.a2bf3d36c12242023e0f0d12cd574e4d416d0a5f0c7ffafe0e3f0fa55df25c1d
11279750000	https://dashboard.internetcomputer.org/sns/leu43-oiaaa-aaaaq-aadgq-cai/account/lnxxh-yaaaa-aaaaq-aadha-cai-dptm2ta.f64e16468b1af5b042e1d4355b4b1a4ca69967d0e43b58f3353ae1c414a4eaf4

Todos

  • Add entry to changelog (if necessary).
    not necessary

@dskloetd dskloetd marked this pull request as ready for review February 10, 2025 13:33
@dskloetd dskloetd requested a review from a team as a code owner February 10, 2025 13:33
@dskloetd dskloetd enabled auto-merge February 10, 2025 13:33
Copy link
Contributor

@yhabib yhabib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@dskloetd dskloetd added this pull request to the merge queue Feb 10, 2025
Merged via the queue into main with commit 8c6291c Feb 10, 2025
32 checks passed
@dskloetd dskloetd deleted the kloet/ledger-scripts branch February 10, 2025 14:57
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.

2 participants