Skip to content

Commit

Permalink
starknet api version change (#879)
Browse files Browse the repository at this point in the history
* starknet api version change

* add missing types in test utils

* storage changes - fit starknet api change

* change resource file of writer client to be hex format"

* ignore breaking test for broadcasted txs

* change starknet api commit to the one on main

---------

Co-authored-by: Shahak Shama <[email protected]>
  • Loading branch information
nagmo-starkware and ShahakShama authored Jul 24, 2023
1 parent 871bc3f commit f65c401
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 45 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.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ serde = "1.0.130"
serde_json = "1.0.81"
serde_yaml = "0.9.16"
simple_logger = "4.0.0"
starknet_api = { git = "https://github.com/starkware-libs/starknet-api", rev = "ecc9b6946ef13003da202838e4124a9ad2efabb0" }
starknet_api = {git = "https://github.com/starkware-libs/starknet-api", rev="a74edae2e3c727e55d9fc3161edbe13607232832"}
tempfile = "3.3.0"
thiserror = "1.0.31"
tokio = "1.18.2"
Expand Down
1 change: 1 addition & 0 deletions crates/papyrus_gateway/src/broadcasted_transaction_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ fn invoke_fits_rpc() {
validate_tx_fits_rpc(tx);
}

#[ignore]
#[test]
fn declare_v1_fits_rpc() {
let mut rng = get_rng();
Expand Down
4 changes: 4 additions & 0 deletions crates/papyrus_storage/src/body/body_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@ async fn append_body() {
let body = get_test_block(10, None, None, None).body;
let txs = body.transactions;
let tx_outputs = body.transaction_outputs;
let tx_exec_sts = body.transaction_execution_statuses;

let body0 = BlockBody {
transactions: vec![txs[0].clone()],
transaction_outputs: vec![tx_outputs[0].clone()],
transaction_execution_statuses: vec![tx_exec_sts[0].clone()],
};
let body1 = BlockBody::default();
let body2 = BlockBody {
transactions: vec![txs[1].clone(), txs[2].clone()],
transaction_outputs: vec![tx_outputs[1].clone(), tx_outputs[2].clone()],
transaction_execution_statuses: vec![tx_exec_sts[1].clone(), tx_exec_sts[2].clone()],
};
let body3 = BlockBody {
transactions: vec![txs[3].clone(), txs[0].clone()],
transaction_outputs: vec![tx_outputs[3].clone(), tx_outputs[0].clone()],
transaction_execution_statuses: vec![tx_exec_sts[3].clone(), tx_exec_sts[0].clone()],
};
writer
.begin_rw_txn()
Expand Down
8 changes: 7 additions & 1 deletion crates/starknet_reader_client/src/objects/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,13 @@ impl Block {
timestamp: self.timestamp,
};

let body = starknet_api::block::BlockBody { transactions, transaction_outputs };
// todo: replace this with acctual data once sync is implemented.
let transaction_execution_statuses = vec![];
let body = starknet_api::block::BlockBody {
transactions,
transaction_outputs,
transaction_execution_statuses,
};

Ok((starknet_api_block { header, body }, self.starknet_version))
}
Expand Down
78 changes: 39 additions & 39 deletions crates/starknet_writer_client/resources/declare_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,163 +11,163 @@
"CONSTRUCTOR": [
{
"selector": "0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194",
"offset": 624
"offset": "0x270"
}
],
"EXTERNAL": [
{
"selector": "0x5fbd85570830519219bb4ad6951316f96fce363f86909d1f8adb1fdc836471",
"offset": 1727
"offset": "0x6bf"
},
{
"selector": "0x679c22735055a10db4f275395763a3752a1e3a3043c192299ab6b574fba8d6",
"offset": 764
"offset": "0x2fc"
},
{
"selector": "0x7772be8b80a8a33dc6c1f9a6ab820c02e537c73e859de67f288c70f92571bb",
"offset": 671
"offset": "0x29f"
},
{
"selector": "0x8692275a885fee8890c5eaa075cc627d4755e3a1c8a2f1d557f7f97743761a",
"offset": 1302
"offset": "0x516"
},
{
"selector": "0x8a2a3272a92492ded6c04f7c85df9c53134cef398564465f12af3c9c986d41",
"offset": 1621
"offset": "0x655"
},
{
"selector": "0xbd7daa40535813d892224da817610f4c7e6fe8983abe588a4227586262d9d3",
"offset": 1455
"offset": "0x5af"
},
{
"selector": "0xc3aec03fe455b8a64bf01ebad1b32252b107e07bc075631c513bb581ea3ee4",
"offset": 1776
"offset": "0x6f0"
},
{
"selector": "0xd47144c49bce05b6de6bce9d5ff0cc8da9420f8945453e20ef779cbea13ad4",
"offset": 2079
"offset": "0x81f"
},
{
"selector": "0xd5e8843577a4b0aa2c4408c543dd466ece9a2611a140c26c004169cb123e43",
"offset": 1839
"offset": "0x72f"
},
{
"selector": "0xe7510edcf6e9f1b70f7bd1f488767b50f0363422f3c563160ab77adf62467b",
"offset": 2123
"offset": "0x84b"
},
{
"selector": "0xe8f69bd941db5b0bff2e416c63d46f067fcdfad558c528f9fd102ba368cb5f",
"offset": 1383
"offset": "0x567"
},
{
"selector": "0x127a04cfe41aceb22fc022bce0c5c70f2d860a7c7c054681bd821cdc18e6dbc",
"offset": 1922
"offset": "0x782"
},
{
"selector": "0x12ead94ae9d3f9d2bdb6b847cf255f1f398193a1f88884a0ae8e18f24a037b6",
"offset": 1052
"offset": "0x41c"
},
{
"selector": "0x167ac610845cc0ab1501b38169a7e50f1bf60602d3c2a961b30987454f97812",
"offset": 1431
"offset": "0x597"
},
{
"selector": "0x169f135eddda5ab51886052d777a57f2ea9c162d713691b5e04a6d4ed71d47f",
"offset": 1246
"offset": "0x4de"
},
{
"selector": "0x19a35a6e95cb7a3318dbb244f20975a1cd8587cc6b5259f15f61d7beb7ee43b",
"offset": 1527
"offset": "0x5f7"
},
{
"selector": "0x1ae1a515cf2d214b29bdf63a79ee2d490efd4dd1acc99d383a8e549c3cecb5d",
"offset": 877
"offset": "0x36d"
},
{
"selector": "0x1b1343fe0f4a16bed5e5133b5ca9f03ab15976bb2df2b6d263ac3170b8b6a13",
"offset": 1663
"offset": "0x67f"
},
{
"selector": "0x1b1a0649752af1b28b3dc29a1556eee781e4a4c3a1f7f53f90fa834de098c4d",
"offset": 706
"offset": "0x2c2"
},
{
"selector": "0x1cad42b55a5b2c7366b371db59448730766dfef74c0156c9c6f332c8c5e34d9",
"offset": 975
"offset": "0x3cf"
},
{
"selector": "0x1de4779362d5ca708d55fe1d4d499501b7f692730d2e01656e9180708985e07",
"offset": 1897
"offset": "0x769"
},
{
"selector": "0x1eaab699414d786ce9dbfd4e86815f66680647efd13f9334ac97148e4e30e82",
"offset": 1020
"offset": "0x3fc"
},
{
"selector": "0x218f305395474a84a39307fa5297be118fe17bf65e27ac5e2de6617baa44c64",
"offset": 1579
"offset": "0x62b"
},
{
"selector": "0x26813d396fdb198e9ead934e4f7a592a8b88a059e45ab0eb6ee53494e8d45b0",
"offset": 936
"offset": "0x3a8"
},
{
"selector": "0x27c3334165536f239cfd400ed956eabff55fc60de4fb56728b6a4f6b87db01c",
"offset": 1198
"offset": "0x4ae"
},
{
"selector": "0x2913ee03e5e3308c41e308bd391ea4faac9b9cb5062c76a6b3ab4f65397e106",
"offset": 1078
"offset": "0x436"
},
{
"selector": "0x29cef374bfc7ad2628f04d9a18ac3c3a259c1eb3ce3d3c77bbab281c42649fc",
"offset": 1953
"offset": "0x7a1"
},
{
"selector": "0x30f842021fbf02caf80d09a113997c1e00a32870eee0c6136bed27acb348bea",
"offset": 832
"offset": "0x340"
},
{
"selector": "0x317eb442b72a9fae758d4fb26830ed0d9f31c8e7da4dbff4e8c59ea6a158e7f",
"offset": 586
"offset": "0x24a"
},
{
"selector": "0x330a77821de972bb6bd8a5eeb87efdf645a609a3057cfc0b3de7bdfaf887c85",
"offset": 1159
"offset": "0x487"
},
{
"selector": "0x33ce93a3eececa5c9fc70da05f4aff3b00e1820b79587924d514bc76788991a",
"offset": 1407
"offset": "0x57f"
},
{
"selector": "0x34c4c150632e67baf44fc50e9a685184d72a822510a26a66f72058b5e7b2892",
"offset": 1694
"offset": "0x69e"
},
{
"selector": "0x3604cea1cdb094a73a31144f14a3e5861613c008e1e879939ebc4827d10cd50",
"offset": 1994
"offset": "0x7ca"
},
{
"selector": "0x3639fffddc860618a5a5cb4e4c1562999b4b0ee1c648dcdecd1a905482d6ac2",
"offset": 2033
"offset": "0x7f1"
},
{
"selector": "0x398cb6c6170250c323a37586d08047d637f53b06360fa0268de8ee3ae3e52a2",
"offset": 2148
"offset": "0x864"
},
{
"selector": "0x3d7905601c217734671143d457f0db37f7f8883112abd34b92c4abfeafde0c3",
"offset": 903
"offset": "0x387"
},
{
"selector": "0x3dc5da2d6d1275aeed57f43461d31967b0fed58bfe739b4ffad4091e89c4b03",
"offset": 1479
"offset": "0x5c7"
}
],
"L1_HANDLER": [
{
"selector": "0xc73f681176fc7b3f9693986fd7b14581e8d540519e27400e88b8713932be01",
"offset": 1356
"offset": "0x54c"
}
]
},
Expand Down
12 changes: 9 additions & 3 deletions crates/test_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ use starknet_api::transaction::{
EventContent, EventData, EventIndexInTransactionOutput, EventKey, Fee, InvokeTransaction,
InvokeTransactionOutput, InvokeTransactionV0, InvokeTransactionV1, L1HandlerTransaction,
L1HandlerTransactionOutput, L1ToL2Payload, L2ToL1Payload, MessageToL1, MessageToL2,
Transaction, TransactionHash, TransactionOffsetInBlock, TransactionOutput,
TransactionSignature, TransactionVersion,
Transaction, TransactionExecutionStatus, TransactionHash, TransactionOffsetInBlock,
TransactionOutput, TransactionSignature, TransactionVersion,
};

//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -160,14 +160,16 @@ fn get_rand_test_body_with_events(
) -> BlockBody {
let mut transactions = vec![];
let mut transaction_outputs = vec![];
let mut transaction_execution_statuses = vec![];
for i in 0..transaction_count {
let mut transaction = Transaction::get_test_instance(rng);
set_transaction_hash(&mut transaction, TransactionHash(StarkHash::from(i as u128)));
let transaction_output = get_test_transaction_output(&transaction);
transactions.push(transaction);
transaction_outputs.push(transaction_output);
transaction_execution_statuses.push(TransactionExecutionStatus::default());
}
let mut body = BlockBody { transactions, transaction_outputs };
let mut body = BlockBody { transactions, transaction_outputs, transaction_execution_statuses };
for tx_output in &mut body.transaction_outputs {
let mut events = vec![];
for _ in 0..events_per_tx {
Expand Down Expand Up @@ -499,6 +501,10 @@ auto_impl_get_test_instance! {
Invoke(InvokeTransaction) = 3,
L1Handler(L1HandlerTransaction) = 4,
}
pub enum TransactionExecutionStatus {
Succeeded = 0,
Reverted = 1,
}
pub struct TransactionHash(pub StarkHash);
pub struct TransactionOffsetInBlock(pub usize);
pub struct TransactionSignature(pub Vec<StarkFelt>);
Expand Down

0 comments on commit f65c401

Please sign in to comment.