Skip to content

Commit 7a3e2a4

Browse files
authored
fix(gateway-contracts): fix InputVerification/CiphertextCommits versions (#1236)
1 parent 82aa1f6 commit 7a3e2a4

File tree

6 files changed

+254
-61
lines changed

6 files changed

+254
-61
lines changed

gateway-contracts/contracts/CiphertextCommits.sol

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ contract CiphertextCommits is ICiphertextCommits, UUPSUpgradeableEmptyProxy, Gat
3838
*/
3939
string private constant CONTRACT_NAME = "CiphertextCommits";
4040
uint256 private constant MAJOR_VERSION = 0;
41-
uint256 private constant MINOR_VERSION = 1;
41+
uint256 private constant MINOR_VERSION = 2;
4242
uint256 private constant PATCH_VERSION = 0;
4343

4444
/**
@@ -47,7 +47,7 @@ contract CiphertextCommits is ICiphertextCommits, UUPSUpgradeableEmptyProxy, Gat
4747
* This constant does not represent the number of time a specific contract have been upgraded,
4848
* as a contract deployed from version VX will have a REINITIALIZER_VERSION > 2.
4949
*/
50-
uint64 private constant REINITIALIZER_VERSION = 2;
50+
uint64 private constant REINITIALIZER_VERSION = 3;
5151

5252
/**
5353
* @notice The contract's variable storage struct (@dev see ERC-7201)
@@ -110,11 +110,10 @@ contract CiphertextCommits is ICiphertextCommits, UUPSUpgradeableEmptyProxy, Gat
110110

111111
/**
112112
* @notice Re-initializes the contract from V1.
113-
* @dev Define a `reinitializeVX` function once the contract needs to be upgraded.
114113
*/
115114
/// @custom:oz-upgrades-unsafe-allow missing-initializer-call
116115
/// @custom:oz-upgrades-validate-as-initializer
117-
// function reinitializeV2() public virtual reinitializer(REINITIALIZER_VERSION) {}
116+
function reinitializeV2() public virtual reinitializer(REINITIALIZER_VERSION) {}
118117

119118
/**
120119
* @notice See {ICiphertextCommits-addCiphertextMaterial}.

gateway-contracts/contracts/InputVerification.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ contract InputVerification is
7878
*/
7979
string private constant CONTRACT_NAME = "InputVerification";
8080
uint256 private constant MAJOR_VERSION = 0;
81-
uint256 private constant MINOR_VERSION = 3;
81+
uint256 private constant MINOR_VERSION = 2;
8282
uint256 private constant PATCH_VERSION = 0;
8383

8484
/**
@@ -87,7 +87,7 @@ contract InputVerification is
8787
* This constant does not represent the number of time a specific contract have been upgraded,
8888
* as a contract deployed from version VX will have a REINITIALIZER_VERSION > 2.
8989
*/
90-
uint64 private constant REINITIALIZER_VERSION = 4;
90+
uint64 private constant REINITIALIZER_VERSION = 3;
9191

9292
/**
9393
* @notice The contract's variable storage struct (@dev see ERC-7201)
@@ -160,11 +160,11 @@ contract InputVerification is
160160
}
161161

162162
/**
163-
* @notice Re-initializes the contract from V2.
163+
* @notice Re-initializes the contract from V1.
164164
*/
165165
/// @custom:oz-upgrades-unsafe-allow missing-initializer-call
166166
/// @custom:oz-upgrades-validate-as-initializer
167-
function reinitializeV3() public virtual reinitializer(REINITIALIZER_VERSION) {}
167+
function reinitializeV2() public virtual reinitializer(REINITIALIZER_VERSION) {}
168168

169169
/**
170170
* @notice See {IInputVerification-verifyProofRequest}.

gateway-contracts/rust_bindings/src/ciphertext_commits.rs

Lines changed: 195 additions & 5 deletions
Large diffs are not rendered by default.

gateway-contracts/rust_bindings/src/input_verification.rs

Lines changed: 44 additions & 44 deletions
Large diffs are not rendered by default.

gateway-contracts/selectors.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ CiphertextCommits
2121
|----------+----------------------------------------------------------+--------------------------------------------------------------------|
2222
| Function | proxiableUUID() | 0x52d1902d |
2323
|----------+----------------------------------------------------------+--------------------------------------------------------------------|
24+
| Function | reinitializeV2() | 0xc4115874 |
25+
|----------+----------------------------------------------------------+--------------------------------------------------------------------|
2426
| Function | upgradeToAndCall(address,bytes) | 0x4f1ef286 |
2527
|----------+----------------------------------------------------------+--------------------------------------------------------------------|
2628
| Event | AddCiphertextMaterial(bytes32,bytes32,bytes32,address[]) | 0xcb89ccb347018d7f282bb4c048e135e19bc1d13660fa0f2850e10518422536de |
@@ -442,7 +444,7 @@ InputVerification
442444
|----------+-----------------------------------------------------------------+--------------------------------------------------------------------|
443445
| Function | proxiableUUID() | 0x52d1902d |
444446
|----------+-----------------------------------------------------------------+--------------------------------------------------------------------|
445-
| Function | reinitializeV3() | 0xbac22bb8 |
447+
| Function | reinitializeV2() | 0xc4115874 |
446448
|----------+-----------------------------------------------------------------+--------------------------------------------------------------------|
447449
| Function | rejectProofResponse(uint256,bytes) | 0x338007fc |
448450
|----------+-----------------------------------------------------------------+--------------------------------------------------------------------|
@@ -851,6 +853,8 @@ CiphertextCommitsV2Example
851853
|----------+----------------------------------------------------------+--------------------------------------------------------------------|
852854
| Function | proxiableUUID() | 0x52d1902d |
853855
|----------+----------------------------------------------------------+--------------------------------------------------------------------|
856+
| Function | reinitializeV2() | 0xc4115874 |
857+
|----------+----------------------------------------------------------+--------------------------------------------------------------------|
854858
| Function | upgradeToAndCall(address,bytes) | 0x4f1ef286 |
855859
|----------+----------------------------------------------------------+--------------------------------------------------------------------|
856860
| Event | AddCiphertextMaterial(bytes32,bytes32,bytes32,address[]) | 0xcb89ccb347018d7f282bb4c048e135e19bc1d13660fa0f2850e10518422536de |
@@ -1272,7 +1276,7 @@ InputVerificationV2Example
12721276
|----------+-----------------------------------------------------------------+--------------------------------------------------------------------|
12731277
| Function | proxiableUUID() | 0x52d1902d |
12741278
|----------+-----------------------------------------------------------------+--------------------------------------------------------------------|
1275-
| Function | reinitializeV3() | 0xbac22bb8 |
1279+
| Function | reinitializeV2() | 0xc4115874 |
12761280
|----------+-----------------------------------------------------------------+--------------------------------------------------------------------|
12771281
| Function | rejectProofResponse(uint256,bytes) | 0x338007fc |
12781282
|----------+-----------------------------------------------------------------+--------------------------------------------------------------------|

gateway-contracts/test/upgrades/upgrades.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describe("Upgrades", function () {
8888
});
8989
const ciphertextCommits = await upgrades.upgradeProxy(emptyUUPS, ciphertextCommitsFactoryV1);
9090
await ciphertextCommits.waitForDeployment();
91-
expect(await ciphertextCommits.getVersion()).to.equal("CiphertextCommits v0.1.0");
91+
expect(await ciphertextCommits.getVersion()).to.equal("CiphertextCommits v0.2.0");
9292
const ciphertextCommitsV2 = await upgrades.upgradeProxy(ciphertextCommits, ciphertextCommitsFactoryV2);
9393
await ciphertextCommitsV2.waitForDeployment();
9494
expect(await ciphertextCommitsV2.getVersion()).to.equal("CiphertextCommits v1000.0.0");
@@ -140,7 +140,7 @@ describe("Upgrades", function () {
140140
});
141141
const inputVerification = await upgrades.upgradeProxy(emptyUUPS, inputVerificationFactoryV1);
142142
await inputVerification.waitForDeployment();
143-
expect(await inputVerification.getVersion()).to.equal("InputVerification v0.3.0");
143+
expect(await inputVerification.getVersion()).to.equal("InputVerification v0.2.0");
144144
const inputVerificationV2 = await upgrades.upgradeProxy(inputVerification, inputVerificationFactoryV2);
145145
await inputVerificationV2.waitForDeployment();
146146
expect(await inputVerificationV2.getVersion()).to.equal("InputVerification v1000.0.0");

0 commit comments

Comments
 (0)