wamp-proto / wamp-xbr

The XBR Protocol - blockchain protocol for decentralized open data markets
https://xbr.network
Other
11 stars 16 forks source link

Block number restriction can be problematic #108

Open om26er opened 4 years ago

om26er commented 4 years ago

Currently we don't allow a signature to be older than 5 blocks, this can be problematic and is easy to reproduce.

We just need to create send 5 onboarding requests using different email/username and verify in a FIFO order and we'll be hit by that code path https://github.com/crossbario/xbr-protocol/blob/06b5b9b7e324f783683a071031af59382539c0af/contracts/XBRNetwork.sol#L121

oberstet commented 4 years ago

Ganache (not mainnet stacks like geth) creates a new block for each and every blockchain transaction, so a limit of 5 blocks hits particularily quick.

The average number of transactions per block on ethereum mainnet is much larger:

The average bloc time is ~15s currently https://bitinfocharts.com/comparison/confirmationtime-eth-sma7.html

So 6 hours is ~1440 blocks, which might be a more reasonable value for the limit

oberstet commented 4 years ago

also, this limit should be defined centrally

public constant uint256 XBRTypes.PRESIGNED_TXN_MAX_AGE = 1440;
oberstet commented 4 years ago

^ it should either be a constant, or there should be a maintainer-only setter or XBRNetwork

oberstet commented 4 years ago

fixed in https://github.com/crossbario/xbr-protocol/pull/112

oberstet commented 4 years ago

no, not yet competely fixed: above PR makes this a parameter, but I had to leave it for now at "4", as there is an issue specific to the CI (when the blockchain has only a few blocks at all) ..