Skip to content

Commit

Permalink
✨(Identity) Add OID address to execute signature
Browse files Browse the repository at this point in the history
Also run linter
  • Loading branch information
Nakasar committed Oct 11, 2024
1 parent e8838b3 commit 67dcff0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 17 deletions.
2 changes: 1 addition & 1 deletion contracts/Identity.sol
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ contract Identity is Storage, IIdentity, Version {

function recoverSignerForExecution(address _to, uint256 _value, bytes memory _data, uint256 _keyType, uint8 v, bytes32 r, bytes32 s) internal delegatedOnly view returns(bytes32 keyHash) {

Check failure on line 628 in contracts/Identity.sol

View workflow job for this annotation

GitHub Actions / Lint (16.x)

Line length must be no more than 130 but current length is 191

Check failure on line 628 in contracts/Identity.sol

View workflow job for this annotation

GitHub Actions / Lint (16.x)

'recoverSignerForExecution' should start with _
if (_keyType == 1) {
bytes32 dataHash = keccak256(abi.encode(_to, _value, _data));
bytes32 dataHash = keccak256(abi.encode(address(this), _to, _value, _data));
bytes32 prefixedHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", dataHash));
address recovered = ecrecover(prefixedHash, v, r, s);

Expand Down
19 changes: 17 additions & 2 deletions contracts/interface/IERC734.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ interface IERC734 {
* Triggers on execution successful Event: `Executed`
* Triggers on execution failure Event: `ExecutionFailed`
*/
function approveSigned(uint256 _id, bool _approve, uint256 _keyType, uint8 v, bytes32 r, bytes32 s) external returns (bool success);
function approveSigned(
uint256 _id,
bool _approve,
uint256 _keyType,
uint8 v,
bytes32 r,
bytes32 s
) external returns (bool success);

/**
* @dev Removes _purpose for _key from the identity.
Expand Down Expand Up @@ -108,7 +115,15 @@ interface IERC734 {
* Triggers Event: ExecutionRequested
* Triggers on direct execution Event: Executed
*/
function executeSigned(address _to, uint256 _value, bytes calldata _data, uint256 _keyType, uint8 v, bytes32 r, bytes32 s) external payable returns (uint256 executionId);
function executeSigned(
address _to,
uint256 _value,
bytes calldata _data,
uint256 _keyType,
uint8 v,
bytes32 r,
bytes32 s
) external payable returns (uint256 executionId);

/**
* @dev Returns the full key data, if present in the identity.
Expand Down
28 changes: 14 additions & 14 deletions test/identities/executions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ describe('Identity', () => {
};

const signature = await aliceWallet.signMessage(ethers.getBytes(ethers.keccak256(ethers.AbiCoder.defaultAbiCoder().encode(
['address', 'uint256', 'bytes'],
[action.to, action.value, action.data],
['address', 'address', 'uint256', 'bytes'],
[await aliceIdentity.getAddress(), action.to, action.value, action.data],
))));
const signatureParsed = ethers.Signature.from(signature);

Expand Down Expand Up @@ -309,8 +309,8 @@ describe('Identity', () => {
};

const signature = await aliceWallet.signMessage(ethers.getBytes(ethers.keccak256(ethers.AbiCoder.defaultAbiCoder().encode(
['address', 'uint256', 'bytes'],
[action.to, action.value, action.data]
['address', 'address', 'uint256', 'bytes'],
[await aliceIdentity.getAddress(), action.to, action.value, action.data]
))));
const signatureParsed = ethers.Signature.from(signature);

Expand Down Expand Up @@ -339,8 +339,8 @@ describe('Identity', () => {
};

const signature = await aliceWallet.signMessage(ethers.getBytes(ethers.keccak256(ethers.AbiCoder.defaultAbiCoder().encode(
['address', 'uint256', 'bytes'],
[action.to, action.value, action.data]
['address', 'address', 'uint256', 'bytes'],
[await aliceIdentity.getAddress(), action.to, action.value, action.data]
))));
const signatureParsed = ethers.Signature.from(signature);

Expand Down Expand Up @@ -371,8 +371,8 @@ describe('Identity', () => {
};

const signature = await aliceWallet.signMessage(ethers.getBytes(ethers.keccak256(ethers.AbiCoder.defaultAbiCoder().encode(
['address', 'uint256', 'bytes'],
[action.to, action.value, action.data]
['address', 'address', 'uint256', 'bytes'],
[await aliceIdentity.getAddress(), action.to, action.value, action.data]
))));
const signatureParsed = ethers.Signature.from(signature);

Expand Down Expand Up @@ -446,8 +446,8 @@ describe('Identity', () => {
const previousBalance = await ethers.provider.getBalance(bobIdentity);

const signature = await carolWallet.signMessage(ethers.getBytes(ethers.keccak256(ethers.AbiCoder.defaultAbiCoder().encode(
['address', 'uint256', 'bytes'],
[action.to, action.value, action.data]
['address', 'address', 'uint256', 'bytes'],
[await aliceIdentity.getAddress(), action.to, action.value, action.data]
))));
const signatureParsed = ethers.Signature.from(signature);

Expand Down Expand Up @@ -478,8 +478,8 @@ describe('Identity', () => {
};

const signature = await carolWallet.signMessage(ethers.getBytes(ethers.keccak256(ethers.AbiCoder.defaultAbiCoder().encode(
['address', 'uint256', 'bytes'],
[action.to, action.value, action.data]
['address', 'address', 'uint256', 'bytes'],
[await aliceIdentity.getAddress(), action.to, action.value, action.data]
))));
const signatureParsed = ethers.Signature.from(signature);

Expand Down Expand Up @@ -558,8 +558,8 @@ describe('Identity', () => {
data: '0x',
};
const signature = await aliceWallet.signMessage(ethers.getBytes(ethers.keccak256(ethers.AbiCoder.defaultAbiCoder().encode(
['address', 'uint256', 'bytes'],
[action.to, action.value, action.data],
['address', 'address', 'uint256', 'bytes'],
[await aliceIdentity.getAddress(), action.to, action.value, action.data],
))));
const signatureParsed = ethers.Signature.from(signature);

Expand Down

0 comments on commit 67dcff0

Please sign in to comment.