Skip to content

Commit de9a293

Browse files
committed
fix: stellar external audit issues
fix: remove soroban contracts from root workspace members chore: upgrade soroban-sdk version to 21.7.4 chore: use different error message for different issues chore: add contract version methods and remove unused methods chore: add unit test for execute call and edge cases
1 parent cb69b17 commit de9a293

File tree

25 files changed

+841
-93
lines changed

25 files changed

+841
-93
lines changed

Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[workspace]
22
members = [
3-
"contracts/cosmwasm-vm/*",
4-
"contracts/soroban/contracts/*",
5-
"contracts/soroban/libs/*"
3+
"contracts/cosmwasm-vm/*"
64
]
75

86
[workspace.package]
@@ -38,8 +36,6 @@ cw-common={ git="https://github.com/icon-project/IBC-Integration.git", branch =
3836
cw-mock-dapp = {path="contracts/cosmwasm-vm/cw-mock-dapp"}
3937
cw-mock-dapp-multi = { path="contracts/cosmwasm-vm/cw-mock-dapp-multi"}
4038

41-
soroban-sdk = "21.6.0"
42-
4339
[profile.release]
4440
opt-level = 'z'
4541
debug = false

contracts/soroban/Cargo.lock

Lines changed: 59 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/soroban/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ members = [
66
]
77

88
[workspace.dependencies]
9-
soroban-sdk = "20.5.0"
9+
soroban-sdk = "21.7.4"
1010

1111
[profile.release]
1212
opt-level = "z"

contracts/soroban/contracts/centralized-connection/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ doctest = false
1010

1111
[dependencies]
1212
soroban-sdk = { workspace = true, features = ["alloc"] }
13+
xcall = { path = "../xcall" }
14+
soroban-xcall-lib = { path = "../../libs/soroban-xcall-lib" }
1315

1416
[dev-dependencies]
1517
soroban-sdk = { workspace = true, features = ["testutils"] }

contracts/soroban/contracts/centralized-connection/src/contract.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,13 @@ impl CentralizedConnection {
125125
helpers::ensure_upgrade_authority(&env)?;
126126
env.deployer().update_current_contract_wasm(new_wasm_hash);
127127

128+
let current_version = storage::get_contract_version(&env);
129+
storage::set_contract_version(&env, current_version + 1);
130+
128131
Ok(())
129132
}
130133

131-
pub fn extend_instance_storage(env: Env) -> Result<(), ContractError> {
132-
storage::extend_instance(&env);
133-
Ok(())
134+
pub fn version(env: Env) -> u32 {
135+
storage::get_contract_version(&env)
134136
}
135137
}

contracts/soroban/contracts/centralized-connection/src/storage.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ pub fn native_token(e: &Env) -> Result<Address, ContractError> {
5050
.ok_or(ContractError::Uninitialized)
5151
}
5252

53-
pub fn get_conn_sn(e: &Env) -> Result<u128, ContractError> {
54-
e.storage()
55-
.instance()
56-
.get(&StorageKey::ConnSn)
57-
.ok_or(ContractError::Uninitialized)
58-
}
59-
6053
pub fn get_next_conn_sn(e: &Env) -> u128 {
6154
let mut sn = e.storage().instance().get(&StorageKey::ConnSn).unwrap_or(0);
6255
sn += 1;
@@ -103,6 +96,19 @@ pub fn get_sn_receipt(e: &Env, network_id: String, sn: u128) -> bool {
10396
is_received
10497
}
10598

99+
pub fn get_contract_version(e: &Env) -> u32 {
100+
e.storage()
101+
.instance()
102+
.get(&StorageKey::Version)
103+
.unwrap_or(1)
104+
}
105+
106+
pub fn set_contract_version(e: &Env, new_version: u32) {
107+
e.storage()
108+
.instance()
109+
.set(&StorageKey::Version, &new_version);
110+
}
111+
106112
pub fn store_receipt(e: &Env, network_id: String, sn: u128) {
107113
let key = StorageKey::Receipts(network_id, sn);
108114
e.storage().persistent().set(&key, &true);

0 commit comments

Comments
 (0)