Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
teku
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
vicotor
teku
Commits
76fec17e
Commit
76fec17e
authored
Jul 17, 2025
by
luxq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update file
parent
a946b8e6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
136 additions
and
3 deletions
+136
-3
build.gradle
attacker/build.gradle
+1
-0
build.gradle
attacker/client/build.gradle
+10
-0
AttackService.java
...c/main/java/tech/pegasys/teku/attacker/AttackService.java
+1
-2
AttackerCommand.java
...main/java/tech/pegasys/teku/attacker/AttackerCommand.java
+55
-0
AttackerResponse.java
...ain/java/tech/pegasys/teku/attacker/AttackerResponse.java
+68
-0
JsonRpcClientUtil.java
...in/java/tech/pegasys/teku/attacker/JsonRpcClientUtil.java
+1
-1
No files found.
attacker/build.gradle
0 → 100644
View file @
76fec17e
jar
{
enabled
=
false
}
attacker/client/build.gradle
0 → 100644
View file @
76fec17e
repositories
{
mavenCentral
()
// Ensure Maven Central is included
}
dependencies
{
implementation
project
(
':infrastructure:async'
)
implementation
'com.github.briandilley.jsonrpc4j:jsonrpc4j:1.7'
implementation
'com.fasterxml.jackson.core:jackson-annotations:2.15.2'
}
description
=
'Teku Attacker Client'
\ No newline at end of file
attacker/client/src/main/java/tech/pegasys/teku/attacker
2
/AttackService.java
→
attacker/client/src/main/java/tech/pegasys/teku/attacker/AttackService.java
View file @
76fec17e
package
tech
.
pegasys
.
teku
.
attacker
2
;
package
tech
.
pegasys
.
teku
.
attacker
;
import
com.googlecode.jsonrpc4j.JsonRpcHttpClient
;
import
tech.pegasys.teku.attacker.client.*
;
import
tech.pegasys.teku.infrastructure.async.SafeFuture
;
public
class
AttackService
{
...
...
attacker/client/src/main/java/tech/pegasys/teku/attacker/AttackerCommand.java
0 → 100644
View file @
76fec17e
/*
* Copyright Consensys Software Inc., 2025
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package
tech
.
pegasys
.
teku
.
attacker
;
import
com.fasterxml.jackson.annotation.JsonCreator
;
import
com.fasterxml.jackson.annotation.JsonValue
;
/**
* AttackerCommand defines the command types that can be returned by the attacker client API. This
* matches the Go implementation in tsinghua-cel/attacker-client-go/client/type.go.
*/
public
enum
AttackerCommand
{
CMD_NULL
(
0
),
CMD_CONTINUE
(
1
),
CMD_RETURN
(
2
),
CMD_ABORT
(
3
),
CMD_SKIP
(
4
),
CMD_ROLE_TO_NORMAL
(
5
),
// Role changes to normal node
CMD_ROLE_TO_ATTACKER
(
6
),
// Role changes to attacker
CMD_EXIT
(
7
),
CMD_UPDATE_STATE
(
8
),
CMP_DELAY_BROAD_CAST
(
9
);
private
final
int
value
;
AttackerCommand
(
int
value
)
{
this
.
value
=
value
;
}
@JsonValue
public
int
getValue
()
{
return
value
;
}
@JsonCreator
public
static
AttackerCommand
fromValue
(
int
value
)
{
for
(
AttackerCommand
command
:
AttackerCommand
.
values
())
{
if
(
command
.
value
==
value
)
{
return
command
;
}
}
throw
new
IllegalArgumentException
(
"Unknown AttackerCommand value: "
+
value
);
}
}
attacker/client/src/main/java/tech/pegasys/teku/attacker/AttackerResponse.java
0 → 100644
View file @
76fec17e
/*
* Copyright Consensys Software Inc., 2025
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package
tech
.
pegasys
.
teku
.
attacker
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
/**
* AttackerResponse defines the response from the attacker client API. This matches the Go
* implementation in tsinghua-cel/attacker-client-go/client/type.go.
*/
public
class
AttackerResponse
{
@JsonProperty
(
"cmd"
)
private
AttackerCommand
cmd
;
@JsonProperty
(
"result"
)
private
String
result
;
public
AttackerResponse
()
{
// Default constructor for Jackson deserialization
}
public
AttackerResponse
(
AttackerCommand
cmd
,
String
result
)
{
this
.
cmd
=
cmd
;
this
.
result
=
result
;
}
public
AttackerCommand
getCmd
()
{
return
cmd
;
}
public
String
getResult
()
{
return
result
;
}
/**
* Convenience method to check if the command is CMD_CONTINUE.
*
* @return true if the command is CMD_CONTINUE, false otherwise
*/
public
boolean
shouldContinue
()
{
return
cmd
==
AttackerCommand
.
CMD_CONTINUE
;
}
/**
* Convenience method to check if the command is CMD_ABORT.
*
* @return true if the command is CMD_ABORT, false otherwise
*/
public
boolean
shouldAbort
()
{
return
cmd
==
AttackerCommand
.
CMD_ABORT
;
}
@Override
public
String
toString
()
{
return
"AttackerResponse{"
+
"cmd="
+
cmd
+
", result='"
+
result
+
'\''
+
'}'
;
}
}
attacker/client/src/main/java/tech/pegasys/teku/attacker
2
/JsonRpcClientUtil.java
→
attacker/client/src/main/java/tech/pegasys/teku/attacker/JsonRpcClientUtil.java
View file @
76fec17e
package
tech
.
pegasys
.
teku
.
attacker
2
;
package
tech
.
pegasys
.
teku
.
attacker
;
import
com.googlecode.jsonrpc4j.JsonRpcHttpClient
;
...
...
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