Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol): PCR-2 iota-rest-api #5276

Open
wants to merge 1 commit into
base: protocol/pcr2-clean
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 78 additions & 2 deletions crates/iota-rest-api/openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,76 @@
}
}
},
{
"type": "object",
"required": [
"computation_charge",
"computation_charge_burned",
"epoch",
"epoch_start_timestamp_ms",
"kind",
"non_refundable_storage_fee",
"protocol_version",
"storage_charge",
"storage_rebate",
"system_packages"
],
"properties": {
"computation_charge": {
"description": "The total amount of gas charged for computation during the epoch.",
"type": "string",
"format": "u64"
},
"computation_charge_burned": {
"description": "The total amount of gas burned for computation during the epoch.",
"type": "string",
"format": "u64"
},
"epoch": {
"description": "The next (to become) epoch ID.",
"type": "string",
"format": "u64"
},
"epoch_start_timestamp_ms": {
"description": "Unix timestamp when epoch started",
"type": "string",
"format": "u64"
},
"kind": {
"type": "string",
"enum": [
"change_epoch_v2"
]
},
"non_refundable_storage_fee": {
"description": "The non-refundable storage fee.",
"type": "string",
"format": "u64"
},
"protocol_version": {
"description": "The protocol version in effect in the new epoch.",
"type": "string",
"format": "u64"
},
"storage_charge": {
"description": "The total amount of gas charged for storage during the epoch.",
"type": "string",
"format": "u64"
},
"storage_rebate": {
"description": "The amount of storage rebate refunded to the txn senders.",
"type": "string",
"format": "u64"
},
"system_packages": {
"description": "System packages (specifically framework and move stdlib) that are written before the new epoch starts. This tracks framework upgrades on chain. When executing the ChangeEpoch txn, the validator must write out the modules below. Modules are provided with the version they will be upgraded to, their modules in serialized form (which include their package ID), and a list of their transitive dependencies.",
"type": "array",
"items": {
"$ref": "#/components/schemas/SystemPackage"
}
}
}
},
{
"type": "object",
"required": [
Expand Down Expand Up @@ -3918,7 +3988,8 @@
"protocol_version",
"reference_gas_price",
"safe_mode",
"safe_mode_computation_rewards",
"safe_mode_computation_charges",
"safe_mode_computation_charges_burned",
"safe_mode_non_refundable_storage_fee",
"safe_mode_storage_charges",
"safe_mode_storage_rebates",
Expand Down Expand Up @@ -4054,11 +4125,16 @@
"description": "Whether the system is running in a downgraded safe mode due to a non-recoverable bug. This is set whenever we failed to execute advance_epoch, and ended up executing advance_epoch_safe_mode. It can be reset once we are able to successfully execute advance_epoch.",
"type": "boolean"
},
"safe_mode_computation_rewards": {
"safe_mode_computation_charges": {
"description": "Amount of computation rewards accumulated (and not yet distributed) during safe mode.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewards should be charges.

"type": "string",
"format": "u64"
},
"safe_mode_computation_charges_burned": {
"description": "Amount of burned computation rewards accumulated during safe mode.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Amount of burned computation rewards accumulated during safe mode.",
"description": "Amount of burned computation charges accumulated during safe mode.",

"type": "string",
"format": "u64"
},
"safe_mode_non_refundable_storage_fee": {
"description": "Amount of non-refundable storage fee accumulated during safe mode.",
"type": "string",
Expand Down
12 changes: 9 additions & 3 deletions crates/iota-rest-api/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ pub struct SystemStateSummary {
/// during safe mode.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one line above rewards should be charges

#[serde_as(as = "iota_types::iota_serde::BigInt<u64>")]
#[schemars(with = "crate::_schemars::U64")]
pub safe_mode_computation_rewards: u64,
pub safe_mode_computation_charges: u64,
/// Amount of burned computation rewards accumulated during safe mode.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Amount of burned computation rewards accumulated during safe mode.
/// Amount of burned computation charges accumulated during safe mode.

#[serde_as(as = "iota_types::iota_serde::BigInt<u64>")]
#[schemars(with = "crate::_schemars::U64")]
pub safe_mode_computation_charges_burned: u64,
/// Amount of storage rebates accumulated (and not yet burned) during safe
/// mode.
#[serde_as(as = "iota_types::iota_serde::BigInt<u64>")]
Expand Down Expand Up @@ -443,7 +447,8 @@ impl From<iota_types::iota_system_state::iota_system_state_summary::IotaSystemSt
reference_gas_price,
safe_mode,
safe_mode_storage_charges,
safe_mode_computation_rewards,
safe_mode_computation_charges,
safe_mode_computation_charges_burned,
safe_mode_storage_rebates,
safe_mode_non_refundable_storage_fee,
epoch_start_timestamp_ms,
Expand Down Expand Up @@ -480,7 +485,8 @@ impl From<iota_types::iota_system_state::iota_system_state_summary::IotaSystemSt
reference_gas_price,
safe_mode,
safe_mode_storage_charges,
safe_mode_computation_rewards,
safe_mode_computation_charges,
safe_mode_computation_charges_burned,
safe_mode_storage_rebates,
safe_mode_non_refundable_storage_fee,
epoch_start_timestamp_ms,
Expand Down
Loading