Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
EdHastingsCasperAssociation committed Nov 21, 2024
1 parent cd6e9f8 commit 19cd919
Show file tree
Hide file tree
Showing 11 changed files with 367 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,7 @@ where
.expect("should have named keys")
}

/// Gets [`Vec<Unbond>`].
/// Gets [`BTreeMap<UnbondKind, Unbond>`].
pub fn get_unbonds(&mut self) -> BTreeMap<UnbondKind, Unbond> {
let state_root_hash = self.get_post_state_hash();

Expand Down
6 changes: 2 additions & 4 deletions node/src/components/rest_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,8 @@ mod schema_tests {
"{}/../resources/test/rest_schema_status.json",
env!("CARGO_MANIFEST_DIR")
);
assert_schema(
schema_path,
serde_json::to_string_pretty(&schema_for!(GetStatusResult)).unwrap(),
);
let pretty = serde_json::to_string_pretty(&schema_for!(GetStatusResult)).unwrap();
assert_schema(schema_path, pretty);
}

#[test]
Expand Down
1 change: 0 additions & 1 deletion node/src/reactor/main_reactor/tests/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2948,7 +2948,6 @@ async fn add_and_withdraw_bid_transaction() {

let (_, _bob_initial_balance, _) = test.get_balances(None);
let (_txn_hash, _block_height, exec_result) = test.send_transaction(txn).await;
println!("{:?}", exec_result);
assert!(exec_result_is_success(&exec_result));

test.fixture
Expand Down
214 changes: 197 additions & 17 deletions resources/test/sse_data_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2392,15 +2392,15 @@
"type": "object",
"required": [
"amount",
"delegator_public_key",
"delegator_kind",
"validator_public_key"
],
"properties": {
"delegator_public_key": {
"delegator_kind": {
"description": "Delegator's public key",
"allOf": [
{
"$ref": "#/definitions/PublicKey"
"$ref": "#/definitions/DelegatorKind"
}
]
},
Expand Down Expand Up @@ -2428,6 +2428,44 @@
}
]
},
"DelegatorKind": {
"description": "Auction bid variants. Kinds of delegation bids.",
"oneOf": [
{
"description": "Delegation from public key.",
"type": "object",
"required": [
"PublicKey"
],
"properties": {
"PublicKey": {
"$ref": "#/definitions/PublicKey"
}
},
"additionalProperties": false
},
{
"description": "Delegation from purse.",
"type": "object",
"required": [
"Purse"
],
"properties": {
"Purse": {
"type": "array",
"items": {
"type": "integer",
"format": "uint8",
"minimum": 0.0
},
"maxItems": 32,
"minItems": 32
}
},
"additionalProperties": false
}
]
},
"TransferV1": {
"description": "Represents a version 1 transfer from one purse to another.",
"type": "object",
Expand Down Expand Up @@ -2565,7 +2603,7 @@
]
},
"delegators": {
"description": "This validator's delegators, indexed by their public keys.",
"description": "This validator's delegators, indexed by their kind.",
"allOf": [
{
"$ref": "#/definitions/Array_of_PublicKeyAndDelegator"
Expand Down Expand Up @@ -2622,32 +2660,32 @@
"description": "The public key of the delegator.",
"allOf": [
{
"$ref": "#/definitions/PublicKey"
"$ref": "#/definitions/DelegatorKind"
}
]
},
"delegator": {
"description": "The delegator details.",
"allOf": [
{
"$ref": "#/definitions/Delegator"
"$ref": "#/definitions/DelegatorBid"
}
]
}
}
},
"Delegator": {
"DelegatorBid": {
"description": "Represents a party delegating their stake to a validator (or \"delegatee\")",
"type": "object",
"required": [
"bonding_purse",
"delegator_public_key",
"delegator_kind",
"staked_amount",
"validator_public_key"
],
"properties": {
"delegator_public_key": {
"$ref": "#/definitions/PublicKey"
"delegator_kind": {
"$ref": "#/definitions/DelegatorKind"
},
"staked_amount": {
"$ref": "#/definitions/U512"
Expand Down Expand Up @@ -2862,7 +2900,7 @@
],
"properties": {
"Delegator": {
"$ref": "#/definitions/Delegator"
"$ref": "#/definitions/DelegatorBid"
}
},
"additionalProperties": false
Expand Down Expand Up @@ -2905,6 +2943,19 @@
}
},
"additionalProperties": false
},
{
"description": "Unbond",
"type": "object",
"required": [
"Unbond"
],
"properties": {
"Unbond": {
"$ref": "#/definitions/Unbond"
}
},
"additionalProperties": false
}
]
},
Expand Down Expand Up @@ -3065,35 +3116,164 @@
"type": "object",
"required": [
"delegation_rate",
"delegator_public_key",
"delegator_kind",
"validator_public_key"
],
"properties": {
"delegator_public_key": {
"description": "Delegator public key",
"delegator_kind": {
"description": "Delegator kind.",
"allOf": [
{
"$ref": "#/definitions/PublicKey"
"$ref": "#/definitions/DelegatorKind"
}
]
},
"validator_public_key": {
"description": "Validator public key",
"description": "Validator public key.",
"allOf": [
{
"$ref": "#/definitions/PublicKey"
}
]
},
"delegation_rate": {
"description": "Individual delegation rate",
"description": "Individual delegation rate.",
"type": "integer",
"format": "uint8",
"minimum": 0.0
}
},
"additionalProperties": false
},
"Unbond": {
"type": "object",
"required": [
"eras",
"unbond_kind",
"validator_public_key"
],
"properties": {
"validator_public_key": {
"description": "Validators public key.",
"allOf": [
{
"$ref": "#/definitions/PublicKey"
}
]
},
"unbond_kind": {
"description": "Unbond kind.",
"allOf": [
{
"$ref": "#/definitions/UnbondKind"
}
]
},
"eras": {
"description": "Unbond amounts per era.",
"type": "array",
"items": {
"$ref": "#/definitions/UnbondEra"
}
}
},
"additionalProperties": false
},
"UnbondKind": {
"description": "Unbond variants.",
"oneOf": [
{
"type": "object",
"required": [
"Validator"
],
"properties": {
"Validator": {
"$ref": "#/definitions/PublicKey"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"DelegatedPublicKey"
],
"properties": {
"DelegatedPublicKey": {
"$ref": "#/definitions/PublicKey"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"DelegatedPurse"
],
"properties": {
"DelegatedPurse": {
"type": "array",
"items": {
"type": "integer",
"format": "uint8",
"minimum": 0.0
},
"maxItems": 32,
"minItems": 32
}
},
"additionalProperties": false
}
]
},
"UnbondEra": {
"description": "Unbond amounts per era.",
"type": "object",
"required": [
"amount",
"bonding_purse",
"era_of_creation"
],
"properties": {
"bonding_purse": {
"description": "Bonding Purse",
"allOf": [
{
"$ref": "#/definitions/URef"
}
]
},
"era_of_creation": {
"description": "Era in which this unbonding request was created.",
"allOf": [
{
"$ref": "#/definitions/EraId"
}
]
},
"amount": {
"description": "Unbonding Amount.",
"allOf": [
{
"$ref": "#/definitions/U512"
}
]
},
"new_validator": {
"description": "The validator public key to re-delegate to.",
"anyOf": [
{
"$ref": "#/definitions/PublicKey"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"ExecutionResultV2": {
"description": "The result of executing a single transaction.",
"type": "object",
Expand Down
Loading

0 comments on commit 19cd919

Please sign in to comment.