Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!
Open sidebar
bao xinyu
vm-native
Commits
02555a68
Commit
02555a68
authored
Dec 19, 2022
by
志宏 蔡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: correct the checkAdmin() failed when 231 handle 221 tx. --bug=1004753
parent
e4cae6c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
accountmgr/account_manager_test.go
accountmgr/account_manager_test.go
+12
-1
No files found.
accountmgr/account_manager_test.go
View file @
02555a68
...
...
@@ -71,6 +71,7 @@ func TestAccountManagerRuntime_ChargeGasVm(t *testing.T) {
mockTxSimContext
.
EXPECT
()
.
GetBlockchainStore
()
.
Return
(
mockBlockchainStore
)
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Debugf
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
gomock
.
InOrder
(
mockTxSimContext
.
EXPECT
()
.
Get
(
syscontract
.
SystemContract_ACCOUNT_MANAGER
.
String
(),
[]
byte
(
FrozenPrefix
+
address
))
.
Return
([]
byte
(
"0"
),
nil
)
.
AnyTimes
(),
mockTxSimContext
.
EXPECT
()
.
Get
(
syscontract
.
SystemContract_ACCOUNT_MANAGER
.
String
(),
[]
byte
(
AccountPrefix
+
address
))
.
Return
([]
byte
(
"10"
),
nil
)
.
AnyTimes
(),
...
...
@@ -174,6 +175,7 @@ func TestAccountManagerRuntime_FrozenAccount(t *testing.T) {
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Infof
(
"verify account address is:%v"
,
address
)
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Debugf
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
type
fields
struct
{
log
protocol
.
Logger
}
...
...
@@ -246,6 +248,7 @@ func TestAccountManagerRuntime_GetAccountStatus(t *testing.T) {
mockTxSimContext
.
EXPECT
()
.
Get
(
syscontract
.
SystemContract_ACCOUNT_MANAGER
.
String
(),
[]
byte
(
FrozenPrefix
+
address
))
.
Return
([]
byte
(
"0"
),
nil
)
.
AnyTimes
()
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Debugf
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Infof
(
"verify account address is:%v"
,
address
)
.
Return
()
.
AnyTimes
()
type
fields
struct
{
log
protocol
.
Logger
...
...
@@ -323,6 +326,7 @@ func TestAccountManagerRuntime_GetAdmin(t *testing.T) {
mockTxSimContext
.
EXPECT
()
.
GetBlockVersion
()
.
Return
(
uint32
(
2300
))
.
AnyTimes
()
mockTxSimContext
.
EXPECT
()
.
Get
(
chainConfigContractName
,
[]
byte
(
chainConfigContractName
))
.
Return
(
chainConfigBytes
,
nil
)
.
AnyTimes
()
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Debugf
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Infof
(
"verify account address is:%v"
,
address
)
.
Return
()
.
AnyTimes
()
type
fields
struct
{
...
...
@@ -387,6 +391,7 @@ func TestAccountManagerRuntime_GetBalance(t *testing.T) {
mockTxSimContext
.
EXPECT
()
.
Get
(
syscontract
.
SystemContract_ACCOUNT_MANAGER
.
String
(),
[]
byte
(
AccountPrefix
+
address
))
.
Return
([]
byte
(
"10"
),
nil
)
.
AnyTimes
()
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Debugf
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Infof
(
"verify account address is:%v"
,
address
)
.
Return
()
.
AnyTimes
()
type
fields
struct
{
...
...
@@ -476,6 +481,7 @@ func TestAccountManagerRuntime_RechargeGas(t *testing.T) {
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Infof
(
"verify account address is:%v"
,
address
)
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Error
()
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Debugf
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
rechargeGasReq
:=
&
syscontract
.
RechargeGasReq
{
BatchRechargeGas
:
[]
*
syscontract
.
RechargeGas
{
...
...
@@ -578,6 +584,7 @@ func TestAccountManagerRuntime_RefundGas(t *testing.T) {
)
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Debugf
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Infof
(
"verify account address is:%v"
,
address
)
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Error
(
fmt
.
Errorf
(
" %s accout is frozened"
,
address
)
.
Error
())
.
Return
()
.
AnyTimes
()
type
fields
struct
{
...
...
@@ -652,6 +659,7 @@ func TestAccountManagerRuntime_RefundGasVm(t *testing.T) {
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Infof
(
"verify account address is:%v"
,
address
)
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Error
(
errors
.
New
(
"error"
))
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Infof
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
type
fields
struct
{
log
protocol
.
Logger
}
...
...
@@ -748,6 +756,7 @@ func TestAccountManagerRuntime_SetAdmin(t *testing.T) {
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Infof
(
"verify account address is:%v"
,
address
)
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Error
(
"org id(chainmaker.org1) not in trust roots config"
)
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Infof
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
type
fields
struct
{
log
protocol
.
Logger
...
...
@@ -844,6 +853,7 @@ func TestAccountManagerRuntime_UnFrozenAccount(t *testing.T) {
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Infof
(
"verify account address is:%v"
,
address
)
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Error
(
errors
.
New
(
"error"
))
.
Return
()
.
AnyTimes
()
logger
.
EXPECT
()
.
Debugf
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
type
fields
struct
{
log
protocol
.
Logger
...
...
@@ -896,6 +906,7 @@ func TestAccountManagerRuntime_chargeGas(t *testing.T) {
defer
c
.
Finish
()
mockTxSimContext
:=
mock
.
NewMockTxSimContext
(
c
)
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Debugf
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
gomock
.
InOrder
(
mockTxSimContext
.
EXPECT
()
.
Get
(
syscontract
.
SystemContract_ACCOUNT_MANAGER
.
String
(),
[]
byte
(
FrozenPrefix
+
address
))
.
Return
([]
byte
(
"0"
),
nil
)
.
AnyTimes
(),
mockTxSimContext
.
EXPECT
()
.
Get
(
syscontract
.
SystemContract_ACCOUNT_MANAGER
.
String
(),
[]
byte
(
AccountPrefix
+
address
))
.
Return
([]
byte
(
"200"
),
nil
)
.
AnyTimes
(),
...
...
@@ -1005,7 +1016,7 @@ func TestAccountManagerRuntime_checkAdmin(t *testing.T) {
defer
c
.
Finish
()
logger
:=
mock
.
NewMockLogger
(
c
)
logger
.
EXPECT
()
.
Infof
(
"verify account address is:%v"
,
address
)
logger
.
EXPECT
()
.
Debugf
(
gomock
.
Any
(),
gomock
.
Any
(),
gomock
.
Any
())
.
Return
()
.
AnyTimes
()
loggerNotAdmin
:=
mock
.
NewMockLogger
(
c
)
gomock
.
InOrder
(
loggerNotAdmin
.
EXPECT
()
.
Infof
(
"verify account address is:%v"
,
"Zx958f7550fe53d96e708b0fc95212812bec3141ea"
),
...
...
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