Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

[DEVOPS-834] Cardano faucet package #2939

Merged
merged 35 commits into from
Aug 10, 2018
Merged

[DEVOPS-834] Cardano faucet package #2939

merged 35 commits into from
Aug 10, 2018

Conversation

commandodev
Copy link
Contributor

@commandodev commandodev commented May 16, 2018

Description

Faucet for the cardano testnet.

Linked issue

DEVOPS-834

Type of change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🛠 New feature (non-breaking change which adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
  • 🏭 Refactoring that does not change existing functionality but does improve things like code readability, structure etc
  • 🔨 New or improved tests for existing code
  • ⛑ git-flow chore (backport, hotfix, etc)

Developer checklist

  • I have read the style guide document, and my code follows the code style of this project.
  • If my code deals with exceptions, it follows the guidelines.
  • I have updated any documentation accordingly, if needed. Documentation changes can be reflected in opening a PR on cardanodocs.com, amending the inline Haddock comments, any relevant README file or one of the document listed in the docs directory.

Testing checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.

default.nix Outdated
@@ -64,7 +64,8 @@ let
executableHaskellDepends = drv.executableHaskellDepends ++ [self.cabal-install];
})));
cardano-sl-node = addGitRev super.cardano-sl-node;
cardano-sl-wallet-new = addGitRev (justStaticExecutables super.cardano-sl-wallet-new);
cardano-sl-wallet-new = addGitRev super.cardano-sl-wallet-new;
cardano-sl-wallet-new-static = justStaticExecutables cardano-sl-wallet-new;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upssing a super. on this line

default.nix Outdated
# Static linking for everything to work around
# https://ghc.haskell.org/trac/ghc/ticket/14444
# This will be the default in nixpkgs since
# https://github.com/NixOS/nixpkgs/issues/29011
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave the comments in, and move enableSharedExecutables out of the args ? src block

, servant-swagger-ui, stdenv, swagger2, text, text-format, tls, wai
, wai-cors, wai-extra, warp
}:
mkDerivation {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can probably delete this file, stack2nix handles it automatically

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was for convenience while I was developing (to get round having to regenerate pkgs/default.nix whenever I changed dependencies. I'll keep it for now, but will make a note to get rid of it and shell.nix before merging.

Copy link
Contributor

@cleverca22 cleverca22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently only looking at the nix files

@commandodev commandodev dismissed cleverca22’s stale review June 19, 2018 16:27

I think I've addressed everything apart from this informational "Only looking at the nix files" message?

@commandodev commandodev force-pushed the faucet branch 4 times, most recently from 686994b to 06ad698 Compare July 13, 2018 16:41
@@ -0,0 +1 @@
{"wallet-id":"Ae2tdPwUPEZJkLTchA9mETtyXumBT1K1gqtX3dgXUguJFLuvyNU9BzQXrEK","recovery-words":["relax","secret","seek","story","supreme","meat","judge","onion","weasel","sponsor","garlic","erase"],"address":"DdzFFzCqrhswmBoqDubnsZZpvnfFbjgwLwFyk4vC5jJJf75m36f4M3f67k4iia1RQdCUPmJHV7c9TK2ogfzjoQSYHKCoM4YTv6zrmr28","account-index":2147483648}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth pretty printing that JSON so its a bit more human readable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wasn't actually supposed to be in there. I've added it to ignore.

_statsd <- liftIO $ forkStatsd (config ^. fcStatsdOpts . _Wrapped') (fEnv ^. feStore)
liftIO $ run (config ^. fcPort) (serve faucetDocAPI server)
where
-- runLogger :: LoggerNameBox IO a -> IO a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment? Why not actually have the type sig there so the compiler can validate that it is indeed correct.

@commandodev commandodev force-pushed the faucet branch 2 times, most recently from 88fde4e to 2ce31cf Compare July 16, 2018 14:39
Copy link
Contributor

@rvl rvl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Split up the withdraw function.
  • Can we have at least one token test case?
  • Needs a little documentation.
  • Remove _dead code and commented out code
  • Remove nix files and .projectile.
  • Remove index.html
  • Copyright IOHK
  • There is a missing letter in Withdrawl

@commandodev
Copy link
Contributor Author

commandodev commented Jul 20, 2018

@rvl these would be easier to address if they were inline :-)

Split up the withdraw function.

I've split out the queue handling parts 59a71c7

Can we have at least one token test case?

I'm sure there are some parts that can be sensibly tested now

Needs a little documentation.

There are haddocks on all the main functions and swagger docs (under /docs). What form would you like the documentation in? Do you mean a better README?

Remove _dead code and commented out code

I've removed all the commented code I could find, could you review inline anymore you see and anything you think is dead? 7cabdb9

Remove nix files and .projectile.

Done a015867

Remove index.html

This is kinda handy to have around for testing purposes... Now that recaptcha is enabled you can't really test with curl or a rest client

Copyright IOHK

Done - found the remaining instance in LICENSE 3d945c6

There is a missing letter in Withdrawl

Urban dictionary informs me that "withdrawl" is

What a Southerner suffers when he moves to the North

which isn't quite what I intended. Fixed in 1c2ae37

@commandodev
Copy link
Contributor Author

commandodev commented Jul 20, 2018

Made a start on a test suite in 8741c9d

@commandodev commandodev force-pushed the faucet branch 3 times, most recently from 49b5656 to d323db0 Compare July 23, 2018 09:59
, Cardano.WalletClient
default-language: Haskell2010

executable faucet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would help with deployment if this were called cardano-faucet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure - I can change that easy enough.


main :: IO ()
main = withCompileInfo $ do
ekg <- forkServer "localhost" 8001
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be configurable with --ekg-server option, like the wallet.
You might be able to re-use option handling code from Pos.Infra.Statistics.Ekg.

@rvl
Copy link
Contributor

rvl commented Jul 24, 2018

In the config file, can the recaptcha secret key be specified as a path to a file from which the key will be read, rather than stored directly in the JSON?

@rvl
Copy link
Contributor

rvl commented Jul 25, 2018

Thanks.

Can readCaptchaSecret read just the first line of the file and not include the newline characters? (edit: never mind -- it seems to work -- the newline character is removed somewhere).

@rvl rvl changed the base branch from develop to release/1.3.0 August 7, 2018 11:24
@rvl
Copy link
Contributor

rvl commented Aug 7, 2018

Ported faucet branch from develop to release/1.3.0.

Previous version of faucet which is based off develop is on the devops-834-faucet-develop branch.

@rvl rvl changed the title DEVOPS-834 Cardano faucet package [DEVOPS-834] Cardano faucet package Aug 7, 2018
@rvl rvl changed the base branch from release/1.3.0 to release/1.3.1 August 9, 2018 13:54
@rvl rvl removed the DO NOT MERGE label Aug 9, 2018
@rvl rvl merged commit 324fbc2 into release/1.3.1 Aug 10, 2018
@rvl rvl deleted the faucet branch August 10, 2018 08:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants