From 162b5084e2788599e3e01e315a75d015db79ae5a Mon Sep 17 00:00:00 2001 From: Andrew Redden Date: Mon, 9 Oct 2023 16:35:42 -0300 Subject: [PATCH] clean up encodeWithAccountCounter interface --- src/originators/Originator.sol | 4 ++-- test/StarPortTest.sol | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/originators/Originator.sol b/src/originators/Originator.sol index d865e736..c4965c9d 100644 --- a/src/originators/Originator.sol +++ b/src/originators/Originator.sol @@ -176,7 +176,7 @@ abstract contract Originator is Ownable { } // Encode the data with the account's nonce for generating a signature - function encodeWithAccountCounter(address account, bytes32 contextHash) + function encodeWithAccountCounter(bytes32 contextHash) public view virtual @@ -214,7 +214,7 @@ abstract contract Originator is Ownable { function _validateOffer(Request calldata request, Details memory details) internal virtual { bytes32 contextHash = keccak256(request.details); _validateSignature( - keccak256(encodeWithAccountCounter(strategist, keccak256(request.details))), request.approval + keccak256(encodeWithAccountCounter(keccak256(request.details))), request.approval ); if (request.custodian != details.custodian) { revert InvalidCustodian(); diff --git a/test/StarPortTest.sol b/test/StarPortTest.sol index a1d14edd..d4488d60 100644 --- a/test/StarPortTest.sol +++ b/test/StarPortTest.sol @@ -227,7 +227,7 @@ contract StarPortTest is BaseOrderTest { bool isTrusted = loanData.caveats.length == 0; { bytes32 detailsHash = - keccak256(originator.encodeWithAccountCounter(strategist.addr, keccak256(loanData.details))); + keccak256(originator.encodeWithAccountCounter(keccak256(loanData.details))); (uint8 v, bytes32 r, bytes32 s) = vm.sign(strategist.key, detailsHash); LoanManager.Loan memory loan = LoanManager.Loan({ custodian: address(loanData.custodian), @@ -262,7 +262,7 @@ contract StarPortTest is BaseOrderTest { ConsiderationItem[] storage collateral ) internal { (uint8 v, bytes32 r, bytes32 s) = vm.sign( - strategist.key, keccak256(originator.encodeWithAccountCounter(strategist.addr, keccak256(loanData.details))) + strategist.key, keccak256(originator.encodeWithAccountCounter(keccak256(loanData.details))) ); LoanManager.Loan memory loan = LoanManager.Loan({