-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime ENVironment configuration #179
Conversation
"local" -> Right Local | ||
s -> Left $ TextDecodingError $ | ||
T.unpack s <> " is neither \"mainnet\", \"testnet\", \"staging\" \ | ||
\nor \"local\"." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to Cardano.Environment
@@ -64,4 +66,4 @@ spec = do | |||
threadDelay 1000000 | |||
(handle,) <$> (mkWalletLayer | |||
<$> MVar.newDBLayer | |||
<*> HttpBridge.newNetworkLayer "testnet" port) | |||
<*> HttpBridge.newNetworkLayer Testnet port) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing this… 🤔 won't this lead to inconsistencies between the network layers and the CLI param in future tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm.. I am not sure to see what you mean here? There's no more "--network" in the CLI, and the CLI itself reads the environment to get this network value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we call mkStdTx
the protocol magic it uses will depend on network
and the ENV var. If we ever create a network layer with a custom network, like here (Testnet
), we can never safely use the two together.
Would it be possible to have one network
for the entire integration tests?
Also:
- Does the choice of network matter for the integration tests? (Could we default to
testnet
everywhere and be done with it?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Anviking Hmm... That's not possible no, because we are running some integration tests against testnet, but some against a local cluster (the scenarios) because we need the ability to have faucets wallets there, and submit transactions at will.
So yeah, if the application is configured with a protocol magic / network that is different from the one used by the bridge, we can an error; but that's pretty much what we have already anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
-- | ||
-- ENV[NETWORK] = ? | ||
-- | ||
-- What about trying to provide a valid ENV var `NETWORK=value cardano-wallet-launcher` ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this error be presentet using stack exec -- cardano-wallet server ....
as well? If it will be, maybe this error message will be missleading as it constrains only to cardano-wallet-launcher
binary
EDIT: I see command is not hardcoded - so everything is ok
deriving (Generic, Show, Eq, Enum) | ||
|
||
instance FromText Network where | ||
fromText = \case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess both FromText
and ToText
instances can be made more generic by using Show and Read classes - but Network
seems so small and selfcontained that I don't find that necessary
-- Note that the 'ProtocolMagic' for 'Local' and 'Testnet' are the same. | ||
protocolMagic :: Network -> ProtocolMagic | ||
protocolMagic = \case | ||
Mainnet -> ProtocolMagic 764824073 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope these hardcoded values are right - because I am not sure where to look up for the proof/source that these are the right numbers?
Maybe it would be usefull for other readers to add a comment where from or why these specific numbers were picked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I am not even sure where I got them from :| ... I think I now mostly go for the ~/.hermes configuration files generated by the http bridge to be honest...
….CLI to Cardano.Environment
7a9d3b7
to
4931fb5
Compare
Issue Number
#95
Overview
Comments
Deprecates #162