Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!
Open sidebar
bao xinyu
vm-native
Commits
06d2d137
Commit
06d2d137
authored
Dec 21, 2022
by
hxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Delete trust root of pk mode --bug=1004738
parent
f02a1b84
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
3 deletions
+27
-3
chainconfigmgr/chain_config_contract.go
chainconfigmgr/chain_config_contract.go
+5
-0
chainconfigmgr/chain_config_trust.go
chainconfigmgr/chain_config_trust.go
+22
-1
go.sum
go.sum
+0
-2
No files found.
chainconfigmgr/chain_config_contract.go
View file @
06d2d137
...
...
@@ -440,6 +440,11 @@ func useCert(authType string) bool {
return
authType
==
protocol
.
PermissionedWithCert
||
authType
==
protocol
.
Identity
||
authType
==
""
}
func
usePK
(
authType
string
)
bool
{
authType
=
strings
.
ToLower
(
authType
)
return
authType
==
protocol
.
Public
}
func
wrapEventResult
(
f
func
(
txSimContext
protocol
.
TxSimContext
,
parameters
map
[
string
][]
byte
)
([]
byte
,
error
))
func
(
txSimContext
protocol
.
TxSimContext
,
parameters
map
[
string
][]
byte
)
*
commonPb
.
ContractResult
{
r
:=
func
(
txSimContext
protocol
.
TxSimContext
,
parameters
map
[
string
][]
byte
)
*
commonPb
.
ContractResult
{
...
...
chainconfigmgr/chain_config_trust.go
View file @
06d2d137
...
...
@@ -157,7 +157,28 @@ func (r *ChainTrustRootsRuntime) TrustRootDelete(txSimContext protocol.TxSimCont
return
nil
,
err
}
trustRoots
=
append
(
trustRoots
[
:
index
],
trustRoots
[
index
+
1
:
]
...
)
if
usePK
(
chainConfig
.
AuthType
)
{
rootPem
:=
string
(
params
[
paramNameRoot
])
if
utils
.
IsAnyBlank
(
rootPem
)
{
err
=
fmt
.
Errorf
(
"delete trust root cert failed, require param [%s], but not found"
,
paramNameRoot
)
r
.
log
.
Error
(
err
)
return
nil
,
err
}
roots
:=
trustRoots
[
index
]
.
Root
for
ri
,
rt
:=
range
roots
{
if
rootPem
==
rt
{
trustRoots
[
index
]
.
Root
=
append
(
trustRoots
[
index
]
.
Root
[
:
ri
],
trustRoots
[
index
]
.
Root
[
ri
+
1
:
]
...
)
if
len
(
trustRoots
[
index
]
.
Root
)
==
0
{
err
=
fmt
.
Errorf
(
"delete trust root cert failed, can't delete all TrustRoot"
)
r
.
log
.
Error
(
err
)
return
nil
,
err
}
break
}
}
}
else
{
trustRoots
=
append
(
trustRoots
[
:
index
],
trustRoots
[
index
+
1
:
]
...
)
}
// verify has consensus nodes
if
useCert
(
chainConfig
.
AuthType
)
{
...
...
go.sum
View file @
06d2d137
...
...
@@ -8,8 +8,6 @@ chainmaker.org/chainmaker/logger/v2 v2.3.0 h1:SuBA48m+OQ5HChX34j6eXk4o0uhXHi8Jfk
chainmaker.org/chainmaker/logger/v2
v2.3.0/go.mod h1:
kmHXCIBl9833c0UO+G4GKAifbhqhNdiL4f5dDsR+Vks=
chainmaker.org/chainmaker/pb-go/v2
v2.3.0/go.mod h1:
MB2+suualBWOKvd6FRQD/XcZzlav7APiSa7uzdDLkY8=
chainmaker.org/chainmaker/pb-go/v2
v2.3.2-0.20221025031424-180bc65c9681/go.mod h1:
MB2+suualBWOKvd6FRQD/XcZzlav7APiSa7uzdDLkY8=
chainmaker.org/chainmaker/pb-go/v2
v2.3.2-0.20221101031204-599dc62493a5 h1:
bFY6EAaF9HblP50jjtPTPDUO3EBFvB8ZYiIeWLpm2Hw=
chainmaker.org/chainmaker/pb-go/v2
v2.3.2-0.20221101031204-599dc62493a5/go.mod h1:
MB2+suualBWOKvd6FRQD/XcZzlav7APiSa7uzdDLkY8=
chainmaker.org/chainmaker/pb-go/v2
v2.3.2-0.20221102022821-b8ab8397a114 h1:
G1JxzLkMhQZ9WuoZjDp0Ae4En5tbx0PBTCMbFKYa+wg=
chainmaker.org/chainmaker/pb-go/v2
v2.3.2-0.20221102022821-b8ab8397a114/go.mod h1:
MB2+suualBWOKvd6FRQD/XcZzlav7APiSa7uzdDLkY8=
chainmaker.org/chainmaker/protocol/v2
v2.3.0/go.mod h1:
l3EfuaCdGG1FKcCItDbGeIJ4YmYnMjSUIoXQ5GElARY=
...
...
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