Skip to content

Commit

Permalink
Sync node fix (#251)
Browse files Browse the repository at this point in the history
* Update for InformationRequest::Transaction change

* Fix test failures due to version mismatches

* Run formatter

* Bump commit
  • Loading branch information
jacek-casper authored Feb 29, 2024
1 parent 820fce5 commit 980c976
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 77 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions event_sidecar/src/sql/tables/transaction_accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,9 @@ pub fn create_table_stmt() -> TableCreateStatement {
.big_unsigned()
.not_null(),
)
.index(
&mut primary_key(),
)
.foreign_key(
&mut event_log_fk(),
)
.foreign_key(
&mut transaction_type_fk(),
)
.index(&mut primary_key())
.foreign_key(&mut event_log_fk())
.foreign_key(&mut transaction_type_fk())
.to_owned()
}

Expand Down
12 changes: 3 additions & 9 deletions event_sidecar/src/sql/tables/transaction_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,9 @@ pub fn create_table_stmt() -> TableCreateStatement {
.tiny_unsigned()
.not_null(),
)
.index(
&mut primary_key(),
)
.foreign_key(
&mut event_log_fk(),
)
.foreign_key(
&mut transaction_type_fk(),
)
.index(&mut primary_key())
.foreign_key(&mut event_log_fk())
.foreign_key(&mut transaction_type_fk())
.to_owned()
}

Expand Down
12 changes: 3 additions & 9 deletions event_sidecar/src/sql/tables/transaction_expired.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,9 @@ pub fn create_table_stmt() -> TableCreateStatement {
.big_unsigned()
.not_null(),
)
.index(
&mut primary_key(),
)
.foreign_key(
&mut event_log_fk(),
)
.foreign_key(
&mut transaction_type_fk(),
)
.index(&mut primary_key())
.foreign_key(&mut event_log_fk())
.foreign_key(&mut transaction_type_fk())
.to_owned()
}

Expand Down
12 changes: 3 additions & 9 deletions event_sidecar/src/sql/tables/transaction_processed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,9 @@ pub fn create_table_stmt() -> TableCreateStatement {
.big_unsigned()
.not_null(),
)
.index(
&mut primary_key(),
)
.foreign_key(
&mut event_log_fk(),
)
.foreign_key(
&mut transaction_type_fk(),
)
.index(&mut primary_key())
.foreign_key(&mut event_log_fk())
.foreign_key(&mut transaction_type_fk())
.to_owned()
}

Expand Down
1 change: 0 additions & 1 deletion event_sidecar/src/testing/fake_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ impl FakeDatabase {
}
}


