How would I go about measuring the size of the state that is being used for storage of the current contract? I have the idea to iterate through the state tree using the host functions, but what is the root prefix of the current contract? Is it 0?
You can get the entire state of the contract using
GetInstanceState GRPC V2 endpoint.
See https://github.com/Concordium/concordium-rust-sdk/blob/main/examples/v2_get_instance_state.rs for an example, which also outputs the size of the state.
The state root is currently at the empty key