diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-01-24 17:30:03 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 13:50:02 +0800 |
commit | 9c331f6344b3353a5b585472090f76297d049122 (patch) | |
tree | a337db051382ee0ded7acb02c771833bf0702405 /.mailmap | |
parent | 3c5b9bab464f5527cb3c25b5681e1d43b96a3d9d (diff) | |
download | dexon-9c331f6344b3353a5b585472090f76297d049122.tar dexon-9c331f6344b3353a5b585472090f76297d049122.tar.gz dexon-9c331f6344b3353a5b585472090f76297d049122.tar.bz2 dexon-9c331f6344b3353a5b585472090f76297d049122.tar.lz dexon-9c331f6344b3353a5b585472090f76297d049122.tar.xz dexon-9c331f6344b3353a5b585472090f76297d049122.tar.zst dexon-9c331f6344b3353a5b585472090f76297d049122.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 '.mailmap')
0 files changed, 0 insertions, 0 deletions