Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove .oldValue in contract state update request #4499

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ library Constants {
uint256 internal constant CONTRACT_DEPLOYMENT_DATA_LENGTH = 6;
uint256 internal constant PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 207;
uint256 internal constant PRIVATE_CALL_STACK_ITEM_LENGTH = 212;
uint256 internal constant CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH = 3;
uint256 internal constant CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH = 2;
uint256 internal constant CONTRACT_STORAGE_READ_LENGTH = 2;
uint256 internal constant PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 203;
uint256 internal constant PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 187;
uint256 internal constant GET_NOTES_ORACLE_RETURN_LENGTH = 674;
uint256 internal constant COMMITMENTS_NUM_BYTES_PER_BASE_ROLLUP = 2048;
uint256 internal constant NULLIFIERS_NUM_BYTES_PER_BASE_ROLLUP = 2048;
Expand Down
66 changes: 33 additions & 33 deletions yarn-project/circuits.js/src/abis/__snapshots__/abis.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

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

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

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

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

exports[`abis compute public call stack item hash 1`] = `
Fr {
"asBigInt": 6902726350534637945034037933577508446422215007904358955522461123516426791152n,
"asBigInt": 583757710252284494516546627711999904651312004856532836086445399930713657189n,
"asBuffer": {
"data": [
15,
66,
205,
254,
91,
241,
1,
74,
101,
117,
214,
154,
136,
128,
223,
11,
120,
249,
245,
174,
102,
132,
69,
153,
40,
228,
207,
104,
103,
139,
74,
227,
198,
157,
67,
210,
33,
142,
79,
97,
166,
39,
88,
179,
36,
144,
98,
110,
24,
250,
168,
240,
163,
197,
164,
77,
158,
105,
31,
67,
207,
101,
],
"type": "Buffer",
},
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/circuits.js/src/constants.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ export const FUNCTION_DATA_LENGTH = 4;
export const CONTRACT_DEPLOYMENT_DATA_LENGTH = 6;
export const PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = 207;
export const PRIVATE_CALL_STACK_ITEM_LENGTH = 212;
export const CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH = 3;
export const CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH = 2;
export const CONTRACT_STORAGE_READ_LENGTH = 2;
export const PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 203;
export const PUBLIC_CIRCUIT_PUBLIC_INPUTS_LENGTH = 187;
export const GET_NOTES_ORACLE_RETURN_LENGTH = 674;
export const COMMITMENTS_NUM_BYTES_PER_BASE_ROLLUP = 2048;
export const NULLIFIERS_NUM_BYTES_PER_BASE_ROLLUP = 2048;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@

exports[`PublicCallStackItem computes hash 1`] = `
Fr {
"asBigInt": 19395696808724235586564354338261030411639537309350164360825567543448743585810n,
"asBigInt": 4461704375521072952584779257251958900536458744959756270131881896949000508985n,
"asBuffer": {
"data": [
42,
225,
147,
74,
255,
117,
70,
214,
242,
250,
92,
118,
98,
9,
221,
60,
53,
31,
80,
50,
39,
122,
36,
109,
92,
28,
126,
53,
44,
114,
204,
213,
245,
21,
18,
210,
34,
226,
246,
182,
119,
107,
40,
145,
163,
218,
248,
163,
143,
58,
40,
18,
116,
17,
158,
3,
80,
70,
153,
22,
57,
],
"type": "Buffer",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@

exports[`PublicCircuitPublicInputs hash matches snapshot 1`] = `
Fr {
"asBigInt": 18998488698478370909936348553101901315705060100426498604017308046889259543837n,
"asBigInt": 12419215527986432358230396681673926997504506530476956067841000382649139000986n,
"asBuffer": {
"data": [
42,
0,
195,
119,
87,
116,
9,
251,
84,
111,
49,
221,
110,
21,
211,
9,
191,
27,
117,
6,
226,
59,
47,
237,
104,
82,
247,
169,
39,
25,
140,
78,
50,
138,
239,
231,
209,
33,
158,
173,
29,
47,
136,
144,
176,
235,
232,
251,
192,
154,
255,
204,
140,
11,
118,
57,
164,
95,
185,
100,
246,
154,
],
"type": "Buffer",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ export class ContractStorageUpdateRequest {
* Storage slot we are updating.
*/
public readonly storageSlot: Fr,
/**
* Old value of the storage slot.
*/
public readonly oldValue: Fr,
/**
* New value of the storage slot.
*/
Expand All @@ -29,12 +25,12 @@ export class ContractStorageUpdateRequest {
) {}

toBuffer() {
return serializeToBuffer(this.storageSlot, this.oldValue, this.newValue);
return serializeToBuffer(this.storageSlot, this.newValue);
}

static fromBuffer(buffer: Buffer | BufferReader) {
const reader = BufferReader.asReader(buffer);
return new ContractStorageUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader));
return new ContractStorageUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader));
}

/**
Expand All @@ -52,32 +48,31 @@ export class ContractStorageUpdateRequest {
* @returns The array.
*/
static getFields(fields: FieldsOf<ContractStorageUpdateRequest>) {
return [fields.storageSlot, fields.oldValue, fields.newValue, fields.sideEffectCounter] as const;
return [fields.storageSlot, fields.newValue, fields.sideEffectCounter] as const;
}

static empty() {
return new ContractStorageUpdateRequest(Fr.ZERO, Fr.ZERO, Fr.ZERO);
return new ContractStorageUpdateRequest(Fr.ZERO, Fr.ZERO);
}

isEmpty() {
return this.storageSlot.isZero() && this.oldValue.isZero() && this.newValue.isZero();
return this.storageSlot.isZero() && this.newValue.isZero();
}

toFriendlyJSON() {
return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.oldValue.toFriendlyJSON()} => ${this.newValue.toFriendlyJSON()}`;
return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.newValue.toFriendlyJSON()}`;
}

toFields(): Fr[] {
return [this.storageSlot, this.oldValue, this.newValue];
return [this.storageSlot, this.newValue];
}

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

const storageSlot = reader.readField();
const oldValue = reader.readField();
const newValue = reader.readField();

return new ContractStorageUpdateRequest(storageSlot, oldValue, newValue);
return new ContractStorageUpdateRequest(storageSlot, newValue);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ export class PublicDataUpdateRequest {
* Index of the leaf in the public data tree which is to be updated.
*/
public readonly leafSlot: Fr,
/**
* Old value of the leaf.
*/
public readonly oldValue: Fr,
/**
* New value of the leaf.
*/
Expand All @@ -143,33 +139,29 @@ export class PublicDataUpdateRequest {
* Index of the leaf in the public data tree which is to be updated.
*/
leafIndex: Fr;
/**
* Old value of the leaf.
*/
oldValue: Fr;
/**
* New value of the leaf.
*/
newValue: Fr;
}) {
return new PublicDataUpdateRequest(args.leafIndex, args.oldValue, args.newValue);
return new PublicDataUpdateRequest(args.leafIndex, args.newValue);
}

toBuffer() {
return serializeToBuffer(this.leafSlot, this.oldValue, this.newValue);
return serializeToBuffer(this.leafSlot, this.newValue);
}

static fromBuffer(buffer: Buffer | BufferReader) {
const reader = BufferReader.asReader(buffer);
return new PublicDataUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader));
return new PublicDataUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader));
}

static empty() {
return new PublicDataUpdateRequest(Fr.ZERO, Fr.ZERO, Fr.ZERO);
return new PublicDataUpdateRequest(Fr.ZERO, Fr.ZERO);
}

toFriendlyJSON() {
return `Leaf=${this.leafSlot.toFriendlyJSON()}: ${this.oldValue.toFriendlyJSON()} => ${this.newValue.toFriendlyJSON()}`;
return `Leaf=${this.leafSlot.toFriendlyJSON()}: ${this.newValue.toFriendlyJSON()}`;
}
}

Expand Down
6 changes: 3 additions & 3 deletions yarn-project/circuits.js/src/tests/factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ function makeNullifierKeyValidationRequestContext(seed: number): NullifierKeyVal
* @returns A public data update request.
*/
export function makePublicDataUpdateRequest(seed = 1): PublicDataUpdateRequest {
return new PublicDataUpdateRequest(fr(seed), fr(seed + 1), fr(seed + 2));
return new PublicDataUpdateRequest(fr(seed), fr(seed + 1));
}

/**
* Creates empty public data update request.
* @returns An empty public data update request.
*/
export function makeEmptyPublicDataUpdateRequest(): PublicDataUpdateRequest {
return new PublicDataUpdateRequest(fr(0), fr(0), fr(0));
return new PublicDataUpdateRequest(fr(0), fr(0));
}

/**
Expand All @@ -224,7 +224,7 @@ export function makeEmptyPublicDataRead(): PublicDataRead {
* @returns A contract storage update request.
*/
export function makeContractStorageUpdateRequest(seed = 1): ContractStorageUpdateRequest {
return new ContractStorageUpdateRequest(fr(seed), fr(seed + 1), fr(seed + 2));
return new ContractStorageUpdateRequest(fr(seed), fr(seed + 1));
}

/**
Expand Down
Loading
Loading