From c984a6b3177e9bb3831d7f77b704ef733edc43da Mon Sep 17 00:00:00 2001 From: Shahak Shama Date: Sun, 26 May 2024 15:31:38 +0300 Subject: [PATCH] add broadcasted transaction --- p2p/proto/transaction.proto | 149 +++++++++++++++++++++++------------- 1 file changed, 94 insertions(+), 55 deletions(-) diff --git a/p2p/proto/transaction.proto b/p2p/proto/transaction.proto index e0d7a1f..84de5ca 100644 --- a/p2p/proto/transaction.proto +++ b/p2p/proto/transaction.proto @@ -1,4 +1,5 @@ syntax = "proto3"; +import "p2p/proto/class.proto"; import "p2p/proto/common.proto"; import "p2p/proto/receipt.proto"; @@ -16,8 +17,59 @@ 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 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=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 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; +} + +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 { message DeclareV0 { @@ -66,29 +118,6 @@ message Transaction uint32 version = 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; - } - - // 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 InvokeV0 { Felt252 max_fee = 1; AccountSignature signature = 2; @@ -97,35 +126,6 @@ message Transaction repeated Felt252 calldata = 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; - } - - message L1HandlerV0 { - Felt252 nonce = 1; - Address address = 2; - Felt252 entry_point_selector = 3; - repeated Felt252 calldata = 4; - } - oneof txn { DeclareV0 declare_v0 = 1; DeclareV1 declare_v1 = 2; @@ -163,4 +163,43 @@ message TransactionsResponse { message Transactions { repeated Transaction transactions = 1; -} \ No newline at end of file +} + +// 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 BroadcastedDeclareV2 { + Address sender = 1; + Felt252 max_fee = 2; + AccountSignature signature = 3; + Cairo1Class class = 4; + Felt252 nonce = 5; + } + + message BroadcastedDeclareV3 { + 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 { + BroadcastedDeclareV2 declare_v2 = 1; + BroadcastedDeclareV3 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; + } +}