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

v2.3 Audit Fixes #441

Merged
merged 154 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
3813d32
Fix Global position read/write with new slot format
arjun-io Sep 4, 2024
7942ac3
write 0s for migration
arjun-io Sep 5, 2024
86e395d
add shim
kbrizzle Sep 6, 2024
d53fe24
add callback skip
kbrizzle Sep 8, 2024
8a4dd0c
add try/catch fix
kbrizzle Sep 9, 2024
02a40b9
add comment
arjun-io Sep 9, 2024
60a3e25
migration oracle returns timestamp
kbrizzle Sep 10, 2024
b5fa427
v2.3 Audit Fixes
arjun-io Sep 18, 2024
3dac8e7
add onlyOwner modifier on updateExtension
prateekdefi Sep 19, 2024
2fdcd35
update tests
prateekdefi Sep 19, 2024
70da23e
fix validateAndCancel
prateekdefi Sep 20, 2024
01e6c3b
Merge pull request #443 from equilibria-xyz/prateek/fix-update-extension
prateekdefi Sep 23, 2024
08bbe58
fix claim risk fee
prateekdefi Sep 23, 2024
fecfb8d
fix issue rebalancing empty markets
EdNoepel Sep 6, 2024
32da682
changed ratio to compare market to target, instead of target to market
EdNoepel Sep 11, 2024
7235f9b
add signer check in verifier contracts
prateekdefi Sep 23, 2024
b38f76b
created test POC
EdNoepel Sep 23, 2024
7eb9ac6
set market factory immutable
prateekdefi Sep 23, 2024
a7f274a
Merge branch 'ed/20-rebalance-0' into ed/84-donation-attack-1
EdNoepel Sep 23, 2024
3f0eaf5
prevent rebalance smaller than maxFee
EdNoepel Sep 23, 2024
49601cd
set market factory as immutable in verifier
prateekdefi Sep 24, 2024
60c4017
fix public immutable state
prateekdefi Sep 24, 2024
cad8dc5
fix tests
prateekdefi Sep 24, 2024
1eddd94
revert change to function type
EdNoepel Sep 24, 2024
24c72e4
created test demonstrating the issue
EdNoepel Sep 24, 2024
6d67bfd
update _authorized function to return whether signer is authorized
prateekdefi Sep 25, 2024
e31938f
fix verifier tests
prateekdefi Sep 25, 2024
18bec5d
fix verifier tests and setup for collateral account tests
prateekdefi Sep 25, 2024
9aa7e03
integrated Arjun's changes
EdNoepel Aug 30, 2024
5dc8ced
gas measurement for trigger orders
EdNoepel Aug 30, 2024
d11953a
keeperConfig for withdrawals
EdNoepel Aug 30, 2024
0db3380
measure gas spent in the TX
EdNoepel Aug 31, 2024
11cb05a
compare gas spent under test to DSU fee earned by keeper
EdNoepel Sep 4, 2024
3da24a7
handle multiple commitments
EdNoepel Sep 4, 2024
d7c99ba
remove logging
EdNoepel Sep 4, 2024
78365e5
add buffered keepConfig to trigger orders
EdNoepel Sep 4, 2024
20a7e97
moved collateral account keeper configs to initializer
EdNoepel Sep 25, 2024
c651ec4
prevent double-read of order needed for keep modifier
EdNoepel Sep 5, 2024
e6a2494
update test to reconcile fees against consumed gas
EdNoepel Sep 5, 2024
e4bed21
unrelated spelling correction
EdNoepel Sep 5, 2024
fe52414
fix collateral account tests
prateekdefi Sep 26, 2024
c6c0788
fix order tests
prateekdefi Sep 26, 2024
30a8c29
remove unused import
EdNoepel Sep 26, 2024
7faab93
fix nit
prateekdefi Sep 26, 2024
8b78dd3
prevent user from reducing maxFee
EdNoepel Sep 26, 2024
525ae49
fix integration tests
EdNoepel Sep 26, 2024
8e10e53
removed unused code
EdNoepel Sep 26, 2024
f97ce6f
bump root version
prateekdefi Sep 27, 2024
abea801
fix collateral account relay test
prateekdefi Sep 27, 2024
0489279
check given signer is approved as operator or signer
prateekdefi Sep 27, 2024
1f06afd
fix tests
prateekdefi Sep 27, 2024
bb47c89
fix unit tests
prateekdefi Sep 27, 2024
99cb41c
ensure deleted groups cannot be rebalanced
EdNoepel Sep 27, 2024
96169ce
unit test demonstrating problem
EdNoepel Sep 27, 2024
354a930
Merge pull request #449 from equilibria-xyz/prateek/fix-immutable-state
prateekdefi Sep 30, 2024
06e6a6c
Merge pull request #446 from equilibria-xyz/prateek/fix-claim-risk-fee
prateekdefi Sep 30, 2024
819439b
Merge branch 'v2.3-fix-review' into prateek/fix-verify-intent
prateekdefi Sep 30, 2024
5e69b8a
correct notional for closing position with pending order
EdNoepel Oct 1, 2024
30c8a49
transfer reward tokens to caller
prateekdefi Oct 1, 2024
6fb2320
Merge branch 'v2.3-fix-review' into ed/92-keeper-configs
EdNoepel Oct 1, 2024
eb86fc8
fix unwrapping of DSU to USDC
prateekdefi Oct 1, 2024
c5ef1cc
adjusted storage layout
EdNoepel Oct 1, 2024
d4493ae
fix tests
prateekdefi Oct 2, 2024
b04179b
add fee receiver to keeper oracle
prateekdefi Oct 2, 2024
78ea268
rename maxFeeAbsolute to maxLiquidationFeeMultiplier and remove liqui…
prateekdefi Oct 2, 2024
b7e1038
correct calculation of assets eligible for redemption to exclude pend…
EdNoepel Oct 2, 2024
c2b0549
fix test
prateekdefi Oct 3, 2024
f91aad2
add method to withdraw DSU collateral / fee from multi invoker and ma…
prateekdefi Oct 3, 2024
b8d428a
[Fix] Re-organize MarketFactory slots for upgrade compatibility
arjun-io Oct 3, 2024
bb1a029
Merge pull request #447 from equilibria-xyz/ed/20-rebalance-0
EdNoepel Oct 3, 2024
0709bc8
Merge pull request #450 from equilibria-xyz/ed/84-donation-attack-1
EdNoepel Oct 3, 2024
41ec629
Merge pull request #453 from equilibria-xyz/ed/79-frontrun-fee-c
EdNoepel Oct 3, 2024
75cccea
Merge pull request #457 from equilibria-xyz/ed/90-marketparameter-sto…
EdNoepel Oct 3, 2024
276d244
introduce maxStaleAfter
EdNoepel Oct 3, 2024
a1659b0
update other packages
EdNoepel Oct 3, 2024
2b43fc8
Merge branch 'v2.3-fix-review' into ed/92-keeper-configs
EdNoepel Oct 4, 2024
ab79f2e
Merge branch 'v2.3-fix-review' into ed/62-notional-position
EdNoepel Oct 4, 2024
4724818
cap maint and margin risk percentages at 1
EdNoepel Oct 4, 2024
0593cfa
removed an .only
EdNoepel Oct 4, 2024
6e77481
Merge pull request #451 from equilibria-xyz/ed/92-keeper-configs
EdNoepel Oct 4, 2024
0ae7be4
Merge branch 'v2.3-fix-review' into ed/62-notional-position
EdNoepel Oct 4, 2024
70389b8
Merge pull request #462 from equilibria-xyz/arjun/fix-market-factory-…
arjun-io Oct 4, 2024
3a11251
test demonstrating the issue
EdNoepel Oct 4, 2024
61d76a8
truncate before validation
EdNoepel Oct 4, 2024
0319e95
Merge pull request #454 from equilibria-xyz/britz-oracle-switchover-fix
kbrizzle Oct 6, 2024
418b783
Merge pull request #442 from equilibria-xyz/arjun/fix-position-global
arjun-io Oct 6, 2024
61d6646
add fix
kbrizzle Oct 7, 2024
800b2fa
Merge pull request #452 from equilibria-xyz/ed/89-unused-code
EdNoepel Oct 7, 2024
9ca7886
Merge pull request #460 from equilibria-xyz/ed/36-vault-redemption
EdNoepel Oct 7, 2024
e9eeb98
corrected comment
EdNoepel Oct 7, 2024
4d7aeb8
Merge pull request #463 from equilibria-xyz/ed/58-maxStaleAfter
EdNoepel Oct 7, 2024
61d6b3e
removed duplicated tests and corrected oracle updates
EdNoepel Oct 7, 2024
cf7ae15
Merge branch 'v2.3-fix-review' into prateek/fix-verify-intent
EdNoepel Oct 7, 2024
9071bd4
fix issue with relay tests
EdNoepel Oct 7, 2024
8e795c0
readability improvement
EdNoepel Oct 8, 2024
8c0b105
Merge pull request #464 from equilibria-xyz/ed/29-cap-margin-at-one
EdNoepel Oct 8, 2024
10e0cdd
Merge pull request #455 from equilibria-xyz/ed/62-notional-position
EdNoepel Oct 8, 2024
329265f
rename withdrawClaimable to claim per PR comment
EdNoepel Oct 8, 2024
768f321
fixed tests
EdNoepel Oct 8, 2024
a6161d9
send funds to msg.sender per PR comment
EdNoepel Oct 8, 2024
f43bbf9
move operator check to modifier per PR comment
EdNoepel Oct 8, 2024
fd84af9
don't escrow withdrawals, only fees
EdNoepel Oct 8, 2024
a23a45e
undid changes to CLAIM_FEE action per PR comments
EdNoepel Oct 8, 2024
2784521
updated MultiInvoker tests
EdNoepel Oct 8, 2024
7d042f7
Merge branch 'v2.3-fix-review' into prateek/pe-1740-fix-unwrapping
EdNoepel Oct 9, 2024
992237c
fix tests under coverage
EdNoepel Oct 9, 2024
4424431
Merge pull request #466 from equilibria-xyz/britz-fix-price-override-…
kbrizzle Oct 9, 2024
bb91a17
addressed PR concerns
EdNoepel Oct 9, 2024
cb76c65
test fix
EdNoepel Oct 9, 2024
07bcb84
Merge branch 'v2.3-fix-review' into prateek/pe-1746-fix-dsu-unwrap
EdNoepel Oct 9, 2024
528f394
unit test for non-1 DSU reserve reedemPrice
EdNoepel Oct 9, 2024
619f0bc
renamed to maxLiquidationFee
EdNoepel Oct 9, 2024
ca37f5c
updated test values to non-fixed amounts
EdNoepel Oct 9, 2024
43c6ea3
Merge pull request #465 from equilibria-xyz/ed/41-limit-truncation-a
EdNoepel Oct 9, 2024
61cc3d8
decrease liquidationFee to 32 bits
EdNoepel Oct 9, 2024
7e347ee
Merge branch 'v2.3-fix-review' into prateek/pe-1784-fix-liquidation-fee
EdNoepel Oct 9, 2024
47aa3c2
fix vault tests
EdNoepel Oct 9, 2024
18779c6
fix market unit test post-merge
EdNoepel Oct 10, 2024
f3e2781
add param
kbrizzle Oct 10, 2024
be1306c
update marketparameter in tests
kbrizzle Oct 10, 2024
4e960a4
reverted change in auth logic and related test changes
EdNoepel Oct 10, 2024
bdab7a3
add price deviation
kbrizzle Oct 10, 2024
cda5b3e
add invariant
kbrizzle Oct 10, 2024
b8b0d2c
Merge pull request #458 from equilibria-xyz/prateek/pe-1746-fix-dsu-u…
EdNoepel Oct 10, 2024
04888e2
corrected two unit tests
EdNoepel Oct 10, 2024
cb368a6
reverted unnecessary test changes
EdNoepel Oct 10, 2024
91d3cd0
corrected auth implementation
EdNoepel Oct 10, 2024
9e58893
removed unused error
EdNoepel Oct 10, 2024
d13892d
added verifier reject common tests to account and order packages
EdNoepel Oct 10, 2024
6dff40a
fix happy path integration test
EdNoepel Oct 10, 2024
03de6e6
Merge pull request #459 from equilibria-xyz/prateek/pe-1784-fix-liqui…
EdNoepel Oct 10, 2024
640fe2e
Merge pull request #461 from equilibria-xyz/prateek/pe-1740-fix-unwra…
EdNoepel Oct 10, 2024
dd578eb
Merge branch 'v2.3-fix-review' into prateek/fix-verify-intent
EdNoepel Oct 10, 2024
f55c199
removed unused code
EdNoepel Oct 10, 2024
e712453
resolve extension test failure
EdNoepel Oct 11, 2024
fb382da
fix test
kbrizzle Oct 11, 2024
fecc233
Merge pull request #469 from equilibria-xyz/ed/fix-extension-unit-tests
EdNoepel Oct 11, 2024
8eefc4e
Merge branch 'v2.3-fix-review' into prateek/fix-verify-intent
EdNoepel Oct 11, 2024
43df24e
removed unnecessary mocks
EdNoepel Oct 11, 2024
35d9612
Merge branch 'v2.3-fix-review' into prateek/fix-async-fee
EdNoepel Oct 11, 2024
f7c68dd
Merge pull request #444 from equilibria-xyz/prateek/fix-verify-intent
EdNoepel Oct 11, 2024
d43845f
address comments
kbrizzle Oct 11, 2024
0f824de
Merge pull request #468 from equilibria-xyz/britz-add-price-override-…
kbrizzle Oct 11, 2024
8d6edef
split out compensation checks for commit and settle
EdNoepel Oct 11, 2024
13851e5
Merge pull request #470 from equilibria-xyz/ed/async-fee-test
EdNoepel Oct 11, 2024
0660bd9
Merge pull request #456 from equilibria-xyz/prateek/fix-async-fee
arjun-io Oct 11, 2024
4d8105e
improved natspec
EdNoepel Oct 12, 2024
7031e00
update risk parameter storage layout documentation
prateekdefi Oct 14, 2024
c7b3c22
Rename Verifier's market factory interface
arjun-io Oct 15, 2024
86ee6d9
added unit test
EdNoepel Oct 15, 2024
ad25506
Fix test
arjun-io Oct 15, 2024
fad3502
Merge pull request #473 from equilibria-xyz/arjun/rename-interface
arjun-io Oct 15, 2024
580a592
Merge pull request #474 from equilibria-xyz/ed/79-empty-order-overwrite
EdNoepel Oct 15, 2024
520e5b9
Merge pull request #471 from equilibria-xyz/prateek/pe-1688-documenta…
arjun-io Oct 16, 2024
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
29 changes: 14 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ on:
pull_request:
branches:
- main
- v2.1
- v2.1.1
- v2.2
- v2.3
- v2.3-fix-review
workflow_dispatch:

