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

Support to change xfield in a block #170

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Naviabheeman
Copy link
Contributor

@Naviabheeman Naviabheeman commented Nov 3, 2023

This PR adds the support to set the xfield in a block header when the change is approved by the federation. We read the federation change from federations.toml. Aggregate-pubkey, threshold, node-vss, signature are optional and are needed when aggregated pubkey changes. max block size and signature are needed when max block size changes in the federation.

SerFederation is converted to Federation where xfield is used. This is to unify the code processing aggregated-pub key and max-block-size. All federations are loaded and signature verified when a node starts. The first federation which defines the aggregated-pub key in the genesis block does not need a signature. Node would fail to start if there is an invalid entry in the toml.

When a new round starts on master node, it gets the new xfield value from federation list based on block heigh. To add the xfield in the new block getnewblockwithxfield is used. it adds a string parameter "xfield_type:xfield_value" in the format that Tapyrus-core expects.

When a candidate block is received for signature, the node checks that the xfield in the block is either empty or matches the xfield change in its federations.toml. xfield signature is verified once again. Only valid blocks are signed.

For federation aggregated pub key change, a description of the new federation i.e. threshold, node-vss and aggregated-pubkey are required in addition to a valid signature.

All nodes identify the results of a federation change attempt from getblockchaininfo rpc output. All nodes create a log entry for each federation change attempt identified from the bock height in federations.toml and getblockchaininfo output.

@Naviabheeman Naviabheeman force-pushed the 163_federationChangeToml branch 4 times, most recently from e522d66 to 9709ca8 Compare December 4, 2023 10:35
Every round, the master node checks the federations file to add xfield and
member nodes verify their federations file signature and block xfield before signing the block
Add tests to verify max block size and aggregated pubkey changes with signatures
…ubkeys and max_block_sizes

rename unused variables with '_' prefix
@Naviabheeman Naviabheeman force-pushed the 163_federationChangeToml branch from a6e340e to 6fffc23 Compare January 9, 2024 11:00
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.

1 participant