Refactored Flood Manager

- Made its logic less convoluted.
- Added stub support for test goals.
- Fixed metadata overriding bug.
Added JSON Schema based goals

Goals are defined per Flood phase. Failing to reach a goal results in an immediate halt.
Tiny fixes