Skip to content

Commit

Permalink
Merge branch 'develop' into feature/stream-proofs-api
Browse files Browse the repository at this point in the history
  • Loading branch information
dhedey committed Jan 25, 2024
2 parents 3e2f06f + 5ebaa9d commit 617281d
Show file tree
Hide file tree
Showing 33 changed files with 1,164 additions and 115 deletions.
56 changes: 56 additions & 0 deletions core-rust/core-api-server/core-api-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7771,6 +7771,9 @@ components:
properties:
network:
$ref: "#/components/schemas/NetworkIdentifier"
include_readiness_signals:
description: Whether to include protocol update readiness signals of active validator set (default false).
type: boolean
StateConsensusManagerResponse:
type: object
required:
Expand All @@ -7797,6 +7800,56 @@ components:
$ref: "#/components/schemas/Substate"
current_time_rounded_to_minutes:
$ref: "#/components/schemas/Substate"
current_validator_readiness_signals:
description: |
Protocol versions signalled by the current validator set.
Every validator from `current_validator_set` will be referenced by exactly one of the items here.
Only returned if enabled by `include_readiness_signals` on your request.
type: array
items:
$ref: "#/components/schemas/ProtocolVersionReadiness"
ProtocolVersionReadiness:
type: object
required:
- total_active_stake_proportion
- signalling_validators
properties:
signalled_protocol_version:
# Note: Re-using "#/components/schemas/ProtocolVersion" hits a quirk of the TypeScript's
# generator ("attribute components.schemas.ProtocolVersionReadiness.ProtocolVersion is not
# of type `schema`").
type: string
description: |
A name identifying a protocol version. May be absent to denote no readiness signalled by
the `signalling_validators`.
total_active_stake_proportion:
type: string
description: |
A sum of `active_stake_proportion` across `signalling_validators` (i.e. an easily-computable convenience field).
This is a string-encoded fixed-precision decimal to 18 decimal places.
A decimal is formed of some signed integer `m` of attos (`10^(-18)`) units, where `-2^(192 - 1) <= m < 2^(192 - 1)`.
signalling_validators:
description: |
References to some of the current validators (i.e. a subset of `current_validator_set`)
which have signalled readiness for the `signalled_protocol_version`.
type: array
items:
$ref: '#/components/schemas/SignallingValidator'
SignallingValidator:
type: object
required:
- index
- active_stake_proportion
properties:
index:
$ref: '#/components/schemas/ActiveValidatorIndex'
description: Validator index within the `current_validator_set`.
active_stake_proportion:
type: string
description: |
A proportion (between 0 and 1) of the total active stake of an entire `current_validator_set` (i.e. an easily-computable convenience field).
This is a string-encoded fixed-precision decimal to 18 decimal places.
A decimal is formed of some signed integer `m` of attos (`10^(-18)`) units, where `-2^(192 - 1) <= m < 2^(192 - 1)`.
###########################
# REQUEST: /state/account #
###########################
Expand Down Expand Up @@ -7939,6 +7992,7 @@ components:
- at_ledger_state
- address
- state
- protocol_update_readiness_signal
- owner_role
- vaults
- descendent_nodes
Expand All @@ -7950,6 +8004,8 @@ components:
$ref: '#/components/schemas/ComponentAddress'
state:
$ref: "#/components/schemas/Substate"
protocol_update_readiness_signal:
$ref: "#/components/schemas/Substate"
owner_role:
$ref: "#/components/schemas/Substate"
vaults:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub fn to_api_proposer_reward(
})
}

pub fn to_api_validator_substate(
pub fn to_api_validator_state_substate(
context: &MappingContext,
substate: &ValidatorStateFieldSubstate,
) -> Result<models::Substate, MappingError> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pub fn to_api_substate(
ValidatorTypedSubstateValue::Field(ValidatorTypedFieldSubstateValue::State(
validator_substate,
)),
)) => to_api_validator_substate(context, validator_substate)?,
)) => to_api_validator_state_substate(context, validator_substate)?,
TypedSubstateValue::MainModule(TypedMainModuleSubstateValue::Validator(
ValidatorTypedSubstateValue::Field(
ValidatorTypedFieldSubstateValue::ProtocolUpdateReadinessSignal(substate),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,8 @@ pub mod protocol_update_ledger_proof_origin;
pub use self::protocol_update_ledger_proof_origin::ProtocolUpdateLedgerProofOrigin;
pub mod protocol_update_ledger_proof_origin_all_of;
pub use self::protocol_update_ledger_proof_origin_all_of::ProtocolUpdateLedgerProofOriginAllOf;
pub mod protocol_version_readiness;
pub use self::protocol_version_readiness::ProtocolVersionReadiness;
pub mod public_key;
pub use self::public_key::PublicKey;
pub mod public_key_type;
Expand Down Expand Up @@ -920,6 +922,8 @@ pub mod scoped_type_id;
pub use self::scoped_type_id::ScopedTypeId;
pub mod scrypto_schema;
pub use self::scrypto_schema::ScryptoSchema;
pub mod signalling_validator;
pub use self::signalling_validator::SignallingValidator;
pub mod signature;
pub use self::signature::Signature;
pub mod signature_with_public_key;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Radix Core API - Babylon
*
* This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects.
*
* The version of the OpenAPI document: v1.0.4
*
* Generated by: https://openapi-generator.tech
*/




#[derive(Clone, Debug, PartialEq, Default, serde::Serialize, serde::Deserialize)]
pub struct ProtocolVersionReadiness {
/// A name identifying a protocol version. May be absent to denote no readiness signalled by the `signalling_validators`.
#[serde(rename = "signalled_protocol_version", skip_serializing_if = "Option::is_none")]
pub signalled_protocol_version: Option<String>,
/// A sum of `active_stake_proportion` across `signalling_validators` (i.e. an easily-computable convenience field). This is a string-encoded fixed-precision decimal to 18 decimal places. A decimal is formed of some signed integer `m` of attos (`10^(-18)`) units, where `-2^(192 - 1) <= m < 2^(192 - 1)`.
#[serde(rename = "total_active_stake_proportion")]
pub total_active_stake_proportion: String,
/// References to some of the current validators (i.e. a subset of `current_validator_set`) which have signalled readiness for the `signalled_protocol_version`.
#[serde(rename = "signalling_validators")]
pub signalling_validators: Vec<crate::core_api::generated::models::SignallingValidator>,
}

impl ProtocolVersionReadiness {
pub fn new(total_active_stake_proportion: String, signalling_validators: Vec<crate::core_api::generated::models::SignallingValidator>) -> ProtocolVersionReadiness {
ProtocolVersionReadiness {
signalled_protocol_version: None,
total_active_stake_proportion,
signalling_validators,
}
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Radix Core API - Babylon
*
* This API is exposed by the Babylon Radix node to give clients access to the Radix Engine, Mempool and State in the node. The default configuration is intended for use by node-runners on a private network, and is not intended to be exposed publicly. Very heavy load may impact the node's function. The node exposes a configuration flag which allows disabling certain endpoints which may be problematic, but monitoring is advised. This configuration parameter is `api.core.flags.enable_unbounded_endpoints` / `RADIXDLT_CORE_API_FLAGS_ENABLE_UNBOUNDED_ENDPOINTS`. This API exposes queries against the node's current state (see `/lts/state/` or `/state/`), and streams of transaction history (under `/lts/stream/` or `/stream`). If you require queries against snapshots of historical ledger state, you may also wish to consider using the [Gateway API](https://docs-babylon.radixdlt.com/). ## Integration and forward compatibility guarantees Integrators (such as exchanges) are recommended to use the `/lts/` endpoints - they have been designed to be clear and simple for integrators wishing to create and monitor transactions involving fungible transfers to/from accounts. All endpoints under `/lts/` have high guarantees of forward compatibility in future node versions. We may add new fields, but existing fields will not be changed. Assuming the integrating code uses a permissive JSON parser which ignores unknown fields, any additions will not affect existing code. Other endpoints may be changed with new node versions carrying protocol-updates, although any breaking changes will be flagged clearly in the corresponding release notes. All responses may have additional fields added, so clients are advised to use JSON parsers which ignore unknown fields on JSON objects.
*
* The version of the OpenAPI document: v1.0.4
*
* Generated by: https://openapi-generator.tech
*/




#[derive(Clone, Debug, PartialEq, Default, serde::Serialize, serde::Deserialize)]
pub struct SignallingValidator {
#[serde(rename = "index")]
pub index: Box<crate::core_api::generated::models::ActiveValidatorIndex>,
/// A proportion (between 0 and 1) of the total active stake of an entire `current_validator_set` (i.e. an easily-computable convenience field). This is a string-encoded fixed-precision decimal to 18 decimal places. A decimal is formed of some signed integer `m` of attos (`10^(-18)`) units, where `-2^(192 - 1) <= m < 2^(192 - 1)`.
#[serde(rename = "active_stake_proportion")]
pub active_stake_proportion: String,
}

impl SignallingValidator {
pub fn new(index: crate::core_api::generated::models::ActiveValidatorIndex, active_stake_proportion: String) -> SignallingValidator {
SignallingValidator {
index: Box::new(index),
active_stake_proportion,
}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ pub struct StateConsensusManagerRequest {
/// The logical name of the network
#[serde(rename = "network")]
pub network: String,
/// Whether to include protocol update readiness signals of active validator set (default false).
#[serde(rename = "include_readiness_signals", skip_serializing_if = "Option::is_none")]
pub include_readiness_signals: Option<bool>,
}

impl StateConsensusManagerRequest {
pub fn new(network: String) -> StateConsensusManagerRequest {
StateConsensusManagerRequest {
network,
include_readiness_signals: None,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ pub struct StateConsensusManagerResponse {
pub current_time: Option<crate::core_api::generated::models::Substate>, // Using Option permits Default trait; Will always be Some in normal use
#[serde(rename = "current_time_rounded_to_minutes")]
pub current_time_rounded_to_minutes: Option<crate::core_api::generated::models::Substate>, // Using Option permits Default trait; Will always be Some in normal use
/// Protocol versions signalled by the current validator set. Every validator from `current_validator_set` will be referenced by exactly one of the items here. Only returned if enabled by `include_readiness_signals` on your request.
#[serde(rename = "current_validator_readiness_signals", skip_serializing_if = "Option::is_none")]
pub current_validator_readiness_signals: Option<Vec<crate::core_api::generated::models::ProtocolVersionReadiness>>,
}

impl StateConsensusManagerResponse {
Expand All @@ -39,6 +42,7 @@ impl StateConsensusManagerResponse {
current_validator_set: Option::Some(current_validator_set),
current_time: Option::Some(current_time),
current_time_rounded_to_minutes: Option::Some(current_time_rounded_to_minutes),
current_validator_readiness_signals: None,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ pub struct StateValidatorResponse {
pub address: String,
#[serde(rename = "state")]
pub state: Option<crate::core_api::generated::models::Substate>, // Using Option permits Default trait; Will always be Some in normal use
#[serde(rename = "protocol_update_readiness_signal")]
pub protocol_update_readiness_signal: Option<crate::core_api::generated::models::Substate>, // Using Option permits Default trait; Will always be Some in normal use
#[serde(rename = "owner_role")]
pub owner_role: Option<crate::core_api::generated::models::Substate>, // Using Option permits Default trait; Will always be Some in normal use
/// Any vaults owned directly or indirectly by the component
Expand All @@ -31,11 +33,12 @@ pub struct StateValidatorResponse {
}

impl StateValidatorResponse {
pub fn new(at_ledger_state: crate::core_api::generated::models::LedgerStateSummary, address: String, state: crate::core_api::generated::models::Substate, owner_role: crate::core_api::generated::models::Substate, vaults: Vec<crate::core_api::generated::models::VaultBalance>, descendent_nodes: Vec<crate::core_api::generated::models::StateComponentDescendentNode>) -> StateValidatorResponse {
pub fn new(at_ledger_state: crate::core_api::generated::models::LedgerStateSummary, address: String, state: crate::core_api::generated::models::Substate, protocol_update_readiness_signal: crate::core_api::generated::models::Substate, owner_role: crate::core_api::generated::models::Substate, vaults: Vec<crate::core_api::generated::models::VaultBalance>, descendent_nodes: Vec<crate::core_api::generated::models::StateComponentDescendentNode>) -> StateValidatorResponse {
StateValidatorResponse {
at_ledger_state: Box::new(at_ledger_state),
address,
state: Option::Some(state),
protocol_update_readiness_signal: Option::Some(protocol_update_readiness_signal),
owner_role: Option::Some(owner_role),
vaults,
descendent_nodes,
Expand Down
Loading

0 comments on commit 617281d

Please sign in to comment.