env:
Expand Down Expand Up @@ -513,12 +511,13 @@ jobs:
with:
name: verifier_unit_test_coverage
path: ./packages/perennial-verifier/coverage/lcov.info

# [PERIPHERY UNIT COVERAGE]
periphery-unit-test-coverage:
name: 'Periphery Unit Tests Coverage'
runs-on: ubuntu-latest
needs: [account-unit-test, oracle-unit-test, order-unit-test, vault-unit-test, extensions-unit-test, verifier-unit-test]
needs:
[account-unit-test, oracle-unit-test, order-unit-test, vault-unit-test, extensions-unit-test, verifier-unit-test]
steps:
- uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -558,10 +557,10 @@ jobs:
run: sudo apt-get update && sudo apt-get install lcov
- name: Combine unit test coverage
run: lcov -a account_unit_test_coverage/lcov.info
-a oracle_unit_test_coverage/lcov.info
-a order_unit_test_coverage/lcov.info
-a vault_unit_test_coverage/lcov.info
-a extensions_unit_test_coverage/lcov.info
-a oracle_unit_test_coverage/lcov.info
-a order_unit_test_coverage/lcov.info
-a vault_unit_test_coverage/lcov.info
-a extensions_unit_test_coverage/lcov.info
-a verifier_unit_test_coverage/lcov.info
--output-file periphery_unit_coverage.info
- name: Upload combined unit test lcov file
Expand Down Expand Up @@ -629,12 +628,12 @@ jobs:
- name: Install lcov
run: sudo apt-get update && sudo apt-get install lcov
- name: Combine integration test coverage
run: lcov -a account_integration_test_coverage/lcov.info
-a oracle_integration_test_coverage/lcov.info
-a oracle_sepolia_integration_test_coverage/lcov.info
-a order_integration_test_coverage/lcov.info
-a vault_integration_test_coverage/lcov.info
-a extensions_integration_test_coverage/lcov.info
run: lcov -a account_integration_test_coverage/lcov.info
-a oracle_integration_test_coverage/lcov.info
-a oracle_sepolia_integration_test_coverage/lcov.info
-a order_integration_test_coverage/lcov.info
-a vault_integration_test_coverage/lcov.info
-a extensions_integration_test_coverage/lcov.info
--output-file periphery_integration_coverage.info
- name: Upload combined integration test lcov file
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"devDependencies": {
"@codechecks/client": "^0.1.10",
"@defi-wonderland/smock": "^2.0.7",
"@equilibria/root": "2.3.0-rc7",
"@equilibria/root": "2.3.0-rc8",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@nomicfoundation/hardhat-toolbox": "2.0.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/common/testutil/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export interface MarketParameter {
riskFee: BigNumberish
maxPendingGlobal: number
maxPendingLocal: number
maxPriceDeviation: BigNumberish
closed: boolean
settle: boolean
}
Expand Down Expand Up @@ -356,6 +357,7 @@ export const DEFAULT_MARKET_PARAMETER: MarketParameter = {
riskFee: 0,
maxPendingGlobal: 0,
maxPendingLocal: 0,
maxPriceDeviation: 0,
closed: false,
settle: false,
}
Expand Down
16 changes: 15 additions & 1 deletion packages/perennial-account/contracts/AccountVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity 0.8.24;
import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import { VerifierBase } from "@equilibria/root/verifier/VerifierBase.sol";
import { IMarketFactory } from "@equilibria/perennial-v2/contracts/interfaces/IMarketFactory.sol";

import { IAccountVerifier } from "./interfaces/IAccountVerifier.sol";
import { IRelayVerifier } from "./interfaces/IRelayVerifier.sol"; // only needed for docstrings
Expand All @@ -21,8 +22,13 @@ import { RelayedAccessUpdateBatch, RelayedAccessUpdateBatchLib } from "./types/R
/// @title Verifier
/// @notice ERC712 signed message verifier for the Perennial V2 Collateral Accounts package.
contract AccountVerifier is VerifierBase, IAccountVerifier {
/// @dev market factory to check authorization
IMarketFactory internal immutable marketFactory;

/// @dev Initializes the domain separator and parameter caches
constructor() EIP712("Perennial V2 Collateral Accounts", "1.0.0") { }
constructor(IMarketFactory _marketFactory) EIP712("Perennial V2 Collateral Accounts", "1.0.0") {
marketFactory = _marketFactory;
}

/// @inheritdoc IAccountVerifier
function verifyAction(Action calldata action, bytes calldata signature)
Expand Down Expand Up @@ -148,4 +154,12 @@ contract AccountVerifier is VerifierBase, IAccountVerifier {
outerSignature
)) revert VerifierInvalidSignerError();
}

