Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
e75a95c1
Commit
e75a95c1
authored
Oct 09, 2019
by
pengjun
Committed by
vipwzw
Oct 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#653 fix fmt
parent
33f0cc2d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
22 deletions
+21
-22
round_state.go
plugin/consensus/tendermint/types/round_state.go
+4
-4
certutils.go
...rt/authority/tools/cryptogen/generator/utils/certutils.go
+6
-6
pokerbull_test.go
plugin/dapp/pokerbull/executor/pokerbull_test.go
+9
-10
jrpc_channel_test.go
plugin/dapp/pokerbull/rpc/jrpc_channel_test.go
+2
-2
No files found.
plugin/consensus/tendermint/types/round_state.go
View file @
e75a95c1
...
@@ -39,7 +39,7 @@ const (
...
@@ -39,7 +39,7 @@ const (
ProposalPOLID
=
byte
(
0x05
)
ProposalPOLID
=
byte
(
0x05
)
VoteID
=
byte
(
0x06
)
VoteID
=
byte
(
0x06
)
HasVoteID
=
byte
(
0x07
)
HasVoteID
=
byte
(
0x07
)
VoteSetMaj23ID
=
byte
(
0
X
08
)
VoteSetMaj23ID
=
byte
(
0
x
08
)
VoteSetBitsID
=
byte
(
0x09
)
VoteSetBitsID
=
byte
(
0x09
)
ProposalHeartbeatID
=
byte
(
0x0a
)
ProposalHeartbeatID
=
byte
(
0x0a
)
ProposalBlockID
=
byte
(
0x0b
)
ProposalBlockID
=
byte
(
0x0b
)
...
@@ -117,9 +117,9 @@ type RoundState struct {
...
@@ -117,9 +117,9 @@ type RoundState struct {
// RoundStateMessage ...
// RoundStateMessage ...
func
(
rs
*
RoundState
)
RoundStateMessage
()
*
tmtypes
.
NewRoundStepMsg
{
func
(
rs
*
RoundState
)
RoundStateMessage
()
*
tmtypes
.
NewRoundStepMsg
{
return
&
tmtypes
.
NewRoundStepMsg
{
return
&
tmtypes
.
NewRoundStepMsg
{
Height
:
rs
.
Height
,
Height
:
rs
.
Height
,
Round
:
int32
(
rs
.
Round
),
Round
:
int32
(
rs
.
Round
),
Step
:
int32
(
rs
.
Step
),
Step
:
int32
(
rs
.
Step
),
SecondsSinceStartTime
:
int32
(
time
.
Since
(
rs
.
StartTime
)
.
Seconds
()),
SecondsSinceStartTime
:
int32
(
time
.
Since
(
rs
.
StartTime
)
.
Seconds
()),
LastCommitRound
:
int32
(
rs
.
LastCommit
.
Round
()),
LastCommitRound
:
int32
(
rs
.
LastCommit
.
Round
()),
}
}
...
...
plugin/dapp/cert/authority/tools/cryptogen/generator/utils/certutils.go
View file @
e75a95c1
...
@@ -73,9 +73,9 @@ func ParseX509CertificateToSm2(x509Cert *x509.Certificate) *sm2.Certificate {
...
@@ -73,9 +73,9 @@ func ParseX509CertificateToSm2(x509Cert *x509.Certificate) *sm2.Certificate {
UnknownExtKeyUsage
:
x509Cert
.
UnknownExtKeyUsage
,
UnknownExtKeyUsage
:
x509Cert
.
UnknownExtKeyUsage
,
BasicConstraintsValid
:
x509Cert
.
BasicConstraintsValid
,
BasicConstraintsValid
:
x509Cert
.
BasicConstraintsValid
,
IsCA
:
x509Cert
.
IsCA
,
IsCA
:
x509Cert
.
IsCA
,
MaxPathLen
:
x509Cert
.
MaxPathLen
,
MaxPathLen
:
x509Cert
.
MaxPathLen
,
MaxPathLenZero
:
x509Cert
.
MaxPathLenZero
,
MaxPathLenZero
:
x509Cert
.
MaxPathLenZero
,
SubjectKeyId
:
x509Cert
.
SubjectKeyId
,
SubjectKeyId
:
x509Cert
.
SubjectKeyId
,
AuthorityKeyId
:
x509Cert
.
AuthorityKeyId
,
AuthorityKeyId
:
x509Cert
.
AuthorityKeyId
,
...
@@ -136,9 +136,9 @@ func ParseSm2CertificateToX509(sm2Cert *sm2.Certificate) *x509.Certificate {
...
@@ -136,9 +136,9 @@ func ParseSm2CertificateToX509(sm2Cert *sm2.Certificate) *x509.Certificate {
UnknownExtKeyUsage
:
sm2Cert
.
UnknownExtKeyUsage
,
UnknownExtKeyUsage
:
sm2Cert
.
UnknownExtKeyUsage
,
BasicConstraintsValid
:
sm2Cert
.
BasicConstraintsValid
,
BasicConstraintsValid
:
sm2Cert
.
BasicConstraintsValid
,
IsCA
:
sm2Cert
.
IsCA
,
IsCA
:
sm2Cert
.
IsCA
,
MaxPathLen
:
sm2Cert
.
MaxPathLen
,
MaxPathLen
:
sm2Cert
.
MaxPathLen
,
MaxPathLenZero
:
sm2Cert
.
MaxPathLenZero
,
MaxPathLenZero
:
sm2Cert
.
MaxPathLenZero
,
SubjectKeyId
:
sm2Cert
.
SubjectKeyId
,
SubjectKeyId
:
sm2Cert
.
SubjectKeyId
,
AuthorityKeyId
:
sm2Cert
.
AuthorityKeyId
,
AuthorityKeyId
:
sm2Cert
.
AuthorityKeyId
,
...
...
plugin/dapp/pokerbull/executor/pokerbull_test.go
View file @
e75a95c1
...
@@ -24,14 +24,14 @@ var (
...
@@ -24,14 +24,14 @@ var (
PrivKeyA
=
"0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
// 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
PrivKeyA
=
"0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
// 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
PrivKeyB
=
"0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4"
// 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR
PrivKeyB
=
"0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4"
// 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR
Nodes
=
[][]
byte
{
Nodes
=
[][]
byte
{
[]
byte
(
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
),
[]
byte
(
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
),
[]
byte
(
"1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR"
),
[]
byte
(
"1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR"
),
}
}
)
)
func
TestPokerbull
(
t
*
testing
.
T
)
{
func
TestPokerbull
(
t
*
testing
.
T
)
{
types
.
SetTitleOnlyForTest
(
"chain33"
)
types
.
SetTitleOnlyForTest
(
"chain33"
)
total
:=
int64
(
1000
*
types
.
Coin
)
total
:=
int64
(
1000
*
types
.
Coin
)
accountA
:=
types
.
Account
{
accountA
:=
types
.
Account
{
Balance
:
total
,
Balance
:
total
,
Frozen
:
0
,
Frozen
:
0
,
...
@@ -63,8 +63,8 @@ func TestPokerbull(t *testing.T) {
...
@@ -63,8 +63,8 @@ func TestPokerbull(t *testing.T) {
// start game
// start game
p1
:=
&
pkt
.
PBGameStart
{
p1
:=
&
pkt
.
PBGameStart
{
Value
:
5
*
types
.
Coin
,
Value
:
5
*
types
.
Coin
,
PlayerNum
:
2
,
PlayerNum
:
2
,
}
}
createTx
,
err
:=
types
.
CallCreateTransaction
(
pkt
.
PokerBullX
,
"Start"
,
p1
)
createTx
,
err
:=
types
.
CallCreateTransaction
(
pkt
.
PokerBullX
,
"Start"
,
p1
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -126,7 +126,7 @@ func TestPokerbull(t *testing.T) {
...
@@ -126,7 +126,7 @@ func TestPokerbull(t *testing.T) {
// continue game
// continue game
p2
:=
&
pkt
.
PBGameContinue
{
p2
:=
&
pkt
.
PBGameContinue
{
GameId
:
common
.
ToHex
(
gameID
),
GameId
:
common
.
ToHex
(
gameID
),
}
}
createTx
,
err
=
types
.
CallCreateTransaction
(
pkt
.
PokerBullX
,
"Continue"
,
p2
)
createTx
,
err
=
types
.
CallCreateTransaction
(
pkt
.
PokerBullX
,
"Continue"
,
p2
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -185,11 +185,11 @@ func TestPokerbull(t *testing.T) {
...
@@ -185,11 +185,11 @@ func TestPokerbull(t *testing.T) {
}
}
// query
// query
res
,
err
:=
exec
.
Query
(
pkt
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pkt
.
QueryPBGameInfo
{
GameId
:
common
.
ToHex
(
gameID
)}))
res
,
err
:=
exec
.
Query
(
pkt
.
FuncNameQueryGameByID
,
types
.
Encode
(
&
pkt
.
QueryPBGameInfo
{
GameId
:
common
.
ToHex
(
gameID
)}))
assert
.
Nil
(
t
,
err
)
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
assert
.
NotNil
(
t
,
res
)
res
,
err
=
exec
.
Query
(
pkt
.
FuncNameQueryGameByAddr
,
types
.
Encode
(
&
pkt
.
QueryPBGameInfo
{
Addr
:
string
(
Nodes
[
0
])}))
res
,
err
=
exec
.
Query
(
pkt
.
FuncNameQueryGameByAddr
,
types
.
Encode
(
&
pkt
.
QueryPBGameInfo
{
Addr
:
string
(
Nodes
[
0
])}))
assert
.
Nil
(
t
,
err
)
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
res
)
assert
.
NotNil
(
t
,
res
)
...
@@ -227,4 +227,4 @@ func signTx(tx *types.Transaction, hexPrivKey string) (*types.Transaction, error
...
@@ -227,4 +227,4 @@ func signTx(tx *types.Transaction, hexPrivKey string) (*types.Transaction, error
tx
.
Sign
(
int32
(
signType
),
privKey
)
tx
.
Sign
(
int32
(
signType
),
privKey
)
return
tx
,
nil
return
tx
,
nil
}
}
\ No newline at end of file
plugin/dapp/pokerbull/rpc/jrpc_channel_test.go
View file @
e75a95c1
...
@@ -43,7 +43,7 @@ func TestJRPCChannel(t *testing.T) {
...
@@ -43,7 +43,7 @@ func TestJRPCChannel(t *testing.T) {
{
fn
:
testQuitRawTxCmd
},
{
fn
:
testQuitRawTxCmd
},
{
fn
:
testPlayRawTxCmd
},
{
fn
:
testPlayRawTxCmd
},
}
}
for
_
,
testCase
:=
range
testCases
{
for
_
,
testCase
:=
range
testCases
{
err
:=
testCase
.
fn
(
t
,
jrpcClient
)
err
:=
testCase
.
fn
(
t
,
jrpcClient
)
assert
.
Nil
(
t
,
err
)
assert
.
Nil
(
t
,
err
)
...
@@ -96,7 +96,7 @@ func testContinueRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
...
@@ -96,7 +96,7 @@ func testContinueRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
}
}
func
testPlayRawTxCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
func
testPlayRawTxCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
payload
:=
&
pty
.
PBGamePlay
{
GameId
:
"123"
,
Round
:
1
,
Value
:
5
,
Address
:
[]
string
{
"a"
,
"b"
}}
payload
:=
&
pty
.
PBGamePlay
{
GameId
:
"123"
,
Round
:
1
,
Value
:
5
,
Address
:
[]
string
{
"a"
,
"b"
}}
params
:=
&
rpctypes
.
CreateTxIn
{
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pty
.
PokerBullX
),
Execer
:
types
.
ExecName
(
pty
.
PokerBullX
),
ActionName
:
pty
.
CreatePlayTx
,
ActionName
:
pty
.
CreatePlayTx
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment