This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 857
[proof chunk] introduce Padding virtual step #1718
Closed
hero78119
wants to merge
1
commit into
privacy-scaling-explorations:proof-chunk
from
hero78119:padding_step
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -371,20 +371,27 @@ impl CircuitInputBuilder<FixedCParams> { | |
self.set_end_chunk(max_rws); | ||
return; | ||
} | ||
|
||
// set end block | ||
let mut end_block_not_last = self.block.block_steps.end_block_not_last.clone(); | ||
let mut end_block_last = self.block.block_steps.end_block_last.clone(); | ||
end_block_not_last.rwc = self.block_ctx.rwc; | ||
end_block_last.rwc = self.block_ctx.rwc; | ||
end_block_not_last.rwc_inner_chunk = self | ||
.chunk_ctx | ||
.as_ref() | ||
.map_or_else(RWCounter::new, |chunk_ctx| chunk_ctx.rwc); | ||
end_block_last.rwc_inner_chunk = self | ||
// set padding | ||
let last_step = self | ||
.block | ||
.txs() | ||
.last() | ||
.map(|tx| tx.last_step()) | ||
.unwrap_or_else(|| &self.block.block_steps.padding); | ||
let mut padding = last_step.clone(); // padding step need to keep transition context | ||
padding.bus_mapping_instance = vec![]; // there is no rw in padding step | ||
padding.exec_state = ExecState::Padding; | ||
padding.rwc = self.block_ctx.rwc; | ||
padding.rwc_inner_chunk = self | ||
.chunk_ctx | ||
.as_ref() | ||
.map_or_else(RWCounter::new, |chunk_ctx| chunk_ctx.rwc); | ||
// TODO automatially assign all field | ||
|
||
// set end block | ||
let mut end_block = padding.clone(); | ||
end_block.exec_state = ExecState::EndBlock; | ||
|
||
let is_first_chunk = self | ||
.chunk_ctx | ||
.as_ref() | ||
|
@@ -395,7 +402,7 @@ impl CircuitInputBuilder<FixedCParams> { | |
|
||
if let Some(call_id) = state.block.txs.last().map(|tx| tx.calls[0].call_id) { | ||
state.call_context_read( | ||
&mut end_block_last, | ||
&mut end_block, | ||
call_id, | ||
CallContextField::TxId, | ||
Word::from(state.block.txs.len() as u64), | ||
|
@@ -421,7 +428,7 @@ impl CircuitInputBuilder<FixedCParams> { | |
if is_first_chunk { | ||
push_op( | ||
&mut state.block.container, | ||
&mut end_block_last, | ||
&mut end_block, | ||
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. why don't we just move |
||
RWCounter(1), | ||
RWCounter(1), | ||
RW::READ, | ||
|
@@ -433,7 +440,7 @@ impl CircuitInputBuilder<FixedCParams> { | |
let (padding_start, padding_end) = (total_rws + 1, max_rws - 1); | ||
push_op( | ||
&mut state.block.container, | ||
&mut end_block_last, | ||
&mut end_block, | ||
RWCounter(padding_start), | ||
RWCounter(padding_start), | ||
RW::READ, | ||
|
@@ -442,7 +449,7 @@ impl CircuitInputBuilder<FixedCParams> { | |
if padding_end != padding_start { | ||
push_op( | ||
&mut state.block.container, | ||
&mut end_block_last, | ||
&mut end_block, | ||
RWCounter(padding_end), | ||
RWCounter(padding_end), | ||
RW::READ, | ||
|
@@ -451,8 +458,8 @@ impl CircuitInputBuilder<FixedCParams> { | |
} | ||
} | ||
|
||
self.block.block_steps.end_block_not_last = end_block_not_last; | ||
self.block.block_steps.end_block_last = end_block_last; | ||
self.block.block_steps.padding = padding; | ||
self.block.block_steps.end_block = end_block; | ||
|
||
// set final rwc value to chunkctx | ||
if let Some(chunk_ctx) = self.chunk_ctx.as_mut() { | ||
|
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Heads up: here use last_step because it's at the end of block.
In chunking, we should use next_tx.first_step instead
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.
Just to make sure
this_tx.last_step
has the same transition witness asnext_tx.first_step
right?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.
No they are different. I thought we discussed this issue in Pr #1690 review section :)
Feel free to bring it up further if you thought it doenst make sense for why they different