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
d4de6275
Unverified
Commit
d4de6275
authored
Jan 20, 2021
by
vipwzw
Committed by
GitHub
Jan 20, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #937 from icehawk-hyb/issues-971
add by hyb for chainid
parents
95a394d8
1768de18
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
87 additions
and
34 deletions
+87
-34
go.mod
go.mod
+3
-1
go.sum
go.sum
+0
-0
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
+2
-0
state.go
plugin/consensus/tendermint/state.go
+1
-0
tendermint_test.go
plugin/consensus/tendermint/tendermint_test.go
+15
-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
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
+2
-1
relayd.go
plugin/dapp/relay/cmd/relayd/relayd/relayd.go
+10
-4
relay_test.go
plugin/dapp/relay/executor/relay_test.go
+3
-0
token_new_test.go
plugin/dapp/token/executor/token_new_test.go
+12
-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.
go.mod
View file @
d4de6275
...
@@ -2,8 +2,9 @@ module github.com/33cn/plugin
...
@@ -2,8 +2,9 @@ module github.com/33cn/plugin
go 1.12
go 1.12
require (
require (
github.com/33cn/chain33 v1.65.1-0.202101
08070140-55a047ad003f
github.com/33cn/chain33 v1.65.1-0.202101
15070259-1e4df1700e2e
github.com/BurntSushi/toml v0.3.1
github.com/BurntSushi/toml v0.3.1
github.com/NebulousLabs/Sia v1.3.7
github.com/NebulousLabs/Sia v1.3.7
github.com/NebulousLabs/errors v0.0.0-20181203160057-9f787ce8f69e // indirect
github.com/NebulousLabs/errors v0.0.0-20181203160057-9f787ce8f69e // indirect
...
@@ -41,6 +42,7 @@ require (
...
@@ -41,6 +42,7 @@ require (
github.com/tjfoc/gmsm v1.3.2
github.com/tjfoc/gmsm v1.3.2
github.com/valyala/fasthttp v1.5.0
github.com/valyala/fasthttp v1.5.0
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
go.uber.org/zap v1.16.0 // indirect
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1
...
...
go.sum
View file @
d4de6275
This diff is collapsed.
Click to expand it.
plugin/consensus/dpos/dpos_test.go
View file @
d4de6275
...
@@ -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 @
d4de6275
...
@@ -93,7 +93,7 @@ func sendReplyList(q queue.Queue) {
...
@@ -93,7 +93,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
{
...
@@ -122,7 +122,8 @@ func getprivkey(key string) crypto.PrivKey {
...
@@ -122,7 +122,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{}
...
@@ -132,6 +133,7 @@ func createReplyList(account string) {
...
@@ -132,6 +133,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 @
d4de6275
...
@@ -334,6 +334,8 @@ func NormPut(privkey string, key string, value string) {
...
@@ -334,6 +334,8 @@ 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
()
version
,
_
:=
c
.
Version
(
context
.
Background
(),
nil
)
tx
.
ChainID
=
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 @
d4de6275
...
@@ -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 @
d4de6275
...
@@ -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,10 @@ func AddNode() {
...
@@ -199,6 +200,10 @@ 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
()
version
,
_
:=
c
.
Version
(
context
.
Background
(),
nil
)
if
version
!=
nil
{
tx
.
ChainID
=
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 +226,11 @@ func ConfigManager() {
...
@@ -221,6 +226,11 @@ 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
()
version
,
_
:=
c
.
Version
(
context
.
Background
(),
nil
)
if
version
!=
nil
{
tx
.
ChainID
=
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 @
d4de6275
...
@@ -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 @
d4de6275
...
@@ -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 @
d4de6275
...
@@ -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 @
d4de6275
...
@@ -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 @
d4de6275
...
@@ -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 @
d4de6275
...
@@ -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/paracross/types/paracross.go
View file @
d4de6275
...
@@ -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 @
d4de6275
...
@@ -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 @
d4de6275
...
@@ -190,6 +190,7 @@ func (mock *PrivacyMock) CreateUTXOs(sender string, pubkeypair string, amount in
...
@@ -190,6 +190,7 @@ func (mock *PrivacyMock) CreateUTXOs(sender string, pubkeypair string, amount in
}
}
func
(
mock
*
PrivacyMock
)
createPublic2PrivacyTx
(
req
*
ty
.
ReqCreatePrivacyTx
)
*
types
.
Transaction
{
func
(
mock
*
PrivacyMock
)
createPublic2PrivacyTx
(
req
*
ty
.
ReqCreatePrivacyTx
)
*
types
.
Transaction
{
cfg
:=
mock
.
walletOp
.
GetAPI
()
.
GetConfig
()
viewPubSlice
,
spendPubSlice
,
err
:=
parseViewSpendPubKeyPair
(
req
.
GetPubkeypair
())
viewPubSlice
,
spendPubSlice
,
err
:=
parseViewSpendPubKeyPair
(
req
.
GetPubkeypair
())
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
return
nil
...
@@ -217,8 +218,8 @@ func (mock *PrivacyMock) createPublic2PrivacyTx(req *ty.ReqCreatePrivacyTx) *typ
...
@@ -217,8 +218,8 @@ 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
()
txSize
:=
types
.
Size
(
tx
)
+
ty
.
SignatureSize
txSize
:=
types
.
Size
(
tx
)
+
ty
.
SignatureSize
realFee
:=
int64
((
txSize
+
1023
)
>>
ty
.
Size1Kshiftlen
)
*
cfg
.
GetMinTxFeeRate
()
realFee
:=
int64
((
txSize
+
1023
)
>>
ty
.
Size1Kshiftlen
)
*
cfg
.
GetMinTxFeeRate
()
tx
.
Fee
=
realFee
tx
.
Fee
=
realFee
...
...
plugin/dapp/relay/cmd/relayd/relayd/relayd.go
View file @
d4de6275
...
@@ -318,17 +318,23 @@ func (r *Relayd) syncBlockHeaders() {
...
@@ -318,17 +318,23 @@ func (r *Relayd) syncBlockHeaders() {
}
}
func
(
r
*
Relayd
)
transaction
(
payload
[]
byte
)
*
types
.
Transaction
{
func
(
r
*
Relayd
)
transaction
(
payload
[]
byte
)
*
types
.
Transaction
{
var
chainID
int32
minFee
:=
types
.
DefaultMinFee
//chain33的配置中获取chainID和minFee
if
r
.
config
.
Chain33Cfg
!=
nil
{
chainID
=
r
.
config
.
Chain33Cfg
.
GetChainID
()
minFee
=
r
.
config
.
Chain33Cfg
.
GetMinTxFeeRate
()
}
tx
:=
&
types
.
Transaction
{
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
ty
.
RelayX
),
Execer
:
[]
byte
(
ty
.
RelayX
),
Payload
:
payload
,
Payload
:
payload
,
Nonce
:
rand
.
Int63
(),
Nonce
:
rand
.
Int63
(),
To
:
address
.
ExecAddress
(
ty
.
RelayX
),
To
:
address
.
ExecAddress
(
ty
.
RelayX
),
ChainID
:
chainID
,
}
}
minFee
:=
types
.
DefaultMinFee
if
r
.
config
.
Chain33Cfg
!=
nil
{
minFee
=
r
.
config
.
Chain33Cfg
.
GetMinTxFeeRate
()
}
fee
,
_
:=
tx
.
GetRealFee
(
minFee
)
fee
,
_
:=
tx
.
GetRealFee
(
minFee
)
tx
.
Fee
=
fee
tx
.
Fee
=
fee
tx
.
Sign
(
types
.
SECP256K1
,
r
.
privateKey
)
tx
.
Sign
(
types
.
SECP256K1
,
r
.
privateKey
)
...
...
plugin/dapp/relay/executor/relay_test.go
View file @
d4de6275
...
@@ -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 @
d4de6275
...
@@ -164,12 +164,14 @@ func TestPrecreate(t *testing.T) {
...
@@ -164,12 +164,14 @@ func TestPrecreate(t *testing.T) {
Ty
:
pty
.
TokenActionPreCreate
,
Ty
:
pty
.
TokenActionPreCreate
,
Value
:
&
pty
.
TokenAction_TokenPreCreate
{
TokenPreCreate
:
v
},
Value
:
&
pty
.
TokenAction_TokenPreCreate
{
TokenPreCreate
:
v
},
}
}
version
,
_
:=
mainClient
.
Version
(
context
.
Background
(),
nil
)
tx
:=
&
types
.
Transaction
{
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
execName
),
Execer
:
[]
byte
(
execName
),
Payload
:
types
.
Encode
(
precreate
),
Payload
:
types
.
Encode
(
precreate
),
Fee
:
feeForToken
,
Fee
:
feeForToken
,
Nonce
:
r
.
Int63
(),
Nonce
:
r
.
Int63
(),
To
:
address
.
ExecAddress
(
execName
),
To
:
address
.
ExecAddress
(
execName
),
ChainID
:
version
.
GetChainID
(),
}
}
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
...
@@ -205,12 +207,15 @@ func TestFinish(t *testing.T) {
...
@@ -205,12 +207,15 @@ func TestFinish(t *testing.T) {
Ty
:
pty
.
TokenActionFinishCreate
,
Ty
:
pty
.
TokenActionFinishCreate
,
Value
:
&
pty
.
TokenAction_TokenFinishCreate
{
TokenFinishCreate
:
v
},
Value
:
&
pty
.
TokenAction_TokenFinishCreate
{
TokenFinishCreate
:
v
},
}
}
version
,
_
:=
mainClient
.
Version
(
context
.
Background
(),
nil
)
tx
:=
&
types
.
Transaction
{
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
execName
),
Execer
:
[]
byte
(
execName
),
Payload
:
types
.
Encode
(
finish
),
Payload
:
types
.
Encode
(
finish
),
Fee
:
feeForToken
,
Fee
:
feeForToken
,
Nonce
:
r
.
Int63
(),
Nonce
:
r
.
Int63
(),
To
:
address
.
ExecAddress
(
execName
),
To
:
address
.
ExecAddress
(
execName
),
ChainID
:
version
.
GetChainID
(),
}
}
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
...
@@ -246,6 +251,9 @@ func TestTransferToken(t *testing.T) {
...
@@ -246,6 +251,9 @@ 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
()
version
,
_
:=
mainClient
.
Version
(
context
.
Background
(),
nil
)
tx
.
ChainID
=
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 +334,10 @@ func TestTokenMint(t *testing.T) {
...
@@ -326,6 +334,10 @@ 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
()
version
,
_
:=
mainClient
.
Version
(
context
.
Background
(),
nil
)
tx
.
ChainID
=
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 @
d4de6275
...
@@ -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 @
d4de6275
...
@@ -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