shutter-network / rolling-shutter

Rolling Shutter is an MEV protection system to be plugged into rollups.
https://twitter.com/project_shutter/
26 stars 7 forks source link

Database Refactoring #420

Closed ezdac closed 7 months ago

ezdac commented 7 months ago

Before, the database schemas were defined in one directory and code generation was configured with one sqlc.yaml file. The database schema validation was only conducted against the most specific schema definition for the command that was invoked (e.g. the "collator" schema). This ignored schema changes for definitions that were used across commands, like "chainobsdb" or the keyper database definition.

Now the code generation is split up in multiple sqlc modules that have the same folder structure. The location of the sql and sqlc files for each individual database module lies within the go package that uses the database the most. Additionally, database definitions now comply to an interface Definition and they are created at initialisation time. The definitions are used to initialise and validate the database. An implementation AggregateDefinition can be used to wrap multiple database module definitions in one Definition and thus combine (hierarchical) definitions into one flat set of database modules. This allows to check for the schema versions of all database modules.

ezdac commented 7 months ago

rs-lint seems to run out of memory on CI

ezdac commented 7 months ago

CI memory increase to medium+ helped.