Skip to content
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

Update ledger #3690

Merged
merged 5 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:
ghc: ["8.10.7"]
os: [ubuntu-20.04, windows-latest]

env:
# current ref from: 27.02.2022
SECP256K1_REF: ac83be33d0956faf6b7f61a60ab524ef7d6a473a

steps:
- name: Install Haskell
uses: haskell/actions/setup@v1
Expand Down Expand Up @@ -76,10 +80,6 @@ jobs:
echo "LIBSODIUM_PATH=$LIBSODIUM_PATH"
echo "$LIBSODIUM_PATH" >> $GITHUB_PATH

- name: Install libsodium (MacOS)
if: matrix.os == 'macos-latest'
run: brew install libsodium

- name: Install build environment
if: matrix.os == 'ubuntu-20.04'
run: |
Expand Down
8 changes: 4 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger
tag: 030c3b12f128f22b9d721a31b6b5ae1b75211d68
--sha256: 0h9qbdik8fnzv33582pvvhkjyv3wwlnshrwvwalh0yl4mmqdcz8x
tag: 70dbfc9f12283666e29f8492aff5da9b1c8c5a7f
--sha256: 0mjrmc49nr9b54dxzb6b8487dys83c0jkk1d5vr0d9v2a8mfpram
subdir:
eras/alonzo/impl
eras/alonzo/test-suite
Expand Down Expand Up @@ -241,8 +241,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/plutus
tag: 4417dfea15746596f51f313ef231fb9ecb1d02fc
--sha256: 0nx7jbql3mmd64f0kjxrv9azzyc61b6sm2xh5dil910lw891szwh
tag: ccf5bcb99ffe054dc8cd5626723f64e02708dbae
--sha256: 18569bgywilibz7r5jyxj9bid8g4fwr80cc0hd9rcm3jhasbgq8i
subdir:
plutus-ledger-api
plutus-tx
Expand Down
9 changes: 4 additions & 5 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@
"homepage": null,
"owner": "input-output-hk",
"repo": "iohk-nix",
"rev": "0a0126d8fb1bdc61ce1fd2ef61cf396de800fdad",
"sha256": "0gwppj37fphjssw9s99xs7yyxylxzi6fdc9g1sq6w7yyx46lrf0i",
"rev": "5e667b374153327c7bdfdbfab8ef19b1f27d4aac",
"sha256": "09jrhq48h5vwl6vyf4q8d38vlaqmbd00m550rwxz79k90bxb7q6y",
"type": "tarball",
"url": "https://github.com/input-output-hk/iohk-nix/archive/0a0126d8fb1bdc61ce1fd2ef61cf396de800fdad.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"version": "60fe72cf807a4ec4409a53883d5c3af77f60f721"
"url": "https://github.com/input-output-hk/iohk-nix/archive/5e667b374153327c7bdfdbfab8ef19b1f27d4aac.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixpkgs-unstable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ getUTxOShelley :: Ticked (LedgerState (ShelleyBlock era))
-> SL.UTxO era
getUTxOShelley tls =
SL._utxo $
SL._utxoState $
SL.lsUTxOState $
SL.esLState $
SL.nesEs $
tickedShelleyLedgerState tls
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module Test.ThreadNet.Infra.Alonzo (degenerateAlonzoGenesis) where
import qualified Data.Map as Map

import Cardano.Ledger.Alonzo.Genesis (AlonzoGenesis (..))
import Cardano.Ledger.Alonzo.Scripts (Prices (..))
import Cardano.Ledger.Alonzo.Scripts (CostModels (..), Prices (..))
import Cardano.Ledger.Shelley.API (Coin (..))

