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

feat: prepend the binary version to BlockAssemblerConfig message #2817

Merged

Conversation

quake
Copy link
Member

@quake quake commented Jul 8, 2021

No description provided.

@quake quake requested a review from a team July 8, 2021 07:44
@quake quake requested a review from a team as a code owner July 8, 2021 07:44
@yangby-cryptape

This comment has been minimized.

@quake
Copy link
Member Author

quake commented Jul 8, 2021

I don't want the user to set this parameter during init, if they want to remove the message_prefix, they need to edit ckb.toml and set it to "0x".

How about adding a commented out line in the generated ckb.toml file?

# A message prefix used to identify the miner client, miner can disable this prefix by setting it to empty hex string: "0x".
# messsage_prefix = "0x"

@quake quake force-pushed the quake/block_assembler_message_prefix branch from 3c96cd5 to 6bd65a0 Compare July 12, 2021 01:00
@doitian doitian mentioned this pull request Jul 12, 2021
10 tasks
Copy link
Collaborator

@yangby-cryptape yangby-cryptape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Only one trivial issue: should we add a separator?

If a user set the message as follow:

message = "Mined by Xxx."

The real message will be "ckb 0.44.0-pre (337b520 2021-07-12)Mined by Xxx.".

        let message = config.message_prefix.as_ref().map_or_else(
            || config.message.as_bytes().pack(),
            |prefix| {
                [prefix.as_bytes(), config.message.as_bytes()]
                    .concat()
                    .pack()
            },
        );

So maybe he/she should set the message as follow to make the message more readable with default prefix:

message = "; Mined by Xxx."

@keroro520
Copy link
Contributor

I don't want the user to set this parameter during init, if they want to remove the message_prefix, they need to edit ckb.toml and set it to "0x".

How about adding a commented out line in the generated ckb.toml file?

# A message prefix used to identify the miner client, miner can disable this prefix by setting it to empty hex string: "0x".
# messsage_prefix = "0x"

The name message_prefix is too general. Its purpose is to attach the binary version to cellbase witnesses. It is difficult for me to connect the field's name to its purpose.

cellbase.lock may want the extra message to appear on the suffix. Their custom block_assembler.message is 1st.

@keroro520
Copy link
Contributor

I don't want the user to set this parameter during init, if they want to remove the message_prefix, they need to edit ckb.toml and set it to "0x".
How about adding a commented out line in the generated ckb.toml file?

# A message prefix used to identify the miner client, miner can disable this prefix by setting it to empty hex string: "0x".
# messsage_prefix = "0x"

The name message_prefix is too general. Its purpose is to attach the binary version to cellbase witnesses. It is difficult for me to connect the field's name to its purpose.

cellbase.lock may want the extra message to appear on the suffix. Their custom block_assembler.message is 1st.

What about this

block_assembler.message_options: {
  embed_client_version: bool, // default is true
}

@zhangsoledad
Copy link
Member

I don't want the user to set this parameter during init, if they want to remove the message_prefix, they need to edit ckb.toml and set it to "0x".
How about adding a commented out line in the generated ckb.toml file?

# A message prefix used to identify the miner client, miner can disable this prefix by setting it to empty hex string: "0x".
# messsage_prefix = "0x"

The name message_prefix is too general. Its purpose is to attach the binary version to cellbase witnesses. It is difficult for me to connect the field's name to its purpose.
cellbase.lock may want the extra message to appear on the suffix. Their custom block_assembler.message is 1st.

What about this

block_assembler.message_options: {
  embed_client_version: bool, // default is true
}

I like this.

@quake quake force-pushed the quake/block_assembler_message_prefix branch from 337b520 to 0683c7d Compare July 13, 2021 02:04
@quake
Copy link
Member Author

quake commented Jul 13, 2021

@keroro520 @zhangsoledad changed the configuration field name to use_binary_version_as_message_prefix, please review again, thanks.

@quake quake changed the title feat: add message prefix to BlockAssemblerConfig feat: prepend the binary version to BlockAssemblerConfig message Jul 13, 2021
@quake
Copy link
Member Author

quake commented Jul 13, 2021

bors r=keroro520,zhangsoledad,driftluo,yangby-cryptape

@bors
Copy link
Contributor

bors bot commented Jul 13, 2021

Build succeeded:

@bors bors bot merged commit b656961 into nervosnetwork:develop Jul 13, 2021
@quake quake deleted the quake/block_assembler_message_prefix branch March 20, 2023 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants