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
156d4750
Commit
156d4750
authored
Jan 06, 2021
by
heyubin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add by hyb for chainid
parent
14c457cf
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
60 additions
and
28 deletions
+60
-28
dpos_test.go
plugin/consensus/dpos/dpos_test.go
+5
-4
pbft_test.go
plugin/consensus/pbft/pbft_test.go
+4
-2
raftPerf.go
plugin/consensus/raft/tools/raftPerf.go
+1
-0
state.go
plugin/consensus/tendermint/state.go
+1
-0
tendermint_test.go
plugin/consensus/tendermint/tendermint_test.go
+8
-5
vote_test.go
plugin/dapp/dposvote/commands/vote_test.go
+6
-4
echo.go
plugin/dapp/echo/types/echo/echo.go
+1
-0
evm.go
plugin/dapp/evm/commands/evm.go
+2
-2
rpc.go
plugin/dapp/evm/rpc/rpc.go
+3
-3
game_test.go
plugin/dapp/guess/commands/game_test.go
+5
-4
guess_test.go
plugin/dapp/guess/rpc/guess_test.go
+5
-4
hashlock_unit_test.go
plugin/dapp/hashlock/executor/hashlock_unit_test.go
+1
-0
paracross.go
plugin/dapp/paracross/types/paracross.go
+1
-0
privacy.go
plugin/dapp/privacy/wallet/privacy.go
+3
-0
privacy_test.go
plugin/dapp/privacy/wallet/privacy_test.go
+1
-0
relayd.go
plugin/dapp/relay/cmd/relayd/relayd/relayd.go
+1
-0
relay_test.go
plugin/dapp/relay/executor/relay_test.go
+3
-0
token_new_test.go
plugin/dapp/token/executor/token_new_test.go
+5
-0
types.go
plugin/dapp/unfreeze/types/types.go
+3
-0
exec_test.go
plugin/dapp/x2ethereum/executor/exec_test.go
+1
-0
No files found.
plugin/consensus/dpos/dpos_test.go
View file @
156d4750
...
@@ -124,7 +124,7 @@ func DposPerf() {
...
@@ -124,7 +124,7 @@ func DposPerf() {
fmt
.
Println
(
"=======start NormPut!======="
)
fmt
.
Println
(
"=======start NormPut!======="
)
for
i
:=
0
;
i
<
loopCount
;
i
++
{
for
i
:=
0
;
i
<
loopCount
;
i
++
{
NormPut
()
NormPut
(
cfg
)
time
.
Sleep
(
time
.
Second
)
time
.
Sleep
(
time
.
Second
)
}
}
...
@@ -462,7 +462,7 @@ func getprivkey(key string) crypto.PrivKey {
...
@@ -462,7 +462,7 @@ func getprivkey(key string) crypto.PrivKey {
return
priv
return
priv
}
}
func
prepareTxList
()
*
types
.
Transaction
{
func
prepareTxList
(
cfg
*
types
.
Chain33Config
)
*
types
.
Transaction
{
var
key
string
var
key
string
var
value
string
var
value
string
var
i
int
var
i
int
...
@@ -475,6 +475,7 @@ func prepareTxList() *types.Transaction {
...
@@ -475,6 +475,7 @@ func prepareTxList() *types.Transaction {
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
Nonce
=
random
.
Int63
()
tx
.
Nonce
=
random
.
Int63
()
tx
.
ChainID
=
cfg
.
GetChainID
()
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
return
tx
return
tx
}
}
...
@@ -489,8 +490,8 @@ func clearTestData() {
...
@@ -489,8 +490,8 @@ func clearTestData() {
fmt
.
Println
(
"test data clear successfully!"
)
fmt
.
Println
(
"test data clear successfully!"
)
}
}
func
NormPut
()
{
func
NormPut
(
cfg
*
types
.
Chain33Config
)
{
tx
:=
prepareTxList
()
tx
:=
prepareTxList
(
cfg
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
plugin/consensus/pbft/pbft_test.go
View file @
156d4750
...
@@ -97,7 +97,7 @@ func sendReplyList(q queue.Queue) {
...
@@ -97,7 +97,7 @@ func sendReplyList(q queue.Queue) {
for
msg
:=
range
client
.
Recv
()
{
for
msg
:=
range
client
.
Recv
()
{
if
msg
.
Ty
==
types
.
EventTxList
{
if
msg
.
Ty
==
types
.
EventTxList
{
count
++
count
++
createReplyList
(
"test"
+
strconv
.
Itoa
(
count
))
createReplyList
(
client
.
GetConfig
(),
"test"
+
strconv
.
Itoa
(
count
))
msg
.
Reply
(
client
.
NewMessage
(
"consensus"
,
types
.
EventReplyTxList
,
msg
.
Reply
(
client
.
NewMessage
(
"consensus"
,
types
.
EventReplyTxList
,
&
types
.
ReplyTxList
{
Txs
:
transactions
}))
&
types
.
ReplyTxList
{
Txs
:
transactions
}))
if
count
==
5
{
if
count
==
5
{
...
@@ -124,7 +124,8 @@ func getprivkey(key string) crypto.PrivKey {
...
@@ -124,7 +124,8 @@ func getprivkey(key string) crypto.PrivKey {
return
priv
return
priv
}
}
func
createReplyList
(
account
string
)
{
func
createReplyList
(
cfg
*
types
.
Chain33Config
,
account
string
)
{
var
result
[]
*
types
.
Transaction
var
result
[]
*
types
.
Transaction
for
j
:=
0
;
j
<
txSize
;
j
++
{
for
j
:=
0
;
j
<
txSize
;
j
++
{
//tx := &types.Transaction{}
//tx := &types.Transaction{}
...
@@ -134,6 +135,7 @@ func createReplyList(account string) {
...
@@ -134,6 +135,7 @@ func createReplyList(account string) {
tx
.
To
=
"14qViLJfdGaP4EeHnDyJbEGQysnCpwn1gZ"
tx
.
To
=
"14qViLJfdGaP4EeHnDyJbEGQysnCpwn1gZ"
tx
.
Nonce
=
random
.
Int63
()
tx
.
Nonce
=
random
.
Int63
()
tx
.
ChainID
=
cfg
.
GetChainID
()
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
result
=
append
(
result
,
tx
)
result
=
append
(
result
,
tx
)
...
...
plugin/consensus/raft/tools/raftPerf.go
View file @
156d4750
...
@@ -334,6 +334,7 @@ func NormPut(privkey string, key string, value string) {
...
@@ -334,6 +334,7 @@ func NormPut(privkey string, key string, value string) {
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
Nonce
=
r
.
Int63
()
tx
.
Nonce
=
r
.
Int63
()
tx
.
ChainID
=
c
.
Version
()
.
ChainID
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
privkey
))
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
privkey
))
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
...
...
plugin/consensus/tendermint/state.go
View file @
156d4750
...
@@ -440,6 +440,7 @@ func LoadProposer(source *tmtypes.Validator) (*ttypes.Validator, error) {
...
@@ -440,6 +440,7 @@ func LoadProposer(source *tmtypes.Validator) (*ttypes.Validator, error) {
// CreateBlockInfoTx make blockInfo to the first transaction of the block and execer is valnode
// CreateBlockInfoTx make blockInfo to the first transaction of the block and execer is valnode
func
CreateBlockInfoTx
(
pubkey
string
,
state
*
tmtypes
.
State
,
block
*
tmtypes
.
TendermintBlock
)
*
types
.
Transaction
{
func
CreateBlockInfoTx
(
pubkey
string
,
state
*
tmtypes
.
State
,
block
*
tmtypes
.
TendermintBlock
)
*
types
.
Transaction
{
blockSave
:=
*
block
blockSave
:=
*
block
blockSave
.
Data
=
nil
blockSave
.
Data
=
nil
blockInfo
:=
&
tmtypes
.
TendermintBlockInfo
{
blockInfo
:=
&
tmtypes
.
TendermintBlockInfo
{
...
...
plugin/consensus/tendermint/tendermint_test.go
View file @
156d4750
...
@@ -74,13 +74,13 @@ func TendermintPerf(t *testing.T) {
...
@@ -74,13 +74,13 @@ func TendermintPerf(t *testing.T) {
time
.
Sleep
(
2
*
time
.
Second
)
time
.
Sleep
(
2
*
time
.
Second
)
ConfigManager
()
ConfigManager
()
for
i
:=
0
;
i
<
loopCount
;
i
++
{
for
i
:=
0
;
i
<
loopCount
;
i
++
{
NormPut
()
NormPut
(
q
.
GetConfig
()
.
GetChainID
()
)
time
.
Sleep
(
time
.
Second
)
time
.
Sleep
(
time
.
Second
)
}
}
CheckState
(
t
,
cs
.
(
*
Client
))
CheckState
(
t
,
cs
.
(
*
Client
))
AddNode
()
AddNode
()
for
i
:=
0
;
i
<
loopCount
*
3
;
i
++
{
for
i
:=
0
;
i
<
loopCount
*
3
;
i
++
{
NormPut
()
NormPut
(
q
.
GetConfig
()
.
GetChainID
()
)
time
.
Sleep
(
time
.
Second
)
time
.
Sleep
(
time
.
Second
)
}
}
time
.
Sleep
(
2
*
time
.
Second
)
time
.
Sleep
(
2
*
time
.
Second
)
...
@@ -148,7 +148,7 @@ func generateValue(i, valI int) string {
...
@@ -148,7 +148,7 @@ func generateValue(i, valI int) string {
return
string
(
value
)
return
string
(
value
)
}
}
func
prepareTxList
()
*
types
.
Transaction
{
func
prepareTxList
(
chainid
int32
)
*
types
.
Transaction
{
var
key
string
var
key
string
var
value
string
var
value
string
var
i
int
var
i
int
...
@@ -161,6 +161,7 @@ func prepareTxList() *types.Transaction {
...
@@ -161,6 +161,7 @@ func prepareTxList() *types.Transaction {
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
Nonce
=
r
.
Int63
()
tx
.
Nonce
=
r
.
Int63
()
tx
.
ChainID
=
chainid
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
return
tx
return
tx
}
}
...
@@ -173,8 +174,8 @@ func clearTestData() {
...
@@ -173,8 +174,8 @@ func clearTestData() {
fmt
.
Println
(
"test data clear successfully!"
)
fmt
.
Println
(
"test data clear successfully!"
)
}
}
func
NormPut
()
{
func
NormPut
(
chainid
int32
)
{
tx
:=
prepareTxList
()
tx
:=
prepareTxList
(
chainid
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -199,6 +200,7 @@ func AddNode() {
...
@@ -199,6 +200,7 @@ func AddNode() {
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"valnode"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"valnode"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
.
To
=
address
.
ExecAddress
(
"valnode"
)
tx
.
To
=
address
.
ExecAddress
(
"valnode"
)
tx
.
Nonce
=
r
.
Int63
()
tx
.
Nonce
=
r
.
Int63
()
tx
.
ChainID
=
c
.
Version
()
.
ChainID
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
...
@@ -221,6 +223,7 @@ func ConfigManager() {
...
@@ -221,6 +223,7 @@ func ConfigManager() {
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"manage"
),
Payload
:
types
.
Encode
(
modify
),
Fee
:
fee
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"manage"
),
Payload
:
types
.
Encode
(
modify
),
Fee
:
fee
}
tx
.
To
=
address
.
ExecAddress
(
"manage"
)
tx
.
To
=
address
.
ExecAddress
(
"manage"
)
tx
.
Nonce
=
r
.
Int63
()
tx
.
Nonce
=
r
.
Int63
()
tx
.
ChainID
=
c
.
Version
()
.
ChainID
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
...
...
plugin/dapp/dposvote/commands/vote_test.go
View file @
156d4750
...
@@ -238,7 +238,7 @@ func DposPerf() {
...
@@ -238,7 +238,7 @@ func DposPerf() {
}
}
time
.
Sleep
(
2
*
time
.
Second
)
time
.
Sleep
(
2
*
time
.
Second
)
for
i
:=
0
;
i
<
loopCount
;
i
++
{
for
i
:=
0
;
i
<
loopCount
;
i
++
{
NormPut
()
NormPut
(
q
.
GetConfig
()
)
time
.
Sleep
(
time
.
Second
)
time
.
Sleep
(
time
.
Second
)
}
}
time
.
Sleep
(
2
*
time
.
Second
)
time
.
Sleep
(
2
*
time
.
Second
)
...
@@ -336,8 +336,8 @@ func getprivkey(key string) crypto.PrivKey {
...
@@ -336,8 +336,8 @@ func getprivkey(key string) crypto.PrivKey {
return
priv
return
priv
}
}
func
NormPut
()
{
func
NormPut
(
cfg
*
types
.
Chain33Config
)
{
tx
:=
prepareTxList
()
tx
:=
prepareTxList
(
cfg
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -350,7 +350,8 @@ func NormPut() {
...
@@ -350,7 +350,8 @@ func NormPut() {
}
}
}
}
func
prepareTxList
()
*
types
.
Transaction
{
func
prepareTxList
(
cfg
*
types
.
Chain33Config
)
*
types
.
Transaction
{
var
key
string
var
key
string
var
value
string
var
value
string
var
i
int
var
i
int
...
@@ -363,6 +364,7 @@ func prepareTxList() *types.Transaction {
...
@@ -363,6 +364,7 @@ func prepareTxList() *types.Transaction {
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
Nonce
=
random
.
Int63
()
tx
.
Nonce
=
random
.
Int63
()
tx
.
ChainID
=
cfg
.
GetChainID
()
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
genesisKey
))
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
genesisKey
))
return
tx
return
tx
}
}
...
...
plugin/dapp/echo/types/echo/echo.go
View file @
156d4750
...
@@ -43,6 +43,7 @@ func createPingTx(cfg *types.Chain33Config, op string, parm *Tx) (*types.Transac
...
@@ -43,6 +43,7 @@ func createPingTx(cfg *types.Chain33Config, op string, parm *Tx) (*types.Transac
Payload
:
types
.
Encode
(
action
),
Payload
:
types
.
Encode
(
action
),
Nonce
:
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
.
Int63
(),
Nonce
:
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
.
Int63
(),
To
:
address
.
ExecAddress
(
cfg
.
ExecName
(
EchoX
)),
To
:
address
.
ExecAddress
(
cfg
.
ExecName
(
EchoX
)),
ChainID
:
cfg
.
GetChainID
(),
}
}
return
tx
,
nil
return
tx
,
nil
}
}
...
...
plugin/dapp/evm/commands/evm.go
View file @
156d4750
...
@@ -296,7 +296,7 @@ func createEvmTx(cfg *types.Chain33Config, action proto.Message, execer, caller,
...
@@ -296,7 +296,7 @@ func createEvmTx(cfg *types.Chain33Config, action proto.Message, execer, caller,
random
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
random
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
tx
.
Nonce
=
random
.
Int63
()
tx
.
Nonce
=
random
.
Int63
()
tx
.
ChainID
=
cfg
.
GetChainID
()
txHex
:=
types
.
Encode
(
tx
)
txHex
:=
types
.
Encode
(
tx
)
rawTx
:=
hex
.
EncodeToString
(
txHex
)
rawTx
:=
hex
.
EncodeToString
(
txHex
)
...
@@ -348,7 +348,7 @@ func createEvmTransferTx(cfg *types.Chain33Config, cmd *cobra.Command, caller, e
...
@@ -348,7 +348,7 @@ func createEvmTransferTx(cfg *types.Chain33Config, cmd *cobra.Command, caller, e
random
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
random
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
tx
.
Nonce
=
random
.
Int63
()
tx
.
Nonce
=
random
.
Int63
()
tx
.
ChainID
=
cfg
.
GetChainID
()
txHex
:=
types
.
Encode
(
tx
)
txHex
:=
types
.
Encode
(
tx
)
rawTx
:=
hex
.
EncodeToString
(
txHex
)
rawTx
:=
hex
.
EncodeToString
(
txHex
)
...
...
plugin/dapp/evm/rpc/rpc.go
View file @
156d4750
...
@@ -40,7 +40,7 @@ func (c *channelClient) Create(ctx context.Context, in evmtypes.EvmContractCreat
...
@@ -40,7 +40,7 @@ func (c *channelClient) Create(ctx context.Context, in evmtypes.EvmContractCreat
random
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
random
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
tx
.
Nonce
=
random
.
Int63
()
tx
.
Nonce
=
random
.
Int63
()
tx
.
ChainID
=
cfg
.
GetChainID
()
txHex
:=
types
.
Encode
(
tx
)
txHex
:=
types
.
Encode
(
tx
)
return
&
types
.
UnsignTx
{
Data
:
txHex
},
nil
return
&
types
.
UnsignTx
{
Data
:
txHex
},
nil
...
@@ -69,7 +69,7 @@ func (c *channelClient) Call(ctx context.Context, in evmtypes.EvmContractCallReq
...
@@ -69,7 +69,7 @@ func (c *channelClient) Call(ctx context.Context, in evmtypes.EvmContractCallReq
random
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
random
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
tx
.
Nonce
=
random
.
Int63
()
tx
.
Nonce
=
random
.
Int63
()
tx
.
ChainID
=
cfg
.
GetChainID
()
txHex
:=
types
.
Encode
(
tx
)
txHex
:=
types
.
Encode
(
tx
)
return
&
types
.
UnsignTx
{
Data
:
txHex
},
nil
return
&
types
.
UnsignTx
{
Data
:
txHex
},
nil
...
@@ -103,7 +103,7 @@ func (c *channelClient) Transfer(ctx context.Context, in evmtypes.EvmContractTra
...
@@ -103,7 +103,7 @@ func (c *channelClient) Transfer(ctx context.Context, in evmtypes.EvmContractTra
random
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
random
:=
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
tx
.
Nonce
=
random
.
Int63
()
tx
.
Nonce
=
random
.
Int63
()
tx
.
ChainID
=
cfg
.
GetChainID
()
txHex
:=
types
.
Encode
(
tx
)
txHex
:=
types
.
Encode
(
tx
)
return
&
types
.
UnsignTx
{
Data
:
txHex
},
nil
return
&
types
.
UnsignTx
{
Data
:
txHex
},
nil
...
...
plugin/dapp/guess/commands/game_test.go
View file @
156d4750
...
@@ -361,7 +361,7 @@ func testGuessImp(t *testing.T) {
...
@@ -361,7 +361,7 @@ func testGuessImp(t *testing.T) {
fmt
.
Println
(
"=======start NormPut!======="
)
fmt
.
Println
(
"=======start NormPut!======="
)
for
i
:=
0
;
i
<
loopCount
;
i
++
{
for
i
:=
0
;
i
<
loopCount
;
i
++
{
NormPut
()
NormPut
(
cfg
)
time
.
Sleep
(
time
.
Second
)
time
.
Sleep
(
time
.
Second
)
}
}
...
@@ -503,7 +503,7 @@ func getprivkey(key string) crypto.PrivKey {
...
@@ -503,7 +503,7 @@ func getprivkey(key string) crypto.PrivKey {
return
priv
return
priv
}
}
func
prepareTxList
()
*
types
.
Transaction
{
func
prepareTxList
(
cfg
*
types
.
Chain33Config
)
*
types
.
Transaction
{
var
key
string
var
key
string
var
value
string
var
value
string
var
i
int
var
i
int
...
@@ -516,12 +516,13 @@ func prepareTxList() *types.Transaction {
...
@@ -516,12 +516,13 @@ func prepareTxList() *types.Transaction {
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
Nonce
=
random
.
Int63
()
tx
.
Nonce
=
random
.
Int63
()
tx
.
ChainID
=
cfg
.
GetChainID
()
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
return
tx
return
tx
}
}
func
NormPut
()
{
func
NormPut
(
cfg
*
types
.
Chain33Config
)
{
tx
:=
prepareTxList
()
tx
:=
prepareTxList
(
cfg
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
plugin/dapp/guess/rpc/guess_test.go
View file @
156d4750
...
@@ -363,7 +363,7 @@ func testGuessImp(t *testing.T) {
...
@@ -363,7 +363,7 @@ func testGuessImp(t *testing.T) {
fmt
.
Println
(
"=======start NormPut!======="
)
fmt
.
Println
(
"=======start NormPut!======="
)
for
i
:=
0
;
i
<
loopCount
;
i
++
{
for
i
:=
0
;
i
<
loopCount
;
i
++
{
NormPut
()
NormPut
(
cfg
)
time
.
Sleep
(
time
.
Second
)
time
.
Sleep
(
time
.
Second
)
}
}
...
@@ -721,7 +721,7 @@ func getprivkey(key string) crypto.PrivKey {
...
@@ -721,7 +721,7 @@ func getprivkey(key string) crypto.PrivKey {
return
priv
return
priv
}
}
func
prepareTxList
()
*
types
.
Transaction
{
func
prepareTxList
(
cfg
*
types
.
Chain33Config
)
*
types
.
Transaction
{
var
key
string
var
key
string
var
value
string
var
value
string
var
i
int
var
i
int
...
@@ -734,12 +734,13 @@ func prepareTxList() *types.Transaction {
...
@@ -734,12 +734,13 @@ func prepareTxList() *types.Transaction {
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"norm"
),
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
}
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
To
=
address
.
ExecAddress
(
"norm"
)
tx
.
Nonce
=
random
.
Int63
()
tx
.
Nonce
=
random
.
Int63
()
tx
.
ChainID
=
cfg
.
GetChainID
()
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
tx
.
Sign
(
types
.
SECP256K1
,
getprivkey
(
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
))
return
tx
return
tx
}
}
func
NormPut
()
{
func
NormPut
(
cfg
*
types
.
Chain33Config
)
{
tx
:=
prepareTxList
()
tx
:=
prepareTxList
(
cfg
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
reply
,
err
:=
c
.
SendTransaction
(
context
.
Background
(),
tx
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
plugin/dapp/hashlock/executor/hashlock_unit_test.go
View file @
156d4750
...
@@ -126,6 +126,7 @@ func constructHashlockInstance() drivers.Driver {
...
@@ -126,6 +126,7 @@ func constructHashlockInstance() drivers.Driver {
}
}
func
ConstructLockTx
()
*
types
.
Transaction
{
func
ConstructLockTx
()
*
types
.
Transaction
{
var
lockAmount
int64
=
90
var
lockAmount
int64
=
90
var
locktime
int64
=
70
var
locktime
int64
=
70
...
...
plugin/dapp/paracross/types/paracross.go
View file @
156d4750
...
@@ -260,6 +260,7 @@ func CreateRawMinerTx(cfg *types.Chain33Config, value *ParacrossMinerAction) (*t
...
@@ -260,6 +260,7 @@ func CreateRawMinerTx(cfg *types.Chain33Config, value *ParacrossMinerAction) (*t
Payload
:
types
.
Encode
(
action
),
Payload
:
types
.
Encode
(
action
),
Nonce
:
0
,
//for consensus purpose, block hash need same, different auth node need keep totally same vote tx
Nonce
:
0
,
//for consensus purpose, block hash need same, different auth node need keep totally same vote tx
To
:
address
.
ExecAddress
(
cfg
.
ExecName
(
ParaX
)),
To
:
address
.
ExecAddress
(
cfg
.
ExecName
(
ParaX
)),
ChainID
:
cfg
.
GetChainID
(),
}
}
err
:=
tx
.
SetRealFee
(
cfg
.
GetMinTxFeeRate
())
err
:=
tx
.
SetRealFee
(
cfg
.
GetMinTxFeeRate
())
if
err
!=
nil
{
if
err
!=
nil
{
...
...
plugin/dapp/privacy/wallet/privacy.go
View file @
156d4750
...
@@ -537,6 +537,7 @@ func (policy *privacyPolicy) createPublic2PrivacyTx(req *privacytypes.ReqCreateP
...
@@ -537,6 +537,7 @@ func (policy *privacyPolicy) createPublic2PrivacyTx(req *privacytypes.ReqCreateP
Payload
:
types
.
Encode
(
action
),
Payload
:
types
.
Encode
(
action
),
Nonce
:
policy
.
getWalletOperate
()
.
Nonce
(),
Nonce
:
policy
.
getWalletOperate
()
.
Nonce
(),
To
:
address
.
ExecAddress
(
cfg
.
ExecName
(
privacytypes
.
PrivacyX
)),
To
:
address
.
ExecAddress
(
cfg
.
ExecName
(
privacytypes
.
PrivacyX
)),
ChainID
:
cfg
.
GetChainID
(),
}
}
tx
.
SetExpire
(
cfg
,
time
.
Duration
(
req
.
Expire
))
tx
.
SetExpire
(
cfg
,
time
.
Duration
(
req
.
Expire
))
tx
.
Signature
=
&
types
.
Signature
{
tx
.
Signature
=
&
types
.
Signature
{
...
@@ -621,6 +622,7 @@ func (policy *privacyPolicy) createPrivacy2PrivacyTx(req *privacytypes.ReqCreate
...
@@ -621,6 +622,7 @@ func (policy *privacyPolicy) createPrivacy2PrivacyTx(req *privacytypes.ReqCreate
Fee
:
privacytypes
.
PrivacyTxFee
,
Fee
:
privacytypes
.
PrivacyTxFee
,
Nonce
:
policy
.
getWalletOperate
()
.
Nonce
(),
Nonce
:
policy
.
getWalletOperate
()
.
Nonce
(),
To
:
address
.
ExecAddress
(
cfg
.
ExecName
(
privacytypes
.
PrivacyX
)),
To
:
address
.
ExecAddress
(
cfg
.
ExecName
(
privacytypes
.
PrivacyX
)),
ChainID
:
cfg
.
GetChainID
(),
}
}
tx
.
SetExpire
(
cfg
,
time
.
Duration
(
req
.
Expire
))
tx
.
SetExpire
(
cfg
,
time
.
Duration
(
req
.
Expire
))
if
!
isMainetCoins
{
if
!
isMainetCoins
{
...
@@ -711,6 +713,7 @@ func (policy *privacyPolicy) createPrivacy2PublicTx(req *privacytypes.ReqCreateP
...
@@ -711,6 +713,7 @@ func (policy *privacyPolicy) createPrivacy2PublicTx(req *privacytypes.ReqCreateP
Fee
:
privacytypes
.
PrivacyTxFee
,
Fee
:
privacytypes
.
PrivacyTxFee
,
Nonce
:
policy
.
getWalletOperate
()
.
Nonce
(),
Nonce
:
policy
.
getWalletOperate
()
.
Nonce
(),
To
:
address
.
ExecAddress
(
cfg
.
ExecName
(
privacytypes
.
PrivacyX
)),
To
:
address
.
ExecAddress
(
cfg
.
ExecName
(
privacytypes
.
PrivacyX
)),
ChainID
:
cfg
.
GetChainID
(),
}
}
tx
.
SetExpire
(
cfg
,
time
.
Duration
(
req
.
Expire
))
tx
.
SetExpire
(
cfg
,
time
.
Duration
(
req
.
Expire
))
if
!
isMainetCoins
{
if
!
isMainetCoins
{
...
...
plugin/dapp/privacy/wallet/privacy_test.go
View file @
156d4750
...
@@ -217,6 +217,7 @@ func (mock *PrivacyMock) createPublic2PrivacyTx(req *ty.ReqCreatePrivacyTx) *typ
...
@@ -217,6 +217,7 @@ func (mock *PrivacyMock) createPublic2PrivacyTx(req *ty.ReqCreatePrivacyTx) *typ
Payload
:
types
.
Encode
(
action
),
Payload
:
types
.
Encode
(
action
),
Nonce
:
mock
.
walletOp
.
Nonce
(),
Nonce
:
mock
.
walletOp
.
Nonce
(),
To
:
address
.
ExecAddress
(
ty
.
PrivacyX
),
To
:
address
.
ExecAddress
(
ty
.
PrivacyX
),
ChainID
:
cfg
.
GetChainID
(),
}
}
cfg
:=
mock
.
walletOp
.
GetAPI
()
.
GetConfig
()
cfg
:=
mock
.
walletOp
.
GetAPI
()
.
GetConfig
()
txSize
:=
types
.
Size
(
tx
)
+
ty
.
SignatureSize
txSize
:=
types
.
Size
(
tx
)
+
ty
.
SignatureSize
...
...
plugin/dapp/relay/cmd/relayd/relayd/relayd.go
View file @
156d4750
...
@@ -323,6 +323,7 @@ func (r *Relayd) transaction(payload []byte) *types.Transaction {
...
@@ -323,6 +323,7 @@ func (r *Relayd) transaction(payload []byte) *types.Transaction {
Payload
:
payload
,
Payload
:
payload
,
Nonce
:
rand
.
Int63
(),
Nonce
:
rand
.
Int63
(),
To
:
address
.
ExecAddress
(
ty
.
RelayX
),
To
:
address
.
ExecAddress
(
ty
.
RelayX
),
ChainID
:
r
.
config
.
Chain33Cfg
..
GetChainID
(),
}
}
minFee
:=
types
.
DefaultMinFee
minFee
:=
types
.
DefaultMinFee
...
...
plugin/dapp/relay/executor/relay_test.go
View file @
156d4750
...
@@ -139,6 +139,7 @@ func (s *suiteRelay) TestExec_1() {
...
@@ -139,6 +139,7 @@ func (s *suiteRelay) TestExec_1() {
tx
.
Execer
=
[]
byte
(
ty
.
RelayX
)
tx
.
Execer
=
[]
byte
(
ty
.
RelayX
)
tx
.
To
=
address
.
ExecAddress
(
ty
.
RelayX
)
tx
.
To
=
address
.
ExecAddress
(
ty
.
RelayX
)
tx
.
Nonce
=
1
//for different order id
tx
.
Nonce
=
1
//for different order id
tx
.
ChainID
=
chainTestCfg
.
GetChainID
()
tx
.
Payload
=
types
.
Encode
(
sell
)
tx
.
Payload
=
types
.
Encode
(
sell
)
tx
.
Sign
(
types
.
SECP256K1
,
privFrom
)
tx
.
Sign
(
types
.
SECP256K1
,
privFrom
)
...
@@ -489,6 +490,8 @@ func (s *suiteBtcHeader) TestSaveBtcHead_1() {
...
@@ -489,6 +490,8 @@ func (s *suiteBtcHeader) TestSaveBtcHead_1() {
tx
.
Execer
=
[]
byte
(
ty
.
RelayX
)
tx
.
Execer
=
[]
byte
(
ty
.
RelayX
)
tx
.
To
=
address
.
ExecAddress
(
ty
.
RelayX
)
tx
.
To
=
address
.
ExecAddress
(
ty
.
RelayX
)
tx
.
Nonce
=
2
//for different order id
tx
.
Nonce
=
2
//for different order id
tx
.
ChainID
=
chainTestCfg
.
GetChainID
()
tx
.
Payload
=
types
.
Encode
(
sell
)
tx
.
Payload
=
types
.
Encode
(
sell
)
tx
.
Sign
(
types
.
SECP256K1
,
privFrom
)
tx
.
Sign
(
types
.
SECP256K1
,
privFrom
)
...
...
plugin/dapp/token/executor/token_new_test.go
View file @
156d4750
...
@@ -170,6 +170,7 @@ func TestPrecreate(t *testing.T) {
...
@@ -170,6 +170,7 @@ func TestPrecreate(t *testing.T) {
Fee
:
feeForToken
,
Fee
:
feeForToken
,
Nonce
:
r
.
Int63
(),
Nonce
:
r
.
Int63
(),
To
:
address
.
ExecAddress
(
execName
),
To
:
address
.
ExecAddress
(
execName
),
ChainID
:
mainClient
.
Version
()
.
GetChainID
(),
}
}
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
...
@@ -211,6 +212,7 @@ func TestFinish(t *testing.T) {
...
@@ -211,6 +212,7 @@ func TestFinish(t *testing.T) {
Fee
:
feeForToken
,
Fee
:
feeForToken
,
Nonce
:
r
.
Int63
(),
Nonce
:
r
.
Int63
(),
To
:
address
.
ExecAddress
(
execName
),
To
:
address
.
ExecAddress
(
execName
),
ChainID
:
mainClient
.
Version
()
.
GetChainID
(),
}
}
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
...
@@ -246,6 +248,7 @@ func TestTransferToken(t *testing.T) {
...
@@ -246,6 +248,7 @@ func TestTransferToken(t *testing.T) {
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
execName
),
Payload
:
types
.
Encode
(
transfer
),
Fee
:
fee
,
To
:
addrexec
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
execName
),
Payload
:
types
.
Encode
(
transfer
),
Fee
:
fee
,
To
:
addrexec
}
tx
.
Nonce
=
r
.
Int63
()
tx
.
Nonce
=
r
.
Int63
()
tx
.
ChainID
=
mainClient
.
Version
()
.
GetChainID
()
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
reply
,
err
:=
mainClient
.
SendTransaction
(
context
.
Background
(),
tx
)
reply
,
err
:=
mainClient
.
SendTransaction
(
context
.
Background
(),
tx
)
...
@@ -326,6 +329,8 @@ func TestTokenMint(t *testing.T) {
...
@@ -326,6 +329,8 @@ func TestTokenMint(t *testing.T) {
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
execName
),
Payload
:
types
.
Encode
(
transfer
),
Fee
:
fee
,
To
:
addrexec
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
execName
),
Payload
:
types
.
Encode
(
transfer
),
Fee
:
fee
,
To
:
addrexec
}
tx
.
Nonce
=
r
.
Int63
()
tx
.
Nonce
=
r
.
Int63
()
tx
.
ChainID
=
mainClient
.
Version
()
.
GetChainID
()
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
reply
,
err
:=
mainClient
.
SendTransaction
(
context
.
Background
(),
tx
)
reply
,
err
:=
mainClient
.
SendTransaction
(
context
.
Background
(),
tx
)
...
...
plugin/dapp/unfreeze/types/types.go
View file @
156d4750
...
@@ -147,6 +147,7 @@ func CreateUnfreezeCreateTx(cfg *types.Chain33Config, title string, parm *Unfree
...
@@ -147,6 +147,7 @@ func CreateUnfreezeCreateTx(cfg *types.Chain33Config, title string, parm *Unfree
Payload
:
types
.
Encode
(
create
),
Payload
:
types
.
Encode
(
create
),
Nonce
:
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
.
Int63
(),
Nonce
:
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
.
Int63
(),
To
:
address
.
ExecAddress
(
getRealExecName
(
cfg
,
cfg
.
GetParaName
())),
To
:
address
.
ExecAddress
(
getRealExecName
(
cfg
,
cfg
.
GetParaName
())),
ChainID
:
cfg
.
GetChainID
(),
}
}
tx
.
SetRealFee
(
cfg
.
GetMinTxFeeRate
())
tx
.
SetRealFee
(
cfg
.
GetMinTxFeeRate
())
return
tx
,
nil
return
tx
,
nil
...
@@ -176,6 +177,7 @@ func CreateUnfreezeWithdrawTx(cfg *types.Chain33Config, title string, parm *Unfr
...
@@ -176,6 +177,7 @@ func CreateUnfreezeWithdrawTx(cfg *types.Chain33Config, title string, parm *Unfr
Payload
:
types
.
Encode
(
withdraw
),
Payload
:
types
.
Encode
(
withdraw
),
Nonce
:
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
.
Int63
(),
Nonce
:
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
.
Int63
(),
To
:
address
.
ExecAddress
(
getRealExecName
(
cfg
,
cfg
.
GetParaName
())),
To
:
address
.
ExecAddress
(
getRealExecName
(
cfg
,
cfg
.
GetParaName
())),
ChainID
:
cfg
.
GetChainID
(),
}
}
tx
.
SetRealFee
(
cfg
.
GetMinTxFeeRate
())
tx
.
SetRealFee
(
cfg
.
GetMinTxFeeRate
())
return
tx
,
nil
return
tx
,
nil
...
@@ -205,6 +207,7 @@ func CreateUnfreezeTerminateTx(cfg *types.Chain33Config, title string, parm *Unf
...
@@ -205,6 +207,7 @@ func CreateUnfreezeTerminateTx(cfg *types.Chain33Config, title string, parm *Unf
Payload
:
types
.
Encode
(
terminate
),
Payload
:
types
.
Encode
(
terminate
),
Nonce
:
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
.
Int63
(),
Nonce
:
rand
.
New
(
rand
.
NewSource
(
time
.
Now
()
.
UnixNano
()))
.
Int63
(),
To
:
address
.
ExecAddress
(
getRealExecName
(
cfg
,
cfg
.
GetParaName
())),
To
:
address
.
ExecAddress
(
getRealExecName
(
cfg
,
cfg
.
GetParaName
())),
ChainID
:
cfg
.
GetChainID
(),
}
}
tx
.
SetRealFee
(
cfg
.
GetMinTxFeeRate
())
tx
.
SetRealFee
(
cfg
.
GetMinTxFeeRate
())
return
tx
,
nil
return
tx
,
nil
...
...
plugin/dapp/x2ethereum/executor/exec_test.go
View file @
156d4750
...
@@ -75,6 +75,7 @@ func (x *suiteX2Ethereum) SetupSuite() {
...
@@ -75,6 +75,7 @@ func (x *suiteX2Ethereum) SetupSuite() {
tx
.
Execer
=
[]
byte
(
types2
.
X2ethereumX
)
tx
.
Execer
=
[]
byte
(
types2
.
X2ethereumX
)
tx
.
To
=
address
.
ExecAddress
(
types2
.
X2ethereumX
)
tx
.
To
=
address
.
ExecAddress
(
types2
.
X2ethereumX
)
tx
.
Nonce
=
1
tx
.
Nonce
=
1
tx
.
ChainID
=
chainTestCfg
.
GetChainID
()
tx
.
Sign
(
types
.
SECP256K1
,
privFrom
)
tx
.
Sign
(
types
.
SECP256K1
,
privFrom
)
x
.
action
=
newAction
(
x2eth
,
tx
,
0
)
x
.
action
=
newAction
(
x2eth
,
tx
,
0
)
...
...
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