You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks to @vbuterin for providing some suggestions.
Goal
Get down to ~90-100k gas in practice without too much effort
Items
Storing score and parent inside a single storage key
giving collations a 24 byte ID instead of 32 byte: ID = num256_add(shift(parent, -192), num256_and(sha3(header), as_num256(<valueof 2**192 - 1 here>)))
Using emitting log instead of storing collations_with_score mapping
Remove validator code, just use the signature of the transaction itself.
Record the address of validator in validators mapping and remove validator_code_addr:
validators: public({
# Amount of wei the validator holdsdeposit: wei_value,
# The address which the validatorvalidation_addr: address,
# Addess to withdraw toreturn_addr: address,
# The cycle number which the validator would be included after# Will be [DEPRECATED] for stateless clientcycle: num,
}[num])
Make get_eligible_proposer return validator_addr
Change the input of add_header by removing sig field: add_header(shard_id: num, expected_period_number: num, period_start_prevhash: bytes32, parent_collation_hash: bytes32, tx_list_root: bytes32, collation_coinbase: address, post_state_root: bytes32, receipt_root: bytes32, collation_number: num)
Thanks to @vbuterin for providing some suggestions.
Goal
Get down to ~90-100k gas in practice without too much effort
Items
ID = num256_add(shift(parent, -192), num256_and(sha3(header), as_num256(<valueof 2**192 - 1 here>)))
collations_with_score
mappingvalidators
mapping and removevalidator_code_addr
:get_eligible_proposer
returnvalidator_addr
add_header
by removingsig
field:add_header(shard_id: num, expected_period_number: num, period_start_prevhash: bytes32, parent_collation_hash: bytes32, tx_list_root: bytes32, collation_coinbase: address, post_state_root: bytes32, receipt_root: bytes32, collation_number: num)
assert msg.sender == self.get_eligible_proposer(shard_id, block.number / self.period_length)
entire_header_hash
:entire_header_hash = sha3(concat(as_bytes32(shard_id), as_bytes32(expected_period_number) ... as_bytes32(collation_number)))
assert msg.sender == self.validators[validator_index].validator_addr
The text was updated successfully, but these errors were encountered: