steemit / steem-js

Steem.js the official JavaScript library for Steem blockchain
https://www.npmjs.com/package/steem
MIT License
472 stars 225 forks source link

Tx TaPoS handling #144

Open roadscape opened 7 years ago

roadscape commented 7 years ago

Currently, ref_block_num and ref_block_prefix are set to the head block.

This could cause transactions to "silently disappear" if the head block is on a fork. On the STEEM chain, it's pretty rare but occasionally there is a microfork (from a double-producing node, or maybe network latency).

One could use last_irreversible_block, but there are theoretical attacks whose window of opportunity closes the closer you get to head_block. A good compromise could be head_block_num - 3.

This way, if someone submits e.g. a vote when the head_block is on a micro fork (of depth 1), TaPoS won't be invalidated when the node switches back to the main chain.

jcalfee commented 7 years ago

What is a theoretical attack using last_irreversible_block?

theoreticalbts commented 7 years ago

See https://github.com/steemit/steem/issues/1144