Support to change xfield in a block #170
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 toFederation
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 infederations.toml
andgetblockchaininfo
output.