pathfinder icon indicating copy to clipboard operation
pathfinder copied to clipboard

Disallow decimal strings for starknet_addInvokeTransaction

Open CHr15F0x opened this issue 2 years ago • 0 comments

Remove the: #[serde_as(as = "Vec<CallSignatureElemAsDecimalStr>")]:

        module.register_async_method(
            "starknet_addInvokeTransaction",
            |params, context| async move {
                #[serde_with::serde_as]
                #[derive(Debug, Deserialize)]
                struct NamedArgs {
                    function_invocation: ContractCall,
                    #[serde_as(as = "Vec<CallSignatureElemAsDecimalStr>")]
                    signature: Vec<CallSignatureElem>,
                    #[serde_as(as = "FeeAsHexStr")]
                    max_fee: Fee,
                    #[serde_as(as = "TransactionVersionAsHexStr")]
                    version: TransactionVersion,
                }
                let params = params.parse::<NamedArgs>()?;
                context
                    .add_invoke_transaction(
                        params.function_invocation,
                        params.signature,
                        params.max_fee,
                        params.version,
                    )
                    .await
            },
        )?;

The hex representation is correctly deserialized only because of the fallback to hex in starkhash_from_dec_str.

CHr15F0x avatar Aug 29 '22 09:08 CHr15F0x