[ ] register_notary() returns bool: Adds an entry to notary_registry, updates the notary pool (notary_pool, notary_pool_len, etc.), locks a deposit of size NOTARY_DEPOSIT, and returns True on success. Checks:
Deposit size: msg.value >= NOTARY_DEPOSIT
Uniqueness: notary_registry[msg.sender] does not exist
[ ] deregister_notary() returns bool: Sets the deregistered period in the notary_registry entry, updates the notary pool (notary_pool, notary_pool_len, etc.), and returns True on success. Checks:
[x] add_header(shard_id, chunk_root, period) returns bool: anyone can call this function at anytime. The first header to get included for a given shard in a given period gets in, all others don’t. Returns True on success. This function just emits a log.
HeaderAdded log (emitted from SMC add_header function)
v1
shard_id uint256 # pointer to shard
chunk_root bytes32 # pointer to collation body
period int128 # (current block number / PERIOD_LENGTH)
proposer_address address # the address of proposer
v2 compressed
shard_id bytes1 # pointer to shard
chunk_root bytes32 # pointer to collation body
period bytes3 # (current block number / PERIOD_LENGTH)
proposer_address address # the address of proposer
[x] get_committee(shard_id, period) returns a list of addresses: use the last block hash h before this period as the seed. Selecting notary_pool[sha3(h) % notary_pool_size], notary_pool[sha3(h + 1) % notary_pool_size], .... notary_pool[sha3(h + (COMMITTEE_SIZE - 1)) % notary_pool_size] notaries from notary_pool.
[ ] submit_vote(shard_id, chunk_root, period) returns bool: Sampled notaries call this function to submit vote, returns True on success. This function just emits a log.
Vote log (emitted from SMC submit_vote function)
v1
shard_id uint256 # pointer to shard
chunk_root bytes32 # pointer to collation body
period int128 # (current block number / PERIOD_LENGTH)
notary_address address # the address of notary
v2 compressed
shard_id bytes1 # pointer to shard
chunk_root bytes32 # pointer to collation body
period bytes3 # (current block number / PERIOD_LENGTH)
notary_address address # the address of notary
What is wrong?
Old sharding spec + A minimal sharding protocol
How can it be fixed
[x] "collator" -> "notary"
COLLATOR_DEPOSIT
->NOTARY_DEPOSIT
[x] Add constant
COMMITTEE_SIZE
:= 135QUORUM_SIZE
:= 90Implement notary pool and notary registry:
register_notary() returns bool
: Adds an entry tonotary_registry
, updates the notary pool (notary_pool
,notary_pool_len
, etc.), locks a deposit of sizeNOTARY_DEPOSIT
, and returnsTrue
on success. Checks:msg.value >= NOTARY_DEPOSIT
notary_registry[msg.sender]
does not existderegister_notary() returns bool
: Sets the deregistered period in thenotary_registry
entry, updates the notary pool (notary_pool
,notary_pool_len
, etc.), and returnsTrue
on success. Checks:notary_registry[msg.sender]
existsrelease_natory() returns bool
: Removes an entry fromnotary_registry
, releases the notary deposit, and returnsTrue
on success. Checks:notary_registry[msg.sender]
existsnotary_registry[msg.sender].deregistered != 0
floor(block.number / PERIOD_LENGTH) > notary_registry[msg.sender].deregistered + NOTARY_LOCKUP_LENGTH
[x]
add_header(shard_id, chunk_root, period) returns bool
: anyone can call this function at anytime. The first header to get included for a given shard in a given period gets in, all others don’t. ReturnsTrue
on success. This function just emits a log.HeaderAdded
log (emitted from SMCadd_header
function)[x]
get_committee(shard_id, period) returns a list of addresses
: use the last block hashh
before this period as the seed. Selectingnotary_pool[sha3(h) % notary_pool_size], notary_pool[sha3(h + 1) % notary_pool_size], .... notary_pool[sha3(h + (COMMITTEE_SIZE - 1)) % notary_pool_size]
notaries fromnotary_pool
.[ ]
submit_vote(shard_id, chunk_root, period) returns bool
: Sampled notaries call this function to submit vote, returnsTrue
on success. This function just emits a log.Vote
log (emitted from SMCsubmit_vote
function)