-
Notifications
You must be signed in to change notification settings - Fork 226
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
feat: Allow miner add an arbitrary message into the cellbase #1000
feat: Allow miner add an arbitrary message into the cellbase #1000
Conversation
@yangby-cryptape is assigned as the chief reviewer |
e663d6d
to
60fea84
Compare
resource/ckb.toml
Outdated
@@ -117,8 +117,16 @@ cell_output_cache_size = 128 | |||
# | |||
# ckb cli secp256k1-lock <pubkey> | |||
# | |||
# Also, ckb allows the miner to add any data to the cellbase that he has dug out. | |||
# The data must be A 0x-prefixed hex string. **Please note** that the data cannot be | |||
# larger than the capacity value of the current cellbase. If it is larger, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The normal users don't know the capacity value of the cellbase, this data size may be confused for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- First of all, it is not a required field here. If you don’t understand it, you will not fill it out.
- The capacity of cellbase is dynamically changed. It is impossible to determine the size of data by a static value.
- I considered a lot of processing solutions, and finally decided to write the details in the comment, and verify the value when generating the block template to ensure that the user can find the filling error as soon as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to truncate the data when it is too long. And add a warning here to tell users that do not rely on the data here, it may be truncated when the block reward capacity is not enough to hold the data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should never be panic if the data size overflow sometimes, for the user view it's a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current processing will not panic if overflow RPC will return an error when getting the block template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the implementation to forced truncate, need to review if the calculation of capacity is correct
resource/ckb.toml
Outdated
@@ -117,8 +117,16 @@ cell_output_cache_size = 128 | |||
# | |||
# ckb cli secp256k1-lock <pubkey> | |||
# | |||
# Also, ckb allows the miner to add any data to the cellbase that he has dug out. | |||
# The data must be A 0x-prefixed hex string. **Please note** that the data cannot be | |||
# larger than the capacity value of the current cellbase. If it is larger, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to truncate the data when it is too long. And add a warning here to tell users that do not rely on the data here, it may be truncated when the block reward capacity is not enough to hold the data.
1227071
to
0d204f5
Compare
Allow miner add an arbitrary message into the cellbase
closed #888