Skip to content

Commit

Permalink
Disallow zero predecessor config digest for staging (it MUST always b…
Browse files Browse the repository at this point in the history
…e promotable) (#15407)

* Disallow zero predecessor config digest for staging (it MUST always be promotable)

* Update gethwrappers

* Disallow zero predecessor config digest for staging (it MUST always be promotable)

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
  • Loading branch information
1 parent def2b4a commit a677d28
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
4 changes: 2 additions & 2 deletions contracts/gas-snapshots/llo-feeds.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ ConfiguratorSetProductionConfigTest:test_revertsIfNotEnoughSigners() (gas: 95951
ConfiguratorSetProductionConfigTest:test_revertsIfOnchainConfigIsInvalid() (gas: 60885)
ConfiguratorSetProductionConfigTest:test_revertsIfSetWithTooManySigners() (gas: 107412)
ConfiguratorSetProductionConfigTest:test_supportsHigherVersionsIgnoringExcessOnchainConfig() (gas: 125099)
ConfiguratorSetStagingConfigTest:test_correctlyUpdatesTheConfig() (gas: 265921)
ConfiguratorSetStagingConfigTest:test_correctlyUpdatesTheConfig() (gas: 266041)
ConfiguratorSetStagingConfigTest:test_revertsIfCalledByNonOwner() (gas: 266528)
ConfiguratorSetStagingConfigTest:test_revertsIfFaultToleranceIsZero() (gas: 264142)
ConfiguratorSetStagingConfigTest:test_revertsIfNotEnoughSigners() (gas: 95920)
ConfiguratorSetStagingConfigTest:test_revertsIfOnchainConfigIsInvalid() (gas: 67763)
ConfiguratorSetStagingConfigTest:test_revertsIfOnchainConfigIsInvalid() (gas: 85217)
ConfiguratorSetStagingConfigTest:test_revertsIfSetWithTooManySigners() (gas: 107392)
ConfiguratorTest:testSupportsInterface() (gas: 8367)
ConfiguratorTest:testTypeAndVersion() (gas: 9683)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ contract Configurator is IConfigurator, ConfirmedOwner, TypeAndVersionInterface,

ConfigurationState memory configurationState = s_configurationStates[configId];
if (
predecessorConfigDigest == bytes32(0) ||
predecessorConfigDigest !=
s_configurationStates[configId].configDigest[configurationState.isGreenProduction ? 1 : 0]
) revert InvalidPredecessorConfigDigest(predecessorConfigDigest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@ contract ConfiguratorSetStagingConfigTest is BaseTest {
OFFCHAIN_CONFIG_VERSION,
offchainConfig
);

onchainConfig = abi.encode(uint256(1), uint256(0));

vm.expectRevert(abi.encodeWithSelector(Configurator.InvalidPredecessorConfigDigest.selector, uint256(0)));
s_configurator.setStagingConfig(
CONFIG_ID_1,
signers,
offchainTransmitters,
f,
onchainConfig,
OFFCHAIN_CONFIG_VERSION,
offchainConfig
);
}

function test_correctlyUpdatesTheConfig() public {
Expand Down
Loading

0 comments on commit a677d28

Please sign in to comment.