Solution: Stop getting events from the Tendermint events API. Get the
event right before returning from the COMMIT phase of Tendermint, and
publish it to the events queue.
* Problem: `ValidatorElection` and `MigrationElection` need to inherit from a common `Election` class
Solution: Factored the common logic out of `ValidatorElection` and moved it to `Election` parent class
* Problem: Adding base58 as a requirement seems to break the build...
Solution: Reverting the changes
* Problem: Responding to a suggestion for improved method naming
Solution: Refactored `get_result_by_election_id` to `get_election_result_by_id`
* Problem: No need to store different types of elections in their own tables
Solution: Remove `DB_TABLE` property from `Election` class
* Revert "Problem: No need to store different types of elections in their own tables"
This reverts commit db45374d3c690429d18a25bcc319f8056c016500.
* Problem: Missed a method in `Bigchain` class when updating the naming for an election method
Solution: Finished the refactoring
* Problem: Need a table to store data for all elections
Solution: Created the `elections` table with secondary_index `election_id`
* Problem: `Election` class needs to be updated to store concluded elections in the `elections` table
Solution: Updated the class to use the new table
* Problem: `UpsertValidatorVote` can be generalized to just be `Vote`
Solution: Renamed, refactored and moved the `Vote` class to tie in with the more general `Election` base class
* Problem: Error in docstring return signature
Solution: Fixed the docstring
* Problem: Hardcoded reference to the `VOTE_TYPE` in `Election` base class
Solution: Pointed the reference to the class variable
* Problem: Schema still refers to `ValidatorElectionVote` instead of `Vote`
Solution: Renamed `TX_SCHEMA_VALIDATOR_ELECTION_VOTE` as `TX_SCHEMA_VOTE`
* Problem: `Election` class variable `ELECTION_TYPE` is overly specific
Solution: Renamed `ELECTION_TYPE` to `OPERATION`
* Problem: Command line options for `upsert-validator` can be generalized to manage any type of election
Solution: Refactored the CLI to manage generalized elections
* Problem: Default for `show_election` not implemented for `Election` class
Solution: Create a default method that work if all fields in the 'asset[data]' can be displayed without additional formatting
* Problem: Multiple small issues with style etc.
Solution: Addressed comments from PR
* Problem: `Election` class variable to `VOTE_TYPE` unnecessary
Solution: Removed the variable and hardcoded everything to use the `Vote` class
* Problem: Minor style issues with PR
Solution: Addressing comments
* Problem: Changes to format for validator keys broke some tests
Solution: Aligned the tests to reflect the changed key format
* Problem: `election show` command displaying the base56 public key
Solution: Cast any public key to base64
* Problem: `election_parser` help message still refers to upsert-validator
Solution: Updated the help message
* Log rotation for tendermint and BigchainDB using Monit
* Change file size from 100KB used for testing to 200 MB for test envs
* Add docs for log rotation
* remove --consensus.create_empty_blocks from monit start
Because already taken care of in the config file
* do not run bigchaindb with debug flag instead use config file
* Address comments I
- Rephrase log rotation to imply monit is not default
- Add statement to explain where bigchaindb log files are created
- Fix HTML comment
- Add log rotation to index
* Address comments II
* Problem: `ValidatorElection` and `MigrationElection` need to inherit from a common `Election` class.
Solution: Factored the common logic out of `ValidatorElection` and moved it to `Election` parent class.
* Problem: No need to store different types of elections in their own tables
Solution: Remove `DB_TABLE` property from `Election` class.
Solution: Created the `elections` table with secondary_index `election_id`.
* Problem: `UpsertValidatorVote` can be generalized to just be `Vote`
Solution: Renamed, refactored and moved the `Vote` class to tie in with the more general `Election` base class.
* Problem: `election_id` is not unique if two elections have the same properties.
Solution: Added a random `uuid4` seed to enforce uniqueness.
Solution: Change the docs to recommend installing a specific Tendermint version.
Also update our release process so we change that version number before a release, if necessary.
* Problem: we have unused and outdated fixtures
Solution: clean up fixtures and tests accordingly
* Problem: there are still unused fixtures
Solution: remove Merlin keys
* Problem: There are unnecessary markers
Solution: remove the tendermint marker for tests
* Problem: The commit mode behaves incorrectly.
Solution: Parse the Tendermint response properly. The functionality was disabled in https://github.com/bigchaindb/bigchaindb/pull/2235/files#diff-c6511560546a7dc577e7e647b5bfdaceL68 and was not fixed since then.
* Add a test case for the sync mode.
* Do not strictly expect deliver_tx in the response.
* Fix post_mock in web/test_transactions.py.
* Check for the error field first.
Solution: Document when the transactions posted in the async and sync modes can be lost. Describe how they are stored. Mention that BigchainDB does not store or expose rejected transactions.
The information on that page was either wrong or redundant, so I either deleted it or linked to where to find the same information in the docs about contributing to BigchainDB.
* Problem: No good way to check for val set absence.
Solution: Make get_validator_set/get_validators return None/[] when there are no validators yet.
* Problem: Incompatible ABCI chain upgrades.
Solution: Record known chains and sync through InitChain. Triggering the migration and adjusting other ABCI endpoints will follow.
Solution: Election ID has to be unique but not every validator set record has it. MongoDB does not support partial indexes, does not even allow for multiple Nones. This is a temporary fix since we are introducing an `election` collection to store election IDs in #2498.
* Problem: cyrptoconditions dependency updated because of vulnerability CVE-2018-10903
* update cc to ~=0.7.2
* Fix test using b58encode
* Fixing some more tests failing because of base58 update
Solution: Remove un-necessary code. Deployment of MongoDB with or without replicaSet should be the responsibility of MongoDB admin which can and cannot be a BigchainDB node operator. As far as BigchainDB is concerned replicaset, if provided in bigchaindb configs, should be used to establish connection with MongoDB.
* Problem: We need to store the `election_id` as part of the `validator_update` so we can efficiently check which election was resposible for the change
Solution: Added the parameter to `store_validator_set` and aligned the tests
* Problem: Logic for `upsert-validator show` is convoluted
Solution: Rewrote the function to be much simpler
* Problem: Need a uniqueness constraint for election_id wrt validator changes
Solution: Added a new key to the db schema
Solution: BigchainDB by default writes logs in the same directory it is
run. The `looponfail` feature provided by pytest waits for changes in
the current directory, so it is continuously triggered. This patch tells
pytest to only watch the `bigchaindb` and `tests` directories.
Solution: if a TRANSFER transaction is validated after a CREATE
transaction, the system crashes with `AttributeError: 'NoneType' object
has no attribute 'txid'`.
This happens because querying `get_spent` checks the attributes `txid`
and `output` of `input.fulfills` for every transaction in the current
buffer (`current_transactions`). For a CREATE, `input.fulfills` is None,
so the check would fail.
The solution is to check if `input.fulfills` is defined. If not, then
the current transaction cannot spend any output, so we can safely skip
it.
Solution: Transfer vote to the election public key; generalize implemenation to handle election txn type
* Problem: Upsert valdiator 'new' doesn't accept public in base64 format
Solution: Tendermint stores all keys in base64 format so it would suitable to
abandon base58 encoding in favour of base64 encoding
* Problem: Not test for invalid execution of upsert-validator 'new'
Solution: Write tests to when invalid power or private key path has been supplied
* Problem: Exceptions are not informational when executing upsert-validator
Solution: generate error logs or print statement indicating success
Solution: have a more general approach to process transaction types. If
a transaction does *not* contain `asset.id`, then the `id` of the
`asset` is the `id` of the transaction.
* Problem: `run_upsert_validator_approve` was getting the voting power in a convoluted way
Solution: Changed it to get the voting power from the election outputs
* Problem: `run_upsert_validator_approve` casts votes for *all* voters, not just the user calling the command
Solution: Filter vote txs by the users public key
* Problem: Docs needed a more specific description of how to input the path to the private-key file
Solution: Changed the wording a bit
* Problem: several tests are skipped
Solution: activate or remove tests
* Problem: store_transaction is deprecated
Solution: replace it with store_bulk_transaction
* Problem: we don't test the transaction split
Solution: undelete `test_store_transaction`
* Problem: failing tests
Solution: merge master and change deprecated store_transaction
* Problem: tests in test_bigchain_api are not activated
Solution: remove or active tests
* Problem: TransactionNotInValidBlock was removed
Solution: remove TransactionNotInValidBlock from tests
* Problem: Config settings docs missing some configs & inconsistent
Solution: Document some undocumented config settings and make the config settings docs page more consistent
* Problem: No docs about how config setting env var name determined
Solution: Explain and show the relationship between the config-file name and the environment variable name of config settings