Sitelet https://github.com/Dargon789/account/commit/7ea8d3262830e1d76b0d384faa88bd662f3b0227
Skip to content

Commit 7ea8d32

Browse files
committed
Merge branch 'fix-tests-account' into IthacaAccount
2 parents d3fa551 + 05f0843 commit 7ea8d32

10 files changed

Lines changed: 1926 additions & 0 deletions

File tree

‎.idea/.gitignore‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/account.iml‎

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/caches/deviceStreaming.xml‎

Lines changed: 1698 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/codeStyles/Project.xml‎

Lines changed: 117 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/codeStyles/codeStyleConfig.xml‎

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/copilot.data.migration.ask2agent.xml‎

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/markdown.xml‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/modules.xml‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/vcs.xml‎

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/Benchmark.t.sol‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,6 +1805,52 @@ contract BenchmarkTest is BaseTest {
18051805
assertEq(paymentToken.balanceOf(address(0xbabe)), 1 ether);
18061806
}
18071807

1808+
function testERC20TransferViaPortoOrchestratorWithPasskey() public {
1809+
vm.pauseGasMetering();
1810+
1811+
PassKey memory k = _randomSecp256k1PassKey();
1812+
1813+
DelegatedEOA memory d = _randomEIP7702DelegatedEOA();
1814+
vm.deal(d.eoa, type(uint128).max);
1815+
_mint(address(paymentToken), d.eoa, type(uint128).max);
1816+
1817+
vm.startPrank(d.eoa);
1818+
d.d.authorize(k.k);
1819+
d.d.setCanExecute(
1820+
k.keyHash, address(paymentToken), bytes4(keccak256("transfer(address,uint256)")), true
1821+
);
1822+
d.d.setSpendLimit(
1823+
k.keyHash, address(paymentToken), GuardedExecutor.SpendPeriod.Hour, type(uint256).max
1824+
);
1825+
d.d.setSpendLimit(k.keyHash, address(0), GuardedExecutor.SpendPeriod.Hour, type(uint256).max);
1826+
vm.stopPrank();
1827+
1828+
Orchestrator.Intent memory u;
1829+
u.eoa = d.eoa;
1830+
u.nonce = 0;
1831+
u.combinedGas = 1000000;
1832+
u.prePaymentAmount = 0 ether;
1833+
u.prePaymentMaxAmount = 0 ether;
1834+
u.totalPaymentAmount = 0.01 ether;
1835+
u.totalPaymentMaxAmount = 0.1 ether;
1836+
u.paymentToken = address(0);
1837+
// To maintain parity with the old benchmarks.
1838+
u.paymentRecipient = address(oc);
1839+
u.executionData = _transferExecutionData(address(paymentToken), address(0xbabe), 1 ether);
1840+
u.signature = _sig(k, u);
1841+
1842+
bytes[] memory encodedIntents = new bytes[](1);
1843+
encodedIntents[0] = abi.encode(u);
1844+
1845+
vm.resumeGasMetering();
1846+
1847+
oc.execute(encodedIntents);
1848+
1849+
vm.pauseGasMetering();
1850+
assertEq(paymentToken.balanceOf(address(0xbabe)), 1 ether);
1851+
vm.resumeGasMetering();
1852+
}
1853+
18081854
function testERC20TransferDirect() public {
18091855
DelegatedEOA memory d = _randomEIP7702DelegatedEOA();
18101856
_giveAccountSomeTokens(d.eoa);

0 commit comments

Comments
 (0)