Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove "invalid_reason" from the vote model? #217

Closed
ttmc opened this issue Apr 23, 2016 · 6 comments
Closed

Remove "invalid_reason" from the vote model? #217

ttmc opened this issue Apr 23, 2016 · 6 comments
Assignees
Labels

Comments

@ttmc
Copy link
Contributor

ttmc commented Apr 23, 2016

The vote model (documented at http://bigchaindb.readthedocs.org/en/master/models.html#the-vote-model ) for the vote-on-a-block includes an "invalid_reason":

"invalid_reason": "<None|DOUBLE_SPEND|TRANSACTIONS_HASH_MISMATCH|NODES_PUBKEYS_MISMATCH",

but a block may contain several invalid transactions, each one invalid for a different reason, therefore it doesn't make sense to give only one reason for voting that a block is invalid.

A node stops looking at the transactions in a block once it encounters the first invalid transaction, so it doesn't even know if there are other invalid transactions in the block, or why they are invalid.

Alternatives to removing "invalid_reason":

  • rename it "first_invalid_reason"
  • replace it with "first_invalid_transaction_id" (but don't store the reason; anyone else can check the transaction to figure out the reason)

I prefer the latter option: replacing "invalid_reason" with "first_invalid_transaction".

@r-marques
Copy link
Contributor

I also like the option of of first_invalid_transaction.
Another solution would be to just removed that field for now since we are not using it.

@diminator
Copy link
Contributor

or one could provide a set or dict of reasons is there are multiple?

could be:

"invalid_reason": {
    "DOUBLE_SPEND": <count>/[<txid>], 
    "TRANSACTIONS_HASH_MISMATCH": <count>/[<txid>],
    ...
}

@r-marques
Copy link
Contributor

Right now the transaction validation raises an exception at the first invalid condition so we don't have multiple reasons (this also increases performance). I guess that the txid would be enough for other nodes to just run he validator and find out what was wrong with the transaction.

@r-marques
Copy link
Contributor

Since @libscott has been working on simplifying the models and adding schema validation now would be a good time to just remove it.
We can re-add it later if we have a use for it

@ttmc
Copy link
Contributor Author

ttmc commented Mar 13, 2018

BigchainDB 2.0 works differently from BigchainDB 1.3 and earlier.

Invalid blocks are no longer a thing in BigchainDB 2.0. There is no need for a reason to be given for a block being invalid, since there is no block being invalid.

@isaacwalkercox
Copy link

isaacwalkercox commented Aug 20, 2021

or one could provide a set or dict of reasons is there are multiple?

could be:

"invalid_reason": {
    "DOUBLE_SPEND": <count>/[<txid>], 
    "TRANSACTIONS_HASH_MISMATCH": <count>/[<txid>],
    ...
}

I realy like this option but if you are going to do that why not make it clearer with a tx id/reason keypair instead:
"invalid_reasons": [{ "TXID": "", "reason": "<MISMATCH_HASH,DOUBLESPEND ETC.>"}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants