beamer-bridge / beamer

Beamer - Bridging rollups with L1 inherited security
https://beamerbridge.com
MIT License
45 stars 21 forks source link

Agent config validation #1346

Open fredo opened 1 year ago

fredo commented 1 year ago

Currently we check in the token match checker if the configured rpc have the same base chain.

Instead we should do either:

a) a static analysis of the config b) analyse the config upon agent's start up and either raise or give a warning that the config does not seem fine.

Here, we could gradually enhance the check around the config if values configured makes sense.

fredo commented 1 year ago

We might need to do b) because we check against the queried chain id of the given rpcs

fredo commented 1 year ago

We realized that no direct values in the config are checked syntactically. Especially in values which are typed (i.e. int) but have a smaller range of valid values. For example: time periods can only be > 0 values.

Additionally the same sanity check should for for values we load from the deployment files (i.e. BlockNumber can only be > 0)

@istankovic will research for some generic toml and json validation approach and posts his findings here.

fredo commented 1 year ago

Additionally, when implementing this issue, we should revise the values' types in the config such as

chain id -> integer allowance -> integer

in order to safe conversions and fail upon loading and/or validation directly