Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
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
exchain
nebula
Commits
8dd18f0e
Unverified
Commit
8dd18f0e
authored
May 23, 2024
by
Adrian Sutton
Committed by
GitHub
May 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use log label game consistently (#10603)
parent
cfe82c63
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
monitor.go
op-dispute-mon/mon/bonds/monitor.go
+3
-3
monitor_test.go
op-dispute-mon/mon/bonds/monitor_test.go
+7
-7
No files found.
op-dispute-mon/mon/bonds/monitor.go
View file @
8dd18f0e
...
@@ -96,7 +96,7 @@ func (b *Bonds) checkCredits(games []*types.EnrichedGameData) {
...
@@ -96,7 +96,7 @@ func (b *Bonds) checkCredits(games []*types.EnrichedGameData) {
if
maxDurationReached
{
if
maxDurationReached
{
if
comparison
>
0
{
if
comparison
>
0
{
creditMetrics
[
metrics
.
CreditAboveMaxDuration
]
+=
1
creditMetrics
[
metrics
.
CreditAboveMaxDuration
]
+=
1
b
.
logger
.
Warn
(
"Credit above expected amount"
,
"recipient"
,
recipient
,
"expected"
,
expected
,
"actual"
,
actual
,
"game
Addr
"
,
game
.
Proxy
,
"duration"
,
"reached"
)
b
.
logger
.
Warn
(
"Credit above expected amount"
,
"recipient"
,
recipient
,
"expected"
,
expected
,
"actual"
,
actual
,
"game"
,
game
.
Proxy
,
"duration"
,
"reached"
)
}
else
if
comparison
==
0
{
}
else
if
comparison
==
0
{
creditMetrics
[
metrics
.
CreditEqualMaxDuration
]
+=
1
creditMetrics
[
metrics
.
CreditEqualMaxDuration
]
+=
1
}
else
{
}
else
{
...
@@ -105,12 +105,12 @@ func (b *Bonds) checkCredits(games []*types.EnrichedGameData) {
...
@@ -105,12 +105,12 @@ func (b *Bonds) checkCredits(games []*types.EnrichedGameData) {
}
else
{
}
else
{
if
comparison
>
0
{
if
comparison
>
0
{
creditMetrics
[
metrics
.
CreditAboveNonMaxDuration
]
+=
1
creditMetrics
[
metrics
.
CreditAboveNonMaxDuration
]
+=
1
b
.
logger
.
Warn
(
"Credit above expected amount"
,
"recipient"
,
recipient
,
"expected"
,
expected
,
"actual"
,
actual
,
"game
Addr
"
,
game
.
Proxy
,
"duration"
,
"unreached"
)
b
.
logger
.
Warn
(
"Credit above expected amount"
,
"recipient"
,
recipient
,
"expected"
,
expected
,
"actual"
,
actual
,
"game"
,
game
.
Proxy
,
"duration"
,
"unreached"
)
}
else
if
comparison
==
0
{
}
else
if
comparison
==
0
{
creditMetrics
[
metrics
.
CreditEqualNonMaxDuration
]
+=
1
creditMetrics
[
metrics
.
CreditEqualNonMaxDuration
]
+=
1
}
else
{
}
else
{
creditMetrics
[
metrics
.
CreditBelowNonMaxDuration
]
+=
1
creditMetrics
[
metrics
.
CreditBelowNonMaxDuration
]
+=
1
b
.
logger
.
Warn
(
"Credit withdrawn early"
,
"recipient"
,
recipient
,
"expected"
,
expected
,
"actual"
,
actual
,
"game
Addr
"
,
game
.
Proxy
,
"duration"
,
"unreached"
)
b
.
logger
.
Warn
(
"Credit withdrawn early"
,
"recipient"
,
recipient
,
"expected"
,
expected
,
"actual"
,
actual
,
"game"
,
game
.
Proxy
,
"duration"
,
"unreached"
)
}
}
}
}
}
}
...
...
op-dispute-mon/mon/bonds/monitor_test.go
View file @
8dd18f0e
...
@@ -348,21 +348,21 @@ func TestCheckRecipientCredit(t *testing.T) {
...
@@ -348,21 +348,21 @@ func TestCheckRecipientCredit(t *testing.T) {
require
.
NotNil
(
t
,
logs
.
FindLog
(
require
.
NotNil
(
t
,
logs
.
FindLog
(
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewMessageFilter
(
"Credit withdrawn early"
),
testlog
.
NewMessageFilter
(
"Credit withdrawn early"
),
testlog
.
NewAttributesFilter
(
"game
Addr
"
,
game1
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"game"
,
game1
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr2
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr2
.
Hex
()),
testlog
.
NewAttributesFilter
(
"duration"
,
"unreached"
)))
testlog
.
NewAttributesFilter
(
"duration"
,
"unreached"
)))
// addr3 is above expected
// addr3 is above expected
require
.
NotNil
(
t
,
logs
.
FindLog
(
require
.
NotNil
(
t
,
logs
.
FindLog
(
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewMessageFilter
(
"Credit above expected amount"
),
testlog
.
NewMessageFilter
(
"Credit above expected amount"
),
testlog
.
NewAttributesFilter
(
"game
Addr
"
,
game1
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"game"
,
game1
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr3
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr3
.
Hex
()),
testlog
.
NewAttributesFilter
(
"duration"
,
"unreached"
)))
testlog
.
NewAttributesFilter
(
"duration"
,
"unreached"
)))
// addr4 is below expected before max duration, so warn about early withdrawal
// addr4 is below expected before max duration, so warn about early withdrawal
require
.
NotNil
(
t
,
logs
.
FindLog
(
require
.
NotNil
(
t
,
logs
.
FindLog
(
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewMessageFilter
(
"Credit withdrawn early"
),
testlog
.
NewMessageFilter
(
"Credit withdrawn early"
),
testlog
.
NewAttributesFilter
(
"game
Addr
"
,
game1
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"game"
,
game1
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr4
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr4
.
Hex
()),
testlog
.
NewAttributesFilter
(
"duration"
,
"unreached"
)))
testlog
.
NewAttributesFilter
(
"duration"
,
"unreached"
)))
...
@@ -373,7 +373,7 @@ func TestCheckRecipientCredit(t *testing.T) {
...
@@ -373,7 +373,7 @@ func TestCheckRecipientCredit(t *testing.T) {
require
.
NotNil
(
t
,
logs
.
FindLog
(
require
.
NotNil
(
t
,
logs
.
FindLog
(
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewMessageFilter
(
"Credit above expected amount"
),
testlog
.
NewMessageFilter
(
"Credit above expected amount"
),
testlog
.
NewAttributesFilter
(
"game
Addr
"
,
game2
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"game"
,
game2
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr3
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr3
.
Hex
()),
testlog
.
NewAttributesFilter
(
"duration"
,
"reached"
)))
testlog
.
NewAttributesFilter
(
"duration"
,
"reached"
)))
// addr4 is correct
// addr4 is correct
...
@@ -384,7 +384,7 @@ func TestCheckRecipientCredit(t *testing.T) {
...
@@ -384,7 +384,7 @@ func TestCheckRecipientCredit(t *testing.T) {
require
.
NotNil
(
t
,
logs
.
FindLog
(
require
.
NotNil
(
t
,
logs
.
FindLog
(
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewMessageFilter
(
"Credit withdrawn early"
),
testlog
.
NewMessageFilter
(
"Credit withdrawn early"
),
testlog
.
NewAttributesFilter
(
"game
Addr
"
,
game3
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"game"
,
game3
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr2
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr2
.
Hex
()),
testlog
.
NewAttributesFilter
(
"duration"
,
"unreached"
)))
testlog
.
NewAttributesFilter
(
"duration"
,
"unreached"
)))
// addr3 is not involved so no logs
// addr3 is not involved so no logs
...
@@ -392,7 +392,7 @@ func TestCheckRecipientCredit(t *testing.T) {
...
@@ -392,7 +392,7 @@ func TestCheckRecipientCredit(t *testing.T) {
require
.
NotNil
(
t
,
logs
.
FindLog
(
require
.
NotNil
(
t
,
logs
.
FindLog
(
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewMessageFilter
(
"Credit above expected amount"
),
testlog
.
NewMessageFilter
(
"Credit above expected amount"
),
testlog
.
NewAttributesFilter
(
"game
Addr
"
,
game3
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"game"
,
game3
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr4
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr4
.
Hex
()),
testlog
.
NewAttributesFilter
(
"duration"
,
"unreached"
)))
testlog
.
NewAttributesFilter
(
"duration"
,
"unreached"
)))
...
@@ -404,7 +404,7 @@ func TestCheckRecipientCredit(t *testing.T) {
...
@@ -404,7 +404,7 @@ func TestCheckRecipientCredit(t *testing.T) {
require
.
NotNil
(
t
,
logs
.
FindLog
(
require
.
NotNil
(
t
,
logs
.
FindLog
(
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewLevelFilter
(
log
.
LevelWarn
),
testlog
.
NewMessageFilter
(
"Credit above expected amount"
),
testlog
.
NewMessageFilter
(
"Credit above expected amount"
),
testlog
.
NewAttributesFilter
(
"game
Addr
"
,
game4
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"game"
,
game4
.
Proxy
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr4
.
Hex
()),
testlog
.
NewAttributesFilter
(
"recipient"
,
addr4
.
Hex
()),
testlog
.
NewAttributesFilter
(
"duration"
,
"reached"
)))
testlog
.
NewAttributesFilter
(
"duration"
,
"reached"
)))
}
}
...
...
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