Time: ~40 min. Goal: see what a 7702 delegation does, locally, before XDC mainnet has Prague.
Status: Ethereum mainnet has 7702 since Pectra; XDC devnet has it, XDC Apothem activates Prague at
block 84,333,000; XDC mainnet (chain 50) is still Cancun. So: anvil / forge only.
Exercises are the numbered comments in the starter files.
cd lab3 && forge install foundry-rs/forge-std@v1.17.0 --no-git && forge build (foundry.toml sets evm_version = "prague").src/BatchExecutor.sol (delegate code for the EOA).test/BatchExecutor.t.sol. Key cheatcode: vm.signAndAttachDelegation(impl, key) (keys from makeAddrAndKey, throwaway).
forge test -vv until green. Check: alice.code == 0xef0100 || impl (23 bytes).anvil --port 18513 --hardfork prague, deploy BatchExecutor with forge create, then send a type-4 tx with `cast send <eoa> 'execute((address,uint256,bytes)[])' '[...]'
--auth <impl> --private-key <anvil test key of that EOA> --rpc-url anvil, then cast code <eoa> --rpc-url anvil`.
msg.sender == address(this)? Without it anyone could drive the EOA.tx.origin == msg.sender no longer proves "top-level EOA call".Solution: lab3-solution.tar.gz (download link below; same layout, run the same forge install step first).
Download starter · Download solution · All workshop material