Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
411da0fd
Unverified
Commit
411da0fd
authored
Oct 20, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(safe-tools): Cache priv-key during sorting loop
this change is more readable
parent
0a443dd4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
SafeTestTools.sol
packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol
+7
-2
No files found.
packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol
View file @
411da0fd
...
@@ -67,6 +67,7 @@ library Sort {
...
@@ -67,6 +67,7 @@ library Sort {
}
}
/// @dev Sorts an array of private keys by the computed address
/// @dev Sorts an array of private keys by the computed address
/// If the private key is a smart contract wallet, it will be decoded and sorted by the address
function sortPKsByComputedAddress(uint256[] memory _pks) pure returns (uint256[] memory) {
function sortPKsByComputedAddress(uint256[] memory _pks) pure returns (uint256[] memory) {
uint256[] memory sortedPKs = new uint256[](_pks.length);
uint256[] memory sortedPKs = new uint256[](_pks.length);
...
@@ -74,10 +75,14 @@ function sortPKsByComputedAddress(uint256[] memory _pks) pure returns (uint256[]
...
@@ -74,10 +75,14 @@ function sortPKsByComputedAddress(uint256[] memory _pks) pure returns (uint256[]
bytes32[2][] memory accounts = new bytes32[2][](_pks.length);
bytes32[2][] memory accounts = new bytes32[2][](_pks.length);
for (uint256 i; i < _pks.length; i++) {
for (uint256 i; i < _pks.length; i++) {
address signer = getAddr(_pks[i]);
uint256 pk = _pks[i];
address signer = getAddr(pk);
if (isSmartContractPK(pk)) {
signer = decodeSmartContractWalletAsAddress(pk);
}
addresses[i] = signer;
addresses[i] = signer;
accounts[i][0] = bytes32(abi.encode(signer));
accounts[i][0] = bytes32(abi.encode(signer));
accounts[i][1] = bytes32(
_pks[i]
);
accounts[i][1] = bytes32(
pk
);
}
}
addresses = Sort.sort(addresses);
addresses = Sort.sort(addresses);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment