Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BridgeManager] Fix admin cannot interact with proxy register #270

Merged
merged 8 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import { IBridgeManagerCallbackRegister } from "../../interfaces/bridge/IBridgeManagerCallbackRegister.sol";
import { IBridgeManagerCallback } from "../../interfaces/bridge/IBridgeManagerCallback.sol";
import { IdentityGuard } from "../../utils/IdentityGuard.sol";
import { TransparentUpgradeableProxyV2, IdentityGuard } from "../../utils/IdentityGuard.sol";

/**
* @title BridgeManagerCallbackRegister
Expand Down Expand Up @@ -107,19 +107,23 @@ abstract contract BridgeManagerCallbackRegister is IdentityGuard, IBridgeManager
uint256 length = registers.length;
if (length == 0) return;

bool[] memory statuses = new bool[](length);
bool[] memory successes = new bool[](length);
bytes[] memory returnDatas = new bytes[](length);
bytes memory callData = abi.encodePacked(callbackFnSig, inputs);
bytes memory proxyCallData = abi.encodeCall(TransparentUpgradeableProxyV2.functionDelegateCall, (callData));

for (uint256 i; i < length; ) {
(statuses[i], returnDatas[i]) = registers[i].call(callData);
(successes[i], returnDatas[i]) = registers[i].call(callData);
if (!successes[i]) {
(successes[i], returnDatas[i]) = registers[i].call(proxyCallData);
}
TuDo1403 marked this conversation as resolved.
Show resolved Hide resolved

unchecked {
++i;
}
}

emit Notified(callData, registers, statuses, returnDatas);
emit Notified(callData, registers, successes, returnDatas);
}

/**
Expand Down
1 change: 1 addition & 0 deletions contracts/ronin/gateway/BridgeReward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ contract BridgeReward is IBridgeReward, BridgeTrackingHelper, HasContracts, RONT

/**
* @inheritdoc IBridgeReward
* @notice call with {TransparentUpgradeableProxyV2.functionDelegateCall}
*/
function setRewardPerPeriod(uint256 rewardPerPeriod) external onlyContract(ContractType.BRIDGE_MANAGER) {
_setRewardPerPeriod(rewardPerPeriod);
Expand Down
8 changes: 4 additions & 4 deletions logs/contract_code_sizes.log
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
············································|···························|·················
| LibTUint256Slot · 0.044 · │
············································|···························|·················
| MainchainBridgeManager · 18.550 · │
| MainchainBridgeManager · 18.818 · │
············································|···························|·················
| MainchainGatewayV2 · 17.699 · │
············································|···························|·················
Expand All @@ -71,7 +71,7 @@
············································|···························|·················
| MockBridge · 1.232 · │
············································|···························|·················
| MockBridgeManager · 10.163 · │
| MockBridgeManager · 10.432 · │
············································|···························|·················
| MockBridgeReward · 6.368 · │
············································|···························|·················
Expand Down Expand Up @@ -103,7 +103,7 @@
············································|···························|·················
| MockPrecompile · 3.794 · │
············································|···························|·················
| MockRoninBridgeManager · 23.646 · │
| MockRoninBridgeManager · 23.914 · │
············································|···························|·················
| MockRoninGatewayV2Extended · 20.397 · │
············································|···························|·················
Expand Down Expand Up @@ -131,7 +131,7 @@
············································|···························|·················
| ProxyAdmin · 1.604 · │
············································|···························|·················
| RoninBridgeManager · 23.646 · │
| RoninBridgeManager · 23.914 · │
············································|···························|·················
| RoninGatewayV2 · 20.090 · │
············································|···························|·················
Expand Down