Skip to content

Commit 40987d9

Browse files
committed
Push intermediate version of Stats3
1 parent e2b8169 commit 40987d9

14 files changed

Lines changed: 477 additions & 106 deletions

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ARG PROMETHEUS_MULTIPROC_DIR="/tmp/prometheus_multiproc"
1818
MAINTAINER Max Planck Institute for Security and Privacy
1919
LABEL org.opencontainers.image.authors="Max Planck Institute for Security and Privacy"
2020
# NOTE Also change the version in config.py
21-
LABEL org.opencontainers.image.version="2.1.2"
21+
LABEL org.opencontainers.image.version="2.1.3"
2222
LABEL org.opencontainers.image.licenses="AGPL-3.0-only"
2323
LABEL org.opencontainers.image.description="Ready to deploy Docker container to use ReverSim for research. ReverSim is an open-source environment for the browser, originally developed at the Max Planck Institute for Security and Privacy (MPI-SP) to study human aspects in hardware reverse engineering."
2424
LABEL org.opencontainers.image.source="https://github.com/emsec/ReverSim"

app/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ def loadGameConfig(configName: str = "conf/gameConfig.json", instanceFolder: str
2020
__gameConfig = GameConfig(instanceFolder=instanceFolder, configName=configName)
2121

2222

23+
def setGameConfig(config: GameConfig):
24+
global __gameConfig
25+
__gameConfig = config
26+
27+
2328
@functools.wraps(GameConfig.groups)
2429
def groups() -> Dict[str, Any]:
2530
assert __gameConfig is not None

app/gameConfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# CONFIG Current Log File Version.
1818
# NOTE Also change this in the Dockerfile
19-
LOGFILE_VERSION = "2.1.0" # Major.Milestone.Subversion
19+
LOGFILE_VERSION = "2.1.3" # Major.Milestone.Subversion
2020

2121
PSEUDONYM_LENGTH = 32
2222
LEVEL_ENCODING = 'UTF-8' # was Windows-1252

app/model/Participant.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,8 +855,8 @@ def sessionState(self, timeStamp: int):
855855
"""Called in the PreloadScene to determine if the game is already running or if this is the first session"""
856856
self.logger.writeToLog(EventType.StartSession, '', timeStamp)
857857

858-
state = {
859-
'scene': self.getPhaseName() if self.startedGame else 'not started',
858+
state: dict[str, str] = {
859+
'scene': self.getPhaseName() if self.startedGame else PhaseType.NotStarted,
860860
'firstSession': 'yes' if self.packetIndex == 0 else 'no',
861861
}
862862

app/statistics3/GameStateValidator.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,24 @@ class GameStateValidator:
55
"""
66

77
# TODO
8+
9+
10+
def validate():
11+
12+
# The phase from the game state
13+
assert statsParticipant.phaseIdx is not None
14+
gamestate_phase = player.phases[statsParticipant.phaseIdx]
15+
16+
# Check that the phase type matches what was shown during the game
17+
if gamestate_phase.name != phaseType:
18+
raise LogValidationError(f'{phaseType} does not match the gamestate {gamestate_phase.name}')
19+
20+
# Assert that a phase with levels really has levels
21+
assert phaseType in PHASES_WITH_LEVELS and len(gamestate_phase.levels) > 0, (
22+
f'Phase {phaseType} is expected to have no levels, but gameState has {len(gamestate_phase.levels)}'
23+
)
24+
25+
# Assert that a phase without levels really has no levels
26+
assert phaseType not in PHASES_WITH_LEVELS and len(gamestate_phase.levels) < 1, (
27+
f'Phase {phaseType} is expected to have levels, but gameState has 0'
28+
)

0 commit comments

Comments
 (0)