Commit 2a9c6cc7 authored by Adrian Sutton's avatar Adrian Sutton

op-challenger: Rename Game to GamePlayer

parent f721de84
......@@ -24,21 +24,21 @@ type GameInfo interface {
LogGameInfo(ctx context.Context)
}
type Game struct {
type GamePlayer struct {
agent Actor
agreeWithProposedOutput bool
caller GameInfo
logger log.Logger
}
func NewGame(
func NewGamePlayer(
ctx context.Context,
logger log.Logger,
cfg *config.Config,
addr common.Address,
txMgr txmgr.TxManager,
client *ethclient.Client,
) (*Game, error) {
) (*GamePlayer, error) {
logger = logger.New("game", addr)
contract, err := bindings.NewFaultDisputeGameCaller(addr, client)
if err != nil {
......@@ -85,7 +85,7 @@ func NewGame(
return nil, fmt.Errorf("failed to bind the fault contract: %w", err)
}
return &Game{
return &GamePlayer{
agent: NewAgent(loader, int(gameDepth), provider, responder, updater, cfg.AgreeWithProposedOutput, logger),
agreeWithProposedOutput: cfg.AgreeWithProposedOutput,
caller: caller,
......@@ -93,7 +93,7 @@ func NewGame(
}, nil
}
func (g *Game) ProgressGame(ctx context.Context) bool {
func (g *GamePlayer) ProgressGame(ctx context.Context) bool {
g.logger.Trace("Checking if actions are required")
if err := g.agent.Act(ctx); err != nil {
g.logger.Error("Error when acting on game", "err", err)
......
......@@ -84,7 +84,7 @@ func TestProgressGame_LogErrorWhenGameLost(t *testing.T) {
}
}
func setupProgressGameTest(t *testing.T, agreeWithProposedRoot bool) (*testlog.CapturingHandler, *Game, *stubActor, *stubGameInfo) {
func setupProgressGameTest(t *testing.T, agreeWithProposedRoot bool) (*testlog.CapturingHandler, *GamePlayer, *stubActor, *stubGameInfo) {
logger := testlog.Logger(t, log.LvlDebug)
handler := &testlog.CapturingHandler{
Delegate: logger.GetHandler(),
......@@ -92,7 +92,7 @@ func setupProgressGameTest(t *testing.T, agreeWithProposedRoot bool) (*testlog.C
logger.SetHandler(handler)
actor := &stubActor{}
gameInfo := &stubGameInfo{}
game := &Game{
game := &GamePlayer{
agent: actor,
agreeWithProposedOutput: agreeWithProposedRoot,
caller: gameInfo,
......
......@@ -47,7 +47,7 @@ func NewService(ctx context.Context, logger log.Logger, cfg *config.Config) (*se
loader := NewGameLoader(factory)
monitor := newGameMonitor(logger, client.BlockNumber, cfg.GameAddress, loader, func(addr common.Address) (gameAgent, error) {
return NewGame(ctx, logger, cfg, addr, txMgr, client)
return NewGamePlayer(ctx, logger, cfg, addr, txMgr, client)
})
return &service{
monitor: monitor,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment