Skip to content

Commit

Permalink
feat(protocol): Add computation_cost_burned field to GasCostSummary
Browse files Browse the repository at this point in the history
  • Loading branch information
DaughterOfMars committed Nov 7, 2024
1 parent 9613695 commit fc75533
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/iota-rust-sdk/src/types/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,8 @@ mod serialization {
#[test]
fn signed_checkpoint_fixture() {
const FIXTURES: &[&str] = &[
"CgAAAAAAAAAUAAAAAAAAABUAAAAAAAAAIJ6CIMG/6Un4MKNM8h+R9r8bQ6dNTk0WZxBMUQH1XFQBASCWUVucdQkje+4YbXVpvQZcg74nndL1NK7ccj1dDR04agAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAKAAAAAAAAAKOonlp6Vf8dJEjQYa/VyigZruaZwSwu3u/ZZVCsdrS1iaGPIAERZcNnfM75tOh10hI6MAAAAQAAAAAAAAAQAAAAAAA=",
"AgAAAAAAAAAFAAAAAAAAAAYAAAAAAAAAIINaPEm+WRQV2vGcPR9fe6fYhxl48GpqB+DqDYQqRHkuASBe+6BDLHSRCMiWqBkvVMqWXPWUsZnpc2gbOVdre3vnowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAQFgqGJldzxWMt2CZow1QiLmDf0RdLE6udu0bVdc1xaExX37NByF27rDH5C1DF+mkpLdA6YZnXMvuUw+zoWo71qe2DTdIDU4AcNaSUE3OoEHceuT+fBa6dMib3yDkkhmOZLyECcAAAAAAAAkAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAK+WOf7UtYVKm7c8bHgGUiVVmrtuUUr59XtI48RTTP2fPuWCS/xrXYQD1HS0abyERhI6MAAAAQAAAAAAAAAQAAAAAAA=",
"CgAAAAAAAAAUAAAAAAAAABUAAAAAAAAAIJ6CIMG/6Un4MKNM8h+R9r8bQ6dNTk0WZxBMUQH1XFQBASCWUVucdQkje+4YbXVpvQZcg74nndL1NK7ccj1dDR04agAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAoAAAAAAAAAo6ieWnpV/x0kSNBhr9XKKBmu5pnBLC7e79llUKx2tLWJoY8gARFlw2d8zvm06HXSEjowAAABAAAAAAAAABAAAAAAAA==",
"AgAAAAAAAAAFAAAAAAAAAAYAAAAAAAAAIINaPEm+WRQV2vGcPR9fe6fYhxl48GpqB+DqDYQqRHkuASBe+6BDLHSRCMiWqBkvVMqWXPWUsZnpc2gbOVdre3vnowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAABAWCoYmV3PFYy3YJmjDVCIuYN/RF0sTq527RtV1zXFoTFffs0HIXbusMfkLUMX6aSkt0Dphmdcy+5TD7OhajvWp7YNN0gNTgBw1pJQTc6gQdx65P58Frp0yJvfIOSSGY5kvIQJwAAAAAAACQAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAr5Y5/tS1hUqbtzxseAZSJVWau25RSvn1e0jjxFNM/Z8+5YJL/GtdhAPUdLRpvIRGEjowAAABAAAAAAAAABAAAAAAAA==",
];

for fixture in FIXTURES {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
AAADAAAAAAAAAEBCDwAAAAAAgE08AAAAAADAJh4AAAAAAAAAAAAAAAAAIOrjkZAn7XCCmrYeV5FY1h8Qwc2PmKwuvMs/dTkbKtmTAQAAAAAAAiCWPACmeHYzWNdw8Ug2nmoZwl7EmkW8V+oxKTWVbwg5yiCo7vWKhdFVfDBrhPNL/dm8lEUakRX2mo7pCM88f1cyXgMAAAAAAAAABA0rm7unaqByv19SmTZUrEy3iuEr8ukanp4FrDMN6EfZAQIAAAAAAAAAIJWu62cTMqk+i1lFBl0iun+3KOQw7XAgDK+RqZSzaqt7AJk4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1atfZZruJFe1Hh5xlfwFxu9dzkyohQSxsAQIAAAAAAAAAICSc3TbBllfLRW3YdVuwYLAR90I9OSGRjqtuxl7oJKCUALeeoS0K7z7CBOvKx6pmSCEwh3VVlU+B/mhLvrZJ/1I7ASDSOCipmGyUeMUGatlg/dzjyBE/IYtaK2xniCOTjJXiLgC3nqEtCu8+wgTryseqZkghMId1VZVPgf5oS762Sf9SOwBNM15nnDCan3/5XR6H5GPNoxCGJzKCBXQ2RS4alIDZYwABICNTZ4X/uYTJpRs8yxcLvu4wpChezAubDDFfAN9f/p/AABEREREVBOk1DmNdZc04zNLAKUNMajpIDYlHqbpqFbIVAcVPCOTme+HdUkr6XwtMQja5B0vWl0dSokShwTp55FnnAAEgN6YVrhzZPJwQvGwyu3MNsu7a/k1XRTxS37EC6LAUCe0Aoal9ILuteeKsifIVo7PE8v+aGqPMJuUpvebnvFUA1hABAAA=
8 changes: 8 additions & 0 deletions crates/iota-rust-sdk/src/types/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ pub struct GasCostSummary {
#[cfg_attr(feature = "schemars", schemars(with = "crate::_schemars::U64"))]
pub computation_cost: u64,

/// The burned component of the computation/execution costs
#[cfg_attr(feature = "serde", serde(with = "crate::_serde::ReadableDisplay"))]
#[cfg_attr(feature = "schemars", schemars(with = "crate::_schemars::U64"))]
pub computation_cost_burned: u64,

/// Storage cost, it's the sum of all storage cost for all objects created
/// or mutated.
#[cfg_attr(feature = "serde", serde(with = "crate::_serde::ReadableDisplay"))]
Expand All @@ -58,12 +63,14 @@ pub struct GasCostSummary {
impl GasCostSummary {
pub fn new(
computation_cost: u64,
computation_cost_burned: u64,
storage_cost: u64,
storage_rebate: u64,
non_refundable_storage_fee: u64,
) -> GasCostSummary {
GasCostSummary {
computation_cost,
computation_cost_burned,
storage_cost,
storage_rebate,
non_refundable_storage_fee,
Expand Down Expand Up @@ -106,6 +113,7 @@ mod test {
fn formats() {
let actual = GasCostSummary {
computation_cost: 42,
computation_cost_burned: 24,
storage_cost: u64::MAX,
storage_rebate: 0,
non_refundable_storage_fee: 9,
Expand Down

0 comments on commit fc75533

Please sign in to comment.