Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CU-86dthgzj6 - Update CryptoLib native contract #1257

Merged
merged 1 commit into from
May 24, 2024
Merged

Conversation

luc10921
Copy link
Contributor

Summary or solution description
Added the keccak256 method to CryptoLib and changed NamedCuve to NamedCurveHash.

How to Reproduce

from boa3.sc.compiletime import public
from boa3.sc.contracts import CryptoLib
from boa3.sc.types import ECPoint, NamedCurveHash
@public
def Main():
CryptoLib.verify_with_ecdsa(b'unit test', ECPoint(b'0123456789ABCDEFGHIJKLMNOPQRSTUVW'), b'signature', NamedCurveHash.SECP256K1KECCAK256)

from boa3.sc.compiletime import public
from boa3.sc.contracts import CryptoLib
@public
def main(data: bytes) -> bytes:
return CryptoLib.keccak256(data)

Tests

async def test_keccak256(self):
expected_output = (
Opcode.INITSLOT
+ b'\x00'
+ b'\x01'
+ Opcode.LDARG0
+ Opcode.CALLT + b'\x00\x00'
+ Opcode.RET
)
output, _ = self.assertCompile('Keccak256.py')
self.assertEqual(expected_output, output)

Platform:

  • OS: Windows 11 x64
  • Python version: Python 3.11

@luc10921 luc10921 requested a review from meevee98 May 23, 2024 17:21
@luc10921 luc10921 self-assigned this May 23, 2024
@melanke
Copy link
Contributor

melanke commented May 23, 2024

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 91.217% (+0.002%) from 91.215%
when pulling e7bec28 on CU-86dthgzj6
into 49731b6 on development.

@meevee98 meevee98 merged commit 9299150 into development May 24, 2024
5 checks passed
@meevee98 meevee98 deleted the CU-86dthgzj6 branch May 24, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants