Skip to content

Commit

Permalink
minor audit changes (#116)
Browse files Browse the repository at this point in the history
* minor audit changes

* allow world-id address to be zero (for off-chain verification)

* Use llamarpc by default

* fix test workflow

* remove console import
  • Loading branch information
Dzejkop authored Jan 8, 2025
1 parent 3c36c6a commit 0cf5409
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:

- name: Run Forge tests
working-directory: contracts
env:
ETHEREUM_PROVIDER: "${{ secrets.ETHEREUM_PROVIDER }}"
run: |
forge test -f "${{ secrets.ETHEREUM_PROVIDER }}" -vvv
forge test -vvv
id: test
4 changes: 2 additions & 2 deletions contracts/scripts/DeployDevnet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ contract DeployDevnet is Script {
address batchInsertionVerifiers = address(0);
address batchDeletionVerifiers = address(0);


function run() public {
console.log(
"Deploying: EntryPoint, PBHEntryPoint, PBHEntryPointImplV1, PBHSignatureAggregator, WorldIDRouter, WorldIDOrb"
Expand Down Expand Up @@ -77,7 +76,8 @@ contract DeployDevnet is Script {
pbhEntryPointImpl = address(new PBHEntryPointImplV1());
console.log("PBHEntryPointImplV1 Deployed at: ", pbhEntryPointImpl);
bytes memory initCallData = abi.encodeCall(
PBHEntryPointImplV1.initialize, (IWorldID(worldIdGroups), IEntryPoint(entryPoint), 30, address(0x123), MAX_PBH_GAS_LIMIT)
PBHEntryPointImplV1.initialize,
(IWorldID(worldIdGroups), IEntryPoint(entryPoint), 30, address(0x123), MAX_PBH_GAS_LIMIT)
);
pbhEntryPoint = address(new PBHEntryPoint(pbhEntryPointImpl, initCallData));
console.log("PBHEntryPoint Deployed at: ", pbhEntryPoint);
Expand Down
6 changes: 1 addition & 5 deletions contracts/src/PBHEntryPointImplV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ contract PBHEntryPointImplV1 is IPBHEntryPoint, WorldIDImpl, ReentrancyGuard {
/// @notice Initializes the contract.
/// @dev Must be called exactly once.
/// @dev This is marked `reinitializer()` to allow for updated initialisation steps when working
/// with upgrades based upon this contract. Be aware that there are only 256 (zero-indexed)
/// with upgrades based upon this contract. Be aware that there are only 255 (parameter is `uint8` and first value is 1)
/// initialisations allowed, so decide carefully when to use them. Many cases can safely be
/// replaced by use of setters.
/// @dev This function is explicitly not virtual as it does not make sense to override even when
Expand Down Expand Up @@ -281,10 +281,6 @@ contract PBHEntryPointImplV1 is IPBHEntryPoint, WorldIDImpl, ReentrancyGuard {
/// @notice Sets the World ID instance that will be used for verifying proofs.
/// @param _worldId The World ID instance that will be used for verifying proofs.
function setWorldId(address _worldId) external virtual onlyProxy onlyInitialized onlyOwner {
if (_worldId == address(0)) {
revert AddressZero();
}

worldId = IWorldID(_worldId);
emit WorldIdSet(_worldId);
}
Expand Down
6 changes: 6 additions & 0 deletions contracts/test/TestSetup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ contract TestSetup is Test {
/// TEST DATA ///
///////////////////////////////////////////////////////////////////////////////

string internal constant MAINNET_RPC_URL = "https://eth.llamarpc.com";

/// @notice The 4337 Entry Point on Ethereum Mainnet.
IEntryPoint internal entryPoint = IEntryPoint(address(0x0000000071727De22E5E9d8BAf0edAc6f37da032));
/// @notice The PBHEntryPoint contract.
Expand Down Expand Up @@ -72,6 +74,10 @@ contract TestSetup is Test {
/// @notice This function runs before every single test.
/// @dev It is run before every single iteration of a property-based fuzzing test.
function setUp() public virtual {
string memory rpcUrl = vm.envOr("ETHEREUM_PROVIDER", MAINNET_RPC_URL);
uint256 forkId = vm.createFork(rpcUrl);
vm.selectFork(forkId);

safeOwner = vm.addr(safeOwnerKey);
vm.startPrank(OWNER);
deployWorldIDGroups();
Expand Down

0 comments on commit 0cf5409

Please sign in to comment.