Post #13324

613dd6c197a2aba72beb51a17541259728355ef77a42c643d74c78ade7506da3
69468a71944e9683683016d9a00b4dc26f6af382a3bd8aac5782a16e5191c24d
Signature not verified

This entry might be using an old signature, or it was signed by a key that does not exist on the server.

{"entry_date":1551879894,"post_data":{"edit_count":1,"last_edit_date":0,"last_edit_user_id":0,"message_sha512":"35ae04bd04233732a99b3841172d81d4c58b09926f769c32b0e0cf729578c3cf1ea916db3759a6fc885346fc1a0f6f0a513b8c361fd8eb68ed043016f6f7658b","node_id":67,"post_date":1551879813,"thread_id":1724,"user_id":192},"post_link":"https:\/\/factomize.com\/forums\/index.php?threads\/1724#post-13324"}
The entry content as it exists in the database. This should be verified against the blockchain entry.
Explanation of Messages (IMsg)
[SIZE=7]Election Messages[/SIZE]
Election messages are added to the [B][URL='https://factomize.com/forums/threads/miscellaneous-channel-diagrams.1659/post-12891']election queue[/URL][/B] while processing VMs. In addition to the functions the other messages have, election messages also have [B]ElectionValidate[/B] and [B]ElectionProcess[/B]. The implementation for the above functionality is usually not implemented as the messages don't leave the election system. For that reason, I'm going to leave them out [B]unless they do something[/B].

Additionally, elections have an "adapter" which controls the inner election state. This election adapter is somewhat independent of the rest of the factomd node and has its own messages and message types that are not IMsg. The factomd "FedVote" election messages act as carriers. They push internal election messages into the system and (if they are leaders) receive different messages in return, which are then broadcasted to the network (Special thanks to [USER=95]@Steven Masley[/USER] for providing some insight into this)

For this post, I'm going to treat the election adapter as a black box as I don't fully understand the way it works yet myself.

Note: Internal messages are called "Internal" because they can't be sent over the network, as they typically lack unmarshalling support.

[SIZE=6]electionMsgs.AddLeaderInternal[/SIZE]
[LIST]
[*][B]Origin:[/B] A new federated server entry in the adminblock, genesis
[*][B]Election Validation:[/B]
[INDENT]Always valid[/INDENT]
[*][B]Election Process:[/B]
[INDENT]If the specified server is not already a federated server, add it to the election's list of federated servers[/INDENT]
[/LIST]

[SIZE=6]electionMsgs.RemoveLeaderInternal[/SIZE]
[LIST]
[*][B]Origin:[/B] Adminblock entry to remove leader, or to change it to audit
[*][B]Election Validation:[/B]
[INDENT]Always valid[/INDENT]
[*][B]Election Process:[/B]
[INDENT]If the specified server is a federated server, remove it from the election's list of federated servers[/INDENT]
[/LIST]



[SIZE=6]electionMsgs.AddAuditInternal[/SIZE]
[LIST]
[*][B]Origin:[/B] A new audit server entry in the adminblock, genesis
[*][B]Election Validation:[/B]
[INDENT]Always valid[/INDENT]
[*][B]Election Process:[/B]
[INDENT]If the specified server is not already an audit server, add it to the election's list of audit servers[/INDENT]
[/LIST]

[SIZE=6]electionMsgs.RemoveAuditInternal[/SIZE]
[LIST]
[*][B]Origin:[/B] Adminblock entry to remove audit, or to change it to fed
[*][B]Election Validation:[/B]
[INDENT]Always valid[/INDENT]
[*][B]Election Process:[/B]
[INDENT]If the specified server is an audit server, remove it from the election's list of audit servers[/INDENT]
[/LIST]


