Skip to content

Commit

Permalink
Merge pull request #150 from AElfProject/feature/deserializeLog
Browse files Browse the repository at this point in the history
Feature/deserialize log
  • Loading branch information
hzz780 committed May 10, 2024
2 parents e9297f5 + 46666ef commit ae55dbe
Show file tree
Hide file tree
Showing 10 changed files with 1,596 additions and 303 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aelf-sdk",
"version": "3.4.8",
"version": "3.4.9",
"description": "aelf-sdk js library",
"main": "dist/aelf.cjs.js",
"browser": "dist/aelf.umd.js",
Expand Down
157 changes: 157 additions & 0 deletions proto/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/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;
}
56 changes: 0 additions & 56 deletions proto/core.proto

This file was deleted.

0 comments on commit ae55dbe

Please sign in to comment.