-
Notifications
You must be signed in to change notification settings - Fork 296
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: make public data update requests, note hashes, and unencrypted logs readonly in TS #6658
Changes from all commits
f779eda
2165f08
92fb2c9
d6d96ee
f8e5e1e
3aec50d
dca09ce
f34601a
62f7835
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -548,23 +548,32 @@ mod tests { | |
} | ||
|
||
#[test] | ||
unconstrained fn correctly_updates_revert_code() { | ||
unconstrained fn correctly_updates_revert_code_0() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I needed to split this into multiple tests because I was getting a panic on "stack too deep". |
||
let mut builder = PublicKernelTeardownCircuitPrivateInputsBuilder::new(); | ||
let public_inputs = builder.execute(); | ||
assert_eq(public_inputs.revert_code, 0); | ||
} | ||
|
||
#[test] | ||
unconstrained fn correctly_updates_revert_code_1() { | ||
// Case where we carry forward a revert code from app logic | ||
let mut builder = PublicKernelTeardownCircuitPrivateInputsBuilder::new(); | ||
builder.previous_kernel.revert_code = 1; | ||
let public_inputs = builder.execute(); | ||
assert_eq(public_inputs.revert_code, 1); | ||
} | ||
|
||
#[test] | ||
unconstrained fn correctly_updates_revert_code_2() { | ||
// Case where there is a new error in teardown | ||
let mut builder = PublicKernelTeardownCircuitPrivateInputsBuilder::new(); | ||
builder.public_call.public_inputs.revert_code = 1; | ||
let public_inputs = builder.execute(); | ||
assert_eq(public_inputs.revert_code, 2); | ||
} | ||
|
||
#[test] | ||
unconstrained fn correctly_updates_revert_code_3() { | ||
// Case where there is an error in both app logic and teardown | ||
let mut builder = PublicKernelTeardownCircuitPrivateInputsBuilder::new(); | ||
builder.previous_kernel.revert_code = 1; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,7 +273,7 @@ impl BaseRollupInputs { | |
); | ||
|
||
let new_value = compute_public_data_tree_value(existing_update.new_value - tx_fee); | ||
let protocol_update_request = PublicDataUpdateRequest { leaf_slot, new_value }; | ||
let protocol_update_request = PublicDataUpdateRequest { leaf_slot, new_value, counter: 0 }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably worth a comment in the code, but by the time we're in the base rollup, we don't care about the counters, which is why we arbitrarily set it to 0. |
||
(protocol_update_request, existing_update_index as u64) | ||
} else { | ||
// Otherwise, build a new one to be inserted into the protocol update requests at the end of the array. | ||
|
@@ -284,7 +284,7 @@ impl BaseRollupInputs { | |
assert(!balance.lt(tx_fee), "Not enough balance for fee payer to pay for transaction"); | ||
|
||
let new_value = compute_public_data_tree_value(balance - tx_fee); | ||
let protocol_update_request = PublicDataUpdateRequest { leaf_slot, new_value }; | ||
let protocol_update_request = PublicDataUpdateRequest { leaf_slot, new_value, counter: 0 }; | ||
(protocol_update_request, MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX) | ||
} | ||
} else { | ||
|
@@ -505,6 +505,7 @@ mod tests { | |
kernel_data.public_inputs.end.public_data_update_requests[i] = PublicDataUpdateRequest { | ||
leaf_slot : leaf.slot, | ||
new_value : leaf.value, | ||
counter : 0 | ||
}; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Dead comment. I will remove in the next PR.