l1 and builder_port here are used to set a different value into the default config. This would be troublesome if we keep adding parameters in this constructor. For example, we need a TestNetwork with a specific relay-state-url, so this constructor will be like:
And every time we change the constructor, we need to do a minor fix on the other places where it is being used. This is also not a good idea for reviewing.
Currently we use this constructor a lot:
l1
andbuilder_port
here are used to set a different value into the default config. This would be troublesome if we keep adding parameters in this constructor. For example, we need aTestNetwork
with a specificrelay-state-url
, so this constructor will be like:And every time we change the constructor, we need to do a minor fix on the other places where it is being used. This is also not a good idea for reviewing.
So I prefer using a constructor like this:
We can invoke the
TestNetwork
after we set the config. It is clear and more elegant. People will easily know how the TestNetwork looks like.Also we can use the builder pattern to construct a
TestConfig
. That would be like: