xaya/taurion_gsp

Consolidate basic read-only "context" data

Closed this issue · 1 comments

A lot of functions in the core game logic need general "context" information, like a BaseMap or Params instance, or the current block height. Rather than pass around / store those things in an ad-hoc fashion whereever it is needed, we should put all that basic read-only data into a Context class and just expose that one everywhere.

The Context should hold (initially) a BaseMap, Params, the block height and the block time. For processing pending moves we should be able to create a Context that does not have a known time (and just CHECK-fails when the time would be accessed).

For testing, we also need a ContextForTesting class, which allows setting some stuff (e.g. time or block height).