diff --git a/CHANGELOG.md b/CHANGELOG.md index 100a8e55c2..c437ae25c5 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) +- Check for valid host architecture when production mining is enabled [`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**. @@ -12,7 +28,7 @@ This is a major version update. This release replaces all previous versions. Any prior version will stop working on **2024-08-21T00:00:00Z**. Node administrators must upgrade to this version before that date. The 2.25 feature upgrade will -occur at block height 5060924 which is estimated to be mined at **2024-08-21T00:00:00Z**. +occur at block height 5060924 which is estimated to be mined at **2024-08-22T00:00:00Z**. ### Changes - Updated to Pact 4.13: https://github.com/kadena-io/pact/releases/tag/v4.13.0 diff --git a/cabal.project b/cabal.project index 844a2cacb2..3925c30258 100644 --- a/cabal.project +++ b/cabal.project @@ -80,8 +80,8 @@ package yet-another-logger source-repository-package type: git location: https://github.com/kadena-io/pact.git - tag: f5980d1594122a65872980bf92d7295c32997116 - --sha256: 1vwv8qrg2fpxalk3mdnj2zwzjynldvdsdmz2jzq5jyrcykfqafy2 + tag: 058da315f7b427ad5dcaa334683600a1f7fd9588 + --sha256: 105jbsvrjv2zxsazd3vcbkml99w26xqimwjybfiznkg21456d6hn source-repository-package type: git @@ -210,3 +210,6 @@ allow-newer: *:hashable -- -------------------------------------------------------------------------- -- -- Upper Bounds + + +constraints: http-client-tls < 0.3.6.4 diff --git a/cabal.project.freeze b/cabal.project.freeze index 3394dccf75..ba09c501da 100644 --- a/cabal.project.freeze +++ b/cabal.project.freeze @@ -7,35 +7,24 @@ 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-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.1, any.base ==4.19.1.0, @@ -43,87 +32,65 @@ constraints: any.Cabal ==3.10.2.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, any.character-ps ==0.1, 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.3.0, - criterion -embed-data-files -fast, any.criterion-measurement ==0.2.2.0, - criterion-measurement -fast, any.crypto-api ==0.13.3, - crypto-api -all_cpolys, any.crypto-pubkey-types ==0.4.3, any.crypto-token ==0.1.1, any.cryptohash-md5 ==0.11.101.0, any.cryptohash-sha1 ==0.11.101.0, any.crypton ==1.0.0, - crypton -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq +support_pclmuldq +support_rdrand -support_sse +use_target_attributes, 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.7.1.1, any.data-default-class ==0.1.2.0, @@ -137,19 +104,14 @@ 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, @@ -158,10 +120,9 @@ constraints: any.Cabal ==3.10.2.0, 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.0, - generic-data -enable-inspect, any.generically ==0.1.1, any.ghc-bignum ==1.3, any.ghc-boot-th ==9.8.2, @@ -171,90 +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 ==1.20.1.1, 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.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.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.1.4.0, - network -devel, 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, @@ -262,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.11, - parsers +attoparsec +binary +parsec, 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, @@ -287,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, @@ -306,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-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, @@ -358,7 +278,6 @@ 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, @@ -369,22 +288,17 @@ constraints: any.Cabal ==3.10.2.0, 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.0, - tls -devel, 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.2, @@ -393,46 +307,34 @@ constraints: any.Cabal ==3.10.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.4.1, any.wai-middleware-throttle ==0.3.0.1, any.wai-middleware-validation ==0.1.0.2, any.warp ==3.4.1, - warp +allow-sendfilefd -network-bytestring -warp-debug +x509, 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-09-18T21:54:46Z + any.zlib ==0.7.1.0 +index-state: hackage.haskell.org 2024-10-29T18:54:35Z diff --git a/chainweb.cabal b/chainweb.cabal index 450b2ee571..af8b8ce6c1 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 @@ -471,6 +471,7 @@ test-suite chainweb-tests ghc-options: -threaded -with-rtsopts=-N4 + -Wno-x-partial -Wno-unrecognised-warning-flags type: exitcode-stdio-1.0 hs-source-dirs: test main-is: ChainwebTests.hs @@ -613,6 +614,7 @@ test-suite chainweb-tests , temporary >= 1.3 , text >=2.0 , time >= 1.12.2 + , tls >=1.9 , transformers >= 0.5 , unliftio >= 0.2.25 , unordered-containers >= 0.2.20 @@ -641,6 +643,7 @@ executable cwtool -threaded -rtsopts "-with-rtsopts=-N -H1G -A64M" + -Wno-x-partial -Wno-unrecognised-warning-flags hs-source-dirs: tools/cwtool tools/ea @@ -751,6 +754,7 @@ executable cwtool , temporary >= 1.3 , time >= 1.9 , text >= 2.0 + , tls >=1.9 , unliftio >= 0.2.25 , unordered-containers >= 0.2.20 , vector >= 0.12.2 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/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/BlockHeader/Internal.hs b/src/Chainweb/BlockHeader/Internal.hs index eee41e11ea..36914ef032 100644 --- a/src/Chainweb/BlockHeader/Internal.hs +++ b/src/Chainweb/BlockHeader/Internal.hs @@ -686,7 +686,7 @@ makeGenesisBlockHeader v cid = genesisHeight' :: HasCallStack => ChainwebVersion -> ChainId -> BlockHeight genesisHeight' v c = fst - $ head + $ unsafeHead "Chainweb.BlockHeader.Internal.genesisHeight'" $ NE.dropWhile (not . flip isWebChain c . snd) $ NE.reverse (ruleElems (BlockHeight 0) $ _versionGraphs v) 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/RestAPI/Server.hs b/src/Chainweb/Pact/RestAPI/Server.hs index f6dfd0bcfa..8431321d32 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/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 940f65b1f5..e5a9512ab1 100644 --- a/src/Chainweb/Utils.hs +++ b/src/Chainweb/Utils.hs @@ -10,6 +10,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE ImportQualifiedPost #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} @@ -222,6 +223,9 @@ module Chainweb.Utils , estimateBlockHeight , parseUtcTime +-- * General utilities +, unsafeHead +, unsafeTail ) where import Configuration.Utils hiding (Error, Lens) @@ -253,7 +257,6 @@ import qualified Data.ByteString.Builder as BB import qualified Data.ByteString.Lazy as BL import qualified Data.Csv as CSV import Data.Decimal -import Data.Default (def) import Data.Functor.Of import Data.Hashable import qualified Data.HashMap.Strict as HM @@ -277,6 +280,7 @@ import qualified Network.Connection as HTTP import qualified Network.HTTP.Client as HTTP import qualified Network.HTTP.Client.TLS as HTTP import Network.Socket hiding (Debug) +import Network.TLS.QUIC qualified as TLS import Numeric.Natural @@ -1326,8 +1330,9 @@ _T3 = iso (\(T3 a b c) -> (a,b,c)) (\(a,b,c) -> T3 a b c) 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 + 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 @@ -1353,12 +1358,12 @@ manager micros = HTTP.newManager unsafeManager :: Int -> IO HTTP.Manager unsafeManager micros = HTTP.newTlsManagerWith $ setManagerRequestTimeout micros - $ HTTP.mkManagerSettings (HTTP.TLSSettingsSimple True True True def) Nothing + $ HTTP.mkManagerSettings (HTTP.TLSSettingsSimple True True True TLS.defaultSupported) Nothing unsafeManagerWithSettings :: (HTTP.ManagerSettings -> HTTP.ManagerSettings) -> IO HTTP.Manager unsafeManagerWithSettings settings = HTTP.newTlsManagerWith $ settings - $ HTTP.mkManagerSettings (HTTP.TLSSettingsSimple True True True def) Nothing + $ HTTP.mkManagerSettings (HTTP.TLSSettingsSimple True True True TLS.defaultSupported) Nothing setManagerRequestTimeout :: Int -> HTTP.ManagerSettings -> HTTP.ManagerSettings setManagerRequestTimeout micros settings = settings @@ -1470,3 +1475,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 diff --git a/src/Chainweb/Version.hs b/src/Chainweb/Version.hs index bbb49573ff..59cac28c0b 100644 --- a/src/Chainweb/Version.hs +++ b/src/Chainweb/Version.hs @@ -208,6 +208,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) @@ -244,6 +245,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 @@ -276,6 +278,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/Network/X509/SelfSigned.hs b/src/Network/X509/SelfSigned.hs index 4ef0f68227..cc2b12a77a 100644 --- a/src/Network/X509/SelfSigned.hs +++ b/src/Network/X509/SelfSigned.hs @@ -6,6 +6,7 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE ImportQualifiedPost #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternSynonyms #-} @@ -120,7 +121,6 @@ import Data.Bifunctor import Data.ByteArray (ByteArray, convert) import qualified Data.ByteString as B (ByteString, length, pack) import qualified Data.ByteString.Char8 as B8 -import Data.Default (def) import Data.Foldable import Data.Hashable import Data.Hourglass (DateTime, durationHours, timeAdd) @@ -145,6 +145,7 @@ import Network.TLS hiding (HashSHA256, HashSHA512, SHA512) import Network.TLS.Extra (ciphersuite_default) import Network.Wai.Handler.WarpTLS as WARP (TLSSettings(..), tlsSettingsChainMemory, tlsSettingsMemory) +import Network.TLS.QUIC qualified as TLS import System.Hourglass (dateCurrent) import System.X509 (getSystemCertificateStore) @@ -679,11 +680,11 @@ certificateCacheManagerSettings policy = do -- and 'connectTo' are going to overwrite this anyways. -- settings certstore = (defaultParamsClient "" "") - { clientSupported = def + { clientSupported = TLS.defaultSupported { supportedCiphers = ciphersuite_default , supportedVersions = [TLS13, TLS12, TLS11, TLS10] } - , clientShared = def + , clientShared = (clientShared (defaultParamsClient "" "")) -- song and dance to get the default 'Shared' { sharedCAStore = certstore , sharedValidationCache = validationCache policy } @@ -732,7 +733,6 @@ isCertificateMismatchException (HttpExceptionRequest _ (InternalException e)) = -- ]" isCertificateMismatchException _ = False - -- -------------------------------------------------------------------------- -- -- Server Settings 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/Chainweb/Test/TestVersions.hs b/test/Chainweb/Test/TestVersions.hs index e223129f9e..e21ab14d55 100644 --- a/test/Chainweb/Test/TestVersions.hs +++ b/test/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/Chainweb/Test/Utils.hs b/test/Chainweb/Test/Utils.hs index 6318a9c52c..cd5ccb1b9a 100644 --- a/test/Chainweb/Test/Utils.hs +++ b/test/Chainweb/Test/Utils.hs @@ -138,7 +138,6 @@ import Data.Bifunctor hiding (second) import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL import Data.Coerce (coerce) -import Data.Default (def) import Data.Foldable import qualified Data.HashMap.Strict as HashMap import Data.IORef @@ -157,6 +156,7 @@ import Network.Socket (close) import qualified Network.Wai as W import qualified Network.Wai.Handler.Warp as W import Network.Wai.Handler.WarpTLS as W (runTLSSocket) +import Network.TLS.QUIC qualified as TLS import Numeric.Natural @@ -1143,7 +1143,7 @@ getClientEnv :: BaseUrl -> IO ClientEnv getClientEnv url = flip mkClientEnv url <$> HTTP.newTlsManagerWith mgrSettings where mgrSettings = HTTP.mkManagerSettings - (HTTP.TLSSettingsSimple True False False def) + (HTTP.TLSSettingsSimple True False False TLS.defaultSupported) Nothing -- | Backoff up to a constant 250ms, limiting to ~40s diff --git a/tools/cwtool/TxSimulator.hs b/tools/cwtool/TxSimulator.hs index e3d750a1f2..f7cff87f30 100644 --- a/tools/cwtool/TxSimulator.hs +++ b/tools/cwtool/TxSimulator.hs @@ -1,10 +1,12 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE ImportQualifiedPost #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ScopedTypeVariables #-} + module TxSimulator where @@ -57,6 +59,7 @@ import Chainweb.Version.Registry import Network.Connection import Network.HTTP.Client.TLS +import Network.TLS.QUIC qualified as TLS import Servant.Client.Core import Servant.Client @@ -109,7 +112,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 @@ -270,7 +273,7 @@ setupClient :: SimConfig -> IO ClientEnv setupClient sc = flip mkClientEnv (scApiHostUrl sc) <$> newTlsManagerWith mgrSettings where mgrSettings = mkManagerSettings - (TLSSettingsSimple True False False def) + (TLSSettingsSimple True False False TLS.defaultSupported) Nothing -- | note, fetches [low - 1, hi] to have parent headers