ä»åã¯BeaconChainã®Attestationã«ã¤ãã¦å¦ãã ãã¨ãæ´çããããã«è¨äºã«ããã
ãªããAttestationã®ä»æ§ã«ã¤ãã¦ã¯åºæ¬çã«ä»¥ä¸ã®å
¬å¼ã®specãåç
§ããã
github.com
- åºç¤ç¥è
- Attestationã¨ã¯
- Attestationã«å¯¾ããå ±é ¬ã¨ããã«ãã£
- LMDã¨FFGã®å¤å®ã¿ã¤ãã³ã°
- Attestationã®slashingæ¡ä»¶
- çåç¹
- åè
åºç¤ç¥è
Beacon Chainã§ã¯epochã¨slotã¨ããï¼ã¤ã®æéã®åä½ãåå¨ããã1epoch = 32 slotã§ããã1 slot = 12 secã§ãããslotãæå°ã®æéåä½ã¨ãªãã
ã¾ããValidatorã¯Committeeã«å²ãå½ã¦ãããCommitteeã¯slotã«å²ãå½ã¦ãããã
1 slotã«å²ãå½ã¦ãããCommitteeã®æ°ã¯æ大64åã§ããã1 Committeeã«å«ã¾ããValidatorã®æ°ã¯ Active Validator / (32 * 64)ã¨ãªããç¾å¨ã¯Active Validatorã411,865ãªã®ã§ã1ã¤ã®Committeeã«å¤§ä½201ã®Validatorãå²ãå½ã¦ããã¦ããã
slotã«å²ãå½ã¦ãããValidatorã®ä¸ããä¸äººã ããBlock Proposerã¨ãã¦é¸åºãããããã以å¤ã®Validatorã¯ãã®slotã«å¯¾ããvoteãè¡ãAttestatorã¨ãªãã
Attestationã¨ã¯
Eth 2.0ã«ããã¦ããããã¯ã«æ£å½æ§ãä¸ããããã®æ票ã®ãã¨ãAttestationã¨å¼ã¶ã
Attestationã«ã¯Eth2.0ã§æ¡ç¨ããã¦ããï¼ã¤ã®ã³ã³ã»ã³ãµã¹ã«ã¼ã«ã§ãããLMD-GHOSTã¨Casper FFGã®ï¼ã¤ã®æ票ãå«ãã
Attestationã®æ§é
class Attestation(Container): aggregation_bits: Bitlist[MAX_VALIDATORS_PER_COMMITTEE] data: AttestationData signature: BLSSignature
- aggregation_bits: Attest(=Vote)ãè¡ã£ãvalidatorã®bit表ç¾
- data: voteã®å 容
- signature: éç´ããBLSç½²å
Attestationã¯éè¤ããattest(=vote)ã®å 容ãéç´ãããã®ã§ãããéç´ã«ã¤ãã¦ã¯å¾è¿°ããã
AttestationDataã®æ§é
class AttestationData(Container): slot: Slot index: CommitteeIndex # LMD GHOST vote beacon_block_root: Root # FFG vote source: Checkpoint target: Checkpoint
- slot: ãã®Attestationãè¡ã£ãvalidatorãå²ãå½ã¦ããã¦ããslot
- index: ãã®Attestationãè¡ã£ãvalidatorãæå±ããcommitteeã®index
- beacon_block_root: ç¾å¨ã®epocå ã®æ票ãããããã¯ã®Rootå¤(LMD GHOSTã®vote)
- source: ãã®Attestationãè¡ã£ãvalidatorãæ£å½ã¨ä¿¡ãã¦ããjustifyãããepoch
- target: ãã®Attestationã§æ£å½ã¨ã¿ãªãepoch(é常ã¯ç¾å¨ã®epocï¼
Validatorã¯ãã®Dataã«å¯¾ãã¦BLSç½²åãä»ãã¦ããã¼ããã£ã¹ãããã
Attestationãæå¹ã¨ã¿ãªãããæ¡ä»¶
1. AttestationãAttestationData.slotã¨åä¸ã®epochã®ãããã¯ã«å¯¾ãã¦ã®æ票ã§ãããã¨ã
1. Attestationã®å¯¾è±¡ããAttestationData.slotããåã®ãããã¯ã«å¯¾ããæ票ã§ãããã¨
1. AttestationData.slotãç¾å¨ã®slotãã32slot以å
ã§ãããã¨
ï¼çªç®ã®æ¡ä»¶ãå°ã詳ãã説æããã¨ãã¤ã¾ãã¯Validatorã¯Attestationãããã¼ããã£ã¹ãããã¿ã¤ã ãªããããããã¨ãããã¨ã
é ãããæ票ï¼33slot以ä¸ã®æéãçµéãããã®ï¼ã¯ç¡å¹ã¨ããããã¾ããå¾è¿°ãããæå¹ã§ãã£ã¦ããæ票ãé ãå ´åã¯rewardãæ¸ãã
Attestationã®éç´ï¼Aggregationï¼
voteã¯ãã®æ§é ä¸ãã»ã¨ãã©ã®å ´åãåä¸ã®å
容ãã¤ã¾ãåä¸ã®å¯¾è±¡ã«å¯¾ãã¦ã®æ票ã§åãå°½ããããã
æ£å¸¸ã«blockãçæããã¦ããéã¯ã常ã«ãåãCommitteeã®validatorã¯beacon_block_rootã«ï¼ã¤åã®ãããã¯ãæå®ããsourceã«ã¯current - 1ã®epochããtargetã«ã¯ç¾å¨ã®epochãæå®ãããã¨ã«ãªãã
ãã®ããã«ãattesteã¯éè¤ããå
容ã大éã«åå¨ããããããããã¯ã¼ã¯å¸¯åãBlockãã¼ã¿ã®ç¯ç´ã®ããã«éç´ãããAttestationã«å¤æãã¦ãæçµçã«ãããã¯ã«æ ¼ç´ãããã
ã¾ããAttestationã«éç´ã§ããvoteã®æ大æ°ã¯ï¼ã¤ã®Committeeã®åå 人æ°ã¨åãã§ãããåãAttestationDataãæã¤voteã¯ï¼ã¤ã®Attestationã«éç´ãããã
1slotã®Committeeã¯æ大ã§64ã°ã«ã¼ããå²ãå½ã¦ãããããããããã¯ã«æ ¼ç´ãããAttestationã®æ°ã¯ä½è£ããã£ã¦128ã¾ã§ã¨ãªã£ã¦ããã
æ£å¸¸ã«Blockãçæããã¦ããéã¯ï¼ã¤ã®ãããã¯ã«ãã¹ã¦ã®voteãæ ¼ç´ã§ããè¨ç®ã¨ãªãã
ãã ãã以åèµ·ãã7blockã®reorgãªã©ãçºçããã¨ãblockã«æ ¼ç´ããããªãvoteãçºçããã1ã¤ã®committeeå ã§2ã¤ã®blockã¸ã®voteãçºçããå ´åã¯ã®ãªã®ãª128åã®Attestationã«éç´å¯è½ã ãã1ã¤ã®Committeeå ã§3ã¤ä»¥ä¸ã®blockã«å¯¾ãã¦voteããå ´åã¯ã64 * 3 = 192以ä¸ã®ç¨®é¡ã®voteãåå¨ãããã¨ã«ãªããblockã«æ ¼ç´å¯è½ãªAttestationæ°ãè¶ ãã¦ãã¾ãããã§ããã
Attestationã«å¯¾ããå ±é ¬ã¨ããã«ãã£
æ£ããvoteãè¡ã£ãvalidatorã«ã¯æ¡ä»¶ã«å¿ã㦠BaseReward * n ã®å ±é
¬ãä¸ãããããBaseRewardã®è¨ç®ã¯å°ããããããã®ã§ãä¸è¨ãµã¤ããåç
§ã
kb.beaconcha.in
å ±é ¬ã¨ããã«ãã£ã®çµã¿åããã¯ä»¥ä¸ã®ï¼ãã¿ã¼ã³
- source ã«æå®ããepochãæå¾ã«justifyãããepochã¨ä¸è´ãã¦ããã°BaseRewardã®å ±é ¬ãééã£ã¦ãããBaseRewardã®ããã«ãã£
- targetã«æå®ããepochã(èªåãå²ãå½ã¦ãããslotã«å¯¾ãã¦)ç¾å¨ã®epochã¨ä¸è´ãã¦ããã°BaseRewardã®å ±é ¬ãééã£ã¦ãããBaseRewardã®ããã«ãã£
- block_rootã«æå®ããblockãèªåã®å²ãå½ã¦ãããslotã®blockã¨ä¸è´ãã¦ããã°BaseRewardã®å ±é ¬ãééã£ã¦ãããBaseRewardã®ããã«ãã£
- Attestationãblockã«æ ¼ç´ãããã7/8 * BaseRewardã®å ±é ¬ããã ããèªåã®voteãæ ¼ç´ãããblockã®slotããé 延ãã¦ããå ´åã¯é 延ã«å¿ãã¦å ±é ¬ãé¤ç®ããããã¤ã¾ããèªåã®Attestationãå«ãã blockã®slotã40ã§ãèªåã®å²ãå½ã¦ãããslotã38ã®å ´åã¯ãinclusion delayã2ã¨ãªãã®ã§ã 7/8 * BaseReward * 1/2ãå ±é ¬ã¨ãªãã
ãã¹ã¦ã°ï½ã«ãªããã¿ã¼ã³ã¯ãã¤ã¾ãvoteããã¦ããªãå ´åãã¤ã¾ããnon-activeãªå ´åã§ãããããã§ä¸ãã¦ããããã«ãã£ã¨ã¯ã¹ã©ãã·ã¥ã¨ã¯å¥ã®ãã®ã
åºæ¬çã«ãValidatorã¯æ¬¡ã®slotã®blockãä½ãããã¾ã§ã®éã«ãèªåã®slotã®ãããã¯ã«å¯¾ããvoteãè¡ãã¨å ±é
¬ãæ大ã¨ãªãã
ãªããBlock Proposerã¯target epochãæå¹ãªvoteãã¨ã«BaseReward * 1/8ã®å ±é ¬ãå¾ãããã(Attesterã¨Proposerã§å ±é ¬ãåããããã¨ã«ãªãï¼ããã®ãããBlock Proposerã¯ã§ããã ãå¤ãã®Attestationãå«ããã¤ã³ã»ã³ãã£ããããã
LMDã¨FFGã®å¤å®ã¿ã¤ãã³ã°
LMDã¯Attestationãå°éããã¿ã¤ãã³ã°ã§å¤å®ãããããã®ãããånodeã§ã¯å¾®å¦ã«ãããã¯ã«éã¾ã£ã¦ããæ票æ°ãç°ãªã£ã¦ããå¯è½æ§ãããã¨æãããã
FFGã®å¤å®ã¿ã¤ãã³ã°ã¯epochãåãæ¿ãã£ãç¬éã§ãããã¾ãããã®æã«å ±é
¬ãè¨ç®ãããããã®ãããvoteã®targetãä¸è´ãã¦ããã°å¿
ãinclusion rewardã¯ããããã
FFGã¯Attestationãåãåã£ãæã¨epochãåãæ¿ãã£ãæã®2åå¤å®ããããã¾ãããã®æã«å ±é
¬ãè¨ç®ãããããã®ãããvoteã®targetãä¸è´ãã¦ããã°å¿
ãinclusion rewardã¯ãããããï¼â»2022/08/09追è¨ï¼
Attestationã®slashingæ¡ä»¶
åä¸epochå ã§ç°ãªãï¼ã¤ã®ãããã¯ã«å¯¾ãã¦voteãããslash対象ã¨ãªããvoteãè¡ããªããããããnon-activeãªç¶æ ã§ã¯slash対象ã¨ã¯ãªããªããééã£ããããã¯ã«æ票ãã¦ããã¡ããslash対象ã«ã¯ãªããªããããã¾ã§ã2ã¤ã®ãããã¯ã«æ票ããã¨ãã®ã¿slash対象ã¨ãªãã
çåç¹
LMDã®éã¿ããªã¢ã«ã¿ã¤ã ã¨éå»ã¨ã§ç°ãªã
Attestationã¯blockã«å«ã¾ãããã®ã ãããBeaconStateã«ä¿åãããããã®ããããªã¢ã«ã¿ã¤ã ã§è¦ãã¦ãããããã¯ã®éã¿ã¨æçµçã«æå¹ã¨ãªããããã¯ã®éã¿ã«ã¯å¾®å¦ãªå·®ç°ãçã¾ããã¨æãããã(beacon-chain.mdã®process_attestationã¨fork-choice.mdã®on_attestationããå¤æ)
å®é大ããªå·®ç°ãçºçãããã¨ã¯å°ãªãã¨æãããããã¯çµæ§åé¡ãªæ°ããããããééã£ã¦ããã°ææãã¦ã»ããã
Block Proposerãblockãææ¡ããªãã£ãããattestorã®å ±é ¬ã¯æ¸ã£ã¦ãã¾ãã®ãï¼
å ±é ¬ã¨ããã«ãã£ã®ä»çµã¿ãè¦ãã¨block rootãç¾å¨ã®slotã¨ä¸è´ããªãå ´åã¯å ±é ¬ãæ¸é¡ãããããããªãã¨ãproposerããããã¯ãææ¡ããªãã£ãå ´åãæ¸é¡ãããã®ããªï¼ã¨æã£ãã
ä¸è¨çåããã¨ã«specãè¦ç´ãã¦ã¿ãã¨ãheadã®ãã§ãã¯ããã対象ã¯ä¸è¨ã®å¦çã§æ±ºã¾ã£ã¦ãããblockãææ¡ãããªãå ´åã¯ãã®ï¼ã¤åã®block(ã¨ããããæå¾ã«æå¹ã¨ã¿ãªãããblock)ã該å½slotã®headã¨ãã¦æ ¼ç´ãããã®ã§ãblockãmissã®å ´åã¯ï¼ã¤åã®slotã®blockã«å¯¾ãã¦æ票ããã°ãããã¨ãåããã
def process_slot(state: BeaconState) -> None: # Cache state root previous_state_root = hash_tree_root(state) state.state_roots[state.slot % SLOTS_PER_HISTORICAL_ROOT] = previous_state_root # Cache latest block header state root if state.latest_block_header.state_root == Bytes32(): state.latest_block_header.state_root = previous_state_root # Cache block root previous_block_root = hash_tree_root(state.latest_block_header) state.block_roots[state.slot % SLOTS_PER_HISTORICAL_ROOT] = previous_block_root