Skip to content

Commit

Permalink
regenerated contract schema and made the migration data optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jstuczyn committed Oct 9, 2024
1 parent ae30b0d commit 1f089ca
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 6 deletions.
2 changes: 1 addition & 1 deletion common/cosmwasm-smart-contracts/mixnet-contract/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -804,5 +804,5 @@ impl AffectedNode {
#[cw_serde]
pub struct MigrateMsg {
pub vesting_contract_address: Option<String>,
pub fix_nodes: Vec<AffectedNode>,
pub fix_nodes: Option<Vec<AffectedNode>>,
}
56 changes: 54 additions & 2 deletions contracts/mixnet/schema/nym-mixnet-contract.json
Original file line number Diff line number Diff line change
Expand Up @@ -2150,7 +2150,7 @@
"minimum": 0.0
},
"owner": {
"description": "The address of the owner of the the mixnodes used for the query.",
"description": "The address of the owner of the mixnodes used for the query.",
"type": "string"
},
"start_after": {
Expand Down Expand Up @@ -2961,14 +2961,66 @@
"title": "MigrateMsg",
"type": "object",
"properties": {
"fix_nodes": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/AffectedNode"
}
},
"vesting_contract_address": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
"additionalProperties": false,
"definitions": {
"AffectedDelegator": {
"type": "object",
"required": [
"address",
"missing_ratio"
],
"properties": {
"address": {
"type": "string"
},
"missing_ratio": {
"$ref": "#/definitions/Decimal"
}
},
"additionalProperties": false
},
"AffectedNode": {
"type": "object",
"required": [
"delegators",
"mix_id"
],
"properties": {
"delegators": {
"type": "array",
"items": {
"$ref": "#/definitions/AffectedDelegator"
}
},
"mix_id": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
}
},
"additionalProperties": false
},
"Decimal": {
"description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)",
"type": "string"
}
}
},
"sudo": null,
"responses": {
Expand Down
54 changes: 53 additions & 1 deletion contracts/mixnet/schema/raw/migrate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,64 @@
"title": "MigrateMsg",
"type": "object",
"properties": {
"fix_nodes": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/AffectedNode"
}
},
"vesting_contract_address": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
"additionalProperties": false,
"definitions": {
"AffectedDelegator": {
"type": "object",
"required": [
"address",
"missing_ratio"
],
"properties": {
"address": {
"type": "string"
},
"missing_ratio": {
"$ref": "#/definitions/Decimal"
}
},
"additionalProperties": false
},
"AffectedNode": {
"type": "object",
"required": [
"delegators",
"mix_id"
],
"properties": {
"delegators": {
"type": "array",
"items": {
"$ref": "#/definitions/AffectedDelegator"
}
},
"mix_id": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
}
},
"additionalProperties": false
},
"Decimal": {
"description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)",
"type": "string"
}
}
}
2 changes: 1 addition & 1 deletion contracts/mixnet/schema/raw/query.json
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@
"minimum": 0.0
},
"owner": {
"description": "The address of the owner of the the mixnodes used for the query.",
"description": "The address of the owner of the mixnodes used for the query.",
"type": "string"
},
"start_after": {
Expand Down
4 changes: 3 additions & 1 deletion contracts/mixnet/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,9 @@ pub fn migrate(

let mut response = Response::new();

queued_migrations::restore_vested_delegations(&mut response, deps, env, msg.fix_nodes)?;
if let Some(nodes_to_fix) = msg.fix_nodes {
queued_migrations::restore_vested_delegations(&mut response, deps, env, nodes_to_fix)?;
}

Ok(response)
}
Expand Down
1 change: 1 addition & 0 deletions tools/internal/testnet-manager/src/manager/network_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ impl NetworkManager {
) -> Result<nym_mixnet_contract_common::MigrateMsg, NetworkManagerError> {
Ok(nym_mixnet_contract_common::MigrateMsg {
vesting_contract_address: Some(ctx.network.contracts.vesting.address()?.to_string()),
fix_nodes: None,
})
}

Expand Down

0 comments on commit 1f089ca

Please sign in to comment.