Skip to content

Commit f399296

Browse files
authored
feat: Upgrade solidity to 0.8.30 (#1176)
* feat: OpenZeppelin V5 upgrade Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Removed unused uma contracts Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * pinned foundry/hardhat versions Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * downgraded to 0.8.24 Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * feat: Upgrade solidity to 0.8.30 Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Downgraded hardhat Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * undo yarn.lock Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * get yarn.lock from parent branch Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * fix: Updated function visibility from private to internal (#1179) Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> --------- Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
1 parent 70350c6 commit f399296

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

contracts/SpokePool.sol

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,8 +1697,23 @@ abstract contract SpokePool is
16971697
if (fillStatuses[relayHash] == uint256(FillStatus.Filled)) revert RelayFilled();
16981698
fillStatuses[relayHash] = uint256(FillStatus.Filled);
16991699

1700-
// @dev Before returning early, emit events to assist the dataworker in being able to know which fills were
1701-
// successful.
1700+
_emitFilledRelayEvent(relayExecution, relayData, relayer, fillType);
1701+
_transferTokensToRecipient(relayExecution, relayData, isSlowFill);
1702+
}
1703+
1704+
/**
1705+
* @notice Emits the FilledRelay event for a completed relay fill.
1706+
* @param relayExecution The relay execution parameters.
1707+
* @param relayData The relay data.
1708+
* @param relayer The relayer address.
1709+
* @param fillType The type of fill being executed.
1710+
*/
1711+
function _emitFilledRelayEvent(
1712+
V3RelayExecutionParams memory relayExecution,
1713+
V3RelayData memory relayData,
1714+
bytes32 relayer,
1715+
FillType fillType
1716+
) internal {
17021717
emit FilledRelay(
17031718
relayData.inputToken,
17041719
relayData.outputToken,
@@ -1721,13 +1736,25 @@ abstract contract SpokePool is
17211736
fillType: fillType
17221737
})
17231738
);
1739+
}
17241740

1741+
/**
1742+
* @notice Transfers tokens to the recipient based on the relay execution parameters.
1743+
* @param relayExecution The relay execution parameters.
1744+
* @param relayData The relay data.
1745+
* @param isSlowFill Whether this is a slow fill execution.
1746+
*/
1747+
function _transferTokensToRecipient(
1748+
V3RelayExecutionParams memory relayExecution,
1749+
V3RelayData memory relayData,
1750+
bool isSlowFill
1751+
) internal {
17251752
address outputToken = relayData.outputToken.toAddress();
17261753
uint256 amountToSend = relayExecution.updatedOutputAmount;
17271754
address recipientToSend = relayExecution.updatedRecipient.toAddress();
1755+
17281756
// If relay token is wrappedNativeToken then unwrap and send native token.
1729-
// Stack too deep.
1730-
if (relayData.outputToken.toAddress() == address(wrappedNativeToken)) {
1757+
if (outputToken == address(wrappedNativeToken)) {
17311758
// Note: useContractFunds is True if we want to send funds to the recipient directly out of this contract,
17321759
// otherwise we expect the caller to send funds to the recipient. If useContractFunds is True and the
17331760
// recipient wants wrappedNativeToken, then we can assume that wrappedNativeToken is already in the

foundry.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ remappings = [
2727
]
2828
via_ir = true
2929
optimizer_runs = 800
30-
solc_version = "0.8.24"
30+
solc_version = "0.8.30"
3131
revert_strings = "strip"
3232
fs_permissions = [{ access = "read", path = "./"}]
3333

34-
solc = "0.8.24"
34+
solc = "0.8.30"
3535
evm_version = "prague"
3636

3737
[profile.zksync.zksync]

hardhat.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ const isTest = process.env.IS_TEST === "true" || process.env.CI === "true";
5656
// the following config is true.
5757
const compileZk = process.env.COMPILE_ZK === "true";
5858

59-
const solcVersion = "0.8.24";
59+
const solcVersion = "0.8.30";
60+
61+
// Hardhat 2.14.0 doesn't support prague yet, so we use paris instead (need to upgrade to v3 to use prague)
62+
const evmVersion = isTest ? "paris" : "prague";
6063

6164
// Compilation settings are overridden for large contracts to allow them to compile without going over the bytecode
6265
// limit.
@@ -65,6 +68,7 @@ const LARGE_CONTRACT_COMPILER_SETTINGS = {
6568
settings: {
6669
optimizer: { enabled: true, runs: 800 },
6770
viaIR: true,
71+
evmVersion,
6872
debug: { revertStrings: isTest ? "debug" : "strip" },
6973
},
7074
};
@@ -73,6 +77,7 @@ const DEFAULT_CONTRACT_COMPILER_SETTINGS = {
7377
settings: {
7478
optimizer: { enabled: true, runs: 1000000 },
7579
viaIR: true,
80+
evmVersion,
7681
// Only strip revert strings if not testing or in ci.
7782
debug: { revertStrings: isTest ? "debug" : "strip" },
7883
},
@@ -83,6 +88,7 @@ const LARGEST_CONTRACT_COMPILER_SETTINGS = {
8388
settings: {
8489
optimizer: { enabled: true, runs: 50 },
8590
viaIR: true,
91+
evmVersion,
8692
debug: { revertStrings: isTest ? "debug" : "strip" },
8793
},
8894
};

0 commit comments

Comments
 (0)