Skip to content

Commit

Permalink
feat: virtualTransactionCreated
Browse files Browse the repository at this point in the history
  • Loading branch information
AbigailDeng authored and AbigailDeng committed May 8, 2024
1 parent d3457c1 commit 389c049
Show file tree
Hide file tree
Showing 8 changed files with 1,501 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

| Statements | Branches | Functions | Lines |
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
| ![Statements](https://img.shields.io/badge/statements-96.23%25-brightgreen.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-93.62%25-brightgreen.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-96.66%25-brightgreen.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-96.39%25-brightgreen.svg?style=flat) |
| ![Statements](https://img.shields.io/badge/statements-96.16%25-brightgreen.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-93.45%25-brightgreen.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-96.68%25-brightgreen.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-96.32%25-brightgreen.svg?style=flat) |


## 1. Introduction
Expand Down
157 changes: 157 additions & 0 deletions proto/virtual_transaction/aelf/core.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
syntax = "proto3";

package aelf;

option csharp_namespace = "AElf.Types";

message Transaction {
// The address of the sender of the transaction.
Address from = 1;
// The address of the contract when calling a contract.
Address to = 2;
// The height of the referenced block hash.
int64 ref_block_number = 3;
// The first four bytes of the referenced block hash.
bytes ref_block_prefix = 4;
// The name of a method in the smart contract at the To address.
string method_name = 5;
// The parameters to pass to the smart contract method.
bytes params = 6;
// When signing a transaction it’s actually a subset of the fields: from/to and the target method as well as
// the parameter that were given. It also contains the reference block number and prefix.
bytes signature = 10000;
}

message StatePath {
// The partial path of the state path.
repeated string parts = 1;
}

message ScopedStatePath {
// The scope address, which will be the contract address.
Address address = 1;
// The path of contract state.
StatePath path = 2;
}

enum TransactionResultStatus {
// The execution result of the transaction does not exist.
NOT_EXISTED = 0;
// The transaction is in the transaction pool waiting to be packaged.
PENDING = 1;
// Transaction execution failed.
FAILED = 2;
// The transaction was successfully executed and successfully packaged into a block.
MINED = 3;
// When executed in parallel, there are conflicts with other transactions.
CONFLICT = 4;
// The transaction is waiting for validation.
PENDING_VALIDATION = 5;
// Transaction validation failed.
NODE_VALIDATION_FAILED = 6;
}

message TransactionResult {
// The transaction id.
Hash transaction_id = 1;
// The transaction result status.
TransactionResultStatus status = 2;
// The log events.
repeated LogEvent logs = 3;
// Bloom filter for transaction logs. A transaction log event can be defined in the contract and stored
// in the bloom filter after the transaction is executed. Through this filter, we can quickly search for
// and determine whether a log exists in the transaction result.
bytes bloom = 4;
// The return value of the transaction execution.
bytes return_value = 5;
// The height of the block hat packages the transaction.
int64 block_number = 6;
// The hash of the block hat packages the transaction.
Hash block_hash = 7;
// Failed execution error message.
string error = 10;
}

message LogEvent {
// The contract address.
Address address = 1;
// The name of the log event.
string name = 2;
// The indexed data, used to calculate bloom.
repeated bytes indexed = 3;
// The non indexed data.
bytes non_indexed = 4;
}

message SmartContractRegistration {
// The category of contract code(0: C#).
sint32 category = 1;
// The byte array of the contract code.
bytes code = 2;
// The hash of the contract code.
Hash code_hash = 3;
// Whether it is a system contract.
bool is_system_contract = 4;
// The version of the current contract.
int32 version = 5;
// The version of the contract.
string contract_version = 6;
// The address of the current contract.
Address contract_address = 7;
// Indicates if the contract is the user contract.
bool is_user_contract = 8;
}

message TransactionExecutingStateSet {
// The changed states.
map<string, bytes> writes = 1;
// The read states.
map<string, bool> reads = 2;
// The deleted states.
map<string, bool> deletes = 3;
}

message Address
{
bytes value = 1;
}

message Hash
{
bytes value = 1;
}

message SInt32Value
{
sint32 value = 1;
}

message SInt64Value
{
sint64 value = 1;
}

message MerklePath {
// The merkle path nodes.
repeated MerklePathNode merkle_path_nodes = 1;
}

message MerklePathNode{
// The node hash.
Hash hash = 1;
// Whether it is a left child node.
bool is_left_child_node = 2;
}

message BinaryMerkleTree {
// The leaf nodes.
repeated Hash nodes = 1;
// The root node hash.
Hash root = 2;
// The count of leaf node.
int32 leaf_count = 3;
}

message BigIntValue {
string value = 1;
}
38 changes: 38 additions & 0 deletions proto/virtual_transaction/aelf/options.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
syntax = "proto3";

package aelf;

import "../google/protobuf/descriptor.proto";

option csharp_namespace = "AElf";

// All aelf custom options field numbers are like 50yxxx
// where y stands for the custom options type:
// 0 - FileOptions
// 1 - MessageOptions
// 2 - FieldOptions
// 3 - EnumOptions
// 4 - EnumValueOptions
// 5 - ServiceOptions
// 6 - MethodOptions

extend google.protobuf.FileOptions {
string identity = 500001;
}

extend google.protobuf.ServiceOptions {
repeated string base = 505001;
string csharp_state = 505030;
}

extend google.protobuf.MethodOptions {
bool is_view = 506001;
}

extend google.protobuf.MessageOptions {
bool is_event = 50100;
}

extend google.protobuf.FieldOptions {
bool is_indexed = 502001;
}
Loading

0 comments on commit 389c049

Please sign in to comment.