Skip to content

Commit 21252c9

Browse files
authored
chore: remove .oldValue in contract state update request (AztecProtocol#4499)
1 parent 5ae1e12 commit 21252c9

30 files changed

Lines changed: 959 additions & 1641 deletions

l1-contracts/src/core/libraries/ConstantsGen.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ library Constants {
9292
uint256 internal constant CONTRACT_DEPLOYMENT_DATA_LENGTH = 6;
9393
uint256 internal constant PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 207;
9494
uint256 internal constant PRIVATE_CALL_STACK_ITEM_LENGTH = 212;
95-
uint256 internal constant CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH = 3;
95+
uint256 internal constant CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH = 2;
9696
uint256 internal constant CONTRACT_STORAGE_READ_LENGTH = 2;
97-
uint256 internal constant PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 203;
97+
uint256 internal constant PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 187;
9898
uint256 internal constant GET_NOTES_ORACLE_RETURN_LENGTH = 674;
9999
uint256 internal constant COMMITMENTS_NUM_BYTES_PER_BASE_ROLLUP = 2048;
100100
uint256 internal constant NULLIFIERS_NUM_BYTES_PER_BASE_ROLLUP = 2048;

yarn-project/circuits.js/src/abis/__snapshots__/abis.test.ts.snap

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`abis Computes a callstack item hash 1`] = `"0x17095bbb9e3e104dc520b6eec9338e9b6ce1fdc0f3a66b06d5ca90b15909ad0e"`;
3+
exports[`abis Computes a callstack item hash 1`] = `"0x02a4d04a7aa77e376045f3682b0cabe4bced0a8bd7f3fc52814bd7bf40e5259d"`;
44

5-
exports[`abis Computes a callstack item request hash 1`] = `"0x28cb4c264eb11e13c77a5e60b251a6b3edfb4cfed786c4f1ec5e1749fede9b78"`;
5+
exports[`abis Computes a callstack item request hash 1`] = `"0x2ef4ba9f3dde0e10bb1c86776035ca9ea025609b20613e879d8987971223c34a"`;
66

77
exports[`abis Computes an empty nullifier hash 1`] = `"0x066e6cdc4a6ba5e4781deda650b0be6c12f975f064fc38df72c1060716759b17"`;
88

99
exports[`abis Computes an empty sideeffect hash 1`] = `"0x27b1d0839a5b23baf12a8d195b18ac288fcf401afb2f70b8a4b529ede5fa9fed"`;
1010

1111
exports[`abis compute public call stack item hash 1`] = `
1212
Fr {
13-
"asBigInt": 6902726350534637945034037933577508446422215007904358955522461123516426791152n,
13+
"asBigInt": 583757710252284494516546627711999904651312004856532836086445399930713657189n,
1414
"asBuffer": {
1515
"data": [
16-
15,
17-
66,
18-
205,
19-
254,
20-
91,
21-
241,
16+
1,
17+
74,
2218
101,
23-
117,
24-
214,
25-
154,
26-
136,
27-
128,
28-
223,
29-
11,
30-
120,
31-
249,
32-
245,
33-
174,
34-
102,
35-
132,
36-
69,
37-
153,
19+
40,
20+
228,
21+
207,
22+
104,
23+
103,
24+
139,
25+
74,
26+
227,
27+
198,
28+
157,
29+
67,
30+
210,
31+
33,
32+
142,
33+
79,
34+
97,
35+
166,
36+
39,
3837
88,
39-
179,
40-
36,
41-
144,
42-
98,
43-
110,
44-
24,
45-
250,
46-
168,
47-
240,
38+
163,
39+
197,
40+
164,
41+
77,
42+
158,
43+
105,
44+
31,
45+
67,
46+
207,
47+
101,
4848
],
4949
"type": "Buffer",
5050
},

yarn-project/circuits.js/src/constants.gen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ export const FUNCTION_DATA_LENGTH = 4;
7878
export const CONTRACT_DEPLOYMENT_DATA_LENGTH = 6;
7979
export const PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 207;
8080
export const PRIVATE_CALL_STACK_ITEM_LENGTH = 212;
81-
export const CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH = 3;
81+
export const CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH = 2;
8282
export const CONTRACT_STORAGE_READ_LENGTH = 2;
83-
export const PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 203;
83+
export const PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 187;
8484
export const GET_NOTES_ORACLE_RETURN_LENGTH = 674;
8585
export const COMMITMENTS_NUM_BYTES_PER_BASE_ROLLUP = 2048;
8686
export const NULLIFIERS_NUM_BYTES_PER_BASE_ROLLUP = 2048;

yarn-project/circuits.js/src/structs/__snapshots__/public_call_stack_item.test.ts.snap

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,41 @@
22

33
exports[`PublicCallStackItem computes hash 1`] = `
44
Fr {
5-
"asBigInt": 19395696808724235586564354338261030411639537309350164360825567543448743585810n,
5+
"asBigInt": 4461704375521072952584779257251958900536458744959756270131881896949000508985n,
66
"asBuffer": {
77
"data": [
8-
42,
9-
225,
10-
147,
11-
74,
12-
255,
13-
117,
14-
70,
15-
214,
16-
242,
17-
250,
18-
92,
19-
118,
20-
98,
8+
9,
9+
221,
10+
60,
11+
53,
12+
31,
13+
80,
14+
50,
15+
39,
16+
122,
17+
36,
18+
109,
2119
92,
20+
28,
21+
126,
22+
53,
23+
44,
24+
114,
25+
204,
26+
213,
27+
245,
2228
21,
23-
18,
29+
210,
2430
34,
25-
226,
26-
246,
27-
182,
28-
119,
29-
107,
30-
40,
31-
145,
32-
163,
33-
218,
34-
248,
35-
163,
36-
143,
37-
58,
38-
40,
39-
18,
31+
116,
32+
17,
33+
158,
34+
3,
35+
80,
36+
70,
37+
153,
38+
22,
39+
57,
4040
],
4141
"type": "Buffer",
4242
},

yarn-project/circuits.js/src/structs/__snapshots__/public_circuit_public_inputs.test.ts.snap

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,41 @@
22

33
exports[`PublicCircuitPublicInputs hash matches snapshot 1`] = `
44
Fr {
5-
"asBigInt": 18998488698478370909936348553101901315705060100426498604017308046889259543837n,
5+
"asBigInt": 12419215527986432358230396681673926997504506530476956067841000382649139000986n,
66
"asBuffer": {
77
"data": [
8-
42,
9-
0,
10-
195,
11-
119,
12-
87,
13-
116,
14-
9,
15-
251,
16-
84,
17-
111,
18-
49,
19-
221,
20-
110,
21-
21,
22-
211,
23-
9,
24-
191,
8+
27,
9+
117,
10+
6,
11+
226,
12+
59,
13+
47,
14+
237,
15+
104,
2516
82,
26-
247,
27-
169,
28-
39,
29-
25,
30-
140,
31-
78,
32-
50,
33-
138,
17+
239,
3418
231,
35-
209,
36-
33,
37-
158,
38-
173,
39-
29,
19+
47,
20+
136,
21+
144,
22+
176,
23+
235,
24+
232,
25+
251,
26+
192,
27+
154,
28+
255,
29+
204,
30+
140,
31+
11,
32+
118,
33+
57,
34+
164,
35+
95,
36+
185,
37+
100,
38+
246,
39+
154,
4040
],
4141
"type": "Buffer",
4242
},

yarn-project/circuits.js/src/structs/contract_storage_update_request.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ export class ContractStorageUpdateRequest {
1414
* Storage slot we are updating.
1515
*/
1616
public readonly storageSlot: Fr,
17-
/**
18-
* Old value of the storage slot.
19-
*/
20-
public readonly oldValue: Fr,
2117
/**
2218
* New value of the storage slot.
2319
*/
@@ -29,12 +25,12 @@ export class ContractStorageUpdateRequest {
2925
) {}
3026

3127
toBuffer() {
32-
return serializeToBuffer(this.storageSlot, this.oldValue, this.newValue);
28+
return serializeToBuffer(this.storageSlot, this.newValue);
3329
}
3430

3531
static fromBuffer(buffer: Buffer | BufferReader) {
3632
const reader = BufferReader.asReader(buffer);
37-
return new ContractStorageUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader));
33+
return new ContractStorageUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader));
3834
}
3935

4036
/**
@@ -52,32 +48,31 @@ export class ContractStorageUpdateRequest {
5248
* @returns The array.
5349
*/
5450
static getFields(fields: FieldsOf<ContractStorageUpdateRequest>) {
55-
return [fields.storageSlot, fields.oldValue, fields.newValue, fields.sideEffectCounter] as const;
51+
return [fields.storageSlot, fields.newValue, fields.sideEffectCounter] as const;
5652
}
5753

5854
static empty() {
59-
return new ContractStorageUpdateRequest(Fr.ZERO, Fr.ZERO, Fr.ZERO);
55+
return new ContractStorageUpdateRequest(Fr.ZERO, Fr.ZERO);
6056
}
6157

6258
isEmpty() {
63-
return this.storageSlot.isZero() && this.oldValue.isZero() && this.newValue.isZero();
59+
return this.storageSlot.isZero() && this.newValue.isZero();
6460
}
6561

6662
toFriendlyJSON() {
67-
return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.oldValue.toFriendlyJSON()} => ${this.newValue.toFriendlyJSON()}`;
63+
return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.newValue.toFriendlyJSON()}`;
6864
}
6965

7066
toFields(): Fr[] {
71-
return [this.storageSlot, this.oldValue, this.newValue];
67+
return [this.storageSlot, this.newValue];
7268
}
7369

7470
static fromFields(fields: Fr[] | FieldReader): ContractStorageUpdateRequest {
7571
const reader = FieldReader.asReader(fields);
7672

7773
const storageSlot = reader.readField();
78-
const oldValue = reader.readField();
7974
const newValue = reader.readField();
8075

81-
return new ContractStorageUpdateRequest(storageSlot, oldValue, newValue);
76+
return new ContractStorageUpdateRequest(storageSlot, newValue);
8277
}
8378
}

yarn-project/circuits.js/src/structs/kernel/combined_accumulated_data.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@ export class PublicDataUpdateRequest {
124124
* Index of the leaf in the public data tree which is to be updated.
125125
*/
126126
public readonly leafSlot: Fr,
127-
/**
128-
* Old value of the leaf.
129-
*/
130-
public readonly oldValue: Fr,
131127
/**
132128
* New value of the leaf.
133129
*/
@@ -143,33 +139,29 @@ export class PublicDataUpdateRequest {
143139
* Index of the leaf in the public data tree which is to be updated.
144140
*/
145141
leafIndex: Fr;
146-
/**
147-
* Old value of the leaf.
148-
*/
149-
oldValue: Fr;
150142
/**
151143
* New value of the leaf.
152144
*/
153145
newValue: Fr;
154146
}) {
155-
return new PublicDataUpdateRequest(args.leafIndex, args.oldValue, args.newValue);
147+
return new PublicDataUpdateRequest(args.leafIndex, args.newValue);
156148
}
157149

158150
toBuffer() {
159-
return serializeToBuffer(this.leafSlot, this.oldValue, this.newValue);
151+
return serializeToBuffer(this.leafSlot, this.newValue);
160152
}
161153

162154
static fromBuffer(buffer: Buffer | BufferReader) {
163155
const reader = BufferReader.asReader(buffer);
164-
return new PublicDataUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader));
156+
return new PublicDataUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader));
165157
}
166158

167159
static empty() {
168-
return new PublicDataUpdateRequest(Fr.ZERO, Fr.ZERO, Fr.ZERO);
160+
return new PublicDataUpdateRequest(Fr.ZERO, Fr.ZERO);
169161
}
170162

171163
toFriendlyJSON() {
172-
return `Leaf=${this.leafSlot.toFriendlyJSON()}: ${this.oldValue.toFriendlyJSON()} => ${this.newValue.toFriendlyJSON()}`;
164+
return `Leaf=${this.leafSlot.toFriendlyJSON()}: ${this.newValue.toFriendlyJSON()}`;
173165
}
174166
}
175167

yarn-project/circuits.js/src/tests/factories.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,15 @@ function makeNullifierKeyValidationRequestContext(seed: number): NullifierKeyVal
190190
* @returns A public data update request.
191191
*/
192192
export function makePublicDataUpdateRequest(seed = 1): PublicDataUpdateRequest {
193-
return new PublicDataUpdateRequest(fr(seed), fr(seed + 1), fr(seed + 2));
193+
return new PublicDataUpdateRequest(fr(seed), fr(seed + 1));
194194
}
195195

196196
/**
197197
* Creates empty public data update request.
198198
* @returns An empty public data update request.
199199
*/
200200
export function makeEmptyPublicDataUpdateRequest(): PublicDataUpdateRequest {
201-
return new PublicDataUpdateRequest(fr(0), fr(0), fr(0));
201+
return new PublicDataUpdateRequest(fr(0), fr(0));
202202
}
203203

204204
/**
@@ -224,7 +224,7 @@ export function makeEmptyPublicDataRead(): PublicDataRead {
224224
* @returns A contract storage update request.
225225
*/
226226
export function makeContractStorageUpdateRequest(seed = 1): ContractStorageUpdateRequest {
227-
return new ContractStorageUpdateRequest(fr(seed), fr(seed + 1), fr(seed + 2));
227+
return new ContractStorageUpdateRequest(fr(seed), fr(seed + 1));
228228
}
229229

230230
/**

0 commit comments

Comments
 (0)