Commit ab305b59 authored by vicotor's avatar vicotor

update proto

parent 61eaa9b7
......@@ -16,7 +16,7 @@ message EthTxParam {
BigInt value = 7;
uint64 nonce = 8;
bytes input = 9;
EthAccessList accesslist = 10;
AccessList accesslist = 10;
BigInt chain_id = 11;
}
......@@ -78,12 +78,12 @@ message EthTxLog {
bool removed = 9;
}
message Receipt {
message EthReceipt {
uint32 type = 1;
bytes root = 2;
uint64 status = 3;
uint64 cululative_gas_used = 4;
EthBloom bloom = 5;
Bloom bloom = 5;
repeated EthTxLog logs = 6;
Hash tx_hash = 7;
Address contract_address = 8;
......
......@@ -4,6 +4,7 @@ package crypter.v1;
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "base/v1/meta.proto";
import "crypter/v1/resource.proto";
......@@ -27,22 +28,20 @@ message BatchVerifyResponse {
repeated bool verified = 1;
}
message BatchRecoverRequest {
repeated bytes data = 1;
repeated bytes signature = 2;
CryptType crypt_type = 3;
}
message BatchRecoverResponse {
repeated bytes pubkey = 1;
}
message BatchRecoverTxRequest {
repeated EthTx raw_tx = 1;
repeated base.v1.MetaTxBase raw_tx = 1;
}
message BatchRecoverTxResponse {
repeated RethTx recover_tx = 1;
repeated base.v1.MetaTxBase recoverd_tx = 1;
}
......@@ -6,12 +6,3 @@ enum CryptType {
CRYPT_TYPE_INVALID = 0;
CRYPT_TYPE_SECP256K1 = 1;
}
\ No newline at end of file
message EthTx {
bytes rlp_data = 1;
}
message RethTx {
bytes from = 1;
bytes rlp_data = 2;
}
\ No newline at end of file
/*
Package custom contains custom types for test and example purposes.
These types are used by the test structures generated by gogoprotobuf.
*/
package custom
import (
"bytes"
"encoding/json"
"errors"
)
type Uint256 [4]uint64
func (u Uint256) Marshal() ([]byte, error) {
buffer := make([]byte, 32)
_, err := u.MarshalTo(buffer)
return buffer, err
}
func (u Uint256) MarshalTo(data []byte) (n int, err error) {
PutLittleEndianUint256(data, 0, u)
return 16, nil
}
func GetLittleEndianUint64(b []byte, offset int) uint64 {
v := uint64(b[offset+7]) << 56
v += uint64(b[offset+6]) << 48
v += uint64(b[offset+5]) << 40
v += uint64(b[offset+4]) << 32
v += uint64(b[offset+3]) << 24
v += uint64(b[offset+2]) << 16
v += uint64(b[offset+1]) << 8
v += uint64(b[offset])
return v
}
func PutLittleEndianUint64(b []byte, offset int, v uint64) {
b[offset] = byte(v)
b[offset+1] = byte(v >> 8)
b[offset+2] = byte(v >> 16)
b[offset+3] = byte(v >> 24)
b[offset+4] = byte(v >> 32)
b[offset+5] = byte(v >> 40)
b[offset+6] = byte(v >> 48)
b[offset+7] = byte(v >> 56)
}
func PutLittleEndianUint256(buffer []byte, offset int, v [4]uint64) {
PutLittleEndianUint64(buffer, offset, v[0])
PutLittleEndianUint64(buffer, offset+8, v[1])
PutLittleEndianUint64(buffer, offset+16, v[2])
PutLittleEndianUint64(buffer, offset+24, v[3])
}
func GetLittleEndianUint256(buffer []byte, offset int) (value [4]uint64) {
value[0] = GetLittleEndianUint64(buffer, offset)
value[1] = GetLittleEndianUint64(buffer, offset+8)
value[2] = GetLittleEndianUint64(buffer, offset+16)
value[3] = GetLittleEndianUint64(buffer, offset+24)
return
}
func (u *Uint256) Unmarshal(data []byte) error {
if data == nil {
u = nil
return nil
}
if len(data) == 0 {
pu := Uint256{}
*u = pu
return nil
}
if len(data) != 32 {
return errors.New("Uint256: invalid length")
}
pu := Uint256(GetLittleEndianUint256(data, 0))
*u = pu
return nil
}
func (u Uint256) MarshalJSON() ([]byte, error) {
data, err := u.Marshal()
if err != nil {
return nil, err
}
return json.Marshal(data)
}
func (u Uint256) Size() int {
return 32
}
func (u *Uint256) UnmarshalJSON(data []byte) error {
v := new([]byte)
err := json.Unmarshal(data, v)
if err != nil {
return err
}
return u.Unmarshal(*v)
}
func (this Uint256) Equal(that Uint256) bool {
return this == that
}
func (this Uint256) Compare(that Uint256) int {
thisdata, err := this.Marshal()
if err != nil {
panic(err)
}
thatdata, err := that.Marshal()
if err != nil {
panic(err)
}
return bytes.Compare(thisdata, thatdata)
}
type randy interface {
Intn(n int) int
}
func NewPopulatedUint256(r randy) *Uint256 {
data := make([]byte, 256)
for i := 0; i < 32; i++ {
data[i] = byte(r.Intn(255))
}
u := Uint256(GetLittleEndianUint256(data, 0))
return &u
}
package custom
import (
"testing"
)
func TestUint56(t *testing.T) {
var uint256a = Uint256{0, 1, 2, 3}
buf := make([]byte, 32)
PutLittleEndianUint256(buf, 0, uint256a)
uint256b := GetLittleEndianUint256(buf, 0)
if !uint256a.Equal(uint256b) {
t.Fatalf("%v != %v", uint256a, uint256b)
}
}
......@@ -5,7 +5,7 @@ package ethrpc.v1;
import "google/protobuf/empty.proto";
import "ethrpc/v1/request_response.proto";
import "ethrpc/v1/account_req_res.proto";
import "base/v1/eth_tx.proto";
import "base/v1/resource.proto";
......@@ -63,8 +63,8 @@ service RpcService {
rpc GetCode(GetCodeRequest) returns (GetCodeResponse) {};
rpc Sign(SignRequest) returns (SignResponse) {};
rpc SignTransaction(SignTransactionRequest) returns (SignTransactionResponse) {};
rpc SendTransaction(base.v1.EthTx) returns (SendTransactionResponse) {};
rpc SendRawTransaction(base.v1.EthTx) returns (SendRawTransactionResponse) {};
rpc SendTransaction(base.v1.EthTransaction) returns (SendTransactionResponse) {};
rpc SendRawTransaction(base.v1.EthTransaction) returns (SendRawTransactionResponse) {};
rpc Call(CallRequest) returns (CallResponse) {};
// filter
......
......@@ -11,7 +11,7 @@ require (
require (
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
......@@ -20,7 +20,6 @@ require (
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
google.golang.org/genproto v0.0.0-20221205194025-8222ab48f5fc // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 // indirect
google.golang.org/grpc/examples v0.0.0-20221202020918-001d234e1f2d // indirect
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,16 +2,16 @@ syntax = "proto3";
package txchecker.v1;
import "base/v1/resource.proto";
import "base/v1/meta.proto";
// The standard BatchGet request definition.
message BatchCheckTxRequest {
repeated base.v1.EthTx txs = 1;
repeated base.v1.MetaTxBase txs = 1;
}
// The standard BatchGet response definition.
message BatchCheckTxResponse {
// The retrieved shelves.
repeated bool status = 1;
repeated base.v1.MetaProofTx checked_txs = 1;
}
......@@ -4,6 +4,8 @@ package p2p.v1;
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "p2p/v1/resource.proto";
import "base/v1/batchtx.proto";
import "base/v1/meta.proto";
import "base/v1/resource.proto";
message BroadCastRequest {
......@@ -17,7 +19,7 @@ message BroadCastResponse {
message BroadCastTxsRequest {
repeated base.v1.Transaction txs = 1;
repeated base.v1.BatchTx txs = 1;
}
message BroadCastTxsResponse {
......@@ -33,7 +35,7 @@ message BatchTxsHashRequest{
message BatchTxsHashResponse {
bytes hash = 1;
repeated base.v1.Transaction txs = 2;
repeated base.v1.MetaProofTx txs = 2;
}
......
......@@ -11,22 +11,22 @@ import "base/v1/resource.proto";
service RingService{
// account info service
rpc SendTxAsEth(base.v1.TransactionEth) returns (SendRawTransactionResponse) {};
// account info service, just for test.
// rpc SendTxAsEth(base.v1.TransactionEth) returns (SendRawTransactionResponse) {};
rpc SendRepeatedEthTx(base.v1.RepeatedEthTx) returns (SendRawTransactionResponse) {};
// rpc SendRepeatedEthTx(base.v1.RepeatedEthTx) returns (SendRawTransactionResponse) {};
rpc SendRepeatedStdTx(base.v1.RepeatedStdTx) returns (SendRawTransactionResponse) {};
// rpc SendRepeatedStdTx(base.v1.RepeatedStdTx) returns (SendRawTransactionResponse) {};
rpc SendTxAsStd(base.v1.TransactionStd) returns (SendRawTransactionResponse) {};
// rpc SendTxAsStd(base.v1.TransactionStd) returns (SendRawTransactionResponse) {};
rpc SendTxAsAny(base.v1.Transaction) returns (SendRawTransactionResponse) {};
// rpc SendTxAsAny(base.v1.Transaction) returns (SendRawTransactionResponse) {};
rpc SendTxAsBytes(base.v1.TransactionBytes) returns (SendRawTransactionResponse) {};
// rpc SendTxAsBytes(base.v1.TransactionBytes) returns (SendRawTransactionResponse) {};
rpc SendEmpty(google.protobuf.Empty) returns (google.protobuf.Empty) {};
// rpc SendEmpty(google.protobuf.Empty) returns (google.protobuf.Empty) {};
rpc SendEmptyMsg(EmptyRequest) returns (EmptyResponse) {};
// rpc SendEmptyMsg(EmptyRequest) returns (EmptyResponse) {};
//rpc SendRawTransaction(base.v1.EthTx) returns (SendRawTransactionResponse) {};
rpc Nonce(NonceRequest) returns (NonceResponse) {};
......
......@@ -6,13 +6,15 @@ import "google/protobuf/empty.proto";
// SentryService methods for other module.
service SentryService {
// for ring
// LimitInfo get latest param for make batch tx.
rpc GetLimitInfo(LimitInfoRequest) returns(LimitInfoResponse) {}
// CommitBatchTx used to commit batch tx to tx-sort-network
rpc CommitBatchTx(CommitBatchTxRequest) returns(CommitBatchTxResponse) {}
// GetTxReceipt from tx-sort-network with txhash
rpc GetBatchTxResult(GetReceiptRequest) returns(GetReceiptResponse) {}
//for val
//for validator
// GetNewBlock used for nebula get new virtual block info from contract with lastblock.
rpc GetNewBlock(GetNewBlockRequest) returns(GetNewBlockResponse) {}
// CommitBlock used for nebula commit new block and state info to contract.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment