dev-protocol/protocol-v2

[BUG] Incorrect IArbSys.sendTxToL1 call

Closed this issue · 0 comments

aggre commented

Problem subject

  • Contract

Description

IArbSys.sendTxToL1 is called from bridgeBurn and is executed with the first argument as the user's address.

Correctly, its first argument should be the address of the Dev contract on L1.

function bridgeBurn(address _account, uint256 _amount) external override {
uint256 insufficient = bridgeBalanceOnL1 < _amount
? _amount - bridgeBalanceOnL1
: 0;
burn(_account, _amount);
emit BridgeBurn(_account, _amount);
if (insufficient > 0) {
_mintL1(_account, insufficient);
}
uint256 tmp = insufficient > 0 ? bridgeBalanceOnL1 : _amount;
bridgeBalanceOnL1 = bridgeBalanceOnL1 - tmp;
}
function _mintL1(address _to, uint256 _amount) private {
bytes memory data = abi.encodeWithSignature(
"escrowMint(uint256)",
_amount
);
// Use Arbitrum's messaging system to execute L1Token.escrowMint
address arbSys = registry().registries("ArbSys");
uint256 id = IArbSys(arbSys).sendTxToL1(_to, data);
address l1DevAddress = registry().registries("L1DevAddress");
emit L1EscrowMint(l1DevAddress, id, _amount);
emit TxToL1(address(this), _to, id, data);
}

Expected behavior/contents

It must pass the return value of registry().registries("L1DevAddress") as the first argument.

function _mintL1(address _to, uint256 _amount) private {
  bytes memory data = abi.encodeWithSignature(
	  "escrowMint(uint256)",
	  _amount
  );
  // Use Arbitrum's messaging system to execute L1Token.escrowMint
  address arbSys = registry().registries("ArbSys");
  address l1DevAddress = registry().registries("L1DevAddress");
  uint256 id = IArbSys(arbSys).sendTxToL1(l1DevAddress, data);
  emit L1EscrowMint(l1DevAddress, id, _amount);
  emit TxToL1(address(this), _to, id, data);
}

Code of Conduct

  • I agree to follow this project's Code of Conduct