Skip to content

Commit

Permalink
Add endpoint RPC/stream to get the call stacks (#58)
Browse files Browse the repository at this point in the history
* Add endpoint RPC to get the call stack for an operation id

* Correct typo and add skeleton for slot

* Correct typo in RPC response

* Add response ABI call stack for slots

* Add stream with filter for call stack

* Fix enum values

* Fix enum naming
  • Loading branch information
AurelienFT authored Feb 12, 2024
1 parent cb5671f commit 0162ffc
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions proto/apis/massa/api/v1/public.proto
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,22 @@ service PublicService {
};
}

// Get ABI call stack of an operation
rpc GetOperationABICallStacks(GetOperationABICallStacksRequest) returns (GetOperationABICallStacksResponse) {
option (google.api.http) = {
post: "/v1/get_operation_abi_call_stacks"
body: "*"
};
}

// Get ABI call stack of all asynchronous executions and all operations for a given slot
rpc GetSlotABICallStacks(GetSlotABICallStacksRequest) returns (GetSlotABICallStacksResponse) {
option (google.api.http) = {
post: "/v1/get_slot_abi_call_stacks"
body: "*"
};
}

// ███████╗████████╗██████╗ ███████╗ █████╗ ███╗ ███╗
// ██╔════╝╚══██╔══╝██╔══██╗██╔════╝██╔══██╗████╗ ████║
// ███████╗ ██║ ██████╔╝█████╗ ███████║██╔████╔██║
Expand All @@ -172,6 +188,9 @@ service PublicService {
// New received and slot execution events
rpc NewSlotExecutionOutputs(stream NewSlotExecutionOutputsRequest) returns (stream NewSlotExecutionOutputsResponse) {}

// Call stack for each slot executed
rpc NewSlotABICallStacks(stream NewSlotABICallStacksRequest) returns (stream NewSlotABICallStacksResponse) {}

// Send blocks
rpc SendBlocks(stream SendBlocksRequest) returns (stream SendBlocksResponse) {}

Expand Down Expand Up @@ -871,6 +890,32 @@ message NewSlotExecutionOutputsResponse {
massa.model.v1.SlotExecutionOutput output = 1;
}

// Finality level to filter on in streams
enum FinalityLevel {
// Unspecified (receive both)
FINALITY_LEVEL_UNSPECIFIED = 0;
// Candidate level
FINALITY_LEVEL_CANDIDATE = 1;
// Final level
FINALITY_LEVEL_FINAL = 2;
}

// NewSlotABICallStacks request
message NewSlotABICallStacksRequest {
// Finality level to receive informations from
FinalityLevel finality_level = 1;
}

// NewSlotABICallStacks response
message NewSlotABICallStacksResponse {
// Finality level to receive informations from
massa.model.v1.Slot slot = 1;
// Call stacks for asynchronous execution
repeated ASCABICallStack asc_call_stacks = 2;
// Call stack for operations
repeated OperationABICallStack operation_call_stacks = 3;
}

// SendBlocksRequest holds parameters to SendBlocks
message SendBlocksRequest {
// Secure shared block
Expand Down Expand Up @@ -1006,3 +1051,83 @@ message SearchOperationsResponse {
// Information about the operations
repeated massa.model.v1.OperationInfo operation_infos = 1;
}

// GetOperationABICallStacks request
message GetOperationABICallStacksRequest {
// Operations ids to get the call stack from
repeated string operation_ids = 1;
}

// Definition of an ABI call stack element
message ABICallStackElement {
// name of the ABI
string name = 1;
// Parameters of the ABI
repeated string parameters = 2;
// Return value of the ABI
string return_value = 3;
}

// Definition of an ABI call stack element that is the 'call' ABI
message ABICallStackElementCall {
// name of the ABI
string name = 1;
// Parameters of the ABI
repeated string parameters = 2;
// Calls made within this SC call
repeated ABICallStackElementParent sub_calls = 3;
// Return value of the ABI
string return_value = 4;
}

// Definition of an ABI call stack element parent
message ABICallStackElementParent {
// Element of the call stack
oneof call_stack_element {
// Any ABI call that is not the ABI 'call'
ABICallStackElement element = 1;
// Element that is the ABI 'call'
ABICallStackElementCall element_call = 2;
}
}

// Definition of an ABI call stack
message ABICallStack {
// All elements of the call stack
repeated ABICallStackElementParent call_stack = 1;
}

// GetOperationABICallStacks response
message GetOperationABICallStacksResponse {
repeated ABICallStack call_stacks = 1;
}

// GetSlotABICallStacks request
message GetSlotABICallStacksRequest {
// Slots asked
repeated massa.model.v1.Slot slots = 1;
}

// ABI asynchronous execution call stack
message ASCABICallStack {
// Index of the execution in the slot
uint64 index = 1;
// Call stack
repeated ABICallStackElementParent call_stack = 2;
}

// Operation execution call stack
message OperationABICallStack {
// Operation id
string operation_id = 1;
// Call stack
repeated ABICallStackElementParent call_stack = 2;
}

// GetSlotABICallStacks response
message GetSlotABICallStacksResponse {
// Call stacks for asynchronous execution
repeated ASCABICallStack asc_call_stacks = 1;
// Call stack for operations
repeated OperationABICallStack operation_call_stacks = 2;
}

0 comments on commit 0162ffc

Please sign in to comment.