Release preparation
This commit is contained in:
parent
de21a4e4b3
commit
47743ddd5a
10 changed files with 31 additions and 46 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,4 +1,4 @@
|
|||
[submodule "zcash-haskell"]
|
||||
path = zcash-haskell
|
||||
url = https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
||||
branch = milestone2
|
||||
branch = master
|
||||
|
|
|
@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `getoperationstatus` RPC method
|
||||
- `sendmany` RPC method
|
||||
- Function `prepareTxV2` implementing `PrivacyPolicy`
|
||||
- Support for TEX addresses
|
||||
- Functionality to shield transparent balance
|
||||
- Functionality to de-shield shielded notes
|
||||
- Native commitment trees
|
||||
|
|
|
@ -528,7 +528,7 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
|
|||
(str
|
||||
" _____ _ _ _ \n|__ /___ _ __ (_) |_| |__\n / // _ \\ '_ \\| | __| '_ \\\n / /| __/ | | | | |_| | | |\n/____\\___|_| |_|_|\\__|_| |_|") <=>
|
||||
C.hCenter
|
||||
(withAttr titleAttr (str "Zcash Wallet v0.6.0.0-beta")) <=>
|
||||
(withAttr titleAttr (str "Zcash Wallet v0.7.0.0-beta")) <=>
|
||||
C.hCenter (withAttr blinkAttr $ str "Press any key..."))
|
||||
else emptyWidget
|
||||
capCommand3 :: String -> String -> String -> Widget Name
|
||||
|
@ -827,7 +827,7 @@ scanZebra ::
|
|||
-> Int
|
||||
-> BC.BChan Tick
|
||||
-> ZcashNet
|
||||
-> LoggingT IO ()
|
||||
-> NoLoggingT IO ()
|
||||
scanZebra dbP zHost zPort b eChan znet = do
|
||||
bStatus <- liftIO $ checkBlockChain zHost zPort
|
||||
pool <- liftIO $ runNoLoggingT $ initPool dbP
|
||||
|
@ -860,7 +860,7 @@ scanZebra dbP zHost zPort b eChan znet = do
|
|||
_ <- liftIO $ startSync pool
|
||||
mapM_ (liftIO . processBlock pool step) bList
|
||||
confUp <-
|
||||
liftIO $ try $ updateConfs zHost zPort pool :: LoggingT
|
||||
liftIO $ try $ updateConfs zHost zPort pool :: NoLoggingT
|
||||
IO
|
||||
(Either IOError ())
|
||||
case confUp of
|
||||
|
@ -940,7 +940,7 @@ appEvent (BT.AppEvent t) = do
|
|||
Just (_k, w) -> return w
|
||||
_ <-
|
||||
liftIO $
|
||||
runStderrLoggingT $
|
||||
runNoLoggingT $
|
||||
syncWallet
|
||||
(Config
|
||||
(s ^. dbPath)
|
||||
|
@ -1006,7 +1006,7 @@ appEvent (BT.AppEvent t) = do
|
|||
_ <-
|
||||
liftIO $
|
||||
forkIO $
|
||||
runStderrLoggingT $
|
||||
runNoLoggingT $
|
||||
scanZebra
|
||||
(s ^. dbPath)
|
||||
(s ^. zebraHost)
|
||||
|
@ -2021,7 +2021,7 @@ sendTransaction pool chan zHost zPort znet accId bl amt ua memo policy = do
|
|||
Nothing -> BC.writeBChan chan $ TickMsg "Incorrect address"
|
||||
Just outUA -> do
|
||||
res <-
|
||||
runStderrLoggingT $
|
||||
runNoLoggingT $
|
||||
prepareTxV2
|
||||
pool
|
||||
zHost
|
||||
|
@ -2089,7 +2089,7 @@ deshieldTransaction ::
|
|||
-> IO ()
|
||||
deshieldTransaction pool chan zHost zPort znet accId bl pnote = do
|
||||
BC.writeBChan chan $ TickMsg "Deshielding funds..."
|
||||
res <- runStderrLoggingT $ deshieldNotes pool zHost zPort znet accId bl pnote
|
||||
res <- runNoLoggingT $ deshieldNotes pool zHost zPort znet accId bl pnote
|
||||
case res of
|
||||
Left e -> BC.writeBChan chan $ TickMsg $ show e
|
||||
Right rawTx -> do
|
||||
|
|
|
@ -8,21 +8,15 @@ import Control.Monad (forM, unless, when)
|
|||
import Control.Monad.IO.Class (liftIO)
|
||||
import Control.Monad.Logger
|
||||
( LoggingT
|
||||
, MonadLoggerIO
|
||||
, NoLoggingT
|
||||
, logDebugN
|
||||
, logErrorN
|
||||
, logInfoN
|
||||
, logWarnN
|
||||
, runFileLoggingT
|
||||
, runNoLoggingT
|
||||
, runStdoutLoggingT
|
||||
)
|
||||
import Crypto.Secp256k1 (SecKey(..))
|
||||
import Data.Aeson
|
||||
import Data.Binary.Get hiding (getBytes)
|
||||
import qualified Data.ByteString as BS
|
||||
import qualified Data.ByteString.Lazy as LBS
|
||||
import Data.HexString (HexString, hexBytes, hexString, toBytes, toText)
|
||||
import Data.Int (Int32, Int64)
|
||||
import Data.List
|
||||
|
@ -34,14 +28,8 @@ import Data.Time
|
|||
import qualified Database.Esqueleto.Experimental as ESQ
|
||||
import Database.Persist
|
||||
import Database.Persist.Sqlite
|
||||
import GHC.Float.RealFracMethods
|
||||
( ceilingFloatInteger
|
||||
, floorFloatInt
|
||||
, floorFloatInteger
|
||||
)
|
||||
import Haskoin.Crypto.Keys (XPrvKey(..))
|
||||
import Lens.Micro ((&), (.~), (^.), set)
|
||||
import Network.HTTP.Client
|
||||
import ZcashHaskell.Keys
|
||||
import ZcashHaskell.Orchard
|
||||
( decryptOrchardActionSK
|
||||
|
@ -759,7 +747,7 @@ deshieldNotes ::
|
|||
-> ZcashAccountId
|
||||
-> Int
|
||||
-> ProposedNote
|
||||
-> LoggingT IO (Either TxError HexString)
|
||||
-> NoLoggingT IO (Either TxError HexString)
|
||||
deshieldNotes pool zebraHost zebraPort znet za bh pnote = do
|
||||
bal <- liftIO $ getShieldedBalance pool za
|
||||
let zats = pn_amt pnote * scientific 1 8
|
||||
|
@ -886,7 +874,7 @@ prepareTxV2 ::
|
|||
-> Int
|
||||
-> [ProposedNote]
|
||||
-> PrivacyPolicy
|
||||
-> LoggingT IO (Either TxError HexString)
|
||||
-> NoLoggingT IO (Either TxError HexString)
|
||||
prepareTxV2 pool zebraHost zebraPort zn za bh pnotes policy = do
|
||||
accRead <- liftIO $ getAccountById pool za
|
||||
let recipients = map extractReceiver pnotes
|
||||
|
@ -1297,7 +1285,7 @@ prepareTxV2 pool zebraHost zebraPort zn za bh pnotes policy = do
|
|||
syncWallet ::
|
||||
Config -- ^ configuration parameters
|
||||
-> Entity ZcashWallet
|
||||
-> LoggingT IO ()
|
||||
-> NoLoggingT IO ()
|
||||
syncWallet config w = do
|
||||
startTime <- liftIO getCurrentTime
|
||||
logDebugN $ T.pack $ show startTime
|
||||
|
@ -1343,7 +1331,7 @@ syncWallet config w = do
|
|||
|
||||
-- | Update commitment trees
|
||||
updateCommitmentTrees ::
|
||||
ConnectionPool -> T.Text -> Int -> ZcashNetDB -> LoggingT IO ()
|
||||
ConnectionPool -> T.Text -> Int -> ZcashNetDB -> NoLoggingT IO ()
|
||||
updateCommitmentTrees pool zHost zPort zNet = do
|
||||
sTdb <- liftIO $ getSaplingTree pool
|
||||
oTdb <- liftIO $ getOrchardTree pool
|
||||
|
|
|
@ -2680,7 +2680,7 @@ completeSync pool st = do
|
|||
return ()
|
||||
|
||||
-- | Rewind the data store to a given block height
|
||||
rewindWalletData :: ConnectionPool -> Int -> ZcashNetDB -> LoggingT IO ()
|
||||
rewindWalletData :: ConnectionPool -> Int -> ZcashNetDB -> NoLoggingT IO ()
|
||||
rewindWalletData pool b net = do
|
||||
logDebugN "Starting transaction rewind"
|
||||
liftIO $ rewindWalletTransactions pool b
|
||||
|
|
|
@ -15,6 +15,7 @@ import Control.Monad (forM_, unless, when)
|
|||
import Control.Monad.IO.Class (liftIO)
|
||||
import Control.Monad.Logger
|
||||
( LoggingT
|
||||
, NoLoggingT
|
||||
, logDebugN
|
||||
, runNoLoggingT
|
||||
, runStderrLoggingT
|
||||
|
@ -1395,7 +1396,7 @@ handleEvent wenv node model evt =
|
|||
model & timer .~ 0 & barValue .~ 0.0 & modalMsg ?~
|
||||
"Downloading blocks..."
|
||||
, Producer $
|
||||
runStderrLoggingT .
|
||||
runNoLoggingT .
|
||||
scanZebra
|
||||
(c_dbPath $ model ^. configuration)
|
||||
(c_zebraHost $ model ^. configuration)
|
||||
|
@ -1411,7 +1412,7 @@ handleEvent wenv node model evt =
|
|||
case currentWallet of
|
||||
Nothing -> return $ ShowError "No wallet available"
|
||||
Just cW -> do
|
||||
runStderrLoggingT $ syncWallet (model ^. configuration) cW
|
||||
runNoLoggingT $ syncWallet (model ^. configuration) cW
|
||||
pool <-
|
||||
runNoLoggingT $ initPool $ c_dbPath $ model ^. configuration
|
||||
wL <- getWallets pool (model ^. network)
|
||||
|
@ -1668,7 +1669,7 @@ scanZebra ::
|
|||
-> Int
|
||||
-> ZcashNet
|
||||
-> (AppEvent -> IO ())
|
||||
-> LoggingT IO ()
|
||||
-> NoLoggingT IO ()
|
||||
scanZebra dbPath zHost zPort net sendMsg = do
|
||||
bStatus <- liftIO $ checkBlockChain zHost zPort
|
||||
pool <- liftIO $ runNoLoggingT $ initPool dbPath
|
||||
|
@ -1697,7 +1698,7 @@ scanZebra dbPath zHost zPort net sendMsg = do
|
|||
_ <- liftIO $ startSync pool
|
||||
mapM_ (liftIO . processBlock pool step) bList
|
||||
confUp <-
|
||||
liftIO $ try $ updateConfs zHost zPort pool :: LoggingT
|
||||
liftIO $ try $ updateConfs zHost zPort pool :: NoLoggingT
|
||||
IO
|
||||
(Either IOError ())
|
||||
case confUp of
|
||||
|
@ -1806,7 +1807,7 @@ deshieldTransaction config znet accId addR pnote sendMsg = do
|
|||
Nothing -> sendMsg $ ShowError "No transparent address available"
|
||||
Just tAddr -> do
|
||||
res <-
|
||||
runStderrLoggingT $
|
||||
runNoLoggingT $
|
||||
deshieldNotes
|
||||
pool
|
||||
zHost
|
||||
|
@ -1850,7 +1851,7 @@ sendTransaction config znet accId bl amt ua memo policy sendMsg = do
|
|||
let zPort = c_zebraPort config
|
||||
pool <- runNoLoggingT $ initPool dbPath
|
||||
res <-
|
||||
runStderrLoggingT $
|
||||
runNoLoggingT $
|
||||
prepareTxV2
|
||||
pool
|
||||
zHost
|
||||
|
|
|
@ -834,7 +834,7 @@ zenithServer state = getinfo :<|> handleRPC
|
|||
forkIO $ do
|
||||
res <-
|
||||
liftIO $
|
||||
runStderrLoggingT $
|
||||
runNoLoggingT $
|
||||
prepareTxV2
|
||||
pool
|
||||
zHost
|
||||
|
@ -898,7 +898,7 @@ scanZebra dbPath zHost zPort net = do
|
|||
then max dbBlock b
|
||||
else max chkBlock b
|
||||
unless (chkBlock == dbBlock || chkBlock == 1) $
|
||||
runStderrLoggingT $ rewindWalletData pool sb $ ZcashNetDB net
|
||||
runNoLoggingT $ rewindWalletData pool sb $ ZcashNetDB net
|
||||
unless (sb > zgb_blocks bStatus || sb < 1) $ do
|
||||
let bList = [(sb + 1) .. (zgb_blocks bStatus)]
|
||||
unless (null bList) $ do
|
||||
|
@ -912,9 +912,9 @@ scanZebra dbPath zHost zPort net = do
|
|||
Right _ -> do
|
||||
wals <- getWallets pool net
|
||||
_ <-
|
||||
runStderrLoggingT $
|
||||
runNoLoggingT $
|
||||
updateCommitmentTrees pool zHost zPort $ ZcashNetDB net
|
||||
runStderrLoggingT $
|
||||
runNoLoggingT $
|
||||
mapM_
|
||||
(syncWallet (Config dbPath zHost zPort "user" "pwd" 8080))
|
||||
wals
|
||||
|
|
|
@ -108,7 +108,7 @@ rescanZebra host port dbFilePath = do
|
|||
{-mapM_ (processBlock host port pool3 pg3 znet) bl3-}
|
||||
print "Please wait..."
|
||||
_ <- completeSync pool1 Successful
|
||||
_ <- runStderrLoggingT $ updateCommitmentTrees pool1 host port znet
|
||||
_ <- runNoLoggingT $ updateCommitmentTrees pool1 host port znet
|
||||
print "Rescan complete"
|
||||
|
||||
-- | Function to process a raw block and extract the transaction information
|
||||
|
@ -239,7 +239,7 @@ clearSync config = do
|
|||
w <- getWallets pool $ zgb_net chainInfo
|
||||
liftIO $ mapM_ (updateWalletSync pool 0 . entityKey) w
|
||||
w' <- liftIO $ getWallets pool $ zgb_net chainInfo
|
||||
r <- runStderrLoggingT $ mapM (syncWallet config) w'
|
||||
r <- runNoLoggingT $ mapM (syncWallet config) w'
|
||||
liftIO $ print r
|
||||
|
||||
-- | Detect chain re-orgs
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
module Zenith.Tree where
|
||||
|
||||
import Codec.Borsh
|
||||
import Control.Monad.Logger (LoggingT, logDebugN)
|
||||
import Control.Monad.Logger (NoLoggingT, logDebugN)
|
||||
import Data.HexString
|
||||
import Data.Int (Int32, Int64, Int8)
|
||||
import Data.Maybe (fromJust, isNothing)
|
||||
|
@ -18,12 +18,7 @@ import qualified GHC.Generics as GHC
|
|||
import qualified Generics.SOP as SOP
|
||||
import ZcashHaskell.Orchard (combineOrchardNodes, getOrchardNodeValue)
|
||||
import ZcashHaskell.Sapling (combineSaplingNodes, getSaplingNodeValue)
|
||||
import ZcashHaskell.Types
|
||||
( MerklePath(..)
|
||||
, OrchardFrontier(..)
|
||||
, OrchardTree(..)
|
||||
, SaplingTree(..)
|
||||
)
|
||||
import ZcashHaskell.Types (MerklePath(..), OrchardTree(..), SaplingTree(..))
|
||||
|
||||
type Level = Int8
|
||||
|
||||
|
@ -181,7 +176,7 @@ getNotePosition (Branch _ x y) i
|
|||
| otherwise = Nothing
|
||||
getNotePosition _ _ = Nothing
|
||||
|
||||
truncateTree :: Monoid v => Node v => Tree v -> Int64 -> LoggingT IO (Tree v)
|
||||
truncateTree :: Monoid v => Node v => Tree v -> Int64 -> NoLoggingT IO (Tree v)
|
||||
truncateTree (Branch s x y) i
|
||||
| getLevel s == 1 && getIndex (value x) == i = do
|
||||
logDebugN $ T.pack $ show (getLevel s) ++ " Trunc to left leaf"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit dea960c2acf7479eeb42845c07b482449d538aae
|
||||
Subproject commit d45bd7dcf3c3cf4e893900a1774d24b14bf56591
|
Loading…
Reference in a new issue