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

Tmp/slow tests and pact 5 #2019

Draft
wants to merge 49 commits into
base: pact5
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2318955
split up SlowTests
larskuhtz Sep 20, 2024
71ad4ed
fix typo in mac workflow
larskuhtz Sep 20, 2024
f7deecb
...
larskuhtz Sep 20, 2024
eaf7d03
Merge branch 'master' into lars/split-slowtests
larskuhtz Sep 20, 2024
7eec188
wip: Pact 5 integration
edmundnoble Sep 20, 2024
2c34736
Fix tests, update to latest pact pin
jmcardon Sep 20, 2024
fb29925
add more keys to the testnet05 genesis grants
edmundnoble Sep 21, 2024
4480386
Update freeze file
edmundnoble Sep 22, 2024
5538a1e
Disable orphan warning for PactDbFor instances
edmundnoble Sep 22, 2024
384bcce
add nsv2 to testnet05
edmundnoble Sep 23, 2024
a636a4a
add extra key to testnet05
edmundnoble Sep 24, 2024
6f41487
Remove redundant case
edmundnoble Sep 24, 2024
5d44690
Delete checkDesugar
edmundnoble Sep 24, 2024
dd0c77e
stop using show on errors in local
edmundnoble Sep 24, 2024
0df9f2f
Fix off by one error in gas payer
jmcardon Sep 24, 2024
9c7df3f
update freeze file
chessai Sep 24, 2024
71c0219
add test that failed txs don't enter pending writes
chessai Sep 24, 2024
aedd2ca
Re-update freeze file to GHC 9.8
edmundnoble Sep 25, 2024
22ce0ba
Make Ea concurrent
edmundnoble Sep 25, 2024
04c6c78
Add extra key for testnet05
edmundnoble Sep 25, 2024
b2bb4a7
Band-aid fix on gas station msg data
edmundnoble Sep 25, 2024
ab04d00
Add another key
edmundnoble Sep 25, 2024
5028b3b
add logging when we hit a Pact UnknownException error
edmundnoble Sep 25, 2024
7251ec9
Add extra key to testnet05
edmundnoble Sep 25, 2024
9be1d4d
comment FIXMEs vs TODOs
edmundnoble Sep 25, 2024
68fa7b2
nit: Use `unless` in PactService to avoid populating module cache
edmundnoble Sep 26, 2024
6d49165
Add prisms for chainweb gas errors
edmundnoble Sep 26, 2024
037f8cd
Clean up TransactionExecTest
edmundnoble Sep 26, 2024
9039a4f
Fix testCoinUpgrade
edmundnoble Sep 26, 2024
928f604
Jose/update latest pact5 (#2004)
chessai Oct 2, 2024
d620238
make chainweb-node application a separate cabal package
larskuhtz Oct 6, 2024
2c81d8f
small Dockerfile fixes
larskuhtz Oct 6, 2024
d5c5561
Merge branch 'lars/no-frontend' into lars/split-slowtests
larskuhtz Oct 6, 2024
1d05e62
move common test modules in internal test library
larskuhtz Oct 6, 2024
d624486
Merge branch 'master' into lars/split-slowtests
larskuhtz Oct 9, 2024
900cedb
adjust timeouts for slow tests
larskuhtz Oct 9, 2024
acb8d46
Merge branch 'lars/split-slowtests' of github.com:kadena-io/chainweb-…
larskuhtz Oct 9, 2024
2d4b5d1
Merge branch 'master' into lars/split-slowtests
larskuhtz Oct 9, 2024
d79253f
move RemoteDB to BlockHeaderDB
larskuhtz Oct 9, 2024
60ea939
add HasCallStack constraint to local test miner
larskuhtz Oct 9, 2024
a6af1ba
remotedb ...
larskuhtz Oct 9, 2024
fb97081
separate code of different components
larskuhtz Oct 10, 2024
52395bb
simplify some gensis dependencies
larskuhtz Oct 10, 2024
3b6b534
update to latest pact5 (#2010)
chessai Oct 22, 2024
d4a89ed
Add libmpfr6 to dockerfile dependencies (#2011)
DevopsGoth Oct 22, 2024
de4e5c8
Merge branch 'master' into lars/split-slowtests
larskuhtz Oct 25, 2024
42d0af5
Merge remote-tracking branch 'chainweb-master/lars/refactor' into lar…
larskuhtz Oct 25, 2024
2854d0d
increment failures of failed peer sync (#2013)
chessai Oct 26, 2024
cc18d1c
Merge branch 'lars/split-slowtests' into tmp/slow-tests-and-pact-5
larskuhtz Oct 27, 2024
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
82 changes: 74 additions & 8 deletions .github/workflows/applications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ jobs:
cabal --version
- name: Install non-Haskell dependencies (ubuntu)
if: contains(matrix.os, 'ubuntu')
run: sudo apt-get install -y libgflags-dev liblz4-dev libzstd-dev libsnappy-dev libbz2-dev
run: sudo apt-get install -y libgflags-dev liblz4-dev libzstd-dev libsnappy-dev libbz2-dev libmpfr-dev
# Project Configuration
- name: Create cabal.project.local
run: |
Expand Down Expand Up @@ -358,7 +358,15 @@ jobs:
- name: Build chainweb library
run: cabal build --ghc-options=-j2 lib:chainweb
- name: Build chainweb applications
run: cabal build -j2 --ghc-options=-j2 exe:compact test:chainweb-tests exe:cwtool chainweb:bench:bench
run: |
cabal build -j2 --ghc-options=-j2 \
exe:compact \
test:chainweb-tests \
test:multi-node-network-tests \
test:compaction-tests \
test:remote-tests \
exe:cwtool \
chainweb:bench:bench
- name: Build chainweb-node application
run: cabal build -j2 --ghc-options=-j2 chainweb-node:exe:chainweb-node

Expand All @@ -384,6 +392,9 @@ jobs:
cp $(cabal list-bin chainweb-node) artifacts/chainweb
cp $(cabal list-bin compact) artifacts/chainweb
cp $(cabal list-bin chainweb-tests) artifacts/chainweb
cp $(cabal list-bin multi-node-network-tests) artifacts/chainweb
cp $(cabal list-bin remote-tests) artifacts/chainweb
cp $(cabal list-bin compaction-tests) artifacts/chainweb
cp $(cabal list-bin cwtool) artifacts/chainweb
cp $(cabal list-bin bench) artifacts/chainweb
cp README.md artifacts/chainweb
Expand All @@ -406,10 +417,10 @@ jobs:
if-no-files-found: error

# ########################################################################## #
# Run Slow tests (Multinode test)
# Run misc test suites

slow-tests:
name: Slow tests
remote-tests:
name: Remote tests
needs: [config, build]
runs-on: ${{ matrix.os }}
env:
Expand All @@ -430,11 +441,65 @@ jobs:
os: ${{ matrix.os }}
ghc: ${{ matrix.ghc }}
use-freeze-file: ${{ matrix.use-freeze-file }}
- name: Run slow tests
timeout-minutes: 20
- name: Run remote-tests
timeout-minutes: 2
run: remote-tests

compaction-tests:
name: Compaction tests
needs: [config, build]
runs-on: ${{ matrix.os }}
env:
ARTIFACTS_NAME: chainweb-applications.${{ matrix.use-freeze-file }}.${{ matrix.ghc }}.${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.config.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACTS_NAME }}
path: .
- name: Install chainweb from artifacts
uses: ./.github/actions/install-chainweb-from-artifacts
with:
os: ${{ matrix.os }}
ghc: ${{ matrix.ghc }}
use-freeze-file: ${{ matrix.use-freeze-file }}
- name: Run compaction-tests
timeout-minutes: 7
run: |
ulimit -n 10000
compaction-tests

multi-node-network-tests:
name: Multi-node network tests
needs: [config, build]
runs-on: ${{ matrix.os }}
env:
ARTIFACTS_NAME: chainweb-applications.${{ matrix.use-freeze-file }}.${{ matrix.ghc }}.${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.config.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACTS_NAME }}
path: .
- name: Install chainweb from artifacts
uses: ./.github/actions/install-chainweb-from-artifacts
with:
os: ${{ matrix.os }}
ghc: ${{ matrix.ghc }}
use-freeze-file: ${{ matrix.use-freeze-file }}
- name: Run multi-node-network-tests
timeout-minutes: 7
run: |
ulimit -n 10000
cwtool slow-tests
multi-node-network-tests

# ########################################################################## #
# Run Benchmarks
Expand Down Expand Up @@ -697,6 +762,7 @@ jobs:
libbz2-1.0 \
libgflags2.2 \
zstd \
libmpfr6 \
locales &&
rm -rf /var/lib/apt/lists/* &&
locale-gen en_US.UTF-8 &&
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
EOF

# Build
- name: Delete Freeze file if it exists
- name: Delete freeze file if it exists
run: rm -f cabal.project.freeze
- name: Update package database
run: cabal update
Expand All @@ -116,10 +116,17 @@ jobs:
- name: Build chainweb library
run: cabal build lib:chainweb
- name: Build chainweb applications
run: cabal build test:chainweb-tests exe:cwtool chainweb:bench:bench
run: |
cabal build -j \
exe:compact \
test:chainweb-tests \
test:multi-node-network-tests \
test:compaction-tests \
test:remote-tests \
exe:cwtool \
chainweb:bench:bench
- name: Build chainweb-node application
run: cabal build chainweb-node:exe:chainweb-node

run: cabal build -j chainweb-node:exe:chainweb-node
- uses: actions/cache/save@v4
name: Save dist-newstyle cache
if: steps.cabal-dist-cache.outputs.cache-hit != 'true'
Expand All @@ -130,10 +137,10 @@ jobs:
dist-newstyle
key: ${{ steps.cabal-dist-cache.outputs.cache-primary-key }}

- name: Run Tests
- name: Run unit tests
run: |
ulimit -n 10000
cabal run tests -- --hide-successes -p '!/chainweb216Test/'
$(cabal list-bin chainweb:test:chainweb-tests) --hide-successes -p '!/chainweb216Test/'

# Checks
- name: Check that working directory tree is clean
Expand All @@ -155,3 +162,4 @@ jobs:
exit 1
fi
mv cabal.project.freeze.backup cabal.project.freeze

7 changes: 2 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,9 @@ jobs:

* ubuntu-22.04:
```sh
apt-get install ca-certificates libgmp10 libssl3 libsnappy1v5 zlib1g liblz4-1 libbz2-1.0 libgflags2.2 zstd
```
* ubuntu-20.04:
```sh
apt-get install ca-certificates libgmp10 libssl1.1 libsnappy1v5 zlib1g liblz4-1 libbz2-1.0 libgflags2.2 zstd
apt install ca-certificates libgmp10 libssl3 libsnappy1v5 zlib1g liblz4-1 libbz2-1.0 libgflags2.2 zstd libmpfr6 locales
```

' >> CHANGELOG.md
cat CHANGELOG.md

Expand Down
12 changes: 7 additions & 5 deletions bench/Chainweb/Pact/Backend/Bench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ import Chainweb.Graph
import Chainweb.Logger
import Chainweb.MerkleLogHash
import Chainweb.Pact.Backend.RelationalCheckpointer
import Chainweb.Pact.Backend.Types

import Chainweb.Pact.Backend.Utils
import Chainweb.Pact.Types
import Chainweb.Test.TestVersions
import Chainweb.Utils.Bench
import Chainweb.Utils (sshow)
import Chainweb.Version
import qualified Chainweb.Pact4.Backend.ChainwebPactDb as Pact4
import qualified Pact.Types.Command as Pact

testVer :: ChainwebVersion
testVer = instantCpmTestVersion petersonChainGraph
Expand All @@ -73,10 +75,10 @@ cpRestoreAndSave
:: (Monoid q)
=> Checkpointer logger
-> Maybe BlockHeader
-> [(BlockHeader, ChainwebPactDbEnv logger -> IO q)]
-> [(BlockHeader, PactDbEnv (Pact4.BlockEnv logger) -> IO q)]
-> IO q
cpRestoreAndSave cp pc blks = snd <$> _cpRestoreAndSave cp (ParentHeader <$> pc)
(traverse Stream.yield [RunnableBlock $ \dbEnv _ -> (,bh) <$> fun (_cpPactDbEnv dbEnv) | (bh, fun) <- blks])
(traverse Stream.yield [Pact4RunnableBlock $ \dbEnv _ -> (,bh) <$> fun (Pact4._cpPactDbEnv dbEnv) | (bh, fun) <- blks])

-- | fabricate a `BlockHeader` for a block given its hash and its parent.
childOf :: Maybe BlockHeader -> BlockHash -> BlockHeader
Expand Down Expand Up @@ -442,5 +444,5 @@ cpBenchLookupProcessedTx transactionCount cp = C.env setup' $ \ ~(ut) ->
pc02 = childOf (Just pc01) hash02

go (NoopNFData _) = do
_cpReadFrom (_cpReadCp cp) (Just (ParentHeader pc02)) $ \dbEnv ->
_cpLookupProcessedTx dbEnv (V.fromList [Pact.TypedHash "" | _ <- [1..transactionCount]])
_cpReadFrom (_cpReadCp cp) (Just (ParentHeader pc02)) Pact4T $ \dbEnv _ ->
Pact4._cpLookupProcessedTx dbEnv (V.fromList [Pact.RequestKey (Pact.toUntypedHash $ Pact.TypedHash "") | _ <- [1..transactionCount]])
33 changes: 19 additions & 14 deletions bench/Chainweb/Pact/Backend/ForkingBench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# OPTIONS_GHC -Wno-partial-type-signatures #-}

module Chainweb.Pact.Backend.ForkingBench ( bench ) where

Expand All @@ -31,6 +33,7 @@ import Data.Aeson hiding (Error)
import Data.ByteString (ByteString)
import Data.Char
import Data.Decimal
import Data.Either
import Data.FileEmbed
import Data.Foldable (toList)
import Data.IORef
Expand Down Expand Up @@ -81,23 +84,22 @@ import Chainweb.BlockHeight (BlockHeight(..))
import Chainweb.ChainId
import Chainweb.Graph
import Chainweb.Logger
import Chainweb.Mempool.Mempool (BlockFill(..))
import Chainweb.Mempool.Mempool
import Chainweb.Miner.Pact
import Chainweb.Pact.Backend.Compaction qualified as C
import Chainweb.Pact.Backend.Types

import Chainweb.Pact.Backend.Utils
import Chainweb.Pact.PactService
import Chainweb.Pact.Service.BlockValidation
import Chainweb.Pact.Service.PactQueue
import Chainweb.Pact.Service.Types
import Chainweb.Pact.Types
import Chainweb.Pact.Utils (toTxCreationTime)
import Chainweb.Payload
import Chainweb.Payload.PayloadStore
import Chainweb.Payload.PayloadStore.InMemory
import Chainweb.Test.TestVersions (slowForkingCpmTestVersion)
import Chainweb.Time
import Chainweb.Transaction
import qualified Chainweb.Pact4.Transaction as Pact4
import Chainweb.Utils
import Chainweb.Utils.Bench
import Chainweb.Version
Expand Down Expand Up @@ -242,7 +244,7 @@ createBlock validate parent nonce pact = do
-- assemble block without nonce and timestamp

bip <- throwIfNoHistory =<< newBlock noMiner NewBlockFill parent pact
let payload = blockInProgressToPayloadWithOutputs bip
let payload = forAnyPactVersion finalizeBlock bip

let creationTime = add second $ view blockCreationTime $ _parentHeader parent
let bh = newBlockHeader
Expand Down Expand Up @@ -383,15 +385,16 @@ withResources rdb trunkLength logLevel compact p f = C.envWithCleanup create des
testMemPoolAccess :: IORef Int -> MVar (Map Account (NonEmpty (DynKeyPair, [SigCapability]))) -> IO MemPoolAccess
testMemPoolAccess txsPerBlock accounts = do
return $ mempty
{ mpaGetBlock = \bf validate bh hash header -> do
{ mpaGetBlock = \bf validate bh hash bct -> do
if _bfCount bf /= 0 then pure mempty else do
testBlock <- getTestBlock accounts (_bct $ view blockCreationTime header) validate bh hash
testBlock <- getTestBlock accounts (_bct bct) validate bh hash
pure testBlock
}
where

setTime time pb = pb { _pmCreationTime = toTxCreationTime time }

getTestBlock :: _ -> _ -> MempoolPreBlockCheck Pact4.UnparsedTransaction to -> _ -> _ -> IO (V.Vector to)
getTestBlock mVarAccounts txOrigTime validate bHeight hash
| bHeight == 1 = do
meta <- setTime txOrigTime <$> makeMeta cid
Expand All @@ -402,10 +405,10 @@ testMemPoolAccess txsPerBlock accounts = do
modifyMVar' mVarAccounts
(const $ M.fromList $ zip as kss)

vs <- validate bHeight hash (V.fromList $ toList r)
vs <- validate bHeight hash (V.fromList $ toList $ Pact4.unparseTransaction <$> r)
-- TODO: something better should go here
unless (and vs) $ throwM $ userError $ "at blockheight 1: tx validation failed " <> sshow vs
return $! V.fromList $ toList r
unless (all isRight vs) $ throwM $ userError $ "at blockheight 1: tx validation failed " <> sshow r
return $! V.fromList [v | Right v <- toList vs]

| otherwise = do
withMVar mVarAccounts $ \accs -> do
Expand All @@ -419,7 +422,9 @@ testMemPoolAccess txsPerBlock accounts = do
case eCmd of
Left e -> throwM $ userError e
Right tx -> return tx
return $! txs
vs <- validate bHeight hash (V.fromList $ toList $ Pact4.unparseTransaction <$> txs)
unless (all isRight vs) $ throwM $ userError $ "tx validation failed " <> sshow txs
return $! V.fromList [v | Right v <- toList vs]

mkTransferCaps :: ReceiverName -> Amount -> (Account, NonEmpty (DynKeyPair, [SigCapability])) -> (Account, NonEmpty (DynKeyPair, [SigCapability]))
mkTransferCaps (ReceiverName (Account r)) (Amount m) (s@(Account ss),ks) = (s, (caps <$) <$> ks)
Expand Down Expand Up @@ -509,10 +514,10 @@ safeCapitalize :: String -> String
safeCapitalize = maybe [] (uncurry (:) . bimap toUpper (Prelude.map toLower)) . Data.List.uncons


-- TODO: Use the new `assertCommand` function.
validateCommand :: Command Text -> Either String ChainwebTransaction
-- TODO: Use the new `assertPact4Command` function.
validateCommand :: Command Text -> Either String Pact4.Transaction
validateCommand cmdText = case verifyCommand cmdBS of
ProcSucc cmd -> Right (mkPayloadWithTextOld <$> cmd)
ProcSucc cmd -> Right (Pact4.mkPayloadWithTextOld <$> cmd)
ProcFail err -> Left err
where
cmdBS :: Command ByteString
Expand Down
Loading
Loading