@@ -1566,28 +1566,49 @@ base64DecodeWithShimmedErrors i txt = do
1566
1566
hashDefs :: NativeModule
1567
1567
hashDefs = (" Hashes" ,)
1568
1568
[ poseidonHackAChainDef
1569
+ , poseidonHashAliasDef
1569
1570
, keccak256Def
1570
1571
]
1571
1572
1572
1573
poseidonHackAChainDef :: NativeDef
1573
1574
poseidonHackAChainDef = defGasRNative
1574
1575
" poseidon-hash-hack-a-chain"
1575
- poseidon'
1576
+ poseidonImpl
1576
1577
(funType tTyInteger [(" i" , tTyInteger), (" j" , tTyInteger), (" k" , tTyInteger), (" l" , tTyInteger), (" m" , tTyInteger), (" n" , tTyInteger), (" o" , tTyInteger), (" p" , tTyInteger)])
1577
- [" (poseidon-hash-hack-a-chain 1)"
1578
- ," (poseidon-hash-hack-a-chain 1 2)"
1579
- ," (poseidon-hash-hack-a-chain 1 2 3 4 5 6)"
1580
- ," (poseidon-hash-hack-a-chain 1 2 3 4 5 6 7 8)"
1581
- ]
1582
- " Poseidon Hash Function. Note: This is a reference version of the Poseidon hash function used by Hack-a-Chain."
1583
- where
1584
- poseidon' :: RNativeFun e
1585
- poseidon' i as
1586
- | not (null as) && length as <= 8 ,
1587
- Just intArgs <- traverse (preview _TLitInteger) as
1588
- = computeGas' i (GPoseidonHashHackAChain $ length as) $
1589
- return $ toTerm $ poseidon intArgs
1590
- | otherwise = argsError i as
1578
+ [" (poseidon-hash-hack-a-chain 1)"
1579
+ ," (poseidon-hash-hack-a-chain 1 2)"
1580
+ ," (poseidon-hash-hack-a-chain 1 2 3 4 5 6)"
1581
+ ," (poseidon-hash-hack-a-chain 1 2 3 4 5 6 7 8)"
1582
+ ]
1583
+ " Poseidon Hash Function. Note: This is a reference version of the Poseidon hash function used by Hack-a-Chain."
1584
+
1585
+ poseidonHashAliasDef :: NativeDef
1586
+ poseidonHashAliasDef = defGasRNative
1587
+ " hash-poseidon"
1588
+ poseidonImpl
1589
+ ( funType tTyInteger [(" i" , tTyInteger)]
1590
+ <> funType tTyInteger [(" i" , tTyInteger), (" j" , tTyInteger)]
1591
+ <> funType tTyInteger [(" i" , tTyInteger), (" j" , tTyInteger), (" k" , tTyInteger)]
1592
+ <> funType tTyInteger [(" i" , tTyInteger), (" j" , tTyInteger), (" k" , tTyInteger), (" l" , tTyInteger)]
1593
+ <> funType tTyInteger [(" i" , tTyInteger), (" j" , tTyInteger), (" k" , tTyInteger), (" l" , tTyInteger), (" m" , tTyInteger)]
1594
+ <> funType tTyInteger [(" i" , tTyInteger), (" j" , tTyInteger), (" k" , tTyInteger), (" l" , tTyInteger), (" m" , tTyInteger), (" n" , tTyInteger)]
1595
+ <> funType tTyInteger [(" i" , tTyInteger), (" j" , tTyInteger), (" k" , tTyInteger), (" l" , tTyInteger), (" m" , tTyInteger), (" n" , tTyInteger), (" o" , tTyInteger)]
1596
+ <> funType tTyInteger [(" i" , tTyInteger), (" j" , tTyInteger), (" k" , tTyInteger), (" l" , tTyInteger), (" m" , tTyInteger), (" n" , tTyInteger), (" o" , tTyInteger), (" p" , tTyInteger)]
1597
+ )
1598
+ [" (hash-poseidon 1)"
1599
+ ," (hash-poseidon 1 2)"
1600
+ ," (hash-poseidon 1 2 3 4 5 6)"
1601
+ ," (hash-poseidon 1 2 3 4 5 6 7 8)"
1602
+ ]
1603
+ " Poseidon Hash Function. This is an alias of 'poseidon-hash-hack-a-chain'."
1604
+
1605
+ poseidonImpl :: RNativeFun e
1606
+ poseidonImpl i as
1607
+ | not (null as) && length as <= 8 ,
1608
+ Just intArgs <- traverse (preview _TLitInteger) as
1609
+ = computeGas' i (GPoseidonHashHackAChain $ length as) $
1610
+ return $ toTerm $ poseidon intArgs
1611
+ | otherwise = argsError i as
1591
1612
1592
1613
keccak256Def :: NativeDef
1593
1614
keccak256Def = defGasRNative
0 commit comments