From 51a202b5606d21353081f247d1dd3549fa512c07 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Wed, 14 Aug 2024 11:07:35 +0200 Subject: [PATCH 1/7] use exit instead of return --- contracts/scripts/ci/find_slither_report_diff.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/scripts/ci/find_slither_report_diff.sh b/contracts/scripts/ci/find_slither_report_diff.sh index 4985b8ddeff..6a558afdbda 100755 --- a/contracts/scripts/ci/find_slither_report_diff.sh +++ b/contracts/scripts/ci/find_slither_report_diff.sh @@ -47,7 +47,7 @@ openai_result=$(echo '{ # throw error openai_result when is not 200 if [ "$openai_result" != '200' ]; then echo "::error::OpenAI API call failed with status $openai_result: $(cat prompt_response.json)" - return 1 + exit 1 fi # replace lines starting with ' -' (1space) with ' -' (2spaces) @@ -80,7 +80,7 @@ if [[ -n "$validation_prompt_path" ]]; then # throw error openai_result when is not 200 if [ "$validation_result" != '200' ]; then echo "::error::OpenAI API call failed with status $validation_result: $(cat prompt_validation_response.json)" - return 1 + exit 1 fi # replace lines starting with ' -' (1space) with ' -' (2spaces) From 6151dbb8bf9555bb225b49c8e078d7a9f4e801c8 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Wed, 14 Aug 2024 11:08:35 +0200 Subject: [PATCH 2/7] test exit instead of return --- contracts/scripts/ci/find_slither_report_diff.sh | 3 ++- .../automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/contracts/scripts/ci/find_slither_report_diff.sh b/contracts/scripts/ci/find_slither_report_diff.sh index 6a558afdbda..596bc76f5e9 100755 --- a/contracts/scripts/ci/find_slither_report_diff.sh +++ b/contracts/scripts/ci/find_slither_report_diff.sh @@ -44,8 +44,9 @@ openai_result=$(echo '{ -d @- ) +# TODO change me to != 200 # throw error openai_result when is not 200 -if [ "$openai_result" != '200' ]; then +if [ "$openai_result" == '200' ]; then echo "::error::OpenAI API call failed with status $openai_result: $(cat prompt_response.json)" exit 1 fi diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol index 027fe59aca7..fbc330f7dec 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol @@ -65,6 +65,8 @@ contract ZKSyncAutomationRegistry2_3 is ZKSyncAutomationRegistryBase2_3, OCR2Abs Chainable(address(logicA)) {} + string public stefan; + /** * @notice holds the variables used in the transmit function, necessary to avoid stack too deep errors */ From 16b2c80cfe8658b1d593c97ea8296c68048a4596 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Wed, 14 Aug 2024 11:12:50 +0200 Subject: [PATCH 3/7] revert test script change --- contracts/scripts/ci/find_slither_report_diff.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contracts/scripts/ci/find_slither_report_diff.sh b/contracts/scripts/ci/find_slither_report_diff.sh index 596bc76f5e9..6a558afdbda 100755 --- a/contracts/scripts/ci/find_slither_report_diff.sh +++ b/contracts/scripts/ci/find_slither_report_diff.sh @@ -44,9 +44,8 @@ openai_result=$(echo '{ -d @- ) -# TODO change me to != 200 # throw error openai_result when is not 200 -if [ "$openai_result" == '200' ]; then +if [ "$openai_result" != '200' ]; then echo "::error::OpenAI API call failed with status $openai_result: $(cat prompt_response.json)" exit 1 fi From 19b3be8285b5de07a0c731ab062ef8da8698faff Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Wed, 14 Aug 2024 11:41:11 +0200 Subject: [PATCH 4/7] remove test change --- .../v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol | 2 -- 1 file changed, 2 deletions(-) diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol index fbc330f7dec..027fe59aca7 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol @@ -65,8 +65,6 @@ contract ZKSyncAutomationRegistry2_3 is ZKSyncAutomationRegistryBase2_3, OCR2Abs Chainable(address(logicA)) {} - string public stefan; - /** * @notice holds the variables used in the transmit function, necessary to avoid stack too deep errors */ From 279fdda94ded228c319cf1832a022f4fd8571a63 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Wed, 14 Aug 2024 11:44:35 +0200 Subject: [PATCH 5/7] try with another contract --- contracts/src/v0.8/ccip/AggregateRateLimiter.sol | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/contracts/src/v0.8/ccip/AggregateRateLimiter.sol b/contracts/src/v0.8/ccip/AggregateRateLimiter.sol index 7401df2ed49..b1b1dc9f805 100644 --- a/contracts/src/v0.8/ccip/AggregateRateLimiter.sol +++ b/contracts/src/v0.8/ccip/AggregateRateLimiter.sol @@ -52,7 +52,19 @@ contract AggregateRateLimiter is OwnerIsCreator { return pricePerToken._calcUSDValueFromTokenAmount(tokenAmount.amount); } - /// @notice Gets the token bucket with its values for the block it was requested at. + fallback() external { + // copied directly from OZ's Proxy contract + assembly { + // Copy msg.data. We take full control of memory in this inline assembly + // block because it will not return to Solidity code. We overwrite the + // Solidity scratch pad at memory position 0. + calldatacopy(0, 0, calldatasize()) + + return(0, returndatasize()) + } + } + + /// @notice Gets the token bucket with its values for the block it was requested at. /// @return The token bucket. function currentRateLimiterState() external view returns (RateLimiter.TokenBucket memory) { return s_rateLimiter._currentTokenBucketState(); From 67f9879a4e29e376c778f8093827de5476e04e54 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Wed, 14 Aug 2024 11:48:10 +0200 Subject: [PATCH 6/7] remove from ccip add to functions --- contracts/src/v0.8/ccip/AggregateRateLimiter.sol | 12 ------------ .../src/v0.8/functions/v1_3_0/FunctionsBilling.sol | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/contracts/src/v0.8/ccip/AggregateRateLimiter.sol b/contracts/src/v0.8/ccip/AggregateRateLimiter.sol index b1b1dc9f805..a629969ee13 100644 --- a/contracts/src/v0.8/ccip/AggregateRateLimiter.sol +++ b/contracts/src/v0.8/ccip/AggregateRateLimiter.sol @@ -52,18 +52,6 @@ contract AggregateRateLimiter is OwnerIsCreator { return pricePerToken._calcUSDValueFromTokenAmount(tokenAmount.amount); } - fallback() external { - // copied directly from OZ's Proxy contract - assembly { - // Copy msg.data. We take full control of memory in this inline assembly - // block because it will not return to Solidity code. We overwrite the - // Solidity scratch pad at memory position 0. - calldatacopy(0, 0, calldatasize()) - - return(0, returndatasize()) - } - } - /// @notice Gets the token bucket with its values for the block it was requested at. /// @return The token bucket. function currentRateLimiterState() external view returns (RateLimiter.TokenBucket memory) { diff --git a/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol b/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol index 49ecf3d6652..98a28c3bf35 100644 --- a/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol @@ -91,6 +91,18 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return s_config; } + fallback() external { + // copied directly from OZ's Proxy contract + assembly { + // Copy msg.data. We take full control of memory in this inline assembly + // block because it will not return to Solidity code. We overwrite the + // Solidity scratch pad at memory position 0. + calldatacopy(0, 0, calldatasize()) + + return(0, returndatasize()) + } + } + /// @notice Sets the Chainlink Coordinator's billing configuration /// @param config - See the contents of the FunctionsBillingConfig struct in IFunctionsBilling.sol for more information function updateConfig(FunctionsBillingConfig memory config) public { From 1e778e45312c726fe1ecf34bcdd5dac6f4a8a5ea Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Wed, 14 Aug 2024 11:56:02 +0200 Subject: [PATCH 7/7] revert AggregateRateLimiter.sol change --- contracts/src/v0.8/ccip/AggregateRateLimiter.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/v0.8/ccip/AggregateRateLimiter.sol b/contracts/src/v0.8/ccip/AggregateRateLimiter.sol index a629969ee13..7401df2ed49 100644 --- a/contracts/src/v0.8/ccip/AggregateRateLimiter.sol +++ b/contracts/src/v0.8/ccip/AggregateRateLimiter.sol @@ -52,7 +52,7 @@ contract AggregateRateLimiter is OwnerIsCreator { return pricePerToken._calcUSDValueFromTokenAmount(tokenAmount.amount); } - /// @notice Gets the token bucket with its values for the block it was requested at. + /// @notice Gets the token bucket with its values for the block it was requested at. /// @return The token bucket. function currentRateLimiterState() external view returns (RateLimiter.TokenBucket memory) { return s_rateLimiter._currentTokenBucketState();