hashgraph / hedera-services

Crypto, token, consensus, file, and smart contract services for the Hedera public ledger
Apache License 2.0
281 stars 125 forks source link

Establish whether `WritableSingletonState` should accept nulls and update javadoc/implementation accordingly #14582

Open tinker-michaelj opened 1 month ago

tinker-michaelj commented 1 month ago

Description

The current WritableSingletonState#put(T) API definition is documented as accepting null values; but its canonical Merkle implementation is based on a SingletonNode whose ValueLeaf wrapper has a serialize() implementation that will throw a NPE given a null value.

Steps to reproduce

Try to serialize a MerkleStateRoot with a SingletonState whose value is null.

Additional context

No response

Hedera network

other

Version

develop

Operating system

None

rbair23 commented 1 month ago

Probably better to not allow null, and then only change our mind if there is a compelling reason to do so.