/// The hash of a ContractClass.
#[derive(
Debug,
Default,
Copy,
Clone,
Eq,
PartialEq,
Hash,
Deserialize,
Serialize,
PartialOrd,
Ord,
Display,
)]
#[cfg_attr(
feature = "parity-scale-codec",
derive(parity_scale_codec::Encode, parity_scale_codec::Decode)
)]
#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))]
pub struct ClassHash(pub StarkHash);
/// The hash of a compiled ContractClass.
#[derive(
Debug,
Default,
Copy,
Clone,
Eq,
PartialEq,
Hash,
Deserialize,
Serialize,
PartialOrd,
Ord,
Display,
)]
#[cfg_attr(
feature = "parity-scale-codec",
derive(parity_scale_codec::Encode, parity_scale_codec::Decode)
)]
#[cfg_attr(feature = "scale-info", derive(scale_info::TypeInfo))]
pub struct CompiledClassHash(pub StarkHash);
So we have two really similar struct here.
We are using two types of class hashes in Starknet, the hash of the contract compiled to sierra and the one of the contract compiled to casm.
So my guess is that ClassHash is SierraClassHash and CompiledClassHash is for CasmClassHash.
But that could be the opposite. It's misleading because both hashes are the hashes of a compiled object, one to Sierra, and the other to Casm.
It could also be that the first one is the hash of something that is not compiled (in opposition to the second), so is the hash of the .cairo files? Or the hash of the in-memory ContractClass struct?
Would it be possible to shed some light on this? And change in naming to make it explicit for lib users. And some doc.
So we have two really similar struct here.
We are using two types of class hashes in Starknet, the hash of the contract compiled to sierra and the one of the contract compiled to casm.
So my guess is that
ClassHashisSierraClassHashandCompiledClassHashis forCasmClassHash.But that could be the opposite. It's misleading because both hashes are the hashes of a compiled object, one to Sierra, and the other to Casm.
It could also be that the first one is the hash of something that is not compiled (in opposition to the second), so is the hash of the
.cairofiles? Or the hash of the in-memoryContractClassstruct?Would it be possible to shed some light on this? And change in naming to make it explicit for lib users. And some doc.