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
bf16d0e5
Commit
bf16d0e5
authored
Sep 20, 2019
by
pengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#484 update rpc_test evm
parent
5d2f1df8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
57 deletions
+16
-57
test-rpc.sh
plugin/dapp/evm/cmd/build/test-rpc.sh
+16
-57
No files found.
plugin/dapp/evm/cmd/build/test-rpc.sh
View file @
bf16d0e5
...
...
@@ -8,7 +8,7 @@ MAIN_HTTP=""
CASE_ERR
=
""
evm_createContract_unsignedTx
=
"0a0365766d129407228405608060405234801561001057600080fd5b50610264806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063b8e010de1461003b578063cc80f6f314610045575b600080fd5b6100436100c2565b005b61004d610109565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561008757818101518382015260200161006f565b50505050905090810190601f1680156100b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051808201909152600d8082527f5468697320697320746573742e000000000000000000000000000000000000006020909201918252610106916000916101a0565b50565b60008054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156101955780601f1061016a57610100808354040283529160200191610195565b820191906000526020600020905b81548152906001019060200180831161017857829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101e157805160ff191683800117855561020e565b8280016001018555821561020e579182015b8281111561020e5782518255916020019190600101906101f3565b5061021a92915061021e565b5090565b61019d91905b8082111561021a576000815560010161022456fea165627a7a72305820fec5dd5ca2cb47523ba08c04749bc5c14c435afee039f3047c2b7ea2faca737800293a8a025b7b22636f6e7374616e74223a66616c73652c22696e70757473223a5b5d2c226e616d65223a22736574222c226f757470757473223a5b5d2c2270617961626c65223a66616c73652c2273746174654d75746162696c697479223a226e6f6e70617961626c65222c2274797065223a2266756e6374696f6e227d2c7b22636f6e7374616e74223a747275652c22696e70757473223a5b5d2c226e616d65223a2273686f77222c226f757470757473223a5b7b226e616d65223a22222c2274797065223a22737472696e67227d5d2c2270617961626c65223a66616c73652c2273746174654d75746162696c697479223a2276696577222c2274797065223a2266756e6374696f6e227d5d20c0c7ee04309aedc4bcfba5beca5f3a223139746a5335316b6a7772436f535153313355336f7765376759424c6653666f466d"
evm_createContract_para_unsignedTx
=
"0a0f757365722e702e706172612e65766d129407228405608060405234801561001057600080fd5b50610264806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063b8e010de1461003b578063cc80f6f314610045575b600080fd5b6100436100c2565b005b61004d610109565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561008757818101518382015260200161006f565b50505050905090810190601f1680156100b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051808201909152600d8082527f5468697320697320746573742e000000000000000000000000000000000000006020909201918252610106916000916101a0565b50565b60008054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156101955780601f1061016a57610100808354040283529160200191610195565b820191906000526020600020905b81548152906001019060200180831161017857829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101e157805160ff191683800117855561020e565b8280016001018555821561020e579182015b8281111561020e5782518255916020019190600101906101f3565b5061021a92915061021e565b5090565b61019d91905b8082111561021a576000815560010161022456fea165627a7a7230582080ff1004de2195e6c08d0d0a65484b3d393c99c280e305cb383dbc89343cdd6a00293a8a025b7b22636f6e7374616e74223a66616c73652c22696e70757473223a5b5d2c226e616d65223a22736574222c226f757470757473223a5b5d2c2270617961626c65223a66616c73652c2273746174654d75746162696c697479223a226e6f6e70617961626c65222c2274797065223a2266756e6374696f6e227d2c7b22636f6e7374616e74223a747275652c22696e70757473223a5b5d2c226e616d65223a2273686f77222c226f757470757473223a5b7b226e616d65223a22222c2274797065223a22737472696e67227d5d2c2270617961626c65223a66616c73652c2273746174654d75746162696c697479223a2276696577222c2274797065223a2266756e6374696f6e227d5d20c0c7ee0430e1c7facdc1f199956c3a2231483969326a67464a594e5167573350695468694337796b7a5663653570764b7478"
evm_creatorAddr
=
"1
4KEKbYtKKQm4wMthSK9J4La4nAiidGoz
t"
evm_creatorAddr
=
"1
PTXh2EZ8aRUzpuoDRASV19K86Kx3qQiP
t"
evm_contractAddr
=
""
evm_addr
=
""
...
...
@@ -27,45 +27,6 @@ function echo_rst() {
fi
}
function
Chain33_SendToAddress
()
{
local
from
=
"
$1
"
local
to
=
"
$2
"
local
amount
=
$3
local
req
=
'"method":"Chain33.SendToAddress", "params":[{"from":"'
"
$from
"
'","to":"'
"
$to
"
'", "amount":'
"
$amount
"
', "note":"test\n"}]'
# echo "#request: $req"
resp
=
$(
curl
-ksd
"{
$req
}"
"
${
MAIN_HTTP
}
"
)
# echo "#response: $resp"
ok
=
$(
jq
'(.error|not) and (.result.hash|length==66)'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
echo_rst
"
$FUNCNAME
"
"
$?
"
hash
=
$(
jq
'(.result.hash)'
<<<
"
$resp
"
)
echo
"hash=
$hash
"
# query_tx "$hash"
}
function
chain33_unlock
()
{
ok
=
$(
curl
-k
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.UnLock","params":[{"passwd":"1314fuzamei","timeout":0}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
| jq
-r
".result.isOK"
)
[
"
$ok
"
==
true
]
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
block_wait
()
{
local
req
=
'"method":"Chain33.GetLastHeader","params":[]'
cur_height
=
$(
curl
-ksd
"{
$req
}"
${
MAIN_HTTP
}
| jq
".result.height"
)
expect
=
$((
cur_height
+
${
1
}))
local
count
=
0
while
true
;
do
new_height
=
$(
curl
-ksd
"{
$req
}"
${
MAIN_HTTP
}
| jq
".result.height"
)
if
[
"
${
new_height
}
"
-ge
"
${
expect
}
"
]
;
then
break
fi
count
=
$((
count
+
1
))
sleep
1
done
echo
"wait new block
$count
s, cur height=
$expect
,old=
$cur_height
"
}
function
evm_createContract
()
{
validator
=
$1
expectRes
=
$2
...
...
@@ -80,7 +41,7 @@ function evm_createContract() {
sendSignedTx
echo_rst
"CreateContract sendSignedTx"
"
$?
"
block_wait 2
chain33_BlockWait 2
"
$MAIN_HTTP
"
queryTransaction
"
${
validator
}
"
"
${
expectRes
}
"
echo_rst
"CreateContract queryExecRes"
"
$?
"
...
...
@@ -122,7 +83,7 @@ function evm_callContract() {
sendSignedTx
echo_rst
"CallContract sendSignedTx"
"
$?
"
block_wait 2
chain33_BlockWait 2
"
$MAIN_HTTP
"
queryTransaction
"
${
validator
}
"
"
${
expectRes
}
"
echo_rst
"CallContract queryExecRes"
"
$?
"
...
...
@@ -155,7 +116,7 @@ function evm_transfer() {
sendSignedTx
echo_rst
"evm transfer sendSignedTx"
"
$?
"
block_wait 2
chain33_BlockWait 2
"
$MAIN_HTTP
"
queryTransaction
"
${
validator
}
"
"
${
expectRes
}
"
echo_rst
"evm transfer queryExecRes"
"
$?
"
...
...
@@ -191,7 +152,7 @@ function evm_withDraw() {
sendSignedTx
echo_rst
"evm withdraw sendSignedTx"
"
$?
"
block_wait 2
chain33_BlockWait 2
"
$MAIN_HTTP
"
queryTransaction
"
${
validator
}
"
"
${
expectRes
}
"
echo_rst
"evm withdraw queryExecRes"
"
$?
"
...
...
@@ -264,39 +225,37 @@ function init() {
#1PTXh2EZ8aRUzpuoDRASV19K86Kx3qQiPt
chain33_ImportPrivkey
"0x4947ce3c4b845cfed59be2edf47320546116a3ff3af5715a7df094d116039b89"
"1PTXh2EZ8aRUzpuoDRASV19K86Kx3qQiPt"
"evm"
"
${
main_ip
}
"
local
ACCOUNT_A
=
"1PTXh2EZ8aRUzpuoDRASV19K86Kx3qQiPt"
local
from
=
"1PTXh2EZ8aRUzpuoDRASV19K86Kx3qQiPt"
if
[
"
$ispara
"
==
false
]
;
then
chain33_applyCoins
"
$
ACCOUNT_A
"
12000000000
"
${
main_ip
}
"
chain33_QueryBalance
"
${
ACCOUNT_A
}
"
"
$main_ip
"
chain33_applyCoins
"
$
from
"
12000000000
"
${
main_ip
}
"
chain33_QueryBalance
"
${
from
}
"
"
$main_ip
"
else
# tx fee
chain33_applyCoins
"
$
ACCOUNT_A
"
1000000000
"
${
main_ip
}
"
chain33_QueryBalance
"
${
ACCOUNT_A
}
"
"
$main_ip
"
chain33_applyCoins
"
$
from
"
1000000000
"
${
main_ip
}
"
chain33_QueryBalance
"
${
from
}
"
"
$main_ip
"
local
para_ip
=
"
${
MAIN_HTTP
}
"
#para chain import pri key
chain33_ImportPrivkey
"0x4947ce3c4b845cfed59be2edf47320546116a3ff3af5715a7df094d116039b89"
"1PTXh2EZ8aRUzpuoDRASV19K86Kx3qQiPt"
"evm"
"
$para_ip
"
chain33_applyCoins
"
$
ACCOUNT_A
"
12000000000
"
${
para_ip
}
"
chain33_QueryBalance
"
${
ACCOUNT_A
}
"
"
$para_ip
"
chain33_applyCoins
"
$
from
"
12000000000
"
${
para_ip
}
"
chain33_QueryBalance
"
${
from
}
"
"
$para_ip
"
fi
from
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
Chain33_SendToAddress
"
$ACCOUNT_A
"
"
$from
"
11000000000
block_wait 2
chain33_BlockWait 2
"
$MAIN_HTTP
"
local
evm_addr
=
""
if
[
"
$ispara
"
==
"true"
]
;
then
evm_addr
=
$(
curl
-ksd
'{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"user.p.para.evm"}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
Chain33_SendToAddress
"
$from
"
"
$evm_addr
"
10000000000
chain33_SendToAddress
"
$from
"
"
$evm_addr
"
10000000000
"
$MAIN_HTTP
"
else
evm_addr
=
$(
curl
-ksd
'{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"evm"}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
fi
echo
"evm=
$evm_addr
"
Chain33_SendToAddress
"
$from
"
"
$evm_addr
"
10000000000
block_wait 2
chain33_SendToAddress
"
$from
"
"
$evm_addr
"
10000000000
"
$MAIN_HTTP
"
chain33_BlockWait 2
"
$MAIN_HTTP
"
}
function
run_test
()
{
local
ip
=
$1
...
...
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