/// Creates random SSE event data and saves them, returning the identifiers for each record.
#[allow(clippy::too_many_lines)]
pub(crate) async fn populate_with_events(
Expand Down
4 changes: 2 additions & 2 deletions event_sidecar/src/types/sse_events.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#[cfg(test)]
use casper_types::ChainNameDigest;
use casper_types::FinalitySignature as FinSig;
use casper_types::{
contract_messages::Messages, execution::ExecutionResult, AsymmetricType, Block, BlockHash,
EraId, InitiatorAddr, ProtocolVersion, PublicKey, TimeDiff, Timestamp, Transaction,
TransactionHash,
};
#[cfg(test)]
use casper_types::ChainNameDigest;
#[cfg(test)]
use casper_types::{
execution::{execution_result_v1::ExecutionResultV1, Effects, ExecutionResultV2},
testing::TestRng,
Expand Down
46 changes: 23 additions & 23 deletions resources/test/rpc_schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"openrpc": "1.0.0-rc1",
"info": {
"version": "1.5.3",
"version": "2.0.0",
"title": "Client API of Casper Node",
"description": "This describes the JSON-RPC 2.0 API of a node on the Casper network.",
"contact": {
Expand Down Expand Up @@ -116,7 +116,7 @@
"result": {
"name": "account_put_deploy_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"deploy_hash": "5c9b3b099c1378aa8e4a5f07f59ff1fcdc69a83179427c7e67ae0377d94d93fa"
}
}
Expand Down Expand Up @@ -246,7 +246,7 @@
"result": {
"name": "account_put_transaction_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"transaction_hash": {
"Version1": "6aaf4a54499e3757eb4be6967503dcc431e4623bf8bb57a14c1729a114a1aaa2"
}
Expand Down Expand Up @@ -336,7 +336,7 @@
"result": {
"name": "info_get_deploy_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"deploy": {
"hash": "5c9b3b099c1378aa8e4a5f07f59ff1fcdc69a83179427c7e67ae0377d94d93fa",
"header": {
Expand Down Expand Up @@ -500,7 +500,7 @@
"result": {
"name": "info_get_transaction_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"transaction": {
"Version1": {
"hash": "6aaf4a54499e3757eb4be6967503dcc431e4623bf8bb57a14c1729a114a1aaa2",
Expand Down Expand Up @@ -681,7 +681,7 @@
"result": {
"name": "state_get_account_info_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"account": {
"account_hash": "account-hash-e94daaff79c2ab8d9c31d9c3058d7d0a0dd31204a5638dc1451fa67b2e3fb88c",
"named_keys": [
Expand Down Expand Up @@ -783,7 +783,7 @@
"result": {
"name": "state_get_entity_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"entity": {
"AddressableEntity": {
"protocol_version": "2.0.0",
Expand Down Expand Up @@ -819,7 +819,7 @@
"message_topics": [
{
"topic_name": "topic",
"topic_name_hash": "topic-name-0000000000000000000000000000000000000000000000000000000000000000"
"topic_name_hash": "0000000000000000000000000000000000000000000000000000000000000000"
}
]
}
Expand Down Expand Up @@ -904,7 +904,7 @@
"result": {
"name": "state_get_dictionary_item_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"dictionary_key": "dictionary-67518854aa916c97d4e53df8570c8217ccc259da2721b692102d76acd0ee8d1f",
"stored_value": {
"CLValue": {
Expand Down Expand Up @@ -1019,7 +1019,7 @@
"result": {
"name": "query_global_state_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"block_header": {
"Version2": {
"parent_hash": "0707070707070707070707070707070707070707070707070707070707070707",
Expand Down Expand Up @@ -1153,7 +1153,7 @@
"result": {
"name": "query_balance_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"balance": "123456"
}
}
Expand Down Expand Up @@ -1193,7 +1193,7 @@
"result": {
"name": "info_get_peers_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"peers": [
{
"node_id": "tls:0101..0101",
Expand Down Expand Up @@ -1322,7 +1322,7 @@
"result": {
"name": "info_get_status_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"peers": [
{
"node_id": "tls:0101..0101",
Expand Down Expand Up @@ -1406,7 +1406,7 @@
"result": {
"name": "info_get_validator_changes_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"changes": [
{
"public_key": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c",
Expand Down Expand Up @@ -1455,7 +1455,7 @@
"result": {
"name": "info_get_chainspec_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"chainspec_bytes": {
"chainspec_bytes": "2a2a",
"maybe_genesis_accounts_bytes": null,
Expand Down Expand Up @@ -1521,7 +1521,7 @@
"result": {
"name": "chain_get_block_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"block_with_signatures": {
"block": {
"Version2": {
Expand Down Expand Up @@ -1663,7 +1663,7 @@
"result": {
"name": "chain_get_block_transfers_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"block_hash": "0707070707070707070707070707070707070707070707070707070707070707",
"transfers": [
{
Expand Down Expand Up @@ -1737,7 +1737,7 @@
"result": {
"name": "chain_get_state_root_hash_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"state_root_hash": "0808080808080808080808080808080808080808080808080808080808080808"
}
}
Expand Down Expand Up @@ -1826,7 +1826,7 @@
"result": {
"name": "state_get_item_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"stored_value": {
"CLValue": {
"cl_type": "U64",
Expand Down Expand Up @@ -1904,7 +1904,7 @@
"result": {
"name": "state_get_balance_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"balance_value": "123456",
"merkle_proof": "01000000006ef2e0949ac76e55812421f755abe129b6244fe7168b77f47a72536147614625016ef2e0949ac76e55812421f755abe129b6244fe7168b77f47a72536147614625000000003529cde5c621f857f75f3810611eb4af3f998caaa9d4a3413cf799f99c67db0307010000006ef2e0949ac76e55812421f755abe129b6244fe7168b77f47a7253614761462501010102000000006e06000000000074769d28aac597a36a03a932d4b43e4f10bf0403ee5c41dd035102553f5773631200b9e173e8f05361b681513c14e25e3138639eb03232581db7557c9e8dbbc83ce94500226a9a7fe4f2b7b88d5103a4fc7400f02bf89c860c9ccdd56951a2afe9be0e0267006d820fb5676eb2960e15722f7725f3f8f41030078f8b2e44bf0dc03f71b176d6e800dc5ae9805068c5be6da1a90b2528ee85db0609cc0fb4bd60bbd559f497a98b67f500e1e3e846592f4918234647fca39830b7e1e6ad6f5b7a99b39af823d82ba1873d000003000000010186ff500f287e9b53f823ae1582b1fa429dfede28015125fd233a31ca04d5012002015cc42669a55467a1fdf49750772bfc1aed59b9b085558eb81510e9b015a7c83b0301e3cf4a34b1db6bfa58808b686cb8fe21ebe0c1bcbcee522649d2b135fe510fe3"
}
Expand Down Expand Up @@ -1967,7 +1967,7 @@
"result": {
"name": "chain_get_era_info_by_switch_block_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"era_summary": {
"block_hash": "9ccc716f5f3c7ac238bf7aaad113c2add3586921a7966faffb3a5a253aa1d75e",
"era_id": 42,
Expand Down Expand Up @@ -2047,7 +2047,7 @@
"result": {
"name": "state_get_auction_info_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"auction_state": {
"state_root_hash": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
"block_height": 10,
Expand Down Expand Up @@ -2142,7 +2142,7 @@
"result": {
"name": "chain_get_era_summary_example_result",
"value": {
"api_version": "1.5.3",
"api_version": "2.0.0",
"era_summary": {
"block_hash": "9ccc716f5f3c7ac238bf7aaad113c2add3586921a7966faffb3a5a253aa1d75e",
"era_id": 42,
Expand Down
10 changes: 7 additions & 3 deletions rpc_sidecar/src/node_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,14 @@ pub trait NodeClient: Send + Sync {

async fn read_transaction_with_execution_info(
&self,
transaction_hash: TransactionHash,
hash: TransactionHash,
with_finalized_approvals: bool,
) -> Result<Option<TransactionWithExecutionInfo>, Error> {
let resp = self
.read_info(InformationRequest::Transaction(transaction_hash))
.read_info(InformationRequest::Transaction {
hash,
with_finalized_approvals,
})
.await?;
parse_response::<TransactionWithExecutionInfo>(&resp.into())
}
Expand Down Expand Up @@ -590,7 +594,7 @@ mod tests {
async fn start_mock_binary_port_responding_with_stored_value(port: u16) -> JoinHandle<()> {
let value = StoredValue::CLValue(CLValue::from_t("Foo").unwrap());
let data = GlobalStateQueryResult::new(value, vec![]);
let protocol_version = ProtocolVersion::from_parts(1, 5, 4);
let protocol_version = ProtocolVersion::from_parts(2, 0, 0);
let val = BinaryResponse::from_value(data, protocol_version);
let request = [];
let response = BinaryResponseAndRequest::new(val, &request);
Expand Down
Loading

0 comments on commit 980c976

Please sign in to comment.