add phase 1 custody objects to custody-game.md
This commit is contained in:
parent
f4334d1522
commit
3851a26a0f
|
@ -12,14 +12,6 @@
|
||||||
- [Custom types](#custom-types)
|
- [Custom types](#custom-types)
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Misc](#misc)
|
- [Misc](#misc)
|
||||||
- [New containers](#new-containers)
|
|
||||||
- [`CustodyChunkChallenge`](#custodychunkchallenge)
|
|
||||||
- [`CustodyChunkChallengeRecord`](#custodychunkchallengerecord)
|
|
||||||
- [`CustodyChunkResponse`](#custodychunkresponse)
|
|
||||||
- [`CustodySlashing`](#custodyslashing)
|
|
||||||
- [`SignedCustodySlashing`](#signedcustodyslashing)
|
|
||||||
- [`CustodyKeyReveal`](#custodykeyreveal)
|
|
||||||
- [`EarlyDerivedSecretReveal`](#earlyderivedsecretreveal)
|
|
||||||
- [Updated containers](#updated-containers)
|
- [Updated containers](#updated-containers)
|
||||||
- [Extended `AttestationData`](#extended-attestationdata)
|
- [Extended `AttestationData`](#extended-attestationdata)
|
||||||
- [Extended `Attestation`](#extended-attestation)
|
- [Extended `Attestation`](#extended-attestation)
|
||||||
|
@ -31,7 +23,7 @@
|
||||||
- [Extended `BeaconBlock`](#extended-beaconblock)
|
- [Extended `BeaconBlock`](#extended-beaconblock)
|
||||||
- [Extended `SignedBeaconBlock`](#extended-signedbeaconblock)
|
- [Extended `SignedBeaconBlock`](#extended-signedbeaconblock)
|
||||||
- [Extended `BeaconState`](#extended-beaconstate)
|
- [Extended `BeaconState`](#extended-beaconstate)
|
||||||
- [New containers](#new-containers-1)
|
- [New containers](#new-containers)
|
||||||
- [`ShardBlock`](#shardblock)
|
- [`ShardBlock`](#shardblock)
|
||||||
- [`SignedShardBlock`](#signedshardblock)
|
- [`SignedShardBlock`](#signedshardblock)
|
||||||
- [`ShardBlockHeader`](#shardblockheader)
|
- [`ShardBlockHeader`](#shardblockheader)
|
||||||
|
@ -124,95 +116,6 @@ Configuration is not namespaced. Instead it is strictly an extension;
|
||||||
| `BYTES_PER_CUSTODY_CHUNK` | `2**12` | bytes |
|
| `BYTES_PER_CUSTODY_CHUNK` | `2**12` | bytes |
|
||||||
| `CUSTODY_RESPONSE_DEPTH` | `ceillog2(MAX_SHARD_BLOCK_SIZE // BYTES_PER_CUSTODY_CHUNK) | - | - |
|
| `CUSTODY_RESPONSE_DEPTH` | `ceillog2(MAX_SHARD_BLOCK_SIZE // BYTES_PER_CUSTODY_CHUNK) | - | - |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## New containers
|
|
||||||
|
|
||||||
### `CustodyChunkChallenge`
|
|
||||||
|
|
||||||
```python
|
|
||||||
class CustodyChunkChallenge(Container):
|
|
||||||
responder_index: ValidatorIndex
|
|
||||||
shard_transition: ShardTransition
|
|
||||||
attestation: Attestation
|
|
||||||
data_index: uint64
|
|
||||||
chunk_index: uint64
|
|
||||||
```
|
|
||||||
|
|
||||||
### `CustodyChunkChallengeRecord`
|
|
||||||
|
|
||||||
```python
|
|
||||||
class CustodyChunkChallengeRecord(Container):
|
|
||||||
challenge_index: uint64
|
|
||||||
challenger_index: ValidatorIndex
|
|
||||||
responder_index: ValidatorIndex
|
|
||||||
inclusion_epoch: Epoch
|
|
||||||
data_root: Root
|
|
||||||
chunk_index: uint64
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `CustodyChunkResponse`
|
|
||||||
|
|
||||||
```python
|
|
||||||
class CustodyChunkResponse(Container):
|
|
||||||
challenge_index: uint64
|
|
||||||
chunk_index: uint64
|
|
||||||
chunk: ByteVector[BYTES_PER_CUSTODY_CHUNK]
|
|
||||||
branch: Vector[Root, CUSTODY_RESPONSE_DEPTH]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `CustodySlashing`
|
|
||||||
|
|
||||||
```python
|
|
||||||
class CustodySlashing(Container):
|
|
||||||
# Attestation.custody_bits_blocks[data_index][committee.index(malefactor_index)] is the target custody bit to check.
|
|
||||||
# (Attestation.data.shard_transition_root as ShardTransition).shard_data_roots[data_index] is the root of the data.
|
|
||||||
data_index: uint64
|
|
||||||
malefactor_index: ValidatorIndex
|
|
||||||
malefactor_secret: BLSSignature
|
|
||||||
whistleblower_index: ValidatorIndex
|
|
||||||
shard_transition: ShardTransition
|
|
||||||
attestation: Attestation
|
|
||||||
data: ByteList[MAX_SHARD_BLOCK_SIZE]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `SignedCustodySlashing`
|
|
||||||
|
|
||||||
```python
|
|
||||||
class SignedCustodySlashing(Container):
|
|
||||||
message: CustodySlashing
|
|
||||||
signature: BLSSignature
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### `CustodyKeyReveal`
|
|
||||||
|
|
||||||
```python
|
|
||||||
class CustodyKeyReveal(Container):
|
|
||||||
# Index of the validator whose key is being revealed
|
|
||||||
revealer_index: ValidatorIndex
|
|
||||||
# Reveal (masked signature)
|
|
||||||
reveal: BLSSignature
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `EarlyDerivedSecretReveal`
|
|
||||||
|
|
||||||
Represents an early (punishable) reveal of one of the derived secrets, where derived secrets are RANDAO reveals and custody reveals (both are part of the same domain).
|
|
||||||
|
|
||||||
```python
|
|
||||||
class EarlyDerivedSecretReveal(Container):
|
|
||||||
# Index of the validator whose key is being revealed
|
|
||||||
revealed_index: ValidatorIndex
|
|
||||||
# RANDAO epoch of the key that is being revealed
|
|
||||||
epoch: Epoch
|
|
||||||
# Reveal (masked signature)
|
|
||||||
reveal: BLSSignature
|
|
||||||
# Index of the validator who revealed (whistleblower)
|
|
||||||
masker_index: ValidatorIndex
|
|
||||||
# Mask used to hide the actual reveal signature (prevent reveal from being stolen)
|
|
||||||
mask: Bytes32
|
|
||||||
```
|
|
||||||
|
|
||||||
## Updated containers
|
## Updated containers
|
||||||
|
|
||||||
The following containers have updated definitions in Phase 1.
|
The following containers have updated definitions in Phase 1.
|
||||||
|
|
|
@ -18,6 +18,13 @@
|
||||||
- [Signature domain types](#signature-domain-types)
|
- [Signature domain types](#signature-domain-types)
|
||||||
- [Data structures](#data-structures)
|
- [Data structures](#data-structures)
|
||||||
- [New Beacon Chain operations](#new-beacon-chain-operations)
|
- [New Beacon Chain operations](#new-beacon-chain-operations)
|
||||||
|
- [`CustodyChunkChallenge`](#custodychunkchallenge)
|
||||||
|
- [`CustodyChunkChallengeRecord`](#custodychunkchallengerecord)
|
||||||
|
- [`CustodyChunkResponse`](#custodychunkresponse)
|
||||||
|
- [`CustodySlashing`](#custodyslashing)
|
||||||
|
- [`SignedCustodySlashing`](#signedcustodyslashing)
|
||||||
|
- [`CustodyKeyReveal`](#custodykeyreveal)
|
||||||
|
- [`EarlyDerivedSecretReveal`](#earlyderivedsecretreveal)
|
||||||
- [Helpers](#helpers)
|
- [Helpers](#helpers)
|
||||||
- [`replace_empty_or_append`](#replace_empty_or_append)
|
- [`replace_empty_or_append`](#replace_empty_or_append)
|
||||||
- [`legendre_bit`](#legendre_bit)
|
- [`legendre_bit`](#legendre_bit)
|
||||||
|
@ -95,6 +102,91 @@ The following types are defined, mapping into `DomainType` (little endian):
|
||||||
|
|
||||||
### New Beacon Chain operations
|
### New Beacon Chain operations
|
||||||
|
|
||||||
|
#### `CustodyChunkChallenge`
|
||||||
|
|
||||||
|
```python
|
||||||
|
class CustodyChunkChallenge(Container):
|
||||||
|
responder_index: ValidatorIndex
|
||||||
|
shard_transition: ShardTransition
|
||||||
|
attestation: Attestation
|
||||||
|
data_index: uint64
|
||||||
|
chunk_index: uint64
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `CustodyChunkChallengeRecord`
|
||||||
|
|
||||||
|
```python
|
||||||
|
class CustodyChunkChallengeRecord(Container):
|
||||||
|
challenge_index: uint64
|
||||||
|
challenger_index: ValidatorIndex
|
||||||
|
responder_index: ValidatorIndex
|
||||||
|
inclusion_epoch: Epoch
|
||||||
|
data_root: Root
|
||||||
|
chunk_index: uint64
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `CustodyChunkResponse`
|
||||||
|
|
||||||
|
```python
|
||||||
|
class CustodyChunkResponse(Container):
|
||||||
|
challenge_index: uint64
|
||||||
|
chunk_index: uint64
|
||||||
|
chunk: ByteVector[BYTES_PER_CUSTODY_CHUNK]
|
||||||
|
branch: Vector[Root, CUSTODY_RESPONSE_DEPTH]
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `CustodySlashing`
|
||||||
|
|
||||||
|
```python
|
||||||
|
class CustodySlashing(Container):
|
||||||
|
# Attestation.custody_bits_blocks[data_index][committee.index(malefactor_index)] is the target custody bit to check.
|
||||||
|
# (Attestation.data.shard_transition_root as ShardTransition).shard_data_roots[data_index] is the root of the data.
|
||||||
|
data_index: uint64
|
||||||
|
malefactor_index: ValidatorIndex
|
||||||
|
malefactor_secret: BLSSignature
|
||||||
|
whistleblower_index: ValidatorIndex
|
||||||
|
shard_transition: ShardTransition
|
||||||
|
attestation: Attestation
|
||||||
|
data: ByteList[MAX_SHARD_BLOCK_SIZE]
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `SignedCustodySlashing`
|
||||||
|
|
||||||
|
```python
|
||||||
|
class SignedCustodySlashing(Container):
|
||||||
|
message: CustodySlashing
|
||||||
|
signature: BLSSignature
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `CustodyKeyReveal`
|
||||||
|
|
||||||
|
```python
|
||||||
|
class CustodyKeyReveal(Container):
|
||||||
|
# Index of the validator whose key is being revealed
|
||||||
|
revealer_index: ValidatorIndex
|
||||||
|
# Reveal (masked signature)
|
||||||
|
reveal: BLSSignature
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `EarlyDerivedSecretReveal`
|
||||||
|
|
||||||
|
Represents an early (punishable) reveal of one of the derived secrets, where derived secrets are RANDAO reveals and custody reveals (both are part of the same domain).
|
||||||
|
|
||||||
|
```python
|
||||||
|
class EarlyDerivedSecretReveal(Container):
|
||||||
|
# Index of the validator whose key is being revealed
|
||||||
|
revealed_index: ValidatorIndex
|
||||||
|
# RANDAO epoch of the key that is being revealed
|
||||||
|
epoch: Epoch
|
||||||
|
# Reveal (masked signature)
|
||||||
|
reveal: BLSSignature
|
||||||
|
# Index of the validator who revealed (whistleblower)
|
||||||
|
masker_index: ValidatorIndex
|
||||||
|
# Mask used to hide the actual reveal signature (prevent reveal from being stolen)
|
||||||
|
mask: Bytes32
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Helpers
|
## Helpers
|
||||||
|
|
||||||
### `replace_empty_or_append`
|
### `replace_empty_or_append`
|
||||||
|
|
Loading…
Reference in New Issue