diff --git a/CHANGELOG.md b/CHANGELOG.md index 100a8e55c2..b3f7efd30d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +## 2.26 (2024-11-13) +This is a major version update. This release replaces all previous versions. + +Any prior version will stop working on **2024-11-13T00:00:00Z**. Node administrators must +upgrade to this version before that date. The 2.26 feature upgrade will +occur at block height 5302559 which is estimated to be mined at **2024-11-14T00:00:00Z**. + +### Changes +- Update to Pact 4.13.1 (see Pact's [CHANGELOG](https://github.com/kadena-io/pact/blob/master/CHANGELOG.md#4131)) +- Log large response sizes after a response completes. If the response doesn't complete, still log it if it's large. [`1b57a9b`](https://github.com/kadena-io/chainweb-node/commit/1b57a9bef226d5443d28f2c556f4bfd36f997922) +- p2p payload batch endpoint: Return 404 when the payload batch limit is 0 [`23726e1`](https://github.com/kadena-io/chainweb-node/commit/23726e18242ab44a3e01009356d2fda93afdf9e2) +- Support GHC 9.10, build with GHC 9.8.2 by default [`3fa69e8`](https://github.com/kadena-io/chainweb-node/commit/3fa69e89f5f17c97569b3cc5ee8ecead1162f56a) +- More rigorous system health checks at startup [`578e9fc`](https://github.com/kadena-io/chainweb-node/commit/578e9fc1e9fdb4381e889bdd5d85bad6f592115f) +- Log request bodies with debug level [`834c09e`](https://github.com/kadena-io/chainweb-node/commit/834c09e4217af3d17f7f52f8909031e0b152570f) +- Performance: Avoid redundant decode/encode in mempool lookup [`e8b2567`](https://github.com/kadena-io/chainweb-node/commit/e8b2567ca12978f7305ca26a446e6ca8b2d66795) + ## 2.25.1 (2024-08-25) This is a minor point release. Upgrading is **strongly recommended**. diff --git a/cabal.project b/cabal.project index 9b70afc7ca..a6f312e768 100644 --- a/cabal.project +++ b/cabal.project @@ -37,7 +37,7 @@ package chainweb benchmarks: True ghc-options: -Wno-missed-extra-shared-lib -package node +package chainweb-node ghc-options: -Wno-missed-extra-shared-lib if impl(ghc >= 9.8.1) @@ -80,8 +80,8 @@ package yet-another-logger source-repository-package type: git location: https://github.com/kadena-io/pact.git - tag: ef32c9c65a4b3d8c93e841c654cd4621749fb3a2 - --sha256: 0wmx246qppdc6s6m2nbj9kyxly6adx8qcsiryiibqah6bsdb3rdm + tag: 058da315f7b427ad5dcaa334683600a1f7fd9588 + --sha256: 105jbsvrjv2zxsazd3vcbkml99w26xqimwjybfiznkg21456d6hn source-repository-package type: git @@ -206,10 +206,11 @@ allow-newer: base-compat-batteries:* allow-newer: webauthn:* -- many packages use an spurious <1.5 upper bound on hashable -allow-newer: *:hashable +-- allow-newer: *:hashable -- -------------------------------------------------------------------------- -- -- Upper Bounds -- remove when crypton-connection >0.4.1 got released constraints: http-client-tls <0.3.6.4 +constraints: hashable < 1.4.5 \ No newline at end of file diff --git a/cabal.project.freeze b/cabal.project.freeze index bb2159eb22..8065484974 100644 --- a/cabal.project.freeze +++ b/cabal.project.freeze @@ -7,80 +7,58 @@ constraints: any.Cabal ==3.10.2.0, any.OneTuple ==0.4.2, any.Only ==0.1, any.QuickCheck ==2.15.0.1, - QuickCheck -old-random +templatehaskell, any.RSA ==2.4.1, any.SHA ==1.6.4.4, - SHA -exe, any.StateVar ==1.2.2, any.adjunctions ==4.4.2, - any.aeson ==2.2.3.0, - aeson +ordered-keymap, + any.aeson ==2.2.2.0, any.aeson-pretty ==0.8.10, - aeson-pretty -lib-only, any.ansi-terminal ==1.1.1, - ansi-terminal -example, any.ansi-terminal-types ==1.1, any.ap-normalize ==0.1.0.1, - ap-normalize -test-with-clang, any.appar ==0.1.8, any.array ==0.5.6.0, any.asn1-encoding ==0.9.6, any.asn1-parse ==0.9.5, any.asn1-types ==0.3.4, any.assoc ==1.1.1, - assoc -tagged, any.async ==2.2.5, - async -bench, any.atomic-primops ==0.8.8, - atomic-primops -debug, any.attoparsec ==0.14.4, - attoparsec -developer, - any.attoparsec-aeson ==2.2.2.0, any.authenticate-oauth ==1.7, - any.auto-update ==0.2.2, + any.auto-update ==0.2.1, any.base ==4.19.1.0, any.base-compat ==0.14.0, any.base-compat-batteries ==0.14.0, any.base-orphans ==0.9.2, any.base-unicode-symbols ==0.2.4.2, - base-unicode-symbols +base-4-8 -old-base, any.base16-bytestring ==1.0.2.0, any.base64-bytestring ==1.2.1.0, any.base64-bytestring-kadena ==0.1, any.basement ==0.0.16, any.bifunctors ==5.6.2, - bifunctors +tagged, any.binary ==0.8.9.1, any.binary-orphans ==1.0.5, any.bitvec ==1.1.5.0, - bitvec +simd, any.blaze-builder ==0.4.2.3, any.blaze-html ==0.9.2.0, any.blaze-markup ==0.8.3.0, any.boring ==0.2.2, - boring +tagged, any.bound ==2.0.7, - bound +template-haskell, any.bsb-http-chunked ==0.0.0.4, any.bytebuild ==0.3.16.2, - bytebuild -checked, any.byteorder ==1.0.4, any.bytes ==0.17.3, any.byteslice ==0.2.13.2, - byteslice +avoid-rawmemchr, any.bytesmith ==0.3.11.1, any.bytestring ==0.12.1.0, any.bytestring-builder ==0.10.8.2.0, - bytestring-builder +bytestring_has_builder, - any.cabal-doctest ==1.0.10, any.cache ==0.1.3.0, any.call-stack ==0.4.0, any.case-insensitive ==1.2.1.0, - any.cassava ==0.5.3.2, + any.cassava ==0.5.3.1, any.cborg ==0.2.10.0, - cborg +optimize-gmp, any.cereal ==0.5.8.3, - cereal -bytestring-builder, chainweb -debug -ed25519 -ghc-flags, chainweb-node -debug -ed25519 -ghc-flags, any.chainweb-storage ==0.1.0.0, @@ -88,46 +66,37 @@ constraints: any.Cabal ==3.10.2.0, any.charset ==0.3.10, any.chronos ==1.1.6.1, any.clock ==0.8.4, - clock -llvm, - any.cmdargs ==0.10.22, - cmdargs +quotation -testprog, any.code-page ==0.2.1, any.colour ==2.3.6, any.comonad ==5.0.8, - comonad +containers +distributive +indexed-traversable, - any.conduit ==1.3.6, + any.conduit ==1.3.5, any.configuration-tools ==0.7.0, - configuration-tools -remote-configs, any.constraints ==0.14.2, any.containers ==0.6.8, any.contiguous ==0.6.4.2, any.contravariant ==1.5.5, - contravariant +semigroups +statevar +tagged, any.cookie ==0.5.0, - any.criterion ==1.6.4.0, - criterion -embed-data-files -fast, - any.criterion-measurement ==0.2.3.0, - criterion-measurement -fast, + any.criterion ==1.6.3.0, + any.criterion-measurement ==0.2.2.0, any.crypto-api ==0.13.3, - crypto-api -all_cpolys, any.crypto-pubkey-types ==0.4.3, - any.crypto-token ==0.1.2, + any.crypto-token ==0.1.1, any.cryptohash-md5 ==0.11.101.0, any.cryptohash-sha1 ==0.11.101.0, - any.crypton ==1.0.1, - crypton -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq +support_pclmuldq +support_rdrand -support_sse +use_target_attributes, + any.crypton ==1.0.0, any.crypton-connection ==0.4.1, any.crypton-x509 ==1.7.7, any.crypton-x509-store ==1.6.9, any.crypton-x509-system ==1.6.7, any.crypton-x509-validation ==1.6.12, any.cryptonite ==0.30, - cryptonite -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq -support_pclmuldq +support_rdrand -support_sse +use_target_attributes, any.cuckoo ==0.3.1, - cuckoo -mwc-random -pcg-random, any.data-bword ==0.1.0.2, - any.data-default ==0.8.0.0, - any.data-default-class ==0.1.2.2, + any.data-default ==0.7.1.1, + any.data-default-class ==0.1.2.0, + any.data-default-instances-containers ==0.0.1, + any.data-default-instances-dlist ==0.0.1, + any.data-default-instances-old-locale ==0.0.1, any.data-dword ==0.3.2.1, any.data-fix ==0.3.4, any.data-ordlist ==0.4.7.0, @@ -135,31 +104,25 @@ constraints: any.Cabal ==3.10.2.0, any.deepseq ==1.5.0.0, any.dense-linear-algebra ==0.1.0.0, any.deriving-compat ==0.6.6, - deriving-compat +base-4-9 +new-functor-classes +template-haskell-2-11, any.digraph ==0.3.0, any.direct-sqlite ==2.3.29, - direct-sqlite +dbstat +fulltextsearch +haveusleep +json1 -mathfunctions -systemlib +urifilenames, any.directory ==1.3.8.1, any.distributive ==0.6.2.1, - distributive +semigroups +tagged, any.dlist ==1.0, - dlist -werror, any.easy-file ==0.2.5, any.enclosed-exceptions ==1.0.3, any.entropy ==0.4.1.10, - entropy -donotgetentropy, any.errors ==2.3.0, any.ethereum ==0.1.0.2, ethereum -ethhash -openssl-use-pkg-config, any.exceptions ==0.10.7, - any.fast-logger ==3.2.4, + any.fast-logger ==3.2.3, any.file-embed ==0.0.16.0, any.filepath ==1.4.200.1, any.fingertree ==0.1.5.0, - any.finite-typelits ==0.2.1.0, + any.finite-typelits ==0.2.0.1, any.free ==5.2, - any.generic-data ==1.1.0.1, - generic-data -enable-inspect, + any.generic-data ==1.1.0.0, any.generically ==0.1.1, any.ghc-bignum ==1.3, any.ghc-boot-th ==9.8.2, @@ -169,91 +132,68 @@ constraints: any.Cabal ==3.10.2.0, any.groups ==0.5.3, any.growable-vector ==0.1, any.half ==0.3.1, - any.happy ==2.1.2, - any.happy-lib ==2.1.2, - any.hashable ==1.5.0.0, - hashable -arch-native -random-initial-seed, - any.hashes ==0.3.0.1, - hashes -benchmark-cryptonite -openssl-use-pkg-config -test-cryptonite +with-openssl, - any.haskell-lexer ==1.1.2, + any.hashable ==1.4.4.0, + any.hashes ==0.3.0, + any.haskell-lexer ==1.1.1, any.haskell-src-exts ==1.23.1, any.haskell-src-meta ==0.8.14, any.heaps ==0.4, any.hourglass ==0.2.12, - any.hsc2hs ==0.68.10, - hsc2hs -in-ghc-tree, any.http-api-data ==0.6.1, - http-api-data -use-text-show, any.http-client ==0.7.17, - http-client +network-uri, any.http-client-tls ==0.3.6.3, any.http-date ==0.0.11, any.http-media ==0.8.1.1, - any.http-semantics ==0.2.1, + any.http-semantics ==0.2.0, any.http-types ==0.12.4, - any.http2 ==5.3.4, - http2 -devel -h2spec, + any.http2 ==5.3.1, any.indexed-list-literals ==0.2.1.3, any.indexed-traversable ==0.1.4, any.indexed-traversable-instances ==0.1.2, any.integer-conversion ==0.1.1, any.integer-gmp ==1.1, any.integer-logarithms ==1.0.3.1, - integer-logarithms -check-bounds +integer-gmp, any.invariant ==0.6.3, - any.iproute ==1.7.15, + any.iproute ==1.7.14, any.ixset-typed ==0.5, any.js-chart ==2.9.4.1, any.kan-extensions ==5.2.6, any.lens ==5.3.2, - lens -benchmark-uniplate -dump-splices +inlining -j +test-hunit +test-properties +test-templates +trustworthy, any.lens-aeson ==1.2.3, any.libBF ==0.6.8, - libBF -system-libbf, any.libyaml ==0.1.4, - libyaml -no-unicode -system-libyaml, any.libyaml-clib ==0.2.5, any.lifted-base ==0.2.3.12, any.loglevel ==0.1.0.0, any.managed ==1.0.10, any.massiv ==1.0.4.0, - massiv -unsafe-checks, any.math-functions ==0.3.4.4, - math-functions +system-erf +system-expm1, any.megaparsec ==9.6.1, - megaparsec -dev, any.memory ==0.18.0, - memory +support_bytestring +support_deepseq, any.merkle-log ==0.2.0, any.microlens ==0.4.13.1, any.microstache ==1.0.3, any.mime-types ==0.1.2.0, any.mmorph ==1.2.0, any.mod ==0.2.0.1, - mod +semirings +vector, any.monad-control ==1.0.3.1, - any.mono-traversable ==1.0.20.0, + any.mono-traversable ==1.0.17.0, any.mtl ==2.3.1, any.mtl-compat ==0.2.2, - mtl-compat -two-point-one -two-point-two, any.mwc-probability ==2.3.1, any.mwc-random ==0.15.1.0, - mwc-random -benchpapi, any.natural-arithmetic ==0.2.1.0, - any.network ==3.2.4.0, - network -devel, + any.network ==3.1.4.0, any.network-byte-order ==0.1.7, any.network-control ==0.1.3, any.network-info ==0.2.1, any.network-uri ==2.6.4.2, - any.nothunks ==0.3.0.0, - nothunks +bytestring +text +vector, + any.nothunks ==0.2.1.1, any.old-locale ==1.0.0.7, any.old-time ==1.1.0.4, any.optparse-applicative ==0.18.1.0, - optparse-applicative +process, any.os-string ==2.0.6, - any.pact ==4.13, + any.pact ==4.13.1, pact -build-tool +cryptonite-ed25519 -tests-in-lib, any.pact-json ==0.1.0.0, any.pact-time ==0.3.0.1, @@ -261,17 +201,13 @@ constraints: any.Cabal ==3.10.2.0, any.parallel ==3.2.2.0, any.parsec ==3.1.17.0, any.parser-combinators ==1.3.0, - parser-combinators -dev, - any.parsers ==0.12.12, - parsers +attoparsec +binary +parsec, + any.parsers ==0.12.11, any.patience ==0.3, any.pem ==0.2.4, any.poly ==0.5.1.0, - poly +sparse, any.pretty ==1.1.3.6, any.pretty-show ==1.10, any.prettyprinter ==1.7.1, - prettyprinter -buildreadme +text, any.prettyprinter-ansi-terminal ==1.1.3, any.primitive ==0.9.0.0, any.primitive-addr ==0.1.0.3, @@ -286,14 +222,11 @@ constraints: any.Cabal ==3.10.2.0, any.recv ==0.1.0, any.reducers ==3.12.4, any.reflection ==2.1.8, - reflection -slow +template-haskell, any.regex-base ==0.94.0.2, any.regex-tdfa ==1.3.2.2, - regex-tdfa +doctest -force-o2, any.resource-pool ==0.4.0.0, any.resourcet ==1.3.0, any.retry ==0.9.3.1, - retry -lib-werror, any.rocksdb-haskell-kadena ==1.1.0, rocksdb-haskell-kadena -with-tbb, any.rosetta ==1.0.1, @@ -305,50 +238,38 @@ constraints: any.Cabal ==3.10.2.0, any.sbv ==9.2, any.scheduler ==2.0.0.1, any.scientific ==0.3.8.0, - scientific -integer-simple, any.semialign ==1.3.1, - semialign +semigroupoids, any.semigroupoids ==6.0.1, - semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers, any.semigroups ==0.20, - semigroups +binary +bytestring -bytestring-builder +containers +deepseq +hashable +tagged +template-haskell +text +transformers +unordered-containers, any.semirings ==0.7, - semirings +containers +unordered-containers, any.serialise ==0.2.6.1, - serialise +newtime15, - any.servant ==0.20.2, - any.servant-client ==0.20.2, - any.servant-client-core ==0.20.2, - any.servant-server ==0.20.2, + any.servant ==0.20.1, + any.servant-client ==0.20, + any.servant-client-core ==0.20, + any.servant-server ==0.20, any.sha-validation ==0.1.0.1, any.show-combinators ==0.2.0.0, any.simple-sendfile ==0.2.32, - simple-sendfile +allow-bsd -fallback, any.singleton-bool ==0.1.8, any.socks ==0.6.1, any.some ==1.0.6, - some +newtype-unsafe, any.sop-core ==0.5.0.2, any.split ==0.2.5, any.splitmix ==0.1.0.5, - splitmix -optimised-mixer, any.statistics ==0.16.2.1, any.stm ==2.5.2.1, any.stm-chans ==3.0.0.9, any.stopwatch ==0.1.0.6, - stopwatch -test_delay_upper_bound -test_threaded, any.streaming ==0.2.4.0, any.streaming-commons ==0.2.2.6, - streaming-commons -use-bytestring-builder, - any.strict ==0.5.1, + any.strict ==0.5, any.strict-concurrency ==0.2.4.3, + any.string-conversions ==0.4.0.1, any.syb ==0.7.2.4, + any.system-cxx-std-lib ==1.0, any.tagged ==0.8.8, - tagged +deepseq +transformers, any.tasty ==1.5, - tasty +unix, any.tasty-golden ==2.3.5, - tasty-golden -build-example, any.tasty-hunit ==0.10.2, any.tasty-json ==0.1.0.0, any.tasty-quickcheck ==0.11, @@ -357,81 +278,63 @@ constraints: any.Cabal ==3.10.2.0, any.text ==2.1.1, any.text-iso8601 ==0.1.1, any.text-short ==0.1.6, - text-short -asserts, any.th-abstraction ==0.7.0.0, any.th-compat ==0.1.5, any.th-expand-syns ==0.4.11.0, - any.th-lift ==0.8.5, - any.th-orphans ==0.13.15, + any.th-lift ==0.8.4, + any.th-orphans ==0.13.14, any.th-reify-many ==0.1.10, any.these ==1.2.1, any.time ==1.12.2, any.time-compat ==1.9.7, any.time-locale-compat ==0.1.1.5, - time-locale-compat +old-locale, any.time-manager ==0.1.0, - any.tls ==2.1.1, - tls -devel, - any.tls-session-manager ==0.0.7, + any.tls ==2.1.0, + any.tls-session-manager ==0.0.6, any.token-bucket ==0.1.0.1, - token-bucket +use-cbits, any.torsor ==0.1.0.1, any.transformers ==0.6.1.0, any.transformers-base ==0.4.6, - transformers-base +orphaninstances, any.transformers-compat ==0.7.2, - transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, any.trifecta ==2.1.4, any.tuples ==0.1.0.0, - any.typed-process ==0.2.12.0, + any.typed-process ==0.2.11.1, any.uniplate ==1.6.13, any.unix ==2.8.4.0, - any.unix-compat ==0.7.3, - any.unix-time ==0.4.16, + any.unix-compat ==0.7.2, + any.unix-time ==0.4.15, any.unlifted ==0.2.2.0, any.unliftio ==0.2.25.0, any.unliftio-core ==0.2.1.0, any.unordered-containers ==0.2.20, - unordered-containers -debug, any.utf8-string ==1.0.2, any.uuid ==1.3.16, any.uuid-types ==1.0.6, any.validation ==1.1.3, any.vault ==0.3.1.5, - vault +useghc, any.vector ==0.13.1.0, - vector +boundschecks -internalchecks -unsafechecks -wall, any.vector-algorithms ==0.9.0.2, - vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks, any.vector-binary-instances ==0.2.5.2, any.vector-sized ==1.6.1, any.vector-stream ==0.1.0.1, any.vector-th-unbox ==0.2.2, any.void ==0.7.3, - void -safe, any.wai ==3.2.4, any.wai-app-static ==3.1.9, - wai-app-static +crypton -print, any.wai-cors ==0.2.7, any.wai-extra ==3.1.15, - wai-extra -build-example, - any.wai-logger ==2.5.0, + any.wai-logger ==2.4.1, any.wai-middleware-throttle ==0.3.0.1, any.wai-middleware-validation ==0.1.0.2, - any.warp ==3.4.3, - warp +allow-sendfilefd -network-bytestring -warp-debug +x509, - any.warp-tls ==3.4.7, + any.warp ==3.4.1, + any.warp-tls ==3.4.6, any.wherefrom-compat ==0.1.1.1, any.wide-word ==0.1.6.0, any.witherable ==0.5, any.word8 ==0.1.3, any.wreq ==0.5.4.3, - wreq -aws -developer +doctest -httpbin, any.yaml ==0.11.11.2, - yaml +no-examples +no-exe, any.yet-another-logger ==0.4.2, - yet-another-logger -tbmqueue, any.zigzag ==0.1.0.0, - any.zlib ==0.7.1.0, - zlib -bundled-c-zlib +non-blocking-ffi +pkg-config -index-state: hackage.haskell.org 2024-10-30T21:35:57Z + any.zlib ==0.7.1.0 +index-state: hackage.haskell.org 2024-10-31T14:36:55Z diff --git a/chainweb.cabal b/chainweb.cabal index 2955f04417..b8c91b26ed 100644 --- a/chainweb.cabal +++ b/chainweb.cabal @@ -1,7 +1,7 @@ cabal-version: 3.8 name: chainweb -version: 2.25.1 +version: 2.26 synopsis: A Proof-of-Work Parallel-Chain Architecture for Massive Throughput description: A Proof-of-Work Parallel-Chain Architecture for Massive Throughput. homepage: https://github.com/kadena-io/chainweb @@ -351,6 +351,7 @@ library build-depends: , Decimal >= 0.4.2 , aeson >= 2.2 + , aeson-pretty >= 0.8 , asn1-encoding >=0.9 , asn1-types >=0.3 , async >= 2.2 @@ -372,7 +373,7 @@ library , crypton-x509-system >=1.6 , crypton-x509-validation >=1.6 , cuckoo >= 0.3 - , data-default-class >=0.1.2.2 + , data-default-class >=0.1.2 , data-dword >= 0.3 , deepseq >= 1.4 , digraph >= 0.2.3 @@ -466,6 +467,8 @@ library library chainweb-test-utils import: warning-flags, debugging-flags default-language: Haskell2010 + ghc-options: + -Wno-x-partial -Wno-unrecognised-warning-flags hs-source-dirs: test/lib exposed-modules: Chainweb.Test.Cut @@ -584,6 +587,7 @@ test-suite chainweb-tests default-language: Haskell2010 ghc-options: -threaded + -Wno-x-partial -Wno-unrecognised-warning-flags type: exitcode-stdio-1.0 hs-source-dirs: test/unit main-is: ChainwebTests.hs @@ -714,6 +718,7 @@ test-suite compaction-tests -threaded -rtsopts "-with-rtsopts=-N -H1G -A64M" + -Wno-x-partial -Wno-unrecognised-warning-flags hs-source-dirs: test/compaction main-is: CompactionTests.hs build-depends: @@ -740,6 +745,7 @@ test-suite multi-node-network-tests -threaded -rtsopts "-with-rtsopts=-N -H1G -A64M" + -Wno-x-partial -Wno-unrecognised-warning-flags hs-source-dirs: test/multinode main-is: MultiNodeNetworkTests.hs build-depends: @@ -766,6 +772,7 @@ test-suite remote-tests -threaded -rtsopts "-with-rtsopts=-N -H1G -A64M" + -Wno-x-partial -Wno-unrecognised-warning-flags hs-source-dirs: test/remote main-is: RemoteTests.hs other-modules: @@ -802,6 +809,7 @@ executable cwtool -threaded -rtsopts "-with-rtsopts=-N -H1G -A64M" + -Wno-x-partial -Wno-unrecognised-warning-flags hs-source-dirs: tools/cwtool tools/ea diff --git a/default.nix b/default.nix index afa06c7d76..00add2d417 100644 --- a/default.nix +++ b/default.nix @@ -13,7 +13,7 @@ let flakeDefaultNix = (import ( }; in { pkgs ? pkgsDef -, compiler ? "ghc965" +, compiler ? "ghc982" , flakePath ? flakeDefaultNix.outPath , nix-filter ? inputs.nix-filter , pact ? null diff --git a/flake.lock b/flake.lock index 4b5ca2ff47..af40055c27 100644 --- a/flake.lock +++ b/flake.lock @@ -85,11 +85,11 @@ "hackage": { "flake": false, "locked": { - "lastModified": 1730334523, - "narHash": "sha256-m3YpA8tDs3EA3UZZy8U9hDT4NJuKuwi67qnGAwMBdMw=", + "lastModified": 1722385397, + "narHash": "sha256-rccC2HsYG7SUEo5dhLRhwx7RWRotvlzeF/TZ3IU4mZY=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "49a85d9969134eac18146e75d99e67dc454cfa34", + "rev": "cb8f6dc140b3bcfe14589f5a191fa912bef2464f", "type": "github" }, "original": { diff --git a/node/chainweb-node.cabal b/node/chainweb-node.cabal index 448a35f2fd..b279995c6a 100644 --- a/node/chainweb-node.cabal +++ b/node/chainweb-node.cabal @@ -1,7 +1,7 @@ cabal-version: 3.8 name: chainweb-node -version: 2.25.1 +version: 2.26 synopsis: A Proof-of-Work Parallel-Chain Architecture for Massive Throughput description: A Proof-of-Work Parallel-Chain Architecture for Massive Throughput. homepage: https://github.com/kadena-io/chainweb diff --git a/src/Chainweb/Cut.hs b/src/Chainweb/Cut.hs index 32407a9580..f30d820ddb 100644 --- a/src/Chainweb/Cut.hs +++ b/src/Chainweb/Cut.hs @@ -338,7 +338,7 @@ cutHeadersMinHeight = minimum . fmap (view blockHeight) {-# INLINE cutHeadersMinHeight #-} cutHeadersChainwebVersion :: HM.HashMap ChainId BlockHeader -> ChainwebVersion -cutHeadersChainwebVersion m = _chainwebVersion $ head $ toList m +cutHeadersChainwebVersion m = _chainwebVersion $ unsafeHead "Chainweb.Cut.cutHeadersChainwebVersion" $ toList m {-# INLINE cutHeadersChainwebVersion #-} -- | The function projects onto the chains available at the minimum block height diff --git a/src/Chainweb/Pact/PactService.hs b/src/Chainweb/Pact/PactService.hs index ffaa95c719..60fd8c6071 100644 --- a/src/Chainweb/Pact/PactService.hs +++ b/src/Chainweb/Pact/PactService.hs @@ -812,7 +812,7 @@ execReadOnlyReplay lowerBound maybeUpperBound = pactLabel "execReadOnlyReplay" $ let printValidationError (BlockValidationFailure (BlockValidationFailureMsg m)) = do writeIORef validationFailedRef True - logFunctionText logger Error (J.getJsonText m) + logFunctionText logger Error m printValidationError e = throwM e handleMissingBlock NoHistory = throwM $ BlockHeaderLookupFailure $ "execReadOnlyReplay: missing block: " <> sshow bh @@ -823,16 +823,15 @@ execReadOnlyReplay lowerBound maybeUpperBound = pactLabel "execReadOnlyReplay" $ $ readFrom (Just $ ParentHeader bhParent) $ do liftIO $ writeIORef heightRef (view blockHeight bh) payload <- liftIO $ fromJuste <$> - lookupPayloadDataWithHeight pdb (Just $ view blockHeight bh) (view blockPayloadHash bh) - let isPayloadEmpty = V.null (view payloadDataTransactions payload) + lookupPayloadWithHeight pdb (Just $ view blockHeight bh) (view blockPayloadHash bh) + let isPayloadEmpty = V.null (_payloadWithOutputsTransactions payload) let isUpgradeBlock = isJust $ _chainwebVersion bhdb ^? versionUpgrades . onChain (_chainId bhdb) . ix (view blockHeight bh) unless (isPayloadEmpty && not isUpgradeBlock) $ - void $ execBlock bh (CheckablePayload payload) + void $ execBlock bh (CheckablePayloadWithOutputs payload) ) validationFailed <- readIORef validationFailedRef when validationFailed $ - throwM $ BlockValidationFailure $ BlockValidationFailureMsg $ - J.encodeJsonText ("Prior block validation errors" :: Text) + throwM $ BlockValidationFailure $ BlockValidationFailureMsg "Prior block validation errors" return r heightProgress :: BlockHeight -> BlockHeight -> IORef BlockHeight -> (Text -> IO ()) -> IO () diff --git a/src/Chainweb/Pact/PactService/ExecBlock.hs b/src/Chainweb/Pact/PactService/ExecBlock.hs index 8d3220a4eb..217481b10d 100644 --- a/src/Chainweb/Pact/PactService/ExecBlock.hs +++ b/src/Chainweb/Pact/PactService/ExecBlock.hs @@ -7,6 +7,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} -- | @@ -43,7 +44,9 @@ import Control.Monad.Reader import Control.Monad.State.Strict import qualified Data.Aeson as A +import qualified Data.Aeson.Encode.Pretty as A import qualified Data.ByteString.Short as SB +import qualified Data.ByteString.Lazy as BL import Data.Decimal import Data.List qualified as List import Data.Either @@ -53,6 +56,7 @@ import qualified Data.Map as Map import Data.Maybe import Data.Text (Text) import qualified Data.Text as T +import qualified Data.Text.Encoding as T import Data.Vector (Vector) import qualified Data.Vector as V @@ -66,7 +70,6 @@ import Pact.Interpreter(PactDbEnv(..)) import qualified Pact.JSON.Encode as J import qualified Pact.Parse as P import qualified Pact.Types.Command as P -import Pact.Types.Exp (ParsedCode(..)) import Pact.Types.ExpParser (mkTextInfo, ParseEnv(..)) import qualified Pact.Types.Hash as P import Pact.Types.RPC @@ -560,86 +563,77 @@ validateHashes -> Either PactException PayloadWithOutputs validateHashes bHeader payload miner transactions = if newHash == prevHash - then Right pwo + then Right actualPwo else Left $ BlockValidationFailure $ BlockValidationFailureMsg $ - J.encodeJsonText $ J.object + prettyJson $ J.encodeText $ J.object [ "header" J..= J.encodeWithAeson (ObjectEncoded bHeader) , "mismatch" J..= errorMsg "Payload hash" prevHash newHash - , "details" J..= details + , "details" J..= difference ] where + prettyJson txt = case A.eitherDecodeStrict @A.Value (T.encodeUtf8 txt) of + Right obj -> T.cons '\n' $ T.decodeUtf8 $ BL.toStrict $ A.encodePretty obj + Left err -> error $ "validateHashes: impossible JSON decode failure: " <> show err - pwo = toPayloadWithOutputs miner transactions + actualPwo = toPayloadWithOutputs miner transactions - newHash = _payloadWithOutputsPayloadHash pwo + newHash = _payloadWithOutputsPayloadHash actualPwo prevHash = view blockPayloadHash bHeader -- The following JSON encodings are used in the BlockValidationFailure message - check :: Eq a => A.ToJSON a => T.Text -> [Maybe J.KeyValue] -> a -> a -> Maybe J.Builder - check desc extra expect actual - | expect == actual = Nothing - | otherwise = Just $ J.object - $ "mismatch" J..= errorMsg desc expect actual - : extra + transactionBytesToCommand :: Chainweb.Payload.Transaction -> P.Command T.Text + transactionBytesToCommand txBytes = case A.decodeStrict' (_transactionBytes txBytes) of + Just cmd -> cmd + Nothing -> error $ "validateHashes.transactionBytesToCommand: Failed to decode transaction bytes as Command Text" - errorMsg :: A.ToJSON a => T.Text -> a -> a -> J.Builder + transactionOutputsToCommandResult :: Chainweb.Payload.TransactionOutput -> P.CommandResult A.Value + transactionOutputsToCommandResult txOuts = case A.decodeStrict' (_transactionOutputBytes txOuts) of + Just cmdRes -> cmdRes + Nothing -> error $ "validateHashes.transactionOutputsToJson: Failed to decode transaction output bytes as CommandResult Text" + + errorMsg :: (A.ToJSON a) => T.Text -> a -> a -> J.Builder errorMsg desc expect actual = J.object [ "type" J..= J.text desc , "actual" J..= J.encodeWithAeson actual , "expected" J..= J.encodeWithAeson expect ] - details = case payload of - CheckablePayload pData -> J.Array $ catMaybes - [ check "Miner" - [] - (view payloadDataMiner pData) - (_payloadWithOutputsMiner pwo) - , check "TransactionsHash" - [ "txs" J..?= - (J.Array <$> traverse (uncurry $ check "Tx" []) (zip - (toList $ fst <$> _payloadWithOutputsTransactions pwo) - (toList $ view payloadDataTransactions pData) - )) - ] - (view payloadDataTransactionsHash pData) - (_payloadWithOutputsTransactionsHash pwo) - , check "OutputsHash" - [ "outputs" J..= J.object - [ "coinbase" J..= toPairCR (_transactionCoinbase transactions) - , "txs" J..= J.array (addTxOuts <$> _transactionPairs transactions) - ] + payloadDataToJSON pd = J.object + [ "miner" J..= J.encodeWithAeson (view payloadDataMiner pd) + , "txs" J..= J.array + [ J.array + -- only works because these are valid utf8, they may not be in future! + [ J.build $ transactionBytesToCommand cmd + | cmd <- V.toList (view payloadDataTransactions pd) ] - (view payloadDataOutputsHash pData) - (_payloadWithOutputsOutputsHash pwo) ] - - CheckablePayloadWithOutputs localPwo -> J.Array $ catMaybes - [ check "Miner" - [] - (_payloadWithOutputsMiner localPwo) - (_payloadWithOutputsMiner pwo) - , Just $ J.object - [ "transactions" J..= J.object - [ "txs" J..?= - (J.Array <$> traverse (uncurry $ check "Tx" []) (zip - (toList $ _payloadWithOutputsTransactions pwo) - (toList $ _payloadWithOutputsTransactions localPwo) - )) - , "coinbase" J..= - check "Coinbase" [] - (_payloadWithOutputsCoinbase pwo) - (_payloadWithOutputsCoinbase localPwo) - ] + , "hash" J..= J.string (show (view payloadDataPayloadHash pd)) + ] + + payloadWithOutputsToJSON pwo = J.object + [ "miner" J..= J.encodeWithAeson (_payloadWithOutputsMiner pwo) + , "txs" J..= J.array + [ J.array + -- only works because these are valid utf8, they may not be in future! + [ J.build $ transactionBytesToCommand cmd + , J.build $ transactionOutputsToCommandResult cr ] + | (cmd, cr) <- V.toList (_payloadWithOutputsTransactions pwo) ] - - addTxOuts :: (ChainwebTransaction, P.CommandResult [P.TxLogJson]) -> J.Builder - addTxOuts (tx,cr) = J.object - [ "tx" J..= fmap (fmap _pcCode . payloadObj) tx - , "result" J..= toPairCR cr - ] - - toPairCR cr = over (P.crLogs . _Just) - (CRLogPair (fromJuste $ P._crLogs (toHashCommandResult cr))) cr + , "hash" J..= J.string (show (_payloadWithOutputsPayloadHash pwo)) + ] + + expectedJSON = case payload of + CheckablePayloadWithOutputs expected -> + payloadWithOutputsToJSON expected + CheckablePayload expected -> + payloadDataToJSON expected + + actualJSON = + payloadWithOutputsToJSON actualPwo + + difference = J.object + [ "expected" J..= expectedJSON + , "actual" J..= actualJSON + ] diff --git a/src/Chainweb/Pact/RestAPI/Server.hs b/src/Chainweb/Pact/RestAPI/Server.hs index a930b5a010..a00d623178 100644 --- a/src/Chainweb/Pact/RestAPI/Server.hs +++ b/src/Chainweb/Pact/RestAPI/Server.hs @@ -345,7 +345,7 @@ listenHandler logger cdb cid pact mem (ListenerRequest key) = do hm <- internalPoll pdb bdb mem pact Nothing (pure key) if HM.null hm then go bh - else pure $! ListenResponse $ snd $ head $ HM.toList hm + else pure $! ListenResponse $ snd $ unsafeHead "Chainweb.Pact.RestAPI.Server.listenHandler.poll" $ HM.toList hm waitForNewBlock :: BlockHeader -> IO (Maybe BlockHeader) waitForNewBlock lastBlockHeader = atomically $ do diff --git a/src/Chainweb/Pact/Service/Types.hs b/src/Chainweb/Pact/Service/Types.hs index 3a66d2d25c..916e83bc96 100644 --- a/src/Chainweb/Pact/Service/Types.hs +++ b/src/Chainweb/Pact/Service/Types.hs @@ -213,16 +213,10 @@ data LocalPreflightSimulation | LegacySimulation deriving stock (Eq, Show, Generic) -newtype BlockValidationFailureMsg = BlockValidationFailureMsg J.JsonText +newtype BlockValidationFailureMsg = BlockValidationFailureMsg Text deriving (Eq, Ord, Generic) deriving newtype (J.Encode) --- | Intended only for use in Testing and Debugging. This doesn't --- roundtrip and may result in misleading failure messages. --- -instance FromJSON BlockValidationFailureMsg where - parseJSON = pure . BlockValidationFailureMsg . J.encodeWithAeson - -- | The type of local results (used in /local endpoint) -- data LocalResult diff --git a/src/Chainweb/RestAPI/NodeInfo.hs b/src/Chainweb/RestAPI/NodeInfo.hs index f6f5c4d66e..945083b231 100644 --- a/src/Chainweb/RestAPI/NodeInfo.hs +++ b/src/Chainweb/RestAPI/NodeInfo.hs @@ -36,6 +36,7 @@ import Chainweb.CutDB import Chainweb.Difficulty (BlockDelay) import Chainweb.Graph import Chainweb.RestAPI.Utils +import Chainweb.Utils import Chainweb.Utils.Rule import Chainweb.Version @@ -83,7 +84,7 @@ nodeInfoHandler v (SomeCutDb (CutDbT db :: CutDbT cas v)) = do let ch = cutToCutHashes Nothing curCut let curHeight = maximum $ map _bhwhHeight $ HM.elems $ _cutHashes ch let graphs = unpackGraphs v - let curGraph = head $ dropWhile (\(h,_) -> h > curHeight) graphs + let curGraph = unsafeHead "Chainweb.RestAPI.NodeInfo.nodeInfoHandler.curGraph" $ dropWhile (\(h,_) -> h > curHeight) graphs let curChains = map fst $ snd curGraph return $ NodeInfo { nodeVersion = _versionName v diff --git a/src/Chainweb/TreeDB.hs b/src/Chainweb/TreeDB.hs index a3cfd6eacc..14a1f3b291 100644 --- a/src/Chainweb/TreeDB.hs +++ b/src/Chainweb/TreeDB.hs @@ -732,7 +732,7 @@ toTree db = do S.toList_ $ S.map (\h -> (h, key h, [fromMaybe (key h) $ parent h] )) es let (g, vert, _) = graphFromEdges hs g' = transposeG g - pure . fmap (view _1 . vert) . head . dfs g' $ topSort g' + pure . fmap (view _1 . vert) . unsafeHead "Chainweb.TreeDB.toTree: empty DFS" . dfs g' $ topSort g' -- -------------------------------------------------------------------------- -- -- Misc Utils @@ -810,9 +810,9 @@ collectForkBlocks collectForkBlocks db lastHeader newHeader = do (oldL, newL) <- go (branchDiff db lastHeader newHeader) ([], []) when (null oldL) $ throwM $ TreeDbParentMissing @db lastHeader - let !common = head oldL - let !old = V.fromList $ tail oldL - let !new = V.fromList $ tail newL + let !common = unsafeHead "Chainweb.TreeDB.collectForkBlocks.common" oldL + let !old = V.fromList $ unsafeTail "Chainweb.TreeDB.collectForkBlocks.old" oldL + let !new = V.fromList $ unsafeTail "Chainweb.TreeDB.collectForkBlocks.new" newL return (common, old, new) where go !stream (!oldBlocks, !newBlocks) = do diff --git a/src/Chainweb/Utils.hs b/src/Chainweb/Utils.hs index ab8117c241..f5f1e4a3a9 100644 --- a/src/Chainweb/Utils.hs +++ b/src/Chainweb/Utils.hs @@ -223,6 +223,9 @@ module Chainweb.Utils , estimateBlockHeight , parseUtcTime +-- * General utilities +, unsafeHead +, unsafeTail ) where import Configuration.Utils hiding (Error, Lens) @@ -1327,9 +1330,10 @@ _T3 = iso (\(T3 a b c) -> (a,b,c)) (\(a,b,c) -> T3 a b c) -- Approximate thread delays approximately :: Integral a => a -> Prob.GenIO -> IO a approximately k gen = max 0 <$!> sample - where - sample = (round . (/ 256.0) . head) <$!> - Prob.samples 1 (Prob.normal mean sdev) gen + where + sample = do + samples <- Prob.samples 1 (Prob.normal mean sdev) gen + return $! round $ unsafeHead "Chainweb.Utils.approximately: empty samples" samples / 256.0 mean = fromIntegral $ k * 256 sdev = mean / 6 @@ -1481,3 +1485,13 @@ matchOrDisplayException display anyException = display specificException | otherwise = T.pack $ displayException anyException + +unsafeHead :: HasCallStack => String -> [a] -> a +unsafeHead msg = \case + x : _ -> x + [] -> error $ "unsafeHead: empty list: " <> msg + +unsafeTail :: HasCallStack => String -> [a] -> [a] +unsafeTail msg = \case + _ : xs -> xs + [] -> error $ "unsafeTail: empty list: " <> msg \ No newline at end of file diff --git a/src/Chainweb/Version.hs b/src/Chainweb/Version.hs index 4d0f0a6ddc..8942edc1e7 100644 --- a/src/Chainweb/Version.hs +++ b/src/Chainweb/Version.hs @@ -211,6 +211,7 @@ data Fork | Chainweb224Pact | Chainweb225Pact | Chainweb226Pact + | Chainweb227Pact -- always add new forks at the end, not in the middle of the constructors. deriving stock (Bounded, Generic, Eq, Enum, Ord, Show) deriving anyclass (NFData, Hashable) @@ -247,6 +248,7 @@ instance HasTextRepresentation Fork where toText Chainweb224Pact = "chainweb224Pact" toText Chainweb225Pact = "chainweb225Pact" toText Chainweb226Pact = "chainweb226Pact" + toText Chainweb227Pact = "chainweb227Pact" fromText "slowEpoch" = return SlowEpoch fromText "vuln797Fix" = return Vuln797Fix @@ -279,6 +281,7 @@ instance HasTextRepresentation Fork where fromText "chainweb224Pact" = return Chainweb224Pact fromText "chainweb225Pact" = return Chainweb225Pact fromText "chainweb226Pact" = return Chainweb226Pact + fromText "chainweb227Pact" = return Chainweb227Pact fromText t = throwM . TextFormatException $ "Unknown Chainweb fork: " <> t instance ToJSON Fork where diff --git a/src/Chainweb/Version/Mainnet.hs b/src/Chainweb/Version/Mainnet.hs index c2f4f7746d..f8f9cfb75d 100644 --- a/src/Chainweb/Version/Mainnet.hs +++ b/src/Chainweb/Version/Mainnet.hs @@ -150,7 +150,8 @@ mainnet = ChainwebVersion Chainweb223Pact -> AllChains (ForkAtBlockHeight $ BlockHeight 4_577_530) -- 2024-03-07 00:00:00+00:00 Chainweb224Pact -> AllChains (ForkAtBlockHeight $ BlockHeight 4_819_246) -- 2024-05-30 00:00:00+00:00 Chainweb225Pact -> AllChains (ForkAtBlockHeight $ BlockHeight 5_060_924) -- 2024-08-22 00:00:00+00:00 - Chainweb226Pact -> AllChains ForkNever + Chainweb226Pact -> AllChains (ForkAtBlockHeight $ BlockHeight 5_302_559) -- 2024-11-14 00:00:00+00:00 + Chainweb227Pact -> AllChains ForkNever , _versionGraphs = (to20ChainsMainnet, twentyChainGraph) `Above` @@ -220,5 +221,5 @@ mainnet = ChainwebVersion , (fromJuste (decodeStrictOrThrow' "\"_f1xkIQPGRcOBNBWkOvP0dGNOjmNtmXwOnXzfdwnmJQ\""), Gas 69_092) ] } - , _versionServiceDate = Just "2024-11-13T00:00:00Z" + , _versionServiceDate = Just "2025-02-05T00:00:00Z" } diff --git a/src/Chainweb/Version/RecapDevelopment.hs b/src/Chainweb/Version/RecapDevelopment.hs index fcc44b3692..0fbd6236dd 100644 --- a/src/Chainweb/Version/RecapDevelopment.hs +++ b/src/Chainweb/Version/RecapDevelopment.hs @@ -74,7 +74,8 @@ recapDevnet = ChainwebVersion Chainweb223Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 600 Chainweb224Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 610 Chainweb225Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 620 - Chainweb226Pact -> AllChains ForkNever + Chainweb226Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 630 + Chainweb227Pact -> AllChains ForkNever , _versionUpgrades = foldr (chainZip HM.union) (AllChains mempty) [ indexByForkHeights recapDevnet diff --git a/src/Chainweb/Version/Testnet.hs b/src/Chainweb/Version/Testnet.hs index 6781366c89..296877fb52 100644 --- a/src/Chainweb/Version/Testnet.hs +++ b/src/Chainweb/Version/Testnet.hs @@ -130,7 +130,8 @@ testnet = ChainwebVersion Chainweb223Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 4_100_681 -- 2024-03-06 12:00:00+00:00 Chainweb224Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 4_333_587 -- 2024-05-29 12:00:00+00:00 Chainweb225Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 4_575_072 -- 2024-08-21 12:00:00+00:00 - Chainweb226Pact -> AllChains ForkNever + Chainweb226Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 4_816_925 -- 2024-11-13 12:00:00+00:00 + Chainweb227Pact -> AllChains ForkNever , _versionGraphs = (to20ChainsTestnet, twentyChainGraph) `Above` @@ -191,5 +192,5 @@ testnet = ChainwebVersion , (fromJuste (decodeStrictOrThrow' "\"3fpFnFUrRsu67ItHicBGa9PVlWp71AggrcWoikht3jk\""), Gas 65130) ] } - , _versionServiceDate = Just "2024-11-13T00:00:00Z" + , _versionServiceDate = Just "2025-02-05T00:00:00Z" } diff --git a/src/P2P/Node.hs b/src/P2P/Node.hs index 8705b6c654..429be73827 100644 --- a/src/P2P/Node.hs +++ b/src/P2P/Node.hs @@ -531,13 +531,13 @@ findNextPeer conf node = do nodeGeometric node 0.95 >>= \case -- Special case that avoids forcing of p2 - 0 | not (null p0) -> head <$> shiftR p0 + 0 | not (null p0) -> unsafeHead "P2P.Node.nodeGeometric.0" <$> shiftR p0 -- general case that forces p2 n -> do let n' = min (length (p0 : p2) - 1) n -- note that @p0 : p2@ is guaranteed to be non-empty - head . concat <$> traverse shiftR (drop n' (p0 : p2)) + unsafeHead "P2P.Node.nodeGeometric.n" . concat <$> traverse shiftR (drop n' (p0 : p2)) where diff --git a/test/compaction/CompactionTests.hs b/test/compaction/CompactionTests.hs index 6ddda99fe0..8323a7cf74 100644 --- a/test/compaction/CompactionTests.hs +++ b/test/compaction/CompactionTests.hs @@ -37,12 +37,8 @@ suite = independentSequentialTestGroup "CompactionTests" withSystemTempDirectory "compact-resume-test-pact-target" $ \targetPactDbDir -> do Chainweb.Test.MultiNode.compactAndResumeTest loglevel (fastForkingCpmTestVersion pairChainGraph) 6 srcRocksDb targetRocksDb srcPactDbDir targetPactDbDir step , testCaseSteps "compact-live-node" $ \step -> - withTempRocksDb "pact-import-test-rocks" $ \rdb -> - withSystemTempDirectory "pact-import-test-pact-src" $ \srcPactDbDir -> - withSystemTempDirectory "pact-import-test-pact-target" $ \targetPactDbDir -> do + withTempRocksDb "compact-live-test-rocks" $ \rdb -> + withSystemTempDirectory "compact-live-test-pact-src" $ \srcPactDbDir -> + withSystemTempDirectory "compact-live-test-pact-target" $ \targetPactDbDir -> do Chainweb.Test.MultiNode.compactLiveNodeTest loglevel (fastForkingCpmTestVersion twentyChainGraph) 1 rdb srcPactDbDir targetPactDbDir step - , testCaseSteps "pact-import" $ \step -> - withTempRocksDb "pact-import-test-rocks" $ \rdb -> - withSystemTempDirectory "pact-import-test-pact" $ \pactDbDir -> do - Chainweb.Test.MultiNode.pactImportTest loglevel (fastForkingCpmTestVersion twentyChainGraph) 1 rdb pactDbDir step ] diff --git a/test/lib/Chainweb/Test/TestVersions.hs b/test/lib/Chainweb/Test/TestVersions.hs index e223129f9e..e21ab14d55 100644 --- a/test/lib/Chainweb/Test/TestVersions.hs +++ b/test/lib/Chainweb/Test/TestVersions.hs @@ -164,6 +164,7 @@ fastForks = tabulateHashMap $ \case Chainweb224Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 40 Chainweb225Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 42 Chainweb226Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 44 + Chainweb227Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 46 -- | A test version without Pact or PoW, with only one chain graph. barebonesTestVersion :: ChainGraph -> ChainwebVersion @@ -287,6 +288,7 @@ slowForks = tabulateHashMap \case Chainweb224Pact -> AllChains $ ForkAtBlockHeight (BlockHeight 125) Chainweb225Pact -> AllChains $ ForkAtBlockHeight (BlockHeight 130) Chainweb226Pact -> AllChains $ ForkAtBlockHeight (BlockHeight 135) + Chainweb227Pact -> AllChains $ ForkAtBlockHeight (BlockHeight 140) -- | CPM version (see `cpmTestVersion`) with forks and upgrades slowly enabled. slowForkingCpmTestVersion :: ChainGraph -> ChainwebVersion diff --git a/test/unit/Chainweb/Test/Rosetta/RestAPI.hs b/test/unit/Chainweb/Test/Rosetta/RestAPI.hs index f4a4bd8b58..1c6c46ffd1 100644 --- a/test/unit/Chainweb/Test/Rosetta/RestAPI.hs +++ b/test/unit/Chainweb/Test/Rosetta/RestAPI.hs @@ -217,35 +217,20 @@ blockTransactionTests tio envIo = step "send in block tx request" resp <- blockTransaction v cenv req - (fundtx,deb,cred,redeem,reward) <- + (fundtx,cred,deb,redeem,reward) <- case _transaction_operations $ _blockTransactionResp_transaction resp of [a,b,c,d,e] -> return (a,b,c,d,e) _ -> assertFailure "transfer should have resulted in 5 transactions" - -- The order in which operations are returned is flaky and may break. Use - -- the following to double check the order in case this test fails. - -- - -- print "fundtx: ----------------------" - -- print fundtx - -- print "cred: ----------------------" - -- print cred - -- print "deb: ----------------------" - -- print deb - -- print "redeem: ----------------------" - -- print redeem - -- print "reward: ----------------------" - -- print reward - -- print "----------------------" - step "validate initial gas buy at op index 0" validateOp 0 "FundTx" sender00ks Successful (negate defFundGas) fundtx - step "validate sender00 debit at op index 1" - validateOp 1 "TransferOrCreateAcct" sender00ks Successful (negate 1.0) deb + step "validate sender01 credit at op index 1" + validateOp 1 "TransferOrCreateAcct" sender01ks Successful 1.0 cred - step "validate sender01 credit at op index 2" - validateOp 2 "TransferOrCreateAcct" sender01ks Successful 1.0 cred + step "validate sender00 debit at op index 2" + validateOp 2 "TransferOrCreateAcct" sender00ks Successful (negate 1.0) deb step "validate sender00 gas redemption at op index 3" validateOp 3 "GasPayment" sender00ks Successful (defFundGas - transferGasCost) redeem @@ -310,21 +295,7 @@ blockTests testname tio envIo = testCaseSteps testname $ \step -> do validateBlock $ _blockResp_block resp - validateTxs remeds cbase fundtx deb cred gasRedeem gasReward = do - -- The order in which operations are returned is flaky and may break. Use - -- the following to double check the order in case this test fails. - -- - -- step $ "fundtx: ----------------------" - -- step $ debugShowOperation fundtx - -- step $ "deb: ----------------------" - -- step $ debugShowOperation deb - -- step $ "cred: ----------------------" - -- step $ debugShowOperation cred - -- step $ "redeem: ----------------------" - -- step $ debugShowOperation gasRedeem - -- step $ "reward: ----------------------" - -- step $ debugShowOperation gasReward - -- step $ "----------------------" + validateTxs remeds cbase fundtx cred deb gasRedeem gasReward = do -- coinbase is considered a separate tx list validateOp 0 "CoinbaseReward" noMinerks Successful defMiningReward cbase @@ -336,8 +307,8 @@ blockTests testname tio envIo = testCaseSteps testname $ \step -> do -- rest txs (i.e. transfer transaction) validateOp 0 "FundTx" sender00ks Successful (negate defFundGas) fundtx - validateOp 1 "TransferOrCreateAcct" sender00ks Successful (negate 1.0) deb - validateOp 2 "TransferOrCreateAcct" sender01ks Successful 1.0 cred + validateOp 1 "TransferOrCreateAcct" sender01ks Successful 1.0 cred + validateOp 2 "TransferOrCreateAcct" sender00ks Successful (negate 1.0) deb validateOp 3 "GasPayment" sender00ks Successful (defFundGas - transferGasCost) gasRedeem validateOp 4 "GasPayment" noMinerks Successful transferGasCost gasReward diff --git a/tools/cwtool/TxSimulator.hs b/tools/cwtool/TxSimulator.hs index f2af3108a9..250a3e415f 100644 --- a/tools/cwtool/TxSimulator.hs +++ b/tools/cwtool/TxSimulator.hs @@ -5,6 +5,7 @@ {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ScopedTypeVariables #-} + module TxSimulator where @@ -109,7 +110,7 @@ simulate sc@(SimConfig dbDir txIdx' _ _ cid ver gasLog doTypecheck) = do initRelationalCheckpointer defaultModuleCacheLimit sqlenv DoNotPersistIntraBlockWrites logger ver cid case (txIdx',doTypecheck) of (Just txIdx,_) -> do -- single-tx simulation - let pwo = head pwos + let pwo = unsafeHead "cwtool::TxSimulator.simulate" pwos let txs = _payloadWithOutputsTransactions pwo let md = _payloadWithOutputsMiner pwo miner <- decodeStrictOrThrow $ _minerData md