aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-01-24 17:30:03 +0800
committerGitHub <noreply@github.com>2019-01-24 17:30:03 +0800
commit0bb42a73d6e38f590cc61bf13a5cb9882c4ef6d8 (patch)
tree82b94b329aa17942ea223e762a870d82ee95ef1a /p2p
parentb643af7bc592979e177ee56284e5de7125416593 (diff)
downloaddexon-0bb42a73d6e38f590cc61bf13a5cb9882c4ef6d8.tar
dexon-0bb42a73d6e38f590cc61bf13a5cb9882c4ef6d8.tar.gz
dexon-0bb42a73d6e38f590cc61bf13a5cb9882c4ef6d8.tar.bz2
dexon-0bb42a73d6e38f590cc61bf13a5cb9882c4ef6d8.tar.lz
dexon-0bb42a73d6e38f590cc61bf13a5cb9882c4ef6d8.tar.xz
dexon-0bb42a73d6e38f590cc61bf13a5cb9882c4ef6d8.tar.zst
dexon-0bb42a73d6e38f590cc61bf13a5cb9882c4ef6d8.zip
core: vm: modify randomness calculation algorithm (#173)
The original algorithm used for calculating algorithm is vulnerable to cross context re-entry attack. Example as follows: contract B { event Value(uint256 value); uint256 public value; function call() public { value = rand; emit Value(value); } } contract A { function randTwice(address bAddr) public { B b = B(bAddr); b.call.gas(100000)(); b.call.gas(100000)(); } } The two `b.call` will result in the same randomness value. This commit fix the issue by recording a called index used to store how many times opRand is called, and use it as argument to the Keccak call.
Diffstat (limited to 'p2p')
0 files changed, 0 insertions, 0 deletions