Compare commits

...

2 Commits

Author SHA1 Message Date
Jędrzej Stuczyński e8617c2856 temporarily disabled ability to migrate vested delegation 2024-09-25 15:15:42 +01:00
Bogdan-Ștefan Neacşu 65c8982cab Bump defguard to github latest version (#4872) (#4884)
* Bump defguard to github latest version

* Fix comment location
2024-09-16 15:59:34 +02:00
5 changed files with 37 additions and 26 deletions
Generated
+9 -9
View File
@@ -1850,11 +1850,10 @@ checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2"
[[package]] [[package]]
name = "defguard_wireguard_rs" name = "defguard_wireguard_rs"
version = "0.4.2" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/DefGuard/wireguard-rs.git?rev=v0.4.7#ef1cf3714629bf5016fb38cbb7320451dc69fb09"
checksum = "6ba16f17698d4b389907310af018b0c3a80b025bba9c38d947cbc6dd70921743"
dependencies = [ dependencies = [
"base64 0.21.7", "base64 0.22.1",
"libc", "libc",
"log", "log",
"netlink-packet-core", "netlink-packet-core",
@@ -1863,7 +1862,7 @@ dependencies = [
"netlink-packet-utils", "netlink-packet-utils",
"netlink-packet-wireguard", "netlink-packet-wireguard",
"netlink-sys", "netlink-sys",
"nix 0.27.1", "nix 0.29.0",
"serde", "serde",
"thiserror", "thiserror",
] ]
@@ -3991,14 +3990,15 @@ dependencies = [
[[package]] [[package]]
name = "netlink-packet-route" name = "netlink-packet-route"
version = "0.17.1" version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "053998cea5a306971f88580d0829e90f270f940befd7cf928da179d4187a5a66" checksum = "55e5bda7ca0f9ac5e75b5debac3b75e29a8ac8e2171106a2c3bb466389a8dd83"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bitflags 1.3.2", "bitflags 2.5.0",
"byteorder", "byteorder",
"libc", "libc",
"log",
"netlink-packet-core", "netlink-packet-core",
"netlink-packet-utils", "netlink-packet-utils",
] ]
@@ -4058,7 +4058,6 @@ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"cfg-if", "cfg-if",
"libc", "libc",
"memoffset",
] ]
[[package]] [[package]]
@@ -4071,6 +4070,7 @@ dependencies = [
"cfg-if", "cfg-if",
"cfg_aliases", "cfg_aliases",
"libc", "libc",
"memoffset",
] ]
[[package]] [[package]]
+2 -1
View File
@@ -204,7 +204,8 @@ ctr = "0.9.1"
cupid = "0.6.1" cupid = "0.6.1"
curve25519-dalek = "4.1" curve25519-dalek = "4.1"
dashmap = "5.5.3" dashmap = "5.5.3"
defguard_wireguard_rs = "0.4.2" # We want https://github.com/DefGuard/wireguard-rs/pull/64 , but there's no crates.io release being pushed out anymore
defguard_wireguard_rs = { git = "https://github.com/DefGuard/wireguard-rs.git", rev = "v0.4.7" }
digest = "0.10.7" digest = "0.10.7"
dirs = "4.0" dirs = "4.0"
doc-comment = "0.3" doc-comment = "0.3"
@@ -258,6 +258,9 @@ pub enum MixnetContractError {
provided: Uint128, provided: Uint128,
range: OperatingCostRange, range: OperatingCostRange,
}, },
#[error("this operation is temporarily disabled. please try again later")]
TemporarilyDisabled,
} }
impl MixnetContractError { impl MixnetContractError {
+1
View File
@@ -114,6 +114,7 @@ pub async fn start_wireguard<St: nym_gateway_storage::Storage + 'static>(
address: wireguard_data.inner.config().private_ip.to_string(), address: wireguard_data.inner.config().private_ip.to_string(),
port: wireguard_data.inner.config().announced_port as u32, port: wireguard_data.inner.config().announced_port as u32,
peers, peers,
mtu: None,
}; };
wg_api.configure_interface(&interface_config)?; wg_api.configure_interface(&interface_config)?;
+22 -16
View File
@@ -69,27 +69,33 @@ pub(crate) fn try_migrate_vested_delegation(
let storage_key = let storage_key =
Delegation::generate_storage_key(mix_id, &info.sender, Some(&vesting_contract)); Delegation::generate_storage_key(mix_id, &info.sender, Some(&vesting_contract));
let Some(mut delegation) = let Some(delegation) =
delegations_storage::delegations().may_load(deps.storage, storage_key.clone())? delegations_storage::delegations().may_load(deps.storage, storage_key.clone())?
else { else {
return Err(MixnetContractError::NotAVestingDelegation); return Err(MixnetContractError::NotAVestingDelegation);
}; };
// sanity check that's meant to blow up the contract let _ = delegation;
assert_eq!(delegation.proxy, Some(vesting_contract.clone()));
// update the delegation and save it under the correct storage key Err(MixnetContractError::TemporarilyDisabled)
delegation.proxy = None;
let updated_storage_key = Delegation::generate_storage_key(mix_id, &info.sender, None);
delegations_storage::delegations().remove(deps.storage, storage_key)?;
delegations_storage::delegations().save(deps.storage, updated_storage_key, &delegation)?;
Ok(Response::new().add_message(wasm_execute( //
vesting_contract, //
&VestingExecuteMsg::TrackMigratedDelegation { // // sanity check that's meant to blow up the contract
owner: info.sender.into_string(), // assert_eq!(delegation.proxy, Some(vesting_contract.clone()));
mix_id, //
}, // // update the delegation and save it under the correct storage key
vec![], // delegation.proxy = None;
)?)) // let updated_storage_key = Delegation::generate_storage_key(mix_id, &info.sender, None);
// delegations_storage::delegations().remove(deps.storage, storage_key)?;
// delegations_storage::delegations().save(deps.storage, updated_storage_key, &delegation)?;
//
// Ok(Response::new().add_message(wasm_execute(
// vesting_contract,
// &VestingExecuteMsg::TrackMigratedDelegation {
// owner: info.sender.into_string(),
// mix_id,
// },
// vec![],
// )?))
} }