From da7d37c96508546eadfeeafb808e8d2e7d3ce33c Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 8 Apr 2026 17:44:16 -0700 Subject: [PATCH 1/2] chore: sync main branch with current refactor workspace updates --- README.md | 8 ++++---- foundry.toml | 4 ++++ script/GitBondEscrow.s.sol | 12 +++++------- src/GitBondEscrow.sol | 6 +++--- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 04fddab..8336ea7 100644 --- a/README.md +++ b/README.md @@ -108,10 +108,10 @@ Deterministic deployment: - Set `ESCROW_DEPLOY_SALT=` when running `GitBondEscrowScript` (CREATE2 is now used by default). -- The same deployer address, same salt, same implementation bytecode and same initializer args produce - deterministic addresses on each chain. -- This script deploys both implementation and proxy with CREATE2 (`ERC1967Proxy`), making - proxy/implementation addresses predictable across chains. +- The same deployer address, same salt, and same initializer args produce a deterministic proxy address + on each chain. +- This script deploys the proxy with CREATE2 (`ERC1967Proxy`) for deterministic proxy addresses. + The implementation is deployed normally (non-CREATE2). Whitelist trust assumption: diff --git a/foundry.toml b/foundry.toml index ee999c3..b6fc929 100644 --- a/foundry.toml +++ b/foundry.toml @@ -9,4 +9,8 @@ build_info = true extra_output = ["storageLayout"] fs_permissions = [{ access = "read", path = "./out" }] +# Silence solc warnings emitted from dependencies (e.g. OpenZeppelin foundry helpers under lib/). +# Warnings from src/ and script/ are still shown. +ignored_warnings_from = ["lib"] + # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options diff --git a/script/GitBondEscrow.s.sol b/script/GitBondEscrow.s.sol index 85af979..4d9a008 100644 --- a/script/GitBondEscrow.s.sol +++ b/script/GitBondEscrow.s.sol @@ -17,6 +17,7 @@ contract GitBondEscrowScript is Script { require(deploymentSalt != bytes32(0), "Escrow CREATE2 salt cannot be zero"); Options memory opts; + opts.unsafeAllow = "constructor"; Upgrades.validateImplementation(implementationFile, opts); vm.startBroadcast(); @@ -25,24 +26,21 @@ contract GitBondEscrowScript is Script { address escrowImplementation; address escrowProxy; - bytes32 implementationSalt = _saltForDeployment(deploymentSalt, "implementation"); bytes32 proxySalt = _saltForDeployment(deploymentSalt, "proxy"); - escrowImplementation = _deployImplementation(implementationFile, implementationSalt); + escrowImplementation = _deployImplementation(implementationFile); escrowProxy = _deployProxy(escrowImplementation, initData, proxySalt); console.log("CREATE2 mode: enabled"); console.log("Salt:", vm.toString(deploymentSalt)); - console.log("CREATE2 impl salt:", vm.toString(implementationSalt)); console.log("CREATE2 proxy salt:", vm.toString(proxySalt)); GitBondEscrow escrow = GitBondEscrow(escrowProxy); address implementation = Upgrades.getImplementationAddress(escrowProxy); require(escrow.treasury() == treasury && implementation != address(0), "Deployment post-conditions failed"); - require(escrowImplementation == implementation, "Implementation address mismatch"); console.log("GitBondEscrow implementation:", implementation); - console.log("CREATE2 implementation:", escrowImplementation); + console.log("Implementation:", escrowImplementation); console.log("GitBondEscrow proxy deployed:", escrowProxy); console.log("Escrow treasury:", escrow.treasury()); console.log("Escrow owner:", escrow.owner()); @@ -52,11 +50,11 @@ contract GitBondEscrowScript is Script { vm.stopBroadcast(); } - function _deployImplementation(string memory implementationFile, bytes32 implementationSalt) + function _deployImplementation(string memory implementationFile) internal returns (address) { - return vm.deployCode(implementationFile, bytes(""), implementationSalt); + return vm.deployCode(implementationFile, bytes("")); } function _deployProxy(address escrowImplementation, bytes memory initData, bytes32 proxySalt) diff --git a/src/GitBondEscrow.sol b/src/GitBondEscrow.sol index c9c39d1..0a7ad5b 100644 --- a/src/GitBondEscrow.sol +++ b/src/GitBondEscrow.sol @@ -176,7 +176,7 @@ contract GitBondEscrow is _createEscrowFrom(payer, key, counterparty, beneficiary, token, amount, true, permit_); } - function refundEscrow(bytes32 key) external virtual whenNotPaused { + function refundEscrow(bytes32 key) external virtual whenNotPaused nonReentrant { GitBondEscrowStorage.Layout storage s = _layout(); GitBondEscrowStorage.Escrow storage e = s.escrows[key]; @@ -194,7 +194,7 @@ contract GitBondEscrow is emit EscrowRefunded(key, e.payer, e.beneficiary, e.token, amountToReturn); } - function slashEscrow(bytes32 key) external virtual whenNotPaused { + function slashEscrow(bytes32 key) external virtual whenNotPaused nonReentrant { GitBondEscrowStorage.Layout storage s = _layout(); GitBondEscrowStorage.Escrow storage e = s.escrows[key]; @@ -218,7 +218,7 @@ contract GitBondEscrow is emit EscrowSlashed(key, e.beneficiary, e.counterparty, e.token, amountToCounterparty, platformCut); } - function claim(address token) external virtual whenNotPaused { + function claim(address token) external virtual whenNotPaused nonReentrant { GitBondEscrowStorage.Layout storage s = _layout(); uint256 amount = s.claimAmounts[msg.sender][token]; From aa8e67dceb340f871a0f931224cda91e7fe86349 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 8 Apr 2026 17:55:13 -0700 Subject: [PATCH 2/2] fix: restore deploy implementation address check --- script/GitBondEscrow.s.sol | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/script/GitBondEscrow.s.sol b/script/GitBondEscrow.s.sol index 4d9a008..5209ac6 100644 --- a/script/GitBondEscrow.s.sol +++ b/script/GitBondEscrow.s.sol @@ -17,7 +17,6 @@ contract GitBondEscrowScript is Script { require(deploymentSalt != bytes32(0), "Escrow CREATE2 salt cannot be zero"); Options memory opts; - opts.unsafeAllow = "constructor"; Upgrades.validateImplementation(implementationFile, opts); vm.startBroadcast(); @@ -38,9 +37,10 @@ contract GitBondEscrowScript is Script { address implementation = Upgrades.getImplementationAddress(escrowProxy); require(escrow.treasury() == treasury && implementation != address(0), "Deployment post-conditions failed"); + require(escrowImplementation == implementation, "Implementation address mismatch"); - console.log("GitBondEscrow implementation:", implementation); - console.log("Implementation:", escrowImplementation); + console.log("Proxy-reported implementation:", implementation); + console.log("Locally deployed implementation:", escrowImplementation); console.log("GitBondEscrow proxy deployed:", escrowProxy); console.log("Escrow treasury:", escrow.treasury()); console.log("Escrow owner:", escrow.owner()); @@ -50,10 +50,7 @@ contract GitBondEscrowScript is Script { vm.stopBroadcast(); } - function _deployImplementation(string memory implementationFile) - internal - returns (address) - { + function _deployImplementation(string memory implementationFile) internal returns (address) { return vm.deployCode(implementationFile, bytes("")); }