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

Add VerifySemantic to bindings #1608

Merged

Conversation

Thoralf-M
Copy link
Member

Description of change

Add VerifySemantic to bindings.

Type of change

  • Enhancement (a non-breaking change which adds functionality)

How the change has been tested

Running js and python examples calling it
Python code:

from dacite import from_dict
from iota_sdk import Utils, InputSigningData, TransactionPayload

prepared = {"essence": {"type": 1, "networkId": "7784367046153662236", "inputsCommitment": "0x7a40ce11802ca92397ac29df1fdf82047a806ddd5bbf25c04a960189b8035b35", "inputs": [{"type": 0, "transactionId": "0xba28a28e109a096a8b6347a365aaee1cf3988cbd52e58db3000b58ea8847a528", "transactionOutputIndex": 0}], "outputs": [{"type": 3, "amount": "1000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0xdeb2e6f8e78055259a27b889a3b9a57dfb321cbe73b5c54aea1542b440400524"}}]}, {"type": 3, "amount": "999000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0xdeb2e6f8e78055259a27b889a3b9a57dfb321cbe73b5c54aea1542b440400524"}}]}]}, "inputsData": [{"output": {"type": 3, "amount": "1000000000", "unlockConditions": [{"type": 0, "address": {
    "type": 0, "pubKeyHash": "0xdeb2e6f8e78055259a27b889a3b9a57dfb321cbe73b5c54aea1542b440400524"}}]}, "outputMetadata": {"blockId": "0x24be1fa26abdb1c50f41856bbdf68a18e7982c3dd263196e2ce72e0cf27a4d91", "transactionId": "0xba28a28e109a096a8b6347a365aaee1cf3988cbd52e58db3000b58ea8847a528", "outputIndex": 0, "isSpent": False, "milestoneIndexBooked": 400894, "milestoneTimestampBooked": 1699639723, "ledgerIndex": 400942}, "chain": {"coinType": 4219, "account": 0, "change": 0, "addressIndex": 0}}], "remainder": {"output": {"type": 3, "amount": "999000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0xdeb2e6f8e78055259a27b889a3b9a57dfb321cbe73b5c54aea1542b440400524"}}]}, "chain": {"coinType": 4219, "account": 0, "change": 0, "addressIndex": 0}, "address": {"type": 0, "pubKeyHash": "0xdeb2e6f8e78055259a27b889a3b9a57dfb321cbe73b5c54aea1542b440400524"}}}
signed = {"type": 6, "essence": {"type": 1, "networkId": "7784367046153662236", "inputsCommitment": "0x7a40ce11802ca92397ac29df1fdf82047a806ddd5bbf25c04a960189b8035b35", "inputs": [{"type": 0, "transactionId": "0xba28a28e109a096a8b6347a365aaee1cf3988cbd52e58db3000b58ea8847a528", "transactionOutputIndex": 0}], "outputs": [{"type": 3, "amount": "1000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0xdeb2e6f8e78055259a27b889a3b9a57dfb321cbe73b5c54aea1542b440400524"}}]}, {
    "type": 3, "amount": "999000000", "unlockConditions": [{"type": 0, "address": {"type": 0, "pubKeyHash": "0xdeb2e6f8e78055259a27b889a3b9a57dfb321cbe73b5c54aea1542b440400524"}}]}]}, "unlocks": [{"type": 0, "signature": {"type": 0, "publicKey": "0xb676bc347e3d02810b5f7641841ede6281680b36c3f92b956372a193caeee7f8", "signature": "0x65a1baff779371605f209378f14d70c8730b8394c124845d88818512105c3da3ace504396ef8c7dc80e25abced8e05f041bec3765c236e87f805e2a8938dfe09"}}]}


conflict = Utils.verify_semantic([from_dict(InputSigningData,
                                            i) for i in prepared['inputsData']], from_dict(TransactionPayload, signed), 1699532757)
print(conflict)

@thibault-martinez thibault-martinez merged commit 097f22e into iotaledger:develop Nov 13, 2023
12 checks passed
@Thoralf-M Thoralf-M deleted the bindings-verify-semantic branch November 13, 2023 14:21
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.

3 participants