diff --git a/include/eosio/ship_protocol.hpp b/include/eosio/ship_protocol.hpp index 63297e4..06b7899 100644 --- a/include/eosio/ship_protocol.hpp +++ b/include/eosio/ship_protocol.hpp @@ -825,6 +825,14 @@ namespace eosio { namespace ship_protocol { using resource_limits_config = std::variant; + struct finalizer_authority { + std::string description = {}; + uint64_t weight = {}; + std::vector public_key = {}; + }; + + EOSIO_REFLECT(finalizer_authority, description, weight, public_key) + struct finalizer_authority_with_string_key { std::string description = {}; uint64_t weight = {}; @@ -845,14 +853,78 @@ namespace eosio { namespace ship_protocol { uint32_t major_version = {}; uint32_t minor_version = {}; uint32_t active_finalizer_policy_generation = {}; - uint32_t final_on_strong_qc_block_num = {}; eosio::checksum256 action_mroot = {}; + eosio::checksum256 reversible_blocks_mroot = {}; + uint32_t latest_qc_claim_block_num = {}; + eosio::checksum256 latest_qc_claim_finality_digest = {}; + eosio::block_timestamp latest_qc_claim_timestamp = {}; eosio::checksum256 base_digest = {}; std::optional pending_finalizer_policy = {}; + uint32_t last_pending_finalizer_policy_generation = {}; }; EOSIO_REFLECT(finality_data, major_version, minor_version, active_finalizer_policy_generation, - final_on_strong_qc_block_num, action_mroot, base_digest, pending_finalizer_policy) + action_mroot, reversible_blocks_mroot, latest_qc_claim_block_num, latest_qc_claim_finality_digest, + latest_qc_claim_timestamp, base_digest, pending_finalizer_policy, last_pending_finalizer_policy_generation) + + struct protocol_feature_activation_extension { + std::vector protocol_features = {}; + }; + + EOSIO_REFLECT(protocol_feature_activation_extension, protocol_features) + + struct producer_schedule_change_extension : producer_authority_schedule {}; + + EOSIO_REFLECT(producer_schedule_change_extension, base producer_authority_schedule); + + struct qc_claim { + uint32_t block_num = {}; + bool is_strong_qc = {}; + }; + + EOSIO_REFLECT(qc_claim, block_num, is_strong_qc) + + struct insert_finalizer_policy_index_pair { + uint16_t index = {}; + finalizer_authority value = {}; + }; + + EOSIO_REFLECT(insert_finalizer_policy_index_pair, index, value) + + struct finalizer_policy_diff { + uint32_t generation = {}; + uint64_t threshold = {}; + std::vector remove_indexes = {}; + std::vector insert_indexes = {}; + }; + + EOSIO_REFLECT(finalizer_policy_diff, generation, threshold, remove_indexes, insert_indexes) + + struct insert_proposer_policy_index_pair { + uint16_t index = {}; + producer_authority value = {}; + }; + + EOSIO_REFLECT(insert_proposer_policy_index_pair, index, value) + + struct proposer_policy_diff { + uint32_t version = {}; + eosio::block_timestamp proposal_time = {}; + std::vector remove_indexes = {}; + std::vector insert_indexes = {}; + }; + + EOSIO_REFLECT(proposer_policy_diff, version, proposal_time, remove_indexes, insert_indexes) + + struct finality_extension { + ship_protocol::qc_claim qc_claim = {}; + std::optional new_finalizer_policy_diff = {}; + std::optional new_proposer_policy_diff = {}; + }; + + EOSIO_REFLECT(finality_extension, qc_claim, new_finalizer_policy_diff, new_proposer_policy_diff) + + using block_header_extension = std::variant; }} // namespace eosio::ship_protocol diff --git a/src/ship.abi.cpp b/src/ship.abi.cpp index 7b74f33..fb5cf7f 100644 --- a/src/ship.abi.cpp +++ b/src/ship.abi.cpp @@ -588,6 +588,13 @@ extern const char* const state_history_plugin_abi = R"({ { "type": "uint32", "name": "account_net_usage_average_window" } ] }, + { + "name": "finalizer_authority", "fields": [ + { "name": "description", "type": "string" }, + { "name": "weight", "type": "uint64" }, + { "name": "public_key", "type": "bytes" } + ] + }, { "name": "finalizer_authority_with_string_key", "fields": [ { "name": "description", "type": "string" }, @@ -607,10 +614,63 @@ extern const char* const state_history_plugin_abi = R"({ { "name": "major_version", "type": "uint32" }, { "name": "minor_version", "type": "uint32" }, { "name": "active_finalizer_policy_generation", "type": "uint32" }, - { "name": "final_on_strong_qc_block_num", "type": "uint32" }, { "name": "action_mroot", "type": "checksum256" }, + { "name": "reversible_blocks_mroot", "type": "checksum256" }, + { "name": "latest_qc_claim_block_num", "type": "uint32" }, + { "name": "latest_qc_claim_finality_digest", "type": "checksum256" }, + { "name": "latest_qc_claim_timestamp", "type": "block_timestamp_type" }, { "name": "base_digest", "type": "checksum256" }, - { "name": "pending_finalizer_policy", "type": "finalizer_policy_with_string_key?" } + { "name": "pending_finalizer_policy", "type": "finalizer_policy_with_string_key?" }, + { "name": "last_pending_finalizer_policy_generation", "type": "uint32" } + ] + }, + { + "name": "protocol_feature_activation_extension", "fields": [ + { "name": "protocol_features", "type": "checksum256[]" } + ] + }, + { + "name": "producer_schedule_change_extension", "base": "producer_authority_schedule", "fields": [] + }, + { + "name": "qc_claim", "fields": [ + { "name": "block_num", "type": "uint32" }, + { "name": "is_strong_qc", "type": "bool" } + ] + }, + { + "name": "insert_finalizer_policy_index_pair", "fields": [ + { "name": "index", "type": "uint16" }, + { "name": "value", "type": "finalizer_authority" } + ] + }, + { + "name": "finalizer_policy_diff", "fields": [ + { "name": "generation", "type": "uint32" }, + { "name": "threshold", "type": "uint64" }, + { "name": "remove_indexes", "type": "uint16[]" }, + { "name": "insert_indexes", "type": "insert_finalizer_policy_index_pair[]" } + ] + }, + { + "name": "insert_proposer_policy_index_pair", "fields": [ + { "name": "index", "type": "uint16" }, + { "name": "value", "type": "producer_authority" } + ] + }, + { + "name": "proposer_policy_diff", "fields": [ + { "name": "version", "type": "uint32" }, + { "name": "proposal_time", "type": "block_timestamp_type" }, + { "name": "remove_indexes", "type": "uint16[]" }, + { "name": "insert_indexes", "type": "insert_proposer_policy_index_pair[]" } + ] + }, + { + "name": "finality_extension", "fields": [ + { "name": "qc_claim", "type": "qc_claim" }, + { "name": "new_finalizer_policy_diff", "type": "finalizer_policy_diff?" }, + { "name": "new_proposer_policy_diff", "type": "proposer_policy_diff?" } ] } ], @@ -653,7 +713,8 @@ extern const char* const state_history_plugin_abi = R"({ { "name": "resource_limits_ratio", "types": ["resource_limits_ratio_v0"] }, { "name": "elastic_limit_parameters", "types": ["elastic_limit_parameters_v0"] }, { "name": "resource_limits_config", "types": ["resource_limits_config_v0"] }, - { "name": "block_signing_authority", "types": ["block_signing_authority_v0"] } + { "name": "block_signing_authority", "types": ["block_signing_authority_v0"] }, + { "name": "block_header_extension", "types": ["protocol_feature_activation_extension", "producer_schedule_change_extension", "finality_extension"] } ], "tables": [ { "name": "account", "type": "account", "key_names": ["name"] },