• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

madara-alliance / madara-bootstrapper / 14116412372

27 Mar 2025 08:47PM UTC coverage: 77.183% (-0.009%) from 77.192%
14116412372

Pull #26

github

web-flow
Merge 62bb60c7e into 787e328dd
Pull Request #26: Fixes

21 of 22 new or added lines in 6 files covered. (95.45%)

6 existing lines in 2 files now uncovered.

2077 of 2691 relevant lines covered (77.18%)

6.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.28
/src/setup_scripts/core_contract.rs
1
use std::str::FromStr;
2

3
use ethers::abi::Address;
4

5
use crate::contract_clients::config::Clients;
6
use crate::contract_clients::core_contract::{CoreContract, CoreContractDeploy};
7
use crate::contract_clients::starknet_core_contract::StarknetCoreContract;
8
use crate::contract_clients::starknet_dev_core_contract::StarknetDevCoreContract;
9
use crate::contract_clients::utils::get_bridge_init_configs;
10
use crate::utils::{hexstring_to_address, save_to_json, JsonValueType};
11
use crate::{ConfigFile, CoreContractMode};
12

13
pub struct CoreContractStarknetL1<'a> {
14
    arg_config: &'a ConfigFile,
15
    clients: &'a Clients,
16
}
17

18
pub struct CoreContractStarknetL1Output {
19
    pub core_contract_client: Box<dyn CoreContract>,
20
}
21

22
impl<'a> CoreContractStarknetL1<'a> {
23
    pub fn new(arg_config: &'a ConfigFile, clients: &'a Clients) -> Self {
1✔
24
        Self { arg_config, clients }
1✔
25
    }
1✔
26

27
    pub async fn setup(&self) -> CoreContractStarknetL1Output {
1✔
28
        let core_contract_client: Box<dyn CoreContract> = match self.arg_config.core_contract_mode {
1✔
UNCOV
29
            CoreContractMode::Production => Box::new(StarknetCoreContract::deploy(self.clients).await),
×
30
            CoreContractMode::Dev => Box::new(StarknetDevCoreContract::deploy(self.clients).await),
26✔
31
        };
32
        log::info!("📦 Core address : {:?}", core_contract_client.address());
1✔
33

34
        save_to_json("l1_core_contract_address", &JsonValueType::EthAddress(core_contract_client.address())).unwrap();
1✔
35
        let (program_hash, config_hash) = get_bridge_init_configs(self.arg_config);
1✔
36

1✔
37
        // add_implementation(
1✔
38
        //      call_data : [
1✔
39
        //        0, : block number
1✔
40
        //        0, : state root
1✔
41
        //        0, : block hash
1✔
42
        //        program_hash,
1✔
43
        //        config_hash,
1✔
44
        //        verifier_address
1✔
45
        //      ],
1✔
46
        //      implementation_address,
1✔
47
        //      finalized_implementation_bool
1✔
48
        // )
1✔
49
        core_contract_client
1✔
50
            .add_implementation_core_contract(
1✔
51
                0u64.into(), // block number
1✔
52
                0u64.into(), // state root
1✔
53
                0u64.into(), // block hash
1✔
54
                program_hash,
1✔
55
                config_hash,
1✔
56
                core_contract_client.implementation_address(),
1✔
57
                hexstring_to_address(&self.arg_config.verifier_address),
1✔
58
                false,
1✔
59
            )
1✔
60
            .await;
11✔
61
        // upgrade_to(
62
        //      call_data : [
63
        //        0, : block number
64
        //        0, : state root
65
        //        0, : block hash
66
        //        program_hash,
67
        //        config_hash,
68
        //        verifier_address
69
        //      ],
70
        //      implementation_address,
71
        //      finalized_implementation_bool
72
        // )
73
        core_contract_client
1✔
74
            .upgrade_to_core_contract(
1✔
75
                0u64.into(), // block number
1✔
76
                0u64.into(), // state root
1✔
77
                0u64.into(), // block hash
1✔
78
                program_hash,
1✔
79
                config_hash,
1✔
80
                core_contract_client.implementation_address(),
1✔
81
                hexstring_to_address(&self.arg_config.verifier_address),
1✔
82
                false,
1✔
83
            )
1✔
84
            .await;
11✔
85
        core_contract_client
1✔
86
            .register_operator_core_contract(hexstring_to_address(&self.arg_config.operator_address))
1✔
87
            .await;
11✔
88
        core_contract_client
1✔
89
            .nominate_governor_core_contract(hexstring_to_address(&self.arg_config.l1_multisig_address))
1✔
90
            .await;
11✔
91
        core_contract_client
1✔
92
            .nominate_governor_core_contract_proxy(hexstring_to_address(&self.arg_config.l1_multisig_address))
1✔
93
            .await;
11✔
94

95
        CoreContractStarknetL1Output { core_contract_client }
1✔
96
    }
1✔
97
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc