-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve auto 2.3 migration path efficiency (#12642)
- Loading branch information
Showing
10 changed files
with
77 additions
and
54 deletions.
There are no files selected for viewing
5 changes: 2 additions & 3 deletions
5
contracts/src/v0.8/automation/dev/interfaces/v2_3/IAutomationRegistryMaster2_3.sol
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
contracts/src/v0.8/automation/dev/v2_3/UpkeepTranscoder5_0.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
pragma solidity 0.8.19; | ||
|
||
import {UpkeepTranscoderInterfaceV2} from "../../interfaces/UpkeepTranscoderInterfaceV2.sol"; | ||
import {TypeAndVersionInterface} from "../../../interfaces/TypeAndVersionInterface.sol"; | ||
|
||
enum RegistryVersion { | ||
V12, | ||
V13, | ||
V20, | ||
V21, | ||
V23 | ||
} | ||
|
||
/** | ||
* @notice UpkeepTranscoder is a contract that allows converting upkeep data from previous registry versions to newer versions | ||
* @dev it currently only supports 2.3 -> 2.3 migrations | ||
*/ | ||
contract UpkeepTranscoder5_0 is UpkeepTranscoderInterfaceV2, TypeAndVersionInterface { | ||
error InvalidTranscoding(); | ||
|
||
string public constant override typeAndVersion = "UpkeepTranscoder 5.0.0"; | ||
|
||
/** | ||
* @notice transcodeUpkeeps transforms upkeep data from the format expected by | ||
* one registry to the format expected by another. It future-proofs migrations | ||
* by allowing automation team to customize migration paths and set sensible defaults | ||
* when new fields are added | ||
* @param fromVersion version the upkeep is migrating from | ||
* @param toVersion version the upkeep is migrating to | ||
* @param encodedUpkeeps encoded upkeep data | ||
* @dev this transcoder should ONLY be use for V23->V23 migrations for now | ||
*/ | ||
function transcodeUpkeeps( | ||
uint8 fromVersion, | ||
uint8 toVersion, | ||
bytes calldata encodedUpkeeps | ||
) external view override returns (bytes memory) { | ||
if (toVersion == uint8(RegistryVersion.V23) && fromVersion == uint8(RegistryVersion.V23)) { | ||
return encodedUpkeeps; | ||
} | ||
|
||
revert InvalidTranscoding(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...erated/automation_registry_logic_a_wrapper_2_3/automation_registry_logic_a_wrapper_2_3.go
Large diffs are not rendered by default.
Oops, something went wrong.
26 changes: 1 addition & 25 deletions
26
...ated/i_automation_registry_master_wrapper_2_3/i_automation_registry_master_wrapper_2_3.go
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters