ahadda5
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Check duplicate attestations at Validator launch to avoid unnecessary slashing **Author(s):** Ash Haddad, Prysmatic Labs *Last Updated: Apr 21, 2021* [TOC] ## Background In case of using the same keystore for multiple validators slashing will occur unintentionally (non-malicious attempts). This is most likely happening when users are coping keystore files during migration between machine or Eth2 client implementations. The aim of this feature is to prevent this accidental event from happening by implementing a check at the launch of the validator. A number of epochs will be monitored for duplication against the pubKeys before starting to attest; this way the user is saved running a doppelganger and getting slashed in the process. ## Solution The validator should check **N=2** number of epochs before it starts attesting. The validator will check that the beacon-chain attestation for its keys matches that of the validator.db; otherwise this fatal message is thrown to the user and the validator exits. > Validator key 0x****** seems to be running elsewhere. This process will exit, avoiding a proposer or attester slashing event. Please ensure you are not running your validator in two places simultaneously. N epochs is equal to the maximum number of slots during which an attestation can be propagated ATTESTATION_PROPAGATION_SLOT_RANGE (32) divided by the SLOTS_PER_EPOCH(32)= 1 epoch ( [Nimus](https://github.com/status-im/nimbus-eth2/pull/2244) ). We then add to 1 epoch for more certainity. :::info Statistically, it is important to note that 2 or even 4 missed attestations, at the launch of the validator is very minuscule compared to a potential slashing: * 4 Missed attestation ~ 4 * 3 * BaseReward which is a mere 4*10^4 Wei * Slashing Penalty = effective.balance//MIN_SLASHING_PENALTY_QUOTIENT = 0.25 ETH for new-stacker(32 Eth) first time offenders. Refer to [Rewards&Penalties](https://benjaminion.xyz/eth2-annotated-spec/phase0/beacon-chain/#rewards-and-penalties). * Assume the probability of slashing by mistakenly duplicating keys across validators processes happens roughly 30 times for every 1000 new installs(reported discussions on discord). The expected outcome (EV) for missed attestation due to the extra guard check vs duplicate-keys slashing happening is as below; demonstrating that the extra check's incurred cost is less than 10 magnitude of power and is worth the implementation. * EV (missed attestation) = 100% * 4 * 10^4 Wei = 4*10^4 Wei * EV (slashing due to duplicate keys) = 0.3% * 0.25 Eth = 0.0075 Eth = 7.5 * 10^15 Wei ::: The following changes to the validator will take place: 1. Validator starts up and loads the relevant keys. The current flow of waiting for the beacon synch is still respected , however before the runner starts looping we do our check. 2. Loops through for N epocks from the current slot plus N-epochs-worth of slots. 3. At every slot, Validator performs rpc call to the beacon node to retrieve its signed blocks. There are two types of Block data we check: one for the proposals and another for the attestations. 4. For Proposals, the ID of the proposer is compared against the validator's keys. For the Attestations,the committee ids are checked against the validator's keys. 5. If any match is found log a fatal error(see above) and exit validator. ## Benchmarking The above new feature should be tested with 1, 200 and 2000+ Keys to benchmark the added check on the startup of the validator. ## Work estimates 4 days for 1 SWE ## Other implementations Other client Eth2 implementation are implementing this feature: * [Lighthouse](https://github.com/sigp/lighthouse/pull/2230) * [Nimus](https://github.com/status-im/nimbus-eth2/pull/2244) #### Nimus implementation A gossipSlashingProtection flag is added. It is set to 'warn' the user by default, which will become 'stop' in the future after further testing/experimentation.The N epochs to check is chosen to be ATTESTATION_PROPAGATION_SLOT_RANGE (32) div by the SLOTS_PER_EPOCH(32) and referred to as GUARD_EPOCHS . Nimus even safeguards against the possibility of having two clients starting at the same time. The probability of trigging a slashable condition is 1/n where n is the # of epochs one waits before proposing or attesting. Nimus implements a broadcast starter epoch and a probe epoch. The broadcast is equal to the current beacon chain own slot, plus + 2(set value in the code). Also a probEpoch which check future attestation for duplicates, equal to the current slot + 1 + random(1 or 2) . The validator duplicate deduction becomes if ``` current beacon epoch < broadcastStartEpoch && probeEpoch <= current beacon epoch <= probEpoch + GUARD_EPOCHS ``` The one note to keep in mind is the slight delay in waiting for the current slot of the validator to reach the 'future' prob epoch. However a missed N attestations #### Lighthouse implementation The validator waits for 2 epochs . "By default, Lighthouse will delay startup for two epochs and monitor for attestations on the network by any of the validators managed by this client." Ligthouse implements this by scanning the list of own validator attestation indices with that of the beacon's attestations for 2 epochs. It then gets the validators doppelganger; if found throws an error and exits. Also Lighthouse added a standard endpoint [eth2 API](https://github.com/ethereum/eth2.0-APIs/pull/131) request.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully