Compare commits

...

114 Commits
v0.9.7 ... main

Author SHA1 Message Date
Jürgen Eckel
975921183c
fixed audit (#412)
* fixed audit
* fixed tarantool installation


Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2025-02-13 22:34:42 +01:00
Jürgen Eckel
a848324e1d
version bump 2025-02-13 17:14:24 +01:00
Jürgen Eckel
58131d445a
package changes (#411)
* package changes

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2025-02-13 17:11:34 +01:00
annonymmous
f3077ee8e3 Update poetry.lock 2025-02-13 12:20:07 +01:00
Julian Strobl
ef00a7fdde
[sonar] Remove obsolete project
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-09 10:19:58 +01:00
Julian Strobl
ce1649f7db
Disable scheduled workflow run 2023-09-11 08:20:31 +02:00
Julian Strobl
472d4cfbd9
Merge pull request #403 from planetmint/dependabot/pip/cryptography-41.0.2
Bump cryptography from 41.0.1 to 41.0.2
2023-07-20 08:06:30 +02:00
dependabot[bot]
9279dd680b
Bump cryptography from 41.0.1 to 41.0.2
Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.1 to 41.0.2.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/41.0.1...41.0.2)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-15 01:31:08 +00:00
Jürgen Eckel
1571211a24
bumped ersion to 2.5.1
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-06-22 09:28:45 +02:00
Jürgen Eckel
67abb7102d
fixed all-in-one container tarantool issue
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-06-22 09:21:51 +02:00
Jürgen Eckel
3ac0ca2c69
Tm 0.34.24 (#401)
* upgrade to Tendermint v0.34.24
* upgraded all the old tendermint versions to the new version


Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-06-21 11:59:44 +02:00
Jürgen Eckel
4bf1af6f06
fix dependencies (locked) and the audit (#400)
* fix dependencies (locked) and the audit

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

* added pip-audit to poetry to avoid inconsistent environments

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

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-06-14 09:30:03 +02:00
Lorenz Herzberger
0d947a4083
updated poetry workflow (#399)
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-06-13 09:49:54 +02:00
Jürgen Eckel
34e5492420
Fixed broken tx api (#398)
* enforced using a newer planetmint-transactions package and adjusted to a renaming of the variable
* bumped version & added changelog info

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-05-24 21:48:50 +02:00
Jürgen Eckel
4c55f576b9
392 abci rpc is not defined for election proposals (#397)
* fixed missing abci_rpc initialization
* bumped versions and added changelog
* sq fixes

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-05-24 09:44:50 +02:00
Jürgen Eckel
b2bca169ec
fixing potential type error in cases of new block heights (#396)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-05-23 15:22:21 +02:00
dependabot[bot]
3e223f04cd
Bump requests from 2.25.1 to 2.31.0 (#395)
* Bump requests from 2.25.1 to 2.31.0

Bumps [requests](https://github.com/psf/requests) from 2.25.1 to 2.31.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.25.1...v2.31.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* fixed vulnerability analysis (excluded new/different vulns)

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

* disabled another vuln

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

* adjust the right pipeline

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

* fixed proper pipeline

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-05-23 14:06:02 +02:00
Julian Strobl
95001fc262
[ci] Add nightly run
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-04-28 14:19:16 +02:00
Julian Strobl
923f14d669 [ci] Add SonarQube Quality Gate action
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-04-28 11:23:33 +02:00
Jürgen Eckel
74d3c732b1
bumped version and added missing changelog (#390)
* bumped version added missing changelog

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-04-21 11:05:33 +02:00
Jürgen Eckel
5c4923dbd6
373 integration of the dataaccessor singleton (#389)
* initial singleton usage

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

* passing all tests

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

* blackified

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

* aggretated code into helper functions

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

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-04-21 10:48:40 +02:00
Jürgen Eckel
884c3cc32b
385 cli cmd not properly implemented planetmint migrate up (#386)
* fixed cmd line to function mapping issue
* bumped version
* fixed init.lua script issue
* fixed indexing issue on tarantool migrate script

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-04-19 14:01:34 +02:00
Lorenz Herzberger
4feeed5862
fixed path to init.lua (#384)
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-04-18 11:41:20 +02:00
Lorenz Herzberger
461fae27d1
adjusted tarantool scripts for use in service (#383)
* adjusted tarantool scripts for use in service

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed schema migrate call

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed version number in changelog

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-04-18 09:36:07 +02:00
Jürgen Eckel
033235fb16
fixed the migration to a different output objec (#382)
* fixed the migration to a different output object
* fixed test cases (magic mocks)

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-04-17 15:19:46 +02:00
Lorenz Herzberger
11cf86464f
Add utxo migration (#379)
* added migration script for utxo space
* added migration commands
* changelog and version bump
* added db call to command

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-04-14 11:34:36 +02:00
Lorenz Herzberger
9f4cc292bc
fixed sonarqube issues (#377)
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-04-11 21:38:00 +02:00
Lorenz Herzberger
6a3c655e3b
Refactor utxo (#375)
* adjusted utxo space to resemble outputs

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added update_utxoset, removed deprecated test utils

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed test_update_utxoset

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed deprecated query and test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed delete_unspent_outputs tests

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved get_merkget_utxoset_merkle_root to dataaccessor and fixed test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed delete_transactions query

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed deprecated fixtures

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* blackified

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added get_outputs_by_owner query and adjusted dataaccessor

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed fastquery class

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed api test case

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed TestMultipleInputs

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed get_outputs_filtered test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed get_spent naming issue

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* blackified

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated changelog and version bump

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-04-11 15:18:44 +02:00
Lorenz Herzberger
dbf4e9085c
remove zenroom signing (#368)
* added zenroom validation to validator.py and adjusted zenroom test case
* updated transactions dependency
* updated poetry.lock

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-04-05 15:48:00 +02:00
Julian Strobl
4f9c7127b6
[sonar] Exclude k8s/ directory
Error: Can not add the same measure twice on k8s/dev-setup/nginx-http.yaml

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-04-04 11:06:41 +02:00
Julian Strobl
3b4dcac388
[sonar] Add initial Sonar Scan setup
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-04-04 11:03:17 +02:00
Jürgen Eckel
e69742808f
asyncio - removed deprecation (#372)
* improved connection error and termination handling
* removed keyboard termination: exception
* fixed test cases
* added python >= 3.10 compatibility

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-04-02 23:36:37 +02:00
Julian Strobl
08ce10ab1f
[ci] Fix docker tag for planetmint-aio (#356)
Otherwise a tag "latest-aio" instead of "latest" is created.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-03-14 09:37:23 +01:00
Jürgen Eckel
a3468cf991
added changelog , bumped version
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-03-13 13:19:30 +01:00
Julian Strobl
6403e02277
Merge pull request #354 from planetmint/jmastr/switch-to-planetmint-aio-docker-image
[ci] Switch to planetmint-aio Docker image
2023-03-13 13:16:16 +01:00
Julian Strobl
aa1310bede
Merge pull request #355 from planetmint/fixed_dockerfile_all_in_one
fixed usability of the planetmint-aio dockerfile/image
2023-03-13 13:08:47 +01:00
Jürgen Eckel
90759697ee
fixed usability of the planetmint-aio dockerfile/image
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-03-13 12:58:27 +01:00
Julian Strobl
eae8ec4c1e
[ci] Switch to planetmint-aio Docker image
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-03-13 10:55:17 +01:00
Julian Strobl
26e0a21e39
[ci] Add Docker All-In-One build (#352)
* [ci] Add Docker All-In-One build
* added changelog and version bump


Signed-off-by: Julian Strobl <jmastr@mailbox.org>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-03-10 08:43:41 +01:00
Jürgen Eckel
8942ebe4af
fixed object differentiation issue in eventify_block (#350)
* fixed object differentiation issue in eventify_block

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-03-06 15:11:53 +01:00
Jürgen Eckel
59f25687da
Hot fix 2.3.1 (#340)
* fixed issues after 2.3.0, one that has been caused by refactoring, the other existed already
* version bump and changlog

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-03-02 08:50:28 +01:00
Jürgen Eckel
83dfbed8b2
332 integrate tarantool driver abstraction (#339)
* renamed bigchain_pool -> validator_obj
* renamed the flask connection pool (class name)
* prepared AsyncIO separation
* renamed abci/core.py and class names, merged utils files
* removed obsolete file
* tidy up of ABCI application logic interface
* updated to newest driver tarantool 0.12.1
* Added new start options: --abci-only and --web-api-only to enable seperate execution of the services
* Added exception handling to the ABCI app
* removed space() object usage and thereby halved the amount of DB lookups
* removed async_io handling in the connection object but left some basics of the potential initialization
* tidied up the import structure/order
* tidied up imports
* set version number and changelog

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-03-01 17:42:18 +01:00
dependabot[bot]
2c0b0f03c9
Bump markdown-it-py from 2.1.0 to 2.2.0 (#336)
Bumps [markdown-it-py](https://github.com/executablebooks/markdown-it-py) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/executablebooks/markdown-it-py/releases)
- [Changelog](https://github.com/executablebooks/markdown-it-py/blob/master/CHANGELOG.md)
- [Commits](https://github.com/executablebooks/markdown-it-py/compare/v2.1.0...v2.2.0)

---
updated-dependencies:
- dependency-name: markdown-it-py
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-27 16:56:26 +01:00
Jürgen Eckel
0b0c954d34
331 refactor a certain module gets a specific driver type flask sync driver abci server async driver first we stick to the current tarantool driver (#337)
* created ABCI_RPC class to seperate RPC interaction from the other ABCI interactions
* renamed validation.py to validator.py
* simplified planetmint/__init__.py
* moved methods used by testing to tests/utils.py
* making planetmint/__init__.py lean
* moved ProcessGroup object to tests as it is only used there
* reintegrated disabled tests


Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-02-27 16:48:31 +01:00
Jürgen Eckel
77ab922eed
removed integration tests from the repo (#329)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-02-22 14:07:20 +01:00
Lorenz Herzberger
1fc306e09d
fixed subcondition instantiation recursively (#328)
* fixed subcondition instantiation recursively
* blackified
* updated changelog

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-02-22 10:39:04 +01:00
Jürgen Eckel
89b5427e47
fixed bug : roll back caused from_dict call on a None object (#327)
* fixed bug : roll back caused from_dict call on a None object

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

* blackified

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

* simplified fix

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

* blackified

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

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-02-21 10:57:37 +01:00
dependabot[bot]
979af5e453
Bump cryptography from 3.4.7 to 39.0.1 (#324)
Bumps [cryptography](https://github.com/pyca/cryptography) from 3.4.7 to 39.0.1.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/3.4.7...39.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-16 16:00:43 +01:00
Lorenz Herzberger
63b386a9cf
Migrate docs to use poetry (#326)
* migrated docs to use poetry, removed python browser script from makefile

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* bumped version in version.py

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated changelog

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-02-16 16:00:00 +01:00
dependabot[bot]
15a8a82191
Bump ipython from 8.9.0 to 8.10.0 (#323)
Bumps [ipython](https://github.com/ipython/ipython) from 8.9.0 to 8.10.0.
- [Release notes](https://github.com/ipython/ipython/releases)
- [Commits](https://github.com/ipython/ipython/compare/8.9.0...8.10.0)

---
updated-dependencies:
- dependency-name: ipython
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-16 15:22:41 +01:00
Lorenz Herzberger
c69272f6a2
removed unused code for deprecated text search (#322)
* removed unused code for depricated text search

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated changelog

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-02-15 16:11:36 +01:00
Lorenz Herzberger
384b091d74
Migrate to poetry (#321)
* added pyproject.toml and poetry.lock

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added scripts and classifiers to pyproject.toml

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated planetmint-transacitons, updated dockerfile to use poerty, updated changelog

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated CI and Makefile

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated CI audit step to use poetry

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated version number on pyproject.toml

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated version number

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-02-15 15:56:01 +01:00
Jürgen Eckel
811f89e5a6
79 hotfix election validation bckwrd compat (#319)
* fixed election and voting backward compatibility issues
* bumped version!
* fixed changed testcases and a bug
* blackified
* blackified with newest verion to satisfy CI
* fix dependency management issue

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-02-15 09:19:17 +01:00
Jürgen Eckel
2bb0539b78
catching Tarantool exceptions in case of concurrency (implicitly issu… (#312)
* catching Tarantool exceptions in case of concurrency (implicitly issued by the planetmint-diver-ts tests)
* fixed black version
* blackified (new version)

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-02-01 13:43:39 +01:00
Lorenz Herzberger
87506ff4a1
removed depricated or unused code (#311)
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-01-31 16:39:09 +01:00
Jürgen Eckel
3cb9424a35
added content: write permissions to the CI.yml
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-01-31 16:34:19 +01:00
Jürgen Eckel
6115a73f66
fixed workflow & bumped version
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-01-31 14:09:24 +01:00
Lorenz Herzberger
3f65a13c46
standardize blocks api (#306)
* adjusted block API return format
* blackified and updated version and changelog
* added to error message if no block with id was found

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-01-31 09:59:34 +01:00
Jürgen Eckel
9a74a9c987
286 pull access denied attempting to download planetmint docker image (#307)
* simplified CI workflows
* added docker image publishing on gh
* added arm buildxy
* added CI changes
* adjusted CI workflow
* fixed some vulnerability by upgrading dependencies


* changed Dockerfile-dev to be the default

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-01-31 09:55:19 +01:00
Jürgen Eckel
599f64f68c
Compose & Decompose Support (#304)
Added the newest transaction package and support for Compose and Decompose as specified in PRP-5 https://github.com/planetmint/PRPs/tree/main/5
2023-01-26 17:41:45 +01:00
Jürgen Eckel
cfa3b6dcd4
Fixing issues (#300)
* making multprocessing usage explicit and easily identifiable
* fixed error messaging and made API not found reports debug information
* removed acceptance tests
* removed obsolete gh workflow file
* fixed testcaes issue with patching
* changed testcases to not check for error logs as we moved this to debug logs
checks/asserts can be re-integrated asap we are able to set the debuglevel in for the single use cases

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-01-26 13:53:04 +01:00
Jürgen Eckel
84ae2ccf2b
upgraded tarantool to support M1 (#302)
* upgraded tarantool to support M1

* increased number to a stable version

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-01-26 13:51:11 +01:00
Lorenz Herzberger
8abaaf79f4
removed faulty pip statement (#301)
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-01-26 10:17:44 +01:00
Lorenz Herzberger
4472a1a3ee
refactor tarantool backend (#292)
* added initial interfaces for backend, refactored Asset and MetaData logic

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted input dataclass, added queries, removed convert

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* created backend models folder, replaced token_hex with uuid

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Add cleanup and add constants

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* added to and from static methods to asset, input model and removed logic from tools

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* simplified store_bulk_transaction and corresponding query, adjusted test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* changed script queries

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Add Output model

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* Adapt Output class

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* Further fixes

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* Further fixes

* Get rid of decompose

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* refactored init.lua

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* refactored drop.lua

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Add transaction data class

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* refactored init.lua

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fix tests

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* Fix more tests

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* Format file

* Fix recursion error

* More fixes

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* Further fixes

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* using init.lua for db setup

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed flush_db for new tarantool implementation

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* changed unique constraints

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* used new indexes on block related db operations

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Adapt models

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* Check if blocks is empty

* adjusted get_txids_filtered for new indexes

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Adaptions due to schema change

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* fixed get block test case

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Fix subcondition serialization

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* Remove unnecessary method

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* More fixes

* renamed group_txs and used data models in fastquery

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted query test cases, removed unused code

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* replaced asset search with get_asset_by_cid

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added limit to asset queries

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* replaced metadata search with cid lookup

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed most of the test_lib test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed election test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed some more test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed 'is' vs '==' issue

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

* - blackified & fixed recovery / delete transactions issues becaues of data model transitions
- reintegrated get_transaction() call in query -> delegating this to get_complete_transactions_by_ids

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

* show election status uses the governance table from now on
show election status maps the asset["data"] object properly

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

* fixed input object differences between old / new version and lookup of transaction in the governance pool

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

* fixed TX lookup issues due to different pools

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

* fixed wrong index name issue:  transaction_by_asset vs transaction_by_asset_id

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

* fixed asset class key mixup

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved field removal methods to DbTransaction
redefined strcuture of DbTransction.to_dict() to be equal to the one of Transactions.to_dict()

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

* added proper input conversion of the test cases and a proper input validation and object converion

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

* simplified imports
fixed transfer input issues of the tests

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

* fixed comparision issue : dict vs. object

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

* fixed schema validation errors

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added verification of ConditionDetails to the owner verification to avoid mixup between ConditionDetails and SubCondition
fixed Object comparision issues due to object changes

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

* fixed object handling issue and complicated stuff

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

* added missing import

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

* added proper corner case handling in case a requested block is not found

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

* fixed object comparision issue

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

* fixed output handling for validate_transfer_inputs

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed wrong search pool usage

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

* fixed zenroom testcase

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

* fixed last abci issues and blackified the code

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

* added tarantool exception catching and raising as well as logging

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

* fixed obj comparision issue in test_get_spent_issue_1271

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

* added raiing CriticialDoubleSpend Exception for governance and transactions
fixed search space issue with election / voting commit lookup

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

* * made returned outputs unique (get_owned_ids)
* added delete_output method to init.lua
* fixd output deletion issue by relaying the deletion to lua instead of the python code

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

* fixed rollback after crash

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted assets=None to assets=[{"data":None}] to avoid exeptions in the background service

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

* removed unused code

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed unused code, reverted transaction fetching, added return types to queries

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed duplicate code

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed depricated code

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* store transactions of various versions (backwardcompatibility)
added _bdb variable to init/drop DBs for the single use cases (started failing as TXs are looked up in DB - compared to before)

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

* added support for v2.0 transaction to DB writing/reading

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

* fixed merge errors (arguments ... )

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

* blackified

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

* Simplified unit tests (#294)

* adjusted make test
* 1st improvments to ease testing
* simplified gh actions
* adjusted gh action file
* removed deps
* added sudo to apt calls
* removed predefined pytest module definitions
* added installing planetmint into the unit test container
* give time to the db container
* added environment variables to unit-test.yml
* removed acceptances tests from test executions

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

* removed unused code, updated version number

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Signed-off-by: cybnon <stefan.weber93@googlemail.com>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: cybnon <stefan.weber93@googlemail.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: Jürgen Eckel <eckelj@users.noreply.github.com>
2023-01-16 15:21:56 +01:00
Jürgen Eckel
8730d516a3
Remove keyring tag - zenroom improvements/fixes (#291)
* removed keyring tag from zenroom tests
* removed keyring tag mishandling (zenroom) from cryptoconditions. using cyptoconditions 1.1.0 from now on
* fixed doc-build
* fixed docstring issue
* removed doc-building workflow and tox usage
* fixed import issue
* fixed connectionerror obj resolution in tests

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-12-21 16:38:25 +01:00
dependabot[bot]
f104b0979d
Bump certifi from 2021.10.8 to 2022.12.7 in /docs/root (#289)
Bumps [certifi](https://github.com/certifi/python-certifi) from 2021.10.8 to 2022.12.7.
- [Release notes](https://github.com/certifi/python-certifi/releases)
- [Commits](https://github.com/certifi/python-certifi/compare/2021.10.08...2022.12.07)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-12 13:08:17 +01:00
Jürgen Eckel
4ce06066b0
support for v2.0 and v3.0 TX (#290)
* added support for v2.0 TX
* integrated transactions package deeper into the code
* added test cases for v2.0 TXs
* added version gateway to the push transactions API to only allow latest versions schemes to enter the APP
* replaced exception catching by version-management

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-12-12 13:07:55 +01:00
Jürgen Eckel
bc1f13c9b2
fixed mising wheel package
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-11-29 13:54:34 +01:00
Jürgen Eckel
a56ef70407
fixed GH yaml file strucuture
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-11-29 13:48:06 +01:00
Jürgen Eckel
229ace99e1
from poetry to pip & venv
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-11-29 13:38:28 +01:00
Jürgen Eckel
dc09ce4044
added tag-release workflow
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-11-29 11:16:34 +01:00
Jürgen Eckel
bd1cdf44e4
Integration of new cryptoconditions package name and newest zenroom version (#288)
* adjusted to neweest transaction package
* adjusted to new planetmint-cryptoconditions imports
* added Changelog and increased version

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-11-29 10:56:07 +01:00
Jürgen Eckel
713bd5267c
Connection singleton (#265)
Created a Singleton for the connection classes.
2022-11-02 09:51:48 +01:00
Lorenz Herzberger
e401995637
updated asset migration (#276)
* started replacing asset with assets

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* switched asset_id for asset_ids

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* __init__ transfer now uses multiple assets

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed some test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added VS Code debugging section to tests/README.md

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed typo

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* minor changes to get_transaction

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Added ignore for .vscode

* convert cursor to list

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed get_assets

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Resolved the error of validation for assets

* added additional check to get_transaction

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted backend queries for multiple assets

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted common tests for multiple assets

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed db test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed election test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed almost all tendermint tests

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed some command test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed validation test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added comment to get_transaction_filtered

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed some core test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Updated the unspent output function of Transaction according to new assets model

* fixed txlist tests

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added comments to backend get_asset function, removed duplicate

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed further test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed some more tests

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added TODOs and changed test_client for aiohttp_client

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Solved assert comparision issue and handled key error with fallback.

* Converted asset to assets in websocket

* Resolved store transaction tests

* added check to fix vote test cases, requires future change

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed some test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed test case

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed test case, added TODO on transaction.py for COMPOSE DECOMPOSE

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed last test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added planetmint-driver branch reference to dockerfiles for testing

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Updated asset to assets on the acceptance/integration test suite

* changed get transaction list api point to use comma separated txids

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed acceptance test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* change cryptoconditions to asset-migration branch

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted doc strings

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed integration tests, removed unused code and adjusted some docstrings

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted some test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed some test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed some more test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed tendermint test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed web test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* bumped up planetmint-transactions version number

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* resolved linting issues

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed abci test

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated changelog and version umber

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Co-authored-by: ArpitShukla007 <arpitnshukla@gmail.com>
2022-10-28 11:45:27 +02:00
Lorenz Herzberger
3954340d7d
replaced transactions module (#268)
* adjusted hashlib imports and renamed to bigchaindb error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added type hints to transactions module

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved upsert_validator txs to transactions, updated imports

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed unused imports

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved tx validate to lib

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved from_db to planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed from db from transaction

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved election validation to planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved election methods to planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved get_validators and get_recipients to planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed unnecessary election method

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved show_election_status to planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved topology check to planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved election_id_to_public_key to validator_utils

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved vote methods to planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved process_block to planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed unused code from Vote

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved has election concluded to planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted has_election_concluded

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed unused imports, added copyright notices

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved rollback_eleciton to planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved on_rollback behaviour to planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved some validator utils to tendermint utils, election approval now handled by planetmint

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Use planetmint-transaction pypi package

Signed-off-by: cybnon <stefan.weber93@googlemail.com>

* fixed docs imports

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed validate call on test case

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* resolved linting errors

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed mock on test case

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted CHANGELOG

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed duplicate transactions test suite

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed pr comments

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* reordered imports to be standardized

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed unused imports and reordered them

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed linter error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Signed-off-by: cybnon <stefan.weber93@googlemail.com>
Co-authored-by: cybnon <stefan.weber93@googlemail.com>
2022-10-13 09:31:19 +02:00
Lorenz Herzberger
69fe9b253d
ipld documentation and validation (#259)
* added information on CID and IPLD marhsalling to basic-usage

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted test cases for cid validation

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed linting errors

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated version number and CHANGELOG

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-09-20 10:34:44 +02:00
Jürgen Eckel
da27c7f2d5
fixed 'make run' : using tarantool instead of mongodb (#258)
* fixed 'make run' : using tarantool instead of mongodb

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

* replaced mongodb by tarantool in the inline docs

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

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-09-19 13:42:37 +02:00
Jürgen Eckel
76c051ed26
increased rapid-json version (works now with 1.8.0) (#257)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-09-19 13:33:43 +02:00
Jürgen Eckel
637dc4993b
Ipld (#256)
* added ipld dep

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

* Cid tx schema (#252)

* changed asset and metadata schema to string

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated fixtures and adjusted some models and test cases

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted dependencies, fixtures and added comments

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* alignd TX inputs to be CID compatible

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

* converted assets to CIDs

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

* added multihashes

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

* fixed data packaging for IPLD compatible test cases for the unit tests

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

* Transaction hierarchy (#254)

* removed Transaction class from models.py, adjusted imports and function calls

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed comments

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed empty lines

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* resolved linting error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted import path

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added missing argument to mock

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* resolved linting error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted mock func signature

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed all unit tests

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

* fixed zenroom acceptance test

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

* adjusted common tx schema, fixed election validate

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed an planetmint-ipld dependency that solved a package namespace collision in the dependencies of IPLD

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

* disabled integration and acceptance tests as they rely on planetmint driver.
Plan is to resolve this circular dependency

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

* adjusted acceptance tests to IPLD requirements

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

* blackified

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

* added missing imports

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

* blackified little changes

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

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: Jürgen Eckel <eckelj@users.noreply.github.com>

* increased version
enforce ipld encodings to metadata and asset["data"]

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

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Co-authored-by: Lorenz Herzberger <64837895+LaurentMontBlanc@users.noreply.github.com>
2022-09-16 00:13:51 +02:00
Lorenz Herzberger
22ccb26d99
Transaction hierarchy (#254)
* removed Transaction class from models.py, adjusted imports and function calls

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed comments

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed empty lines

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* resolved linting error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted import path

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added missing argument to mock

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* resolved linting error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted mock func signature

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-09-13 17:27:51 +02:00
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
Lorenz Herzberger
e41ce5df76
Script tag schema (#245)
* updated tx schema for v2 and v3, some errors remaining

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* linted transaction spec v2, wip script tag

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed state error on script tag

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed transaction schema script error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-08-25 14:58:42 +02:00
Jürgen Eckel
a9abc4114a
added a fix for get_txid_filtered (#241)
* added a fix for get_txid_filtered

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

* moved 3 tx test to acceptance tests

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

* fixed linter issues

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

* renamed file

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Co-authored-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-08-23 09:59:52 +02:00
Lorenz Herzberger
6be78c052f
added exception to handle erroneus cmd output (#239)
* added exception to handle erroneus cmd output

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* linted the schema.py

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

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-08-19 10:08:58 +02:00
Lorenz Herzberger
0a21b0a9d9
updated primary indices from hash to tree (#235)
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-08-19 09:04:44 +02:00
Lorenz Herzberger
8abbef00fe
GitHub actions (#234)
* creating first github action

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fix syntax error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* renamed action, using black stable

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated checkout action on workflow black

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* formatted code with black

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* replaced lint with black service

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed black service added black check to makefile

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* replaced flake8 with black

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added pull_request to black actions trigger

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* replaced flake8 with black style checker (#212)

* updated version number to 1.0.0

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* creating first github action

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fix syntax error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* renamed action, using black stable

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated checkout action on workflow black

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* formatted code with black

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* version bumpt

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed some comments and unsused import

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* replaced lint with black service

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed black service added black check to makefile

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* replaced flake8 with black

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added pull_request to black actions trigger

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* started on unit test workflow

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed run step

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed typo

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* testing docker-compose

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* check docker-compose

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* try running pytest

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* check out -f

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* changed path

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* increased health check retries, added job dependency

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added path to docker-compose.yml to test action

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved container startup to test step

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added checkout step to test job

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* different kind of execution

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* checking build step

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed missing keyword

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added checkout to build step

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* storing artifacts

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added needs

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* changed Dockerfile-dev to python-slim

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added job matrix back in

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added abci to build job matrix

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated test job steps

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed typo

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* replaced docker exec with docker-compose exec for abci test

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added first version of acceptance and integration test action

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added runs-on

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed syntax error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* reverted to docker exec

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added copyright notice and env to start container step

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* separated abci from non abci test job

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* renamed pytest workflow to unit-test

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added codecov workflow

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added pytest install to codecov step

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added pip install

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* moved codecov to unit-test

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* show files

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* changed paths

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed debug job steps

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* renamed black to lint, added audit workflow

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* checking if dc down is necessary

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed dc down step from acceptance and integration

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed lint error

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added tox documentation to github acitons (#226)

* added documentation job

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added docs dependency install to docs workflow

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* add more dependencies

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* install rapidjson manually

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added python-rapidjson to docs requirements text

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* changed gh config on tox.ini

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added base58 to docs require

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* changed docs require to dev

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* reversed changes to docs require

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* changed gh to gh-actions

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* increased verbosity for debugging

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added -e docsroot manually

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed verbosity

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed travis ci files

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* changed audit step to trigger on schedule

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
Co-authored-by: enesturk <enes.m.turk@gmail.com>
2022-08-18 09:45:51 +02:00
enesturk
e88bb41c70
Merge pull request #223 from LaurentMontBlanc/main
removed dead link
2022-07-20 13:12:17 +03:00
Lorenz Herzberger
3a8fdf2589
removed dead link
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-07-20 11:34:42 +02:00
enesturk
ae5f9d1a83
Merge pull request #222 from LaurentMontBlanc/main
fixed documentation links
2022-07-18 13:12:37 +03:00
Lorenz Herzberger
b6b06cbcd1
Merge branch 'planetmint:main' into main 2022-07-18 11:39:27 +02:00
Lorenz Herzberger
340f0c2449
fixed links to tendermint documentation
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-07-18 11:39:12 +02:00
Lorenz Herzberger
6dc855d327
removed comments and unused import (#204)
* updated version number to 1.0.0

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* version bumpt

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed some comments and unsused import

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-07-13 15:04:13 +02:00
Lorenz Herzberger
90e90ab7a8
Merge branch 'planetmint:main' into main 2022-07-12 15:54:11 +02:00
Lorenz Herzberger
10f084768a
removed some comments and unsused import
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-07-12 15:53:44 +02:00
Jürgen Eckel
f7f5d2107f
moved doc-refs from .com to .io (#203)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-07-12 15:37:13 +02:00
enesturk
d4830011aa
Update quickstart.md (#197)
fixed a typo
2022-07-11 15:24:28 +02:00
enesturk
c9eed57ffd
Update quickstart.md (#196)
fixed a typo
2022-07-11 15:21:53 +02:00
Lorenz Herzberger
08b3c44f83
Merge branch 'planetmint:main' into main 2022-07-07 13:20:41 +02:00
Lorenz Herzberger
7d132c17dd
version bump (#185)
* updated version number to 1.0.0

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* version bumpt

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-07-07 13:11:42 +02:00
Lorenz Herzberger
6772a583b1
Merge branch 'planetmint:main' into main 2022-07-07 11:55:15 +02:00
Lorenz Herzberger
3ef42bc60f
version bumpt
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-07-07 11:54:44 +02:00
Jürgen Eckel
0ff69cae75
150 add cryptoconditions documentation (#178)
* added smaller logos fixed reference issue

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

* fixed some erros and typos

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

* added cryptoconditions reference to the subproject

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

* fixed wrong phrase

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-07-07 11:46:30 +02:00
Lorenz Herzberger
65f238b81a
update documentation for pypi (#184)
* updated version number to 1.0.0

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added tarantool sharding section and zenroom contracts and policies

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* update links on documentation, fixed PEP to PRP

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed missing links

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-07-07 11:37:28 +02:00
Lorenz Herzberger
c70d4443a1
Merge branch 'planetmint:main' into main 2022-07-07 10:35:12 +02:00
Lorenz Herzberger
871b7ecfaa
update documentation on tarantool and zenroom (#183)
* updated version number to 1.0.0

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added tarantool sharding section and zenroom contracts and policies

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-07-06 15:31:04 +02:00
Lorenz Herzberger
21063b743a
Merge branch 'planetmint:main' into main 2022-07-06 07:10:58 +02:00
Lorenz Herzberger
cf4c638f86
updated version number to 1.0.0 (#182)
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-07-05 15:30:32 +02:00
Lorenz Herzberger
f2c23db822
updated version number to 1.0.0
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2022-07-05 15:06:43 +02:00
Lorenz Herzberger
b57bbe21d2
Planetmint tarantool the merge (#181)
* assets changes

* fixed init db code

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

* fixed some other test cases

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

* Fixed 1/3 from test_queries.py

* test_queries.py ALL PASSED

* removed junk comment

* test_schema.py fixed

* added funcationilty to init a DB in case it hasn't been initialized before

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

* fixed test_schema.py

* last commit

* fixed some minor bugs

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

* test_schema.py ALL PASSING + changes in TarantoolDB Class

* test_schema.py ALL PASSING + changes in TarantoolDB Class

* commit err

* fixed asset issues

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

* fixed assets handling

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

* fixed missing Config().get() migrations

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

* fixed unit test error in case tx id is not defined

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

* fixed some minor bugs

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

* simplified return of metadata

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

* reconnect function added to reset_database if statement

* removed some print

* fixed TX compose bug about threshold information

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

* fixed usage of from_db part 1

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

* fixed tarantool/tendermint status management

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

* fixed some backend init issues and error handling

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

* fixed output public_keys order bug

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

* fixed deepcopy bug and another small assignment bug

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

* s

* fixed last asset bug

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

* merge

* fixed another set of tests

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

* fixed test_core.py by converting dict transaction to Transaction Object

* fixed delete_transaction function

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

* commit

* pre_commit_state singledispatch issue

* fixed global variable of backend

* fixed backend problem with command make tests

* args_reset_db added, fixed error with incorrect handling of kwargs

* test_validator passing

* fixed test_core.py by adding HDict in saved_key_orders function

* fixed pre_commiT-state bug

* init chain recoginez function fixed .

* fixed last error from tendermint/test_core.py

* tendermint/test_core.py all passing

* fixed function from fast_query.py, problem was in deleteting functions

* fixed error from test_fastquery.py, by chaning the algorithm of verifying returnred transactions id

* fixed test_core.py by adding HDict in saved_key_orders function

Signed-off-by: Sangat Das <sangatdas5@gmail.com>

* Fix make test issue - unhealthy planetmint container because non-init of tarantool spaces

Signed-off-by: Sangat Das <sangatdas5@gmail.com>

* Fix tarantool connection issues in test

Signed-off-by: Sangat Das <sangatdas5@gmail.com>

* _save_keys_order, changes behaviour

* hash problem fixed

* separated asset test fixed

* Removed all Errors in Make Test

Signed-off-by: Sangat Das <sangatdas5@gmail.com>

* mock error solved

* mock solved

* problem with stdout from Popen

* fixed output from calling subprocess

* Now planetmint drop and planemint init, is working throught schema.py file.

* Fixed some lib and web issues

Signed-off-by: Sangat Das <sangatdas5@gmail.com>

* test_lib test_update_utxoset passing

* test_commands.py -> all tests are passing

* test_queries.py -> fixed

* rollback my changes

* fixed test_quries.py -> problem with assets

* test_quries.py -> metadata error fixed

* test_bigchain_api -> fixed by adding ErrorHandling for Tarantool operation

* test_bigchain_api

* test_integration.py -> fixed issue with block object

* test_lib.py -> fixed

* store and get utxo fixed

* NoneType error, fixed in test_lib.py

* test_lib.py fixed error, adopting verification for tarantool

* test_lib.py fixed one more function

* test_store_bulk_transaction -> adopted for tarantool

* test_store_transaction -> changed to work with tarantool

* test_asset_is_separated_from_transaciton -> skipped for Tarantool connection type

* Fixed 4 issues in test/tendermint

Signed-off-by: Sangat Das <sangatdas5@gmail.com>

* fixed merge issues

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

* fixed last misspelling of backend config

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

* test_block_tendermint.py -> solved by returning empty list if not found

* readded test_core tests, fixed some linter issues

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* last changes

* removed test fixture

* removed planetmint_env folder

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* .idea/ added to gitignore file

* removed .idea/ folder from project

* create 3 files. init: indexes, schema, tables(spaces). this is used for initializing space,index and schema separately, and getting an output for specific command

* added to schema all execute commands in dictionary format

* Added create_tables function for tarantool connection

* 'create_database' function from schema file, is ignored using TarantoolDB Class.

* Implemented planetmint init via schema.py !

* added execute drop commands for spaces

* drop_databases improved

* Removed .lua files that was created temporarily.

* replaced TarantoolDB with TarantoolDBConnection

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Added output to console for creating indexes.

* fixed connection instantiation

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Added exception for NetworkError, to get specific error from connection class.

* _setup_database fixture restored.(STILL NOT WORKING in this commit)

* added 'universe' name as database name for tarantool

* created flush_db for tarantool connection type

* function create_database will call create_tables only for tarantool connection

* _bdb, setup_database restored as it was before

* Fixed flush_dbtarantool

* Fixed fatal crashing at beginning of starting planetmint. problem was solved by returning None value if where is no space.

* adding try except to some queries from tarantool/query.py.

* implemented decorator for running queries in try catch

* removed import of interface

* Removed print + removed import of interface directly

* removed importing of interface

* fixed some imports, refactored TarantoolDBConnection.conn handling

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added new requirement to setup.py

* added query() method, that will return Lazy Object

* removed unecessary comments from connection class

* get_space method is the same as old space method.

* Added run() method to TarantoolDBConnection Class.

* tarantool/query.py changed for using Lazy() implementation + little changes

* queries from tarantool/query.py was adjusted to not get NonType error

* adjusted some function calls, and connection calls

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixes for error NoneType

* fix for flush function (freezing of pytest) + NoneType error

* store_transactions changed to use new format of query

* Changed from .space() method to .get_space()

* putted from new line

* fixed Lazy() has no len

* adjusted _group_transaction_by_ids and store_transactions for connection.run

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed .data from select queries

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed run_command_without_output config and removed faulty error handling

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* made rollback db agnostic

* Added assign for pre_commit

* resolved comments and clean-up of unused code

* Fixed no attribute .run(). Fixed | Fixed no attribute .data

* Fixed no atribute .data

* Fixed list has no attribute .data

* Removed comments

* Fixed flush_db_tarantool, not it removes also from blocks spaces

* Fixed test_queries.py PASSED

* Fixed SystemExit error by inversing sorting of array

* Cleaned up test_core.py

* fixed upsert() functions, incorrect behaviour

* removed unused print

* removed unused print (2)

* Fixed test_txlist.py by improving flush_db_tarantool

* Small fixes in .upsert() functions for tarantool_db

* Fixes some test cases in tendermint/test_lib.py

* Fixed flush_tarantool_db Function.

* added utxos to SPACE_NAMES to delete data from utxo space

* fixed this module by restoring original function instructions.

* added hash generation to create primary key for abci_chain tuple.

* Added field 'id' to abci_chains

* changed flush function to delete abci_chains tuples

* added indexed_pattern_search to basic lua, implemented text_search

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted some queries, wip print statements to be removed

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed get_metadata

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added some prints and simplified code

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed __asset_check

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed print statements

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added limit to text_Search

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Planetmint tarantool (#152)

* added indexed_pattern_search to basic lua, implemented text_search

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted some queries, wip print statements to be removed

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed get_metadata

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added some prints and simplified code

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed __asset_check

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed print statements

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added limit to text_Search

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted store_asset behaviour to match mongodb implementation

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed test_write_metadata test case

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed pattern search for meta_data

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed text_search result conversion

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* adjusted connect config error handling and test case for new signature

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Resolved issues related to key error

* Added convert.py for storing interfaces

* Added convert.py implementation for tarantool

* Implemented to lib.py, functions from converted.py

* Added initializing for convert.py

* init of convert.py for mongodb implementation

* implemented convert.py for mongodatabase [NOT TESTED]

* adjusted get_assets and from_db for tarantool

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added comment

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fix get_assets issue (#160)

* adjusted get_assets and from_db for tarantool

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added comment

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* resolve conflicts

* docker all in one now install tarantool

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added user to integration init.lua

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated integration test setup for tarantool

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed print statements

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated changelog

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed error messaging

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

* fixed exception verification

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

* fixed printing of testdata

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

* Planetmint tarantool (#169)

* 31 restructue documentation (#138)

* removed korean documentation

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

* removed CN and KOR readme

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

* changed to the press theme

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

* first changes

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

* fixe H3 vs H1 issues

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

* added missing png

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

* added missing file

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

* fixed warnings

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

* moved documents

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

* removed obsolete files

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

* removed obsolete folder

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

* removed obs. file

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

* added some final changes

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

* removed obs. reference

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

* moved chain migration to election types (#109)

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Final zenroom (#147)

* zenroom fixes

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

* expl. defined the aiohttp package

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

* increased version number and fixed a zenroom runtime bug

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

* added fialing zenroom tx signing test

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

* extended test to pass zenrooom validation, but to fail planetmint validation.

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

* added manual tx crafting

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

* added zenroom fulfillment verification

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

* the last mile before integration

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

* zenroom unit tests are passing

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

* simplified zenroom unit tests

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

* removed obsolte lines from the zenroom tests

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

* fixed acceptance tests

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

* adjusted zenroom integraiton tests

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

* fixed linting errors

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

* simplified zenroom unit test

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

* increased version number

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

* using cryptoconditions without print message

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

* increased cc usage to 0.9.9 readded daemon proceses

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

* increased version to 0.9.6

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

* fixed deployment issue for 0.9.6

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

* adjusted get_assets and from_db for tarantool

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added comment

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* improve usability of zenroom (#159)

* improve usability of zenroom

* * increased version
* fixed test cases
* added changelog

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

Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>

* migrated to AGPLv3

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

* 150 add cryptoconditions documentation (#166)

* added smaller logos fixed reference issue

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

* fixed some erros and typos

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

* added cryptoconditions reference to the subproject

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

* docker all in one now install tarantool

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added user to integration init.lua

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated integration test setup for tarantool

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed print statements

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated changelog

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed error messaging

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

* fixed exception verification

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

* fixed printing of testdata

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

Co-authored-by: Jürgen Eckel <eckelj@users.noreply.github.com>
Co-authored-by: Lorenz Herzberger <64837895+LaurentDeMontBlanc@users.noreply.github.com>
Co-authored-by: Alberto Lerda <30939098+albertolerda@users.noreply.github.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>

* Removing naughty strings test cases

* updated quickstart with tarantool installation

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated all-in-one-planetmint with tarantool port and data persistence

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed typo

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* update documentation about tarantool (#174)

* 31 restructue documentation (#138)

* removed korean documentation

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

* removed CN and KOR readme

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

* changed to the press theme

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

* first changes

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

* fixe H3 vs H1 issues

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

* added missing png

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

* added missing file

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

* fixed warnings

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

* moved documents

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

* removed obsolete files

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

* removed obsolete folder

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

* removed obs. file

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

* added some final changes

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

* removed obs. reference

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

* moved chain migration to election types (#109)

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* Final zenroom (#147)

* zenroom fixes

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

* expl. defined the aiohttp package

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

* increased version number and fixed a zenroom runtime bug

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

* added fialing zenroom tx signing test

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

* extended test to pass zenrooom validation, but to fail planetmint validation.

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

* added manual tx crafting

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

* added zenroom fulfillment verification

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

* the last mile before integration

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

* zenroom unit tests are passing

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

* simplified zenroom unit tests

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

* removed obsolte lines from the zenroom tests

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

* fixed acceptance tests

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

* adjusted zenroom integraiton tests

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

* fixed linting errors

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

* simplified zenroom unit test

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

* increased version number

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

* using cryptoconditions without print message

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

* increased cc usage to 0.9.9 readded daemon proceses

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

* increased version to 0.9.6

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

* fixed deployment issue for 0.9.6

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

* adjusted get_assets and from_db for tarantool

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added comment

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* improve usability of zenroom (#159)

* improve usability of zenroom

* * increased version
* fixed test cases
* added changelog

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

Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>

* migrated to AGPLv3

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

* 150 add cryptoconditions documentation (#166)

* added smaller logos fixed reference issue

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

* fixed some erros and typos

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

* added cryptoconditions reference to the subproject

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

* docker all in one now install tarantool

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added user to integration init.lua

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated integration test setup for tarantool

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* removed print statements

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated changelog

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed error messaging

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

* fixed exception verification

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

* fixed printing of testdata

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

* updated quickstart with tarantool installation

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated all-in-one-planetmint with tarantool port and data persistence

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* fixed typo

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

Co-authored-by: Jürgen Eckel <eckelj@users.noreply.github.com>
Co-authored-by: Lorenz Herzberger <64837895+LaurentDeMontBlanc@users.noreply.github.com>
Co-authored-by: Alberto Lerda <30939098+albertolerda@users.noreply.github.com>
Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>

* Fixes lint issues  (#176)

* Resolved lint issues

* resolved other lint issues

Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
Co-authored-by: andrei <deffuls@debian-BULLSEYE-live-builder-AMD64>
Co-authored-by: Sangat Das <sangatdas5@gmail.com>
Co-authored-by: liviu-lesan <31960632+liviu-lesan@users.noreply.github.com>
Co-authored-by: Lorenz Herzberger <64837895+LaurentDeMontBlanc@users.noreply.github.com>
Co-authored-by: andreitricolici <97448537+andreitricolici@users.noreply.github.com>
Co-authored-by: ArpitShukla007 <arpitnshukla@gmail.com>
Co-authored-by: Jürgen Eckel <eckelj@users.noreply.github.com>
Co-authored-by: Alberto Lerda <30939098+albertolerda@users.noreply.github.com>
2022-07-05 14:56:53 +02:00
Jürgen Eckel
a34862b8bc
150 add cryptoconditions documentation (#166)
* added smaller logos fixed reference issue

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

* fixed some erros and typos

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

* added cryptoconditions reference to the subproject

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-06-28 14:16:02 +02:00
Lorenz Herzberger
b207c5f689
Merge pull request #165 from planetmint/164-change-license-file-to-agplv3
migrated to AGPLv3
2022-06-28 10:36:53 +02:00
Jürgen Eckel
08d835b466 migrated to AGPLv3
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-06-27 23:37:54 +02:00
Alberto Lerda
4b286455e3
improve usability of zenroom (#159)
* improve usability of zenroom

* * increased version
* fixed test cases
* added changelog

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

Co-authored-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-06-27 20:55:48 +02:00
Jürgen Eckel
5bd3784dbf
Final zenroom (#147)
* zenroom fixes

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

* expl. defined the aiohttp package

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

* increased version number and fixed a zenroom runtime bug

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

* added fialing zenroom tx signing test

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

* extended test to pass zenrooom validation, but to fail planetmint validation.

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

* added manual tx crafting

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

* added zenroom fulfillment verification

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

* the last mile before integration

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

* zenroom unit tests are passing

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

* simplified zenroom unit tests

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

* removed obsolte lines from the zenroom tests

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

* fixed acceptance tests

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

* adjusted zenroom integraiton tests

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

* fixed linting errors

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

* simplified zenroom unit test

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

* increased version number

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

* using cryptoconditions without print message

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

* increased cc usage to 0.9.9 readded daemon proceses

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

* increased version to 0.9.6

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

* fixed deployment issue for 0.9.6

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2022-06-17 11:04:12 +02:00
306 changed files with 15134 additions and 17283 deletions

View File

@ -1,20 +0,0 @@
#!/bin/bash
# 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
if [[ -n ${TOXENV} ]]; then
sudo apt-get update
sudo apt-get install zsh
fi
if [[ -z ${TOXENV} ]]; then
sudo apt-get update
sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
sudo rm /usr/local/bin/docker-compose
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose
sudo mv docker-compose /usr/local/bin
fi

View File

@ -1,18 +0,0 @@
#!/bin/bash
# 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
set -e -x
if [[ -z ${TOXENV} ]]; then
if [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
docker-compose up -d planetmint
else
docker-compose up -d bdb
fi
fi

View File

@ -1,19 +0,0 @@
#!/bin/bash
# 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
set -e -x
pip install --upgrade pip
if [[ -n ${TOXENV} ]]; then
pip install --upgrade tox
elif [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
docker-compose build --no-cache --build-arg abci_status=enable planetmint
else
docker-compose build --no-cache planetmint
pip install --upgrade codecov
fi

View File

@ -1,21 +0,0 @@
#!/bin/bash
# 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
set -e -x
if [[ -n ${TOXENV} ]]; then
tox -e ${TOXENV}
elif [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
docker-compose exec planetmint pytest -v -m abci
elif [[ ${PLANETMINT_ACCEPTANCE_TEST} == 'enable' ]]; then
./scripts/run-acceptance-test.sh
elif [[ ${PLANETMINT_INTEGRATION_TEST} == 'enable' ]]; then
docker-compose down # TODO: remove after ci optimization
./scripts/run-integration-test.sh
else
docker-compose exec planetmint pytest -v --cov=planetmint --cov-report xml:htmlcov/coverage.xml
fi

View File

@ -1,14 +0,0 @@
<!---
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
--->
# How to Contribute to the Planetmint Project
There are many ways you can contribute to the Planetmint project, some very easy and others more involved.
All of that is documented elsewhere: go to the "[Contributing to Planetmint" docs on ReadTheDocs](https://docs.planetmint.com/projects/contributing/en/latest/index.html).
Note: GitHub automatically links to this file (`.github/CONTRIBUTING.md`) when a contributor creates a new issue or pull request, so you shouldn't delete it. Just use it to point people to full and proper help elsewhere.

View File

@ -1,20 +0,0 @@
# Do you want to:
- make a bug report? Then read below about what should go in a bug report.
- make a feature request or proposal? Then read [the page about how to make a feature request or proposal](https://docs.planetmint.com/projects/contributing/en/latest/ways-can-contribute/make-a-feature-request-or-proposal.html).
- ask a question about Planetmint? Then [go to Gitter](https://gitter.im/planetmint/planetmint) (our chat room) and ask it there.
- share your neat idea or realization? Then [go to Gitter](https://gitter.im/planetmint/planetmint) (our chat room) and share it there.
# What Should Go in a Bug Report
- What computer are you on (hardware)?
- What operating system are you using, including version. e.g. Ubuntu 14.04? Fedora 23?
- What version of Planetmint software were you using? Is that the latest version?
- What, exactly, did you do to get to the point where you got stuck? Describe all the steps so we can get there too. Show screenshots or copy-and-paste text to GitHub.
- Show what actually happened.
- Say what you tried to do to resolve the problem.
- Provide details to convince us that it matters to you. Is it for a school project, a job, a contract with a deadline, a child who needs it for Christmas?
We will do our best but please understand that we don't have time to help everyone, especially people who don't care to help us help them. "It doesn't work." is not going to get any reaction from us. We need _details_.
Tip: Use Github code block formatting to make code render pretty in GitHub. To do that, put three backticks followed by a string to set the type of code (e.g. `Python`), then the code, and then end with three backticks. There's more information about [inserting code blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/) in the GitHub help pages.

View File

@ -1,30 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
**Expected behavior**
A clear and concise description of what you expected to happen.
**Logs or terminal output**
If applicable, add add textual content to help explain your problem.
**Desktop (please complete the following information):**
- Distribution: [e.g. Ubuntu 18.04]
- Bigchaindb version:
- Tendermint version:
- Mongodb version:
- Python full version: [e.g. Python 3.9.3]
**Additional context**
Add any other context about the problem here.

View File

@ -1,18 +0,0 @@
Make sure the title of this pull request has the form:
**Problem: A short statement of the problem.**
## Solution
A short statement about how this PR solves the **Problem**.
## Issues Resolved
What issues does this PR resolve, if any? Please include lines like the following (i.e. "Resolves #NNNN), so that when this PR gets merged, GitHub will automatically close those issues.
Resolves #NNNN
Resolves #MMMM
## BEPs Implemented
What [BEPs](https://github.com/planetmint/beps) does this pull request implement, if any?

224
.github/workflows/CI.yml vendored Normal file
View File

@ -0,0 +1,224 @@
# 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
---
name: CI
on:
push:
branches:
- "*"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"
permissions:
packages: write
contents: write
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: "--check -l 119"
src: "."
audit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Setup poetry
uses: Gr1N/setup-poetry@v8
- name: Install dependencies
run: poetry install
- name: Create requirements.txt
run: poetry run pip freeze > requirements.txt
- name: Audit dependencies
run: |
poetry run pip-audit \
--ignore-vuln GHSA-8495-4g3g-x7pr \
--ignore-vuln PYSEC-2024-230 \
--ignore-vuln PYSEC-2024-225 \
--ignore-vuln GHSA-3ww4-gg4f-jr7f \
--ignore-vuln GHSA-9v9h-cgj8-h64p \
--ignore-vuln GHSA-h4gh-qq45-vh27 \
--ignore-vuln PYSEC-2023-62 \
--ignore-vuln PYSEC-2024-71 \
--ignore-vuln GHSA-84pr-m4jr-85g5 \
--ignore-vuln GHSA-w3h3-4rj7-4ph4 \
--ignore-vuln PYSEC-2024-60 \
--ignore-vuln GHSA-h5c8-rqwp-cp95 \
--ignore-vuln GHSA-h75v-3vvj-5mfj \
--ignore-vuln GHSA-q2x7-8rv6-6q7h \
--ignore-vuln GHSA-gmj6-6f8f-6699 \
--ignore-vuln PYSEC-2023-117 \
--ignore-vuln GHSA-m87m-mmvp-v9qm \
--ignore-vuln GHSA-9wx4-h78v-vm56 \
--ignore-vuln GHSA-34jh-p97f-mpxf \
--ignore-vuln PYSEC-2022-203 \
--ignore-vuln PYSEC-2023-58 \
--ignore-vuln PYSEC-2023-57 \
--ignore-vuln PYSEC-2023-221 \
--ignore-vuln GHSA-2g68-c3qc-8985 \
--ignore-vuln GHSA-f9vj-2wh5-fj8j \
--ignore-vuln GHSA-q34m-jh98-gwm2
test:
needs: lint
runs-on: ubuntu-latest
env:
PLANETMINT_DATABASE_BACKEND: tarantool_db
PLANETMINT_DATABASE_HOST: localhost
PLANETMINT_DATABASE_PORT: 3303
PLANETMINT_SERVER_BIND: 0.0.0.0:9984
PLANETMINT_WSSERVER_HOST: 0.0.0.0
PLANETMINT_WSSERVER_ADVERTISED_HOST: localhost
PLANETMINT_TENDERMINT_HOST: localhost
PLANETMINT_TENDERMINT_PORT: 26657
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Prepare OS
run: sudo apt-get update && sudo apt-get install -y git zsh curl tarantool-common vim build-essential cmake
- name: Get Tendermint
run: wget https://github.com/tendermint/tendermint/releases/download/v0.34.24/tendermint_0.34.24_linux_amd64.tar.gz && tar zxf tendermint_0.34.24_linux_amd64.tar.gz
- name: Setup poetry
uses: Gr1N/setup-poetry@v8
- name: Install Planetmint
run: poetry install --with dev
- name: Execute Tests
run: make test
release:
needs: test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Setup poetry
uses: Gr1N/setup-poetry@v8
- name: Install dependencies
run: poetry install --with dev
- name: Upload to PyPI
run: |
poetry build
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}
- name: Upload to GitHub
uses: softprops/action-gh-release@v1
with:
files: dist/*
publish-docker:
needs: test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
# Get the repository's code
- name: Checkout
uses: actions/checkout@v2
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PACKAGE_DEPLOYMENT }}
- name: Docker meta
id: semver # you'll use this in the next step
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/planetmint/planetmint
# Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.semver.outputs.tags }}
labels: ${{ steps.semver.outputs.labels }}
env:
CRYPTOGRAPHY_DONT_BUILD_RUST: 1
- name: Docker meta AIO
id: semver-aio # you'll use this in the next step
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/planetmint/planetmint-aio
# Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push AIO
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile-all-in-one
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.semver-aio.outputs.tags }}
labels: ${{ steps.semver-aio.outputs.labels }}
env:
CRYPTOGRAPHY_DONT_BUILD_RUST: 1

64
.github/workflows/audit.yml vendored Normal file
View File

@ -0,0 +1,64 @@
# 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
name: Audit
on:
schedule:
- cron: '0 2 * * *'
jobs:
audit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Setup poetry
uses: Gr1N/setup-poetry@v8
- name: Install dependencies
run: poetry install
- name: Create requirements.txt
run: poetry run pip freeze > requirements.txt
- name: Audit dependencies
run: |
poetry run pip-audit \
--ignore-vuln PYSEC-2022-203 \
--ignore-vuln PYSEC-2023-58 \
--ignore-vuln PYSEC-2023-57 \
--ignore-vuln PYSEC-2023-62 \
--ignore-vuln GHSA-8495-4g3g-x7pr \
--ignore-vuln PYSEC-2023-135 \
--ignore-vuln PYSEC-2024-230 \
--ignore-vuln PYSEC-2024-225 \
--ignore-vuln GHSA-3ww4-gg4f-jr7f \
--ignore-vuln GHSA-9v9h-cgj8-h64p \
--ignore-vuln GHSA-h4gh-qq45-vh27 \
--ignore-vuln PYSEC-2024-71 \
--ignore-vuln GHSA-84pr-m4jr-85g5 \
--ignore-vuln GHSA-w3h3-4rj7-4ph4 \
--ignore-vuln PYSEC-2024-60 \
--ignore-vuln GHSA-h5c8-rqwp-cp95 \
--ignore-vuln GHSA-h75v-3vvj-5mfj \
--ignore-vuln GHSA-q2x7-8rv6-6q7h \
--ignore-vuln GHSA-gmj6-6f8f-6699 \
--ignore-vuln PYSEC-2023-117 \
--ignore-vuln GHSA-m87m-mmvp-v9qm \
--ignore-vuln GHSA-9wx4-h78v-vm56 \
--ignore-vuln PYSEC-2023-192 \
--ignore-vuln PYSEC-2023-212 \
--ignore-vuln GHSA-34jh-p97f-mpxf \
--ignore-vuln PYSEC-2023-221 \
--ignore-vuln GHSA-2g68-c3qc-8985 \
--ignore-vuln GHSA-f9vj-2wh5-fj8j \
--ignore-vuln GHSA-q34m-jh98-gwm2

5
.gitignore vendored
View File

@ -1,5 +1,7 @@
# Byte-compiled / optimized / DLL files
__pycache__/
planetmint_environment/
.idea/
*.py[cod]
*$py.class
@ -51,7 +53,6 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
@ -97,3 +98,5 @@ network/*/data
docs/contributing/source/cross-project-policies/*.md
.DS_Store
.vscode

View File

@ -1,54 +0,0 @@
# Copyright © 2020, 2021 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
sudo: required
dist: focal
services:
- docker
language: python
cache: pip
python:
- 3.9
env:
global:
- DOCKER_COMPOSE_VERSION=1.29.2
matrix:
- TOXENV=flake8
- TOXENV=docsroot
matrix:
fast_finish: true
include:
- python: 3.9
env:
- PLANETMINT_DATABASE_BACKEND=localmongodb
- PLANETMINT_DATABASE_SSL=
- python: 3.9
env:
- PLANETMINT_DATABASE_BACKEND=localmongodb
- PLANETMINT_DATABASE_SSL=
- PLANETMINT_CI_ABCI=enable
- python: 3.9
env:
- PLANETMINT_ACCEPTANCE_TEST=enable
- python: 3.9
env:
- PLANETMINT_INTEGRATION_TEST=enable
before_install: sudo .ci/travis-before-install.sh
install: .ci/travis-install.sh
before_script: .ci/travis-before-script.sh
script: .ci/travis_script.sh
after_success: .ci/travis-after-success.sh

View File

@ -25,6 +25,146 @@ For reference, the possible headings are:
* **Known Issues**
* **Notes**
## [2.5.1] - 2023-22-06
* **Fixed** docker image incompatibility with tarantool installer, switched to ubuntu-container for AIO image
## [2.5.0] - 2023-21-06
* **Changed** Upgraded ABCI compatbility to Tendermint v0.34.24 and CometBFT v0.34.29
## [2.4.7] - 2023-24-05
* **Fixed** wrong referencing of planetmint-transactions object and variable
## [2.4.6] - 2023-24-05
* **Fixed** Missing ABCI_RPC object initiailization for CLI voting commands.
* **Fixed** TypeError in EndBlock procedure that occured rarely within the network.
* **Security** moved to a more secure requests version
## [2.4.5] - 2023-21-04
* **Fixed** Integration of DataAccessor Singleton class to reduce potentially multiple DB driver initializations.
## [2.4.4] - 2023-19-04
* **Fixed** tarantool migration script issues (modularity, script failures, cli cmd to function mapping)
## [2.4.3] - 2023-17-04
* **Fixed** fixed migration behaviour for non docker service
## [2.4.2] - 2023-13-04
* **Added** planetmint migration commands
## [2.4.1] - 2023-11-04
* **Removed** Fastquery class
* **Changed** UTXO space updated to resemble outputs
* **Changed** updated UTXO querying
## [2.4.0] - 2023-29-03
* **Added** Zenroom script validation
* **Changed** adjusted zenroom testing for new transaction script structure
## [2.3.3] - 2023-10-03
* **Fixed** CI issues with the docker images
* **Added** Tendermint, tarantool, and planetmint initialization to the all-in-one docker image
## [2.3.2] - 2023-10-03
* **Fixed** websocket service issue with block/asset object access of different object/tx versions
* **Added** CI pipeline to build and package the all-in-one docker images
## [2.3.1] - 2023-02-03
* **Fixed** backend.models.assets class content type issue (verification if objects are of type dict)
* **Fixed** Type defintions of Exceptions in the backend.query exception catching decorat
## [2.3.0] - 2023-01-03
* **Fixed** double usage of the tarantool driver in one instance that lead to crashes
* **Changed** refactored a lot of classes and the structure
* **Changed** upgraded to tarantool driver 0.12.1
## [2.2.4] - 2023-15-02
* **Fixed** subcondition instantiation now works recursively
* **Changed** migrated dependency management to poetry
* **Removed** removed unused text_search related code
* **Changed** docs are now built using poetry
## [2.2.3] - 2023-14-02
* **Fixed** fixed voting/election backward compatibility issue (using planetmint-transactions >= 0.7.0) on the 2.2 main branch
* **Changed** migrated dependency management to poetry
## [2.2.2] - 2023-31-01
* **Fixed** catching tarantool exceptions in case tarantool drivers throw execeptions due to concurrency issues. This issue got idenitfied during the testing of the planetmint-driver-ts.
## [2.2.0] - 2023-31-01
* **Changed** standardized blocks API
## [2.1.0] - 2023-26-01
* **Added** validation for compose and decompose transaction types
## [2.0.0] - 2023-12-01
* **Changed** changed tarantool db schema
* **Removed** removed text_search routes
* **Added** metadata / asset cid route for fetching transactions
## [1.4.2] - 2023-14-02
* **fixed** fixed voting/election backward compatibility issue (using planetmint-transactions >= 0.7.0)
## [1.4.1] - 2022-21-12
* **fixed** inconsistent cryptocondition keyring tag handling. Using cryptoconditions > 1.1.0 from now on.
## [1.4.0] - 2022-12-12
* **Added** added upgrade compatibility to older nodes to support v2.0 TX validity for nodes supporting v3.0 transactions (planetmint-transactions >= 0.4.1)
## [1.3.2] - 2022-28-11
* **Changed** new zenroom 2.3.1 support
* **Changed** integrated new planetmint-cryptoconditions package (via the transactions package)
## [1.3.0] - 2022-27-10
* **Changed** migrated asset to assets
* **Changed** replaced transaction module with planetmint-transactions package
* **Changed** moved transaction network validation to Planetmint class
* **Changed** adjusted test cases
## [1.2.2] - 2022-23-09
* **Changed** A connection singleton got introduced to avoid connection issues and unstable states.
## [1.2.1] - 2022-20-09
* **Changed** Create model now validates for CID strings for asset["data"] and metadata
* **Changed** adjusted test cases
## [1.2.0] - 2022-09-05
* **Changed** disabled acceptance and integration tests, they have a circular dep. to the python driver
* **Changed** Metadata and asset["data"] types to string containing an IPLD hash
* **Fixed** Transaction generation bug that automatically assigned 'assets' to asset["data"]
* **Changed** adjusted test cases
## [1.1.0] - 2022-09-05
* **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
## [1.0.1] - 2022-07-07
updated documentation
## [1.0.0] - 2022-07-05
### Feature Update
Tarantool integration
## [0.9.8] - 2022-06-27
### Feature Update
Changed license to AGPLv3
## [0.9.7] - 2022-06-17
### Feature Update
Deep Zenroom integration
## [0.9.6] - 2022-06-08
@ -1165,6 +1305,6 @@ The first public release of Planetmint, including:
- Initial documentation (in `planetmint/docs`).
- Initial `README.md`, `ROADMAP.md`, `CODE_OF_CONDUCT.md`, and `CONTRIBUTING.md`.
- Packaging for PyPI, including `setup.py` and `setup.cfg`.
- Initial `Dockerfile` and `docker-compose.yml` (for deployment using Docker and Docker Compose).
- Initial `Dockerfile` and `docker compose.yml` (for deployment using Docker and Docker Compose).
- Initial `.gitignore` (list of things for git to ignore).
- Initial `.travis.yml` (used by Travis CI).

View File

@ -42,7 +42,7 @@ This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior directed at yourself or another community member may be
reported by contacting a project maintainer at [contact@planetmint.com](mailto:contact@planetmint.com). All
reported by contacting a project maintainer at [mail@planetmint.io](mailto:contact@planetmint.io). All
complaints will be reviewed and investigated and will result in a response that
is appropriate to the circumstances. Maintainers are
obligated to maintain confidentiality with regard to the reporter of an

View File

@ -1,24 +1,36 @@
FROM python:3.9
ARG python_version=3.9
FROM python:${python_version}-slim
LABEL maintainer "contact@ipdb.global"
RUN mkdir -p /usr/src/app
COPY . /usr/src/app/
WORKDIR /usr/src/app
RUN apt-get -qq update \
&& apt-get -y upgrade \
&& apt-get install -y jq vim zsh build-essential cmake\
&& pip install . \
RUN apt-get update \
&& apt-get install -y git zsh curl\
&& apt-get install -y tarantool-common\
&& apt-get install -y vim build-essential cmake\
&& pip install -U pip \
&& apt-get autoremove \
&& apt-get clean
ARG backend
ARG abci_status
VOLUME ["/data", "/certs"]
# When developing with Python in a docker container, we are using PYTHONBUFFERED
# to force stdin, stdout and stderr to be totally unbuffered and to capture logs/outputs
ENV PYTHONUNBUFFERED 0
ENV PLANETMINT_CONFIG_PATH /data/.planetmint
ENV PLANETMINT_DATABASE_PORT 3303
ENV PLANETMINT_DATABASE_BACKEND $backend
ENV PLANETMINT_SERVER_BIND 0.0.0.0:9984
ENV PLANETMINT_WSSERVER_HOST 0.0.0.0
ENV PLANETMINT_WSSERVER_SCHEME ws
ENV PLANETMINT_WSSERVER_ADVERTISED_HOST 0.0.0.0
ENV PLANETMINT_WSSERVER_ADVERTISED_SCHEME ws
ENV PLANETMINT_WSSERVER_ADVERTISED_PORT 9985
ENTRYPOINT ["planetmint"]
CMD ["start"]
ENV PLANETMINT_TENDERMINT_PORT 26657
ENV PLANETMINT_CI_ABCI ${abci_status}
RUN mkdir -p /usr/src/app
COPY . /usr/src/app/
WORKDIR /usr/src/app
RUN pip install poetry
RUN poetry install --with dev

View File

@ -1,7 +1,7 @@
FROM python:3.9-slim
FROM ubuntu:22.04
LABEL maintainer "contact@ipdb.global"
ARG TM_VERSION=0.34.15
ARG TM_VERSION=0.34.24
RUN mkdir -p /usr/src/app
ENV HOME /root
COPY . /usr/src/app/
@ -11,17 +11,18 @@ RUN apt-get update \
&& apt-get install -y openssl ca-certificates git \
&& apt-get install -y vim build-essential cmake jq zsh wget \
&& apt-get install -y libstdc++6 \
&& apt-get install -y openssh-client openssh-server \
&& pip install --upgrade pip cffi \
&& apt-get install -y openssh-client openssh-server
RUN apt-get install -y python3 python3-pip cython3
RUN pip install --upgrade pip cffi \
&& pip install -e . \
&& apt-get autoremove
# Install mongodb and monit
# Install tarantool and monit
RUN apt-get install -y dirmngr gnupg apt-transport-https software-properties-common ca-certificates curl
RUN wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | apt-key add -
RUN echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/5.0 main" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list
RUN ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime
RUN apt-get update
RUN apt-get install -y mongodb-org monit
RUN curl -L https://tarantool.io/release/2/installer.sh | bash
RUN apt-get install -y tarantool monit
# Install Tendermint
RUN wget https://github.com/tendermint/tendermint/releases/download/v${TM_VERSION}/tendermint_${TM_VERSION}_linux_amd64.tar.gz \
@ -31,13 +32,10 @@ RUN wget https://github.com/tendermint/tendermint/releases/download/v${TM_VERSIO
ENV TMHOME=/tendermint
# Set permissions required for mongodb
RUN mkdir -p /data/db /data/configdb \
&& chown -R mongodb:mongodb /data/db /data/configdb
# Planetmint enviroment variables
ENV PLANETMINT_DATABASE_PORT 27017
ENV PLANETMINT_DATABASE_BACKEND localmongodb
ENV PLANETMINT_DATABASE_PORT 3303
ENV PLANETMINT_DATABASE_BACKEND tarantool_db
ENV PLANETMINT_DATABASE_HOST localhost
ENV PLANETMINT_SERVER_BIND 0.0.0.0:9984
ENV PLANETMINT_WSSERVER_HOST 0.0.0.0
ENV PLANETMINT_WSSERVER_SCHEME ws
@ -46,8 +44,14 @@ ENV PLANETMINT_WSSERVER_ADVERTISED_HOST 0.0.0.0
ENV PLANETMINT_WSSERVER_ADVERTISED_SCHEME ws
ENV PLANETMINT_TENDERMINT_PORT 26657
COPY planetmint/backend/tarantool/opt/init.lua /etc/tarantool/instances.enabled
VOLUME /data/db /data/configdb /tendermint
EXPOSE 27017 28017 9984 9985 26656 26657 26658
WORKDIR $HOME
WORKDIR $HOME
RUN tendermint init
RUN planetmint -y configure

View File

@ -1,13 +1,14 @@
ARG python_version=3.9
FROM python:${python_version}
FROM python:${python_version}-slim
LABEL maintainer "contact@ipdb.global"
RUN apt-get update \
&& apt-get install -y git zsh-common vim build-essential cmake\
&& apt-get install -y git zsh curl\
&& apt-get install -y tarantool-common\
&& apt-get install -y vim build-essential cmake\
&& pip install -U pip \
&& apt-get autoremove \
&& apt-get clean
ARG backend
ARG abci_status
@ -15,7 +16,7 @@ ARG abci_status
# to force stdin, stdout and stderr to be totally unbuffered and to capture logs/outputs
ENV PYTHONUNBUFFERED 0
ENV PLANETMINT_DATABASE_PORT 27017
ENV PLANETMINT_DATABASE_PORT 3303
ENV PLANETMINT_DATABASE_BACKEND $backend
ENV PLANETMINT_SERVER_BIND 0.0.0.0:9984
ENV PLANETMINT_WSSERVER_HOST 0.0.0.0
@ -31,5 +32,5 @@ ENV PLANETMINT_CI_ABCI ${abci_status}
RUN mkdir -p /usr/src/app
COPY . /usr/src/app/
WORKDIR /usr/src/app
RUN pip install -e .[dev]
RUN planetmint -y configure
RUN pip install poetry
RUN poetry install --with dev

798
LICENSE
View File

@ -1,201 +1,661 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
1. Definitions.
Preamble
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
The precise terms and conditions for copying, distribution and
modification follow.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
TERMS AND CONDITIONS
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
0. Definitions.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
"This License" refers to version 3 of the GNU Affero General Public License.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
A "covered work" means either the unmodified Program or a work based
on the Program.
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
1. Source Code.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
END OF TERMS AND CONDITIONS
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
APPENDIX: How to apply the Apache License to your work.
The Corresponding Source for a work in source code form is that
same work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
2. Basic Permissions.
Copyright [yyyy] [name of copyright owner]
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
http://www.apache.org/licenses/LICENSE-2.0
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

View File

@ -1,23 +1,8 @@
.PHONY: help run start stop logs lint test test-unit test-unit-watch test-acceptance test-integration cov docs docs-acceptance clean reset release dist check-deps clean-build clean-pyc clean-test
.PHONY: help run start stop logs lint test test-unit test-unit-watch cov docs clean reset release dist check-deps clean-build clean-pyc clean-test
.DEFAULT_GOAL := help
#############################
# Open a URL in the browser #
#############################
define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT
##################################
# Display help for this makefile #
##################################
@ -41,12 +26,12 @@ export PRINT_HELP_PYSCRIPT
# Basic commands #
##################
DOCKER := docker
DC := docker-compose
BROWSER := python -c "$$BROWSER_PYSCRIPT"
DC := docker compose
HELP := python -c "$$PRINT_HELP_PYSCRIPT"
ECHO := /usr/bin/env echo
IS_DOCKER_COMPOSE_INSTALLED := $(shell command -v docker-compose 2> /dev/null)
IS_BLACK_INSTALLED := $(shell command -v black 2> /dev/null)
################
# Main targets #
@ -56,10 +41,10 @@ help: ## Show this help
@$(HELP) < $(MAKEFILE_LIST)
run: check-deps ## Run Planetmint from source (stop it with ctrl+c)
# although planetmint has tendermint and mongodb in depends_on,
# although planetmint has tendermint and tarantool in depends_on,
# launch them first otherwise tendermint will get stuck upon sending yet another log
# due to some docker-compose issue; does not happen when containers are run as daemons
@$(DC) up --no-deps mongodb tendermint planetmint
@$(DC) up --no-deps tarantool tendermint planetmint
start: check-deps ## Run Planetmint from source and daemonize it (stop with `make stop`)
@$(DC) up -d planetmint
@ -70,39 +55,31 @@ stop: check-deps ## Stop Planetmint
logs: check-deps ## Attach to the logs
@$(DC) logs -f planetmint
lint: check-deps ## Lint the project
@$(DC) up lint
lint: check-py-deps ## Lint the project
black --check -l 119 .
test: check-deps test-unit test-acceptance ## Run unit and acceptance tests
format: check-py-deps ## Format the project
black -l 119 .
test-unit: check-deps ## Run all tests once
@$(DC) up -d bdb
@$(DC) exec planetmint pytest
test: check-deps test-unit ## Run unit
test-unit: check-deps ## Run all tests once or specify a file/test with TEST=tests/file.py::Class::test
@$(DC) up -d tarantool
#wget https://github.com/tendermint/tendermint/releases/download/v0.34.24/tendermint_0.34.24_linux_amd64.tar.gz
#tar zxf tendermint_0.34.24_linux_amd64.tar.gz
poetry run pytest -m "not abci"
rm -rf ~/.tendermint && ./tendermint init && ./tendermint node --consensus.create_empty_blocks=false --rpc.laddr=tcp://0.0.0.0:26657 --proxy_app=tcp://localhost:26658&
poetry run pytest -m abci
@$(DC) down
test-unit-watch: check-deps ## Run all tests and wait. Every time you change code, tests will be run again
@$(DC) run --rm --no-deps planetmint pytest -f
test-acceptance: check-deps ## Run all acceptance tests
@./scripts/run-acceptance-test.sh
test-integration: check-deps ## Run all integration tests
@./scripts/run-integration-test.sh
cov: check-deps ## Check code coverage and open the result in the browser
@$(DC) run --rm planetmint pytest -v --cov=planetmint --cov-report html
$(BROWSER) htmlcov/index.html
docs: check-deps ## Generate HTML documentation and open it in the browser
@$(DC) run --rm --no-deps bdocs make -C docs/root html
$(BROWSER) docs/root/build/html/index.html
docs-acceptance: check-deps ## Create documentation for acceptance tests
@$(DC) run --rm python-acceptance pycco -i -s /src -d /docs
$(BROWSER) acceptance/python/docs/index.html
docs-integration: check-deps ## Create documentation for integration tests
@$(DC) run --rm python-integration pycco -i -s /src -d /docs
$(BROWSER) integration/python/docs/index.html
clean: check-deps ## Remove all build, test, coverage and Python artifacts
@$(DC) up clean
@ -132,3 +109,12 @@ ifndef IS_DOCKER_COMPOSE_INSTALLED
@$(ECHO)
@$(DC) # docker-compose is not installed, so we call it to generate an error and exit
endif
check-py-deps:
ifndef IS_BLACK_INSTALLED
@$(ECHO) "Error: black is not installed"
@$(ECHO)
@$(ECHO) "You need to activate your virtual environment and install the test dependencies"
black # black is not installed, so we call it to generate an error and exit
endif

View File

@ -82,11 +82,11 @@ x = 'name: {}; score: {}'.format(name, n)
we use the `format()` version. The [official Python documentation says](https://docs.python.org/2/library/stdtypes.html#str.format), "This method of string formatting is the new standard in Python 3, and should be preferred to the % formatting described in String Formatting Operations in new code."
## Running the Flake8 Style Checker
## Running the Black Style Checker
We use [Flake8](http://flake8.pycqa.org/en/latest/index.html) to check our Python code style. Once you have it installed, you can run it using:
We use [Black](https://black.readthedocs.io/en/stable/) to check our Python code style. Once you have it installed, you can run it using:
```text
flake8 --max-line-length 119 planetmint/
black --check -l 119 .
```

View File

@ -18,13 +18,11 @@ so show the latest GitHub release instead.
# Planetmint Server
Planetmint is the blockchain database. This repository is for _BigchainDB Server_.
Planetmint is the blockchain database. This repository is for _Planetmint Server_.
## The Basics
* [Try the Quickstart](https://docs.planetmint.com/projects/server/en/latest/quickstart.html)
* [Read the Planetmint 2.0 whitepaper](https://www.planetmint.com/whitepaper/)
* [Check out the _Hitchiker's Guide to BigchainDB_](https://www.planetmint.com/developers/guide/)
* [Try the Quickstart](https://docs.planetmint.io/en/latest/introduction/index.html#quickstart)
## Run and Test Planetmint Server from the `master` Branch
@ -55,15 +53,11 @@ To view all commands available, run `make`.
## Links for Everyone
* [Planetmint.com](https://www.planetmint.com/) - the main Planetmint website, including newsletter signup
* [Roadmap](https://github.com/planetmint/org/blob/master/ROADMAP.md)
* [Blog](https://medium.com/the-planetmint-blog)
* [Twitter](https://twitter.com/Planetmint)
* [Planetmint.io](https://www.planetmint.io/) - the main Planetmint website, including newsletter signup
## Links for Developers
* [All Planetmint Documentation](https://docs.planetmint.com/en/latest/)
* [Planetmint Server Documentation](https://docs.planetmint.com/projects/server/en/latest/index.html)
* [All Planetmint Documentation](https://docs.planetmint.io/en/latest/)
* [CONTRIBUTING.md](.github/CONTRIBUTING.md) - how to contribute
* [Community guidelines](CODE_OF_CONDUCT.md)
* [Open issues](https://github.com/planetmint/planetmint/issues)
@ -73,5 +67,3 @@ To view all commands available, run `make`.
## Legal
* [Licenses](LICENSES.md) - open source & open content
* [Imprint](https://www.planetmint.com/imprint/)
* [Contact Us](https://www.planetmint.com/contact/)

View File

@ -1,27 +0,0 @@
<!---
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
--->
# Acceptance test suite
This directory contains the acceptance test suite for Planetmint.
The suite uses Docker Compose to set up a single Planetmint node, run all tests, and finally stop the node. In the future we will add support for a four node network setup.
## Running the tests
It should be as easy as `make test-acceptance`.
Note that `make test-acceptance` will take some time to start the node and shutting it down. If you are developing a test, or you wish to run a specific test in the acceptance test suite, first start the node with `make start`. After the node is running, you can run `pytest` inside the `python-acceptance` container with:
```bash
docker-compose run --rm python-acceptance pytest <use whatever option you need>
```
## Writing and documenting the tests
Tests are sometimes difficult to read. For acceptance tests, we try to be really explicit on what the test is doing, so please write code that is *simple* and easy to understand. We decided to use literate-programming documentation. To generate the documentation run:
```bash
make doc-acceptance
```

View File

@ -1 +0,0 @@
docs

View File

@ -1,64 +0,0 @@
FROM python:3.9
RUN apt-get update \
&& pip install -U pip \
&& apt-get autoremove \
&& apt-get clean
RUN apt-get install -y vim zsh build-essential cmake
RUN mkdir -p /src
RUN /usr/local/bin/python -m pip install --upgrade pip
RUN pip install --upgrade meson ninja
RUN pip install zenroom==2.0.0.dev1644927841
RUN pip install --upgrade \
pycco \
websocket-client~=0.47.0 \
pytest~=3.0 \
#git+https://github.com/planetmint/cryptoconditions.git@gitzenroom \
#git+https://github.com/planetmint/planetmint-driver.git@gitzenroom \
planetmint-cryptoconditions>=0.9.4\
planetmint-driver>=0.9.0 \
blns
#FROM python:3.9
#
#RUN apt-get update && apt-get install -y vim zsh
#RUN apt-get update \
# && apt-get install -y git zsh\
# && pip install -U pip \
# && apt-get autoremove \
# && apt-get clean
#RUN apt install sudo
#RUN apt-get install -y python3 openssl ca-certificates git python3-dev
#RUN apt-get install zsh gcc
#RUN apt-get install libffi-dev
#RUN apt-get install build-essential cmake -y
#
#
#RUN mkdir -p /src
#RUN pip install --upgrade \
# pycco \
# websocket-client~=0.47.0 \
# pytest~=3.0 \
# planetmint-driver>=0.9.0 \
# blns \
# git+https://github.com/planetmint/cryptoconditions.git@gitzenroom >=0.9.0 \
# chardet==3.0.4 \
# aiohttp==3.7.4 \
# abci==0.8.3 \
# #planetmint-cryptoconditions>=0.9.0\
# flask-cors==3.0.10 \
# flask-restful==0.3.9 \
# flask==2.0.1 \
# gunicorn==20.1.0 \
# jsonschema==3.2.0 \
# logstats==0.3.0 \
# packaging>=20.9 \
# pymongo==3.11.4 \
# pyyaml==5.4.1 \
# requests==2.25.1 \
# setproctitle==1.2.2
#

View File

@ -1,89 +0,0 @@
# 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
GENERATE_KEYPAIR = \
"""Rule input encoding base58
Rule output encoding base58
Scenario 'ecdh': Create the keypair
Given that I am known as 'Pippo'
When I create the ecdh key
When I create the testnet key
Then print data"""
# secret key to public key
SK_TO_PK = \
"""Rule input encoding base58
Rule output encoding base58
Scenario 'ecdh': Create the keypair
Given that I am known as '{}'
Given I have the 'keys'
When I create the ecdh public key
When I create the testnet address
Then print my 'ecdh public key'
Then print my 'testnet address'"""
FULFILL_SCRIPT = \
"""Rule input encoding base58
Rule output encoding base58
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' inside 'asset'
Given I have a 'signature' named 'data.signature' inside 'result'
When I verify the 'houses' has a signature in 'data.signature' by 'Alice'
Then print the string 'ok'"""
HOUSE_ASSETS = {
"data": {
"houses": [
{
"name": "Harry",
"team": "Gryffindor",
},
{
"name": "Draco",
"team": "Slytherin",
}
],
}
}
ZENROOM_DATA = {
'also': 'more data'
}
CONDITION_SCRIPT = """Rule input encoding base58
Rule output encoding base58
Scenario 'ecdh': create the signature of an object
Given I have the 'keys'
Given that I have a 'string dictionary' named 'houses' inside 'asset'
When I create the signature of 'houses'
When I rename the 'signature' to 'data.signature'
Then print the 'data.signature'"""
@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 HOUSE_ASSETS
@pytest.fixture
def zenroom_data():
return ZENROOM_DATA

View File

@ -1,125 +0,0 @@
# 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
# # Basic Acceptance Test
# Here we check that the primitives of the system behave as expected.
# As you will see, this script tests basic stuff like:
#
# - create a transaction
# - check if the transaction is stored
# - check for the outputs of a given public key
# - transfer the transaction to another key
#
# We run a series of checks for each steps, that is retrieving the transaction from
# the remote system, and also checking the `outputs` of a given public key.
#
# This acceptance test is a rip-off of our
# [tutorial](https://docs.planetmint.com/projects/py-driver/en/latest/usage.html).
# ## Imports
# We need some utils from the `os` package, we will interact with
# env variables.
import os
# For this test case we import and use the Python Driver.
from planetmint_driver import Planetmint
from planetmint_driver.crypto import generate_keypair
def test_basic():
# ## Set up a connection to Planetmint
# To use BighainDB we need a connection. Here we create one. By default we
# connect to localhost, but you can override this value using the env variable
# called `PLANETMINT_ENDPOINT`, a valid value must include the schema:
# `https://example.com:9984`
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT'))
# ## Create keypairs
# This test requires the interaction between two actors with their own keypair.
# The two keypairs will be called—drum roll—Alice and Bob.
alice, bob = generate_keypair(), generate_keypair()
# ## Alice registers her bike in Planetmint
# Alice has a nice bike, and here she creates the "digital twin"
# of her bike.
bike = {'data': {'bicycle': {'serial_number': 420420}}}
# She prepares a `CREATE` transaction...
prepared_creation_tx = bdb.transactions.prepare(
operation='CREATE',
signers=alice.public_key,
asset=bike)
# ... and she fulfills it with her private key.
fulfilled_creation_tx = bdb.transactions.fulfill(
prepared_creation_tx,
private_keys=alice.private_key)
# We will use the `id` of this transaction several time, so we store it in
# a variable with a short and easy name
bike_id = fulfilled_creation_tx['id']
# Now she is ready to send it to the Planetmint Network.
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_creation_tx)
# And just to be 100% sure, she also checks if she can retrieve
# it from the Planetmint node.
assert bdb.transactions.retrieve(bike_id), 'Cannot find transaction {}'.format(bike_id)
# Alice is now the proud owner of one unspent asset.
assert len(bdb.outputs.get(alice.public_key, spent=False)) == 1
assert bdb.outputs.get(alice.public_key)[0]['transaction_id'] == bike_id
# ## Alice transfers her bike to Bob
# After registering her bike, Alice is ready to transfer it to Bob.
# She needs to create a new `TRANSFER` transaction.
# A `TRANSFER` transaction contains a pointer to the original asset. The original asset
# is identified by the `id` of the `CREATE` transaction that defined it.
transfer_asset = {'id': bike_id}
# Alice wants to spend the one and only output available, the one with index `0`.
output_index = 0
output = fulfilled_creation_tx['outputs'][output_index]
# Here, she defines the `input` of the `TRANSFER` transaction. The `input` contains
# several keys:
#
# - `fulfillment`, taken from the previous `CREATE` transaction.
# - `fulfills`, that specifies which condition she is fulfilling.
# - `owners_before`.
transfer_input = {'fulfillment': output['condition']['details'],
'fulfills': {'output_index': output_index,
'transaction_id': fulfilled_creation_tx['id']},
'owners_before': output['public_keys']}
# Now that all the elements are set, she creates the actual transaction...
prepared_transfer_tx = bdb.transactions.prepare(
operation='TRANSFER',
asset=transfer_asset,
inputs=transfer_input,
recipients=bob.public_key)
# ... and signs it with her private key.
fulfilled_transfer_tx = bdb.transactions.fulfill(
prepared_transfer_tx,
private_keys=alice.private_key)
# She finally sends the transaction to a Planetmint node.
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
# And just to be 100% sure, she also checks if she can retrieve
# it from the Planetmint node.
assert bdb.transactions.retrieve(fulfilled_transfer_tx['id']) == sent_transfer_tx
# Now Alice has zero unspent transactions.
assert len(bdb.outputs.get(alice.public_key, spent=False)) == 0
# While Bob has one.
assert len(bdb.outputs.get(bob.public_key, spent=False)) == 1
# Bob double checks what he got was the actual bike.
bob_tx_id = bdb.outputs.get(bob.public_key, spent=False)[0]['transaction_id']
assert bdb.transactions.retrieve(bob_tx_id) == sent_transfer_tx

View File

@ -1,181 +0,0 @@
# 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
# # Divisible assets integration testing
# This test checks if we can successfully divide assets.
# The script tests various things like:
#
# - create a transaction with a divisible asset and issue them to someone
# - check if the transaction is stored and has the right amount of tokens
# - spend some tokens
# - try to spend more tokens than available
#
# We run a series of checks for each step, that is retrieving
# the transaction from the remote system, and also checking the `amount`
# of a given transaction.
#
# This integration test is a rip-off of our
# [tutorial](https://docs.planetmint.com/projects/py-driver/en/latest/usage.html).
# ## Imports
# We need some utils from the `os` package, we will interact with
# env variables.
# We need the `pytest` package to catch the `BadRequest` exception properly.
# And of course, we also need the `BadRequest`.
import os
import pytest
from planetmint_driver.exceptions import BadRequest
# For this test case we import and use the Python Driver.
from planetmint_driver import Planetmint
from planetmint_driver.crypto import generate_keypair
def test_divisible_assets():
# ## Set up a connection to Planetmint
# Check [test_basic.py](./test_basic.html) to get some more details
# about the endpoint.
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT'))
# Oh look, it is Alice again and she brought her friend Bob along.
alice, bob = generate_keypair(), generate_keypair()
# ## Alice creates a time sharing token
# Alice wants to go on vacation, while Bobs bike just broke down.
# Alice decides to rent her bike to Bob while she is gone.
# So she prepares a `CREATE` transaction to issues 10 tokens.
# First, she prepares an asset for a time sharing token. As you can see in
# the description, Bob and Alice agree that each token can be used to ride
# the bike for one hour.
bike_token = {
'data': {
'token_for': {
'bike': {
'serial_number': 420420
}
},
'description': 'Time share token. Each token equals one hour of riding.',
},
}
# She prepares a `CREATE` transaction and issues 10 tokens.
# Here, Alice defines in a tuple that she wants to assign
# these 10 tokens to Bob.
prepared_token_tx = bdb.transactions.prepare(
operation='CREATE',
signers=alice.public_key,
recipients=[([bob.public_key], 10)],
asset=bike_token)
# She fulfills and sends the transaction.
fulfilled_token_tx = bdb.transactions.fulfill(
prepared_token_tx,
private_keys=alice.private_key)
bdb.transactions.send_commit(fulfilled_token_tx)
# We store the `id` of the transaction to use it later on.
bike_token_id = fulfilled_token_tx['id']
# Let's check if the transaction was successful.
assert bdb.transactions.retrieve(bike_token_id), \
'Cannot find transaction {}'.format(bike_token_id)
# Bob owns 10 tokens now.
assert bdb.transactions.retrieve(bike_token_id)['outputs'][0][
'amount'] == '10'
# ## Bob wants to use the bike
# Now that Bob got the tokens and the sun is shining, he wants to get out
# with the bike for three hours.
# To use the bike he has to send the tokens back to Alice.
# To learn about the details of transferring a transaction check out
# [test_basic.py](./test_basic.html)
transfer_asset = {'id': bike_token_id}
output_index = 0
output = fulfilled_token_tx['outputs'][output_index]
transfer_input = {'fulfillment': output['condition']['details'],
'fulfills': {'output_index': output_index,
'transaction_id': fulfilled_token_tx[
'id']},
'owners_before': output['public_keys']}
# To use the tokens Bob has to reassign 7 tokens to himself and the
# amount he wants to use to Alice.
prepared_transfer_tx = bdb.transactions.prepare(
operation='TRANSFER',
asset=transfer_asset,
inputs=transfer_input,
recipients=[([alice.public_key], 3), ([bob.public_key], 7)])
# He signs and sends the transaction.
fulfilled_transfer_tx = bdb.transactions.fulfill(
prepared_transfer_tx,
private_keys=bob.private_key)
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
# First, Bob checks if the transaction was successful.
assert bdb.transactions.retrieve(
fulfilled_transfer_tx['id']) == sent_transfer_tx
# There are two outputs in the transaction now.
# The first output shows that Alice got back 3 tokens...
assert bdb.transactions.retrieve(
fulfilled_transfer_tx['id'])['outputs'][0]['amount'] == '3'
# ... while Bob still has 7 left.
assert bdb.transactions.retrieve(
fulfilled_transfer_tx['id'])['outputs'][1]['amount'] == '7'
# ## Bob wants to ride the bike again
# It's been a week and Bob wants to right the bike again.
# Now he wants to ride for 8 hours, that's a lot Bob!
# He prepares the transaction again.
transfer_asset = {'id': bike_token_id}
# This time we need an `output_index` of 1, since we have two outputs
# in the `fulfilled_transfer_tx` we created before. The first output with
# index 0 is for Alice and the second output is for Bob.
# Since Bob wants to spend more of his tokens he has to provide the
# correct output with the correct amount of tokens.
output_index = 1
output = fulfilled_transfer_tx['outputs'][output_index]
transfer_input = {'fulfillment': output['condition']['details'],
'fulfills': {'output_index': output_index,
'transaction_id': fulfilled_transfer_tx['id']},
'owners_before': output['public_keys']}
# This time Bob only provides Alice in the `recipients` because he wants
# to spend all his tokens
prepared_transfer_tx = bdb.transactions.prepare(
operation='TRANSFER',
asset=transfer_asset,
inputs=transfer_input,
recipients=[([alice.public_key], 8)])
fulfilled_transfer_tx = bdb.transactions.fulfill(
prepared_transfer_tx,
private_keys=bob.private_key)
# Oh Bob, what have you done?! You tried to spend more tokens than you had.
# Remember Bob, last time you spent 3 tokens already,
# so you only have 7 left.
with pytest.raises(BadRequest) as error:
bdb.transactions.send_commit(fulfilled_transfer_tx)
# Now Bob gets an error saying that the amount he wanted to spent is
# higher than the amount of tokens he has left.
assert error.value.args[0] == 400
message = 'Invalid transaction (AmountError): The amount used in the ' \
'inputs `7` needs to be same as the amount used in the ' \
'outputs `8`'
assert error.value.args[2]['message'] == message
# We have to stop this test now, I am sorry, but Bob is pretty upset
# about his mistake. See you next time :)

View File

@ -1,48 +0,0 @@
# 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
# # Double Spend testing
# This test challenge the system with double spends.
import os
from uuid import uuid4
from threading import Thread
import queue
import planetmint_driver.exceptions
from planetmint_driver import Planetmint
from planetmint_driver.crypto import generate_keypair
def test_double_create():
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT'))
alice = generate_keypair()
results = queue.Queue()
tx = bdb.transactions.fulfill(
bdb.transactions.prepare(
operation='CREATE',
signers=alice.public_key,
asset={'data': {'uuid': str(uuid4())}}),
private_keys=alice.private_key)
def send_and_queue(tx):
try:
bdb.transactions.send_commit(tx)
results.put('OK')
except planetmint_driver.exceptions.TransportError as e:
results.put('FAIL')
t1 = Thread(target=send_and_queue, args=(tx, ))
t2 = Thread(target=send_and_queue, args=(tx, ))
t1.start()
t2.start()
results = [results.get(timeout=2), results.get(timeout=2)]
assert results.count('OK') == 1
assert results.count('FAIL') == 1

View File

@ -1,126 +0,0 @@
# 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
# # Multiple owners integration testing
# This test checks if we can successfully create and transfer a transaction
# with multiple owners.
# The script tests various things like:
#
# - create a transaction with multiple owners
# - check if the transaction is stored and has the right amount of public keys
# - transfer the transaction to a third person
#
# We run a series of checks for each step, that is retrieving
# the transaction from the remote system, and also checking the public keys
# of a given transaction.
#
# This integration test is a rip-off of our
# [tutorial](https://docs.planetmint.com/projects/py-driver/en/latest/usage.html).
# ## Imports
# We need some utils from the `os` package, we will interact with
# env variables.
import os
# For this test case we import and use the Python Driver.
from planetmint_driver import Planetmint
from planetmint_driver.crypto import generate_keypair
def test_multiple_owners():
# ## Set up a connection to Planetmint
# Check [test_basic.py](./test_basic.html) to get some more details
# about the endpoint.
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT'))
# Hey Alice and Bob, nice to see you again!
alice, bob = generate_keypair(), generate_keypair()
# ## Alice and Bob create a transaction
# Alice and Bob just moved into a shared flat, no one can afford these
# high rents anymore. Bob suggests to get a dish washer for the
# kitchen. Alice agrees and here they go, creating the asset for their
# dish washer.
dw_asset = {
'data': {
'dish washer': {
'serial_number': 1337
}
}
}
# They prepare a `CREATE` transaction. To have multiple owners, both
# Bob and Alice need to be the recipients.
prepared_dw_tx = bdb.transactions.prepare(
operation='CREATE',
signers=alice.public_key,
recipients=(alice.public_key, bob.public_key),
asset=dw_asset)
# Now they both sign the transaction by providing their private keys.
# And send it afterwards.
fulfilled_dw_tx = bdb.transactions.fulfill(
prepared_dw_tx,
private_keys=[alice.private_key, bob.private_key])
bdb.transactions.send_commit(fulfilled_dw_tx)
# We store the `id` of the transaction to use it later on.
dw_id = fulfilled_dw_tx['id']
# Let's check if the transaction was successful.
assert bdb.transactions.retrieve(dw_id), \
'Cannot find transaction {}'.format(dw_id)
# The transaction should have two public keys in the outputs.
assert len(
bdb.transactions.retrieve(dw_id)['outputs'][0]['public_keys']) == 2
# ## Alice and Bob transfer a transaction to Carol.
# Alice and Bob save a lot of money living together. They often go out
# for dinner and don't cook at home. But now they don't have any dishes to
# wash, so they decide to sell the dish washer to their friend Carol.
# Hey Carol, nice to meet you!
carol = generate_keypair()
# Alice and Bob prepare the transaction to transfer the dish washer to
# Carol.
transfer_asset = {'id': dw_id}
output_index = 0
output = fulfilled_dw_tx['outputs'][output_index]
transfer_input = {'fulfillment': output['condition']['details'],
'fulfills': {'output_index': output_index,
'transaction_id': fulfilled_dw_tx[
'id']},
'owners_before': output['public_keys']}
# Now they create the transaction...
prepared_transfer_tx = bdb.transactions.prepare(
operation='TRANSFER',
asset=transfer_asset,
inputs=transfer_input,
recipients=carol.public_key)
# ... and sign it with their private keys, then send it.
fulfilled_transfer_tx = bdb.transactions.fulfill(
prepared_transfer_tx,
private_keys=[alice.private_key, bob.private_key])
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
# They check if the transaction was successful.
assert bdb.transactions.retrieve(
fulfilled_transfer_tx['id']) == sent_transfer_tx
# The owners before should include both Alice and Bob.
assert len(
bdb.transactions.retrieve(fulfilled_transfer_tx['id'])['inputs'][0][
'owners_before']) == 2
# While the new owner is Carol.
assert bdb.transactions.retrieve(fulfilled_transfer_tx['id'])[
'outputs'][0]['public_keys'][0] == carol.public_key

View File

@ -1,101 +0,0 @@
# 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
# ## Testing potentially hazardous strings
# This test uses a library of `naughty` strings (code injections, weird unicode chars., etc.) as both keys and values.
# We look for either a successful tx, or in the case that we use a naughty string as a key, and it violates some key
# constraints, we expect to receive a well formatted error message.
# ## Imports
# We need some utils from the `os` package, we will interact with
# env variables.
import os
# Since the naughty strings get encoded and decoded in odd ways,
# we'll use a regex to sweep those details under the rug.
import re
# We'll use a nice library of naughty strings...
from blns import blns
# And parameterize our test so each one is treated as a separate test case
import pytest
# For this test case we import and use the Python Driver.
from planetmint_driver import Planetmint
from planetmint_driver.crypto import generate_keypair
from planetmint_driver.exceptions import BadRequest
naughty_strings = blns.all()
# This is our base test case, but we'll reuse it to send naughty strings as both keys and values.
def send_naughty_tx(asset, metadata):
# ## Set up a connection to Planetmint
# Check [test_basic.py](./test_basic.html) to get some more details
# about the endpoint.
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT'))
# Here's Alice.
alice = generate_keypair()
# Alice is in a naughty mood today, so she creates a tx with some naughty strings
prepared_transaction = bdb.transactions.prepare(
operation='CREATE',
signers=alice.public_key,
asset=asset,
metadata=metadata)
# She fulfills the transaction
fulfilled_transaction = bdb.transactions.fulfill(
prepared_transaction,
private_keys=alice.private_key)
# The fulfilled tx gets sent to the BDB network
try:
sent_transaction = bdb.transactions.send_commit(fulfilled_transaction)
except BadRequest as e:
sent_transaction = e
# If her key contained a '.', began with a '$', or contained a NUL character
regex = '.*\..*|\$.*|.*\x00.*'
key = next(iter(metadata))
if re.match(regex, key):
# Then she expects a nicely formatted error code
status_code = sent_transaction.status_code
error = sent_transaction.error
regex = (
r'\{\s*\n*'
r'\s*"message":\s*"Invalid transaction \(ValidationError\):\s*'
r'Invalid key name.*The key name cannot contain characters.*\n*'
r'\s*"status":\s*400\n*'
r'\s*\}\n*')
assert status_code == 400
assert re.fullmatch(regex, error), sent_transaction
# Otherwise, she expects to see her transaction in the database
elif 'id' in sent_transaction.keys():
tx_id = sent_transaction['id']
assert bdb.transactions.retrieve(tx_id)
# If neither condition was true, then something weird happened...
else:
raise TypeError(sent_transaction)
@pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings)
def test_naughty_keys(naughty_string):
asset = {'data': {naughty_string: 'nice_value'}}
metadata = {naughty_string: 'nice_value'}
send_naughty_tx(asset, metadata)
@pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings)
def test_naughty_values(naughty_string):
asset = {'data': {'nice_key': naughty_string}}
metadata = {'nice_key': naughty_string}
send_naughty_tx(asset, metadata)

View File

@ -1,132 +0,0 @@
# 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
# # Stream Acceptance Test
# This test checks if the event stream works correctly. The basic idea of this
# test is to generate some random **valid** transaction, send them to a
# Planetmint node, and expect those transactions to be returned by the valid
# transactions Stream API. During this test, two threads work together,
# sharing a queue to exchange events.
#
# - The *main thread* first creates and sends the transactions to Planetmint;
# then it run through all events in the shared queue to check if all
# transactions sent have been validated by Planetmint.
# - The *listen thread* listens to the events coming from Planetmint and puts
# them in a queue shared with the main thread.
import os
import queue
import json
from threading import Thread, Event
from uuid import uuid4
# For this script, we need to set up a websocket connection, that's the reason
# we import the
# [websocket](https://github.com/websocket-client/websocket-client) module
from websocket import create_connection
from planetmint_driver import Planetmint
from planetmint_driver.crypto import generate_keypair
def test_stream():
# ## Set up the test
# We use the env variable `BICHAINDB_ENDPOINT` to know where to connect.
# Check [test_basic.py](./test_basic.html) for more information.
BDB_ENDPOINT = os.environ.get('PLANETMINT_ENDPOINT')
# *That's pretty bad, but let's do like this for now.*
WS_ENDPOINT = 'ws://{}:9985/api/v1/streams/valid_transactions'.format(BDB_ENDPOINT.rsplit(':')[0])
bdb = Planetmint(BDB_ENDPOINT)
# Hello to Alice again, she is pretty active in those tests, good job
# Alice!
alice = generate_keypair()
# We need few variables to keep the state, specifically we need `sent` to
# keep track of all transactions Alice sent to Planetmint, while `received`
# are the transactions Planetmint validated and sent back to her.
sent = []
received = queue.Queue()
# In this test we use a websocket. The websocket must be started **before**
# sending transactions to Planetmint, otherwise we might lose some
# transactions. The `ws_ready` event is used to synchronize the main thread
# with the listen thread.
ws_ready = Event()
# ## Listening to events
# This is the function run by the complementary thread.
def listen():
# First we connect to the remote endpoint using the WebSocket protocol.
ws = create_connection(WS_ENDPOINT)
# After the connection has been set up, we can signal the main thread
# to proceed (continue reading, it should make sense in a second.)
ws_ready.set()
# It's time to consume all events coming from the Planetmint stream API.
# Every time a new event is received, it is put in the queue shared
# with the main thread.
while True:
result = ws.recv()
received.put(result)
# Put `listen` in a thread, and start it. Note that `listen` is a local
# function and it can access all variables in the enclosing function.
t = Thread(target=listen, daemon=True)
t.start()
# ## Pushing the transactions to Planetmint
# After starting the listen thread, we wait for it to connect, and then we
# proceed.
ws_ready.wait()
# Here we prepare, sign, and send ten different `CREATE` transactions. To
# make sure each transaction is different from the other, we generate a
# random `uuid`.
for _ in range(10):
tx = bdb.transactions.fulfill(
bdb.transactions.prepare(
operation='CREATE',
signers=alice.public_key,
asset={'data': {'uuid': str(uuid4())}}),
private_keys=alice.private_key)
# We don't want to wait for each transaction to be in a block. By using
# `async` mode, we make sure that the driver returns as soon as the
# transaction is pushed to the Planetmint API. Remember: we expect all
# transactions to be in the shared queue: this is a two phase test,
# first we send a bunch of transactions, then we check if they are
# valid (and, in this case, they should).
bdb.transactions.send_async(tx)
# The `id` of every sent transaction is then stored in a list.
sent.append(tx['id'])
# ## Check the valid transactions coming from Planetmint
# Now we are ready to check if Planetmint did its job. A simple way to
# check if all sent transactions have been processed is to **remove** from
# `sent` the transactions we get from the *listen thread*. At one point in
# time, `sent` should be empty, and we exit the test.
while sent:
# To avoid waiting forever, we have an arbitrary timeout of 5
# seconds: it should be enough time for Planetmint to create
# blocks, in fact a new block is created every second. If we hit
# the timeout, then game over ¯\\\_(ツ)\_/¯
try:
event = received.get(timeout=5)
txid = json.loads(event)['transaction_id']
except queue.Empty:
assert False, 'Did not receive all expected transactions'
# Last thing is to try to remove the `txid` from the set of sent
# transactions. If this test is running in parallel with others, we
# might get a transaction id of another test, and `remove` can fail.
# It's OK if this happens.
try:
sent.remove(txid)
except ValueError:
pass

View File

@ -1,85 +0,0 @@
# GOAL:
# In this script I tried to implement the ECDSA signature using zenroom
# However, the scripts are customizable and so with the same procedure
# we can implement more complex smart contracts
# PUBLIC IDENTITY
# The public identity of the users in this script (Bob and Alice)
# is the pair (ECDH public key, Testnet address)
import json
import hashlib
from cryptoconditions import ZenroomSha256
from json.decoder import JSONDecodeError
def test_zenroom(gen_key_zencode, secret_key_to_private_key_zencode, fulfill_script_zencode,
condition_script_zencode, zenroom_data, zenroom_house_assets):
alice = json.loads(ZenroomSha256.run_zenroom(gen_key_zencode).output)['keys']
bob = json.loads(ZenroomSha256.run_zenroom(gen_key_zencode).output)['keys']
zen_public_keys = json.loads(ZenroomSha256.run_zenroom(secret_key_to_private_key_zencode.format('Alice'),
keys={'keys': alice}).output)
zen_public_keys.update(json.loads(ZenroomSha256.run_zenroom(secret_key_to_private_key_zencode.format('Bob'),
keys={'keys': bob}).output))
# CRYPTO-CONDITIONS: instantiate an Ed25519 crypto-condition for buyer
zenSha = ZenroomSha256(script=fulfill_script_zencode, keys=zen_public_keys, data=zenroom_data)
# CRYPTO-CONDITIONS: generate the condition uri
condition_uri = zenSha.condition.serialize_uri()
# CRYPTO-CONDITIONS: construct an unsigned fulfillment dictionary
unsigned_fulfillment_dict = {
'type': zenSha.TYPE_NAME,
'script': fulfill_script_zencode,
'keys': zen_public_keys,
}
output = {
'amount': '1000',
'condition': {
'details': unsigned_fulfillment_dict,
'uri': condition_uri,
},
'data': zenroom_data,
'script': fulfill_script_zencode,
'conf': '',
'public_keys': (zen_public_keys['Alice']['ecdh_public_key'], ),
}
input_ = {
'fulfillment': None,
'fulfills': None,
'owners_before': (zen_public_keys['Alice']['ecdh_public_key'], ),
}
token_creation_tx = {
'operation': 'CREATE',
'asset': zenroom_house_assets,
'metadata': None,
'outputs': (output,),
'inputs': (input_,),
'version': '2.0',
'id': None,
}
# JSON: serialize the transaction-without-id to a json formatted string
message = json.dumps(
token_creation_tx,
sort_keys=True,
separators=(',', ':'),
ensure_ascii=False,
)
try:
assert(not zenSha.validate(message=message))
except JSONDecodeError:
pass
except ValueError:
pass
message = zenSha.sign(message, condition_script_zencode, alice)
assert(zenSha.validate(message=message))

View File

@ -1,3 +1,4 @@
---
# Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)

321
config/test_config_utils.py Normal file
View File

@ -0,0 +1,321 @@
# 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
import planetmint
from unittest.mock import mock_open, patch
from planetmint.config import Config
@pytest.fixture(scope="function", autouse=True)
def clean_config(monkeypatch, request):
original_config = Config().init_config("tarantool_db")
backend = request.config.getoption("--database-backend")
original_config["database"] = Config().get_db_map(backend)
monkeypatch.setattr("planetmint.config", original_config)
def test_bigchain_instance_is_initialized_when_conf_provided():
from planetmint import config_utils
assert "CONFIGURED" not in Config().get()
config_utils.set_config({"database": {"backend": "a"}})
assert Config().get()["CONFIGURED"] is True
def test_load_validation_plugin_loads_default_rules_without_name():
from planetmint import config_utils
from planetmint.application.basevalidationrules import BaseValidationRules
assert config_utils.load_validation_plugin() == BaseValidationRules
def test_load_validation_plugin_raises_with_unknown_name():
from pkg_resources import ResolutionError
from planetmint import config_utils
with pytest.raises(ResolutionError):
config_utils.load_validation_plugin("bogus")
def test_load_validation_plugin_raises_with_invalid_subclass(monkeypatch):
# Monkeypatch entry_point.load to return something other than a
# ValidationRules instance
from planetmint import config_utils
import time
monkeypatch.setattr(
config_utils, "iter_entry_points", lambda *args: [type("entry_point", (object,), {"load": lambda: object})]
)
with pytest.raises(TypeError):
# Since the function is decorated with `lru_cache`, we need to
# "miss" the cache using a name that has not been used previously
config_utils.load_validation_plugin(str(time.time()))
def test_load_events_plugins(monkeypatch):
from planetmint import config_utils
monkeypatch.setattr(
config_utils, "iter_entry_points", lambda *args: [type("entry_point", (object,), {"load": lambda: object})]
)
plugins = config_utils.load_events_plugins(["one", "two"])
assert len(plugins) == 2
def test_map_leafs_iterator():
from planetmint import config_utils
mapping = {"a": {"b": {"c": 1}, "d": {"z": 44}}, "b": {"d": 2}, "c": 3}
result = config_utils.map_leafs(lambda x, path: x * 2, mapping)
assert result == {"a": {"b": {"c": 2}, "d": {"z": 88}}, "b": {"d": 4}, "c": 6}
result = config_utils.map_leafs(lambda x, path: path, mapping)
assert result == {
"a": {"b": {"c": ["a", "b", "c"]}, "d": {"z": ["a", "d", "z"]}},
"b": {"d": ["b", "d"]},
"c": ["c"],
}
def test_update_types():
from planetmint import config_utils
raw = {
"a_string": "test",
"an_int": "42",
"a_float": "3.14",
"a_list": "a:b:c",
}
reference = {
"a_string": "test",
"an_int": 42,
"a_float": 3.14,
"a_list": ["a", "b", "c"],
}
result = config_utils.update_types(raw, reference)
assert result == reference
def test_env_config(monkeypatch):
monkeypatch.setattr(
"os.environ", {"PLANETMINT_DATABASE_HOST": "test-host", "PLANETMINT_DATABASE_PORT": "test-port"}
)
from planetmint import config_utils
result = config_utils.env_config({"database": {"host": None, "port": None}})
expected = {"database": {"host": "test-host", "port": "test-port"}}
assert result == expected
@pytest.mark.skip(reason="Disabled until we create a better config format")
def test_autoconfigure_read_both_from_file_and_env(monkeypatch, request):
# constants
DATABASE_HOST = "test-host"
DATABASE_NAME = "test-dbname"
DATABASE_PORT = 4242
DATABASE_BACKEND = request.config.getoption("--database-backend")
SERVER_BIND = "1.2.3.4:56"
WSSERVER_SCHEME = "ws"
WSSERVER_HOST = "1.2.3.4"
WSSERVER_PORT = 57
WSSERVER_ADVERTISED_SCHEME = "wss"
WSSERVER_ADVERTISED_HOST = "a.b.c.d"
WSSERVER_ADVERTISED_PORT = 89
LOG_FILE = "/somewhere/something.log"
file_config = {
"database": {"host": DATABASE_HOST},
"log": {
"level_console": "debug",
},
}
monkeypatch.setattr("planetmint.config_utils.file_config", lambda *args, **kwargs: file_config)
monkeypatch.setattr(
"os.environ",
{
"PLANETMINT_DATABASE_NAME": DATABASE_NAME,
"PLANETMINT_DATABASE_PORT": str(DATABASE_PORT),
"PLANETMINT_DATABASE_BACKEND": DATABASE_BACKEND,
"PLANETMINT_SERVER_BIND": SERVER_BIND,
"PLANETMINT_WSSERVER_SCHEME": WSSERVER_SCHEME,
"PLANETMINT_WSSERVER_HOST": WSSERVER_HOST,
"PLANETMINT_WSSERVER_PORT": WSSERVER_PORT,
"PLANETMINT_WSSERVER_ADVERTISED_SCHEME": WSSERVER_ADVERTISED_SCHEME,
"PLANETMINT_WSSERVER_ADVERTISED_HOST": WSSERVER_ADVERTISED_HOST,
"PLANETMINT_WSSERVER_ADVERTISED_PORT": WSSERVER_ADVERTISED_PORT,
"PLANETMINT_LOG_FILE": LOG_FILE,
"PLANETMINT_LOG_FILE": LOG_FILE,
"PLANETMINT_DATABASE_CA_CERT": "ca_cert",
"PLANETMINT_DATABASE_CRLFILE": "crlfile",
"PLANETMINT_DATABASE_CERTFILE": "certfile",
"PLANETMINT_DATABASE_KEYFILE": "keyfile",
"PLANETMINT_DATABASE_KEYFILE_PASSPHRASE": "passphrase",
},
)
from planetmint import config_utils
from planetmint.log import DEFAULT_LOGGING_CONFIG as log_config
config_utils.autoconfigure()
database_mongodb = {
"backend": "localmongodb",
"host": DATABASE_HOST,
"port": DATABASE_PORT,
"name": DATABASE_NAME,
"connection_timeout": 5000,
"max_tries": 3,
"replicaset": None,
"ssl": False,
"login": None,
"password": None,
"ca_cert": "ca_cert",
"certfile": "certfile",
"keyfile": "keyfile",
"keyfile_passphrase": "passphrase",
"crlfile": "crlfile",
}
assert planetmint.config == {
"CONFIGURED": True,
"server": {
"bind": SERVER_BIND,
"loglevel": "info",
"workers": None,
},
"wsserver": {
"scheme": WSSERVER_SCHEME,
"host": WSSERVER_HOST,
"port": WSSERVER_PORT,
"advertised_scheme": WSSERVER_ADVERTISED_SCHEME,
"advertised_host": WSSERVER_ADVERTISED_HOST,
"advertised_port": WSSERVER_ADVERTISED_PORT,
},
"database": database_mongodb,
"tendermint": {"host": "localhost", "port": 26657, "version": "v0.34.24"},
"log": {
"file": LOG_FILE,
"level_console": "debug",
"error_file": log_config["handlers"]["errors"]["filename"],
"level_console": "debug",
"level_logfile": "info",
"datefmt_console": log_config["formatters"]["console"]["datefmt"],
"datefmt_logfile": log_config["formatters"]["file"]["datefmt"],
"fmt_console": log_config["formatters"]["console"]["format"],
"fmt_logfile": log_config["formatters"]["file"]["format"],
"granular_levels": {},
},
}
def test_autoconfigure_env_precedence(monkeypatch):
file_config = {"database": {"host": "test-host", "name": "planetmint", "port": 28015}}
monkeypatch.setattr("planetmint.config_utils.file_config", lambda *args, **kwargs: file_config)
monkeypatch.setattr(
"os.environ",
{
"PLANETMINT_DATABASE_NAME": "test-dbname",
"PLANETMINT_DATABASE_PORT": 4242,
"PLANETMINT_SERVER_BIND": "localhost:9985",
},
)
from planetmint import config_utils
from planetmint.config import Config
config_utils.autoconfigure()
assert Config().get()["CONFIGURED"]
assert Config().get()["database"]["host"] == "test-host"
assert Config().get()["database"]["name"] == "test-dbname"
assert Config().get()["database"]["port"] == 4242
assert Config().get()["server"]["bind"] == "localhost:9985"
def test_autoconfigure_explicit_file(monkeypatch):
from planetmint import config_utils
def file_config(*args, **kwargs):
raise FileNotFoundError()
monkeypatch.setattr("planetmint.config_utils.file_config", file_config)
with pytest.raises(FileNotFoundError):
config_utils.autoconfigure(filename="autoexec.bat")
def test_update_config(monkeypatch):
from planetmint import config_utils
file_config = {"database": {"host": "test-host", "name": "planetmint", "port": 28015}}
monkeypatch.setattr("planetmint.config_utils.file_config", lambda *args, **kwargs: file_config)
config_utils.autoconfigure(config=file_config)
# update configuration, retaining previous changes
config_utils.update_config({"database": {"port": 28016, "name": "planetmint_other"}})
assert Config().get()["database"]["host"] == "test-host"
assert Config().get()["database"]["name"] == "planetmint_other"
assert Config().get()["database"]["port"] == 28016
def test_file_config():
from planetmint.config_utils import file_config, CONFIG_DEFAULT_PATH
with patch("builtins.open", mock_open(read_data="{}")) as m:
config = file_config()
m.assert_called_once_with(CONFIG_DEFAULT_PATH)
assert config == {}
def test_invalid_file_config():
from planetmint.config_utils import file_config
from transactions.common import exceptions
with patch("builtins.open", mock_open(read_data="{_INVALID_JSON_}")):
with pytest.raises(exceptions.ConfigurationError):
file_config()
def test_write_config():
from planetmint.config_utils import write_config, CONFIG_DEFAULT_PATH
m = mock_open()
with patch("builtins.open", m):
write_config({})
m.assert_called_once_with(CONFIG_DEFAULT_PATH, "w")
handle = m()
handle.write.assert_called_once_with("{}")
@pytest.mark.parametrize(
"env_name,env_value,config_key",
(
("PLANETMINT_DATABASE_BACKEND", "test-backend", "backend"),
("PLANETMINT_DATABASE_HOST", "test-host", "host"),
("PLANETMINT_DATABASE_PORT", 4242, "port"),
("PLANETMINT_DATABASE_NAME", "test-db", "name"),
),
)
def test_database_envs(env_name, env_value, config_key, monkeypatch):
monkeypatch.setattr("os.environ", {env_name: env_value})
planetmint.config_utils.autoconfigure()
expected_config = Config().get()
expected_config["database"][config_key] = env_value
assert planetmint.config.Config().get() == expected_config

View File

@ -1,3 +1,4 @@
---
# Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
@ -6,19 +7,8 @@
version: '2.2'
services:
clean-shared:
image: alpine
command: ["/scripts/clean-shared.sh"]
volumes:
- ./integration/scripts/clean-shared.sh:/scripts/clean-shared.sh
- shared:/shared
planetmint-all-in-one:
build:
context: .
dockerfile: Dockerfile-all-in-one
depends_on:
- clean-shared
image: planetmint/planetmint-aio:latest
expose:
- "22"
- "9984"
@ -27,8 +17,6 @@ services:
- "26657"
- "26658"
command: ["/usr/src/app/scripts/pre-config-planetmint.sh", "/usr/src/app/scripts/all-in-one.bash"]
environment:
SCALE: ${SCALE:-4}
volumes:
- ./integration/scripts:/usr/src/app/scripts
- shared:/shared
@ -48,6 +36,3 @@ services:
- ./integration/scripts:/scripts
- ./integration/cli:/tests
- shared:/shared
volumes:
shared:

View File

@ -1,3 +1,4 @@
---
# Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
@ -14,13 +15,25 @@ services:
- "27017:27017"
command: mongod
restart: always
tarantool:
image: tarantool/tarantool:2.10.4
ports:
- "5200:5200"
- "3301:3301"
- "3303:3303"
- "8081:8081"
volumes:
- ./planetmint/backend/tarantool/opt/init.lua:/opt/tarantool/init.lua
entrypoint: tarantool /opt/tarantool/init.lua
restart: always
planetmint:
depends_on:
- mongodb
- tendermint
- tarantool
build:
context: .
dockerfile: Dockerfile-dev
dockerfile: Dockerfile
volumes:
- ./planetmint:/usr/src/app/planetmint
- ./tests:/usr/src/app/tests
@ -29,11 +42,10 @@ services:
- ./setup.py:/usr/src/app/setup.py
- ./setup.cfg:/usr/src/app/setup.cfg
- ./pytest.ini:/usr/src/app/pytest.ini
- ./tox.ini:/usr/src/app/tox.ini
environment:
PLANETMINT_DATABASE_BACKEND: localmongodb
PLANETMINT_DATABASE_HOST: mongodb
PLANETMINT_DATABASE_PORT: 27017
PLANETMINT_DATABASE_BACKEND: tarantool_db
PLANETMINT_DATABASE_HOST: tarantool
PLANETMINT_DATABASE_PORT: 3303
PLANETMINT_SERVER_BIND: 0.0.0.0:9984
PLANETMINT_WSSERVER_HOST: 0.0.0.0
PLANETMINT_WSSERVER_ADVERTISED_HOST: planetmint
@ -43,15 +55,17 @@ services:
- "9984:9984"
- "9985:9985"
- "26658"
- "2222:2222"
healthcheck:
test: ["CMD", "bash", "-c", "curl http://planetmint:9984 && curl http://tendermint:26657/abci_query"]
interval: 3s
timeout: 5s
retries: 3
command: '.ci/entrypoint.sh'
retries: 5
command: 'planetmint -l DEBUG start'
restart: always
tendermint:
image: tendermint/tendermint:v0.34.15
image: tendermint/tendermint:v0.34.24
# volumes:
# - ./tmdata:/tendermint
entrypoint: ''
@ -60,6 +74,7 @@ services:
- "26657:26657"
command: sh -c "tendermint init && tendermint node --consensus.create_empty_blocks=false --rpc.laddr=tcp://0.0.0.0:26657 --proxy_app=tcp://planetmint:26658"
restart: always
bdb:
image: busybox
depends_on:
@ -72,17 +87,6 @@ services:
image: appropriate/curl
command: /bin/sh -c "curl -s http://planetmint:9984/ > /dev/null && curl -s http://tendermint:26657/ > /dev/null"
# Planetmint setup to do acceptance testing with Python
python-acceptance:
build:
context: .
dockerfile: ./acceptance/python/Dockerfile
volumes:
- ./acceptance/python/docs:/docs
- ./acceptance/python/src:/src
environment:
- PLANETMINT_ENDPOINT=planetmint
# Build docs only
# docker-compose build bdocs
# docker-compose up -d bdocs
@ -91,9 +95,9 @@ services:
- vdocs
build:
context: .
dockerfile: Dockerfile-dev
dockerfile: Dockerfile
args:
backend: localmongodb
backend: tarantool_db
volumes:
- .:/usr/src/app/
command: make -C docs/root html
@ -104,19 +108,9 @@ services:
volumes:
- ./docs/root/build/html:/usr/share/nginx/html
# Lints project according to PEP8
lint:
image: alpine/flake8
command: --max-line-length 119 /planetmint /acceptance /integration /tests
volumes:
- ./planetmint:/planetmint
- ./acceptance:/acceptance
- ./integration:/integration
- ./tests:/tests
# Remove all build, test, coverage and Python artifacts
clean:
image: alpine
command: /bin/sh -c "./planetmint/scripts/clean.sh"
volumes:
- $PWD:/planetmint
- $PWD:/planetmint

3
docs/root/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"makefile.extensionOutputFolder": "./.vscode"
}

View File

@ -3,7 +3,7 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXBUILD = poetry run sphinx-build
PAPER = a4
BUILDDIR = build

View File

@ -3,45 +3,56 @@
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
""" Script to build http examples for http server api docs """
"""Script to build http examples for http server api docs"""
import json
import os
import os.path
from planetmint.transactions.common.input import Input
from planetmint.transactions.common.transaction_link import TransactionLink
from planetmint import lib
from planetmint.transactions.types.assets.create import Create
from planetmint.transactions.types.assets.transfer import Transfer
from transactions.common.input import Input
from transactions.common.transaction_link import TransactionLink
import planetmint.abci.block
from transactions.types.assets.create import Create
from transactions.types.assets.transfer import Transfer
from planetmint.web import server
from ipld import multihash, marshal
TPLS = {}
TPLS['index-response'] = """\
TPLS[
"index-response"
] = """\
HTTP/1.1 200 OK
Content-Type: application/json
%(index)s
"""
TPLS['api-index-response'] = """\
TPLS[
"api-index-response"
] = """\
HTTP/1.1 200 OK
Content-Type: application/json
%(api_index)s
"""
TPLS['get-tx-id-request'] = """\
TPLS[
"get-tx-id-request"
] = """\
GET /api/v1/transactions/%(txid)s HTTP/1.1
Host: example.com
"""
TPLS['get-tx-id-response'] = """\
TPLS[
"get-tx-id-response"
] = """\
HTTP/1.1 200 OK
Content-Type: application/json
@ -49,14 +60,18 @@ Content-Type: application/json
"""
TPLS['get-tx-by-asset-request'] = """\
TPLS[
"get-tx-by-asset-request"
] = """\
GET /api/v1/transactions?operation=TRANSFER&asset_id=%(txid)s HTTP/1.1
Host: example.com
"""
TPLS['get-tx-by-asset-response'] = """\
TPLS[
"get-tx-by-asset-response"
] = """\
HTTP/1.1 200 OK
Content-Type: application/json
@ -64,7 +79,9 @@ Content-Type: application/json
%(tx_transfer_last)s]
"""
TPLS['post-tx-request'] = """\
TPLS[
"post-tx-request"
] = """\
POST /api/v1/transactions?mode=async HTTP/1.1
Host: example.com
Content-Type: application/json
@ -73,7 +90,9 @@ Content-Type: application/json
"""
TPLS['post-tx-response'] = """\
TPLS[
"post-tx-response"
] = """\
HTTP/1.1 202 Accepted
Content-Type: application/json
@ -81,14 +100,18 @@ Content-Type: application/json
"""
TPLS['get-block-request'] = """\
TPLS[
"get-block-request"
] = """\
GET /api/v1/blocks/%(blockid)s HTTP/1.1
Host: example.com
"""
TPLS['get-block-response'] = """\
TPLS[
"get-block-response"
] = """\
HTTP/1.1 200 OK
Content-Type: application/json
@ -96,14 +119,18 @@ Content-Type: application/json
"""
TPLS['get-block-txid-request'] = """\
TPLS[
"get-block-txid-request"
] = """\
GET /api/v1/blocks?transaction_id=%(txid)s HTTP/1.1
Host: example.com
"""
TPLS['get-block-txid-response'] = """\
TPLS[
"get-block-txid-response"
] = """\
HTTP/1.1 200 OK
Content-Type: application/json
@ -112,7 +139,7 @@ Content-Type: application/json
def main():
""" Main function """
"""Main function"""
ctx = {}
@ -121,90 +148,94 @@ def main():
client = server.create_app().test_client()
host = 'example.com:9984'
host = "example.com:9984"
# HTTP Index
res = client.get('/', environ_overrides={'HTTP_HOST': host})
res = client.get("/", environ_overrides={"HTTP_HOST": host})
res_data = json.loads(res.data.decode())
ctx['index'] = pretty_json(res_data)
ctx["index"] = pretty_json(res_data)
# API index
res = client.get('/api/v1/', environ_overrides={'HTTP_HOST': host})
ctx['api_index'] = pretty_json(json.loads(res.data.decode()))
res = client.get("/api/v1/", environ_overrides={"HTTP_HOST": host})
ctx["api_index"] = pretty_json(json.loads(res.data.decode()))
# tx create
privkey = 'CfdqtD7sS7FgkMoGPXw55MVGGFwQLAoHYTcBhZDtF99Z'
pubkey = '4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD'
asset = {'msg': 'Hello Planetmint!'}
tx = Create.generate([pubkey], [([pubkey], 1)], asset=asset, metadata={'sequence': 0})
from ipld import marshal, multihash
privkey = "CfdqtD7sS7FgkMoGPXw55MVGGFwQLAoHYTcBhZDtF99Z"
pubkey = "4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
assets = [{"data": multihash(marshal({"msg": "Hello Planetmint!"}))}]
tx = Create.generate([pubkey], [([pubkey], 1)], assets=assets, metadata=multihash(marshal({"sequence": 0})))
tx = tx.sign([privkey])
ctx['tx'] = pretty_json(tx.to_dict())
ctx['public_keys'] = tx.outputs[0].public_keys[0]
ctx['txid'] = tx.id
ctx["tx"] = pretty_json(tx.to_dict())
ctx["public_keys"] = tx.outputs[0].public_keys[0]
ctx["txid"] = tx.id
# tx transfer
privkey_transfer = '3AeWpPdhEZzWLYfkfYHBfMFC2r1f8HEaGS9NtbbKssya'
pubkey_transfer = '3yfQPHeWAa1MxTX9Zf9176QqcpcnWcanVZZbaHb8B3h9'
privkey_transfer = "3AeWpPdhEZzWLYfkfYHBfMFC2r1f8HEaGS9NtbbKssya"
pubkey_transfer = "3yfQPHeWAa1MxTX9Zf9176QqcpcnWcanVZZbaHb8B3h9"
cid = 0
input_ = Input(fulfillment=tx.outputs[cid].fulfillment,
fulfills=TransactionLink(txid=tx.id, output=cid),
owners_before=tx.outputs[cid].public_keys)
tx_transfer = Transfer.generate([input_], [([pubkey_transfer], 1)], asset_id=tx.id, metadata={'sequence': 1})
input_ = Input(
fulfillment=tx.outputs[cid].fulfillment,
fulfills=TransactionLink(txid=tx.id, output=cid),
owners_before=tx.outputs[cid].public_keys,
)
tx_transfer = Transfer.generate(
[input_], [([pubkey_transfer], 1)], asset_ids=[tx.id], metadata=multihash(marshal({"sequence": 1}))
)
tx_transfer = tx_transfer.sign([privkey])
ctx['tx_transfer'] = pretty_json(tx_transfer.to_dict())
ctx['public_keys_transfer'] = tx_transfer.outputs[0].public_keys[0]
ctx['tx_transfer_id'] = tx_transfer.id
ctx["tx_transfer"] = pretty_json(tx_transfer.to_dict())
ctx["public_keys_transfer"] = tx_transfer.outputs[0].public_keys[0]
ctx["tx_transfer_id"] = tx_transfer.id
# privkey_transfer_last = 'sG3jWDtdTXUidBJK53ucSTrosktG616U3tQHBk81eQe'
pubkey_transfer_last = '3Af3fhhjU6d9WecEM9Uw5hfom9kNEwE7YuDWdqAUssqm'
pubkey_transfer_last = "3Af3fhhjU6d9WecEM9Uw5hfom9kNEwE7YuDWdqAUssqm"
cid = 0
input_ = Input(fulfillment=tx_transfer.outputs[cid].fulfillment,
fulfills=TransactionLink(txid=tx_transfer.id, output=cid),
owners_before=tx_transfer.outputs[cid].public_keys)
tx_transfer_last = Transfer.generate([input_], [([pubkey_transfer_last], 1)],
asset_id=tx.id, metadata={'sequence': 2})
input_ = Input(
fulfillment=tx_transfer.outputs[cid].fulfillment,
fulfills=TransactionLink(txid=tx_transfer.id, output=cid),
owners_before=tx_transfer.outputs[cid].public_keys,
)
tx_transfer_last = Transfer.generate(
[input_], [([pubkey_transfer_last], 1)], asset_ids=[tx.id], metadata=multihash(marshal({"sequence": 2}))
)
tx_transfer_last = tx_transfer_last.sign([privkey_transfer])
ctx['tx_transfer_last'] = pretty_json(tx_transfer_last.to_dict())
ctx['tx_transfer_last_id'] = tx_transfer_last.id
ctx['public_keys_transfer_last'] = tx_transfer_last.outputs[0].public_keys[0]
ctx["tx_transfer_last"] = pretty_json(tx_transfer_last.to_dict())
ctx["tx_transfer_last_id"] = tx_transfer_last.id
ctx["public_keys_transfer_last"] = tx_transfer_last.outputs[0].public_keys[0]
# block
node_private = "5G2kE1zJAgTajkVSbPAQWo4c2izvtwqaNHYsaNpbbvxX"
node_public = "DngBurxfeNVKZWCEcDnLj1eMPAS7focUZTE5FndFGuHT"
signature = "53wxrEQDYk1dXzmvNSytbCfmNVnPqPkDQaTnAe8Jf43s6ssejPxezkCvUnGTnduNUmaLjhaan1iRLi3peu6s5DzA"
app_hash = 'f6e0c49c6d94d6924351f25bb334cf2a99af4206339bf784e741d1a5ab599056'
block = lib.Block(height=1, transactions=[tx.to_dict()], app_hash=app_hash)
app_hash = "f6e0c49c6d94d6924351f25bb334cf2a99af4206339bf784e741d1a5ab599056"
block = planetmint.abci.block.Block(height=1, transactions=[tx.to_dict()], app_hash=app_hash)
block_dict = block._asdict()
block_dict.pop('app_hash')
ctx['block'] = pretty_json(block_dict)
ctx['blockid'] = block.height
block_dict.pop("app_hash")
ctx["block"] = pretty_json(block_dict)
ctx["blockid"] = block.height
# block status
block_list = [
block.height
]
ctx['block_list'] = pretty_json(block_list)
block_list = [block.height]
ctx["block_list"] = pretty_json(block_list)
base_path = os.path.join(os.path.dirname(__file__),
'source/connecting/http-samples')
base_path = os.path.join(os.path.dirname(__file__), "source/connecting/http-samples")
if not os.path.exists(base_path):
os.makedirs(base_path)
for name, tpl in TPLS.items():
path = os.path.join(base_path, name + '.http')
path = os.path.join(base_path, name + ".http")
code = tpl % ctx
with open(path, 'w') as handle:
with open(path, "w") as handle:
handle.write(code)
def setup(*_):
""" Fool sphinx into think it's an extension muahaha """
"""Fool sphinx into think it's an extension muahaha"""
main()
if __name__ == '__main__':
if __name__ == "__main__":
main()

View File

@ -1,40 +0,0 @@
aafigure==0.6
alabaster==0.7.12
Babel==2.10.1
certifi==2021.10.8
charset-normalizer==2.0.12
commonmark==0.9.1
docutils==0.17.1
idna
imagesize==1.3.0
importlib-metadata==4.11.3
Jinja2==3.0.0
markdown-it-py==2.1.0
MarkupSafe==2.1.1
mdit-py-plugins==0.3.0
mdurl==0.1.1
myst-parser==0.17.2
packaging==21.3
pockets==0.9.1
Pygments==2.12.0
pyparsing==3.0.8
pytz==2022.1
PyYAML>=5.4.0
requests>=2.25i.1
six==1.16.0
snowballstemmer==2.2.0
Sphinx==4.5.0
sphinx-rtd-theme==1.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-httpdomain==1.8.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-napoleon==0.7
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
urllib3==1.26.9
wget==3.2
zipp==3.8.0
nest-asyncio==1.5.5
sphinx-press-theme==0.8.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 120 50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(0.20764,0,0,0.20764,14.4981,12.6907)">
<path d="M0,117.028C32.316,117.028 58.514,90.831 58.514,58.514C58.514,26.198 32.316,0 0,0C-32.316,0 -58.514,26.198 -58.514,58.514C-58.514,90.831 -32.316,117.028 0,117.028" style="fill:rgb(0,227,0);fill-rule:nonzero;"/>
</g>
<g transform="matrix(0.20764,0,0,0.20764,20.2132,30.2549)">
<path d="M0,-55.048L-27.524,-27.524L-55.048,-55.048L-55.048,0L0,0L0,-55.048Z" style="fill:white;fill-rule:nonzero;"/>
</g>
<g transform="matrix(0.20764,0,0,0.20764,117.634,29.1275)">
<path d="M0,-42.385C0,-45.539 -2.515,-47.568 -5.337,-47.568C-8.158,-47.568 -10.673,-45.539 -10.673,-42.385C-10.673,-39.215 -8.158,-37.173 -5.337,-37.173C-2.515,-37.173 0,-39.215 0,-42.385M-1.416,-42.385C-1.416,-40.007 -3.183,-38.283 -5.337,-38.283C-7.518,-38.283 -9.257,-40.007 -9.257,-42.385C-9.257,-44.748 -7.518,-46.458 -5.337,-46.458C-3.183,-46.458 -1.416,-44.748 -1.416,-42.385M-2.905,-39.479L-4.46,-42.024C-3.613,-42.094 -2.933,-42.51 -2.933,-43.58C-2.933,-44.845 -3.751,-45.303 -5.211,-45.303L-7.407,-45.303L-7.407,-39.479L-6.255,-39.479L-6.255,-41.967L-5.531,-41.967L-4.112,-39.479L-2.905,-39.479ZM-5.225,-42.87L-6.255,-42.87L-6.255,-44.401L-5.281,-44.401C-4.752,-44.401 -4.085,-44.29 -4.085,-43.677C-4.085,-42.968 -4.558,-42.87 -5.225,-42.87M-30.556,-36.925L-15.073,-36.925L-15.073,-46.475L-60.249,-46.475L-60.249,-11.82L-60.393,-11.82L-81.954,-46.475L-93.241,-46.475L-93.241,5.183L-82.605,5.183L-82.605,-29.401L-82.461,-29.401L-60.972,5.183L-49.613,5.183L-49.613,-36.925L-41.915,-36.925L-41.915,5.183L-30.556,5.183L-30.556,-36.925ZM-108.073,5.183L-96.714,5.183L-96.714,-46.475L-108.073,-46.475L-108.073,5.183ZM-122.181,5.183L-111.545,5.183L-111.545,-46.475L-127.535,-46.475L-138.967,-10.952L-139.111,-10.952L-151.194,-46.475L-167.183,-46.475L-167.183,5.183L-156.548,5.183L-156.548,-31.065L-156.403,-31.065L-143.742,5.183L-134.987,5.183L-122.326,-31.427L-122.181,-31.427L-122.181,5.183ZM-186.684,-36.925L-171.201,-36.925L-171.201,-46.475L-244.984,-46.475L-244.984,5.183L-205.77,5.183L-205.77,-4.368L-233.625,-4.368L-233.625,-17.029L-208.592,-17.029L-208.592,-25.856L-233.625,-25.856L-233.625,-36.925L-198.043,-36.925L-198.043,5.183L-186.684,5.183L-186.684,-36.925ZM-259.816,5.183L-248.457,5.183L-248.457,-46.475L-259.093,-46.475L-259.093,-11.82L-259.237,-11.82L-280.798,-46.475L-292.084,-46.475L-292.084,5.183L-281.449,5.183L-281.449,-29.401L-281.304,-29.401L-259.816,5.183ZM-305.52,5.183L-293.727,5.183L-313.044,-46.475L-324.693,-46.475L-340.675,-4.368L-356.154,-4.368L-356.154,-46.475L-367.513,-46.475L-367.513,5.183L-332.796,5.183L-328.744,-6.321L-309.427,-6.321L-305.52,5.183ZM-312.393,-14.786L-325.778,-14.786L-319.049,-33.742L-318.905,-33.742L-312.393,-14.786ZM-370.414,-29.907C-370.414,-38.3 -375.334,-46.475 -388.285,-46.475L-411.582,-46.475L-411.582,5.183L-400.223,5.183L-400.223,-13.339L-388.285,-13.339C-375.334,-13.339 -370.414,-21.514 -370.414,-29.907M-381.411,-29.907C-381.411,-23.323 -386.187,-22.165 -391.396,-22.165L-400.223,-22.165L-400.223,-37.649L-391.396,-37.649C-386.187,-37.649 -381.411,-36.491 -381.411,-29.907" style="fill-rule:nonzero;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 120 50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(0.20764,0,0,0.20764,14.4981,12.6907)">
<path d="M0,117.028C32.316,117.028 58.514,90.831 58.514,58.514C58.514,26.198 32.316,0 0,0C-32.316,0 -58.514,26.198 -58.514,58.514C-58.514,90.831 -32.316,117.028 0,117.028" style="fill:rgb(0,227,0);fill-rule:nonzero;"/>
</g>
<g transform="matrix(0.20764,0,0,0.20764,20.2132,30.2549)">
<path d="M0,-55.048L-27.524,-27.524L-55.048,-55.048L-55.048,0L0,0L0,-55.048Z" style="fill:white;fill-rule:nonzero;"/>
</g>
<g transform="matrix(0.20764,0,0,0.20764,117.634,29.1275)">
<path d="M0,-42.385C0,-45.539 -2.515,-47.568 -5.337,-47.568C-8.158,-47.568 -10.673,-45.539 -10.673,-42.385C-10.673,-39.215 -8.158,-37.173 -5.337,-37.173C-2.515,-37.173 0,-39.215 0,-42.385M-1.416,-42.385C-1.416,-40.007 -3.183,-38.283 -5.337,-38.283C-7.518,-38.283 -9.257,-40.007 -9.257,-42.385C-9.257,-44.748 -7.518,-46.458 -5.337,-46.458C-3.183,-46.458 -1.416,-44.748 -1.416,-42.385M-2.905,-39.479L-4.46,-42.024C-3.613,-42.094 -2.933,-42.51 -2.933,-43.58C-2.933,-44.845 -3.751,-45.303 -5.211,-45.303L-7.407,-45.303L-7.407,-39.479L-6.255,-39.479L-6.255,-41.967L-5.531,-41.967L-4.112,-39.479L-2.905,-39.479ZM-5.225,-42.87L-6.255,-42.87L-6.255,-44.401L-5.281,-44.401C-4.752,-44.401 -4.085,-44.29 -4.085,-43.677C-4.085,-42.968 -4.558,-42.87 -5.225,-42.87M-30.556,-36.925L-15.073,-36.925L-15.073,-46.475L-60.249,-46.475L-60.249,-11.82L-60.393,-11.82L-81.954,-46.475L-93.241,-46.475L-93.241,5.183L-82.605,5.183L-82.605,-29.401L-82.461,-29.401L-60.972,5.183L-49.613,5.183L-49.613,-36.925L-41.915,-36.925L-41.915,5.183L-30.556,5.183L-30.556,-36.925ZM-108.073,5.183L-96.714,5.183L-96.714,-46.475L-108.073,-46.475L-108.073,5.183ZM-122.181,5.183L-111.545,5.183L-111.545,-46.475L-127.535,-46.475L-138.967,-10.952L-139.111,-10.952L-151.194,-46.475L-167.183,-46.475L-167.183,5.183L-156.548,5.183L-156.548,-31.065L-156.403,-31.065L-143.742,5.183L-134.987,5.183L-122.326,-31.427L-122.181,-31.427L-122.181,5.183ZM-186.684,-36.925L-171.201,-36.925L-171.201,-46.475L-244.984,-46.475L-244.984,5.183L-205.77,5.183L-205.77,-4.368L-233.625,-4.368L-233.625,-17.029L-208.592,-17.029L-208.592,-25.856L-233.625,-25.856L-233.625,-36.925L-198.043,-36.925L-198.043,5.183L-186.684,5.183L-186.684,-36.925ZM-259.816,5.183L-248.457,5.183L-248.457,-46.475L-259.093,-46.475L-259.093,-11.82L-259.237,-11.82L-280.798,-46.475L-292.084,-46.475L-292.084,5.183L-281.449,5.183L-281.449,-29.401L-281.304,-29.401L-259.816,5.183ZM-305.52,5.183L-293.727,5.183L-313.044,-46.475L-324.693,-46.475L-340.675,-4.368L-356.154,-4.368L-356.154,-46.475L-367.513,-46.475L-367.513,5.183L-332.796,5.183L-328.744,-6.321L-309.427,-6.321L-305.52,5.183ZM-312.393,-14.786L-325.778,-14.786L-319.049,-33.742L-318.905,-33.742L-312.393,-14.786ZM-370.414,-29.907C-370.414,-38.3 -375.334,-46.475 -388.285,-46.475L-411.582,-46.475L-411.582,5.183L-400.223,5.183L-400.223,-13.339L-388.285,-13.339C-375.334,-13.339 -370.414,-21.514 -370.414,-29.907M-381.411,-29.907C-381.411,-23.323 -386.187,-22.165 -391.396,-22.165L-400.223,-22.165L-400.223,-37.649L-391.396,-37.649C-386.187,-37.649 -381.411,-36.491 -381.411,-29.907" style="fill-rule:nonzero;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -9,7 +9,7 @@ Code is Apache-2.0 and docs are CC-BY-4.0
Each Planetmint node runs:
- MongoDB
- Tarantool
- Planetmint Server
- Tendermint
@ -17,11 +17,6 @@ When running a Planetmint node for long periods
of time, we need to consider doing log rotation, i.e. we do not want the logs taking
up large amounts of storage and making the node unresponsive or getting it into a bad state.
## MongoDB Logging and Log Rotation
See the MongoDB docs about
[logging](https://docs.mongodb.com/v3.6/administration/monitoring/#monitoring-standard-loggging)
and [log rotation](https://docs.mongodb.com/v3.6/tutorial/rotate-log-files/).
## Planetmint Server Logging and Log Rotation

View File

@ -17,7 +17,7 @@ two kinds: CREATE transactions and TRANSFER transactions.
You can view the transaction specifications in Github, which describe transaction components and the conditions they have to fulfill in order to be valid.
[Planetmint Transactions Specs](https://github.com/planetmint/BEPs/tree/master/13/)
[Planetmint Transactions Specs](https://github.com/bigchaindb/BEPs/tree/master/13/)
### CREATE Transactions
@ -44,7 +44,7 @@ Planetmint supports a variety of conditions.
For details, see
the section titled **Transaction Components: Conditions**
in the relevant
[Planetmint Transactions Spec](https://github.com/planetmint/BEPs/tree/master/13/).
[Planetmint Transactions Spec](https://github.com/bigchaindb/BEPs/tree/master/13/).
![Example Planetmint CREATE transaction](./_static/CREATE_example.png)
@ -58,7 +58,7 @@ Loosely speaking, that list might be interpreted as the list of "owners."
A more accurate word might be fulfillers, signers, controllers,
or transfer-enablers.
See the section titled **A Note about Owners**
in the relevant [Planetmint Transactions Spec](https://github.com/planetmint/BEPs/tree/master/13/).
in the relevant [Planetmint Transactions Spec](https://github.com/bigchaindb/BEPs/tree/master/13/).
A CREATE transaction must be signed by all the owners.
(If you're looking for that signature,
@ -119,13 +119,43 @@ of the outgoing paperclips (100).
### Transaction Validity
When a node is asked to check if a transaction is valid, it checks several
things. We documented those things in a post on *The Planetmint Blog*:
["What is a Valid Transaction in Planetmint?"](https://blog.planetmint.io/what-is-a-valid-transaction-in-planetmint-9a1a075a9598)
things. This got documented by a BigchainDB post (previous version of Planetmint) at*The BigchainDB Blog*:
["What is a Valid Transaction in BigchainDB?"](https://blog.bigchaindb.com/what-is-a-valid-transaction-in-planetmint-9a1a075a9598)
(Note: That post was about Planetmint Server v1.0.0.)
## A Note on IPLD marshalling and CIDs
Planetmint utilizes IPLD (interplanetary linked data) marshalling and CIDs (content identifiers) to store and verify data.
Before submitting a transaction to the network the data is marshalled using [py-ipld](https://github.com/planetmint/py-ipld) and instead of the raw data a CID is stored on chain.
The CID is a self describing data structure. It contains information about the encoding, cryptographic algorithm, length and the actual hashvalue. For example the CID `bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi` tells us the following:
```
Encoding: base32
Codec: dag-pb (MerkleDAG protobuf)
Hashing-Algorithm: sha2-256
Digest (Hex): C3C4733EC8AFFD06CF9E9FF50FFC6BCD2EC85A6170004BB709669C31DE94391A
```
With this information we can validate that information about an asset we've received is actually valid.
### Example Transactions
There are example Planetmint transactions in
[the HTTP API documentation](./connecting/api/http-client-server-api)
[the HTTP API documentation](./connecting/http-client-server-api)
and
[the Python Driver documentation](./connecting/drivers).
## Contracts & Conditions
Planetmint has been developed with simple logical gateways in mind. The logic got introduced by [cryptoconditions](https://https://docs.planetmint.io/projects/cryptoconditions). The cryptocondition documentation contains all details about how conditoins are defined and how they can be verified and fulfilled.
The integration of such into the transaction schema of Planetmint is shown below.
## Zenroom Smart Contracts and Policies
[Zenroom](https://zenroom.org/) was integrated into [cryptoconditions](https://https://docs.planetmint.io/projects/cryptoconditions) to allow for human-readable conditions and fulfillments.
At the moment these contracts can only be stateless, which implies that the conditions and fulfillments need to be transacted in the same transaction. However, [PRP-10](https://github.com/planetmint/PRPs/tree/main/10) aims to make stateful contracts possible, which enables asynchronous and party-independent processing of contracts.
As for network-wide or asset-based policies [PRP-11](https://github.com/planetmint/PRPs/tree/main/11) specifies how these can be implemented and how these can be used to verify a transaction state before it is commited to the network.

View File

@ -30,14 +30,14 @@ from os import rename, remove
# get version
_version = {}
with open('../../../planetmint/version.py') as fp:
with open("../../../planetmint/version.py") as fp:
exec(fp.read(), _version)
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
#sys.path.insert(0, "/home/myname/pythonfiles")
sys.path.insert(0, parentdir)
# sys.path.insert(0, "/home/myname/pythonfiles")
# -- General configuration ------------------------------------------------
@ -48,84 +48,95 @@ sys.path.insert(0,parentdir)
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
project = 'Planetmint'
project = "Planetmint"
import sphinx_rtd_theme
extensions = [
'myst_parser',
'sphinx.ext.autosectionlabel',
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'sphinx.ext.todo',
'sphinx.ext.napoleon',
'sphinxcontrib.httpdomain',
'aafigure.sphinxext',
"myst_parser",
"sphinx.ext.napoleon",
"sphinx.ext.autosectionlabel",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.viewcode",
"sphinx.ext.todo",
"sphinxcontrib.httpdomain",
"aafigure.sphinxext",
#'sphinx_toolbox.collapse',
# Below are actually build steps made to look like sphinx extensions.
# It was the easiest way to get it running with ReadTheDocs.
'generate_http_server_api_documentation',
"generate_http_server_api_documentation",
]
try:
remove('contributing/cross-project-policies/code-of-conduct.md')
remove('contributing/cross-project-policies/release-process.md')
remove('contributing/cross-project-policies/python-style-guide.md')
remove("contributing/cross-project-policies/code-of-conduct.md")
remove("contributing/cross-project-policies/release-process.md")
remove("contributing/cross-project-policies/python-style-guide.md")
except:
print('done')
print("done")
def get_old_new(url, old, new):
filename = wget.download(url)
rename(old, new)
get_old_new('https://raw.githubusercontent.com/planetmint/planetmint/master/CODE_OF_CONDUCT.md',
'CODE_OF_CONDUCT.md', 'contributing/cross-project-policies/code-of-conduct.md')
get_old_new('https://raw.githubusercontent.com/planetmint/planetmint/master/RELEASE_PROCESS.md',
'RELEASE_PROCESS.md', 'contributing/cross-project-policies/release-process.md')
get_old_new(
"https://raw.githubusercontent.com/planetmint/planetmint/master/CODE_OF_CONDUCT.md",
"CODE_OF_CONDUCT.md",
"contributing/cross-project-policies/code-of-conduct.md",
)
get_old_new('https://raw.githubusercontent.com/planetmint/planetmint/master/PYTHON_STYLE_GUIDE.md',
'PYTHON_STYLE_GUIDE.md', 'contributing/cross-project-policies/python-style-guide.md')
get_old_new(
"https://raw.githubusercontent.com/planetmint/planetmint/master/RELEASE_PROCESS.md",
"RELEASE_PROCESS.md",
"contributing/cross-project-policies/release-process.md",
)
suppress_warnings = ['misc.highlighting_failure']
get_old_new(
"https://raw.githubusercontent.com/planetmint/planetmint/master/PYTHON_STYLE_GUIDE.md",
"PYTHON_STYLE_GUIDE.md",
"contributing/cross-project-policies/python-style-guide.md",
)
suppress_warnings = ["misc.highlighting_failure"]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]
# autodoc settings
autodoc_member_order = 'bysource'
autodoc_member_order = "bysource"
autodoc_default_options = {
'members': None,
"members": None,
}
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = ['.rst', '.md']
source_suffix = [".rst", ".md"]
# The encoding of source files.
#
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
master_doc = "index"
autosectionlabel_prefix_document = True
# General information about the project.
now = datetime.datetime.now()
copyright = str(now.year) + ', Planetmint Contributors'
author = 'Planetmint Contributors'
copyright = str(now.year) + ", Planetmint Contributors"
author = "Planetmint Contributors"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = _version['__short_version__']
version = _version["__short_version__"]
# The full version, including alpha/beta/rc tags.
release = _version['__version__']
release = _version["__version__"]
# The full version, including alpha/beta/rc tags.
# The language for content autogenerated by Sphinx. Refer to documentation
@ -133,7 +144,7 @@ release = _version['__version__']
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
language = "en"
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
@ -169,7 +180,7 @@ exclude_patterns = []
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
@ -186,7 +197,7 @@ todo_include_todos = False
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'press'
html_theme = "press"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@ -195,7 +206,7 @@ html_theme = 'press'
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = [press.get_html_theme_path()]
# html_theme_path = [press.get_html_theme_path()]
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
@ -209,7 +220,7 @@ html_theme = 'press'
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#
html_logo = '_static/PLANETMINT_COLOR_POS.png'
html_logo = "_static/planetmint-logo.png"
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@ -220,7 +231,7 @@ html_logo = '_static/PLANETMINT_COLOR_POS.png'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
@ -300,34 +311,36 @@ html_static_path = ['_static']
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'Planetmintdoc'
htmlhelp_basename = "Planetmintdoc"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
# The paper size ('letterpaper' or 'a4paper').
#
"papersize": "letterpaper",
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Planetmint.tex', 'Planetmint Documentation',
'Planetmint Contributors', 'manual'),
(
master_doc,
"Planetmint.tex",
"Planetmint Documentation",
"Planetmint Contributors",
"manual",
),
]
# The name of an image file (relative to this directory) to place at the top of
@ -367,10 +380,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'planetmint', 'Planetmint Documentation',
[author], 1)
]
man_pages = [(master_doc, "planetmint", "Planetmint Documentation", [author], 1)]
# If true, show URL addresses after external links.
#
@ -383,9 +393,15 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Planetmint', 'Planetmint Documentation',
author, 'Planetmint', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"Planetmint",
"Planetmint Documentation",
author,
"Planetmint",
"One line description of project.",
"Miscellaneous",
),
]
# Documents to append as an appendix to all manuals.

View File

@ -147,11 +147,11 @@ Transactions Endpoint
If it's invalid, the node will return an HTTP 400 (error).
Otherwise, the node will send the transaction to Tendermint (in the same node) using the
`Tendermint broadcast API
<https://tendermint.io/docs/tendermint-core/using-tendermint.html#broadcast-api>`_.
<https://tendermint.com/docs/tendermint-core/using-tendermint.html#broadcast-api>`_.
The meaning of the ``mode`` query parameter is inherited from the mode parameter in
`Tendermint's broadcast API
<https://tendermint.io/docs/tendermint-core/using-tendermint.html#broadcast-api>`_.
<https://tendermint.com/docs/tendermint-core/using-tendermint.html#broadcast-api>`_.
``mode=async`` means the HTTP response will come back immediately,
before Tendermint asks Planetmint Server to check the validity of the transaction (a second time).
``mode=sync`` means the HTTP response will come back

View File

@ -4,7 +4,7 @@ Content-Type: application/json
{
"assets": "/assets/",
"blocks": "/blocks/",
"docs": "https://docs.planetmint.com/projects/server/en/v0.9.3/http-client-server-api.html",
"docs": "https://docs.planetmint.io/projects/server/en/v2.2.4/http-client-server-api.html",
"metadata": "/metadata/",
"outputs": "/outputs/",
"streamedblocks": "ws://localhost:9985/api/v1/streams/valid_blocks",

View File

@ -5,24 +5,22 @@ Content-Type: application/json
"height": 1,
"transactions": [
{
"asset": {
"data": {
"msg": "Hello Planetmint!"
"assets": [
{
"data": "QmQP5C3PmhH9oB84n7YqSY4WVqmYatdoo1BdwhH4zmcwqM"
}
},
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2",
],
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530",
"inputs": [
{
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUBcdRj6EnG3MPl47m3XPd1HNfe7q3WL4T6MewNNnat33UvzVnPHo_vossv57M7L064VwrYMLGp097H7IeHpDngK",
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUDklzRb5aUQz9slbaqSWap1AfC-cacTCN3CGtFy2LPK7JKEqKG2b0KQXnUcFksk_KH_v6ImFXHsclKSp1OJkIEI",
"fulfills": null,
"owners_before": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
]
}
],
"metadata": {
"sequence": 0
},
"metadata": "QmZs4UHLHCUGLQr6rzbtJTjT8Sf5pw6FNuaRZ5pzguk5FV",
"operation": "CREATE",
"outputs": [
{
@ -39,7 +37,7 @@ Content-Type: application/json
]
}
],
"version": "2.0"
"version": "3.0"
}
]
}

View File

@ -1,3 +1,3 @@
GET /api/v1/blocks?transaction_id=6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2 HTTP/1.1
GET /api/v1/blocks?transaction_id=0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530 HTTP/1.1
Host: example.com

View File

@ -1,3 +1,3 @@
GET /api/v1/transactions?operation=TRANSFER&asset_id=6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2 HTTP/1.1
GET /api/v1/transactions?operation=TRANSFER&asset_id=0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530 HTTP/1.1
Host: example.com

View File

@ -2,25 +2,25 @@ HTTP/1.1 200 OK
Content-Type: application/json
[{
"asset": {
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2"
},
"id": "2bf8ae1e3bc889a26df129dd6bbe6ccab30d1ae8e9e434fae1c4446042a68931",
"assets": [
{
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530"
}
],
"id": "8d11fe2bd91c4747a41e0c3dbe1400c511175be42f008d6cff92cbfa9e04f799",
"inputs": [
{
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUA90mMa9AWnbI70CUSVgzV9kRFf3tQ20RUIczNFqmwg9xrpOk_5uNoJB4bWRIojZmUhEyxSueCHLpqPXCEuyisE",
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUCh-rpO-xqDm2fngjzxnKc39G16FpFMo0y50sHT7_uo1Itzvh4jsxnSGco2HjG6ZF-lSiGsASZ4uIIHuPM57yUI",
"fulfills": {
"output_index": 0,
"transaction_id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2"
"transaction_id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530"
},
"owners_before": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
]
}
],
"metadata": {
"sequence": 1
},
"metadata": "QmQ9Sc3VWZ3nH5FWVVi2MNMDhyjTiKrEb6mN79qqt1Uq9s",
"operation": "TRANSFER",
"outputs": [
{
@ -37,28 +37,28 @@ Content-Type: application/json
]
}
],
"version": "2.0"
"version": "3.0"
},
{
"asset": {
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2"
},
"id": "b9b614175eaed7cc93d9b80ebc2a91d35ae31928a7c218ae982272bb1785ef16",
"assets": [
{
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530"
}
],
"id": "45c929b66d1b10db6c3c3e6b1adddc0778b473fced4a1f403c2646b25f3fd983",
"inputs": [
{
"fulfillment": "pGSAICw7Ul-c2lG6NFbHp3FbKRC7fivQcNGO7GS4wV3A-1QggUDi2bAVKJgEyE3LzMrAnAu1PnNs9DbDNkABaY6j3OCNEVwNVNg3V3qELOFNnH8vGUevREr4E-8Vb1Kzk4VR71MO",
"fulfillment": "pGSAICw7Ul-c2lG6NFbHp3FbKRC7fivQcNGO7GS4wV3A-1QggUAc6OAQcXppDxCazw0UK2nwghctKNiZYDDsSOkAn0eQE8QjZ7GLzJpVb92oGXw_4FF7cLE0gg3nNxu7taQ8xakE",
"fulfills": {
"output_index": 0,
"transaction_id": "2bf8ae1e3bc889a26df129dd6bbe6ccab30d1ae8e9e434fae1c4446042a68931"
"transaction_id": "8d11fe2bd91c4747a41e0c3dbe1400c511175be42f008d6cff92cbfa9e04f799"
},
"owners_before": [
"3yfQPHeWAa1MxTX9Zf9176QqcpcnWcanVZZbaHb8B3h9"
]
}
],
"metadata": {
"sequence": 2
},
"metadata": "QmRRg9RGq3TmV6nj2SXJacPuTdwaFDGTPACJLdN368pN3t",
"operation": "TRANSFER",
"outputs": [
{
@ -75,5 +75,5 @@ Content-Type: application/json
]
}
],
"version": "2.0"
"version": "3.0"
}]

View File

@ -1,3 +1,3 @@
GET /api/v1/transactions/6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2 HTTP/1.1
GET /api/v1/transactions/0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530 HTTP/1.1
Host: example.com

View File

@ -2,24 +2,22 @@ HTTP/1.1 200 OK
Content-Type: application/json
{
"asset": {
"data": {
"msg": "Hello Planetmint!"
"assets": [
{
"data": "QmQP5C3PmhH9oB84n7YqSY4WVqmYatdoo1BdwhH4zmcwqM"
}
},
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2",
],
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530",
"inputs": [
{
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUBcdRj6EnG3MPl47m3XPd1HNfe7q3WL4T6MewNNnat33UvzVnPHo_vossv57M7L064VwrYMLGp097H7IeHpDngK",
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUDklzRb5aUQz9slbaqSWap1AfC-cacTCN3CGtFy2LPK7JKEqKG2b0KQXnUcFksk_KH_v6ImFXHsclKSp1OJkIEI",
"fulfills": null,
"owners_before": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
]
}
],
"metadata": {
"sequence": 0
},
"metadata": "QmZs4UHLHCUGLQr6rzbtJTjT8Sf5pw6FNuaRZ5pzguk5FV",
"operation": "CREATE",
"outputs": [
{
@ -36,5 +34,5 @@ Content-Type: application/json
]
}
],
"version": "2.0"
"version": "3.0"
}

View File

@ -6,7 +6,7 @@ Content-Type: application/json
"v1": {
"assets": "/api/v1/assets/",
"blocks": "/api/v1/blocks/",
"docs": "https://docs.planetmint.com/projects/server/en/v0.9.3/http-client-server-api.html",
"docs": "https://docs.planetmint.io/projects/server/en/v2.2.4/http-client-server-api.html",
"metadata": "/api/v1/metadata/",
"outputs": "/api/v1/outputs/",
"streamedblocks": "ws://localhost:9985/api/v1/streams/valid_blocks",
@ -15,7 +15,7 @@ Content-Type: application/json
"validators": "/api/v1/validators"
}
},
"docs": "https://docs.planetmint.com/projects/server/en/v0.9.3/",
"docs": "https://docs.planetmint.io/projects/server/en/v2.2.4/",
"software": "Planetmint",
"version": "0.9.3"
"version": "2.2.4"
}

View File

@ -3,24 +3,22 @@ Host: example.com
Content-Type: application/json
{
"asset": {
"data": {
"msg": "Hello Planetmint!"
"assets": [
{
"data": "QmQP5C3PmhH9oB84n7YqSY4WVqmYatdoo1BdwhH4zmcwqM"
}
},
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2",
],
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530",
"inputs": [
{
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUBcdRj6EnG3MPl47m3XPd1HNfe7q3WL4T6MewNNnat33UvzVnPHo_vossv57M7L064VwrYMLGp097H7IeHpDngK",
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUDklzRb5aUQz9slbaqSWap1AfC-cacTCN3CGtFy2LPK7JKEqKG2b0KQXnUcFksk_KH_v6ImFXHsclKSp1OJkIEI",
"fulfills": null,
"owners_before": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
]
}
],
"metadata": {
"sequence": 0
},
"metadata": "QmZs4UHLHCUGLQr6rzbtJTjT8Sf5pw6FNuaRZ5pzguk5FV",
"operation": "CREATE",
"outputs": [
{
@ -37,5 +35,5 @@ Content-Type: application/json
]
}
],
"version": "2.0"
"version": "3.0"
}

View File

@ -2,24 +2,22 @@ HTTP/1.1 202 Accepted
Content-Type: application/json
{
"asset": {
"data": {
"msg": "Hello Planetmint!"
"assets": [
{
"data": "QmQP5C3PmhH9oB84n7YqSY4WVqmYatdoo1BdwhH4zmcwqM"
}
},
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2",
],
"id": "0fdeb547670bbea980389df53cf5a91e60159339084c6b0b5cc0b5494a679530",
"inputs": [
{
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUBcdRj6EnG3MPl47m3XPd1HNfe7q3WL4T6MewNNnat33UvzVnPHo_vossv57M7L064VwrYMLGp097H7IeHpDngK",
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUDklzRb5aUQz9slbaqSWap1AfC-cacTCN3CGtFy2LPK7JKEqKG2b0KQXnUcFksk_KH_v6ImFXHsclKSp1OJkIEI",
"fulfills": null,
"owners_before": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
]
}
],
"metadata": {
"sequence": 0
},
"metadata": "QmZs4UHLHCUGLQr6rzbtJTjT8Sf5pw6FNuaRZ5pzguk5FV",
"operation": "CREATE",
"outputs": [
{
@ -36,5 +34,5 @@ Content-Type: application/json
]
}
],
"version": "2.0"
"version": "3.0"
}

View File

@ -42,7 +42,7 @@ This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior directed at yourself or another community member may be
reported by contacting a project maintainer at [contact@planetmint.com](mailto:contact@planetmint.com). All
reported by contacting a project maintainer at [mail@planetmint.io](mailto:contact@planetmint.io). All
complaints will be reviewed and investigated and will result in a response that
is appropriate to the circumstances. Maintainers are
obligated to maintain confidentiality with regard to the reporter of an

View File

@ -82,11 +82,11 @@ x = 'name: {}; score: {}'.format(name, n)
we use the `format()` version. The [official Python documentation says](https://docs.python.org/2/library/stdtypes.html#str.format), "This method of string formatting is the new standard in Python 3, and should be preferred to the % formatting described in String Formatting Operations in new code."
## Running the Flake8 Style Checker
## Running the Black Style Checker
We use [Flake8](http://flake8.pycqa.org/en/latest/index.html) to check our Python code style. Once you have it installed, you can run it using:
We use [Black](https://black.readthedocs.io/en/stable/) to check our Python code style. Once you have it installed, you can run it using:
```text
flake8 --max-line-length 119 planetmint/
black --check -l 119 .
```

View File

@ -99,8 +99,7 @@ $ bash stack.sh -h
ENV[TM_VERSION]
(Optional) Tendermint version to use for the setup. (default: 0.22.8)
ENV[MONGO_VERSION]
(Optional) MongoDB version to use with the setup. (default: 3.6)
ENV[AZURE_CLIENT_ID]
Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Steps to generate:
@ -181,8 +180,6 @@ $ export STACK_BRANCH=master
#Optional, since 0.22.8 is the default tendermint version.
$ export TM_VERSION=0.22.8
#Optional, since 3.6 is the default MongoDB version.
$ export MONGO_VERSION=3.6
$ bash stack.sh
```
@ -232,8 +229,7 @@ $ export STACK_BRANCH=master
#Optional, since 0.22.8 is the default tendermint version
$ export TM_VERSION=0.22.8
#Optional, since 3.6 is the default MongoDB version.
$ export MONGO_VERSION=3.6
$ bash stack.sh
```

View File

@ -11,16 +11,16 @@ The following doc describes how to run a local node for developing Planetmint Te
There are two crucial dependencies required to start a local node:
- MongoDB
- Tarantool
- Tendermint
and of course you also need to install Planetmint Sever from the local code you just developed.
## Install and Run MongoDB
## Install and Run Tarantool
MongoDB can be easily installed, just refer to their [installation documentation](https://docs.mongodb.com/manual/installation/) for your distro.
We know MongoDB 3.4 and 3.6 work with Planetmint.
After the installation of MongoDB is complete, run MongoDB using `sudo mongod`
Tarantool can be easily installed, just refer to their [installation documentation](https://www.tarantool.io/en/download/os-installation/ubuntu/) for your distro.
We know Tarantool 2.8 work with Planetmint.
After the installation of Tarantool is complete, run Tarantool using `tarantool` and to create a listener `box.cfg{listen=3301}` in cli of Tarantool.
## Install and Run Tendermint
@ -30,9 +30,9 @@ The version of Planetmint Server described in these docs only works well with Te
```bash
$ sudo apt install -y unzip
$ wget https://github.com/tendermint/tendermint/releases/download/v0.34.15/tendermint_v0.34.15_linux_amd64.zip
$ unzip tendermint_v0.34.15_linux_amd64.zip
$ rm tendermint_v0.34.15_linux_amd64.zip
$ wget https://github.com/tendermint/tendermint/releases/download/v0.34.24/tendermint_v0.34.24_linux_amd64.zip
$ unzip tendermint_v0.34.24_linux_amd64.zip
$ rm tendermint_v0.34.24_linux_amd64.zip
$ sudo mv tendermint /usr/local/bin
```
@ -125,7 +125,7 @@ To execute tests when developing a feature or fixing a bug one could use the fol
$ pytest -v
```
NOTE: MongoDB and Tendermint should be running as discussed above.
NOTE: Tarantool and Tendermint should be running as discussed above.
One could mark a specific test and execute the same by appending `-m my_mark` to the above command.

View File

@ -39,7 +39,7 @@ $ docker-compose up -d bdb
The above command will launch all 3 main required services/processes:
* ``mongodb``
* ``tarantool``
* ``tendermint``
* ``planetmint``
@ -55,7 +55,7 @@ To follow the logs of the ``planetmint`` service:
$ docker-compose logs -f planetmint
```
To follow the logs of the ``mongodb`` service:
```bash
$ docker-compose logs -f mdb

View File

@ -12,7 +12,7 @@ Know What You Want to Write Code to Do
Do you want to write code to resolve an open issue (bug)? Which one?
Do you want to implement a Planetmint Enhancement Proposal (PEP)? Which one?
Do you want to implement a Planetmint Refinement Proposal (PRP)? Which one?
You should know why you want to write code before you go any farther.
@ -21,7 +21,7 @@ Refresh Yourself about the C4 Process
-------------------------------------
C4 is the Collective Code Construction Contract. It's quite short:
`re-reading it will only take a few minutes <https://github.com/planetmint/BEPs/tree/master/1>`_.
`re-reading it will only take a few minutes <https://github.com/bigchaindb/BEPs/tree/master/1>`_.
Set Up Your Local Machine. Here's How.
@ -69,7 +69,7 @@ Set Up Your Local Machine. Here's How.
Before You Start Writing Code
-----------------------------
Read `BEP-24 <https://github.com/planetmint/BEPs/tree/master/24>`_
Read `BEP-24 <https://github.com/bigchaindb/BEPs/tree/master/24>`_
so you know what to do to ensure that your changes (i.e. your future pull request) can be merged.
It's easy and will save you some hassle later on.

View File

@ -16,7 +16,7 @@ It includes several sub-projects.
- `Planetmint Java Driver <https://github.com/planetmint/java-bigchaindb-driver>`_
- `cryptoconditions <https://github.com/planetmint/cryptoconditions>`_ (a Python package by us)
- `py-abci <https://github.com/davebryson/py-abci>`_ (a Python package we use)
- `Planetmint Enhancement Proposals (PEPs) <https://github.com/planetmint/PEPs>`_
- `Planetmint Refinement Proposals (PRPs) <https://github.com/planetmint/PRPs>`_
Contents
--------

View File

@ -27,17 +27,17 @@ People ask questions about Planetmint in the following places:
Feel free to hang out and answer some questions. People will be thankful.
# Write a Planetmint Enhancement Proposal (PEP)
# Write a Planetmint Refinement Proposal (PRP)
If you have an idea for a new feature or enhancement, and you want some feedback before you write a full Planetmint Enhancement Proposal (PEP), then feel free to:
If you have an idea for a new feature or enhancement, and you want some feedback before you write a full Planetmint Refinement Proposal (PRP), then feel free to:
- ask in the [planetmint/community Gitter chat room](https://gitter.im/planetmint/planetmint) or
- [open a new issue in the planetmint/PEPs repo](https://github.com/planetmint/PEPs/issues/new) and give it the label **PEP idea**.
- [open a new issue in the planetmint/PRPs repo](https://github.com/planetmint/PRPs/issues/new) and give it the label **PRP idea**.
If you want to discuss an existing PEP, then [open a new issue in the planetmint/PEPs repo](https://github.com/planetmint/BEPs/issues/new) and give it the label **discuss existing PEP**.
If you want to discuss an existing PRP, then [open a new issue in the planetmint/PRPs repo](https://github.com/planetmint/PRPs/issues/new) and give it the label **discuss existing PRP**.
## Steps to Write a New PEP
## Steps to Write a New PRP
1. Look at the structure of existing PEPs in the [planetmint/PEPs repo](https://github.com/planetmint/PEPs). Note the section headings. [PEP-2](https://github.com/planetmint/PEPs/tree/master/2) (our variant of the consensus-oriented specification system [COSS]) says more about the expected structure and process.
1. Write a first draft of your PEP. It doesn't have to be long or perfect.
1. Push your BEP draft to the [planetmint/PEPs repo](https://github.com/planetmint/PEPs) and make a pull request. [PEP-1](https://github.com/planetmint/PEPs/tree/master/1) (our variant of C4) outlines the process we use to handle all pull requests. In particular, we try to merge all pull requests quickly.
1. Your PEP can be revised by pushing more pull requests.
1. Look at the structure of existing PRPs in the [planetmint/PRPs repo](https://github.com/planetmint/PRPs). Note the section headings. [PRP-2](https://github.com/planetmint/PRPs/tree/master/2) (our variant of the consensus-oriented specification system [COSS]) says more about the expected structure and process.
1. Write a first draft of your PRP. It doesn't have to be long or perfect.
1. Push your BEP draft to the [planetmint/PRPs repo](https://github.com/planetmint/PRPs) and make a pull request. [PRP-1](https://github.com/planetmint/PRPs/tree/master/1) (our variant of C4) outlines the process we use to handle all pull requests. In particular, we try to merge all pull requests quickly.
1. Your PRP can be revised by pushing more pull requests.

View File

@ -7,7 +7,7 @@
Planetmint
==========
Meet Planetmint. The blockchain database.
Meet Planetmint. The metadata blockchain.
It has some database characteristics and some blockchain `properties <properties.html>`_,
including decentralization, immutability and native support for assets.
@ -27,3 +27,10 @@ At a high level, one can communicate with a Planetmint network (set of nodes) us
terminology
troubleshooting
.. toctree::
:maxdepth: 1
:caption: Cryptoconditions & Smart Contracts
Crypto Conditions & Smart Contracts <https://docs.planetmint.io/projects/cryptoconditions/en/latest/>
cryptoconditions

View File

@ -0,0 +1,7 @@
# Network of nodes with the Ansible script
You can find one of the installation methods with Ansible on GitHub at:
[Ansible script](https://github.com/planetmint/planetmint-node-ansible)
It allows to install Planetmint, Tarantool, Tendermint, and python, and then connect nodes into a network. Current tested machine is Ubuntu 18.04.

View File

@ -19,13 +19,13 @@ A consortium can increase its decentralization (and its resilience) by increasin
Theres no node that has a long-term special position in the Planetmint network. All nodes run the same software and perform the same duties.
If someone has (or gets) admin access to a node, they can mess with that node (e.g. change or delete data stored on that node), but those changes should remain isolated to that node. The Planetmint network can only be compromised if more than one third of the nodes get compromised. See the [Tendermint documentation](https://tendermint.io/docs/introduction/introduction.html) for more details.
If someone has (or gets) admin access to a node, they can mess with that node (e.g. change or delete data stored on that node), but those changes should remain isolated to that node. The Planetmint network can only be compromised if more than one third of the nodes get compromised. See the [Tendermint documentation](https://tendermint.com/docs/introduction/introduction.html) for more details.
Its worth noting that not even the admin or superuser of a node can transfer assets. The only way to create a valid transfer transaction is to fulfill the current crypto-conditions on the asset, and the admin/superuser cant do that because the admin user doesnt have the necessary information (e.g. private keys).
## Byzantine Fault Tolerance
[Tendermint](https://tendermint.io/) is used for consensus and transaction replication,
[Tendermint](https://www.tendermint.com/) is used for consensus and transaction replication,
and Tendermint is [Byzantine Fault Tolerant (BFT)](https://en.wikipedia.org/wiki/Byzantine_fault_tolerance).
## Node Diversity

View File

@ -13,7 +13,7 @@ Planetmint is a metadata blockchain. This introduction gives an overview about h
## The IPDB Testnet - sending transactions
The IPDB foundation hosta a testnet server that is reset every night at 4am UTC.
The IPDB foundation hosts a testnet server that is reset every night at 4am UTC.
The following sequence shows a simple asset notarization / attestion on that testnet:
Create a file named notarize.py
@ -43,16 +43,24 @@ $ python notarize.py
# Install Planetmint
## Local Node
Planemtint is a Tendermint applicatoin with an attached database.
A basic installation installs the database, Tenermint and therafter Planetmint.
A basic installation installs the database, Tendermint and therafter Planetmint.
The instalation of the database is as follows:
Planetmint currently supports Tarantool and MongoDB database. The installation is as follows:
```
# Tarantool
$ curl -L https://tarantool.io/release/2/installer.sh | bash
$ sudo apt-get -y install tarantool
```
*Caveat:* Tarantool versions before [2.4.2](https://www.tarantool.io/en/doc/latest/release/2.4.2/) automatically enable and start a demonstration instance that listens on port `3301` by default. Refer to the [Tarantool documentation](https://www.tarantool.io/en/doc/latest/getting_started/getting_started_db/#creating-db-locally) for more information.
```
# MongoDB
$ sudo apt install mongodb
```
Tendermint can be installed and started as follows
```
$ wget https://github.com/tendermint/tendermint/releases/download/v0.34.15/tendermint_0.34.15_linux_amd64.tar.gz
$ tar zxf tendermint_0.34.15_linux_amd64.tar.gz
$ wget https://github.com/tendermint/tendermint/releases/download/v0.34.24/tendermint_0.34.24_linux_amd64.tar.gz
$ tar zxf tendermint_0.34.24_linux_amd64.tar.gz
$ ./tendermint init
$ ./tendermint node --proxy_app=tcp://localhost:26658
```

View File

@ -4,7 +4,7 @@
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
Code is Apache-2.0 and docs are CC-BY-4.0
Networks & Fedreations
Networks & Federations
######################

View File

@ -60,7 +60,7 @@ you can do this:
.. code::
$ mkdir $(pwd)/tmdata
$ docker run --rm -v $(pwd)/tmdata:/tendermint/config tendermint/tendermint:v0.34.15 init
$ docker run --rm -v $(pwd)/tmdata:/tendermint/config tendermint/tendermint:v0.34.24 init
$ cat $(pwd)/tmdata/genesis.json
You should see something that looks like:

View File

@ -155,13 +155,12 @@ recheck = false
Note: The list of `persistent_peers` doesn't have to include all nodes
in the network.
## Member: Start MongoDB
## Member: Start Tarantool
If you installed MongoDB using `sudo apt install mongodb`, then MongoDB should already be running in the background. You can check using `systemctl status mongodb`.
You install Tarantool as described [here](https://www.tarantool.io/ru/download/os-installation/ubuntu/).
If MongoDB isn't running, then you can start it using the command `mongod`, but that will run it in the foreground. If you want to run it in the background (so it will continue running after you logout), you can use `mongod --fork --logpath /var/log/mongodb.log`. (You might have to create the `/var/log` directory if it doesn't already exist.)
You can start it using the command `tarantool`.To run it in the background (so it will continue running after you logout), you can have to create a listener `box.cfg{listen=3301}`.
If you installed MongoDB using `sudo apt install mongodb`, then a MongoDB startup script should already be installed (so MongoDB will start automatically when the machine is restarted). Otherwise, you should install a startup script for MongoDB.
## Member: Start Planetmint and Tendermint Using Monit
@ -199,7 +198,7 @@ If you want to start and manage the Planetmint and Tendermint processes yourself
## How Others Can Access Your Node
If you followed the above instructions, then your node should be publicly-accessible with Planetmint Root URL `https://hostname` or `http://hostname:9984`. That is, anyone can interact with your node using the [Planetmint HTTP API](../connecting/api/http-client-server-api) exposed at that address. The most common way to do that is to use one of the [Planetmint Drivers](../connecting/drivers).
If you followed the above instructions, then your node should be publicly-accessible with Planetmint Root URL `https://hostname` or `http://hostname:9984`. That is, anyone can interact with your node using the [Planetmint HTTP API](../connecting/http-client-server-api) exposed at that address. The most common way to do that is to use one of the [Planetmint Drivers](../connecting/drivers).
[bdb:software]: https://github.com/planetmint/planetmint/
[bdb:pypi]: https://pypi.org/project/Planetmint/#history

View File

@ -25,7 +25,7 @@ We now describe how *we* set up the external (public-facing) DNS records for a P
There were several goals:
* Allow external users/clients to connect directly to any Planetmint node in the network (over the internet), if they want.
* Each Planetmint node operator should get an SSL certificate for their Planetmint node, so that their Planetmint node can serve the [Planetmint HTTP API](../connecting/api/http-client-server-api) via HTTPS. (The same certificate might also be used to serve the [WebSocket API](../connecting/api/websocket-event-stream-api).)
* Each Planetmint node operator should get an SSL certificate for their Planetmint node, so that their Planetmint node can serve the [Planetmint HTTP API](../connecting/http-client-server-api) via HTTPS. (The same certificate might also be used to serve the [WebSocket API](../connecting/websocket-event-stream-api).)
* There should be no sharing of SSL certificates among Planetmint node operators.
* Optional: Allow clients to connect to a "random" Planetmint node in the network at one particular domain (or subdomain).

View File

@ -15,7 +15,7 @@ Docker image and a
This image contains all the services required for a Planetmint node i.e.
- Planetmint Server
- MongoDB
- Tarantool
- Tendermint
**Note:** **NOT for Production Use:** *This is an single node opinionated image not well suited for a network deployment.*
@ -40,10 +40,9 @@ $ docker run \
--name planetmint \
--publish 9984:9984 \
--publish 9985:9985 \
--publish 27017:27017 \
--publish 3303:3303 \
--publish 26657:26657 \
--volume $HOME/planetmint_docker/mongodb/data/db:/data/db \
--volume $HOME/planetmint_docker/mongodb/data/configdb:/data/configdb \
--volume $HOME/planetmint_docker/tarantool:/var/lib/tarantool \
--volume $HOME/planetmint_docker/tendermint:/tendermint \
planetmint/planetmint:all-in-one
```
@ -55,14 +54,12 @@ Let's analyze that command:
* `publish 9984:9984` map the host port `9984` to the container port `9984`
(the Planetmint API server)
* `9985` Planetmint Websocket server
* `27017` Default port for MongoDB
* `26657` Tendermint RPC server
* `--volume "$HOME/planetmint_docker/mongodb:/data"` map the host directory
`$HOME/planetmint_docker/mongodb` to the container directory `/data`;
this allows us to have the data persisted on the host machine,
* `3303` Configured port for Tarantool
* `$HOME/planetmint_docker/tarantool:/var/lib/tarantool` this allows us to have the data persisted on the host machine,
you can read more in the [official Docker
documentation](https://docs.docker.com/engine/tutorials/dockervolumes)
* `$HOME/planetmint_docker/tendermint:/tendermint` to persist Tendermint data.
* `$HOME/planetmint_docker/tendermint:/tendermint` to persist Tendermint data.
* `planetmint/planetmint:all-in-one` the image to use. All the options after the container name are passed on to the entrypoint inside the container.
## Verify

View File

@ -22,28 +22,24 @@ The value of each setting is determined according to the following rules:
* Otherwise, use the default value
The local config file is `$HOME/.planetmint` by default (a file which might not even exist), but you can tell Planetmint to use a different file by using the `-c` command-line option, e.g. `planetmint -c path/to/config_file.json start`
or using the `PLANETMINT_CONFIG_PATH` environment variable, e.g. `BIGHAINDB_CONFIG_PATH=.my_planetmint_config planetmint start`.
or using the `PLANETMINT_CONFIG_PATH` environment variable, e.g. `PLANETMINT_CONFIG_PATH=.my_planetmint_config planetmint start`.
Note that the `-c` command line option will always take precedence if both the `PLANETMINT_CONFIG_PATH` and the `-c` command line option are used.
You can read the current default values in the file [planetmint/\_\_init\_\_.py](https://github.com/planetmint/planetmint/blob/master/planetmint/__init__.py). (The link is to the latest version.)
Running `planetmint -y configure localmongodb` will generate a local config file in `$HOME/.planetmint` with all the default values.
## database.*
The settings with names of the form `database.*` are for the backend database
(currently only MongoDB). They are:
(currently only Tarantool). They are:
* `database.backend` can only be `localmongodb`, currently.
* `database.backend` can only be `localtarantool`, currently.
* `database.host` is the hostname (FQDN) of the backend database.
* `database.port` is self-explanatory.
* `database.name` is a user-chosen name for the database inside MongoDB, e.g. `planetmint`.
* `database.connection_timeout` is the maximum number of milliseconds that Planetmint will wait before giving up on one attempt to connect to the backend database.
* `database.max_tries` is the maximum number of times that Planetmint will try to establish a connection with the backend database. If 0, then it will try forever.
* `database.replicaset` is the name of the MongoDB replica set. The default value is `null` because in Planetmint 2.0+, each Planetmint node has its own independent MongoDB database and no replica set is necessary. Replica set must already exist if this option is configured, Planetmint will not create it.
* `database.ssl` must be `true` or `false`. It tells Planetmint Server whether it should connect to MongoDB using TLS/SSL or not. The default value is `false`.
* `database.user` is a user-chosen name for the database inside Tarantool, e.g. `planetmint`.
* `database.pass` is the password of the user for connection to tarantool listener.
There are three ways for Planetmint Server to authenticate itself with MongoDB (or a specific MongoDB database): no authentication, username/password, and x.509 certificate authentication.
There are two ways for Planetmint Server to authenticate itself with Tarantool (or a specific Tarantool service): no authentication, username/password.
**No Authentication**
@ -51,65 +47,25 @@ If you use all the default Planetmint configuration settings, then no authentica
**Username/Password Authentication**
To use username/password authentication, a MongoDB instance must already be running somewhere (maybe in another machine), it must already have a database for use by Planetmint (usually named `planetmint`, which is the default `database.name`), and that database must already have a "readWrite" user with associated username and password. To create such a user, login to your MongoDB instance as Admin and run the following commands:
```text
use <database.name>
db.createUser({user: "<database.login>", pwd: "<database.password>", roles: [{role: "readWrite", db: "<database.name>"}]})
```
* `database.login` is the user's username.
* `database.password` is the user's password, given in plaintext.
* `database.ca_cert`, `database.certfile`, `database.keyfile`, `database.crlfile`, and `database.keyfile_passphrase` are not used so they can have their default values.
**x.509 Certificate Authentication**
To use x.509 certificate authentication, a MongoDB instance must be running somewhere (maybe in another machine), it must already have a database for use by Planetmint (usually named `planetmint`, which is the default `database.name`), and that database must be set up to use x.509 authentication. See the MongoDB docs about how to do that.
* `database.login` is the user's username.
* `database.password` isn't used so the default value (`null`) is fine.
* `database.ca_cert`, `database.certfile`, `database.keyfile` and `database.crlfile` are the paths to the CA, signed certificate, private key and certificate revocation list files respectively.
* `database.keyfile_passphrase` is the private key decryption passphrase, specified in plaintext.
**Example using environment variables**
```text
export PLANETMINT_DATABASE_BACKEND=localmongodb
export PLANETMINT_DATABASE_HOST=localhost
export PLANETMINT_DATABASE_PORT=27017
export PLANETMINT_DATABASE_NAME=database8
export PLANETMINT_DATABASE_CONNECTION_TIMEOUT=5000
export PLANETMINT_DATABASE_MAX_TRIES=3
```
To use username/password authentication, a Tarantool instance must already be running somewhere (maybe in another machine), it must already have a spaces for use by Planetmint, and that database must already have a "readWrite" user with associated username and password.
**Default values**
If (no environment variables were set and there's no local config file), or you used `planetmint -y configure localmongodb` to create a default local config file for a `localmongodb` backend, then the defaults will be:
```js
"database": {
"backend": "localmongodb",
"backend": "tarantool",
"host": "localhost",
"port": 27017,
"name": "planetmint",
"connection_timeout": 5000,
"max_tries": 3,
"replicaset": null,
"login": null,
"port": 3301,
"username": null,
"password": null
"ssl": false,
"ca_cert": null,
"certfile": null,
"keyfile": null,
"crlfile": null,
"keyfile_passphrase": null,
}
```
## server.*
`server.bind`, `server.loglevel` and `server.workers`
are settings for the [Gunicorn HTTP server](http://gunicorn.org/), which is used to serve the [HTTP client-server API](../connecting/api/http-client-server-api).
are settings for the [Gunicorn HTTP server](http://gunicorn.org/), which is used to serve the [HTTP client-server API](../connecting/http-client-server-api).
`server.bind` is where to bind the Gunicorn HTTP server socket. It's a string. It can be any valid value for [Gunicorn's bind setting](http://docs.gunicorn.org/en/stable/settings.html#bind). For example:
@ -166,7 +122,7 @@ export PLANETMINT_SERVER_WORKERS=5
These settings are for the
[aiohttp server](https://aiohttp.readthedocs.io/en/stable/index.html),
which is used to serve the
[WebSocket Event Stream API](../connecting/api/websocket-event-stream-api).
[WebSocket Event Stream API](../connecting/websocket-event-stream-api).
`wsserver.scheme` should be either `"ws"` or `"wss"`
(but setting it to `"wss"` does *not* enable SSL/TLS).
`wsserver.host` is where to bind the aiohttp server socket and

View File

@ -25,7 +25,7 @@ using private IP addresses, but we don't cover that here.)
## Operating System
**Use Ubuntu 18.04 or Ubuntu Server 18.04 as the operating system.**
**Use Ubuntu 18.04 Server or above versions as the operating system.**
Similar instructions will work on other versions of Ubuntu,
and other recent Debian-like Linux distros,

View File

@ -10,17 +10,15 @@ Code is Apache-2.0 and docs are CC-BY-4.0
A production Planetmint node must include:
* Planetmint Server
* MongoDB Server 3.4+ (mongod)
* Tarantool
* Tendermint
* Storage for MongoDB and Tendermint
It could also include several other components, including:
* NGINX or similar, to provide authentication, rate limiting, etc.
* An NTP daemon running on all machines running Planetmint Server or mongod, and possibly other machines
* Probably _not_ MongoDB Automation Agent. It's for automating the deployment of an entire MongoDB cluster.
* MongoDB Monitoring Agent
* MongoDB Backup Agent
* An NTP daemon running on all machines running Planetmint Server or tarantool, and possibly other machines
* Log aggregation software
* Monitoring software
* Maybe more

View File

@ -7,7 +7,7 @@ Code is Apache-2.0 and docs are CC-BY-4.0
# Production Node Requirements
**This page is about the requirements of Planetmint Server.** You can find the requirements of MongoDB, Tendermint and other [production node components](node-components) in the documentation for that software.
**This page is about the requirements of Planetmint Server.** You can find the requirements of Tarantool, Tendermint and other [production node components](node-components) in the documentation for that software.
## OS Requirements

View File

@ -14,5 +14,5 @@ Here are some references about how to secure an Ubuntu 18.04 server:
Also, here are some recommendations a node operator can follow to enhance the privacy of the data coming to, stored on, and leaving their node:
- Ensure that all data stored on a node is encrypted at rest, e.g. using full disk encryption. This can be provided as a service by the operating system, transparently to Planetmint, MongoDB and Tendermint.
- Ensure that all data stored on a node is encrypted at rest, e.g. using full disk encryption. This can be provided as a service by the operating system, transparently to Planetmint, Tarantool and Tendermint.
- Ensure that all data is encrypted in transit, i.e. enforce using HTTPS for the HTTP API and the Websocket API. This can be done using NGINX or similar, as we do with the IPDB Testnet.

View File

@ -5,11 +5,11 @@ SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
Code is Apache-2.0 and docs are CC-BY-4.0
--->
# Set Up Planetmint, MongoDB and Tendermint
# Set Up Planetmint, Tarantool and Tendermint
We now install and configure software that must run
in every Planetmint node: Planetmint Server,
MongoDB and Tendermint.
Tarantool and Tendermint.
## Install Planetmint Server
@ -69,25 +69,21 @@ under `"wsserver"`:
where `bnode.example.com` should be replaced by your node's actual subdomain.
## Install (and Start) MongoDB
## Install (and Start) Tarantool
Install a recent version of MongoDB.
Install a recent version of Tarantool.
Planetmint Server requires version 3.4 or newer.
```
sudo apt install mongodb
curl -L https://tarantool.io/DDJLJzv/release/2.8/installer.sh | bash
sudo apt-get -y install tarantool
```
If you install MongoDB using the above command (which installs the `mongodb` package),
it also configures MongoDB, starts MongoDB (in the background),
and installs a MongoDB startup script
(so that MongoDB will be started automatically when the machine is restarted).
## Sharding with Tarantool
Note: The `mongodb` package is _not_ the official MongoDB package
from MongoDB the company. If you want to install the official MongoDB package,
please see
[the MongoDB documentation](https://docs.mongodb.com/manual/installation/).
Note that installing the official package _doesn't_ also start MongoDB.
If the load on a single node becomes to large Tarantool allows for sharding to scale horizontally.
For more information on how to setup sharding with Tarantool please refer to the [official Tarantool documentation](https://www.tarantool.io/en/doc/latest/reference/reference_rock/vshard/vshard_index/).
## Install Tendermint

View File

@ -11,8 +11,6 @@ There is some specialized terminology associated with Planetmint. To get started
## Planetmint Node
**Planetmint node** is a machine (or logical machine) running [Planetmint Server](https://docs.planetmint.com/projects/server/en/latest/introduction.html) and related software. Each node is controlled by one person or organization.
**Planetmint node** is a machine (or logical machine) running [Planetmint Server](https://docs.planetmint.io/projects/server/en/latest/introduction.html) and related software. Each node is controlled by one person or organization.
## Planetmint Network
@ -27,6 +25,10 @@ The people and organizations that run the nodes in a Planetmint network belong t
A Planetmint network is just a bunch of connected nodes. A consortium is an organization which has a Planetmint network, and where each node in that network has a different operator.
## Validators
A validator node is a Planetmint node that is a validator as it is defined for Tendermint (see [Tendermint Validator](https://docs.tendermint.com/master/nodes/validators.html)).
## Transactions
Are described in detail in `Planetmint Transactions Spec <https://github.com/planetmint/BEPs/tree/master/tx-specs/>`_ .
@ -78,7 +80,7 @@ You could do more elaborate things too. As one example, each time someone writes
### Role-Based Access Control (RBAC)
In September 2017, we published a [blog post about how one can define an RBAC sub-system on top of Planetmint](https://blog.planetmint.com/role-based-access-control-for-planetmint-assets-b7cada491997).
In September 2017, we published a [blog post about how one can define an RBAC sub-system on top of Planetmint](https://blog.bigchaindb.com/role-based-access-control-for-bigchaindb-assets-b7cada491997).
At the time of writing (January 2018), doing so required the use of a plugin, so it's not possible using standard Planetmint (which is what's available on the [IPDB Testnet](https://test.ipdb.io/>). That may change in the future.
If you're interested, `contact IPDB <contact@ipdb.global>`_.

View File

@ -25,18 +25,18 @@ Show the version number. `planetmint -v` does the same thing.
Generate a local configuration file (which can be used to set some or all [Planetmint node configuration settings](../node-setup/configuration)). It will ask you for the values of some configuration settings.
If you press Enter for a value, it will use the default value.
At this point, only one database backend is supported: `localmongodb`.
At this point, only one database backend is supported: `tarantool`.
If you use the `-c` command-line option, it will generate the file at the specified path:
```text
planetmint -c path/to/new_config.json configure localmongodb
planetmint -c path/to/new_config.json configure tarantool
```
If you don't use the `-c` command-line option, the file will be written to `$HOME/.planetmint` (the default location where Planetmint looks for a config file, if one isn't specified).
If you use the `-y` command-line option, then there won't be any interactive prompts: it will use the default values for all the configuration settings.
```text
planetmint -y configure localmongodb
planetmint -y configure tarantool
```
@ -47,13 +47,13 @@ Show the values of the [Planetmint node configuration settings](../node-setup/co
## planetmint init
Create a backend database (local MongoDB), all database tables/collections,
Create a backend database (local tarantool), all database tables/collections,
various backend database indexes, and the genesis block.
## planetmint drop
Drop (erase) the backend database (the local MongoDB database used by this node).
Drop (erase) the backend database (the local tarantool database used by this node).
You will be prompted to make sure.
If you want to force-drop the database (i.e. skipping the yes/no prompt), then use `planetmint -y drop`
@ -148,7 +148,7 @@ $ planetmint election new migration --private-key /home/user/.tendermint/config/
```
Concluded chain migration elections halt block production at whichever block height they are approved.
Afterwards, validators are supposed to upgrade Tendermint, set new `chain_id`, `app_hash`, and `validators` (to learn these values, use the [election show](election-show) command) in `genesis.json`, make and save a MongoDB dump, and restart the system.
Afterwards, validators are supposed to upgrade Tendermint, set new `chain_id`, `app_hash`, and `validators` (to learn these values, use the [election show](#election-show) command) in `genesis.json`, make and save a tarantool dump, and restart the system.
For more details about how chain migrations work, refer to [Type 3 scenarios in BEP-42](https://github.com/planetmint/BEPs/tree/master/42).

View File

@ -2,14 +2,14 @@
## General Tips
- Check the Planetmint, Tendermint and MongoDB logs.
- Check the Planetmint, Tendermint and Tarantool logs.
For help with that, see the page about [Logging and Log Rotation](../appendices/log-rotation).
- Try Googling the error message.
## Tendermint Tips
* [Configure Tendermint to create no empty blocks](https://tendermint.io/docs/tendermint-core/using-tendermint.html#no-empty-blocks).
* Store the Tendermint data on a fast drive. You can do that by changing [the location of TMHOME](https://tendermint.io/docs/tendermint-core/using-tendermint.html#directory-root) to be on the fast drive.
* [Configure Tendermint to create no empty blocks](https://tendermint.com/docs/tendermint-core/using-tendermint.html#no-empty-blocks).
* Store the Tendermint data on a fast drive. You can do that by changing [the location of TMHOME](https://tendermint.com/docs/tendermint-core/using-tendermint.html#directory-root) to be on the fast drive.
See the [Tendermint tips in the vrde/notes repository](https://github.com/vrde/notes/tree/master/tendermint).
@ -36,7 +36,7 @@ addr_book_strict = false
If you want to refresh your node back to a fresh empty state, then your best bet is to terminate it and deploy a new machine, but if that's not an option, then you can:
* drop the `planetmint` database in MongoDB using `planetmint drop` (but that only works if MongoDB is running)
* drop the `planetmint` database in tarantool using `planetmint drop` (but that only works if tarantool is running)
* reset Tendermint using `tendermint unsafe_reset_all`
* delete the directory `$HOME/.tendermint`

View File

@ -1,23 +0,0 @@
<!---
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
--->
# Integration test suite
This directory contains the integration test suite for Planetmint.
The suite uses Docker Compose to spin up multiple Planetmint nodes, run tests with `pytest` as well as cli tests and teardown.
## Running the tests
Run `make test-integration` in the project root directory.
By default the integration test suite spins up four planetmint nodes. If you desire to run a different configuration you can pass `SCALE=<number of nodes>` as an environmental variable.
## Writing and documenting the tests
Tests are sometimes difficult to read. For integration tests, we try to be really explicit on what the test is doing, so please write code that is *simple* and easy to understand. We decided to use literate-programming documentation. To generate the documentation for python tests run:
```bash
make docs-integration
```

View File

@ -1,47 +0,0 @@
#!/bin/bash
# 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
# Add chain migration test
check_status () {
status=$(ssh -o "StrictHostKeyChecking=no" -i \~/.ssh/id_rsa root@$1 'bash -s' < scripts/election.sh show_election $2 | tail -n 1)
status=${status#*=}
if [ $status != $3 ]; then
exit 1
fi
}
# Read host names from shared
readarray -t HOSTNAMES < /shared/hostnames
# Split into proposer and approvers
PROPOSER=${HOSTNAMES[0]}
APPROVERS=${HOSTNAMES[@]:1}
# Propose chain migration
result=$(ssh -o "StrictHostKeyChecking=no" -i \~/.ssh/id_rsa root@${PROPOSER} 'bash -s' < scripts/election.sh migrate)
# Check if election is ongoing and approve chain migration
for APPROVER in ${APPROVERS[@]}; do
# Check if election is still ongoing
check_status ${APPROVER} $result ongoing
ssh -o "StrictHostKeyChecking=no" -i ~/.ssh/id_rsa root@${APPROVER} 'bash -s' < scripts/election.sh approve $result
done
# Status of election should be concluded
status=$(ssh -o "StrictHostKeyChecking=no" -i \~/.ssh/id_rsa root@${PROPOSER} 'bash -s' < scripts/election.sh show_election $result)
status=${status#*INFO:planetmint.commands.planetmint:}
status=("$status[@]")
# TODO: Get status, chain_id, app_hash and validators to restore planetmint on all nodes
# References:
# https://github.com/bigchaindb/BEPs/tree/master/42
# http://docs.bigchaindb.com/en/latest/installation/node-setup/bigchaindb-cli.html
for word in $status; do
echo $word
done
echo ${status#*validators=}

View File

@ -1,33 +0,0 @@
#!/bin/bash
# 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
check_status () {
status=$(ssh -o "StrictHostKeyChecking=no" -i \~/.ssh/id_rsa root@$1 'bash -s' < scripts/election.sh show_election $2 | tail -n 1)
status=${status#*=}
if [ $status != $3 ]; then
exit 1
fi
}
# Read host names from shared
readarray -t HOSTNAMES < /shared/hostnames
# Split into proposer and approvers
PROPOSER=${HOSTNAMES[0]}
APPROVERS=${HOSTNAMES[@]:1}
# Propose validator upsert
result=$(ssh -o "StrictHostKeyChecking=no" -i \~/.ssh/id_rsa root@${PROPOSER} 'bash -s' < scripts/election.sh elect 2)
# Check if election is ongoing and approve validator upsert
for APPROVER in ${APPROVERS[@]}; do
# Check if election is still ongoing
check_status ${APPROVER} $result ongoing
ssh -o "StrictHostKeyChecking=no" -i ~/.ssh/id_rsa root@${APPROVER} 'bash -s' < scripts/election.sh approve $result
done
# Status of election should be concluded
check_status ${PROPOSER} $result concluded

View File

@ -1 +0,0 @@
docs

View File

@ -1,22 +0,0 @@
FROM python:3.9
RUN apt-get update \
&& pip install -U pip \
&& apt-get autoremove \
&& apt-get clean
RUN apt-get install -y vim
RUN apt-get update
RUN apt-get install -y build-essential cmake openssh-client openssh-server
RUN apt-get install -y zsh
RUN mkdir -p /src
RUN pip install --upgrade meson ninja
RUN pip install --upgrade \
pytest~=6.2.5 \
planetmint-driver~=0.9.0 \
pycco \
websocket-client~=0.47.0 \
#git+https://github.com/planetmint/cryptoconditions.git@gitzenroom \
#git+https://github.com/planetmint/planetmint-driver.git@gitzenroom \
blns

View File

@ -1,95 +0,0 @@
# 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
GENERATE_KEYPAIR = \
"""Rule input encoding base58
Rule output encoding base58
Scenario 'ecdh': Create the keypair
Given that I am known as 'Pippo'
When I create the ecdh key
When I create the testnet key
Then print data"""
# secret key to public key
SK_TO_PK = \
"""Rule input encoding base58
Rule output encoding base58
Scenario 'ecdh': Create the keypair
Given that I am known as '{}'
Given I have the 'keys'
When I create the ecdh public key
When I create the testnet address
Then print my 'ecdh public key'
Then print my 'testnet address'"""
FULFILL_SCRIPT = \
"""Rule input encoding base58
Rule output encoding base58
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' inside 'asset'
Given I have a 'signature' named 'data.signature' inside 'result'
When I verify the 'houses' has a signature in 'data.signature' by 'Alice'
Then print the string 'ok'"""
HOUSE_ASSETS = {
"data": {
"houses": [
{
"name": "Harry",
"team": "Gryffindor",
},
{
"name": "Draco",
"team": "Slytherin",
}
],
}
}
ZENROOM_DATA = {
'also': 'more data'
}
CONDITION_SCRIPT = """Rule input encoding base58
Rule output encoding base58
Scenario 'ecdh': create the signature of an object
Given I have the 'keys'
Given that I have a 'string dictionary' named 'houses' inside 'asset'
When I create the signature of 'houses'
When I rename the 'signature' to 'data.signature'
Then print the 'data.signature'"""
@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 HOUSE_ASSETS
@pytest.fixture
def zenroom_data():
return ZENROOM_DATA

View File

@ -1,36 +0,0 @@
# 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
from typing import List
from planetmint_driver import Planetmint
class Hosts:
hostnames = []
connections = []
def __init__(self, filepath):
self.set_hostnames(filepath=filepath)
self.set_connections()
def set_hostnames(self, filepath) -> None:
with open(filepath) as f:
self.hostnames = f.readlines()
def set_connections(self) -> None:
self.connections = list(map(lambda h: Planetmint(h), self.hostnames))
def get_connection(self, index=0) -> Planetmint:
return self.connections[index]
def get_transactions(self, tx_id) -> List:
return list(map(lambda connection: connection.transactions.retrieve(tx_id), self.connections))
def assert_transaction(self, tx_id) -> None:
txs = self.get_transactions(tx_id)
for tx in txs:
assert txs[0] == tx, \
'Cannot find transaction {}'.format(tx_id)

View File

@ -1,83 +0,0 @@
# 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 Planetmint and create object
from planetmint_driver.crypto import generate_keypair
# import helper to manage multiple nodes
from .helper.hosts import Hosts
import time
def test_basic():
# Setup up connection to Planetmint integration test nodes
hosts = Hosts('/shared/hostnames')
pm_alpha = hosts.get_connection()
# genarate a keypair
alice = generate_keypair()
# create a digital asset for Alice
game_boy_token = {
'data': {
'hash': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
'storageID': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
},
}
# prepare the transaction with the digital asset and issue 10 tokens to bob
prepared_creation_tx = pm_alpha.transactions.prepare(
operation='CREATE',
metadata={
'hash': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
'storageID': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', },
signers=alice.public_key,
recipients=[([alice.public_key], 10)],
asset=game_boy_token)
# fulfill and send the transaction
fulfilled_creation_tx = pm_alpha.transactions.fulfill(
prepared_creation_tx,
private_keys=alice.private_key)
pm_alpha.transactions.send_commit(fulfilled_creation_tx)
time.sleep(1)
creation_tx_id = fulfilled_creation_tx['id']
# Assert that transaction is stored on all planetmint nodes
hosts.assert_transaction(creation_tx_id)
# Transfer
# create the output and inout for the transaction
transfer_asset = {'id': creation_tx_id}
output_index = 0
output = fulfilled_creation_tx['outputs'][output_index]
transfer_input = {'fulfillment': output['condition']['details'],
'fulfills': {'output_index': output_index,
'transaction_id': transfer_asset['id']},
'owners_before': output['public_keys']}
# prepare the transaction and use 3 tokens
prepared_transfer_tx = pm_alpha.transactions.prepare(
operation='TRANSFER',
asset=transfer_asset,
inputs=transfer_input,
metadata={'hash': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
'storageID': '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', },
recipients=[([alice.public_key], 10)])
# fulfill and send the transaction
fulfilled_transfer_tx = pm_alpha.transactions.fulfill(
prepared_transfer_tx,
private_keys=alice.private_key)
sent_transfer_tx = pm_alpha.transactions.send_commit(fulfilled_transfer_tx)
time.sleep(1)
transfer_tx_id = sent_transfer_tx['id']
# Assert that transaction is stored on both planetmint nodes
hosts.assert_transaction(transfer_tx_id)

View File

@ -1,183 +0,0 @@
# 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
# # Divisible assets integration testing
# This test checks if we can successfully divide assets.
# The script tests various things like:
#
# - create a transaction with a divisible asset and issue them to someone
# - check if the transaction is stored and has the right amount of tokens
# - spend some tokens
# - try to spend more tokens than available
#
# We run a series of checks for each step, that is retrieving
# the transaction from the remote system, and also checking the `amount`
# of a given transaction.
#
# This integration test is a rip-off of our
# [tutorial](https://docs.planetmint.com/projects/py-driver/en/latest/usage.html).
# ## Imports
# We need the `pytest` package to catch the `BadRequest` exception properly.
# And of course, we also need the `BadRequest`.
import pytest
from planetmint_driver.exceptions import BadRequest
# Import generate_keypair to create actors
from planetmint_driver.crypto import generate_keypair
# import helper to manage multiple nodes
from .helper.hosts import Hosts
def test_divisible_assets():
# ## Set up a connection to Planetmint
# Check [test_basic.py](./test_basic.html) to get some more details
# about the endpoint.
hosts = Hosts('/shared/hostnames')
pm = hosts.get_connection()
# Oh look, it is Alice again and she brought her friend Bob along.
alice, bob = generate_keypair(), generate_keypair()
# ## Alice creates a time sharing token
# Alice wants to go on vacation, while Bobs bike just broke down.
# Alice decides to rent her bike to Bob while she is gone.
# So she prepares a `CREATE` transaction to issues 10 tokens.
# First, she prepares an asset for a time sharing token. As you can see in
# the description, Bob and Alice agree that each token can be used to ride
# the bike for one hour.
bike_token = {
'data': {
'token_for': {
'bike': {
'serial_number': 420420
}
},
'description': 'Time share token. Each token equals one hour of riding.',
},
}
# She prepares a `CREATE` transaction and issues 10 tokens.
# Here, Alice defines in a tuple that she wants to assign
# these 10 tokens to Bob.
prepared_token_tx = pm.transactions.prepare(
operation='CREATE',
signers=alice.public_key,
recipients=[([bob.public_key], 10)],
asset=bike_token)
# She fulfills and sends the transaction.
fulfilled_token_tx = pm.transactions.fulfill(
prepared_token_tx,
private_keys=alice.private_key)
pm.transactions.send_commit(fulfilled_token_tx)
# We store the `id` of the transaction to use it later on.
bike_token_id = fulfilled_token_tx['id']
# Let's check if the transaction was successful.
assert pm.transactions.retrieve(bike_token_id), \
'Cannot find transaction {}'.format(bike_token_id)
# Bob owns 10 tokens now.
assert pm.transactions.retrieve(bike_token_id)['outputs'][0][
'amount'] == '10'
# ## Bob wants to use the bike
# Now that Bob got the tokens and the sun is shining, he wants to get out
# with the bike for three hours.
# To use the bike he has to send the tokens back to Alice.
# To learn about the details of transferring a transaction check out
# [test_basic.py](./test_basic.html)
transfer_asset = {'id': bike_token_id}
output_index = 0
output = fulfilled_token_tx['outputs'][output_index]
transfer_input = {'fulfillment': output['condition']['details'],
'fulfills': {'output_index': output_index,
'transaction_id': fulfilled_token_tx[
'id']},
'owners_before': output['public_keys']}
# To use the tokens Bob has to reassign 7 tokens to himself and the
# amount he wants to use to Alice.
prepared_transfer_tx = pm.transactions.prepare(
operation='TRANSFER',
asset=transfer_asset,
inputs=transfer_input,
recipients=[([alice.public_key], 3), ([bob.public_key], 7)])
# He signs and sends the transaction.
fulfilled_transfer_tx = pm.transactions.fulfill(
prepared_transfer_tx,
private_keys=bob.private_key)
sent_transfer_tx = pm.transactions.send_commit(fulfilled_transfer_tx)
# First, Bob checks if the transaction was successful.
assert pm.transactions.retrieve(
fulfilled_transfer_tx['id']) == sent_transfer_tx
hosts.assert_transaction(fulfilled_transfer_tx['id'])
# There are two outputs in the transaction now.
# The first output shows that Alice got back 3 tokens...
assert pm.transactions.retrieve(
fulfilled_transfer_tx['id'])['outputs'][0]['amount'] == '3'
# ... while Bob still has 7 left.
assert pm.transactions.retrieve(
fulfilled_transfer_tx['id'])['outputs'][1]['amount'] == '7'
# ## Bob wants to ride the bike again
# It's been a week and Bob wants to right the bike again.
# Now he wants to ride for 8 hours, that's a lot Bob!
# He prepares the transaction again.
transfer_asset = {'id': bike_token_id}
# This time we need an `output_index` of 1, since we have two outputs
# in the `fulfilled_transfer_tx` we created before. The first output with
# index 0 is for Alice and the second output is for Bob.
# Since Bob wants to spend more of his tokens he has to provide the
# correct output with the correct amount of tokens.
output_index = 1
output = fulfilled_transfer_tx['outputs'][output_index]
transfer_input = {'fulfillment': output['condition']['details'],
'fulfills': {'output_index': output_index,
'transaction_id': fulfilled_transfer_tx['id']},
'owners_before': output['public_keys']}
# This time Bob only provides Alice in the `recipients` because he wants
# to spend all his tokens
prepared_transfer_tx = pm.transactions.prepare(
operation='TRANSFER',
asset=transfer_asset,
inputs=transfer_input,
recipients=[([alice.public_key], 8)])
fulfilled_transfer_tx = pm.transactions.fulfill(
prepared_transfer_tx,
private_keys=bob.private_key)
# Oh Bob, what have you done?! You tried to spend more tokens than you had.
# Remember Bob, last time you spent 3 tokens already,
# so you only have 7 left.
with pytest.raises(BadRequest) as error:
pm.transactions.send_commit(fulfilled_transfer_tx)
# Now Bob gets an error saying that the amount he wanted to spent is
# higher than the amount of tokens he has left.
assert error.value.args[0] == 400
message = 'Invalid transaction (AmountError): The amount used in the ' \
'inputs `7` needs to be same as the amount used in the ' \
'outputs `8`'
assert error.value.args[2]['message'] == message
# We have to stop this test now, I am sorry, but Bob is pretty upset
# about his mistake. See you next time :)

View File

@ -1,48 +0,0 @@
# 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
# # Double Spend testing
# This test challenge the system with double spends.
from uuid import uuid4
from threading import Thread
import queue
import planetmint_driver.exceptions
from planetmint_driver.crypto import generate_keypair
from .helper.hosts import Hosts
def test_double_create():
hosts = Hosts('/shared/hostnames')
pm = hosts.get_connection()
alice = generate_keypair()
results = queue.Queue()
tx = pm.transactions.fulfill(
pm.transactions.prepare(
operation='CREATE',
signers=alice.public_key,
asset={'data': {'uuid': str(uuid4())}}),
private_keys=alice.private_key)
def send_and_queue(tx):
try:
pm.transactions.send_commit(tx)
results.put('OK')
except planetmint_driver.exceptions.TransportError:
results.put('FAIL')
t1 = Thread(target=send_and_queue, args=(tx, ))
t2 = Thread(target=send_and_queue, args=(tx, ))
t1.start()
t2.start()
results = [results.get(timeout=2), results.get(timeout=2)]
assert results.count('OK') == 1
assert results.count('FAIL') == 1

View File

@ -1,133 +0,0 @@
# 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
# # Multisignature integration testing
# This test checks if we can successfully create and transfer a transaction
# with multiple owners.
# The script tests various things like:
#
# - create a transaction with multiple owners
# - check if the transaction is stored and has the right amount of public keys
# - transfer the transaction to a third person
#
# We run a series of checks for each step, that is retrieving
# the transaction from the remote system, and also checking the public keys
# of a given transaction.
#
# This integration test is a rip-off of our mutliple signature acceptance tests.
# # Imports
import time
# For this test case we need import and use the Python driver
from planetmint_driver.crypto import generate_keypair
# Import helper to deal with multiple nodes
from .helper.hosts import Hosts
def test_multiple_owners():
# Setup up connection to Planetmint integration test nodes
hosts = Hosts('/shared/hostnames')
pm_alpha = hosts.get_connection()
# Generate Keypairs for Alice and Bob!
alice, bob = generate_keypair(), generate_keypair()
# ## Alice and Bob create a transaction
# Alice and Bob just moved into a shared flat, no one can afford these
# high rents anymore. Bob suggests to get a dish washer for the
# kitchen. Alice agrees and here they go, creating the asset for their
# dish washer.
dw_asset = {
'data': {
'dish washer': {
'serial_number': 1337
}
}
}
# They prepare a `CREATE` transaction. To have multiple owners, both
# Bob and Alice need to be the recipients.
prepared_dw_tx = pm_alpha.transactions.prepare(
operation='CREATE',
signers=alice.public_key,
recipients=(alice.public_key, bob.public_key),
asset=dw_asset)
# Now they both sign the transaction by providing their private keys.
# And send it afterwards.
fulfilled_dw_tx = pm_alpha.transactions.fulfill(
prepared_dw_tx,
private_keys=[alice.private_key, bob.private_key])
pm_alpha.transactions.send_commit(fulfilled_dw_tx)
# We store the `id` of the transaction to use it later on.
dw_id = fulfilled_dw_tx['id']
time.sleep(1)
# Use hosts to assert that the transaction is properly propagated to every node
hosts.assert_transaction(dw_id)
# Let's check if the transaction was successful.
assert pm_alpha.transactions.retrieve(dw_id), \
'Cannot find transaction {}'.format(dw_id)
# The transaction should have two public keys in the outputs.
assert len(
pm_alpha.transactions.retrieve(dw_id)['outputs'][0]['public_keys']) == 2
# ## Alice and Bob transfer a transaction to Carol.
# Alice and Bob save a lot of money living together. They often go out
# for dinner and don't cook at home. But now they don't have any dishes to
# wash, so they decide to sell the dish washer to their friend Carol.
# Hey Carol, nice to meet you!
carol = generate_keypair()
# Alice and Bob prepare the transaction to transfer the dish washer to
# Carol.
transfer_asset = {'id': dw_id}
output_index = 0
output = fulfilled_dw_tx['outputs'][output_index]
transfer_input = {'fulfillment': output['condition']['details'],
'fulfills': {'output_index': output_index,
'transaction_id': fulfilled_dw_tx[
'id']},
'owners_before': output['public_keys']}
# Now they create the transaction...
prepared_transfer_tx = pm_alpha.transactions.prepare(
operation='TRANSFER',
asset=transfer_asset,
inputs=transfer_input,
recipients=carol.public_key)
# ... and sign it with their private keys, then send it.
fulfilled_transfer_tx = pm_alpha.transactions.fulfill(
prepared_transfer_tx,
private_keys=[alice.private_key, bob.private_key])
sent_transfer_tx = pm_alpha.transactions.send_commit(fulfilled_transfer_tx)
time.sleep(1)
# Now compare if both nodes returned the same transaction
hosts.assert_transaction(fulfilled_transfer_tx['id'])
# They check if the transaction was successful.
assert pm_alpha.transactions.retrieve(
fulfilled_transfer_tx['id']) == sent_transfer_tx
# The owners before should include both Alice and Bob.
assert len(
pm_alpha.transactions.retrieve(fulfilled_transfer_tx['id'])['inputs'][0][
'owners_before']) == 2
# While the new owner is Carol.
assert pm_alpha.transactions.retrieve(fulfilled_transfer_tx['id'])[
'outputs'][0]['public_keys'][0] == carol.public_key

View File

@ -1,100 +0,0 @@
# 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
# ## Testing potentially hazardous strings
# This test uses a library of `naughty` strings (code injections, weird unicode chars., etc.) as both keys and values.
# We look for either a successful tx, or in the case that we use a naughty string as a key, and it violates some key
# constraints, we expect to receive a well formatted error message.
# ## Imports
# Since the naughty strings get encoded and decoded in odd ways,
# we'll use a regex to sweep those details under the rug.
import re
# We'll use a nice library of naughty strings...
from blns import blns
# And parameterize our test so each one is treated as a separate test case
import pytest
# For this test case we import and use the Python Driver.
from planetmint_driver.crypto import generate_keypair
from planetmint_driver.exceptions import BadRequest
# import helper to manage multiple nodes
from .helper.hosts import Hosts
naughty_strings = blns.all()
# This is our base test case, but we'll reuse it to send naughty strings as both keys and values.
def send_naughty_tx(asset, metadata):
# ## Set up a connection to Planetmint
# Check [test_basic.py](./test_basic.html) to get some more details
# about the endpoint.
hosts = Hosts('/shared/hostnames')
pm = hosts.get_connection()
# Here's Alice.
alice = generate_keypair()
# Alice is in a naughty mood today, so she creates a tx with some naughty strings
prepared_transaction = pm.transactions.prepare(
operation='CREATE',
signers=alice.public_key,
asset=asset,
metadata=metadata)
# She fulfills the transaction
fulfilled_transaction = pm.transactions.fulfill(
prepared_transaction,
private_keys=alice.private_key)
# The fulfilled tx gets sent to the pm network
try:
sent_transaction = pm.transactions.send_commit(fulfilled_transaction)
except BadRequest as e:
sent_transaction = e
# If her key contained a '.', began with a '$', or contained a NUL character
regex = r'.*\..*|\$.*|.*\x00.*'
key = next(iter(metadata))
if re.match(regex, key):
# Then she expects a nicely formatted error code
status_code = sent_transaction.status_code
error = sent_transaction.error
regex = (
r'\{\s*\n*'
r'\s*"message":\s*"Invalid transaction \(ValidationError\):\s*'
r'Invalid key name.*The key name cannot contain characters.*\n*'
r'\s*"status":\s*400\n*'
r'\s*\}\n*')
assert status_code == 400
assert re.fullmatch(regex, error), sent_transaction
# Otherwise, she expects to see her transaction in the database
elif 'id' in sent_transaction.keys():
tx_id = sent_transaction['id']
assert pm.transactions.retrieve(tx_id)
# If neither condition was true, then something weird happened...
else:
raise TypeError(sent_transaction)
@pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings)
def test_naughty_keys(naughty_string):
asset = {'data': {naughty_string: 'nice_value'}}
metadata = {naughty_string: 'nice_value'}
send_naughty_tx(asset, metadata)
@pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings)
def test_naughty_values(naughty_string):
asset = {'data': {'nice_key': naughty_string}}
metadata = {'nice_key': naughty_string}
send_naughty_tx(asset, metadata)

View File

@ -1,131 +0,0 @@
# 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
# # Stream Acceptance Test
# This test checks if the event stream works correctly. The basic idea of this
# test is to generate some random **valid** transaction, send them to a
# Planetmint node, and expect those transactions to be returned by the valid
# transactions Stream API. During this test, two threads work together,
# sharing a queue to exchange events.
#
# - The *main thread* first creates and sends the transactions to Planetmint;
# then it run through all events in the shared queue to check if all
# transactions sent have been validated by Planetmint.
# - The *listen thread* listens to the events coming from Planetmint and puts
# them in a queue shared with the main thread.
import queue
import json
from threading import Thread, Event
from uuid import uuid4
# For this script, we need to set up a websocket connection, that's the reason
# we import the
# [websocket](https://github.com/websocket-client/websocket-client) module
from websocket import create_connection
from planetmint_driver.crypto import generate_keypair
# import helper to manage multiple nodes
from .helper.hosts import Hosts
def test_stream():
# ## Set up the test
# We use the env variable `BICHAINDB_ENDPOINT` to know where to connect.
# Check [test_basic.py](./test_basic.html) for more information.
hosts = Hosts('/shared/hostnames')
pm = hosts.get_connection()
# *That's pretty bad, but let's do like this for now.*
WS_ENDPOINT = 'ws://{}:9985/api/v1/streams/valid_transactions'.format(hosts.hostnames[0])
# Hello to Alice again, she is pretty active in those tests, good job
# Alice!
alice = generate_keypair()
# We need few variables to keep the state, specifically we need `sent` to
# keep track of all transactions Alice sent to Planetmint, while `received`
# are the transactions Planetmint validated and sent back to her.
sent = []
received = queue.Queue()
# In this test we use a websocket. The websocket must be started **before**
# sending transactions to Planetmint, otherwise we might lose some
# transactions. The `ws_ready` event is used to synchronize the main thread
# with the listen thread.
ws_ready = Event()
# ## Listening to events
# This is the function run by the complementary thread.
def listen():
# First we connect to the remote endpoint using the WebSocket protocol.
ws = create_connection(WS_ENDPOINT)
# After the connection has been set up, we can signal the main thread
# to proceed (continue reading, it should make sense in a second.)
ws_ready.set()
# It's time to consume all events coming from the Planetmint stream API.
# Every time a new event is received, it is put in the queue shared
# with the main thread.
while True:
result = ws.recv()
received.put(result)
# Put `listen` in a thread, and start it. Note that `listen` is a local
# function and it can access all variables in the enclosing function.
t = Thread(target=listen, daemon=True)
t.start()
# ## Pushing the transactions to Planetmint
# After starting the listen thread, we wait for it to connect, and then we
# proceed.
ws_ready.wait()
# Here we prepare, sign, and send ten different `CREATE` transactions. To
# make sure each transaction is different from the other, we generate a
# random `uuid`.
for _ in range(10):
tx = pm.transactions.fulfill(
pm.transactions.prepare(
operation='CREATE',
signers=alice.public_key,
asset={'data': {'uuid': str(uuid4())}}),
private_keys=alice.private_key)
# We don't want to wait for each transaction to be in a block. By using
# `async` mode, we make sure that the driver returns as soon as the
# transaction is pushed to the Planetmint API. Remember: we expect all
# transactions to be in the shared queue: this is a two phase test,
# first we send a bunch of transactions, then we check if they are
# valid (and, in this case, they should).
pm.transactions.send_async(tx)
# The `id` of every sent transaction is then stored in a list.
sent.append(tx['id'])
# ## Check the valid transactions coming from Planetmint
# Now we are ready to check if Planetmint did its job. A simple way to
# check if all sent transactions have been processed is to **remove** from
# `sent` the transactions we get from the *listen thread*. At one point in
# time, `sent` should be empty, and we exit the test.
while sent:
# To avoid waiting forever, we have an arbitrary timeout of 5
# seconds: it should be enough time for Planetmint to create
# blocks, in fact a new block is created every second. If we hit
# the timeout, then game over ¯\\\_(ツ)\_/¯
try:
event = received.get(timeout=5)
txid = json.loads(event)['transaction_id']
except queue.Empty:
assert False, 'Did not receive all expected transactions'
# Last thing is to try to remove the `txid` from the set of sent
# transactions. If this test is running in parallel with others, we
# might get a transaction id of another test, and `remove` can fail.
# It's OK if this happens.
try:
sent.remove(txid)
except ValueError:
pass

Some files were not shown because too many files have changed in this diff Show More