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

Commit

Permalink
Merge #4183
Browse files Browse the repository at this point in the history
4183: Iohk nix r=disassembler a=disassembler

## Description

This is a complete rewrite of all the nix code in cardano-sl. Even though we don't anticipate having another release of SL, this will ease changes needed for the byron-proxy until we're able to shutdown the proxies.

[hydra jobs](https://hydra.iohk.io/jobset/Cardano/cardano-sl-pr-4183#tabs-jobs)

Task List:
- [x] add iohk-nix
- [x] switch to only building with nix-tools
- [x] cleanup of default.nix and release.nix
- [x] move launch scripts to nix directory
- [x] move tests to nix directory
- [x] fix daedalus bridge
- [x] add proposalGui to connectScripts
- [x] get validateYamlJson working again
- [x] add all connect scripts and docker images to required jobset
- [x] mapTestOn connectScripts to build for multiple platforms
- [ ] test daedalus bridge on all 3 platforms
- [ ] test wallet and explorer connectScripts on linux/mac
- [ ] test docker containers
- [ ] add all test derivations to required jobset
- [ ] fix hard-coded version/rev propagation

## Linked issue

<!--- Put here the relevant issue from YouTrack -->



Co-authored-by: Erik de Castro Lopo <[email protected]>
Co-authored-by: Samuel Leathers <[email protected]>
Co-authored-by: Moritz Angermann <[email protected]>
Co-authored-by: Michael Bishop <[email protected]>
  • Loading branch information
5 people committed Jul 12, 2019
2 parents 403e26a + 9004cce commit aaad62f
Show file tree
Hide file tree
Showing 155 changed files with 2,829 additions and 7,469 deletions.
8 changes: 4 additions & 4 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
steps:
- label: 'stack2nix'
command: 'scripts/check-stack2nix.sh'
- label: Check Hydra evaluation of release.nix
command: 'nix-build -A check-hydra lib.nix -o check-hydra.sh && ./check-hydra.sh'
agents:
system: x86_64-linux

- label: 'release.nix'
command: 'scripts/ci/check-hydra.sh'
- label: Check auto-generated Nix
command: 'nix-build -A check-nix-tools lib.nix -o check-nix-tools.sh && ./check-nix-tools.sh'
agents:
system: x86_64-linux

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,4 @@ nix/.stack.nix/*.nix linguist-generated=true
.stack-to-nix.cache linguist-generated=true
nix/.stack-pkgs.nix linguist-generated=true
script-runner/states
test-state
33 changes: 0 additions & 33 deletions .stack-to-nix.cache

This file was deleted.

19 changes: 10 additions & 9 deletions auxx/src/Lang/Lexer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ import Test.QuickCheck.Arbitrary.Generic (Arbitrary (..),
genericArbitrary, genericShrink)
import qualified Test.QuickCheck.Gen as QC
import Test.QuickCheck.Instances ()
import Text.Megaparsec (Parsec, SourcePos (..), between, choice, eof,
getPosition, manyTill, notFollowedBy, parseMaybe,
skipMany, takeP, takeWhile1P, try, unPos, (<?>))
import Text.Megaparsec.Char (anyChar, char, satisfy, spaceChar,
import Text.Megaparsec (Parsec, SourcePos (..), anySingle, between,
choice, eof, getSourcePos, manyTill, notFollowedBy,
parseMaybe, satisfy, skipMany, takeP, takeWhile1P, try,
unPos, (<?>))
import Text.Megaparsec.Char (char, spaceChar,
string)
import Text.Megaparsec.Char.Lexer (decimal, scientific, signed)

Expand Down Expand Up @@ -177,13 +178,13 @@ pToken = withPosition (try pToken' <|> pUnknown) <* pSkip
( fromIntegral . unPos $ sourceLine
, fromIntegral . unPos $ sourceColumn)
withPosition p = do
pos1 <- posToLoc <$> getPosition
pos1 <- posToLoc <$> getSourcePos
t <- p
pos2 <- posToLoc <$> getPosition
pos2 <- posToLoc <$> getSourcePos
return (spanFromTo pos1 pos2, t)

pUnknown :: Lexer Token
pUnknown = TokenUnknown . UnknownChar <$> anyChar
pUnknown = TokenUnknown . UnknownChar <$> anySingle

pSkip :: Lexer ()
pSkip = skipMany (void spaceChar)
Expand Down Expand Up @@ -223,7 +224,7 @@ pText = do
where
loop :: [Char] -> Lexer [Char]
loop !acc = do
next <- anyChar
next <- anySingle
case next of
-- Check for double double quotes. If it's a single double quote,
-- it's the end of the string.
Expand Down Expand Up @@ -287,7 +288,7 @@ pFilePath = FilePath' <$> do
where
pFilePathChar :: Lexer Char
pFilePathChar =
char '\\' *> anyChar <|>
char '\\' *> anySingle <|>
satisfy isFilePathChar

pIdent :: Lexer Token
Expand Down
30 changes: 15 additions & 15 deletions cabal.project.freeze
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ constraints: Cabal ==2.2.0.1,
auto-update ==0.1.4,
base16-bytestring ==0.1.1.6,
base58-bytestring ==0.1.0,
base64-bytestring ==1.0.0.1,
base64-bytestring ==1.0.0.2,
basement ==0.0.8,
beam-core ==0.7.2.2,
beam-migrate ==0.3.2.1,
Expand All @@ -48,14 +48,14 @@ constraints: Cabal ==2.2.0.1,
dns ==3.0.4,
docopt ==0.7.0.5,
ekg ==0.4.0.15,
ekg-core ==0.1.1.4,
ekg-core ==0.1.1.6,
ekg-statsd ==0.2.4.0,
ekg-wai ==0.1.0.3,
engine-io ==1.2.21,
engine-io-wai ==1.0.9,
ether ==0.5.1.0,
exceptions ==0.10.0,
extra ==1.6.13,
extra ==1.6.14,
fgl ==5.6.0.0,
file-embed ==0.0.10.1,
filelock ==0.1.1.2,
Expand All @@ -76,14 +76,14 @@ constraints: Cabal ==2.2.0.1,
hspec-core ==2.5.5,
hspec-expectations-lifted ==0.10.0,
http-api-data ==0.3.8.1,
http-client ==0.5.13.1,
http-client ==0.5.14,
http-client-tls ==0.3.5.3,
http-conduit ==2.3.2,
http-media ==0.7.1.3,
http-types ==0.12.2,
insert-ordered-containers ==0.2.1.0,
ip ==1.3.0,
iproute ==1.7.6,
iproute ==1.7.7,
ixset-typed ==0.4.0.1,
kademlia ==1.1.0.1,
katip ==0.6.3.0,
Expand All @@ -93,23 +93,23 @@ constraints: Cabal ==2.2.0.1,
lifted-base ==0.2.3.12,
loc ==0.1.3.3,
log-warper ==1.8.10.1,
lrucache ==1.2.0.0,
lrucache ==1.2.0.1,
lzma-conduit ==1.2.1,
megaparsec ==6.5.0,
megaparsec ==7.0.4,
memory ==0.14.18,
mmorph ==1.1.2,
monad-control ==1.0.2.3,
mono-traversable ==1.0.9.0,
mono-traversable ==1.0.10.0,
mwc-random ==0.13.6.0,
neat-interpolation ==0.3.2.2,
neat-interpolation ==0.3.2.4,
network ==2.6.3.6,
network-info ==0.2.0.10,
network-transport ==0.5.2,
network-transport-inmemory ==0.5.1,
network-transport-tcp ==0.6.0,
normaldistribution ==1.1.0.3,
optparse-applicative ==0.14.3.0,
optparse-simple ==0.1.0,
optparse-simple ==0.1.1,
parser-combinators ==1.0.0,
parsers ==0.12.9,
pipes ==4.3.9,
Expand All @@ -128,7 +128,7 @@ constraints: Cabal ==2.2.0.1,
rocksdb-haskell-ng ==0.0.0,
safe ==0.3.17,
safe-exceptions ==0.1.7.0,
safecopy ==0.9.4.1,
safecopy ==0.9.4.3,
scientific ==0.3.6.2,
scrypt ==0.5.0,
serokell-util ==0.9.0,
Expand Down Expand Up @@ -164,15 +164,15 @@ constraints: Cabal ==2.2.0.1,
transformers-base ==0.4.5.2,
transformers-lift ==0.2.0.1,
trifecta ==2,
turtle ==1.5.12,
turtle ==1.5.13,
universum ==1.2.0,
unix-compat ==0.5.1,
unliftio ==0.2.8.1,
unliftio ==0.2.9.0,
unliftio-core ==0.1.2.0,
unordered-containers ==0.2.9.0,
uuid ==1.3.13,
validation ==1,
vector ==0.12.0.1,
vector ==0.12.0.2,
vty ==5.21,
wai ==3.2.1.2,
wai-app-static ==3.1.6.2,
Expand All @@ -181,7 +181,7 @@ constraints: Cabal ==2.2.0.1,
wai-middleware-throttle ==0.3.0.0,
warp ==3.2.25,
warp-tls ==3.2.4.3,
wreq ==0.5.2.1,
wreq ==0.5.3.1,
x509 ==1.7.5,
x509-store ==1.6.7,
x509-validation ==1.6.11,
Expand Down
2 changes: 1 addition & 1 deletion chain/cardano-sl-chain.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ library
, mono-traversable
, mtl
, neat-interpolation
, parsec
, megaparsec
, QuickCheck
, reflection
, safecopy
Expand Down
4 changes: 2 additions & 2 deletions chain/src/Pos/Chain/Security/Params.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Data.Aeson.Options (defaultOptions)
import qualified Data.Aeson.Types as A
import Data.Default (Default (..))
import qualified Data.Text as T
import qualified Text.Parsec as Parsec
import qualified Text.Megaparsec as Parsec

import Pos.Core.Common (StakeholderId)
import Pos.Core.NetworkAddress (NetworkAddress, addrParser)
Expand Down Expand Up @@ -99,4 +99,4 @@ instance Exception NodeAttackedError

parseNetworkAddress :: A.Value -> A.Parser NetworkAddress
parseNetworkAddress = A.withText "NetworkAddress" $ \s ->
toAesonError . over _Left show $ Parsec.parse addrParser "" s
toAesonError . over _Left show $ Parsec.parse addrParser "" (toString s)
2 changes: 1 addition & 1 deletion cluster/cardano-sl-cluster.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ library
, iproute
, lens
, optparse-applicative
, parsec
, megaparsec
, safe
, servant-client
, temporary
Expand Down
4 changes: 2 additions & 2 deletions cluster/src/Cardano/Cluster/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import qualified Options.Applicative as Parser
import Options.Applicative.Help.Chunk (Chunk (..))
import qualified Safe
import Servant.Client (BaseUrl (..), Scheme (..))
import qualified Text.Parsec as Parsec
import qualified Text.Megaparsec as Parsec

import Pos.Core.NetworkAddress (NetworkAddress, addrParser)
import Pos.Infra.Network.DnsDomains (NodeAddr (..))
Expand Down Expand Up @@ -238,7 +238,7 @@ unsafeIntFromString str =

unsafeNetworkAddressFromString :: String -> NetworkAddress
unsafeNetworkAddressFromString str =
case Parsec.parse addrParser "" (toText str) of
case Parsec.parse addrParser "" str of
Left err ->
error $ "Tried to convert a 'String' to a 'NetworkAddress' but failed: "
<> toText str <> ", " <> show err
Expand Down
2 changes: 1 addition & 1 deletion core/cardano-sl-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ library
, hashable
, http-api-data
, lens
, parsec
, megaparsec
, memory
, mmorph
, monad-control
Expand Down
9 changes: 5 additions & 4 deletions core/src/Pos/Core/NetworkAddress.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import qualified Serokell.Util.Parse as P
-- We should really be using Megaparsec here instead of Parsec, but that
-- requires 'Serokell.Util.Parse' to be modified to use Parsec and then
-- have that dependency bubble up.
import qualified Text.Parsec as P
import qualified Text.Parsec.Text as P
import Text.Megaparsec (ParsecT)
import qualified Text.Megaparsec as P
import qualified Text.Megaparsec.Char as P


-- | @"127.0.0.1"@.
Expand All @@ -24,11 +25,11 @@ localhost = "127.0.0.1"
type NetworkAddress = (ByteString, Word16)

-- | Parsed for network address in format @host:port@.
addrParser :: P.Parser NetworkAddress
addrParser :: ParsecT () String m NetworkAddress
addrParser = (,) <$> (encodeUtf8 <$> P.host) <*> (P.char ':' *> P.port) <* P.eof

-- | Parses an IPv4 NetworkAddress where the host is not 0.0.0.0.
addrParserNoWildcard :: P.Parser NetworkAddress
addrParserNoWildcard :: ParsecT () String m NetworkAddress
addrParserNoWildcard = do
(host, port) <- addrParser
if host == BS8.pack "0.0.0.0" then empty
Expand Down
Loading

0 comments on commit aaad62f

Please sign in to comment.