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

Fix Typo, Add Address Validation, Remove Redundant ERC20 Deposit #106

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions bindings/BalanceTracker.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions script/deploy/l1/tests/TestDeposits.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ import {L1ERC721Bridge} from "@eth-optimism-bedrock/src/L1/L1ERC721Bridge.sol";
contract DeployTestContracts is Script {
function run(
address _tester,
address payable _l1StandardBirdge,
address payable _l1StandardBridge,
address _l1erc721Bridge,
address payable _l1erc20,
address _l1erc721,
address _l2erc20,
address _l2erc721
) public {
vm.startBroadcast(_tester);
ERC20PresetMinterPauser(_l1erc20).approve(_l1StandardBirdge, 1_000_000 ether);
ERC20PresetMinterPauser(_l1erc20).approve(_l1StandardBridge, 1_000_000 ether);
ERC721PresetMinterPauserAutoId(_l1erc721).approve(_l1erc721Bridge, 0);

console.log("Approvals to bridge contracts complete");

L1StandardBridge(_l1StandardBirdge).depositERC20(_l1erc20, _l2erc20, 1_000_000 ether, 200_000, bytes(""));
L1StandardBridge(_l1StandardBridge).depositERC20(_l1erc20, _l2erc20, 1_000_000 ether, 200_000, bytes(""));

console.log("L1StandardBridge erc20 deposit complete");

Expand Down
4 changes: 2 additions & 2 deletions script/universal/MultisigBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ abstract contract MultisigBase is CommonBase {
bytes32 hash = _getTransactionHash(_safe, data);
_signatures = Signatures.prepareSignatures(_safe, hash, _signatures);

bytes memory simData = _execTransationCalldata(_safe, data, _signatures);
bytes memory simData = _execTransactionCalldata(_safe, data, _signatures);
Simulation.logSimulationLink({_to: _safe, _from: msg.sender, _data: simData});

vm.startStateDiffRecording();
Expand Down Expand Up @@ -142,7 +142,7 @@ abstract contract MultisigBase is CommonBase {
});
}

function _execTransationCalldata(address _safe, bytes memory _data, bytes memory _signatures)
function _execTransactionCalldata(address _safe, bytes memory _data, bytes memory _signatures)
internal
pure
returns (bytes memory)
Expand Down
2 changes: 1 addition & 1 deletion script/universal/MultisigBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ abstract contract MultisigBuilder is MultisigBase {

Simulation.StateOverride[] memory overrides = _overrides(_safe);

bytes memory txData = _execTransationCalldata(_safe, data, Signatures.genPrevalidatedSignature(msg.sender));
bytes memory txData = _execTransactionCalldata(_safe, data, Signatures.genPrevalidatedSignature(msg.sender));
Simulation.logSimulationLink({_to: _safe, _data: txData, _from: msg.sender, _overrides: overrides});

// Forge simulation of the data logged in the link. If the simulation fails
Expand Down
6 changes: 3 additions & 3 deletions script/universal/NestedMultisigBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ abstract contract NestedMultisigBuilder is MultisigBase {
* Step 1.1 (optional)
* ======
* Verify the signatures generated from step 1 are valid.
* This allow transactions to be pre-signed and stored safely before execution.
* This allows transactions to be pre-signed and stored safely before execution.
*/
function verify(address _signerSafe, bytes memory _signatures) public view {
IMulticall3.Call3[] memory nestedCalls = _buildCalls();
Expand Down Expand Up @@ -202,13 +202,13 @@ abstract contract NestedMultisigBuilder is MultisigBase {
)
)
);
bytes memory approveHashExec = _execTransationCalldata(
bytes memory approveHashExec = _execTransactionCalldata(
_signerSafe, approveHashData, Signatures.genPrevalidatedSignature(MULTICALL3_ADDRESS)
);
calls[0] = IMulticall3.Call3({target: _signerSafe, allowFailure: false, callData: approveHashExec});

// simulate the final state changes tx, so that signer can verify the final results
bytes memory finalExec = _execTransationCalldata(_safe, _data, Signatures.genPrevalidatedSignature(_signerSafe));
bytes memory finalExec = _execTransactionCalldata(_safe, _data, Signatures.genPrevalidatedSignature(_signerSafe));
calls[1] = IMulticall3.Call3({target: _safe, allowFailure: false, callData: finalExec});

return calls;
Expand Down
2 changes: 1 addition & 1 deletion script/universal/Signatures.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ library Signatures {
* @param dataHash Hash that is signed.
* @param threshold Number of signatures required to approve the transaction.
* @param dynamicOffset Offset to add to the `s` value of any EIP-1271 signature.
* Can be used to accomodate any additional signatures prepended to the array.
* Can be used to accommodate any additional signatures prepended to the array.
* If prevalidated signatures were prepended, this should be the length of those signatures.
*/
function sortUniqueSignatures(bytes memory _signatures, bytes32 dataHash, uint256 threshold, uint256 dynamicOffset)
Expand Down
8 changes: 4 additions & 4 deletions src/Challenger1of2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ contract Challenger1of2 {
CONSTANTS
//////////////////////////////////////////////////////////////*/
/**
* @dev The address of Optimism's signer (likely a multisig)
* @dev The address of Optimism's signer (likely a multi-signature wallet)
*/
address public immutable OP_SIGNER;

/**
* @dev The address of counter party's signer (likely a multisig)
* @dev The address of the counterparty's signer (likely a multi-signature wallet)
*/
address public immutable OTHER_SIGNER;

Expand All @@ -48,7 +48,7 @@ contract Challenger1of2 {
/**
* @dev Constructor to set the values of the constants.
* @param _opSigner Address of Optimism signer.
* @param _otherSigner Address of counter party signer.
* @param _otherSigner Address of counterparty signer.
* @param _l2OutputOracleProxy Address of the L2OutputOracleProxy contract.
*/
constructor(address _opSigner, address _otherSigner, address _l2OutputOracleProxy) {
Expand All @@ -66,7 +66,7 @@ contract Challenger1of2 {
//////////////////////////////////////////////////////////////*/
/**
* @dev Executes a call as the Challenger (must be called by
* Optimism or counter party signer).
* Optimism or counterparty signer).
* @param _data Data for function call.
*/
function execute(bytes memory _data) external {
Expand Down
2 changes: 1 addition & 1 deletion src/fee-vault-fixes/FeeVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.15;

/// @title FeeVault
/// @notice The FeeVault contract is intended to:
/// 1. Be upgraded to by the Base FeeVault contracts
/// 1. Be upgraded by the Base FeeVault contracts
/// 2. Set `totalProcessed` to the correct value
/// 3. Be upgraded from to back to Optimism's FeeVault
contract FeeVault {
Expand Down
18 changes: 9 additions & 9 deletions src/revenue-share/BalanceTracker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ contract BalanceTracker is ReentrancyGuardUpgradeable {
external
reinitializer(2)
{
uint256 systemAddresesLength = _systemAddresses.length;
require(systemAddresesLength > 0, "BalanceTracker: systemAddresses cannot have a length of zero");
uint256 systemAddressesLength = _systemAddresses.length;
require(systemAddressesLength > 0, "BalanceTracker: systemAddresses cannot have a length of zero");
require(
systemAddresesLength <= MAX_SYSTEM_ADDRESS_COUNT,
systemAddressesLength <= MAX_SYSTEM_ADDRESS_COUNT,
"BalanceTracker: systemAddresses cannot have a length greater than 20"
);
require(
systemAddresesLength == _targetBalances.length,
systemAddressesLength == _targetBalances.length,
"BalanceTracker: systemAddresses and targetBalances length must be equal"
);
for (uint256 i; i < systemAddresesLength;) {
for (uint256 i; i < systemAddressesLength;) {
require(_systemAddresses[i] != address(0), "BalanceTracker: systemAddresses cannot contain address(0)");
require(_targetBalances[i] > 0, "BalanceTracker: targetBalances cannot contain 0 target");
unchecked {
Expand All @@ -125,10 +125,10 @@ contract BalanceTracker is ReentrancyGuardUpgradeable {
*
*/
function processFees() external nonReentrant {
uint256 systemAddresesLength = systemAddresses.length;
require(systemAddresesLength > 0, "BalanceTracker: systemAddresses cannot have a length of zero");
// Refills balances of systems addresses up to their target balances
for (uint256 i; i < systemAddresesLength;) {
uint256 systemAddressesLength = systemAddresses.length;
require(systemAddressesLength > 0, "BalanceTracker: systemAddresses cannot have a length of zero");
// Refills balances of system addresses up to their target balances
for (uint256 i; i < systemAddressesLength;) {
refillBalanceIfNeeded(systemAddresses[i], targetBalances[i]);
unchecked {
i++;
Expand Down
2 changes: 1 addition & 1 deletion src/revenue-share/FeeDisburser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ contract FeeDisburser {
uint256 public lastDisbursementTime;
/**
* @dev Tracks aggregate net fee revenue which is the sum of sequencer and base fees.
* @dev Explicity tracking Net Revenue is required to seperate L1FeeVault initiated
* @dev Explicitly tracking Net Revenue is required to separate L1FeeVault initiated
* withdrawals from Net Revenue calculations.
*/
uint256 public netFeeRevenue;
Expand Down