madara: feat: `to_rpc_contract_class` is still returning contracts with a lot of missing data

/// Returns a [`ContractClass`] from a [`BlockifierContractClass`]
pub fn to_rpc_contract_class(contract_class: BlockifierContractClass) -> Result<ContractClass> {
    match contract_class {
        BlockifierContractClass::V0(contract_class) => {
            let entry_points_by_type = to_legacy_entry_points_by_type(&contract_class.entry_points_by_type)?;
            let compressed_program = compress(&contract_class.program.to_bytes())?;
            Ok(ContractClass::Legacy(CompressedLegacyContractClass {
                program: compressed_program,
                entry_points_by_type,
                // FIXME 723
                abi: None,
            }))
        }
        BlockifierContractClass::V1(_contract_class) => Ok(ContractClass::Sierra(FlattenedSierraClass {
            sierra_program: vec![], // FIXME: https://github.com/keep-starknet-strange/madara/issues/775
            contract_class_version: option_env!("COMPILER_VERSION").unwrap_or("0.11.2").into(),
            entry_points_by_type: EntryPointsByType { constructor: vec![], external: vec![], l1_handler: vec![] }, /* TODO: add entry_points_by_type */
            abi: String::from("{}"), // FIXME: https://github.com/keep-starknet-strange/madara/issues/790
        })),
    }
}

This piece of code is still missing most fields. How to solve this?

Possible solution:

  • store the data lost when passed to the runtime (eg. abi) in a kvStorage in the client, read them back from there when answering get_class rpc request

About this issue

  • Original URL
  • State: open
  • Created 7 months ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

I will come back to this after completing the other task you just assigned to me. If you don’t mind, you can assign this to me too.

@tdelabro started a discussion there

Hi, would be interested to work on this.