Skip to content

feat: add size_bytes to ContractState in diagnostics#52

Open
TDiffff wants to merge 1 commit intofreenet:mainfrom
TDiffff:feat/diagnostics-contract-size
Open

feat: add size_bytes to ContractState in diagnostics#52
TDiffff wants to merge 1 commit intofreenet:mainfrom
TDiffff:feat/diagnostics-contract-size

Conversation

@TDiffff
Copy link

@TDiffff TDiffff commented Feb 12, 2026

Summary

  • Add size_bytes: u64 field to ContractState so diagnostics responses include contract state size
  • Uses #[serde(default)] for backwards compatibility — old responses without this field deserialize to 0

Knowing the size of hosted contract states without downloading them is useful for monitoring dashboards, resource-aware clients, and any application that needs to filter or prioritize contracts based on their state size.

Test plan

  • All existing tests pass (cargo test — 6 tests)
  • Verify old ContractState payloads without size_bytes deserialize correctly (serde default)

TDiffff added a commit to TDiffff/freenet-core that referenced this pull request Feb 12, 2026
Populate the new `size_bytes` field in `ContractState` during
diagnostics collection. Reads from the in-memory hosting cache
(already loaded at startup), adding zero disk I/O.

Depends on freenet/freenet-stdlib#52 — once merged and published,
bump freenet-stdlib version in Cargo.toml.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant