Skip to content

Commit

Permalink
dev: minor changes on casing
Browse files Browse the repository at this point in the history
  • Loading branch information
Harsh Bajpai authored and Harsh Bajpai committed Oct 17, 2023
1 parent 03f5be8 commit b85f3ad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
5 changes: 2 additions & 3 deletions crates/contracts/src/kakarot_core/kakarot.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ struct ContractAccountStorage {
mod KakarotCore {
use contracts::components::ownable::ownable_component::InternalTrait;
use contracts::components::ownable::{ownable_component};
use contracts::components::upgradeable::IUpgradeable;
use contracts::components::upgradeable::{upgradeable_component};
use contracts::components::upgradeable::{IUpgradeable, upgradeable_component};
use contracts::kakarot_core::interface::IKakarotCore;
use contracts::kakarot_core::interface;
use core::hash::{HashStateExTrait, HashStateTrait};
Expand All @@ -44,7 +43,7 @@ mod KakarotCore {

impl OwnableInternalImpl = ownable_component::InternalImpl<ContractState>;

impl upgradeableImpl = upgradeable_component::UpgradeableImpl<ContractState>;
impl upgradeableImpl = upgradeable_component::Upgradeable<ContractState>;

#[storage]
struct Storage {
Expand Down
49 changes: 24 additions & 25 deletions crates/contracts/src/tests/test_upgradeable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,6 @@ impl TestingStateDefault of Default<TestingState> {
}
}

#[test]
#[available_gas(500000)]
fn test_upgradeable_update_contract() {
let (contract_address, _) = deploy_syscall(
MockContractUpgradeableV0::TEST_CLASS_HASH.try_into().unwrap(), 0, array![].span(), false
)
.unwrap();

let version = IMockContractUpgradeableDispatcher { contract_address: contract_address }
.version();

assert(version == 0, 'version is not 0');

let mut call_data: Array<felt252> = array![];

let new_class_hash: ClassHash = MockContractUpgradeableV1::TEST_CLASS_HASH.try_into().unwrap();

IUpgradeableDispatcher { contract_address: contract_address }.upgrade_contract(new_class_hash);

let version = IMockContractUpgradeableDispatcher { contract_address: contract_address }
.version();
assert(version == 1, 'version is not 1');
}


#[starknet::contract]
mod MockContractUpgradeableV1 {
use contracts::components::upgradeable::{upgradeable_component};
Expand All @@ -100,3 +75,27 @@ mod MockContractUpgradeableV1 {
}
}
}

#[test]
#[available_gas(500000)]
fn test_upgradeable_update_contract() {
let (contract_address, _) = deploy_syscall(
MockContractUpgradeableV0::TEST_CLASS_HASH.try_into().unwrap(), 0, array![].span(), false
)
.unwrap();

let version = IMockContractUpgradeableDispatcher { contract_address: contract_address }
.version();

assert(version == 0, 'version is not 0');

let mut call_data: Array<felt252> = array![];

let new_class_hash: ClassHash = MockContractUpgradeableV1::TEST_CLASS_HASH.try_into().unwrap();

IUpgradeableDispatcher { contract_address: contract_address }.upgrade_contract(new_class_hash);

let version = IMockContractUpgradeableDispatcher { contract_address: contract_address }
.version();
assert(version == 1, 'version is not 1');
}

0 comments on commit b85f3ad

Please sign in to comment.