Jürgen Eckel d971709a79
250 migrate zenroom script usage within planetmint so that tx schema 21 is used (#253)
* * **Changed** adjusted to zenroom calling convention of PRP #13 (breaking change)
* **Changed** zenroom test cases to comply to the new calling convention
* **Fixed** zenroom signing bug (call of wrong function)
* **Changed** using cryptoconditions 0.10.0
* **Deprecated** usage of ripde160md as a address generation algorithm, isn't available from python 3.9.14 on, skipping these tests from now on.
* **Changed** script/ouptut tag to be of type array or object for schema v3.0 and v2.0
* **Changed** added 'script' handling to the common/transactions.py class
* **Fixed** data input handling to the transaction fullfillment methods

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* connected the version string in the banner of 'planetmint start' to the planetmint/version.py variables.

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* added input validation to the transaction script parsing and passing

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* added backend support for the scripts

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* adjusted tests to the new zenroom calling convention

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* blackified the code

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* increased version to 1.1.0

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

* fixed docs building issues of dependency inheritance

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-09-08 21:41:10 +02:00

87 lines
2.0 KiB
Python

# Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
import pytest
CONDITION_SCRIPT = """Scenario 'ecdh': create the signature of an object
Given I have the 'keyring'
Given that I have a 'string dictionary' named 'houses'
When I create the signature of 'houses'
Then print the 'signature'"""
FULFILL_SCRIPT = """Scenario 'ecdh': Bob verifies the signature from Alice
Given I have a 'ecdh public key' from 'Alice'
Given that I have a 'string dictionary' named 'houses'
Given I have a 'signature' named 'signature'
When I verify the 'houses' has a signature in 'signature' by 'Alice'
Then print the string 'ok'"""
SK_TO_PK = """Scenario 'ecdh': Create the keypair
Given that I am known as '{}'
Given I have the 'keyring'
When I create the ecdh public key
When I create the bitcoin address
Then print my 'ecdh public key'
Then print my 'bitcoin address'"""
GENERATE_KEYPAIR = """Scenario 'ecdh': Create the keypair
Given that I am known as 'Pippo'
When I create the ecdh key
When I create the bitcoin key
Then print data"""
INITIAL_STATE = {"also": "more data"}
SCRIPT_INPUT = {
"houses": [
{
"name": "Harry",
"team": "Gryffindor",
},
{
"name": "Draco",
"team": "Slytherin",
},
],
}
metadata = {"units": 300, "type": "KG"}
ZENROOM_DATA = {"that": "is my data"}
@pytest.fixture
def gen_key_zencode():
return GENERATE_KEYPAIR
@pytest.fixture
def secret_key_to_private_key_zencode():
return SK_TO_PK
@pytest.fixture
def fulfill_script_zencode():
return FULFILL_SCRIPT
@pytest.fixture
def condition_script_zencode():
return CONDITION_SCRIPT
@pytest.fixture
def zenroom_house_assets():
return SCRIPT_INPUT
@pytest.fixture
def zenroom_script_input():
return SCRIPT_INPUT
@pytest.fixture
def zenroom_data():
return ZENROOM_DATA