Skip to content

Commit ddeb817

Browse files
committed
add keccak256 native
1 parent 34f5971 commit ddeb817

File tree

13 files changed

+260
-13
lines changed

13 files changed

+260
-13
lines changed

docs/en/pact-functions.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ Return ID if called during current pact execution, failing if not.
461461
Obtain current pact build version.
462462
```lisp
463463
pact> (pact-version)
464-
"4.10"
464+
"4.11"
465465
```
466466

467467
Top level only: this function will fail if used in module code.
@@ -1796,7 +1796,23 @@ pact> (scalar-mult 'g1 {'x: 1, 'y: 2} 2)
17961796
{"x": 1368015179489954701390400359078579693043519447331113978918064868415326638035,"y": 9918110051302171585080402603319702774565515993150576347155970296011118125764}
17971797
```
17981798

1799-
## Poseidon Hash {#Poseidon Hash}
1799+
## Hashes {#Hashes}
1800+
1801+
### keccak256 {#keccak256}
1802+
1803+
*chunks* `[string]` *→* `string`
1804+
1805+
1806+
Compute the hash of a list of base64-encoded inputs. The hash is computed incrementally over all of the base64-decoded inputs.
1807+
```lisp
1808+
pact> (keccak256 [""])
1809+
"xdJGAYb3IzySfn2y3McDwOUAtlPKgic7e/rYBF2FpHA="
1810+
pact> (keccak256 ["IP9FQ2ml0FuBp489sFgZ/qmwjCOE91ywq2qhFd1pDaMTGHShyo9witFRnqlSweJJy1QNGWOSx56HdVQk/ufIkICMViciNZ7qUuihL7u5ad15YdK6UgN0k3VaX6BPDVChqibJtEFIwNO5TRxKWaMayhWui9RKy3gz2OkcS4b6MTWkIzh7gVG0Ez7SP21xh7UOwiBK2QGtdNOW5EJ04OyvquF7O5CF4iJgs1ylOxXMUqu6dYr2eY+9BOzuztZI869P2z3tdVeppc+3OCYSqKjz9FlH0aKc4pByko7Bk8ol1RBxvV4ZhOz0AvMG6nYvDyUoL1KW2Zdli+P5g2lv+m0JXGNptNr3nppdMTYikSj462PBK56fp4r/ej6eGaYgIkk80Tbe+7W7e6G5OPNn/S9j61ynbAsP8hueNsPwcjDPPDB05dpYcECnaXXX459ElKzlSG/L84CrdVjE/ollYzW4Lk24ZZUJ6rRqGWExJuWUBCcy3UxBH0GqjN6sccD7QKlObaVYwF53thgoBvJtmv3z2gDGlBkiLIGGpu+tYAtBDmzi8qeX5J3B8TUxmAH6bzlrBvl14qGQoCPkdLYY5w=="])
1811+
"DsjZ0g3fCnsCUelBpyYbVXUH/2KHtQQ2Ko8XNMWpEBI="
1812+
pact> (keccak256 ["IP9FQ2ml0FuBp489sFgZ/qmwjCOE91ywq2qhFd1pDaM=", "Exh0ocqPcIrRUZ6pUsHiSctUDRljkseeh3VUJP7nyJA=", "gIxWJyI1nupS6KEvu7lp3Xlh0rpSA3STdVpfoE8NUKE=", "qibJtEFIwNO5TRxKWaMayhWui9RKy3gz2OkcS4b6MTU=", "pCM4e4FRtBM+0j9tcYe1DsIgStkBrXTTluRCdODsr6o=", "4Xs7kIXiImCzXKU7FcxSq7p1ivZ5j70E7O7O1kjzr08=", "2z3tdVeppc+3OCYSqKjz9FlH0aKc4pByko7Bk8ol1RA=", "cb1eGYTs9ALzBup2Lw8lKC9SltmXZYvj+YNpb/ptCVw=", "Y2m02veeml0xNiKRKPjrY8Ernp+niv96Pp4ZpiAiSTw=", "0Tbe+7W7e6G5OPNn/S9j61ynbAsP8hueNsPwcjDPPDA=", "dOXaWHBAp2l11+OfRJSs5Uhvy/OAq3VYxP6JZWM1uC4=", "TbhllQnqtGoZYTEm5ZQEJzLdTEEfQaqM3qxxwPtAqU4=", "baVYwF53thgoBvJtmv3z2gDGlBkiLIGGpu+tYAtBDmw=", "4vKnl+SdwfE1MZgB+m85awb5deKhkKAj5HS2GOc="])
1813+
"DsjZ0g3fCnsCUelBpyYbVXUH/2KHtQQ2Ko8XNMWpEBI="
1814+
```
1815+
18001816

18011817
### poseidon-hash-hack-a-chain {#poseidon-hash-hack-a-chain}
18021818

@@ -1822,9 +1838,9 @@ pact> (poseidon-hash-hack-a-chain 1 2 3 4 5 6 7 8)
18221838
*x* `string` *→* `object:*`
18231839

18241840

1825-
Decode a base-64 encoded Hyperlane Token Message into an object `{recipient:GUARD, amount:DECIMAL, chainId:STRING}`.
1841+
Decode a base-64-unpadded encoded Hyperlane Token Message into an object `{recipient:GUARD, amount:DECIMAL, chainId:STRING}`.
18261842
```lisp
1827-
pact> (hyperlane-decode-token-message "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAewAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGF7InByZWQiOiAia2V5cy1hbGwiLCAia2V5cyI6WyJkYTFhMzM5YmQ4MmQyYzJlOTE4MDYyNmEwMGRjMDQzMjc1ZGViM2FiYWJiMjdiNTczOGFiZjZiOWRjZWU4ZGI2Il19AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==")
1843+
pact> (hyperlane-decode-token-message "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAewAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGF7InByZWQiOiAia2V5cy1hbGwiLCAia2V5cyI6WyJkYTFhMzM5YmQ4MmQyYzJlOTE4MDYyNmEwMGRjMDQzMjc1ZGViM2FiYWJiMjdiNTczOGFiZjZiOWRjZWU4ZGI2Il19AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
18281844
{"amount": 0.000000000000000123,"chainId": "4","recipient": KeySet {keys: [da1a339bd82d2c2e9180626a00dc043275deb3ababb27b5738abf6b9dcee8db6],pred: keys-all}}
18291845
```
18301846

@@ -1983,7 +1999,7 @@ Retreive any accumulated events and optionally clear event state. Object returne
19831999
*→* `[string]`
19842000

19852001

1986-
Queries, or with arguments, sets execution config flags. Valid flags: ["AllowReadInLocal","DisableHistoryInTransactionalMode","DisableInlineMemCheck","DisableModuleInstall","DisableNewTrans","DisablePact40","DisablePact410","DisablePact411","DisablePact42","DisablePact43","DisablePact431","DisablePact44","DisablePact45","DisablePact46","DisablePact47","DisablePact48","DisablePact49","DisablePactEvents","DisableRuntimeReturnTypeChecking","EnforceKeyFormats","OldReadOnlyBehavior","PreserveModuleIfacesBug","PreserveModuleNameBug","PreserveNsModuleInstallBug","PreserveShowDefs"]
2002+
Queries, or with arguments, sets execution config flags. Valid flags: ["AllowReadInLocal","DisableHistoryInTransactionalMode","DisableInlineMemCheck","DisableModuleInstall","DisableNewTrans","DisablePact40","DisablePact410","DisablePact411","DisablePact412","DisablePact42","DisablePact43","DisablePact431","DisablePact44","DisablePact45","DisablePact46","DisablePact47","DisablePact48","DisablePact49","DisablePactEvents","DisableRuntimeReturnTypeChecking","EnforceKeyFormats","OldReadOnlyBehavior","PreserveModuleIfacesBug","PreserveModuleNameBug","PreserveNsModuleInstallBug","PreserveShowDefs"]
19872003
```lisp
19882004
pact> (env-exec-config ['DisableHistoryInTransactionalMode]) (env-exec-config)
19892005
["DisableHistoryInTransactionalMode"]

golden/gas-model/golden

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,12 @@
922922
(diff-time (time "2016-07-22T12:00:00Z")
923923
(time "2018-07-22T12:00:00Z"))
924924
- 12
925+
- - |-
926+
(keccak256 [""])
927+
(keccak256 ["IP9FQ2ml0FuBp489sFgZ/qmwjCOE91ywq2qhFd1pDaMTGHShyo9witFRnqlSweJJy1QNGWOSx56HdVQk/ufIkICMViciNZ7qUuihL7u5ad15YdK6UgN0k3VaX6BPDVChqibJtEFIwNO5TRxKWaMayhWui9RKy3gz2OkcS4b6MTWkIzh7gVG0Ez7SP21xh7UOwiBK2QGtdNOW5EJ04OyvquF7O5CF4iJgs1ylOxXMUqu6dYr2eY+9BOzuztZI869P2z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KngqgdO04hzg2JJbS+yyHVDuzNJ6mSZfOPntCTqktEi9X27CFWoAwWEN/4Ir7DItecXm5BEu/TYGnFjsxOeMIiLU2sPlX7/macWL0ylqnVqSpgt+tvzHvJVCDxLXGwbmaEH19Ov/9uJFHwsxMmiZD9Hjl4tOTrqN7THy0tel9rc8WtrUKrg87VJ7OR3Rtts5vZ91EBs1OdVldUQPRP536eTcpJNMo+N0fy+taji6L9Mdt4I4/xGqgIfmJxJMpx6ysWmiFVte8vLKl1L5p0yhOnEDsSDjuhZISDOIKC2NeytqoT9VpBQn1T3fjWkF8WEZIvJg5uXTge/qwA46QKV0LE5AlMKgw0cK91T8fnJ+u1Dyk7tCo3XYbx+292iiih8YM1Cr1+cdY5cclAjHAmlglY2ia/GXit5p6K2ggBmd1LpEBdG8DGE4jmeTtiDXLjprpDilq8iCuI0JZ/gvQvMYPekpf8/cMXtTenIxRmhDpYvZzyCxek1F4aoo7/VcAMYV71Mh/T8ox7U1Q4U8hB9oCy1BYcAt06iQai0HXhGFljxsrkL/YSkwsnWVDhhqzxWRRdX3PubpgMzSI290C1gG0Gq4xfKdHTrbm3Q=="])
930+
- 14
925931
- - (make-list longNumber true)
926932
- 1026
927933
- - (make-list medNumber true)

pact.cabal

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ library
9696
cbits/musl/sqrt_data.c
9797
exposed-modules:
9898
Crypto.Hash.Blake2Native
99+
Crypto.Hash.Keccak256Native
99100
Crypto.Hash.HyperlaneMessageId
100101
Crypto.Hash.PoseidonNative
101102
Pact.Analyze.Remote.Types
@@ -222,11 +223,12 @@ library
222223
, direct-sqlite >=2.3.27
223224
, directory >=1.2.6.2
224225
, errors >=2.3
226+
, ethereum >= 0.1
225227
, exceptions >=0.8.3
226228
, filepath >=1.4.1.0
227229
, groups
228230
, hashable >=1.4
229-
, ethereum >= 0.1
231+
, hashes >= 0.2
230232
, lens >=4.14
231233
, megaparsec >=9
232234
, memory
@@ -421,6 +423,7 @@ test-suite hspec
421423
, attoparsec
422424
, base
423425
, base16-bytestring
426+
, base64-bytestring
424427
, bound
425428
, bytestring
426429
, containers
@@ -471,6 +474,7 @@ test-suite hspec
471474
GoldenSpec
472475
HistoryServiceSpec
473476
HyperlaneSpec
477+
Keccak256Spec
474478
PactContinuationSpec
475479
PersistSpec
476480
PoseidonSpec

src/Crypto/Hash/Keccak256Native.hs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{-# LANGUAGE DataKinds #-}
2+
{-# LANGUAGE DerivingStrategies #-}
3+
{-# LANGUAGE ImportQualifiedPost #-}
4+
{-# LANGUAGE OverloadedStrings #-}
5+
{-# LANGUAGE RankNTypes #-}
6+
{-# LANGUAGE ScopedTypeVariables #-}
7+
{-# LANGUAGE TypeApplications #-}
8+
9+
-- | Implementation of the `keccack256` pact native.
10+
--
11+
-- `keccak256` takes as input a Pact object representing a
12+
-- 'HyperlaneMessage', and returns a base16-encoded hash of the abi-encoding
13+
-- of the input.
14+
module Crypto.Hash.Keccak256Native (keccak256) where
15+
16+
import Control.Exception (Exception(..), SomeException(..), try)
17+
import Control.Lens ((^.))
18+
import Control.Monad (forM_)
19+
import Control.Monad.Catch (throwM)
20+
import Data.ByteString.Base64 qualified as Base64
21+
import Data.ByteString.Short qualified as BSS
22+
import Data.Hash.Class.Mutable (initialize, finalize, updateByteString)
23+
import Data.Hash.Internal.OpenSSL (OpenSslException(..))
24+
import Data.Hash.Keccak (Keccak256(..))
25+
import Data.Text (Text)
26+
import Data.Text.Encoding qualified as Text
27+
import Data.Vector (Vector)
28+
import Pact.Types.Term (Term, Name, _TLitString)
29+
import System.IO.Unsafe (unsafePerformIO)
30+
31+
keccak256 :: Vector (Term Name) -> Text
32+
keccak256 strings = unsafePerformIO $ do
33+
e <- try @SomeException @_ $ do
34+
ctx <- initialize @Keccak256
35+
forM_ strings $ \string -> do
36+
let s = string ^. _TLitString
37+
case Base64.decode (Text.encodeUtf8 s) of
38+
Left b64Err -> do
39+
throwM (Base64Exception b64Err)
40+
Right bytes -> do
41+
updateByteString @Keccak256 ctx bytes
42+
Keccak256 hash <- finalize ctx
43+
pure (BSS.fromShort hash)
44+
case e of
45+
Left err
46+
| Just (OpenSslException _) <- fromException err -> error "keccak256 failed"
47+
| Just (Base64Exception _) <- fromException err -> error "keccak256 failed: invalid base64 input"
48+
| otherwise -> error "keccak256 failed"
49+
Right hash -> pure (Text.decodeUtf8 (Base64.encode hash))
50+
{-# noinline keccak256 #-}
51+
52+
newtype Base64Exception = Base64Exception String
53+
deriving stock (Show)
54+
55+
instance Exception Base64Exception where
56+
displayException (Base64Exception err) =
57+
"base64 decode exception: " ++ err

src/Pact/Gas/Table.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ data GasCostConfig = GasCostConfig
5757
, _gasCostConfig_poseidonHashHackAChainLinearGasFactor :: Gas
5858
, _gasCostConfig_hyperlaneMessageIdGasPerRecipientOneHundredBytes :: MilliGas
5959
, _gasCostConfig_hyperlaneDecodeTokenMessageGasPerOneHundredBytes :: MilliGas
60+
, _gasCostConfig_keccak256GasPerOneHundredBytes :: MilliGas
6061
}
6162

6263
defaultGasConfig :: GasCostConfig
@@ -85,6 +86,7 @@ defaultGasConfig = GasCostConfig
8586
, _gasCostConfig_poseidonHashHackAChainQuadraticGasFactor = 38
8687
, _gasCostConfig_hyperlaneMessageIdGasPerRecipientOneHundredBytes = MilliGas 47
8788
, _gasCostConfig_hyperlaneDecodeTokenMessageGasPerOneHundredBytes = MilliGas 50
89+
, _gasCostConfig_keccak256GasPerOneHundredBytes = MilliGas 146
8890
}
8991

9092
defaultGasTable :: Map Text Gas
@@ -242,6 +244,7 @@ defaultGasTable =
242244
,("poseidon-hash-hack-a-chain", 124)
243245
,("hyperlane-message-id", 2)
244246
,("hyperlane-decode-token-message", 2)
247+
,("keccak256",3)
245248
]
246249

247250
{-# NOINLINE defaultGasTable #-}
@@ -345,6 +348,9 @@ tableGasModel gasConfig =
345348
GHyperlaneDecodeTokenMessage len ->
346349
let MilliGas costPerOneHundredBytes = _gasCostConfig_hyperlaneDecodeTokenMessageGasPerOneHundredBytes gasConfig
347350
in MilliGas (costPerOneHundredBytes * div (fromIntegral len) 100)
351+
GKeccak256 numBytes ->
352+
let MilliGas costPerOneHundredBytes = _gasCostConfig_keccak256GasPerOneHundredBytes gasConfig
353+
in MilliGas (costPerOneHundredBytes * div (fromIntegral numBytes) 100)
348354

349355
in GasModel
350356
{ gasModelName = "table"

src/Pact/GasModel/GasTests.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ allTests = HM.fromList
228228
-- SPI/Hyperlane
229229
, ("hyperlane-message-id", hyperlaneMessageIdTests)
230230
, ("enforce-verifier", enforceVerifierTests)
231+
, ("keccak256", keccak256Tests)
231232

232233
-- Non-native concepts to benchmark
233234
, ("use", useTests)
@@ -2044,3 +2045,13 @@ hyperlaneMessageIdTests = defGasUnitTest $ PactExpression hyperlaneMessageIdExpr
20442045
(hyperlane-message-id {"destinationDomain": 1,"nonce": 325,"originDomain": 626,"recipient": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F","sender": "0x6b622d746f6b656e2d726f75746572","tokenMessage": {"amount": 10000000000000000000.0,"recipient": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F"},"version": 1})
20452046
(hyperlane-message-id {"destinationDomain": 1,"nonce": 325,"originDomain": 626,"recipient": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F","sender": "0x6b622d746f6b656e2d726f75746572","tokenMessage": {"amount": 10000000000000000000.0,"recipient": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"version": 1})
20462047
|]
2048+
2049+
keccak256Tests :: NativeDefName -> GasUnitTests
2050+
keccak256Tests = defGasUnitTest $ PactExpression keccak256ExprText Nothing
2051+
where
2052+
keccak256ExprText = [text|
2053+
(keccak256 [""])
2054+
(keccak256 ["IP9FQ2ml0FuBp489sFgZ/qmwjCOE91ywq2qhFd1pDaMTGHShyo9witFRnqlSweJJy1QNGWOSx56HdVQk/ufIkICMViciNZ7qUuihL7u5ad15YdK6UgN0k3VaX6BPDVChqibJtEFIwNO5TRxKWaMayhWui9RKy3gz2OkcS4b6MTWkIzh7gVG0Ez7SP21xh7UOwiBK2QGtdNOW5EJ04OyvquF7O5CF4iJgs1ylOxXMUqu6dYr2eY+9BOzuztZI869P2z3tdVeppc+3OCYSqKjz9FlH0aKc4pByko7Bk8ol1RBxvV4ZhOz0AvMG6nYvDyUoL1KW2Zdli+P5g2lv+m0JXGNptNr3nppdMTYikSj462PBK56fp4r/ej6eGaYgIkk80Tbe+7W7e6G5OPNn/S9j61ynbAsP8hueNsPwcjDPPDB05dpYcECnaXXX459ElKzlSG/L84CrdVjE/ollYzW4Lk24ZZUJ6rRqGWExJuWUBCcy3UxBH0GqjN6sccD7QKlObaVYwF53thgoBvJtmv3z2gDGlBkiLIGGpu+tYAtBDmzi8qeX5J3B8TUxmAH6bzlrBvl14qGQoCPkdLYY5w=="])
2055+
(keccak256 ["IP9FQ2ml0FuBp489sFgZ/qmwjCOE91ywq2qhFd1pDaM=", "Exh0ocqPcIrRUZ6pUsHiSctUDRljkseeh3VUJP7nyJA=", "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iDXLjprpDilq8iCuI0JZ/gvQvMYPekpf8/cMXtTenIxRmhDpYvZzyCxek1F4aoo7/VcAMYV71Mh/T8ox7U1Q4U8hB9oCy1BYcAt06iQai0HXhGFljxsrkL/YSkwsnWVDhhqzxWRRdX3PubpgMzSI290C1gG0Gq4xfKdHTrbm3Q=="])
2057+
|]

src/Pact/Interpreter.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ disablePact410Natives = disablePactNatives pact410Natives FlagDisablePact410
254254
disablePact411Natives :: ExecutionConfig -> Endo RefStore
255255
disablePact411Natives = disablePactNatives pact411Natives FlagDisablePact411
256256

257+
disablePact412Natives :: ExecutionConfig -> Endo RefStore
258+
disablePact412Natives = disablePactNatives pact412Natives FlagDisablePact412
259+
257260
pact40Natives :: [Text]
258261
pact40Natives = ["enumerate" , "distinct" , "emit-event" , "concat" , "str-to-list"]
259262

@@ -278,6 +281,9 @@ pact410Natives = ["poseidon-hash-hack-a-chain"]
278281
pact411Natives :: [Text]
279282
pact411Natives = ["enforce-verifier", "hyperlane-message-id", "hyperlane-decode-token-message"]
280283

284+
pact412Natives :: [Text]
285+
pact412Natives = ["keccak256"]
286+
281287
initRefStore :: RefStore
282288
initRefStore = RefStore nativeDefs
283289

@@ -292,7 +298,9 @@ versionedNativesRefStore ec = versionNatives initRefStore
292298
, disablePact46Natives ec
293299
, disablePact47Natives ec
294300
, disablePact410Natives ec
295-
, disablePact411Natives ec ]
301+
, disablePact411Natives ec
302+
, disablePact412Natives ec
303+
]
296304

297305
mkSQLiteEnv :: Logger -> Bool -> PSL.SQLiteConfig -> Loggers -> IO (PactDbEnv (DbEnv PSL.SQLite))
298306
mkSQLiteEnv initLog deleteOldFile c loggers = do

0 commit comments

Comments
 (0)