syntax = "proto3";
package solana.wen_restart_proto;

enum State {
    INIT = 0;
    LAST_VOTED_FORK_SLOTS = 1;
    HEAVIEST_FORK = 2;
    GENERATE_SNAPSHOT = 3;
    DONE = 4;
}

message LastVotedForkSlotsRecord {
    repeated uint64 last_voted_fork_slots = 1;
    string last_vote_bankhash = 2;
    uint32 shred_version = 3;
    uint64 wallclock = 4;
}

message LastVotedForkSlotsAggregateRecord {
    map<string, LastVotedForkSlotsRecord> received = 1;
    optional LastVotedForkSlotsAggregateFinal final_result = 2;
}

message LastVotedForkSlotsEpochInfoRecord {
    uint64 epoch = 1;
    uint64 total_stake = 2;
    uint64 actively_voting_stake = 3;
    uint64 actively_voting_for_this_epoch_stake = 4;
}

message LastVotedForkSlotsAggregateFinal {
    map<uint64, uint64> slots_stake_map = 1;
    repeated LastVotedForkSlotsEpochInfoRecord epoch_infos = 2;
}

message HeaviestForkRecord {
    uint64 slot = 1;
    string bankhash = 2;
    uint64 total_active_stake = 3;
    uint32 shred_version = 4;
    uint64 wallclock = 5;
    string from = 6;
}

message HeaviestForkAggregateRecord {
    repeated HeaviestForkRecord received = 1;
    uint64 total_active_stake = 2;
}

message GenerateSnapshotRecord {
    string path = 1;
    uint64 slot = 2;
    string bankhash = 3;
    uint32 shred_version = 4;
}

message ConflictMessage {
    string old_message = 2;
    string new_message = 3;
}

message WenRestartProgress {
    State state = 1;
    optional LastVotedForkSlotsRecord my_last_voted_fork_slots = 2;
    optional LastVotedForkSlotsAggregateRecord last_voted_fork_slots_aggregate = 3;
    optional HeaviestForkRecord my_heaviest_fork = 4;
    optional HeaviestForkAggregateRecord heaviest_fork_aggregate = 5;
    optional HeaviestForkRecord coordinator_heaviest_fork = 6;
    optional GenerateSnapshotRecord my_snapshot = 7;
    map<string, ConflictMessage> conflict_message = 8;
}