[SIZE=6]electionMsgs.TimeoutInternal[/SIZE]
[LIST]
[*][B]Origin:[/B] VM Processing timeout ("Fault Timer")
[*][B]Election Validation:[/B]
[INDENT]Always valid[/INDENT]
[*][B]Election Process:[/B]
[INDENT]If the system moved on, don't do anything[/INDENT]
[LIST]
[*]If there is no election or the message is up to date, count the stored messages ([B]EomSigInternal[/B]) for the election. If all federated servers sent either an EOM or a DBsig, stop the timeout.
Otherwise, start an election for the first server with a missing EomSigInternal. This creates a [B]StartElectionInternal[/B] message which is sent to [B]state.InMsgQueue[/B] and also re-adds all the messages from the election wait queue to the elections queue.
[*]If there is an ongoing election, increase the current round and start a new fault timer but with a timer of 30 seconds (if that triggers, it will send another TimeoutInternal)
If this node is an audit server and it's in line to volunteer for this round, create a [B]SyncMsg[/B] (local) and add it to [B]state.InMsgQueue[/B].
[/LIST]
[*]
[/LIST]


[SIZE=6]electionMsgs.EomSigInternal[/SIZE]
Can be of type EOM or type DBSig, hence EomSig
[LIST]
[*][B]Origin:[/B] message FedVoteLevelMsg ElectionProcess, or message EOM's Process, or message DBSig's Process
[*][B]Election Validation:[/B]
[INDENT]always valid[/INDENT]
[*][B]Election Process:[/B]
[INDENT]Ignore messages not from a federated server.
If the message is from a future, stop any elections going on, reset the message store and set all servers as unsynced. Store this message in the elections (see TimeoutInternal), start another "Fault Timer" (2 minutes) and re-add all messages from election wait queue to the elections queue
If the message is NOT from a future minute, just store this message in the elections
In either case, mark the leader that spawned this message as synced
If all leaders are synced, reset the rounds and feedback variables[/INDENT]
[/LIST]



[SIZE=6]electionMsgs.AuthorityListInternal[/SIZE]
[LIST]
[*][B]Origin:[/B] When the State [URL='https://github.com/FactomProject/factomd/blob/9f06f06c8ab49717a20d6a8dd6ad2f3e569a0811/state/stateConsensus.go#L604']moves to a new Height[/URL]
[*][B]Election Validation:[/B]
[INDENT]-1 if the height is lower than the elections' height
1 otherwise[/INDENT]
[*][B]Election Process:[/B]
[INDENT]Update the elections with a fresh list of fed and auth servers[/INDENT]
[*][B]Validation:[/B]
[INDENT]Always valid[/INDENT]
[*][B]Leader:[/B] Same as Follower
[*][B]Follower:[/B]
[INDENT]Enqueue the message to Elections Queue[/INDENT]
[/LIST]


[SIZE=6]electionMsgs.FedVoteMsg[/SIZE]
[LIST]
[*][B]Origin:[/B] This is not a real message per se but rather a "generic" message that implements shared functionality among some of the following messages. those messages are considered this message's "super"
[*][B]Election Validation:[/B]
[INDENT]-1 if it's from the past, or the message tries to vote for servers that don't exist
0 if it's from the future or a different election
1 otherwise[/INDENT]
[*][B]Election Process:[/B] does nothing
[*][B]Validation:[/B]
[INDENT]-1 if it's too old, signature is invalid
0 if the message is for a future height
1 otherwise[/INDENT]
[*][B]Leader:[/B] same as follower
[*][B]Follower:[/B]
[INDENT]add to [B]Election Queue[/B][/INDENT]
[*][B]Process:[/B] panic -- doesn't go into processlist
[/LIST]



[SIZE=6]electionMsgs.FedVoteVolunteerMsg[/SIZE]
(full broadcast)
[LIST]
[*][B]Origin:[/B] Created by SyncMsg
[*][B]Election Validation:[/B] Delegate validation to the attached FedVoteMsg
[*][B]Election Process:[/B]
[INDENT]Excute the message in the election adapter. If that produces a result, send the result out[/INDENT]
[*][B]Validation:[/B]
[INDENT]-1 if the [B]FedVoteMsg[/B] being carried is not valid (old, not signed by a fed server)
0 if there are no elections going or the [B]FedVoteMsg[/B] is for a higher processlist
1 otherwise[/INDENT]
[*][B]Leader:[/B] Same as follower
[*][B]Follower:[/B]
[INDENT]If an adapter doesn't exist, hold it. Otherwise, add it to the Election Queue[/INDENT]
[*][B]Process:[/B] panic -- doesn't go into the processlist
[/LIST]

[SIZE=6]electionMsgs.FedVoteLevelMsg[/SIZE]
(full broadcast)
[LIST]
[*][B]Origin:[/B] response from Election Adapter message execution
[*][B]Election Validation:[/B] Delegate validation to the attached FedVoteMsg
[*][B]Election Process:[/B]
[INDENT]If the message is committed and the election adapter is not finished[/INDENT]
[INDENT]Swap the Federated and Auth server in Elections
Consider the adapter finished
Set the message's valid cache as valid
Add a special reminder for "Follower Execute" (local only)
Create a new message [B]electionMsgs.EomSigInternal[/B] and add it to [B]state.InMsgQueue[/B]
Stop the election[/INDENT]

[INDENT]Let the election adapter execute this message
Send out the result
If the result is a [B]FedVoteLevelMsg[/B], it's committed, and the election adapter is not finished, perform the same steps as in the indent above[/INDENT]
[*][B]Validation:[/B]
[INDENT]Use cached valid value if possible
Delegate validation to the attached FedVoteMsg[/INDENT]
[*][B]Leader:[/B] same as follower
[*][B]Follower:[/B]
[INDENT]If there's no election adapter or processlist yet, add it to holding
If this is a special message (see Election Process)[/INDENT]
[INDENT]Swap the fed and auth servers inside the processlist
Add an EOM and Ack to the processlist
Run [URL='https://factomize.com/forums/attachments/process-flow-rc1-png.966/']state.UpdateState[/URL] once[/INDENT]

[INDENT]Otherwise, add it to the [B]Elections Queue[/B]
If the state's status as Leader changed, update it[/INDENT]
[*][B]Process:[/B] panic -- does not go into processlist
[/LIST]

[SIZE=6]electionMsgs.FedVoteProposalMsg[/SIZE]
(full broadcast)
[LIST]
[*][B]Origin:[/B] response from Election Adapter message execution
[*][B]Election Validation:[/B] Delegate validation to the attached FedVoteMsg
[*][B]Election Process:[/B]
[INDENT]Execute the message inside the Election Adapter
Send out the resulting message[/INDENT]
[*][B]Validation:[/B] delegate validation to the attached FedVoteMsg
[*][B]Leader:[/B] same as follower
[*][B]Follower:[/B]
[INDENT]If there is no Election Adapter, put it into Holding
Otherwise add it to the [B]Elections Queue[/B][/INDENT]
[*][B]Process:[/B] panic -- does not go into processlist
[/LIST]


[SIZE=6]electionMsgs.SyncMsg[/SIZE]
(local only)
[LIST]
[*][B]Origin:[/B] Audit servers send these to state.inMsgQueue when an election round starts (see electionMsgs.TimeoutInternal)
[*][B]Election Validation:[/B] always valid
[*][B]Election Process:[/B] nothing
[*][B]Validation:[/B] always valid
[*][B]Leader:[/B] same as follower
[*][B]Follower:[/B]
[INDENT]Create a [B]electionMsgs.FedVoteVolunteerMsg[/B] for the election round. Send it out (full broadcast) and immediately Follower Execute it.[/INDENT]
[*][B]Process:[/B] panic -- doesn't go into processlist
[/LIST]

[SIZE=6]electionMsgs.StartElectionInternal[/SIZE]
[LIST]
[*][B]Origin:[/B] Started by TimeoutInternal
[*][B]Election Validation:[/B]
[INDENT]-1 if the DBHeight is in the past
1 otherwise[/INDENT]
[*][B]Election Process:[/B]
[INDENT]If there is no election going on, start a "Fault Timer" (60s) and stop
Otherwise, create an election adapter
If this node is neither a fed nor an auth server, make the adapter observe only
Start a "Fault Timer" (60s)[/INDENT]
[*][B]Validation:[/B] always valid
[*][B]Leader:[/B] same as follower
[*][B]Follower:[/B]
[INDENT]Run [URL='https://factomize.com/forums/attachments/process-flow-rc1-png.966/']state.Process()[/URL] until the processlists can't advance anymore
Add this message to the [B]Elections Queue[/B][/INDENT]
[*][B]Process:[/B] panic -- does not go into processlist
[/LIST]
This is the raw content, without BBCode parsing.
Top