Skip to content

Commit

Permalink
feat(starknet_client): support v3 transactions in starknet_client (#1380
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Yael-Starkware authored Nov 9, 2023
1 parent 6425c38 commit 91d906c
Show file tree
Hide file tree
Showing 30 changed files with 641 additions and 91 deletions.
12 changes: 12 additions & 0 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ rustc-hex = "2.1.0"
schemars = "0.8.12"
serde = "1.0.130"
serde_json = "1.0.81"
serde_repr = "0.1"
serde_yaml = "0.9.16"
sha3 = "0.10.8"
simple_logger = "4.0.0"
Expand All @@ -103,4 +104,4 @@ tracing = "0.1.37"
tracing-subscriber = "0.3.16"
tower = "0.4"
url = "2.2.2"
validator = "0.12"
validator = "0.12"
1 change: 1 addition & 0 deletions crates/starknet_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ rand_chacha = { workspace = true, optional = true }
reqwest = { workspace = true, features = ["json", "blocking"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["arbitrary_precision"] }
serde_repr.workspace = true
starknet_api.workspace = true
test_utils = { path = "../test_utils", optional = true }
thiserror.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_client/resources/reader/abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
{"inputs": [{"name": "self_address", "type": "felt"}, {"name": "value", "type": "felt"}], "name": "recursive_add_value", "outputs": [], "type": "function"},
{"inputs": [{"name": "address", "type": "felt"}], "name": "increase_value", "outputs": [], "type": "function"},
{"inputs": [{"name": "self_address", "type": "felt"}, {"name": "arr_len", "type": "felt"}, {"name": "arr", "type": "felt*"}], "name": "test_call_with_array", "outputs": [], "type": "function"}
]
]
158 changes: 158 additions & 0 deletions crates/starknet_client/resources/reader/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,105 @@
"calldata": ["0x2db8c2615db39a5ed8750b87ac8f217485be11ec", "0xbc614e", "0x258"],
"transaction_hash": "0xfb118dc1d4a4141b7718da4b7fa98980b11caf5aa5d6e1e35e9b050aae788b",
"type": "L1_HANDLER"
},
{
"account_deployment_data": [],
"class_hash": "0x6f6742127e27687640c7aaf566b9dc892c4493973076cb96fdeb418ae77c192",
"compiled_class_hash": "0xcbbcfda1dea5cc48d3c7ebefd50ecc4aaefabe7e5596fdef4f60cded0ea0b24",
"fee_data_availability_mode": 0,
"nonce": "0x0",
"nonce_data_availability_mode": 0,
"paymaster_data": [],
"resource_bounds": {
"L1_GAS": {
"max_amount": "0xffffffffffffffff",
"max_price_per_unit": "0xffffffffffffffffffffffffffffffff"
},
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"sender_address": "0x12fd537",
"signature": [],
"tip": "0x0",
"transaction_hash": "0x308104e126e1d6659ef499da73eeb88ba9f066a57ad75d8d27fa3ff420cded2",
"version": "0x3",
"max_fee": "0x0",
"type": "DECLARE"
},
{
"account_deployment_data": [],
"calldata": [
"0x0",
"0x1",
"0x2",
"0x3",
"0x4",
"0x5",
"0x6",
"0x7",
"0x8",
"0x9"
],
"fee_data_availability_mode": 0,
"nonce": "0x0",
"nonce_data_availability_mode": 0,
"paymaster_data": [],
"resource_bounds": {
"L1_GAS": {
"max_amount": "0xffffffffffffffff",
"max_price_per_unit": "0xffffffffffffffffffffffffffffffff"
},
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"sender_address": "0x2da4d93784af6b4427c32533dd7e5780c9d642c3a3348f6adacebc97edab4c",
"signature": [],
"tip": "0x0",
"transaction_hash": "0x14df307294262b17b20c8949fd3dbd8f25a9bd47548d00d89ca93977e5836b",
"version": "0x3",
"type": "INVOKE_FUNCTION"
},
{
"class_hash": "0x1fcd2dcd811e049eaa730b87038a68f39220a04986b43fe287d690da0df01b8",
"constructor_calldata": [
"0x0",
"0x1",
"0x2",
"0x3",
"0x4",
"0x5",
"0x6",
"0x7",
"0x8",
"0x9"
],
"contract_address_salt": "0x2",
"fee_data_availability_mode": 0,
"nonce": "0x0",
"nonce_data_availability_mode": 0,
"paymaster_data": [],
"resource_bounds": {
"L1_GAS": {
"max_amount": "0xffffffffffffffff",
"max_price_per_unit": "0xffffffffffffffffffffffffffffffff"
},
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"sender_address": "0x1b34d819720bd84c89bdfb476bc2c4d0de9a41b766efabd20fa292280e4c6d9",
"signature": [],
"tip": "0x0",
"transaction_hash": "0x60bc493f32b6a2ebc2f6fd67324e72c5104ca26afa9a1f61726caa1094f340b",
"version": "0x3",
"type": "DEPLOY_ACCOUNT"
}

],
"timestamp": 1658396103,
"sequencer_address": "0x46a89ae102987331d369645031b49c27738ed096f2789c24449966da4c6de6b",
Expand Down Expand Up @@ -161,6 +259,66 @@
"n_memory_holes": 22
},
"actual_fee": "0x0"
},
{
"transaction_index": 5,
"transaction_hash": "0x0308104e126e1d6659ef499da73eeb88ba9f066a57ad75d8d27fa3ff420cded2",
"l2_to_l1_messages": [],
"events": [],
"execution_resources": {
"n_steps": 137,
"builtin_instance_counter": {
"pedersen_builtin": 2,
"range_check_builtin": 6,
"bitwise_builtin": 0,
"output_builtin": 0,
"ecdsa_builtin": 0,
"ec_op_builtin": 0
},
"n_memory_holes": 22
},
"actual_fee": "0x0"
},
{
"transaction_index": 6,
"transaction_hash": "0x0014df307294262b17b20c8949fd3dbd8f25a9bd47548d00d89ca93977e5836b",
"l2_to_l1_messages": [],
"events": [
{
"from_address": "0x6d0a7c29de4ea81d1b9982c04f691320a6b65eef9d6ea847b4b077a0305a24e",
"keys": [
"0x5ad857f66a5b55f1301ff1ed7e098ac6d4433148f0b72ebc4a2945ab85ad53"
],
"data": [
"0x6e81d0030bfae36fc55bf682f96dc2d103ee02f439b10c8e9af6742e7d7e2ea",
"0x0"
]
}
],
"execution_resources": {
"n_steps": 754,
"builtin_instance_counter": {
"pedersen_builtin": 2,
"range_check_builtin": 16,
"ecdsa_builtin": 1,
"output_builtin": 0,
"bitwise_builtin": 0
},
"n_memory_holes": 25
},
"actual_fee": "0xdb2148b8ea5"
},
{
"transaction_index": 7,
"transaction_hash": "0x060bc493f32b6a2ebc2f6fd67324e72c5104ca26afa9a1f61726caa1094f340b",
"l2_to_l1_messages": [],
"events": [],
"execution_resources": {
"n_steps": 0,
"builtin_instance_counter": {},
"n_memory_holes": 0
},
"actual_fee": "0x0"
}
],
"starknet_version": "0.9.1"
Expand Down
26 changes: 26 additions & 0 deletions crates/starknet_client/resources/reader/declare_v3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"account_deployment_data": [],
"class_hash": "0x6f6742127e27687640c7aaf566b9dc892c4493973076cb96fdeb418ae77c192",
"compiled_class_hash": "0xcbbcfda1dea5cc48d3c7ebefd50ecc4aaefabe7e5596fdef4f60cded0ea0b24",
"fee_data_availability_mode": 0,
"nonce": "0x0",
"nonce_data_availability_mode": 0,
"paymaster_data": [],
"resource_bounds": {
"L1_GAS": {
"max_amount": "0xffffffffffffffff",
"max_price_per_unit": "0xffffffffffffffffffffffffffffffff"
},
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"sender_address": "0x12fd537",
"signature": [],
"tip": "0x0",
"transaction_hash": "0x308104e126e1d6659ef499da73eeb88ba9f066a57ad75d8d27fa3ff420cded2",
"version": "0x3",
"max_fee": "0x0",
"type": "DECLARE"
}
36 changes: 36 additions & 0 deletions crates/starknet_client/resources/reader/deploy_account_v3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"class_hash": "0x1fcd2dcd811e049eaa730b87038a68f39220a04986b43fe287d690da0df01b8",
"constructor_calldata": [
"0x0",
"0x1",
"0x2",
"0x3",
"0x4",
"0x5",
"0x6",
"0x7",
"0x8",
"0x9"
],
"contract_address_salt": "0x2",
"fee_data_availability_mode": 0,
"nonce": "0x0",
"nonce_data_availability_mode": 0,
"paymaster_data": [],
"resource_bounds": {
"L1_GAS": {
"max_amount": "0xffffffffffffffff",
"max_price_per_unit": "0xffffffffffffffffffffffffffffffff"
},
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"sender_address": "0x1b34d819720bd84c89bdfb476bc2c4d0de9a41b766efabd20fa292280e4c6d9",
"signature": [],
"tip": "0x0",
"transaction_hash": "0x60bc493f32b6a2ebc2f6fd67324e72c5104ca26afa9a1f61726caa1094f340b",
"version": "0x3",
"type": "DEPLOY_ACCOUNT"
}
35 changes: 35 additions & 0 deletions crates/starknet_client/resources/reader/invoke_v3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"account_deployment_data": [],
"calldata": [
"0x0",
"0x1",
"0x2",
"0x3",
"0x4",
"0x5",
"0x6",
"0x7",
"0x8",
"0x9"
],
"fee_data_availability_mode": 0,
"nonce": "0x0",
"nonce_data_availability_mode": 0,
"paymaster_data": [],
"resource_bounds": {
"L1_GAS": {
"max_amount": "0xffffffffffffffff",
"max_price_per_unit": "0xffffffffffffffffffffffffffffffff"
},
"L2_GAS": {
"max_amount": "0x0",
"max_price_per_unit": "0x0"
}
},
"sender_address": "0x2da4d93784af6b4427c32533dd7e5780c9d642c3a3348f6adacebc97edab4c",
"signature": [],
"tip": "0x0",
"transaction_hash": "0x14df307294262b17b20c8949fd3dbd8f25a9bd47548d00d89ca93977e5836b",
"version": "0x3",
"type": "INVOKE_FUNCTION"
}
2 changes: 1 addition & 1 deletion crates/starknet_client/resources/reader/pending_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,4 @@
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"code": "TRANSACTION_RECEIVED",
"transaction_hash": "0x205ea2b8f86259db2d191895e8af9b186bf2aea05a5dbe28721b7840113f217",
"class_hash": "0x32ba0c2c5aa132c795a7ffa58057c36283dedf7bc0bfbf5687ba52fd317f56d"
}
}
2 changes: 1 addition & 1 deletion crates/starknet_client/resources/writer/declare_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -825,4 +825,4 @@
},
"sender_address": "0x43eef75848203b37363edd1e44e4121b49c8d4adff592c21b59566f5b76562f",
"type": "DECLARE"
}
}
2 changes: 1 addition & 1 deletion crates/starknet_client/resources/writer/declare_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@
"compiled_class_hash": "0x2ed2ccb5433d1d50d84d3e9dd8000d4cc618492c95169e30da0f9f93bcf1d01",
"sender_address": "0x43eef75848203b37363edd1e44e4121b49c8d4adff592c21b59566f5b76562f",
"type": "DECLARE"
}
}
94 changes: 94 additions & 0 deletions crates/starknet_client/resources/writer/declare_v3.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"code": "TRANSACTION_RECEIVED",
"transaction_hash": "0x6d0ea68e3e8e257ff7c6633277fc3ea6a42a57d0d15ada480cbaeec9c6be5d0",
"address": "0x219937256cd88844f9fdc9c33a2d6d492e253ae13814c2dc0ecab7f26919d46"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"0x406a640b3b70dad390d661c088df1fbaeb5162a07d57cf29ba794e2b0e3c804"
],
"type": "DEPLOY_ACCOUNT"
}
}
Loading

0 comments on commit 91d906c

Please sign in to comment.