Commit 820571b3 authored by madengji's avatar madengji

add clang format

parent cdf51d68
Language: 'Proto'
BasedOnStyle: 'LLVM'
AccessModifierOffset: '-1'
AlignAfterOpenBracket: 'Align'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
AlignEscapedNewlinesLeft: 'true'
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'true'
AllowShortCaseLabelsOnASingleLine: 'true'
ColumnLimit: '200'
IndentWidth: '4'
ContinuationIndentWidth: '4'
TabWidth: '4'
TabWidth: '4'
ReflowComments: 'true'
SortIncludes: 'true'
AllowShortFunctionsOnASingleLine: 'Empty'
AllowShortIfStatementsOnASingleLine: 'true'
consensus/raft/tools/scripts/grpc33.log
consensus/raft/tools/scripts/logs/
*.orig
store/kvmvcc/1.png
store/kvmvcc/cpu.pprof
store/kvmvcc/kvmvcc.test
store/mpt/1.png
store/mpt/cpu.pprof
store/mpt/mpt.test
tool
.vscode
chain33 chain33
chain33-cli chain33-cli
tool
datadir*
*.log
*.exe
*.orig
*.bak
*.log.last
.idea
.vscode
build/chain33*
build/datadir
build/bityuan*
build/para
build/execblock
build/relayd
build/relayd.toml
build/*.log
build/fzm
build/guodun
build/main.sh
build/main*
build/para.sh
build/ci
build/tools/autotest/autotest
build/tools/autotest/*.toml
build/tools/autotest/chain33
build/tools/autotest/chain33-cli
.DS_Store
logs/
build/wallet
plugin/store/kvmvcc/1.png
plugin/store/kvmvcc/cpu.pprof
plugin/store/kvmvcc/kvmvcc.test
plugin/store/mpt/1.png
plugin/store/mpt/cpu.pprof
plugin/store/mpt/mpt.test
plugin/consensus/raft/tools/scripts/grpc33.log
plugin/consensus/raft/tools/scripts/logs/
...@@ -221,7 +221,6 @@ auto_ci: clean fmt_proto fmt_shell protobuf ...@@ -221,7 +221,6 @@ auto_ci: clean fmt_proto fmt_shell protobuf
${auto_fmt} ${auto_fmt}
git add *.go *.sh *.proto git add *.go *.sh *.proto
git status git status
echo "branch"
echo $(branch) echo $(branch)
files=$$(git status -suno); if [ -n "$$files" ]; then \ files=$$(git status -suno); if [ -n "$$files" ]; then \
git add *.go *.sh *.proto; \ git add *.go *.sh *.proto; \
......
...@@ -5,186 +5,196 @@ import "transaction.proto"; ...@@ -5,186 +5,196 @@ import "transaction.proto";
package types; package types;
message AddressResult { message AddressResult {
string addr = 1; string addr = 1;
int64 amount = 2; int64 amount = 2;
repeated bytes hashValues = 3; repeated bytes hashValues = 3;
string showSecret = 4; string showSecret = 4;
} }
// order // order
message BlackwhiteRound { message BlackwhiteRound {
// txhash // txhash
string gameID = 1; string gameID = 1;
// create -> play(timeout) -> show -> done // create -> play(timeout) -> show -> done
int32 status = 2; int32 status = 2;
// 游戏押金可大于 // 游戏押金可大于
int64 playAmount = 3; int64 playAmount = 3;
// 游戏人数 // 游戏人数
int32 playerCount = 4; int32 playerCount = 4;
// 当前游戏人数 // 当前游戏人数
int32 curPlayerCount = 5; int32 curPlayerCount = 5;
// 游戏需要比对次数 // 游戏需要比对次数
int32 loop = 6; int32 loop = 6;
// 当前出示密钥人数 // 当前出示密钥人数
int32 curShowCount = 7; int32 curShowCount = 7;
// 创建游戏时间 // 创建游戏时间
int64 createTime = 8; int64 createTime = 8;
// 出示密钥开始时间 // 出示密钥开始时间
int64 showTime = 9; int64 showTime = 9;
// 超时时间 // 超时时间
int64 timeout = 10; int64 timeout = 10;
// 创建游戏地址 // 创建游戏地址
string createAddr = 11; string createAddr = 11;
// 游戏名称 // 游戏名称
string gameName = 12; string gameName = 12;
// 游戏加密结果 // 游戏加密结果
repeated AddressResult addrResult = 13; repeated AddressResult addrResult = 13;
// 游戏赢家 // 游戏赢家
repeated string winner = 14; repeated string winner = 14;
// block高度以及索引值 // block高度以及索引值
int64 index = 15; int64 index = 15;
} }
// actions // actions
message BlackwhiteAction { message BlackwhiteAction {
oneof value { oneof value {
BlackwhiteCreate create = 1; BlackwhiteCreate create = 1;
BlackwhitePlay play = 2; BlackwhitePlay play = 2;
BlackwhiteShow show = 3; BlackwhiteShow show = 3;
BlackwhiteTimeoutDone timeoutDone = 4; BlackwhiteTimeoutDone timeoutDone = 4;
} }
int32 ty = 6; int32 ty = 6;
} }
message BlackwhiteCreate { message BlackwhiteCreate {
int64 playAmount = 1; int64 playAmount = 1;
int32 playerCount = 2; int32 playerCount = 2;
int64 timeout = 3; int64 timeout = 3;
string gameName = 4; string gameName = 4;
} }
message BlackwhitePlay { message BlackwhitePlay {
string gameID = 1; string gameID = 1;
int64 amount = 2; int64 amount = 2;
repeated bytes hashValues = 3; repeated bytes hashValues = 3;
} }
message BlackwhiteShow { message BlackwhiteShow {
string gameID = 1; string gameID = 1;
string secret = 2; string secret = 2;
} }
message BlackwhiteTimeoutDone { string gameID = 1; } message BlackwhiteTimeoutDone {
string gameID = 1;
}
// logs // logs
message ReceiptBlackwhite { BlackwhiteRound round = 1; } message ReceiptBlackwhite {
BlackwhiteRound round = 1;
}
message ReceiptBlackwhiteStatus { message ReceiptBlackwhiteStatus {
string gameID = 1; string gameID = 1;
int32 status = 2; int32 status = 2;
//记录上一次状态 //记录上一次状态
int32 prevStatus = 3; int32 prevStatus = 3;
string addr = 4; string addr = 4;
int64 index = 5; int64 index = 5;
} }
message ReqBlackwhiteRoundInfo { string gameID = 1; } message ReqBlackwhiteRoundInfo {
string gameID = 1;
}
message ReplyBlackwhiteRoundInfo { BlackwhiteRoundResult round = 1; } message ReplyBlackwhiteRoundInfo {
BlackwhiteRoundResult round = 1;
}
message ReqBlackwhiteRoundList { message ReqBlackwhiteRoundList {
//优先根据status查询,status不可为空 //优先根据status查询,status不可为空
int32 status = 1; int32 status = 1;
//二级搜索,如果要查询一个地址下的所有game信息,可以根据status,分多次查询,这样规避存储数据时的臃余情况 //二级搜索,如果要查询一个地址下的所有game信息,可以根据status,分多次查询,这样规避存储数据时的臃余情况
string address = 2; string address = 2;
int32 count = 3; int32 count = 3;
int32 direction = 4; int32 direction = 4;
int64 index = 5; int64 index = 5;
} }
message ReplyBlackwhiteRoundList { repeated BlackwhiteRoundResult round = 1; } message ReplyBlackwhiteRoundList {
repeated BlackwhiteRoundResult round = 1;
}
message ReqLoopResult { message ReqLoopResult {
string gameID = 1; string gameID = 1;
int32 loopSeq = 2; int32 loopSeq = 2;
} }
message perLoopResult { message perLoopResult {
repeated string winers = 1; repeated string winers = 1;
repeated string losers = 2; repeated string losers = 2;
} }
message ReplyLoopResults { message ReplyLoopResults {
string gameID = 1; string gameID = 1;
repeated perLoopResult results = 2; repeated perLoopResult results = 2;
} }
message BlackwhiteRoundResult { message BlackwhiteRoundResult {
// txhash // txhash
string gameID = 1; string gameID = 1;
// create -> play(timeout) -> show -> done // create -> play(timeout) -> show -> done
int32 status = 2; int32 status = 2;
// 游戏押金可大于 // 游戏押金可大于
int64 playAmount = 3; int64 playAmount = 3;
// 游戏人数 // 游戏人数
int32 playerCount = 4; int32 playerCount = 4;
// 当前游戏人数 // 当前游戏人数
int32 curPlayerCount = 5; int32 curPlayerCount = 5;
// 游戏需要比对次数 // 游戏需要比对次数
int32 loop = 6; int32 loop = 6;
// 当前出示密钥人数 // 当前出示密钥人数
int32 curShowCount = 7; int32 curShowCount = 7;
// 创建游戏时间 // 创建游戏时间
int64 createTime = 8; int64 createTime = 8;
// 出示密钥开始时间 // 出示密钥开始时间
int64 showTime = 9; int64 showTime = 9;
// 超时时间 // 超时时间
int64 timeout = 10; int64 timeout = 10;
// 创建游戏地址 // 创建游戏地址
string createAddr = 11; string createAddr = 11;
// 游戏名称 // 游戏名称
string gameName = 12; string gameName = 12;
// 游戏加密结果 // 游戏加密结果
repeated AddressResult addrResult = 13; repeated AddressResult addrResult = 13;
// 游戏赢家 // 游戏赢家
repeated string winner = 14; repeated string winner = 14;
// block高度以及索引值 // block高度以及索引值
int64 index = 15; int64 index = 15;
} }
message BlackwhiteCreateTxReq { message BlackwhiteCreateTxReq {
int64 PlayAmount = 1; int64 PlayAmount = 1;
int32 PlayerCount = 2; int32 PlayerCount = 2;
int64 Timeout = 3; int64 Timeout = 3;
string GameName = 4; string GameName = 4;
int64 Fee = 5; int64 Fee = 5;
} }
message BlackwhitePlayTxReq { message BlackwhitePlayTxReq {
string GameID = 1; string GameID = 1;
int64 Amount = 2; int64 Amount = 2;
repeated bytes HashValues = 3; repeated bytes HashValues = 3;
int64 Fee = 4; int64 Fee = 4;
} }
message BlackwhiteShowTxReq { message BlackwhiteShowTxReq {
string GameID = 1; string GameID = 1;
string Secret = 2; string Secret = 2;
int64 Fee = 3; int64 Fee = 3;
} }
message BlackwhiteTimeoutDoneTxReq { message BlackwhiteTimeoutDoneTxReq {
string GameID = 1; string GameID = 1;
int64 Fee = 2; int64 Fee = 2;
} }
service blackwhite { service blackwhite {
// blackwhite 对外提供服务的接口 // blackwhite 对外提供服务的接口
//区块链接口 //区块链接口
rpc Create(BlackwhiteCreate) returns (UnsignTx) {} rpc Create(BlackwhiteCreate) returns (UnsignTx) {}
//获取最新的区块头 //获取最新的区块头
rpc Show(BlackwhiteShow) returns (UnsignTx) {} rpc Show(BlackwhiteShow) returns (UnsignTx) {}
//交易接口 //交易接口
rpc Play(BlackwhitePlay) returns (UnsignTx) {} rpc Play(BlackwhitePlay) returns (UnsignTx) {}
rpc TimeoutDone(BlackwhiteTimeoutDone) returns (UnsignTx) {} rpc TimeoutDone(BlackwhiteTimeoutDone) returns (UnsignTx) {}
} }
\ No newline at end of file
...@@ -3,38 +3,38 @@ syntax = "proto3"; ...@@ -3,38 +3,38 @@ syntax = "proto3";
package types; package types;
message Cert { message Cert {
bytes certId = 1; bytes certId = 1;
int64 createTime = 2; int64 createTime = 2;
string key = 3; string key = 3;
bytes value = 4; bytes value = 4;
} }
message CertAction { message CertAction {
oneof value { oneof value {
CertNew new = 1; CertNew new = 1;
CertUpdate update = 2; CertUpdate update = 2;
CertNormal normal = 3; CertNormal normal = 3;
} }
int32 ty = 4; int32 ty = 4;
} }
message CertNew { message CertNew {
string key = 1; string key = 1;
bytes value = 2; bytes value = 2;
} }
message CertUpdate { message CertUpdate {
string key = 1; string key = 1;
bytes value = 2; bytes value = 2;
} }
message CertNormal { message CertNormal {
string key = 1; string key = 1;
bytes value = 2; bytes value = 2;
} }
message Authority { message Authority {
bool enable = 1; bool enable = 1;
string cryptoPath = 2; string cryptoPath = 2;
string signType = 3; string signType = 3;
} }
\ No newline at end of file
...@@ -4,110 +4,116 @@ package types; ...@@ -4,110 +4,116 @@ package types;
//合约对象信息 //合约对象信息
message EVMContractObject { message EVMContractObject {
string addr = 1; string addr = 1;
EVMContractData data = 2; EVMContractData data = 2;
EVMContractState state = 3; EVMContractState state = 3;
} }
// 存放合约固定数据 // 存放合约固定数据
message EVMContractData { message EVMContractData {
string creator = 1; string creator = 1;
string name = 2; string name = 2;
string alias = 3; string alias = 3;
string addr = 4; string addr = 4;
bytes code = 5; bytes code = 5;
bytes codeHash = 6; bytes codeHash = 6;
} }
// 存放合约变化数据 // 存放合约变化数据
message EVMContractState { message EVMContractState {
uint64 nonce = 1; uint64 nonce = 1;
bool suicided = 2; bool suicided = 2;
bytes storageHash = 3; bytes storageHash = 3;
map<string, bytes> storage = 4; map<string, bytes> storage = 4;
} }
// 创建/调用合约的请求结构 // 创建/调用合约的请求结构
message EVMContractAction { message EVMContractAction {
// 转账金额 // 转账金额
uint64 amount = 1; uint64 amount = 1;
// 消耗限制,默认为Transaction.Fee // 消耗限制,默认为Transaction.Fee
uint64 gasLimit = 2; uint64 gasLimit = 2;
// gas价格,默认为1 // gas价格,默认为1
uint32 gasPrice = 3; uint32 gasPrice = 3;
// 合约数据 // 合约数据
bytes code = 4; bytes code = 4;
// 合约别名,方便识别 // 合约别名,方便识别
string alias = 5; string alias = 5;
// 交易备注 // 交易备注
string note = 6; string note = 6;
} }
// 合约创建/调用日志 // 合约创建/调用日志
message ReceiptEVMContract { message ReceiptEVMContract {
string caller = 1; string caller = 1;
string contractName = 2; string contractName = 2;
string contractAddr = 3; string contractAddr = 3;
uint64 usedGas = 4; uint64 usedGas = 4;
// 创建合约返回的代码 // 创建合约返回的代码
bytes ret = 5; bytes ret = 5;
} }
// 用于保存EVM只能合约中的状态数据变更 // 用于保存EVM只能合约中的状态数据变更
message EVMStateChangeItem { message EVMStateChangeItem {
string key = 1; string key = 1;
bytes preValue = 2; bytes preValue = 2;
bytes currentValue = 3; bytes currentValue = 3;
} }
// 存放合约固定数据 // 存放合约固定数据
message EVMContractDataCmd { message EVMContractDataCmd {
string creator = 1; string creator = 1;
string name = 2; string name = 2;
string alias = 3; string alias = 3;
string addr = 4; string addr = 4;
string code = 5; string code = 5;
string codeHash = 6; string codeHash = 6;
} }
// 存放合约变化数据 // 存放合约变化数据
message EVMContractStateCmd { message EVMContractStateCmd {
uint64 nonce = 1; uint64 nonce = 1;
bool suicided = 2; bool suicided = 2;
string storageHash = 3; string storageHash = 3;
map<string, string> storage = 4; map<string, string> storage = 4;
} }
// 合约创建/调用日志 // 合约创建/调用日志
message ReceiptEVMContractCmd { message ReceiptEVMContractCmd {
string caller = 1; string caller = 1;
// 合约创建时才会返回此内容 // 合约创建时才会返回此内容
string contractName = 2; string contractName = 2;
string contractAddr = 3; string contractAddr = 3;
uint64 usedGas = 4; uint64 usedGas = 4;
// 创建合约返回的代码 // 创建合约返回的代码
string ret = 5; string ret = 5;
} }
message CheckEVMAddrReq { string addr = 1; } message CheckEVMAddrReq {
string addr = 1;
}
message CheckEVMAddrResp { message CheckEVMAddrResp {
bool contract = 1; bool contract = 1;
string contractAddr = 2; string contractAddr = 2;
string contractName = 3; string contractName = 3;
string aliasName = 4; string aliasName = 4;
} }
message EstimateEVMGasReq { message EstimateEVMGasReq {
string to = 1; string to = 1;
bytes code = 2; bytes code = 2;
string caller = 3; string caller = 3;
uint64 amount = 4; uint64 amount = 4;
}
message EstimateEVMGasResp {
uint64 gas = 1;
} }
message EstimateEVMGasResp { uint64 gas = 1; }
message EvmDebugReq { message EvmDebugReq {
// 0 query, 1 set, -1 clear // 0 query, 1 set, -1 clear
int32 optype = 1; int32 optype = 1;
} }
message EvmDebugResp { string debugStatus = 1; } message EvmDebugResp {
\ No newline at end of file string debugStatus = 1;
}
\ No newline at end of file
...@@ -3,121 +3,133 @@ syntax = "proto3"; ...@@ -3,121 +3,133 @@ syntax = "proto3";
package types; package types;
message Game { message Game {
//默认是由创建这局游戏的txHash作为gameId //默认是由创建这局游戏的txHash作为gameId
string gameId = 1; string gameId = 1;
// create 1 -> Match 2 -> Cancel 3 -> Close 4 // create 1 -> Match 2 -> Cancel 3 -> Close 4
int32 status = 2; int32 status = 2;
//创建时间 //创建时间
int64 createTime = 3; int64 createTime = 3;
//匹配时间(何时参与对赌) //匹配时间(何时参与对赌)
int64 matchTime = 4; int64 matchTime = 4;
//状态close的时间(包括cancel) //状态close的时间(包括cancel)
int64 closetime = 5; int64 closetime = 5;
//赌注 //赌注
int64 value = 6; int64 value = 6;
//发起者账号地址 //发起者账号地址
string createAddress = 7; string createAddress = 7;
//对赌者账号地址 //对赌者账号地址
string matchAddress = 8; string matchAddress = 8;
// hash 类型,预留字段 // hash 类型,预留字段
string hashType = 9; string hashType = 9;
//庄家创建游戏时,庄家自己出拳结果加密后的hash值 //庄家创建游戏时,庄家自己出拳结果加密后的hash值
bytes hashValue = 10; bytes hashValue = 10;
//用来公布庄家出拳结果的私钥 //用来公布庄家出拳结果的私钥
string secret = 11; string secret = 11;
// 1 平局,2 庄家获胜,3 matcher获胜,4 // 1 平局,2 庄家获胜,3 matcher获胜,4
// 庄家开奖超时,matcher获胜,并获得本局所有赌资 // 庄家开奖超时,matcher获胜,并获得本局所有赌资
int32 result = 12; int32 result = 12;
// matcher 出拳结果 // matcher 出拳结果
int32 matcherGuess = 13; int32 matcherGuess = 13;
// create txHash // create txHash
string createTxHash = 14; string createTxHash = 14;
// matche交易hash // matche交易hash
string matchTxHash = 15; string matchTxHash = 15;
// close txhash // close txhash
string closeTxHash = 16; string closeTxHash = 16;
// cancel txhash // cancel txhash
string cancelTxHash = 17; string cancelTxHash = 17;
int64 index = 18; int64 index = 18;
int64 prevIndex = 19; int64 prevIndex = 19;
int32 creatorGuess = 20; int32 creatorGuess = 20;
} }
// message for execs.game // message for execs.game
message GameAction { message GameAction {
oneof value { oneof value {
GameCreate create = 1; GameCreate create = 1;
GameCancel cancel = 2; GameCancel cancel = 2;
GameClose close = 3; GameClose close = 3;
GameMatch match = 4; GameMatch match = 4;
} }
int32 ty = 10; int32 ty = 10;
} }
message GameMatch { message GameMatch {
string gameId = 1; string gameId = 1;
int32 guess = 2; int32 guess = 2;
} }
message GameCancel { string gameId = 1; } message GameCancel {
string gameId = 1;
}
message GameClose { message GameClose {
string gameId = 1; string gameId = 1;
string secret = 2; string secret = 2;
} }
message GameCreate { message GameCreate {
int64 value = 1; int64 value = 1;
//加密用的算法 //加密用的算法
string hashType = 2; string hashType = 2;
//加密后的值 //加密后的值
bytes hashValue = 3; bytes hashValue = 3;
} }
// queryByAddr 和 queryByStatus共用同一个结构体 // queryByAddr 和 queryByStatus共用同一个结构体
message QueryGameListByStatusAndAddr { message QueryGameListByStatusAndAddr {
//优先根据status查询,status不可为空 //优先根据status查询,status不可为空
int32 status = 1; int32 status = 1;
//二级搜索,如果要查询一个地址下的所有game信息,可以根据status,分多次查询,这样规避存储数据时的臃余情况 //二级搜索,如果要查询一个地址下的所有game信息,可以根据status,分多次查询,这样规避存储数据时的臃余情况
string address = 2; string address = 2;
// 索引值 // 索引值
int64 index = 3; int64 index = 3;
//单页返回多少条记录,默认返回20条,单次最多返回100条 //单页返回多少条记录,默认返回20条,单次最多返回100条
int32 count = 4; int32 count = 4;
// 0降序,1升序,默认降序 // 0降序,1升序,默认降序
int32 direction = 5; int32 direction = 5;
} }
// 统计数量 // 统计数量
message QueryGameListCount { message QueryGameListCount {
//优先根据status查询,status不可为空 //优先根据status查询,status不可为空
int32 status = 1; int32 status = 1;
//二级搜索,如果要查询一个地址下的所有game信息,可以根据status,分多次查询,这样规避存储数据时的臃余情况 //二级搜索,如果要查询一个地址下的所有game信息,可以根据status,分多次查询,这样规避存储数据时的臃余情况
string address = 2; string address = 2;
} }
// 索引value值 // 索引value值
message GameRecord { message GameRecord {
string gameId = 1; string gameId = 1;
int64 index = 2; int64 index = 2;
} }
message QueryGameInfo { string gameId = 1; } message QueryGameInfo {
string gameId = 1;
}
message QueryGameInfos { repeated string gameIds = 1; } message QueryGameInfos {
repeated string gameIds = 1;
}
message ReplyGameList { repeated Game games = 1; } message ReplyGameList {
repeated Game games = 1;
}
message ReplyGameListCount { int64 count = 1; } message ReplyGameListCount {
int64 count = 1;
}
message ReplyGame { Game game = 1; } message ReplyGame {
Game game = 1;
}
message ReceiptGame { message ReceiptGame {
string gameId = 1; string gameId = 1;
int32 status = 2; int32 status = 2;
//记录上一次状态 //记录上一次状态
int32 prevStatus = 3; int32 prevStatus = 3;
string addr = 4; string addr = 4;
string createAddr = 5; string createAddr = 5;
string matchAddr = 6; string matchAddr = 6;
int64 index = 7; int64 index = 7;
int64 prevIndex = 8; int64 prevIndex = 8;
} }
...@@ -2,52 +2,52 @@ syntax = "proto3"; ...@@ -2,52 +2,52 @@ syntax = "proto3";
package types; package types;
message Hashlock { message Hashlock {
bytes hashlockId = 1; bytes hashlockId = 1;
int32 status = 2; int32 status = 2;
int64 CreateTime = 3; int64 CreateTime = 3;
string toAddress = 4; string toAddress = 4;
string returnAddress = 5; string returnAddress = 5;
int64 amount = 6; int64 amount = 6;
int64 frozentime = 7; int64 frozentime = 7;
} }
message HashlockLock { message HashlockLock {
int64 amount = 1; int64 amount = 1;
int64 time = 2; int64 time = 2;
bytes hash = 3; bytes hash = 3;
string toAddress = 4; string toAddress = 4;
string returnAddress = 5; string returnAddress = 5;
} }
message HashlockSend { message HashlockSend {
bytes secret = 1; bytes secret = 1;
// bytes hash = 3; // bytes hash = 3;
} }
message Hashlockquery { message Hashlockquery {
int64 time = 1; int64 time = 1;
int32 status = 2; int32 status = 2;
int64 amount = 3; int64 amount = 3;
int64 createTime = 4; int64 createTime = 4;
int64 currentTime = 5; int64 currentTime = 5;
} }
message HashRecv { message HashRecv {
bytes HashlockId = 1; bytes HashlockId = 1;
Hashlockquery Infomation = 2; Hashlockquery Infomation = 2;
} }
message HashlockUnlock { message HashlockUnlock {
bytes secret = 1; bytes secret = 1;
// bytes hash = 3; // bytes hash = 3;
} }
// message for hashlock // message for hashlock
message HashlockAction { message HashlockAction {
oneof value { oneof value {
HashlockLock hlock = 1; HashlockLock hlock = 1;
HashlockSend hsend = 2; HashlockSend hsend = 2;
HashlockUnlock hunlock = 3; HashlockUnlock hunlock = 3;
} }
int32 ty = 4; int32 ty = 4;
} }
\ No newline at end of file
...@@ -3,172 +3,194 @@ syntax = "proto3"; ...@@ -3,172 +3,194 @@ syntax = "proto3";
package types; package types;
message PurchaseRecord { message PurchaseRecord {
int64 amount = 1; int64 amount = 1;
int64 number = 2; int64 number = 2;
int64 index = 3; int64 index = 3;
int64 way = 4; int64 way = 4;
} }
message PurchaseRecords { message PurchaseRecords {
repeated PurchaseRecord record = 1; repeated PurchaseRecord record = 1;
int64 fundWin = 2; int64 fundWin = 2;
int64 amountOneRound = 3; int64 amountOneRound = 3;
} }
message Lottery { message Lottery {
string lotteryId = 1; string lotteryId = 1;
int32 status = 2; int32 status = 2;
int64 createHeight = 3; int64 createHeight = 3;
int64 fund = 4; int64 fund = 4;
int64 purBlockNum = 5; int64 purBlockNum = 5;
int64 drawBlockNum = 6; int64 drawBlockNum = 6;
int64 lastTransToPurState = 7; int64 lastTransToPurState = 7;
int64 lastTransToDrawState = 8; int64 lastTransToDrawState = 8;
map<string, PurchaseRecords> records = 9; map<string, PurchaseRecords> records = 9;
int64 totalPurchasedTxNum = 10; int64 totalPurchasedTxNum = 10;
string createAddr = 11; string createAddr = 11;
int64 round = 12; int64 round = 12;
int64 luckyNumber = 13; int64 luckyNumber = 13;
int64 createOnMain = 14; int64 createOnMain = 14;
int64 lastTransToPurStateOnMain = 15; int64 lastTransToPurStateOnMain = 15;
int64 lastTransToDrawStateOnMain = 16; int64 lastTransToDrawStateOnMain = 16;
repeated MissingRecord missingRecords = 17; repeated MissingRecord missingRecords = 17;
} }
message MissingRecord { repeated int32 times = 1; } message MissingRecord {
repeated int32 times = 1;
}
message LotteryAction { message LotteryAction {
oneof value { oneof value {
LotteryCreate create = 1; LotteryCreate create = 1;
LotteryBuy buy = 2; LotteryBuy buy = 2;
LotteryDraw draw = 3; LotteryDraw draw = 3;
LotteryClose close = 4; LotteryClose close = 4;
} }
int32 ty = 10; int32 ty = 10;
} }
message LotteryCreate { message LotteryCreate {
int64 purBlockNum = 1; int64 purBlockNum = 1;
int64 drawBlockNum = 2; int64 drawBlockNum = 2;
} }
message LotteryBuy { message LotteryBuy {
string lotteryId = 1; string lotteryId = 1;
int64 amount = 2; int64 amount = 2;
int64 number = 3; int64 number = 3;
int64 way = 4; int64 way = 4;
} }
message LotteryDraw { string lotteryId = 1; } message LotteryDraw {
string lotteryId = 1;
}
message LotteryClose { string lotteryId = 1; } message LotteryClose {
string lotteryId = 1;
}
message ReceiptLottery { message ReceiptLottery {
string lotteryId = 1; string lotteryId = 1;
int32 status = 2; int32 status = 2;
int32 prevStatus = 3; int32 prevStatus = 3;
string addr = 4; string addr = 4;
int64 round = 5; int64 round = 5;
int64 number = 6; int64 number = 6;
int64 amount = 7; int64 amount = 7;
int64 luckyNumber = 8; int64 luckyNumber = 8;
int64 time = 9; int64 time = 9;
string txHash = 10; string txHash = 10;
LotteryUpdateBuyInfo updateInfo = 11; LotteryUpdateBuyInfo updateInfo = 11;
int64 way = 12; int64 way = 12;
int64 index = 13; int64 index = 13;
} }
message ReqLotteryInfo { string lotteryId = 1; } message ReqLotteryInfo {
string lotteryId = 1;
}
message ReqLotteryBuyInfo { message ReqLotteryBuyInfo {
string lotteryId = 1; string lotteryId = 1;
string addr = 2; string addr = 2;
int64 round = 3; int64 round = 3;
} }
message ReqLotteryBuyHistory { message ReqLotteryBuyHistory {
string lotteryId = 1; string lotteryId = 1;
string addr = 2; string addr = 2;
int64 round = 3; int64 round = 3;
int32 count = 4; int32 count = 4;
int32 direction = 5; int32 direction = 5;
int64 index = 6; int64 index = 6;
} }
message ReqLotteryLuckyInfo { message ReqLotteryLuckyInfo {
string lotteryId = 1; string lotteryId = 1;
repeated int64 round = 2; repeated int64 round = 2;
} }
message ReqLotteryLuckyHistory { message ReqLotteryLuckyHistory {
string lotteryId = 1; string lotteryId = 1;
int64 round = 2; int64 round = 2;
int32 count = 3; int32 count = 3;
int32 direction = 4; int32 direction = 4;
} }
message ReplyLotteryNormalInfo { message ReplyLotteryNormalInfo {
int64 createHeight = 1; int64 createHeight = 1;
int64 purBlockNum = 2; int64 purBlockNum = 2;
int64 drawBlockNum = 3; int64 drawBlockNum = 3;
string createAddr = 4; string createAddr = 4;
} }
message ReplyLotteryCurrentInfo { message ReplyLotteryCurrentInfo {
int32 status = 1; int32 status = 1;
int64 fund = 2; int64 fund = 2;
int64 lastTransToPurState = 3; int64 lastTransToPurState = 3;
int64 lastTransToDrawState = 4; int64 lastTransToDrawState = 4;
int64 totalPurchasedTxNum = 5; int64 totalPurchasedTxNum = 5;
int64 round = 6; int64 round = 6;
int64 luckyNumber = 7; int64 luckyNumber = 7;
int64 lastTransToPurStateOnMain = 8; int64 lastTransToPurStateOnMain = 8;
int64 lastTransToDrawStateOnMain = 9; int64 lastTransToDrawStateOnMain = 9;
int64 purBlockNum = 10; int64 purBlockNum = 10;
int64 drawBlockNum = 11; int64 drawBlockNum = 11;
repeated MissingRecord missingRecords = 12; repeated MissingRecord missingRecords = 12;
} }
message ReplyLotteryHistoryLuckyNumber { repeated int64 luckyNumber = 1; } message ReplyLotteryHistoryLuckyNumber {
repeated int64 luckyNumber = 1;
}
message ReplyLotteryShowInfo { repeated LotteryBuyRecord records = 1; } message ReplyLotteryShowInfo {
repeated LotteryBuyRecord records = 1;
}
message LotteryNumberRecord { message LotteryNumberRecord {
int64 number = 1; int64 number = 1;
int64 amount = 2; int64 amount = 2;
} }
// used for execlocal // used for execlocal
message LotteryBuyRecord { message LotteryBuyRecord {
int64 number = 1; int64 number = 1;
int64 amount = 2; int64 amount = 2;
int64 round = 3; int64 round = 3;
int64 type = 4; int64 type = 4;
int64 way = 5; int64 way = 5;
int64 index = 6; int64 index = 6;
int64 time = 7; int64 time = 7;
string txHash = 8; string txHash = 8;
} }
message LotteryBuyRecords { repeated LotteryBuyRecord records = 1; } message LotteryBuyRecords {
repeated LotteryBuyRecord records = 1;
}
message LotteryDrawRecord { message LotteryDrawRecord {
int64 number = 1; int64 number = 1;
int64 round = 2; int64 round = 2;
int64 time = 3; int64 time = 3;
string txHash = 4; string txHash = 4;
} }
message LotteryDrawRecords { repeated LotteryDrawRecord records = 1; } message LotteryDrawRecords {
repeated LotteryDrawRecord records = 1;
}
message LotteryUpdateRec { message LotteryUpdateRec {
int64 index = 1; int64 index = 1;
int64 type = 2; int64 type = 2;
} }
message LotteryUpdateRecs { repeated LotteryUpdateRec records = 1; } message LotteryUpdateRecs {
repeated LotteryUpdateRec records = 1;
}
message LotteryUpdateBuyInfo { map<string, LotteryUpdateRecs> buyInfo = 1; } message LotteryUpdateBuyInfo {
map<string, LotteryUpdateRecs> buyInfo = 1;
}
message ReplyLotteryPurchaseAddr { repeated string address = 1; } message ReplyLotteryPurchaseAddr {
repeated string address = 1;
}
...@@ -2,20 +2,24 @@ syntax = "proto3"; ...@@ -2,20 +2,24 @@ syntax = "proto3";
package types; package types;
message Norm { message Norm {
bytes normId = 1; bytes normId = 1;
int64 createTime = 2; int64 createTime = 2;
string key = 3; string key = 3;
bytes value = 4; bytes value = 4;
} }
message NormAction { message NormAction {
oneof value { NormPut nput = 1; } oneof value {
int32 ty = 5; NormPut nput = 1;
}
int32 ty = 5;
} }
message NormPut { message NormPut {
string key = 1; string key = 1;
bytes value = 2; bytes value = 2;
} }
message NormGetKey { string key = 1; } message NormGetKey {
\ No newline at end of file string key = 1;
}
\ No newline at end of file
...@@ -7,117 +7,127 @@ package types; ...@@ -7,117 +7,127 @@ package types;
// stateDB // stateDB
message ParacrossStatusDetails { message ParacrossStatusDetails {
repeated string addrs = 1; repeated string addrs = 1;
repeated bytes blockHash = 2; repeated bytes blockHash = 2;
} }
message ParacrossHeightStatus { message ParacrossHeightStatus {
// ing, done // ing, done
int32 status = 1; int32 status = 1;
string title = 2; string title = 2;
int64 height = 3; int64 height = 3;
ParacrossStatusDetails details = 4; ParacrossStatusDetails details = 4;
} }
message ParacrossStatus { message ParacrossStatus {
string title = 1; string title = 1;
int64 height = 2; int64 height = 2;
bytes blockHash = 3; bytes blockHash = 3;
} }
// action // action
message ParacrossNodeStatus { message ParacrossNodeStatus {
bytes mainBlockHash = 1; bytes mainBlockHash = 1;
int64 mainBlockHeight = 2; int64 mainBlockHeight = 2;
string title = 3; string title = 3;
int64 height = 4; int64 height = 4;
bytes preBlockHash = 5; bytes preBlockHash = 5;
bytes blockHash = 6; bytes blockHash = 6;
bytes preStateHash = 7; bytes preStateHash = 7;
bytes stateHash = 8; bytes stateHash = 8;
uint32 txCounts = 9; uint32 txCounts = 9;
bytes txResult = 10; bytes txResult = 10;
repeated bytes txHashs = 11; repeated bytes txHashs = 11;
bytes crossTxResult = 12; bytes crossTxResult = 12;
repeated bytes crossTxHashs = 13; repeated bytes crossTxHashs = 13;
} }
message ParacrossCommitAction { ParacrossNodeStatus status = 1; } message ParacrossCommitAction {
ParacrossNodeStatus status = 1;
}
message ParacrossMinerAction { ParacrossNodeStatus status = 1; } message ParacrossMinerAction {
ParacrossNodeStatus status = 1;
}
message ParacrossAction { message ParacrossAction {
oneof value { oneof value {
ParacrossCommitAction commit = 1; ParacrossCommitAction commit = 1;
ParacrossMinerAction miner = 3; ParacrossMinerAction miner = 3;
AssetsTransfer assetTransfer = 4; AssetsTransfer assetTransfer = 4;
AssetsWithdraw assetWithdraw = 5; AssetsWithdraw assetWithdraw = 5;
AssetsTransfer transfer = 6; AssetsTransfer transfer = 6;
AssetsWithdraw withdraw = 7; AssetsWithdraw withdraw = 7;
AssetsTransferToExec transferToExec = 8; AssetsTransferToExec transferToExec = 8;
} }
int32 ty = 2; int32 ty = 2;
} }
// logs // logs
message ReceiptParacrossCommit { message ReceiptParacrossCommit {
string addr = 1; string addr = 1;
ParacrossNodeStatus status = 2; ParacrossNodeStatus status = 2;
ParacrossHeightStatus prev = 3; ParacrossHeightStatus prev = 3;
ParacrossHeightStatus current = 4; ParacrossHeightStatus current = 4;
} }
message ReceiptParacrossMiner { ParacrossNodeStatus status = 1; } message ReceiptParacrossMiner {
ParacrossNodeStatus status = 1;
}
message ReceiptParacrossDone { message ReceiptParacrossDone {
int32 totalNodes = 1; int32 totalNodes = 1;
int32 totalCommit = 2; int32 totalCommit = 2;
int32 mostSameCommit = 3; int32 mostSameCommit = 3;
string title = 4; string title = 4;
int64 height = 5; int64 height = 5;
bytes stateHash = 6; bytes stateHash = 6;
uint32 txCounts = 7; uint32 txCounts = 7;
bytes txResult = 8; bytes txResult = 8;
} }
message ReceiptParacrossRecord { message ReceiptParacrossRecord {
string addr = 1; string addr = 1;
ParacrossNodeStatus status = 2; ParacrossNodeStatus status = 2;
} }
// LocalDB // LocalDB
// title-height-addr : txHash // title-height-addr : txHash
message ParacrossTx { string txHash = 1; } message ParacrossTx {
string txHash = 1;
}
// query // query
message ReqParacrossTitleHeight { message ReqParacrossTitleHeight {
string title = 1; string title = 1;
int64 height = 2; int64 height = 2;
} }
message RespParacrossTitles { repeated ReceiptParacrossDone titles = 1; } message RespParacrossTitles {
repeated ReceiptParacrossDone titles = 1;
}
// 跨链转账相关 // 跨链转账相关
message ParacrossAsset { message ParacrossAsset {
// input // input
string from = 1; string from = 1;
string to = 2; string to = 2;
bool isWithdraw = 3; bool isWithdraw = 3;
bytes txHash = 4; bytes txHash = 4;
int64 amount = 5; int64 amount = 5;
string exec = 6; string exec = 6;
string symbol = 7; string symbol = 7;
// 主链部分 // 主链部分
int64 height = 10; int64 height = 10;
// 平行链部分 // 平行链部分
int64 commitDoneHeight = 21; int64 commitDoneHeight = 21;
int64 paraHeight = 22; int64 paraHeight = 22;
bool success = 23; bool success = 23;
} }
service paracross { service paracross {
rpc GetTitle(ReqString) returns (ParacrossStatus) {} rpc GetTitle(ReqString) returns (ParacrossStatus) {}
rpc ListTitles(ReqNil) returns (RespParacrossTitles) {} rpc ListTitles(ReqNil) returns (RespParacrossTitles) {}
rpc GetTitleHeight(ReqParacrossTitleHeight) returns (ReceiptParacrossDone) {} rpc GetTitleHeight(ReqParacrossTitleHeight) returns (ReceiptParacrossDone) {}
rpc GetAssetTxResult(ReqHash) returns (ParacrossAsset) {} rpc GetAssetTxResult(ReqHash) returns (ParacrossAsset) {}
} }
\ No newline at end of file
...@@ -6,156 +6,170 @@ package types; ...@@ -6,156 +6,170 @@ package types;
//斗牛游戏内容 //斗牛游戏内容
message PokerBull { message PokerBull {
string gameId = 1; //默认是由创建这局游戏的txHash作为gameId string gameId = 1; //默认是由创建这局游戏的txHash作为gameId
int32 status = 2; // Start 1 -> Continue 2 -> Quit 3 int32 status = 2; // Start 1 -> Continue 2 -> Quit 3
int64 startTime = 3; //开始时间 int64 startTime = 3; //开始时间
string startTxHash = 4; //游戏启动交易hash string startTxHash = 4; //游戏启动交易hash
int64 value = 5; //赌注 int64 value = 5; //赌注
PBPoker poker = 6; //扑克牌 PBPoker poker = 6; //扑克牌
repeated PBPlayer players = 7; //玩家历史牌和结果集 repeated PBPlayer players = 7; //玩家历史牌和结果集
int32 playerNum = 8; //玩家数 int32 playerNum = 8; //玩家数
repeated PBResult results = 9; //游戏结果集 repeated PBResult results = 9; //游戏结果集
int64 index = 10; //索引 int64 index = 10; //索引
int64 prevIndex = 11; //上级索引 int64 prevIndex = 11; //上级索引
int64 quitTime = 12; //游戏结束时间 int64 quitTime = 12; //游戏结束时间
string quitTxHash = 13; //游戏结束交易hash string quitTxHash = 13; //游戏结束交易hash
string dealerAddr = 14; //下局庄家地址 string dealerAddr = 14; //下局庄家地址
bool isWaiting = 15; //游戏是否处于等待状态 bool isWaiting = 15; //游戏是否处于等待状态
int32 preStatus = 16; //上一index的状态 int32 preStatus = 16; //上一index的状态
} }
//一把牌 //一把牌
message PBHand { message PBHand {
repeated int32 cards = 1; //一把牌,五张 repeated int32 cards = 1; //一把牌,五张
int32 result = 2; //斗牛结果 (没牛:0, 牛1-9:1-9, 牛牛:10) int32 result = 2; //斗牛结果 (没牛:0, 牛1-9:1-9, 牛牛:10)
string address = 3; //玩家地址 string address = 3; //玩家地址
bool isWin = 4; //是否赢庄家 bool isWin = 4; //是否赢庄家
int32 leverage = 5; //赌注倍数 int32 leverage = 5; //赌注倍数
} }
//玩家 //玩家
message PBPlayer { message PBPlayer {
repeated PBHand hands = 1; //历史发牌和斗牛结果 repeated PBHand hands = 1; //历史发牌和斗牛结果
string address = 2; //玩家地址 string address = 2; //玩家地址
int64 txHash = 3; //发牌随机数因子txhash的整数格式 int64 txHash = 3; //发牌随机数因子txhash的整数格式
bool ready = 4; // continue状态下,是否ready bool ready = 4; // continue状态下,是否ready
} }
//本局游戏结果 //本局游戏结果
message PBResult { message PBResult {
repeated PBHand hands = 1; //本局所有玩家的牌和结果,按牛大小升序排序 repeated PBHand hands = 1; //本局所有玩家的牌和结果,按牛大小升序排序
string winner = 2; //赢家地址 string winner = 2; //赢家地址
int32 leverage = 3; //赢得赌注倍数 int32 leverage = 3; //赢得赌注倍数
string dealer = 4; //庄家 string dealer = 4; //庄家
int32 dealerLeverage = 5; //庄家赌注倍数 int32 dealerLeverage = 5; //庄家赌注倍数
} }
//扑克牌 //扑克牌
message PBPoker { message PBPoker {
repeated int32 cards = 1; // 52张牌 repeated int32 cards = 1; // 52张牌
int32 pointer = 2; //已发牌偏移 int32 pointer = 2; //已发牌偏移
} }
//游戏状态 //游戏状态
message PBGameAction { message PBGameAction {
oneof value { oneof value {
PBGameStart start = 1; PBGameStart start = 1;
PBGameContinue continue = 2; PBGameContinue continue = 2;
PBGameQuit quit = 3; PBGameQuit quit = 3;
PBGameQuery query = 4; PBGameQuery query = 4;
} }
int32 ty = 10; int32 ty = 10;
} }
//游戏启动 //游戏启动
message PBGameStart { message PBGameStart {
int64 value = 1; int64 value = 1;
int32 playerNum = 2; int32 playerNum = 2;
} }
//游戏继续 //游戏继续
message PBGameContinue { string gameId = 1; } message PBGameContinue {
string gameId = 1;
}
//游戏结束 //游戏结束
message PBGameQuit { string gameId = 1; } message PBGameQuit {
string gameId = 1;
}
//查询游戏结果 //查询游戏结果
message PBGameQuery { string gameId = 1; } message PBGameQuery {
string gameId = 1;
}
//根据状态和游戏人数查找 //根据状态和游戏人数查找
message QueryPBGameListByStatusAndPlayerNum { message QueryPBGameListByStatusAndPlayerNum {
int32 status = 1; int32 status = 1;
int32 playerNum = 2; int32 playerNum = 2;
int64 index = 3; int64 index = 3;
} }
// 索引value值 // 索引value值
message PBGameRecord { message PBGameRecord {
string gameId = 1; string gameId = 1;
int32 status = 2; int32 status = 2;
int64 index = 3; int64 index = 3;
} }
message PBGameIndexRecord { message PBGameIndexRecord {
string gameId = 1; string gameId = 1;
int64 index = 2; int64 index = 2;
} }
message PBGameRecords { repeated PBGameRecord records = 1; } message PBGameRecords {
repeated PBGameRecord records = 1;
}
message QueryPBGameInfo { message QueryPBGameInfo {
string gameId = 1; string gameId = 1;
string addr = 2; string addr = 2;
int32 status = 3; int32 status = 3;
int64 index = 4; int64 index = 4;
} }
message ReplyPBGame { PokerBull game = 1; } message ReplyPBGame {
PokerBull game = 1;
}
message QueryPBGameInfos { repeated string gameIds = 1; } message QueryPBGameInfos {
repeated string gameIds = 1;
}
message ReplyPBGameList { repeated PokerBull games = 1; } message ReplyPBGameList {
repeated PokerBull games = 1;
}
message ReceiptPBGame { message ReceiptPBGame {
string gameId = 1; string gameId = 1;
int32 status = 2; int32 status = 2;
string addr = 3; string addr = 3;
int64 index = 4; int64 index = 4;
int64 prevIndex = 5; int64 prevIndex = 5;
int32 playerNum = 6; int32 playerNum = 6;
int64 value = 7; int64 value = 7;
bool isWaiting = 8; bool isWaiting = 8;
repeated string players = 9; repeated string players = 9;
int32 preStatus = 10; int32 preStatus = 10;
} }
message PBStartTxReq { message PBStartTxReq {
int64 value = 1; int64 value = 1;
int32 playerNum = 2; int32 playerNum = 2;
int64 fee = 3; int64 fee = 3;
} }
message PBContinueTxReq { message PBContinueTxReq {
string gameId = 1; string gameId = 1;
int64 fee = 2; int64 fee = 2;
} }
message PBQuitTxReq { message PBQuitTxReq {
string gameId = 1; string gameId = 1;
int64 fee = 2; int64 fee = 2;
} }
message PBQueryReq { message PBQueryReq {
string gameId = 1; string gameId = 1;
int64 fee = 2; int64 fee = 2;
} }
// pokerbull 对外提供服务的接口 // pokerbull 对外提供服务的接口
service pokerbull { service pokerbull {
//游戏开始 //游戏开始
rpc Start(PBGameStart) returns (UnsignTx) {} rpc Start(PBGameStart) returns (UnsignTx) {}
//游戏继续 //游戏继续
rpc Continue(PBGameContinue) returns (UnsignTx) {} rpc Continue(PBGameContinue) returns (UnsignTx) {}
//游戏结束 //游戏结束
rpc Quit(PBGameQuit) returns (UnsignTx) {} rpc Quit(PBGameQuit) returns (UnsignTx) {}
} }
This diff is collapsed.
...@@ -2,204 +2,212 @@ syntax = "proto3"; ...@@ -2,204 +2,212 @@ syntax = "proto3";
package types; package types;
enum RelayOrderStatus { enum RelayOrderStatus {
init = 0; init = 0;
pending = 1; pending = 1;
locking = 2; locking = 2;
confirming = 3; confirming = 3;
finished = 4; finished = 4;
canceled = 5; canceled = 5;
timeout = 6; // TODO: may not needed? timeout = 6; // TODO: may not needed?
} }
message RelayAction { message RelayAction {
oneof value { oneof value {
RelayCreate create = 1; RelayCreate create = 1;
RelayAccept accept = 2; RelayAccept accept = 2;
RelayRevoke revoke = 3; RelayRevoke revoke = 3;
RelayConfirmTx confirmTx = 4; RelayConfirmTx confirmTx = 4;
RelayVerify verify = 5; RelayVerify verify = 5;
RelayVerifyCli verifyCli = 6; RelayVerifyCli verifyCli = 6;
BtcHeaders btcHeaders = 7; BtcHeaders btcHeaders = 7;
} }
int32 ty = 10; int32 ty = 10;
} }
message RelayOrder { message RelayOrder {
string id = 1; string id = 1;
RelayOrderStatus status = 2; RelayOrderStatus status = 2;
RelayOrderStatus preStatus = 3; RelayOrderStatus preStatus = 3;
uint64 amount = 4; uint64 amount = 4;
string createrAddr = 5; string createrAddr = 5;
uint32 coinOperation = 6; uint32 coinOperation = 6;
string coin = 7; string coin = 7;
uint64 coinAmount = 8; uint64 coinAmount = 8;
string coinAddr = 9; string coinAddr = 9;
string coinTxHash = 10; string coinTxHash = 10;
int64 createTime = 11; int64 createTime = 11;
string acceptAddr = 12; string acceptAddr = 12;
int64 acceptTime = 13; int64 acceptTime = 13;
int64 confirmTime = 14; int64 confirmTime = 14;
int64 finishTime = 15; int64 finishTime = 15;
string finishTxHash = 16; string finishTxHash = 16;
int64 height = 17; int64 height = 17;
uint64 coinHeight = 18; uint64 coinHeight = 18;
uint32 coinWaits = 19; uint32 coinWaits = 19;
} }
message RelayCreate { message RelayCreate {
uint32 operation = 1; // 0: buy, 1: sell uint32 operation = 1; // 0: buy, 1: sell
string coin = 2; // outside coin BTC, ETH... string coin = 2; // outside coin BTC, ETH...
uint64 amount = 3; uint64 amount = 3;
string addr = 4; string addr = 4;
uint64 btyAmount = 5; uint64 btyAmount = 5;
uint32 coinWaits = 6; // the coin blocks to wait uint32 coinWaits = 6; // the coin blocks to wait
} }
message RelayAccept { message RelayAccept {
string orderId = 1; string orderId = 1;
string coinAddr = 2; // for sell coin case needed string coinAddr = 2; // for sell coin case needed
uint32 coinWaits = 3; uint32 coinWaits = 3;
} }
message RelayRevoke { message RelayRevoke {
string orderId = 1; string orderId = 1;
uint32 target = 2; // 0:create , 1: accept uint32 target = 2; // 0:create , 1: accept
uint32 action = 3; // 0: unlock, 1: cancel (only for creator) uint32 action = 3; // 0: unlock, 1: cancel (only for creator)
} }
//客户只用交易hash提交, 验证需要的其他信息由relayd提供 //客户只用交易hash提交, 验证需要的其他信息由relayd提供
message RelayConfirmTx { message RelayConfirmTx {
string orderId = 1; string orderId = 1;
string txHash = 2; string txHash = 2;
} }
// relayd提供验证信息 // relayd提供验证信息
message RelayVerify { message RelayVerify {
string orderId = 1; string orderId = 1;
BtcTransaction tx = 2; BtcTransaction tx = 2;
BtcSpv spv = 3; BtcSpv spv = 3;
} }
message RelayVerifyCli { message RelayVerifyCli {
string orderId = 1; string orderId = 1;
string rawTx = 2; string rawTx = 2;
uint32 txIndex = 3; uint32 txIndex = 3;
string merkBranch = 4; string merkBranch = 4;
string blockHash = 5; string blockHash = 5;
} }
message BtcHeader { message BtcHeader {
string hash = 1; string hash = 1;
uint64 confirmations = 2; uint64 confirmations = 2;
uint64 height = 3; uint64 height = 3;
uint32 version = 4; uint32 version = 4;
string merkleRoot = 5; string merkleRoot = 5;
int64 time = 6; int64 time = 6;
uint64 nonce = 7; uint64 nonce = 7;
int64 bits = 8; int64 bits = 8;
int64 difficulty = 9; int64 difficulty = 9;
string previousHash = 10; string previousHash = 10;
string nextHash = 11; string nextHash = 11;
bool isReset = 12; // 0: nomal btc headers sync (default), 1: set the base bool isReset = 12; // 0: nomal btc headers sync (default), 1: set the base
// head (may not from 1) // head (may not from 1)
} }
message BtcHeaders { repeated BtcHeader btcHeader = 1; } message BtcHeaders {
repeated BtcHeader btcHeader = 1;
}
message BtcTransaction { message BtcTransaction {
string hash = 1; // txhash string hash = 1; // txhash
uint64 blockHeight = 2; uint64 blockHeight = 2;
repeated Vin vin = 3; repeated Vin vin = 3;
repeated Vout vout = 4; repeated Vout vout = 4;
int64 time = 5; int64 time = 5;
uint64 confirmations = 6; uint64 confirmations = 6;
} }
message Vin { message Vin {
string address = 1; string address = 1;
uint64 Value = 2; uint64 Value = 2;
} }
message Vout { message Vout {
bool coinbase = 1; bool coinbase = 1;
string address = 2; string address = 2;
uint64 Value = 3; uint64 Value = 3;
} }
message BtcSpv { message BtcSpv {
string hash = 1; // txhash string hash = 1; // txhash
int64 time = 2; int64 time = 2;
uint64 height = 3; uint64 height = 3;
string blockHash = 4; string blockHash = 4;
uint32 txIndex = 5; uint32 txIndex = 5;
repeated bytes branchProof = 6; repeated bytes branchProof = 6;
} }
message RelayLastRcvBtcHeader { message RelayLastRcvBtcHeader {
BtcHeader Header = 1; BtcHeader Header = 1;
uint64 baseHeight = 2; uint64 baseHeight = 2;
} }
message ReceiptRelayRcvBTCHeaders { message ReceiptRelayRcvBTCHeaders {
repeated BtcHeader headers = 1; repeated BtcHeader headers = 1;
uint64 lastHeight = 2; // last height is the last btc Tx's last height uint64 lastHeight = 2; // last height is the last btc Tx's last height
uint64 newHeight = 3; uint64 newHeight = 3;
uint64 lastBaseHeight = 4; // last base height means ever base height uint64 lastBaseHeight = 4; // last base height means ever base height
uint64 newBaseHeight = 5; uint64 newBaseHeight = 5;
} }
message ReceiptRelayLog { message ReceiptRelayLog {
string orderId = 1; string orderId = 1;
string curStatus = 2; string curStatus = 2;
string preStatus = 3; string preStatus = 3;
string txAmount = 4; string txAmount = 4;
string createrAddr = 5; string createrAddr = 5;
string coinOperation = 6; string coinOperation = 6;
string coin = 7; string coin = 7;
string coinAmount = 8; string coinAmount = 8;
string coinAddr = 9; string coinAddr = 9;
string coinTxHash = 10; string coinTxHash = 10;
int64 createTime = 11; int64 createTime = 11;
string acceptAddr = 12; string acceptAddr = 12;
int64 acceptTime = 13; int64 acceptTime = 13;
int64 confirmTime = 14; int64 confirmTime = 14;
int64 finishTime = 15; int64 finishTime = 15;
string finishTxHash = 16; string finishTxHash = 16;
uint64 coinHeight = 17; uint64 coinHeight = 17;
uint32 coinWaits = 18; uint32 coinWaits = 18;
} }
message ReqRelayAddrCoins { message ReqRelayAddrCoins {
string addr = 1; string addr = 1;
RelayOrderStatus status = 2; RelayOrderStatus status = 2;
repeated string coins = 3; repeated string coins = 3;
int32 pageNumber = 4; int32 pageNumber = 4;
int32 pageSize = 5; int32 pageSize = 5;
} }
message ReplyRelayOrders { repeated RelayOrder relayorders = 1; } message ReplyRelayOrders {
repeated RelayOrder relayorders = 1;
}
message QueryRelayOrderParam { message QueryRelayOrderParam {
RelayOrderStatus status = 1; RelayOrderStatus status = 1;
string orderId = 2; string orderId = 2;
} }
message QueryRelayOrderResult { repeated RelayOrder orders = 1; } message QueryRelayOrderResult {
repeated RelayOrder orders = 1;
}
message ReqRelayBtcHeaderHeightList { message ReqRelayBtcHeaderHeightList {
int64 reqHeight = 1; int64 reqHeight = 1;
int32 counts = 2; int32 counts = 2;
int32 direction = 3; // 0: desc, 1: asc int32 direction = 3; // 0: desc, 1: asc
} }
message ReplyRelayBtcHeadHeightList { repeated int64 heights = 1; } message ReplyRelayBtcHeadHeightList {
repeated int64 heights = 1;
}
message ReqRelayQryBTCHeadHeight { message ReqRelayQryBTCHeadHeight {
int64 baseHeight = 1; // from the baseHeight begin, if any int64 baseHeight = 1; // from the baseHeight begin, if any
} }
message ReplayRelayQryBTCHeadHeight { message ReplayRelayQryBTCHeadHeight {
int64 curHeight = 1; // current height in chain int64 curHeight = 1; // current height in chain
int64 baseHeight = 2; // base height means the the 1st head record in chain db int64 baseHeight = 2; // base height means the the 1st head record in chain db
// (base height can be change) // (base height can be change)
} }
\ No newline at end of file
...@@ -6,70 +6,70 @@ package types; ...@@ -6,70 +6,70 @@ package types;
// message for retrieve start // message for retrieve start
message RetrievePara { message RetrievePara {
string defaultAddress = 1; string defaultAddress = 1;
int32 status = 2; int32 status = 2;
int64 createTime = 3; int64 createTime = 3;
int64 prepareTime = 4; int64 prepareTime = 4;
int64 delayPeriod = 5; int64 delayPeriod = 5;
} }
message Retrieve { message Retrieve {
// used as key // used as key
string backupAddress = 1; string backupAddress = 1;
repeated RetrievePara retPara = 2; repeated RetrievePara retPara = 2;
} }
message RetrieveAction { message RetrieveAction {
oneof value { oneof value {
PrepareRetrieve prepare = 1; PrepareRetrieve prepare = 1;
PerformRetrieve perform = 2; PerformRetrieve perform = 2;
BackupRetrieve backup = 3; BackupRetrieve backup = 3;
CancelRetrieve cancel = 4; CancelRetrieve cancel = 4;
} }
int32 ty = 5; int32 ty = 5;
} }
message BackupRetrieve { message BackupRetrieve {
string backupAddress = 1; string backupAddress = 1;
string defaultAddress = 2; string defaultAddress = 2;
int64 delayPeriod = 3; int64 delayPeriod = 3;
} }
message PrepareRetrieve { message PrepareRetrieve {
string backupAddress = 1; string backupAddress = 1;
string defaultAddress = 2; string defaultAddress = 2;
} }
message PerformRetrieve { message PerformRetrieve {
string backupAddress = 1; string backupAddress = 1;
string defaultAddress = 2; string defaultAddress = 2;
} }
message CancelRetrieve { message CancelRetrieve {
string backupAddress = 1; string backupAddress = 1;
string defaultAddress = 2; string defaultAddress = 2;
} }
message ReqRetrieveInfo { message ReqRetrieveInfo {
string backupAddress = 1; string backupAddress = 1;
string defaultAddress = 2; string defaultAddress = 2;
} }
message RetrieveQuery { message RetrieveQuery {
string backupAddress = 1; string backupAddress = 1;
string defaultAddress = 2; string defaultAddress = 2;
int64 delayPeriod = 3; int64 delayPeriod = 3;
int64 prepareTime = 4; int64 prepareTime = 4;
int64 remainTime = 5; int64 remainTime = 5;
int32 status = 6; int32 status = 6;
} }
// retrieve 对外提供服务的接口 // retrieve 对外提供服务的接口
service retrieve { service retrieve {
rpc Prepare(PrepareRetrieve) returns (UnsignTx) {} rpc Prepare(PrepareRetrieve) returns (UnsignTx) {}
rpc Perform(PerformRetrieve) returns (UnsignTx) {} rpc Perform(PerformRetrieve) returns (UnsignTx) {}
rpc Backup(BackupRetrieve) returns (UnsignTx) {} rpc Backup(BackupRetrieve) returns (UnsignTx) {}
rpc Cancel(CancelRetrieve) returns (UnsignTx) {} rpc Cancel(CancelRetrieve) returns (UnsignTx) {}
} }
// message for retrieve end // message for retrieve end
\ No newline at end of file
...@@ -4,123 +4,131 @@ package types; ...@@ -4,123 +4,131 @@ package types;
import "common.proto"; import "common.proto";
message Ticket { message Ticket {
string ticketId = 1; string ticketId = 1;
// 0 -> 未成熟 1 -> 可挖矿 2 -> 已挖成功 3-> 已关闭 // 0 -> 未成熟 1 -> 可挖矿 2 -> 已挖成功 3-> 已关闭
int32 status = 2; int32 status = 2;
// genesis 创建的私钥比较特殊 // genesis 创建的私钥比较特殊
bool isGenesis = 3; bool isGenesis = 3;
//创建时间 //创建时间
int64 createTime = 4; int64 createTime = 4;
//挖矿时间 //挖矿时间
int64 minerTime = 5; int64 minerTime = 5;
//挖到的币的数目 //挖到的币的数目
int64 minerValue = 8; int64 minerValue = 8;
string minerAddress = 6; string minerAddress = 6;
// return wallet // return wallet
string returnAddress = 7; string returnAddress = 7;
} }
// message for execs.ticket // message for execs.ticket
message TicketAction { message TicketAction {
oneof value { oneof value {
TicketBind tbind = 5; TicketBind tbind = 5;
TicketOpen topen = 1; TicketOpen topen = 1;
TicketGenesis genesis = 2; TicketGenesis genesis = 2;
TicketClose tclose = 3; TicketClose tclose = 3;
TicketMiner miner = 4; TicketMiner miner = 4;
} }
int32 ty = 10; int32 ty = 10;
} }
message TicketMiner { message TicketMiner {
uint32 bits = 1; uint32 bits = 1;
int64 reward = 2; int64 reward = 2;
string ticketId = 3; string ticketId = 3;
bytes modify = 4; bytes modify = 4;
//挖到区块时公开 //挖到区块时公开
bytes privHash = 5; bytes privHash = 5;
} }
message TicketMinerOld { message TicketMinerOld {
uint32 bits = 1; uint32 bits = 1;
int64 reward = 2; int64 reward = 2;
string ticketId = 3; string ticketId = 3;
bytes modify = 4; bytes modify = 4;
} }
message MinerFlag { message MinerFlag {
int32 flag = 1; int32 flag = 1;
int64 reserve = 2; int64 reserve = 2;
} }
message TicketBind { message TicketBind {
string minerAddress = 1; string minerAddress = 1;
string returnAddress = 2; string returnAddress = 2;
} }
message TicketOpen { message TicketOpen {
//用户挖矿的ticket 地址 //用户挖矿的ticket 地址
string minerAddress = 1; string minerAddress = 1;
//购买ticket的数目 //购买ticket的数目
int32 count = 2; int32 count = 2;
//币实际存储的地址 //币实际存储的地址
string returnAddress = 3; string returnAddress = 3;
//随机种子 //随机种子
int64 randSeed = 4; int64 randSeed = 4;
//购买ticket时公开 //购买ticket时公开
repeated bytes pubHashes = 5; repeated bytes pubHashes = 5;
} }
message TicketGenesis { message TicketGenesis {
string minerAddress = 1; string minerAddress = 1;
string returnAddress = 2; string returnAddress = 2;
int32 count = 3; int32 count = 3;
} }
message TicketClose { repeated string ticketId = 1; } message TicketClose {
repeated string ticketId = 1;
}
message TicketList { message TicketList {
string addr = 1; string addr = 1;
int32 status = 3; int32 status = 3;
} }
message TicketInfos { repeated string ticketIds = 1; } message TicketInfos {
repeated string ticketIds = 1;
}
message ReplyTicketList { repeated Ticket tickets = 1; } message ReplyTicketList {
repeated Ticket tickets = 1;
}
message ReplyWalletTickets { message ReplyWalletTickets {
repeated Ticket tickets = 1; repeated Ticket tickets = 1;
repeated bytes privkeys = 2; repeated bytes privkeys = 2;
} }
message ReceiptTicket { message ReceiptTicket {
string ticketId = 1; string ticketId = 1;
int32 status = 2; int32 status = 2;
int32 prevStatus = 3; int32 prevStatus = 3;
string addr = 4; string addr = 4;
} }
message ReceiptTicketBind { message ReceiptTicketBind {
string oldMinerAddress = 1; string oldMinerAddress = 1;
string newMinerAddress = 2; string newMinerAddress = 2;
string returnAddress = 3; string returnAddress = 3;
} }
message ReqBindMiner { message ReqBindMiner {
string bindAddr = 1; string bindAddr = 1;
string originAddr = 2; string originAddr = 2;
int64 amount = 3; int64 amount = 3;
bool checkBalance = 4; bool checkBalance = 4;
} }
message ReplyBindMiner { string txHex = 1; } message ReplyBindMiner {
string txHex = 1;
}
service ticket { service ticket {
//创建绑定挖矿 //创建绑定挖矿
rpc CreateBindMiner(ReqBindMiner) returns (ReplyBindMiner) {} rpc CreateBindMiner(ReqBindMiner) returns (ReplyBindMiner) {}
//查询钱包票数 //查询钱包票数
rpc GetTicketCount(types.ReqNil) returns (Int64) {} rpc GetTicketCount(types.ReqNil) returns (Int64) {}
// Miner // Miner
//设置自动挖矿 //设置自动挖矿
rpc SetAutoMining(MinerFlag) returns (Reply) {} rpc SetAutoMining(MinerFlag) returns (Reply) {}
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ syntax = "proto3"; ...@@ -3,7 +3,7 @@ syntax = "proto3";
package signatory; package signatory;
message Config { message Config {
repeated string whitelist = 1; repeated string whitelist = 1;
string jrpcBindAddr = 2; string jrpcBindAddr = 2;
string privkey = 3; string privkey = 3;
} }
...@@ -7,134 +7,140 @@ package types; ...@@ -7,134 +7,140 @@ package types;
// action // action
message TokenAction { message TokenAction {
oneof value { oneof value {
TokenPreCreate tokenPreCreate = 1; TokenPreCreate tokenPreCreate = 1;
TokenFinishCreate tokenFinishCreate = 2; TokenFinishCreate tokenFinishCreate = 2;
TokenRevokeCreate tokenRevokeCreate = 3; TokenRevokeCreate tokenRevokeCreate = 3;
AssetsTransfer transfer = 4; AssetsTransfer transfer = 4;
AssetsWithdraw withdraw = 5; AssetsWithdraw withdraw = 5;
AssetsGenesis genesis = 6; AssetsGenesis genesis = 6;
AssetsTransferToExec transferToExec = 8; AssetsTransferToExec transferToExec = 8;
} }
int32 Ty = 7; int32 Ty = 7;
} }
//创建token,支持最大精确度是8位小数,即存入数据库的实际总额需要放大1e8倍 //创建token,支持最大精确度是8位小数,即存入数据库的实际总额需要放大1e8倍
message TokenPreCreate { message TokenPreCreate {
string name = 1; string name = 1;
string symbol = 2; string symbol = 2;
string introduction = 3; string introduction = 3;
int64 total = 4; int64 total = 4;
int64 price = 5; int64 price = 5;
string owner = 6; string owner = 6;
} }
message TokenFinishCreate { message TokenFinishCreate {
string symbol = 1; string symbol = 1;
string owner = 2; string owner = 2;
} }
message TokenRevokeCreate { message TokenRevokeCreate {
string symbol = 1; string symbol = 1;
string owner = 2; string owner = 2;
} }
// state db // state db
message Token { message Token {
string name = 1; string name = 1;
string symbol = 2; string symbol = 2;
string introduction = 3; string introduction = 3;
int64 total = 4; int64 total = 4;
int64 price = 5; int64 price = 5;
string owner = 6; string owner = 6;
string creator = 7; string creator = 7;
int32 status = 8; int32 status = 8;
} }
// log // log
message ReceiptToken { message ReceiptToken {
string symbol = 1; string symbol = 1;
string owner = 2; string owner = 2;
int32 status = 3; int32 status = 3;
} }
// local // local
message LocalToken { message LocalToken {
string name = 1; string name = 1;
string symbol = 2; string symbol = 2;
string introduction = 3; string introduction = 3;
int64 total = 4; int64 total = 4;
int64 price = 5; int64 price = 5;
string owner = 6; string owner = 6;
string creator = 7; string creator = 7;
int32 status = 8; int32 status = 8;
int64 createdHeight = 9; int64 createdHeight = 9;
int64 createdTime = 10; int64 createdTime = 10;
int64 prepareCreateHeight = 11; int64 prepareCreateHeight = 11;
int64 prepareCreateTime = 12; int64 prepareCreateTime = 12;
int32 precision = 13; int32 precision = 13;
// 如果需要这个项可以单独做一个域存储 // 如果需要这个项可以单独做一个域存储
int64 totalTransferTimes = 14; int64 totalTransferTimes = 14;
int64 revokedHeight = 15; int64 revokedHeight = 15;
int64 revokedTime = 16; int64 revokedTime = 16;
} }
// query // query
message ReqTokens { message ReqTokens {
bool queryAll = 1; bool queryAll = 1;
int32 status = 2; int32 status = 2;
repeated string tokens = 3; repeated string tokens = 3;
bool symbolOnly = 4; bool symbolOnly = 4;
} }
message ReplyTokens { repeated LocalToken tokens = 1; } message ReplyTokens {
repeated LocalToken tokens = 1;
}
message TokenRecv { message TokenRecv {
string token = 1; string token = 1;
int64 recv = 2; int64 recv = 2;
}
message ReplyAddrRecvForTokens {
repeated TokenRecv tokenRecvs = 1;
} }
message ReplyAddrRecvForTokens { repeated TokenRecv tokenRecvs = 1; }
message ReqTokenBalance { message ReqTokenBalance {
repeated string addresses = 1; repeated string addresses = 1;
string tokenSymbol = 2; string tokenSymbol = 2;
string execer = 3; string execer = 3;
} }
message ReqAccountTokenAssets { message ReqAccountTokenAssets {
string address = 1; string address = 1;
string execer = 2; string execer = 2;
} }
message TokenAsset { message TokenAsset {
string symbol = 1; string symbol = 1;
Account account = 2; Account account = 2;
} }
message ReplyAccountTokenAssets { repeated TokenAsset tokenAssets = 1; } message ReplyAccountTokenAssets {
repeated TokenAsset tokenAssets = 1;
}
message ReqAddrTokens { message ReqAddrTokens {
string addr = 1; string addr = 1;
int32 status = 2; int32 status = 2;
repeated string token = 3; repeated string token = 3;
int32 direction = 4; int32 direction = 4;
int32 count = 5; int32 count = 5;
string fromKey = 6; string fromKey = 6;
} }
message ReqTokenTx { message ReqTokenTx {
string symbol = 1; string symbol = 1;
//表示取所有/from/to/其他的hash列表 //表示取所有/from/to/其他的hash列表
int32 flag = 2; int32 flag = 2;
int32 count = 3; int32 count = 3;
int32 direction = 4; int32 direction = 4;
int64 height = 5; int64 height = 5;
int64 index = 6; int64 index = 6;
string addr = 7; string addr = 7;
} }
service token { service token {
// token 对外提供服务的接口 // token 对外提供服务的接口
//区块链接口 //区块链接口
rpc GetTokenBalance(ReqTokenBalance) returns (Accounts) {} rpc GetTokenBalance(ReqTokenBalance) returns (Accounts) {}
} }
\ No newline at end of file
This diff is collapsed.
...@@ -4,175 +4,185 @@ import "transaction.proto"; ...@@ -4,175 +4,185 @@ import "transaction.proto";
package types; package types;
message BlockID { bytes Hash = 1; } message BlockID {
bytes Hash = 1;
}
message TendermintBitArray { message TendermintBitArray {
int32 Bits = 1; int32 Bits = 1;
repeated uint64 Elems = 2; repeated uint64 Elems = 2;
} }
message Vote { message Vote {
bytes ValidatorAddress = 1; bytes ValidatorAddress = 1;
int32 ValidatorIndex = 2; int32 ValidatorIndex = 2;
int64 Height = 3; int64 Height = 3;
int32 Round = 4; int32 Round = 4;
int64 Timestamp = 5; int64 Timestamp = 5;
uint32 Type = 6; uint32 Type = 6;
BlockID BlockID = 7; BlockID BlockID = 7;
bytes Signature = 8; bytes Signature = 8;
} }
message TendermintCommit { message TendermintCommit {
BlockID BlockID = 1; BlockID BlockID = 1;
repeated Vote Precommits = 2; repeated Vote Precommits = 2;
} }
message TendermintBlockInfo { message TendermintBlockInfo {
TendermintCommit SeenCommit = 1; TendermintCommit SeenCommit = 1;
TendermintCommit LastCommit = 2; TendermintCommit LastCommit = 2;
State State = 3; State State = 3;
Proposal Proposal = 4; Proposal Proposal = 4;
TendermintBlock block = 5; TendermintBlock block = 5;
} }
message BlockSize { message BlockSize {
int32 MaxBytes = 1; int32 MaxBytes = 1;
int32 MaxTxs = 2; int32 MaxTxs = 2;
int64 MaxGas = 3; int64 MaxGas = 3;
} }
message TxSize { message TxSize {
int32 MaxBytes = 1; int32 MaxBytes = 1;
int64 MaxGas = 2; int64 MaxGas = 2;
} }
message BlockGossip { int32 BlockPartSizeBytes = 1; } message BlockGossip {
int32 BlockPartSizeBytes = 1;
}
message EvidenceParams { int64 MaxAge = 1; } message EvidenceParams {
int64 MaxAge = 1;
}
message ConsensusParams { message ConsensusParams {
BlockSize BlockSize = 1; BlockSize BlockSize = 1;
TxSize TxSize = 2; TxSize TxSize = 2;
BlockGossip BlockGossip = 3; BlockGossip BlockGossip = 3;
EvidenceParams EvidenceParams = 4; EvidenceParams EvidenceParams = 4;
} }
message Validator { message Validator {
bytes Address = 1; bytes Address = 1;
bytes PubKey = 2; bytes PubKey = 2;
int64 VotingPower = 3; int64 VotingPower = 3;
int64 Accum = 4; int64 Accum = 4;
} }
message ValidatorSet { message ValidatorSet {
repeated Validator Validators = 1; repeated Validator Validators = 1;
Validator Proposer = 2; Validator Proposer = 2;
} }
message State { message State {
string ChainID = 1; string ChainID = 1;
int64 LastBlockHeight = 2; int64 LastBlockHeight = 2;
int64 LastBlockTotalTx = 3; int64 LastBlockTotalTx = 3;
BlockID LastBlockID = 4; BlockID LastBlockID = 4;
int64 LastBlockTime = 5; int64 LastBlockTime = 5;
ValidatorSet Validators = 6; ValidatorSet Validators = 6;
ValidatorSet LastValidators = 7; ValidatorSet LastValidators = 7;
int64 LastHeightValidatorsChanged = 8; int64 LastHeightValidatorsChanged = 8;
ConsensusParams ConsensusParams = 9; ConsensusParams ConsensusParams = 9;
int64 LastHeightConsensusParamsChanged = 10; int64 LastHeightConsensusParamsChanged = 10;
bytes LastResultsHash = 11; bytes LastResultsHash = 11;
bytes AppHash = 12; bytes AppHash = 12;
} }
message DuplicateVoteEvidence { message DuplicateVoteEvidence {
string pubKey = 1; string pubKey = 1;
Vote voteA = 2; Vote voteA = 2;
Vote voteB = 3; Vote voteB = 3;
} }
message EvidenceEnvelope { message EvidenceEnvelope {
string typeName = 1; string typeName = 1;
bytes data = 2; bytes data = 2;
} }
message EvidenceData { repeated EvidenceEnvelope evidence = 1; } message EvidenceData {
repeated EvidenceEnvelope evidence = 1;
}
message TendermintBlockHeader { message TendermintBlockHeader {
string chainID = 1; string chainID = 1;
int64 height = 2; int64 height = 2;
int64 round = 3; int64 round = 3;
int64 time = 4; int64 time = 4;
int64 numTxs = 5; int64 numTxs = 5;
BlockID lastBlockID = 6; BlockID lastBlockID = 6;
int64 totalTxs = 7; int64 totalTxs = 7;
bytes lastCommitHash = 8; bytes lastCommitHash = 8;
bytes validatorsHash = 9; bytes validatorsHash = 9;
bytes consensusHash = 10; bytes consensusHash = 10;
bytes appHash = 11; bytes appHash = 11;
bytes lastResultsHash = 12; bytes lastResultsHash = 12;
bytes evidenceHash = 13; bytes evidenceHash = 13;
} }
message TendermintBlock { message TendermintBlock {
TendermintBlockHeader header = 1; TendermintBlockHeader header = 1;
repeated Transaction txs = 2; repeated Transaction txs = 2;
EvidenceData evidence = 3; EvidenceData evidence = 3;
TendermintCommit lastCommit = 4; TendermintCommit lastCommit = 4;
bytes proposerAddr = 5; bytes proposerAddr = 5;
} }
message Proposal { message Proposal {
int64 height = 1; int64 height = 1;
int32 round = 2; int32 round = 2;
int64 timestamp = 3; int64 timestamp = 3;
int32 POLRound = 4; int32 POLRound = 4;
BlockID POLBlockID = 5; BlockID POLBlockID = 5;
bytes signature = 6; bytes signature = 6;
bytes blockhash = 7; bytes blockhash = 7;
} }
message NewRoundStepMsg { message NewRoundStepMsg {
int64 height = 1; int64 height = 1;
int32 round = 2; int32 round = 2;
int32 step = 3; int32 step = 3;
int32 secondsSinceStartTime = 4; int32 secondsSinceStartTime = 4;
int32 lastCommitRound = 5; int32 lastCommitRound = 5;
} }
message CommitStepMsg { int64 height = 1; } message CommitStepMsg {
int64 height = 1;
}
message ProposalPOLMsg { message ProposalPOLMsg {
int64 height = 1; int64 height = 1;
int32 proposalPOLRound = 2; int32 proposalPOLRound = 2;
TendermintBitArray proposalPOL = 3; TendermintBitArray proposalPOL = 3;
} }
message HasVoteMsg { message HasVoteMsg {
int64 height = 1; int64 height = 1;
int32 round = 2; int32 round = 2;
int32 type = 3; int32 type = 3;
int32 index = 4; int32 index = 4;
} }
message VoteSetMaj23Msg { message VoteSetMaj23Msg {
int64 height = 1; int64 height = 1;
int32 round = 2; int32 round = 2;
int32 type = 3; int32 type = 3;
BlockID blockID = 4; BlockID blockID = 4;
} }
message VoteSetBitsMsg { message VoteSetBitsMsg {
int64 height = 1; int64 height = 1;
int32 round = 2; int32 round = 2;
int32 type = 3; int32 type = 3;
BlockID blockID = 4; BlockID blockID = 4;
TendermintBitArray votes = 5; TendermintBitArray votes = 5;
} }
message Heartbeat { message Heartbeat {
bytes validatorAddress = 1; bytes validatorAddress = 1;
int32 validatorIndex = 2; int32 validatorIndex = 2;
int64 height = 3; int64 height = 3;
int32 round = 4; int32 round = 4;
int32 sequence = 5; int32 sequence = 5;
bytes signature = 6; bytes signature = 6;
} }
...@@ -4,20 +4,26 @@ package types; ...@@ -4,20 +4,26 @@ package types;
import "tendermint.proto"; import "tendermint.proto";
message ValNode { message ValNode {
bytes pubKey = 1; bytes pubKey = 1;
int64 power = 2; int64 power = 2;
} }
message ValNodes { repeated ValNode nodes = 1; } message ValNodes {
repeated ValNode nodes = 1;
}
message ValNodeAction { message ValNodeAction {
oneof value { oneof value {
ValNode node = 1; ValNode node = 1;
TendermintBlockInfo blockInfo = 2; TendermintBlockInfo blockInfo = 2;
} }
int32 Ty = 3; int32 Ty = 3;
} }
message ReqNodeInfo { int64 height = 1; } message ReqNodeInfo {
int64 height = 1;
}
message ReqBlockInfo { int64 height = 1; } message ReqBlockInfo {
\ No newline at end of file int64 height = 1;
}
\ No newline at end of file
...@@ -3,23 +3,29 @@ syntax = "proto3"; ...@@ -3,23 +3,29 @@ syntax = "proto3";
package mpt; package mpt;
message Node { message Node {
oneof value { oneof value {
FullNode full = 2; FullNode full = 2;
ShortNode short = 3; ShortNode short = 3;
HashNode hash = 4; HashNode hash = 4;
ValueNode val = 5; ValueNode val = 5;
} }
int32 Ty = 1; int32 Ty = 1;
int32 index = 6; int32 index = 6;
} }
message FullNode { repeated Node nodes = 1; } message FullNode {
repeated Node nodes = 1;
}
message ShortNode { message ShortNode {
bytes key = 1; bytes key = 1;
Node val = 2; Node val = 2;
} }
message HashNode { bytes hash = 1; } message HashNode {
bytes hash = 1;
}
message ValueNode { bytes value = 1; } message ValueNode {
bytes value = 1;
}
package mpt package mpt
import ( import (
lru "github.com/hashicorp/golang-lru"
"gitlab.33.cn/chain33/chain33/common" "gitlab.33.cn/chain33/chain33/common"
clog "gitlab.33.cn/chain33/chain33/common/log" clog "gitlab.33.cn/chain33/chain33/common/log"
log "gitlab.33.cn/chain33/chain33/common/log/log15" log "gitlab.33.cn/chain33/chain33/common/log/log15"
......
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