/// @notice Checks whether signer is allowed to sign a message for account
/// @param account user to check authorization for (not the collateral account)
/// @param signer address which signed a message for the account
/// @return true if signer is authorized, otherwise false
function _authorized(address account, address signer) internal view override returns (bool) {
return super._authorized(account, signer) || marketFactory.signers(account, signer);
}
}
30 changes: 13 additions & 17 deletions packages/perennial-account/contracts/Controller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ contract Controller is Factory, IController {
uint256 constant MAX_MARKETS_PER_GROUP = 4;

/// @dev USDC stablecoin address
Token6 public USDC; // solhint-disable-line var-name-mixedcase
Token6 public immutable USDC; // solhint-disable-line var-name-mixedcase

/// @dev DSU address
Token18 public DSU; // solhint-disable-line var-name-mixedcase
Token18 public immutable DSU; // solhint-disable-line var-name-mixedcase

/// @inheritdoc IController
IMarketFactory public marketFactory;
IMarketFactory public immutable marketFactory;

/// @inheritdoc IController
IAccountVerifier public verifier;
Expand All @@ -59,18 +59,17 @@ contract Controller is Factory, IController {

/// @dev Creates instance of Controller
/// @param implementation_ Collateral account contract initialized with stablecoin addresses
constructor(address implementation_) Factory(implementation_) {
constructor(address implementation_, IMarketFactory marketFactory_) Factory(implementation_) {
USDC = Account(implementation_).USDC();
DSU = Account(implementation_).DSU();
marketFactory = marketFactory_;
}

/// @inheritdoc IController
function initialize(
IMarketFactory marketFactory_,
IAccountVerifier verifier_
) external initializer(1) {
__Factory__initialize();
marketFactory = marketFactory_;
verifier = verifier_;
}

Expand Down Expand Up @@ -104,10 +103,17 @@ contract Controller is Factory, IController {
IMarket market = groupToMarkets[owner][group][i];
RebalanceConfig memory marketRebalanceConfig = _rebalanceConfigs[owner][group][address(market)];
(bool canMarketRebalance, Fixed6 imbalance) =
RebalanceLib.checkMarket(marketRebalanceConfig, groupCollateral, actualCollateral[i]);
RebalanceLib.checkMarket(
marketRebalanceConfig,
groupToMaxRebalanceFee[owner][group],
groupCollateral,
actualCollateral[i]
);
imbalances[i] = imbalance;
canRebalance = canRebalance || canMarketRebalance;
}

// if group does not exist or was deleted, arrays will be empty and function will return (0, false, 0)
}

/// @inheritdoc IController
Expand Down Expand Up @@ -163,8 +169,6 @@ contract Controller is Factory, IController {
function _changeRebalanceConfigWithSignature(RebalanceConfigChange calldata configChange, bytes calldata signature) internal {
// ensure the message was signed by the owner or a delegated signer
verifier.verifyRebalanceConfigChange(configChange, signature);
_ensureValidSigner(configChange.action.common.account, configChange.action.common.signer);

// sum of the target allocations of all markets in the group
_updateRebalanceGroup(configChange, configChange.action.common.account);
}
Expand All @@ -174,18 +178,12 @@ contract Controller is Factory, IController {
emit AccountDeployed(owner, account);
}

/// @dev reverts if user is not authorized to sign transactions for the owner
function _ensureValidSigner(address owner, address signer) internal view {
if (signer != owner && !marketFactory.signers(owner, signer)) revert ControllerInvalidSignerError();
}

function _deployAccountWithSignature(
DeployAccount calldata deployAccount_,
bytes calldata signature
) internal returns (IAccount account) {
address owner = deployAccount_.action.common.account;
verifier.verifyDeployAccount(deployAccount_, signature);
_ensureValidSigner(owner, deployAccount_.action.common.signer);

// create the account
account = _createAccount(owner);
Expand All @@ -198,7 +196,6 @@ contract Controller is Factory, IController {
) internal {
// ensure the message was signed by the owner or a delegated signer
verifier.verifyMarketTransfer(marketTransfer, signature);
_ensureValidSigner(marketTransfer.action.common.account, marketTransfer.action.common.signer);

// only Markets with DSU collateral are supported
IMarket market = IMarket(marketTransfer.market);
Expand All @@ -214,7 +211,6 @@ contract Controller is Factory, IController {
) internal {
// ensure the message was signed by the owner or a delegated signer
verifier.verifyWithdrawal(withdrawal, signature);
_ensureValidSigner(withdrawal.action.common.account, withdrawal.action.common.signer);

// call the account's implementation to push to owner
account.withdraw(withdrawal.amount, withdrawal.unwrap);
Expand Down
11 changes: 8 additions & 3 deletions packages/perennial-account/contracts/Controller_Arbitrum.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@ pragma solidity 0.8.24;
import { Kept_Arbitrum, Kept } from "@equilibria/root/attribute/Kept/Kept_Arbitrum.sol";
import { UFixed18 } from "@equilibria/root/number/types/UFixed18.sol";
import { IVerifierBase } from "@equilibria/root/verifier/interfaces/IVerifierBase.sol";
import { IMarketFactory } from "@equilibria/perennial-v2/contracts/interfaces/IMarketFactory.sol";
import { Controller_Incentivized } from "./Controller_Incentivized.sol";

/// @title Controller_Arbitrum
/// @notice Controller which compensates keepers for handling or relaying messages on Arbitrum L2.
contract Controller_Arbitrum is Controller_Incentivized, Kept_Arbitrum {
/// @dev Creates instance of Controller which compensates keepers
/// @param implementation Pristine collateral account contract
/// @param keepConfig Configuration used to compensate keepers
constructor(address implementation, KeepConfig memory keepConfig, IVerifierBase nonceManager)
Controller_Incentivized(implementation, keepConfig, nonceManager) {}
/// @param marketFactory Market Factory contract
/// @param nonceManager Verifier contract to which nonce and group cancellations are relayed
constructor(
address implementation,
IMarketFactory marketFactory,
IVerifierBase nonceManager
) Controller_Incentivized(implementation, marketFactory, nonceManager) {}

/// @dev Use the Kept_Arbitrum implementation for calculating the dynamic fee
function _calldataFee(
Expand Down
Loading
Loading