Skip to content

Commit b858c96

Browse files
authored
Merge the develop branch to the master branch, preparation to v5.6.0-rc0
2 parents 835742d + 24e73c3 commit b858c96

File tree

24 files changed

+204
-81
lines changed

24 files changed

+204
-81
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ jobs:
8080
steps:
8181
- uses: actions/checkout@v2
8282
- if: startsWith(github.ref, 'refs/tags')
83-
run: echo "::set-env name=DOCKER_TAGS::${GITHUB_REF#refs/tags/},latest"
83+
run: echo "DOCKER_TAGS=${GITHUB_REF#refs/tags/},latest" >> $GITHUB_ENV
8484
- if: startsWith(github.ref, 'refs/heads')
85-
run: echo "::set-env name=DOCKER_TAGS::${GITHUB_REF#refs/heads/}-${GITHUB_SHA::8}"
85+
run: echo "DOCKER_TAGS=${GITHUB_REF#refs/heads/}-${GITHUB_SHA::8}" >> $GITHUB_ENV
8686
- uses: docker/build-push-action@v1
8787
with:
8888
username: ${{ secrets.DOCKER_USERNAME }}

contracts/libraries/ArbitraryMessage.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ library ArbitraryMessage {
4848
gasLimit := and(shr(64, blob), 0xffffffff)
4949

5050
dataType := byte(26, blob)
51-
if gt(dataType, 0) {
52-
// for now, only 0 datatype is supported - regular AMB calls
51+
if gt(and(dataType, 0x7f), 0) {
52+
// for now, only 0x00 and 0x80 datatypes are supported - regular AMB calls
5353
// other dataType values are kept reserved for future use
5454
revert(0, 0)
5555
}

contracts/mocks/AMBMock.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ contract AMBMock {
4646
}
4747

4848
function requireToConfirmMessage(address _contract, bytes _data, uint256 _gas) external returns (bytes32) {
49-
return _sendMessage(_contract, _data, _gas, 0xf0);
49+
return _sendMessage(_contract, _data, _gas, 0x80);
5050
}
5151

5252
function _sendMessage(address _contract, bytes _data, uint256 _gas, uint256 _dataType) internal returns (bytes32) {
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
pragma solidity 0.4.24;
22

3-
import "../upgradeability/EternalStorage.sol";
4-
5-
contract ReentrancyGuard is EternalStorage {
6-
bytes32 internal constant LOCK = 0x6168652c307c1e813ca11cfb3a601f1cf3b22452021a5052d8b05f1f1f8a3e92; // keccak256(abi.encodePacked("lock"))
7-
8-
function lock() internal returns (bool) {
9-
return boolStorage[LOCK];
3+
contract ReentrancyGuard {
4+
function lock() internal returns (bool res) {
5+
assembly {
6+
// Even though this is not the same as boolStorage[keccak256(abi.encodePacked("lock"))],
7+
// since solidity mapping introduces another level of addressing, such slot change is safe
8+
// for temporary variables which are cleared at the end of the call execution.
9+
res := sload(0x6168652c307c1e813ca11cfb3a601f1cf3b22452021a5052d8b05f1f1f8a3e92) // keccak256(abi.encodePacked("lock"))
10+
}
1011
}
1112

1213
function setLock(bool _lock) internal {
13-
boolStorage[LOCK] = _lock;
14+
assembly {
15+
// Even though this is not the same as boolStorage[keccak256(abi.encodePacked("lock"))],
16+
// since solidity mapping introduces another level of addressing, such slot change is safe
17+
// for temporary variables which are cleared at the end of the call execution.
18+
sstore(0x6168652c307c1e813ca11cfb3a601f1cf3b22452021a5052d8b05f1f1f8a3e92, _lock) // keccak256(abi.encodePacked("lock"))
19+
}
1420
}
1521
}

contracts/upgradeable_contracts/TokenBridgeMediator.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import "./TransferInfoStorage.sol";
1010
*/
1111
contract TokenBridgeMediator is BasicAMBMediator, BasicTokenBridge, TransferInfoStorage {
1212
event FailedMessageFixed(bytes32 indexed messageId, address recipient, uint256 value);
13+
event TokensBridgingInitiated(address indexed sender, uint256 value, bytes32 indexed messageId);
1314
event TokensBridged(address indexed recipient, uint256 value, bytes32 indexed messageId);
1415

1516
/**
@@ -32,6 +33,8 @@ contract TokenBridgeMediator is BasicAMBMediator, BasicTokenBridge, TransferInfo
3233

3334
setMessageValue(_messageId, _value);
3435
setMessageRecipient(_messageId, _from);
36+
37+
emit TokensBridgingInitiated(_from, _value, _messageId);
3538
}
3639

3740
/**

contracts/upgradeable_contracts/amb_erc20_to_native/BasicAMBErc20ToNative.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ contract BasicAMBErc20ToNative is Initializable, Upgradeable, Claimable, Version
5050
* @return patch value of the version
5151
*/
5252
function getBridgeInterfacesVersion() external pure returns (uint64 major, uint64 minor, uint64 patch) {
53-
return (1, 1, 1);
53+
return (1, 2, 0);
5454
}
5555

5656
/**

contracts/upgradeable_contracts/amb_erc677_to_erc677/BasicAMBErc677ToErc677.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ contract BasicAMBErc677ToErc677 is
9696
}
9797

9898
function getBridgeInterfacesVersion() external pure returns (uint64 major, uint64 minor, uint64 patch) {
99-
return (1, 3, 0);
99+
return (1, 4, 0);
100100
}
101101

102102
function getBridgeMode() external pure returns (bytes4 _data) {

contracts/upgradeable_contracts/amb_erc677_to_erc677/BasicStakeTokenMediator.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import "./BasicAMBErc677ToErc677.sol";
44

55
contract BasicStakeTokenMediator is BasicAMBErc677ToErc677 {
66
function getBridgeInterfacesVersion() external pure returns (uint64 major, uint64 minor, uint64 patch) {
7-
return (1, 2, 0);
7+
return (1, 3, 0);
88
}
99

1010
function getBridgeMode() external pure returns (bytes4 _data) {

contracts/upgradeable_contracts/amb_native_to_erc20/BasicAMBNativeToErc20.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ contract BasicAMBNativeToErc20 is
6161
* @return patch value of the version
6262
*/
6363
function getBridgeInterfacesVersion() external pure returns (uint64 major, uint64 minor, uint64 patch) {
64-
return (1, 1, 0);
64+
return (1, 2, 0);
6565
}
6666

6767
/**

contracts/upgradeable_contracts/arbitrary_message/BasicHomeAMB.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ contract BasicHomeAMB is BasicAMB, MessageDelivery {
1515
uint256 NumberOfCollectedSignatures
1616
);
1717

18-
uint256 internal constant SEND_TO_MANUAL_LANE = 0xf0;
18+
uint256 internal constant SEND_TO_MANUAL_LANE = 0x80;
1919

2020
function executeAffirmation(bytes message) external onlyValidator {
2121
bytes32 hashMsg = keccak256(abi.encodePacked(message));

0 commit comments

Comments
 (0)