diff --git a/src/Chainweb/Pact/SPV.hs b/src/Chainweb/Pact/SPV.hs index f5fcaa2ce6..cf8ed51418 100644 --- a/src/Chainweb/Pact/SPV.hs +++ b/src/Chainweb/Pact/SPV.hs @@ -132,6 +132,7 @@ verifySPV bdb bh typ proof = runExceptT $ go typ proof where cid = CW._chainId bdb enableBridge = CW.enableSPVBridge (CW._chainwebVersion bh) cid (_blockHeight bh) + enableHyperlane = CW.enableHyperlane (CW._chainwebVersion bh) cid (_blockHeight bh) mkSPVResult' cr j | enableBridge = @@ -175,7 +176,7 @@ verifySPV bdb bh typ proof = runExceptT $ go typ proof PactResult (Right v) -> mkSPVResult' q v - "HYPERLANE_V3" -> evalHyperlaneCommand o + "HYPERLANE_V3" | enableHyperlane -> evalHyperlaneCommand o t -> throwError $! "unsupported SPV types: " <> t diff --git a/src/Chainweb/Version.hs b/src/Chainweb/Version.hs index 36c27c3300..94cccdd2b0 100644 --- a/src/Chainweb/Version.hs +++ b/src/Chainweb/Version.hs @@ -191,6 +191,7 @@ data Fork | Chainweb219Pact | Chainweb220Pact | Chainweb221Pact + | Hyperlane -- 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) @@ -222,6 +223,7 @@ instance HasTextRepresentation Fork where toText Chainweb219Pact = "chainweb219Pact" toText Chainweb220Pact = "chainweb220Pact" toText Chainweb221Pact = "chainweb221Pact" + toText Hyperlane = "hyperlane" fromText "slowEpoch" = return SlowEpoch fromText "vuln797Fix" = return Vuln797Fix @@ -249,6 +251,7 @@ instance HasTextRepresentation Fork where fromText "chainweb219Pact" = return Chainweb219Pact fromText "chainweb220Pact" = return Chainweb220Pact fromText "chainweb221Pact" = return Chainweb221Pact + fromText "hyperlane" = return Hyperlane fromText t = throwM . TextFormatException $ "Unknown Chainweb fork: " <> t instance ToJSON Fork where diff --git a/src/Chainweb/Version/Development.hs b/src/Chainweb/Version/Development.hs index 2d3e3b2eeb..f1f4ff6077 100644 --- a/src/Chainweb/Version/Development.hs +++ b/src/Chainweb/Version/Development.hs @@ -67,6 +67,7 @@ devnet = ChainwebVersion Chainweb219Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 550 Chainweb220Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 560 Chainweb221Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 580 + Hyperlane -> AllChains $ ForkAtBlockHeight $ BlockHeight 600 , _versionUpgrades = foldr (chainZip HM.union) (AllChains mempty) [ forkUpgrades devnet diff --git a/src/Chainweb/Version/Guards.hs b/src/Chainweb/Version/Guards.hs index ac1280dc49..276d2ded97 100644 --- a/src/Chainweb/Version/Guards.hs +++ b/src/Chainweb/Version/Guards.hs @@ -42,6 +42,7 @@ module Chainweb.Version.Guards , chainweb219Pact , chainweb220Pact , chainweb221Pact + , enableHyperlane , pact44NewTrans , pactParserVersion , maxBlockGasLimit @@ -238,6 +239,10 @@ chainweb220Pact = checkFork atOrAfter Chainweb220Pact chainweb221Pact :: ChainwebVersion -> ChainId -> BlockHeight -> Bool chainweb221Pact = checkFork atOrAfter Chainweb221Pact +-- | Bridge support: Hyperlane. +enableHyperlane :: ChainwebVersion -> ChainId -> BlockHeight -> Bool +enableHyperlane = checkFork atOrAfter Hyperlane + pactParserVersion :: ChainwebVersion -> ChainId -> BlockHeight -> PactParserVersion pactParserVersion v cid bh | chainweb213Pact v cid bh = PactParserChainweb213 diff --git a/src/Chainweb/Version/Mainnet.hs b/src/Chainweb/Version/Mainnet.hs index 75494fb991..bd941ea161 100644 --- a/src/Chainweb/Version/Mainnet.hs +++ b/src/Chainweb/Version/Mainnet.hs @@ -141,6 +141,7 @@ mainnet = ChainwebVersion Chainweb219Pact -> AllChains (ForkAtBlockHeight $ BlockHeight 3_774_423) -- 2023-06-02 00:00:00+00:00 Chainweb220Pact -> AllChains (ForkAtBlockHeight $ BlockHeight 4_056_499) -- 2023-09-08 00:00:00+00:00 Chainweb221Pact -> AllChains (ForkAtBlockHeight $ BlockHeight 4_177_889) -- 2023-10-20 00:00:00+00:00 + Hyperlane -> AllChains ForkNever -- TODO: add date and block height , _versionGraphs = (to20ChainsMainnet, twentyChainGraph) `Above` diff --git a/src/Chainweb/Version/Testnet.hs b/src/Chainweb/Version/Testnet.hs index c6e198c052..260d453b0e 100644 --- a/src/Chainweb/Version/Testnet.hs +++ b/src/Chainweb/Version/Testnet.hs @@ -121,6 +121,7 @@ testnet = ChainwebVersion Chainweb219Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 3_299_753 -- 2023-06-01 12:00:00+00:00 Chainweb220Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 3_580_964 -- 2023-09-08 12:00:00+00:00 Chainweb221Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 3_702_250 -- 2023-10-19 12:00:00+00:00 + Hyperlane -> AllChains ForkNever -- TODO: add date and block height , _versionGraphs = (to20ChainsTestnet, twentyChainGraph) `Above` diff --git a/test/Chainweb/Test/TestVersions.hs b/test/Chainweb/Test/TestVersions.hs index a79066ae13..7f29719003 100644 --- a/test/Chainweb/Test/TestVersions.hs +++ b/test/Chainweb/Test/TestVersions.hs @@ -139,6 +139,7 @@ fastForks = tabulateHashMap $ \case Chainweb219Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 27 Chainweb220Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 30 Chainweb221Pact -> AllChains $ ForkAtBlockHeight $ BlockHeight 33 + Hyperlane -> AllChains $ ForkAtBlockHeight $ BlockHeight 36 -- | A test version without Pact or PoW, with only one chain graph. barebonesTestVersion :: ChainGraph -> ChainwebVersion @@ -260,6 +261,7 @@ slowForkingCpmTestVersion g = buildTestVersion $ \v -> v Chainweb219Pact -> AllChains $ ForkAtBlockHeight (BlockHeight 71) Chainweb220Pact -> AllChains $ ForkAtBlockHeight (BlockHeight 85) Chainweb221Pact -> AllChains $ ForkAtBlockHeight (BlockHeight 100) + Hyperlane -> AllChains $ ForkAtBlockHeight (BlockHeight 115) -- | CPM version (see `cpmTestVersion`) with forks and upgrades quickly enabled. fastForkingCpmTestVersion :: ChainGraph -> ChainwebVersion