diff --git a/contracts/SpokePool.sol b/contracts/SpokePool.sol index 4aa181a96..a7f7bfa50 100644 --- a/contracts/SpokePool.sol +++ b/contracts/SpokePool.sol @@ -1673,8 +1673,23 @@ abstract contract SpokePool is if (fillStatuses[relayHash] == uint256(FillStatus.Filled)) revert RelayFilled(); fillStatuses[relayHash] = uint256(FillStatus.Filled); - // @dev Before returning early, emit events to assist the dataworker in being able to know which fills were - // successful. + _emitFilledRelayEvent(relayExecution, relayData, relayer, fillType); + _transferTokensToRecipient(relayExecution, relayData, isSlowFill); + } + + /** + * @notice Emits the FilledRelay event for a completed relay fill. + * @param relayExecution The relay execution parameters. + * @param relayData The relay data. + * @param relayer The relayer address. + * @param fillType The type of fill being executed. + */ + function _emitFilledRelayEvent( + V3RelayExecutionParams memory relayExecution, + V3RelayData memory relayData, + bytes32 relayer, + FillType fillType + ) internal { emit FilledRelay( relayData.inputToken, relayData.outputToken, @@ -1697,13 +1712,25 @@ abstract contract SpokePool is fillType: fillType }) ); + } + /** + * @notice Transfers tokens to the recipient based on the relay execution parameters. + * @param relayExecution The relay execution parameters. + * @param relayData The relay data. + * @param isSlowFill Whether this is a slow fill execution. + */ + function _transferTokensToRecipient( + V3RelayExecutionParams memory relayExecution, + V3RelayData memory relayData, + bool isSlowFill + ) internal { address outputToken = relayData.outputToken.toAddress(); uint256 amountToSend = relayExecution.updatedOutputAmount; address recipientToSend = relayExecution.updatedRecipient.toAddress(); + // If relay token is wrappedNativeToken then unwrap and send native token. - // Stack too deep. - if (relayData.outputToken.toAddress() == address(wrappedNativeToken)) { + if (outputToken == address(wrappedNativeToken)) { // Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract, // otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the // recipient wants wrappedNativeToken, then we can assume that wrappedNativeToken is already in the diff --git a/foundry.toml b/foundry.toml index 68f1ad17d..86f8b37ca 100644 --- a/foundry.toml +++ b/foundry.toml @@ -27,11 +27,11 @@ remappings = [ ] via_ir = true optimizer_runs = 800 -solc_version = "0.8.24" +solc_version = "0.8.30" revert_strings = "strip" fs_permissions = [{ access = "read", path = "./"}] -solc = "0.8.24" +solc = "0.8.30" evm_version = "prague" [profile.zksync.zksync] diff --git a/hardhat.config.ts b/hardhat.config.ts index 115e76bf0..d5d71d10b 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -56,7 +56,10 @@ const isTest = process.env.IS_TEST === "true" || process.env.CI === "true"; // the following config is true. const compileZk = process.env.COMPILE_ZK === "true"; -const solcVersion = "0.8.24"; +const solcVersion = "0.8.30"; + +// Hardhat 2.14.0 doesn't support prague yet, so we use paris instead (need to upgrade to v3 to use prague) +const evmVersion = isTest ? "paris" : "prague"; // Compilation settings are overridden for large contracts to allow them to compile without going over the bytecode // limit. @@ -65,6 +68,7 @@ const LARGE_CONTRACT_COMPILER_SETTINGS = { settings: { optimizer: { enabled: true, runs: 800 }, viaIR: true, + evmVersion, debug: { revertStrings: isTest ? "debug" : "strip" }, }, }; @@ -73,6 +77,7 @@ const DEFAULT_CONTRACT_COMPILER_SETTINGS = { settings: { optimizer: { enabled: true, runs: 1000000 }, viaIR: true, + evmVersion, // Only strip revert strings if not testing or in ci. debug: { revertStrings: isTest ? "debug" : "strip" }, }, @@ -83,6 +88,7 @@ const LARGEST_CONTRACT_COMPILER_SETTINGS = { settings: { optimizer: { enabled: true, runs: 50 }, viaIR: true, + evmVersion, debug: { revertStrings: isTest ? "debug" : "strip" }, }, };