-
Notifications
You must be signed in to change notification settings - Fork 161
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
HF integration #1112
HF integration #1112
Conversation
dc33deb
to
9c5c1ad
Compare
e8077b7
to
77d5626
Compare
1f0a861
to
05088fc
Compare
bd15a2d
to
ce97d18
Compare
import Cardano.Mock.Forging.Tx.Alonzo.ScriptsExamples | ||
import Cardano.Mock.Forging.Tx.Generic | ||
import Cardano.Mock.Forging.Types | ||
-- import qualified Data.Maybe as Strict |
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.
-- import qualified Data.Maybe as Strict |
{-# LANGUAGE TupleSections #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
|
||
{-# OPTIONS_GHC -Wno-orphans #-} |
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.
{-# OPTIONS_GHC -Wno-orphans #-} |
Seems to compile without this option.
, _poolRAcnt = RewardAcnt Testnet rwCred | ||
, _poolOwners = Set.fromList owners | ||
, _poolRelays = StrictSeq.singleton $ SingleHostAddr Strict.SNothing Strict.SNothing Strict.SNothing | ||
, _poolMD = Strict.SJust $ PoolMetadata (fromJust $ textToUrl "best.pool") "89237365492387654983275634298756" |
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.
A comment saying where these values come from and whether they are special in some way, would be helpful.
import Cardano.Mock.Forging.Tx.Generic | ||
import Cardano.Mock.Forging.Types | ||
|
||
delegateAndSendBlocks :: Int -> Interpreter -> IO [CardanoBlock] |
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.
A comment describing what this is doing and why would be useful.
|
||
{-# OPTIONS_GHC -Wno-orphans #-} | ||
|
||
module Cardano.Mock.Forging.Tx.Babbage where |
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'd prefer a nice export list here with some comments but I see that isn't the case for other Eras.
stats <- liftIO $ textShowStats cache | ||
liftIO . logInfo tracer $ stats | ||
liftIO . logInfo tracer $ "Starting epoch " <> textShow (unEpochNo en) | ||
LedgerStartAtEpoch en -> | ||
-- This is different from the previous case in that the db-sync started | ||
-- in this epoch, for example after a restart, instead of after an epoch boundary. | ||
liftIO . logInfo tracer $ "Starting at epoch " <> textShow (unEpochNo en) | ||
LedgerDeltaRewards rwd -> do | ||
LedgerDeltaRewards _e rwd -> do |
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.
LedgerDeltaRewards _e rwd -> do | |
LedgerDeltaRewards _ rwd -> do |
blockHash = | ||
Crypto.hashToBytes . Protocol.unHashHeader | ||
Crypto.hashToBytes -- . Protocol.unHashHeader |
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.
Crypto.hashToBytes -- . Protocol.unHashHeader | |
Crypto.hashToBytes |
@@ -49,8 +49,9 @@ ledgerAddrBalance addr lsc = | |||
LedgerStateAllegra st -> getShelleyBalance addr $ getUTxO st | |||
LedgerStateMary st -> getShelleyBalance addr $ getUTxO st | |||
LedgerStateAlonzo st -> getAlonzoBalance addr $ getUTxO st | |||
LedgerStateBabbage _st -> panic "undefined Babbage ledgerAddrBalance" |
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.
This should be using the existing Either Text Word64
for signalling an un-expected return.
The calling code in Cardano.DbTool.Validate.Ledger
logs the result on Left.
LedgerStateBabbage _st -> panic "undefined Babbage ledgerAddrBalance" | |
LedgerStateBabbage _st -> Left "undefined Babbage ledgerAddrBalance" |
pure (eutxo, maTxOuts) | ||
where | ||
hasScript :: Bool | ||
hasScript = maybe False Generic.hasCredScript (Generic.getPaymentCred addr) | ||
|
||
inertCollateralTxOut |
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.
inertCollateralTxOut | |
insertCollateralTxOut |
Left (_err, bs) -> insertStakeAddress txId rewardAddr (Just bs) | ||
Right addrId -> pure addrId | ||
|
||
-- If the address already esists in the table, it will not be inserted again (due to |
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 the address already esists in the table, it will not be inserted again (due to | |
-- If the address already exists in the table, it will not be inserted again (due to |
9e20208
to
5613022
Compare
This also improves performance
This avoids many transformations from ledger types, but more importantly ledger types are backed by ShortByteString which is not pinned memory and doesn't cause heap fragmentation.
Using the whole CostModel caused errors because the unique key can't be that big.
Rollbacks are extremely slow without them
5613022
to
9f24209
Compare
9f24209
to
10868e0
Compare
#1081 and #1120