Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!
Open sidebar
xiao pei
vm-native
Commits
65d4e4e0
Commit
65d4e4e0
authored
Sep 26, 2022
by
mosesyzding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style:add zx prefix for addr, --story=1012324
parent
f0be4fb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
contractmgr/contract_manager.go
contractmgr/contract_manager.go
+15
-13
No files found.
contractmgr/contract_manager.go
View file @
65d4e4e0
...
@@ -9,7 +9,6 @@ package contractmgr
...
@@ -9,7 +9,6 @@ package contractmgr
import
(
import
(
"bytes"
"bytes"
"chainmaker.org/chainmaker/pb-go/v2/config"
"encoding/json"
"encoding/json"
"errors"
"errors"
"fmt"
"fmt"
...
@@ -19,6 +18,8 @@ import (
...
@@ -19,6 +18,8 @@ import (
"path/filepath"
"path/filepath"
"strings"
"strings"
"chainmaker.org/chainmaker/pb-go/v2/config"
"github.com/google/uuid"
"github.com/google/uuid"
"chainmaker.org/chainmaker/pb-go/v2/accesscontrol"
"chainmaker.org/chainmaker/pb-go/v2/accesscontrol"
...
@@ -29,8 +30,8 @@ import (
...
@@ -29,8 +30,8 @@ import (
"chainmaker.org/chainmaker/vm-native/v2/common"
"chainmaker.org/chainmaker/vm-native/v2/common"
)
)
const
(
const
(
ZX
AddrPrefix
=
"ZX"
zxl
AddrPrefix
=
"ZX"
)
)
var
(
var
(
...
@@ -108,6 +109,7 @@ func registerContractManagerMethods(log protocol.Logger) map[string]common.Contr
...
@@ -108,6 +109,7 @@ func registerContractManagerMethods(log protocol.Logger) map[string]common.Contr
// return addr
// return addr
//}
//}
//addZXPrefixForContractAddr add zxl address prefix for contract
func
addZXPrefixForContractAddr
(
txSimContext
protocol
.
TxSimContext
,
contract
*
commonPb
.
Contract
)
*
commonPb
.
Contract
{
func
addZXPrefixForContractAddr
(
txSimContext
protocol
.
TxSimContext
,
contract
*
commonPb
.
Contract
)
*
commonPb
.
Contract
{
cfg
,
_
:=
txSimContext
.
GetBlockchainStore
()
.
GetLastChainConfig
()
cfg
,
_
:=
txSimContext
.
GetBlockchainStore
()
.
GetLastChainConfig
()
...
@@ -116,17 +118,18 @@ func addZXPrefixForContractAddr(txSimContext protocol.TxSimContext, contract *co
...
@@ -116,17 +118,18 @@ func addZXPrefixForContractAddr(txSimContext protocol.TxSimContext, contract *co
return
contract
return
contract
}
}
contract
.
Address
=
ZX
AddrPrefix
+
contract
.
Address
contract
.
Address
=
zxl
AddrPrefix
+
contract
.
Address
return
contract
return
contract
}
}
func
truncateZXPrefixForContractAddr
(
contract
*
commonPb
.
Contract
)
*
commonPb
.
Contract
{
//truncateZXPrefixForContractAddr delete zxl address prefix
if
contract
.
Address
[
0
:
2
]
==
ZXAddrPrefix
{
//func truncateZXPrefixForContractAddr(contract *commonPb.Contract) *commonPb.Contract {
contract
.
Address
=
contract
.
Address
[
2
:
]
// if contract.Address[0:2] == zxlAddrPrefix {
}
// contract.Address = contract.Address[2:]
// }
return
contract
//
}
// return contract
//}
func
putContract
(
context
protocol
.
TxSimContext
,
contract
*
commonPb
.
Contract
)
error
{
func
putContract
(
context
protocol
.
TxSimContext
,
contract
*
commonPb
.
Contract
)
error
{
cdata
,
err
:=
contract
.
Marshal
()
cdata
,
err
:=
contract
.
Marshal
()
...
@@ -299,7 +302,6 @@ func (r *ContractManagerRuntime) fetchDisabledContractList(txSimContext protocol
...
@@ -299,7 +302,6 @@ func (r *ContractManagerRuntime) fetchDisabledContractList(txSimContext protocol
for
_
,
c
:=
range
contracts
{
for
_
,
c
:=
range
contracts
{
if
c
.
Status
==
commonPb
.
ContractStatus_FROZEN
{
if
c
.
Status
==
commonPb
.
ContractStatus_FROZEN
{
disabledContractList
=
append
(
disabledContractList
,
c
.
Name
)
disabledContractList
=
append
(
disabledContractList
,
c
.
Name
)
c
=
addZXPrefixForContractAddr
(
txSimContext
,
c
)
}
}
}
}
return
disabledContractList
,
err
return
disabledContractList
,
err
...
@@ -335,7 +337,7 @@ func (r *ContractManagerRuntime) getAllContracts(txSimContext protocol.TxSimCont
...
@@ -335,7 +337,7 @@ func (r *ContractManagerRuntime) getAllContracts(txSimContext protocol.TxSimCont
contract
.
RuntimeType
=
commonPb
.
RuntimeType_DOCKER_GO
contract
.
RuntimeType
=
commonPb
.
RuntimeType_DOCKER_GO
}
}
contract
=
addZXPrefixForContractAddr
(
txSimContext
,
contract
)
addZXPrefixForContractAddr
(
txSimContext
,
contract
)
}
}
r
.
log
.
Debugf
(
"getAllContracts result: %+v"
,
contracts
)
r
.
log
.
Debugf
(
"getAllContracts result: %+v"
,
contracts
)
return
json
.
Marshal
(
contracts
)
return
json
.
Marshal
(
contracts
)
...
...
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