From 64b25535f43cdeafcea0a20685641c26f9b6ba3b Mon Sep 17 00:00:00 2001 From: Austin Born Date: Mon, 4 Sep 2023 07:19:54 -0700 Subject: [PATCH] Update setConfigFromSource to force config count --- contracts/src/v0.8/llo-feeds/Verifier.sol | 8 +++++++- contracts/src/v0.8/llo-feeds/interfaces/IVerifier.sol | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/contracts/src/v0.8/llo-feeds/Verifier.sol b/contracts/src/v0.8/llo-feeds/Verifier.sol index 0461cae818e..7b9a6d98326 100644 --- a/contracts/src/v0.8/llo-feeds/Verifier.sol +++ b/contracts/src/v0.8/llo-feeds/Verifier.sol @@ -323,6 +323,7 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { feedId, block.chainid, address(this), + 0, // 0 defaults to feedConfig.configCount + 1 signers, offchainTransmitters, f, @@ -338,6 +339,7 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { bytes32 feedId, uint256 sourceChainId, address sourceAddress, + uint32 newConfigCount, address[] memory signers, bytes32[] memory offchainTransmitters, uint8 f, @@ -350,6 +352,7 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { feedId, sourceChainId, sourceAddress, + newConfigCount, signers, offchainTransmitters, f, @@ -364,6 +367,7 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { /// @param feedId Feed ID to set config for /// @param sourceChainId Chain ID of source config /// @param sourceAddress Address of source config Verifier + /// @param newConfigCount Optional param to force the new config count /// @param signers addresses with which oracles sign the reports /// @param offchainTransmitters CSA key for the ith Oracle /// @param f number of faulty oracles the system can tolerate @@ -375,6 +379,7 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { bytes32 feedId, uint256 sourceChainId, address sourceAddress, + uint32 newConfigCount, address[] memory signers, bytes32[] memory offchainTransmitters, uint8 f, @@ -386,7 +391,8 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { VerifierState storage feedVerifierState = s_feedVerifierStates[feedId]; // Increment the number of times a config has been set first - feedVerifierState.configCount++; + if (newConfigCount > 0) feedVerifierState.configCount = newConfigCount; + else feedVerifierState.configCount++; bytes32 configDigest = _configDigestFromConfigData( feedId, diff --git a/contracts/src/v0.8/llo-feeds/interfaces/IVerifier.sol b/contracts/src/v0.8/llo-feeds/interfaces/IVerifier.sol index 6610957d98c..7617d9a5c35 100644 --- a/contracts/src/v0.8/llo-feeds/interfaces/IVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/interfaces/IVerifier.sol @@ -45,6 +45,7 @@ interface IVerifier is IERC165 { * @param feedId Feed ID to set config for * @param sourceChainId Chain ID of source config * @param sourceAddress Address of source config Verifier + * @param newConfigCount Param to force the new config count * @param signers addresses with which oracles sign the reports * @param offchainTransmitters CSA key for the ith Oracle * @param f number of faulty oracles the system can tolerate @@ -57,6 +58,7 @@ interface IVerifier is IERC165 { bytes32 feedId, uint256 sourceChainId, address sourceAddress, + uint32 newConfigCount, address[] memory signers, bytes32[] memory offchainTransmitters, uint8 f,