Skip to content

Commit

Permalink
do not fail the request if objects are pruned for object and balance …
Browse files Browse the repository at this point in the history
…change (#11476)

## Description 

as titled.

Tested on testnet:

request
```
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sui_getTransactionBlock",
  "params": ["Cgww1sn7XViCPSdDcAPmVcARueWuexJ8af8zD842Ff43", {"showBalanceChanges": true, "showObjectChanges":true}]
}
```

response:
```
{
    "jsonrpc": "2.0",
    "result": {
        "digest": "Cgww1sn7XViCPSdDcAPmVcARueWuexJ8af8zD842Ff43",
        "timestampMs": "1679936400000",
        "checkpoint": "0",
        "errors": [
            "Cannot retrieve balance changes: Error checking transaction input objects: ObjectNotFound { object_id: 0x0000000000000000000000000000000000000000000000000000000000000002, version: Some(SequenceNumber(1)) }",
            "Cannot retrieve object changes: Error checking transaction input objects: ObjectNotFound { object_id: 0x0000000000000000000000000000000000000000000000000000000000000002, version: Some(SequenceNumber(1)) }"
        ]
    },
    "id": 1
}
```
  • Loading branch information
patrickkuo committed Apr 28, 2023
1 parent f8b5ad9 commit deb8d58
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions crates/sui-json-rpc/src/read_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,16 @@ impl ReadApiServer for ReadApi {
input_objects,
None,
)
.await
.map_err(Error::SuiError)?;
temp_response.balance_changes = Some(balance_changes);
.await;

if let Ok(balance_changes) = balance_changes {
temp_response.balance_changes = Some(balance_changes);
} else {
temp_response.errors.push(format!(
"Cannot retrieve balance changes: {}",
balance_changes.unwrap_err()
));
}
}
}

Expand All @@ -720,9 +727,16 @@ impl ReadApiServer for ReadApi {
effects.all_changed_objects(),
effects.all_deleted(),
)
.await
.map_err(Error::SuiError)?;
temp_response.object_changes = Some(object_changes);
.await;

if let Ok(object_changes) = object_changes {
temp_response.object_changes = Some(object_changes);
} else {
temp_response.errors.push(format!(
"Cannot retrieve object changes: {}",
object_changes.unwrap_err()
));
}
}
}
let epoch_store = self.state.load_epoch_store_one_call_per_task();
Expand Down

2 comments on commit deb8d58

@vercel
Copy link

@vercel vercel bot commented on deb8d58 Apr 28, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

sui-wallet-kit – ./sdk/wallet-adapter/site

sui-wallet-kit-mysten-labs.vercel.app
sui-wallet-kit.vercel.app
sui-wallet-kit-git-main-mysten-labs.vercel.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

4 Validators 500/s Owned Transactions Benchmark Results

Benchmark Report:
+-------------+------+------+--------+---------------+---------------+---------------+-----------------------+----------------------------+
| duration(s) | tps  | cps  | error% | latency (min) | latency (p50) | latency (p99) | gas used (MIST total) | gas used/hr (MIST approx.) |
+=========================================================================================================================================+
| 60          | 1000 | 1000 | 0      | 14            | 25            | 37            | 803,183,712,000       | 48,191,022,720,000         |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 38  | 47  |

4 Validators 500/s Shared Transactions Benchmark Results

Benchmark Report:
+-------------+-----+-----+--------+---------------+---------------+---------------+-----------------------+----------------------------+
| duration(s) | tps | cps | error% | latency (min) | latency (p50) | latency (p99) | gas used (MIST total) | gas used/hr (MIST approx.) |
+=======================================================================================================================================+
| 60          | 994 | 994 | 0      | 14            | 259           | 438           | 868,011,878,400       | 52,080,712,704,000         |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 42  | 58  |

20 Validators 50/s Owned Transactions Benchmark Results

Benchmark Report:
+-------------+-----+-----+--------+---------------+---------------+---------------+-----------------------+----------------------------+
| duration(s) | tps | cps | error% | latency (min) | latency (p50) | latency (p99) | gas used (MIST total) | gas used/hr (MIST approx.) |
+=======================================================================================================================================+
| 60          | 200 | 200 | 0      | 29            | 76            | 109           | 160,751,616,000       | 9,645,096,960,000          |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 49  | 64  |

20 Validators 50/s Shared Transactions Benchmark Results

Benchmark Report:
+-------------+-----+-----+--------+---------------+---------------+---------------+-----------------------+----------------------------+
| duration(s) | tps | cps | error% | latency (min) | latency (p50) | latency (p99) | gas used (MIST total) | gas used/hr (MIST approx.) |
+=======================================================================================================================================+
| 60          | 197 | 197 | 0      | 68            | 547           | 1660          | 190,399,876,800       | 11,423,992,608,000         |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 49  | 74  |

Narwhal Benchmark Results

 SUMMARY:
-----------------------------------------
 + CONFIG:
 Faults: 0 node(s)
 Committee size: 4 node(s)
 Worker(s) per node: 1 worker(s)
 Collocate primary and workers: True
 Input rate: 50,000 tx/s
 Transaction size: 512 B
 Execution time: 0 s

 Header number of batches threshold: 32 digests
 Header maximum number of batches: 1,000 digests
 Max header delay: 2,000 ms
 GC depth: 50 round(s)
 Sync retry delay: 10,000 ms
 Sync retry nodes: 3 node(s)
 batch size: 500,000 B
 Max batch delay: 200 ms
 Max concurrent requests: 500,000 

 + RESULTS:
 Batch creation avg latency: 202 ms
 Header creation avg latency: -1 ms
 	Batch to header avg latency: -1 ms
 Header to certificate avg latency: 2 ms
 	Request vote outbound avg latency: 0 ms
 Certificate commit avg latency: 844 ms

 Consensus TPS: 0 tx/s
 Consensus BPS: 0 B/s
 Consensus latency: 0 ms

 End-to-end TPS: 0 tx/s
 End-to-end BPS: 0 B/s
 End-to-end latency: 0 ms
-----------------------------------------

Please sign in to comment.