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

Commit

Permalink
Merge branch 'release/1.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Oct 16, 2018
2 parents 0d22897 + 3fa92ec commit 8f750bb
Show file tree
Hide file tree
Showing 390 changed files with 14,575 additions and 16,732 deletions.
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ GTAGS
GRTAGS
GPATH
TAGS
.projectile

# Vim
tags*
Expand Down Expand Up @@ -103,7 +104,6 @@ result*
# remove when done debugging
1.1.1-1-w/


# Created by https://www.gitignore.io/api/python

### Python ###
Expand Down Expand Up @@ -207,3 +207,13 @@ venv.bak/
.mypy_cache/

# End of https://www.gitignore.io/api/python

# Don't include config files with sensitive data or tls certs
/faucet/test-config.json
/faucet/tls/*
/faucet/wallet-source.json
/faucet/existing-wallet-details.json
/faucet/generated-wallet-details.json
/faucet/default.nix
/faucet/shell.nix
/faucet/recaptcha-secret.txt
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# CHANGELOG

## Cardano SL 1.3.1

### Features

- Add genesis data for the Cardano SL public Testnet. ([#3265](https://github.com/input-output-hk/cardano-sl/pull/3265), [#3349](https://github.com/input-output-hk/cardano-sl/pull/3349), [#3585](https://github.com/input-output-hk/cardano-sl/pull/3585), DEVOPS-398)

- Add a "faucet" API to dispense Testnet Ada to users. ([#2939](https://github.com/input-output-hk/cardano-sl/pull/2939), DEVOPS-834)

- Support additional fields for Daedalus bug reports in the report server. ([#3394](https://github.com/input-output-hk/cardano-sl/pull/3394), TSD-116)

### Fixes

- Fix a case where the error reporting system can cause the node to stop syncing. ([#3294](https://github.com/input-output-hk/cardano-sl/pull/3294), CDEC-469, CDEC-439)

- Adjust the address format to distinguish testnet and mainnet addresses. ([#3540](https://github.com/input-output-hk/cardano-sl/pull/3540), [#3556](https://github.com/input-output-hk/cardano-sl/pull/3556), [#3558](https://github.com/input-output-hk/cardano-sl/pull/3558), [#3561](https://github.com/input-output-hk/cardano-sl/pull/3561), [#3578](https://github.com/input-output-hk/cardano-sl/pull/3578), [#3583](https://github.com/input-output-hk/cardano-sl/pull/3583), [#3618](https://github.com/input-output-hk/cardano-sl/pull/3618), [#3659](https://github.com/input-output-hk/cardano-sl/pull/3659), [#3685](https://github.com/input-output-hk/cardano-sl/pull/3685), CO-353, CO-354)

- Add a workaround for the RocksDB issue which prevented Daedalus Windows users with non-ASCII usernames from starting the wallet. ([#3465](https://github.com/input-output-hk/cardano-sl/pull/3465), CBR-391)

- Add support to cardano-sl-launcher for launching Daedalus in "safe mode". ([#3421](https://github.com/input-output-hk/cardano-sl/pull/3421), DDW-380)

- Fix the x509 certificate generation tool to allow using IP addresses as subject alternate names. ([#3390](https://github.com/input-output-hk/cardano-sl/pull/3390), DEVOPS-992)

- Fix display of the git version in Cardano Explorer. ([#3386](https://github.com/input-output-hk/cardano-sl/pull/3386), DEVOPS-999)

- Update Windows build script to use a newer openssl version. ([#3397](https://github.com/input-output-hk/cardano-sl/pull/3397), DEVOPS-1003)

- Fix a build system issue which caused slow builds. ([#3622](https://github.com/input-output-hk/cardano-sl/pull/3622), DEVOPS-916)


## Cardano SL 1.3.0 (Mainnet)

### Features
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ before_test:
$env:PATH="$env:PATH;C:\ghc\ghc-8.2.2\bin"
# Install OpenSSL 1.0.2 (see https://github.com/appveyor/ci/issues/1665)
- ps: (New-Object Net.WebClient).DownloadFile('https://slproweb.com/download/Win64OpenSSL-1_0_2o.exe', "$($env:USERPROFILE)\Win64OpenSSL.exe")
- ps: (New-Object Net.WebClient).DownloadFile('https://slproweb.com/download/Win64OpenSSL-1_0_2p.exe', "$($env:USERPROFILE)\Win64OpenSSL.exe")
- ps: cmd /c start /wait "$($env:USERPROFILE)\Win64OpenSSL.exe" /silent /verysilent /sp- /suppressmsgboxes /DIR=C:\OpenSSL-Win64-v102
- ps: Install-Product node 6
# Install stack
Expand Down
2 changes: 1 addition & 1 deletion auxx/cardano-sl-auxx.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cardano-sl-auxx
version: 1.3.0
version: 1.3.1
synopsis: Cardano SL - Auxx
description: Cardano SL - Auxx
license: MIT
Expand Down
4 changes: 3 additions & 1 deletion auxx/src/Command/BlockGen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import System.Wlog (logInfo)
import Pos.AllSecrets (mkAllSecretsSimple)
import Pos.Client.KeyStorage (getSecretKeysPlain)
import Pos.Core (gdBootStakeholders, genesisData)
import Pos.Core.NetworkMagic (makeNetworkMagic)
import Pos.Crypto (ProtocolMagic, encToSecret)
import Pos.Generator.Block (BlockGenParams (..), genBlocks, tgpTxCountRange)
import Pos.Infra.StateLock (Priority (..), withStateLock)
Expand All @@ -30,7 +31,8 @@ generateBlocks pm GenBlocksParams{..} = withStateLock HighPriority ApplyBlock $
seed <- liftIO $ maybe randomIO pure bgoSeed
logInfo $ "Generating with seed " <> show seed

allSecrets <- mkAllSecretsSimple . map encToSecret <$> getSecretKeysPlain
let nm = makeNetworkMagic pm
allSecrets <- mkAllSecretsSimple nm . map encToSecret <$> getSecretKeysPlain

let bgenParams =
BlockGenParams
Expand Down
33 changes: 20 additions & 13 deletions auxx/src/Command/Proc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import qualified Text.JSON.Canonical as CanonicalJSON

import Pos.Client.KeyStorage (addSecretKey, getSecretKeysPlain)
import Pos.Client.Txp.Balances (getBalance)
import Pos.Core (AddrStakeDistribution (..), Address, HeavyDlgIndex (..),
SoftwareVersion (..), StakeholderId, addressHash, mkMultiKeyDistr,
unsafeGetCoin)
import Pos.Core (AddrStakeDistribution (..), HeavyDlgIndex (..), SoftwareVersion (..),
StakeholderId, addressHash, mkMultiKeyDistr, unsafeGetCoin)
import Pos.Core.Common (AddrAttributes (..), AddrSpendingData (..), makeAddress)
import Pos.Core.Configuration (genesisSecretKeys)
import Pos.Core.NetworkMagic (makeNetworkMagic)
import Pos.Core.Txp (TxOut (..))
import Pos.Crypto (ProtocolMagic, PublicKey, emptyPassphrase, encToPublic, fullPublicKeyF,
hashHexF, noPassEncrypt, safeCreatePsk, unsafeCheatingHashCoerce,
Expand Down Expand Up @@ -93,6 +93,8 @@ createCommandProcs mpm hasAuxxMode printAction mDiffusion = rights . fix $ \comm

let name = "addr" in
needsAuxxMode name >>= \Dict ->
needsProtocolMagic name >>= \pm ->
let nm = makeNetworkMagic pm in
return CommandProc
{ cpName = name
, cpArgumentPrepare = map
Expand All @@ -103,9 +105,9 @@ createCommandProcs mpm hasAuxxMode printAction mDiffusion = rights . fix $ \comm
, cpExec = \(pk', mDistr) -> do
pk <- toLeft pk'
addr <- case mDistr of
Nothing -> makePubKeyAddressAuxx pk
Nothing -> makePubKeyAddressAuxx nm pk
Just distr -> return $
makeAddress (PubKeyASD pk) (AddrAttributes Nothing distr)
makeAddress (PubKeyASD pk) (AddrAttributes Nothing distr nm)
return $ ValueAddress addr
, cpHelp = "address for the specified public key. a stake distribution \
\ can be specified manually (by default it uses the current epoch \
Expand All @@ -114,6 +116,7 @@ createCommandProcs mpm hasAuxxMode printAction mDiffusion = rights . fix $ \comm

let name = "addr-hd" in
needsAuxxMode name >>= \Dict ->
needsProtocolMagic name >>= \pm ->
return CommandProc
{ cpName = name
, cpArgumentPrepare = identity
Expand All @@ -123,7 +126,8 @@ createCommandProcs mpm hasAuxxMode printAction mDiffusion = rights . fix $ \comm
sk <- evaluateWHNF (sks !! i) -- WHNF is sufficient to force possible errors
-- from using (!!). I'd use NF but there's no
-- NFData instance for secret keys.
addrHD <- deriveHDAddressAuxx sk
let nm = makeNetworkMagic pm
addrHD <- deriveHDAddressAuxx nm sk
return $ ValueAddress addrHD
, cpHelp = "address of the HD wallet for the specified public key"
},
Expand Down Expand Up @@ -181,12 +185,16 @@ createCommandProcs mpm hasAuxxMode printAction mDiffusion = rights . fix $ \comm

let name = "balance" in
needsAuxxMode name >>= \Dict ->
needsProtocolMagic name >>= \pm ->
let nm = makeNetworkMagic pm in
return CommandProc
{ cpName = name
, cpArgumentPrepare = identity
, cpArgumentConsumer = getArg (tyAddress `tyEither` tyPublicKey `tyEither` tyInt) "addr"
, cpExec = \addr' -> do
addr <- toLeft addr'
addr <- case addr' of
Left a -> pure a
Right pki -> makePubKeyAddressAuxx nm =<< toLeft pki
balance <- getBalance addr
return $ ValueNumber (fromIntegral . unsafeGetCoin $ balance)
, cpHelp = "check the amount of coins on the specified address"
Expand Down Expand Up @@ -465,6 +473,8 @@ createCommandProcs mpm hasAuxxMode printAction mDiffusion = rights . fix $ \comm

let name = "listaddr" in
needsAuxxMode name >>= \Dict ->
needsProtocolMagic name >>= \pm ->
let nm = makeNetworkMagic pm in
return CommandProc
{ cpName = name
, cpArgumentPrepare = identity
Expand All @@ -474,8 +484,8 @@ createCommandProcs mpm hasAuxxMode printAction mDiffusion = rights . fix $ \comm
printAction "Available addresses:"
for_ (zip [0 :: Int ..] sks) $ \(i, sk) -> do
let pk = encToPublic sk
addr <- makePubKeyAddressAuxx pk
addrHD <- deriveHDAddressAuxx sk
addr <- makePubKeyAddressAuxx nm pk
addrHD <- deriveHDAddressAuxx nm sk
printAction $
sformat (" #"%int%": addr: "%build%"\n"%
" pk: "%fullPublicKeyF%"\n"%
Expand All @@ -484,7 +494,7 @@ createCommandProcs mpm hasAuxxMode printAction mDiffusion = rights . fix $ \comm
i addr pk (addressHash pk) addrHD
walletMB <- (^. usWallet) <$> (view userSecret >>= atomically . readTVar)
whenJust walletMB $ \wallet -> do
addrHD <- deriveHDAddressAuxx (_wusRootKey wallet)
addrHD <- deriveHDAddressAuxx nm (_wusRootKey wallet)
printAction $
sformat (" Wallet address:\n"%
" HD addr: "%build)
Expand Down Expand Up @@ -535,9 +545,6 @@ instance MonadAuxxMode m => ToLeft m PublicKey Int where
instance MonadAuxxMode m => ToLeft m StakeholderId PublicKey where
toLeft = return . either identity addressHash

instance MonadAuxxMode m => ToLeft m Address PublicKey where
toLeft = either return makePubKeyAddressAuxx

getPublicKeyFromIndex :: MonadAuxxMode m => Int -> m PublicKey
getPublicKeyFromIndex i = do
sks <- getSecretKeysPlain
Expand Down
11 changes: 7 additions & 4 deletions auxx/src/Command/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import Pos.Client.Txp.Util (createTx)
import Pos.Core (BlockVersionData (bvdSlotDuration), IsBootstrapEraAddr (..),
Timestamp (..), deriveFirstHDAddress, makePubKeyAddress, mkCoin)
import Pos.Core.Configuration (genesisBlockVersionData, genesisSecretKeys)
import Pos.Core.NetworkMagic (makeNetworkMagic)
import Pos.Core.Txp (TxAux (..), TxIn (TxInUtxo), TxOut (..), TxOutAux (..), txaF)
import Pos.Crypto (EncryptedSecretKey, ProtocolMagic, emptyPassphrase, encToPublic,
fakeSigner, hash, safeToPublic, toPublic, withSafeSigners)
Expand Down Expand Up @@ -103,18 +104,19 @@ sendToAllGenesis pm diffusion (SendToAllGenesisParams genesisTxsPerThread txsPer
logInfo $ sformat ("Found "%shown%" keys in the genesis block.") (length keysToSend)
startAtTxt <- liftIO $ lookupEnv "AUXX_START_AT"
let startAt = fromMaybe 0 . readMaybe . fromMaybe "" $ startAtTxt :: Int
let nm = makeNetworkMagic pm
-- construct a transaction, and add it to the queue
let addTx secretKey = do
let signer = fakeSigner secretKey
publicKey = toPublic secretKey
-- construct transaction output
outAddr <- makePubKeyAddressAuxx publicKey
outAddr <- makePubKeyAddressAuxx nm publicKey
let txOut1 = TxOut {
txOutAddress = outAddr,
txOutValue = mkCoin 1
}
txOuts = TxOutAux txOut1 :| []
utxo <- getOwnUtxoForPk $ safeToPublic signer
utxo <- getOwnUtxoForPk nm $ safeToPublic signer
etx <- createTx pm mempty utxo signer txOuts publicKey
case etx of
Left err -> logError (sformat ("Error: "%build%" while trying to contruct tx") err)
Expand Down Expand Up @@ -220,11 +222,12 @@ send
-> m ()
send pm diffusion idx outputs = do
skey <- takeSecret
let nm = makeNetworkMagic pm
let curPk = encToPublic skey
let plainAddresses = map (flip makePubKeyAddress curPk . IsBootstrapEraAddr) [False, True]
let plainAddresses = map (flip (makePubKeyAddress nm) curPk . IsBootstrapEraAddr) [False, True]
let (hdAddresses, hdSecrets) = unzip $ map
(\ibea -> fromMaybe (error "send: pass mismatch") $
deriveFirstHDAddress (IsBootstrapEraAddr ibea) emptyPassphrase skey) [False, True]
deriveFirstHDAddress nm (IsBootstrapEraAddr ibea) emptyPassphrase skey) [False, True]
let allAddresses = hdAddresses ++ plainAddresses
let allSecrets = hdSecrets ++ [skey, skey]
etx <- withSafeSigners allSecrets (pure emptyPassphrase) $ \signers -> runExceptT @AuxxException $ do
Expand Down
21 changes: 12 additions & 9 deletions auxx/src/Mode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import Pos.Context (HasNodeContext (..))
import Pos.Core (Address, HasConfiguration, HasPrimaryKey (..), IsBootstrapEraAddr (..),
deriveFirstHDAddress, largestPubKeyAddressBoot,
largestPubKeyAddressSingleKey, makePubKeyAddress, siEpoch)
import Pos.Core.NetworkMagic (NetworkMagic)
import Pos.Crypto (EncryptedSecretKey, PublicKey, emptyPassphrase)
import Pos.DB (DBSum (..), MonadGState (..), NodeDBs, gsIsBootstrapEra)
import Pos.DB.Class (MonadDB (..), MonadDBRead (..))
Expand Down Expand Up @@ -211,11 +212,11 @@ instance (HasConfigurations, HasCompileInfo) =>
MonadAddresses AuxxMode where
type AddrData AuxxMode = PublicKey
getNewAddress = makePubKeyAddressAuxx
getFakeChangeAddress = do
getFakeChangeAddress nm = do
epochIndex <- siEpoch <$> getCurrentSlotInaccurate
gsIsBootstrapEra epochIndex <&> \case
False -> largestPubKeyAddressBoot
True -> largestPubKeyAddressSingleKey
False -> largestPubKeyAddressBoot nm
True -> largestPubKeyAddressSingleKey nm

instance MonadKeysRead AuxxMode where
getSecret = getSecretDefault
Expand All @@ -242,20 +243,22 @@ instance (HasConfigurations) =>
-- whether we are currently in bootstrap era.
makePubKeyAddressAuxx ::
MonadAuxxMode m
=> PublicKey
=> NetworkMagic
-> PublicKey
-> m Address
makePubKeyAddressAuxx pk = do
makePubKeyAddressAuxx nm pk = do
epochIndex <- siEpoch <$> getCurrentSlotInaccurate
ibea <- IsBootstrapEraAddr <$> gsIsBootstrapEra epochIndex
pure $ makePubKeyAddress ibea pk
pure $ makePubKeyAddress nm ibea pk

-- | Similar to @makePubKeyAddressAuxx@ but create HD address.
deriveHDAddressAuxx ::
MonadAuxxMode m
=> EncryptedSecretKey
=> NetworkMagic
-> EncryptedSecretKey
-> m Address
deriveHDAddressAuxx hdwSk = do
deriveHDAddressAuxx nm hdwSk = do
epochIndex <- siEpoch <$> getCurrentSlotInaccurate
ibea <- IsBootstrapEraAddr <$> gsIsBootstrapEra epochIndex
pure $ fst $ fromMaybe (error "makePubKeyHDAddressAuxx: pass mismatch") $
deriveFirstHDAddress ibea emptyPassphrase hdwSk
deriveFirstHDAddress nm ibea emptyPassphrase hdwSk
2 changes: 1 addition & 1 deletion binary/cardano-sl-binary.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cardano-sl-binary
version: 1.3.0
version: 1.3.1
synopsis: Cardano SL - binary serialization
description: This package defines a type class for binary serialization,
helpers and instances.
Expand Down
2 changes: 1 addition & 1 deletion binary/test/cardano-sl-binary-test.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cardano-sl-binary-test
version: 1.3.0
version: 1.3.1
synopsis: Cardano SL - binary serializarion (tests)
description: This package contains test helpers for cardano-sl-binary.
license: MIT
Expand Down
6 changes: 3 additions & 3 deletions block/bench/Block.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ import Pos.Core (Block, BlockHeader, BlockVersionData (..), Body, Body
_mbUpdatePayload)
import Pos.Core.Block.Main ()
import Pos.Core.Common (CoinPortion, SharedSeed (..))
import Pos.Core.ProtocolConstants (ProtocolConstants (..))
import Pos.Core.Genesis
import Pos.Crypto (ProtocolMagic (..))
import Pos.Core.ProtocolConstants (ProtocolConstants (..))
import Pos.Crypto (ProtocolMagic (..), ProtocolMagicId (..), RequiresNetworkMagic (..))

import Test.Pos.Block.Arbitrary.Generate (generateMainBlock)

-- We need 'ProtocolMagic' and 'ProtocolConstants' in order to generate a
-- 'MainBlock'.

pm :: ProtocolMagic
pm = ProtocolMagic 0
pm = ProtocolMagic (ProtocolMagicId 0) NMMustBeNothing

pc :: ProtocolConstants
pc = ProtocolConstants
Expand Down
2 changes: 1 addition & 1 deletion block/bench/cardano-sl-block-bench.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cardano-sl-block-bench
version: 1.3.0
version: 1.3.1
synopsis: Cardano SL - block benchmark
description: Cardano SL - block benchmark
license: MIT
Expand Down
2 changes: 1 addition & 1 deletion block/cardano-sl-block.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cardano-sl-block
version: 1.3.0
version: 1.3.1
synopsis: Cardano SL - block processing
description: Cardano SL - block processing
license: MIT
Expand Down
19 changes: 10 additions & 9 deletions block/src/Pos/Block/BListener.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,33 @@ import Control.Monad.Trans (MonadTrans (..))
import Mockable (SharedAtomicT)

import Pos.Block.Types (Blund)
import Pos.DB.BatchOp (SomeBatchOp)
import Pos.Core.Chrono (NE, NewestFirst (..), OldestFirst (..))
import Pos.Core.NetworkMagic (NetworkMagic)
import Pos.DB.BatchOp (SomeBatchOp)

class Monad m => MonadBListener m where
-- Callback will be called after putting blocks into BlocksDB
-- and before changing of GStateDB.
-- Callback action will be performed under block lock.
onApplyBlocks :: OldestFirst NE Blund -> m SomeBatchOp
onApplyBlocks :: NetworkMagic -> OldestFirst NE Blund -> m SomeBatchOp
-- Callback will be called before changing of GStateDB.
-- Callback action will be performed under block lock.
onRollbackBlocks :: NewestFirst NE Blund -> m SomeBatchOp
onRollbackBlocks :: NetworkMagic -> NewestFirst NE Blund -> m SomeBatchOp

instance {-# OVERLAPPABLE #-}
( MonadBListener m, Monad m, MonadTrans t, Monad (t m)
, SharedAtomicT m ~ SharedAtomicT (t m) ) =>
MonadBListener (t m)
where
onApplyBlocks = lift . onApplyBlocks
onRollbackBlocks = lift . onRollbackBlocks
onApplyBlocks nm = lift . onApplyBlocks nm
onRollbackBlocks nm = lift . onRollbackBlocks nm

onApplyBlocksStub
:: Monad m
=> OldestFirst NE Blund -> m SomeBatchOp
onApplyBlocksStub _ = pure mempty
=> NetworkMagic -> OldestFirst NE Blund -> m SomeBatchOp
onApplyBlocksStub _ _ = pure mempty

onRollbackBlocksStub
:: Monad m
=> NewestFirst NE Blund -> m SomeBatchOp
onRollbackBlocksStub _ = pure mempty
=> NetworkMagic -> NewestFirst NE Blund -> m SomeBatchOp
onRollbackBlocksStub _ _ = pure mempty
Loading

0 comments on commit 8f750bb

Please sign in to comment.