Skip to content

Commit

Permalink
[docs] Protocol config (#20884)
Browse files Browse the repository at this point in the history
## Description 

Instead of displaying all fields, display only select ones.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] gRPC:
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
  • Loading branch information
ronny-mysten authored Jan 14, 2025
1 parent 4ef192d commit 2166353
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/content/concepts/object-model.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The `ProtocolConfig` struct in the [`sui-protocol-config` crate](https://github.

Select a network from the following tabs to see the currently configured limits and values.

<ProtocolConfig/>
<ProtocolConfig fields="[max_accumulated_randomness_txn_cost_per_object_in_mysticeti_commit, max_accumulated_txn_cost_per_object_in_mysticeti_commit, max_accumulated_txn_cost_per_object_in_narwhal_commit, max_arguments, max_input_objects, max_gas_computation_bucket, max_gas_payment_objects, max_gas_price, max_move_object_size, max_num_event_emit, max_transactions_per_checkpoint, max_tx_gas, max_tx_size_bytes, max_txn_cost_overage_per_object_in_commit, max_type_argument_depth, max_type_arguments, max_type_nodes, max_type_to_layout_nodes, max_value_stack_size]"/>

## Related links

Expand Down
19 changes: 12 additions & 7 deletions docs/site/src/components/ProtocolConfig/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import axios from "axios";

export default function ProtocolConfig() {
export default function ProtocolConfig(props) {
const data = {
jsonrpc: "2.0",
id: 1,
Expand All @@ -25,6 +25,7 @@ export default function ProtocolConfig() {
});
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const { fields } = props;

const parseResult = (data) => {
let items = Object.entries(data);
Expand All @@ -44,7 +45,7 @@ export default function ProtocolConfig() {
const DisplayResults = (props) => {
const { results } = props;
return (
<table>
<table className="table w-full">
<thead>
<tr>
<th>Parameter</th>
Expand All @@ -54,11 +55,15 @@ export default function ProtocolConfig() {
</thead>
<tbody>
{results.map((item, index) => (
<tr key={index}>
<td>{item[0]}</td>
<td>{item[1]}</td>
<td>{item[2] ? item[2] : "null"}</td>
</tr>
<>
{(!fields || fields.includes(item[0])) && (
<tr key={index}>
<td>{item[0]}</td>
<td>{item[1]}</td>
<td>{item[2] ? item[2] : "null"}</td>
</tr>
)}
</>
))}
</tbody>
</table>
Expand Down

0 comments on commit 2166353

Please sign in to comment.