From eabbf03be2c292a32114c93ea29e8aeadabff21e Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Fri, 15 Sep 2023 08:14:48 +0000 Subject: [PATCH] fix: work around a few new rpc issues --- starknet-accounts/tests/single_owner_account.rs | 2 ++ starknet-core/src/types/contract/legacy.rs | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/starknet-accounts/tests/single_owner_account.rs b/starknet-accounts/tests/single_owner_account.rs index 14394a67..92a884b4 100644 --- a/starknet-accounts/tests/single_owner_account.rs +++ b/starknet-accounts/tests/single_owner_account.rs @@ -347,6 +347,8 @@ async fn can_declare_cairo0_contract_inner(provider: let result = account .declare_legacy(Arc::new(contract_artifact)) + // There seems to be a fee estimation issue with `pathfinder` + .fee_estimate_multiplier(2.0) .send() .await .unwrap(); diff --git a/starknet-core/src/types/contract/legacy.rs b/starknet-core/src/types/contract/legacy.rs index 7d20c5e9..665376fa 100644 --- a/starknet-core/src/types/contract/legacy.rs +++ b/starknet-core/src/types/contract/legacy.rs @@ -510,6 +510,9 @@ impl LegacyProgram { compiler_version: &'a Option, #[serde_as(as = "Vec")] data: &'a Vec, + // Needed due to pathfinder bug: + // https://github.com/eqlabs/pathfinder/issues/1371 + debug_info: EmptyDebugInfo, hints: &'a BTreeMap>, identifiers: &'a BTreeMap, main_scope: &'a String, @@ -517,11 +520,24 @@ impl LegacyProgram { reference_manager: &'a LegacyReferenceManager, } + #[derive(Serialize)] + pub struct EmptyDebugInfo { + file_contents: Unit, + instruction_locations: Unit, + } + + #[derive(Serialize)] + pub struct Unit {} + let program_json = serde_json::to_string(&ProgramWithoutDebugInfo { attributes: &self.attributes, builtins: &self.builtins, compiler_version: &self.compiler_version, data: &self.data, + debug_info: EmptyDebugInfo { + file_contents: Unit {}, + instruction_locations: Unit {}, + }, hints: &self.hints, identifiers: &self.identifiers, main_scope: &self.main_scope,