Skip to content

Commit

Permalink
forgot to emit first MinGasPrice event (#134)
Browse files Browse the repository at this point in the history
* forgot to emit first MinGasPrice event

* test for UtxoId
  • Loading branch information
johannbarbie authored Jan 31, 2019
1 parent 0210d76 commit 00dc4cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions contracts/ExitHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ contract ExitHandler is DepositHandler {
initialize(_bridge);
exitDuration = _exitDuration;
exitStake = _exitStake;
emit MinGasPrice(0);
}

function setExitStake(uint256 _exitStake) public ifAdmin {
Expand Down
4 changes: 4 additions & 0 deletions contracts/mocks/TxMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ contract TxMock {
return TxLib.getSigHash(_txData);
}

function getUtxoId(uint256 _outputIndex, bytes32 _txHash) public pure returns (bytes32) {
return bytes32(uint256(_outputIndex) << 120 | uint120(uint256(_txHash)));
}

function flattenInput(TxLib.Input memory _input, uint256 _offset, bytes32[] memory _rsp) internal pure {
_rsp[_offset] = bytes32(_input.outpoint.hash);
_rsp[_offset + 1] = bytes32(uint256(_input.outpoint.pos));
Expand Down
3 changes: 3 additions & 0 deletions test/txLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ contract('TxLib', (accounts) => {

const rsp = await txLib.parse(proof).should.be.fulfilled;
checkParse(rsp, transfer);
const outpoint = transfer.inputs[0].prevout;
const utxoId = await txLib.getUtxoId(outpoint.index, `0x${outpoint.hash.toString('hex')}`);
assert.equal(utxoId, outpoint.getUtxoId());
});

it('should parse 2 inputs and 2 outputs', async () => {
Expand Down

0 comments on commit 00dc4cf

Please sign in to comment.