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

SMC modification - stage 1 #76

Closed
4 of 8 tasks
hwwhww opened this issue Apr 8, 2018 · 1 comment
Closed
4 of 8 tasks

SMC modification - stage 1 #76

hwwhww opened this issue Apr 8, 2018 · 1 comment
Assignees

Comments

@hwwhww
Copy link
Collaborator

hwwhww commented Apr 8, 2018

What is wrong?

Old sharding spec + A minimal sharding protocol

How can it be fixed

  • "collator" -> "notary"
    • e.g., COLLATOR_DEPOSIT -> NOTARY_DEPOSIT
  • Add constant
    • COMMITTEE_SIZE := 135
    • QUORUM_SIZE := 90
  • Implement notary pool and notary registry:
    • 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:
      • Authentication: notary_registry[msg.sender] exists
    • release_natory() returns bool: Removes an entry from notary_registry, releases the notary deposit, and returns True on success. Checks:
      • Authentication: notary_registry[msg.sender] exists
      • Deregistered: notary_registry[msg.sender].deregistered != 0
      • Lockup: floor(block.number / PERIOD_LENGTH) > notary_registry[msg.sender].deregistered + NOTARY_LOCKUP_LENGTH
  • 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
  • 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
@hwwhww
Copy link
Collaborator Author

hwwhww commented Apr 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants