Skip to content

Commit

Permalink
add broadcasted transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
ShahakShama committed May 26, 2024
1 parent 050f07d commit 52c3ee5
Showing 1 changed file with 139 additions and 100 deletions.
239 changes: 139 additions & 100 deletions p2p/proto/transaction.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
syntax = "proto3";
import "p2p/proto/class.proto";
import "p2p/proto/common.proto";
import "p2p/proto/receipt.proto";

Expand All @@ -16,116 +17,115 @@ message AccountSignature {
repeated Felt252 parts = 1;
}

// This is a transaction that is already accepted in a block. Once we have a mempool, we will define
// a separate message for BroadcastedTransaction.
message Transaction
{
message DeclareV0 {
Address sender = 1;
Felt252 max_fee = 2;
AccountSignature signature = 3;
Hash class_hash = 4;
}
message DeployAccountV1 {
Felt252 max_fee = 1;
AccountSignature signature = 2;
Hash class_hash = 3;
Felt252 nonce = 4;
Felt252 address_salt = 5;
repeated Felt252 calldata = 6;
}

message DeclareV1 {
Address sender = 1;
Felt252 max_fee = 2;
AccountSignature signature = 3;
Hash class_hash = 4;
Felt252 nonce = 5;
}
// see https://external.integration.starknet.io/feeder_gateway/get_transaction?transactionHash=0x29fd7881f14380842414cdfdd8d6c0b1f2174f8916edcfeb1ede1eb26ac3ef0
message DeployAccountV3 {
AccountSignature signature = 1;
Hash class_hash = 2;
Felt252 nonce = 3;
Felt252 address_salt = 4;
repeated Felt252 calldata = 5;
ResourceBounds resource_bounds = 6;
uint64 tip = 7;
repeated Felt252 paymaster_data = 8;
VolitionDomain nonce_data_availability_mode = 9;
VolitionDomain fee_data_availability_mode = 10;
}

message DeclareV2 {
Address sender = 1;
Felt252 max_fee = 2;
AccountSignature signature = 3;
Hash class_hash = 4;
Felt252 nonce = 5;
Hash compiled_class_hash = 6;
}
message DeclareV0 {
Address sender = 1;
Felt252 max_fee = 2;
AccountSignature signature = 3;
Hash class_hash = 4;
}

// see https://external.integration.starknet.io/feeder_gateway/get_transaction?transactionHash=0x41d1f5206ef58a443e7d3d1ca073171ec25fa75313394318fc83a074a6631c3
message DeclareV3 {
Address sender = 1;
AccountSignature signature = 2;
Hash class_hash = 3;
Felt252 nonce = 4;
Hash compiled_class_hash = 5;
ResourceBounds resource_bounds = 6;
uint64 tip = 7;
repeated Felt252 paymaster_data = 8;
repeated Felt252 account_deployment_data = 9;
VolitionDomain nonce_data_availability_mode = 10;
VolitionDomain fee_data_availability_mode = 11;
}
message DeclareV1 {
Address sender = 1;
Felt252 max_fee = 2;
AccountSignature signature = 3;
Hash class_hash = 4;
Felt252 nonce = 5;
}

message Deploy {
Hash class_hash = 1;
Felt252 address_salt = 2;
repeated Felt252 calldata = 3;
uint32 version = 4;
}
message DeclareV2 {
Address sender = 1;
Felt252 max_fee = 2;
AccountSignature signature = 3;
Hash class_hash = 4;
Felt252 nonce = 5;
Hash compiled_class_hash = 6;
}

message DeployAccountV1 {
Felt252 max_fee = 1;
AccountSignature signature = 2;
Hash class_hash = 3;
Felt252 nonce = 4;
Felt252 address_salt = 5;
repeated Felt252 calldata = 6;
}
// see https://external.integration.starknet.io/feeder_gateway/get_transaction?transactionHash=0x41d1f5206ef58a443e7d3d1ca073171ec25fa75313394318fc83a074a6631c3
message DeclareV3 {
Address sender = 1;
AccountSignature signature = 2;
Hash class_hash = 3;
Felt252 nonce = 4;
Hash compiled_class_hash = 5;
ResourceBounds resource_bounds = 6;
uint64 tip = 7;
repeated Felt252 paymaster_data = 8;
repeated Felt252 account_deployment_data = 9;
VolitionDomain nonce_data_availability_mode = 10;
VolitionDomain fee_data_availability_mode = 11;
}

// see https://external.integration.starknet.io/feeder_gateway/get_transaction?transactionHash=0x29fd7881f14380842414cdfdd8d6c0b1f2174f8916edcfeb1ede1eb26ac3ef0
message DeployAccountV3 {
AccountSignature signature = 1;
Hash class_hash = 2;
Felt252 nonce = 3;
Felt252 address_salt = 4;
repeated Felt252 calldata = 5;
ResourceBounds resource_bounds = 6;
uint64 tip = 7;
repeated Felt252 paymaster_data = 8;
VolitionDomain nonce_data_availability_mode = 9;
VolitionDomain fee_data_availability_mode = 10;
}
message Deploy {
Hash class_hash = 1;
Felt252 address_salt = 2;
repeated Felt252 calldata = 3;
uint32 version = 4;
}

message InvokeV0 {
Felt252 max_fee = 1;
AccountSignature signature = 2;
Address address = 3;
Felt252 entry_point_selector = 4;
repeated Felt252 calldata = 5;
}
message InvokeV0 {
Felt252 max_fee = 1;
AccountSignature signature = 2;
Address address = 3;
Felt252 entry_point_selector = 4;
repeated Felt252 calldata = 5;
}

message InvokeV1 {
Address sender = 1;
Felt252 max_fee = 2;
AccountSignature signature = 3;
repeated Felt252 calldata = 4;
Felt252 nonce = 5;
}
message InvokeV1 {
Address sender = 1;
Felt252 max_fee = 2;
AccountSignature signature = 3;
repeated Felt252 calldata = 4;
Felt252 nonce = 5;
}

// see https://external.integration.starknet.io/feeder_gateway/get_transaction?transactionHash=0x41906f1c314cca5f43170ea75d3b1904196a10101190d2b12a41cc61cfd17c
message InvokeV3 {
Address sender = 1;
AccountSignature signature = 2;
repeated Felt252 calldata = 3;
ResourceBounds resource_bounds = 4;
uint64 tip = 5;
repeated Felt252 paymaster_data = 6;
repeated Felt252 account_deployment_data = 7;
VolitionDomain nonce_data_availability_mode = 8;
VolitionDomain fee_data_availability_mode = 9;
Felt252 nonce = 10;
}
// see https://external.integration.starknet.io/feeder_gateway/get_transaction?transactionHash=0x41906f1c314cca5f43170ea75d3b1904196a10101190d2b12a41cc61cfd17c
message InvokeV3 {
Address sender = 1;
AccountSignature signature = 2;
repeated Felt252 calldata = 3;
ResourceBounds resource_bounds = 4;
uint64 tip = 5;
repeated Felt252 paymaster_data = 6;
repeated Felt252 account_deployment_data = 7;
VolitionDomain nonce_data_availability_mode = 8;
VolitionDomain fee_data_availability_mode = 9;
Felt252 nonce = 10;
}

message L1HandlerV0 {
Felt252 nonce = 1;
Address address = 2;
Felt252 entry_point_selector = 3;
repeated Felt252 calldata = 4;
}
message L1HandlerV0 {
Felt252 nonce = 1;
Address address = 2;
Felt252 entry_point_selector = 3;
repeated Felt252 calldata = 4;
}

// This is a transaction that is already accepted in a block.
message Transaction
{
oneof txn {
DeclareV0 declare_v0 = 1;
DeclareV1 declare_v1 = 2;
Expand Down Expand Up @@ -163,4 +163,43 @@ message TransactionsResponse {

message Transactions {
repeated Transaction transactions = 1;
}
}

// This is a transaction that wasn't inserted to a block yet.
// It contains only variants that are currently supported (unlike Transaction which contains
// deprecated variants).
// It also contains the entire class for Declare.
// Useful for consensus and mempool.
message BroadcastedTransaction {
message DeclareV2 {
Address sender = 1;
Felt252 max_fee = 2;
AccountSignature signature = 3;
Cairo1Class class = 4;
Felt252 nonce = 5;
}

message DeclareV3 {
Address sender = 1;
AccountSignature signature = 2;
Cairo1Class class = 3;
Felt252 nonce = 4;
ResourceBounds resource_bounds = 5;
uint64 tip = 6;
repeated Felt252 paymaster_data = 7;
repeated Felt252 account_deployment_data = 8;
VolitionDomain nonce_data_availability_mode = 9;
VolitionDomain fee_data_availability_mode = 10;
}

oneof txn {
DeclareV2 declare_v2 = 1;
DeclareV3 declare_v3 = 2;
DeployAccountV1 deploy_account_v1 = 3;
DeployAccountV3 deploy_account_v3 = 4;
InvokeV1 invoke_v1 = 5;
InvokeV3 invoke_v3 = 6;
// Irrelevant for mempool.
L1HandlerV0 l1_handler = 7;
}
}

0 comments on commit 52c3ee5

Please sign in to comment.