degenerateAlonzoGenesis :: AlonzoGenesis
degenerateAlonzoGenesis = AlonzoGenesis {
coinsPerUTxOWord = Coin 0
, collateralPercentage = 0
, costmdls = Map.empty
, costmdls = CostModels Map.empty
, maxBlockExUnits = mempty
, maxCollateralInputs = 0
, maxTxExUnits = mempty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ genTx _cfg slotNo TickedShelleyLedgerState { tickedShelleyLedgerState } genEnv =
Just . mkShelleyTx <$> Gen.genTx
genEnv
ledgerEnv
(utxoSt, dpState)
(SL.LedgerState utxoSt dpState)
where
epochState :: SL.EpochState (MockShelley h)
epochState = SL.nesEs tickedShelleyLedgerState
Expand All @@ -114,13 +114,13 @@ genTx _cfg slotNo TickedShelleyLedgerState { tickedShelleyLedgerState } genEnv =

utxoSt :: SL.UTxOState (MockShelley h)
utxoSt =
SL._utxoState
SL.lsUTxOState
. SL.esLState
$ epochState

dpState :: SL.DPState (MockCrypto h)
dpState =
SL._delegationState
SL.lsDPState
. SL.esLState
$ epochState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protocolUpdates genesis st = [
SL.ProposedPPUpdates proposals =
SL.proposals
. SL._ppups
. SL._utxoState
. SL.lsUTxOState
. SL.esLState
. SL.nesEs
. shelleyLedgerState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import Ouroboros.Consensus.Util.Condense
import Cardano.Ledger.Alonzo.PParams
import Cardano.Ledger.Alonzo.Tx (totExUnits)
import qualified Cardano.Ledger.Core as Core (Tx)
import qualified Cardano.Ledger.Era as SL (Crypto, TxSeq, fromTxSeq)
import qualified Cardano.Ledger.Era as SL (TxSeq, fromTxSeq)
import qualified Cardano.Ledger.Shelley.API as SL
import qualified Cardano.Ledger.TxIn as SL (txid)

Expand Down Expand Up @@ -269,12 +269,9 @@ set lens inner outer =
runIdentity $ lens (\_ -> Identity inner) outer

theLedgerLens ::
-- TODO SL.overNewEpochState should not require 'Applicative'
Applicative f
=> ( (SL.UTxOState era, SL.DPState (SL.Crypto era))
-> f (SL.UTxOState era, SL.DPState (SL.Crypto era))
)
-> TickedLedgerState (ShelleyBlock era)
Functor f
=> (SL.LedgerState era -> f (SL.LedgerState era))
-> TickedLedgerState (ShelleyBlock era)
-> f (TickedLedgerState (ShelleyBlock era))
theLedgerLens f x =
(\y -> x{tickedShelleyLedgerState = y})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ instance c ~ EraCrypto era
where
pstate :: SL.PState c
pstate =
SL._pstate
. SL._delegationState
SL.dpsPState
. SL.lsDPState
. SL.esLState
. SL.nesEs
$ shelleyLedgerState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,14 @@ getProposedPPUpdates ::
ShelleyBasedEra era
=> SL.NewEpochState era -> SL.ProposedPPUpdates era
getProposedPPUpdates = SL.proposals . SL._ppups
. SL._utxoState . SL.esLState . SL.nesEs
. SL.lsUTxOState . SL.esLState . SL.nesEs

-- Get the current 'EpochState.' This is mainly for debugging.
getEpochState :: SL.NewEpochState era -> SL.EpochState era
getEpochState = SL.nesEs

getDState :: SL.NewEpochState era -> SL.DState (EraCrypto era)
getDState = SL._dstate . SL._delegationState . SL.esLState . SL.nesEs
getDState = SL.dpsDState . SL.lsDPState . SL.esLState . SL.nesEs

getFilteredDelegationsAndRewardAccounts ::
SL.NewEpochState era
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,9 @@ registerGenesisStaking ::
registerGenesisStaking staking nes = nes {
SL.nesEs = epochState {
SL.esLState = ledgerState {
SL._delegationState = dpState {
SL._dstate = dState'
, SL._pstate = pState'
SL.lsDPState = dpState {
SL.dpsDState = dState'
, SL.dpsPState = pState'
}
}
, SL.esSnapshots = (SL.esSnapshots epochState) {
Expand All @@ -483,14 +483,14 @@ registerGenesisStaking staking nes = nes {
SL.ShelleyGenesisStaking { sgsPools, sgsStake } = staking
SL.NewEpochState { nesEs = epochState } = nes
ledgerState = SL.esLState epochState
dpState = SL._delegationState ledgerState
dpState = SL.lsDPState ledgerState

-- New delegation state. Since we're using base addresses, we only care
-- about updating the '_delegations' field.
--
-- See STS DELEG for details
dState' :: SL.DState (EraCrypto era)
dState' = (SL._dstate dpState) {
dState' = (SL.dpsDState dpState) {
SL._unified = UM.unify
( Map.map (const $ SL.Coin 0)
. Map.mapKeys SL.KeyHashObj
Expand All @@ -501,7 +501,7 @@ registerGenesisStaking staking nes = nes {
-- We consider pools as having been registered in slot 0
-- See STS POOL for details
pState' :: SL.PState (EraCrypto era)
pState' = (SL._pstate dpState) {
pState' = (SL.dpsPState dpState) {
SL._pParams = sgsPools
}

Expand All @@ -519,7 +519,7 @@ registerGenesisStaking staking nes = nes {
-- Note that 'updateStakeDistribution' takes first the set of UTxO to
-- delete, and then the set to add. In our case, there is nothing to
-- delete, since this is an initial UTxO set.
(SL.updateStakeDistribution mempty mempty (SL._utxo (SL._utxoState ledgerState)))
(SL.updateStakeDistribution mempty mempty (SL._utxo (SL.lsUTxOState ledgerState)))
dState'
pState'

Expand Down Expand Up @@ -560,7 +560,7 @@ registerInitialFunds initialFunds nes = nes {
epochState = SL.nesEs nes
accountState = SL.esAccountState epochState
ledgerState = SL.esLState epochState
utxoState = SL._utxoState ledgerState
utxoState = SL.lsUTxOState ledgerState
utxo = SL._utxo utxoState
reserves = SL._reserves accountState

Expand All @@ -583,7 +583,7 @@ registerInitialFunds initialFunds nes = nes {
-- is nothing to delete in the incremental update.
utxoToDel = SL.UTxO mempty
ledgerState' = ledgerState {
SL._utxoState = utxoState {
SL.lsUTxOState = utxoState {
SL._utxo = utxo',
-- Normally we would incrementally update here. But since we pass
-- the full UTxO as "toAdd" rather than a delta, we simply
Expand Down