From 5a58df9341df7cf9c1376f65eb8599c284d2f2b4 Mon Sep 17 00:00:00 2001 From: Alysia Tech Date: Wed, 2 Oct 2024 08:50:11 -0400 Subject: [PATCH] rename threshold for escape hatch lag function to minimize confusion (#2093) --- contract-bindings/src/light_client.rs | 8 ++++---- contracts/src/LightClient.sol | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/contract-bindings/src/light_client.rs b/contract-bindings/src/light_client.rs index 0d0e99d65..e8783660e 100644 --- a/contract-bindings/src/light_client.rs +++ b/contract-bindings/src/light_client.rs @@ -309,7 +309,7 @@ pub mod light_client { ), }, ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("threshold"), + name: ::std::borrow::ToOwned::to_owned("blockThreshold"), kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), internal_type: ::core::option::Option::Some( ::std::borrow::ToOwned::to_owned("uint256"), @@ -1057,10 +1057,10 @@ pub mod light_client { pub fn lag_over_escape_hatch_threshold( &self, block_number: ::ethers::core::types::U256, - threshold: ::ethers::core::types::U256, + block_threshold: ::ethers::core::types::U256, ) -> ::ethers::contract::builders::ContractCall { self.0 - .method_hash([224, 48, 51, 1], (block_number, threshold)) + .method_hash([224, 48, 51, 1], (block_number, block_threshold)) .expect("method not found (this should never happen)") } ///Calls the contract's `newFinalizedState` (0x2063d4f7) function @@ -2384,7 +2384,7 @@ pub mod light_client { )] pub struct LagOverEscapeHatchThresholdCall { pub block_number: ::ethers::core::types::U256, - pub threshold: ::ethers::core::types::U256, + pub block_threshold: ::ethers::core::types::U256, } ///Container type for all input parameters for the `newFinalizedState` function with signature `newFinalizedState((uint64,uint64,uint256),((uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))` and selector `0x2063d4f7` #[derive( diff --git a/contracts/src/LightClient.sol b/contracts/src/LightClient.sol index 032568195..2a1a6a693 100644 --- a/contracts/src/LightClient.sol +++ b/contracts/src/LightClient.sol @@ -347,12 +347,13 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable { ); } - /// @notice checks if the state updates lag behind the specified threshold based on the provided + /// @notice checks if the state updates lag behind the specified block threshold based on the + /// provided /// block number. /// @param blockNumber The block number to compare against the latest state updates - /// @param threshold The number of blocks updates to this contract is allowed to lag behind - /// @return bool returns true if the lag exceeds the threshold; otherwise, false - function lagOverEscapeHatchThreshold(uint256 blockNumber, uint256 threshold) + /// @param blockThreshold The number of blocks updates this contract is allowed to lag behind + /// @return bool returns true if the lag exceeds the blockThreshold; otherwise, false + function lagOverEscapeHatchThreshold(uint256 blockNumber, uint256 blockThreshold) public view virtual @@ -395,7 +396,7 @@ contract LightClient is Initializable, OwnableUpgradeable, UUPSUpgradeable { revert InsufficientSnapshotHistory(); } - return blockNumber - prevBlock > threshold; + return blockNumber - prevBlock > blockThreshold; } /// @notice get the HotShot commitment that represents the Merkle root containing the leaf at