-
Notifications
You must be signed in to change notification settings - Fork 857
Feat/##1369 withdraw from beacon chain part 1 - pi circuit #1634
Conversation
a130477
to
5c8f0d8
Compare
57db679
to
e2365d1
Compare
e2365d1
to
953da96
Compare
b389ad1
to
97193e8
Compare
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 some nitpicks, I will have a closer look tomorrow.
} | ||
|
||
impl WithdrawalContext { | ||
/// Return id of the this withdrawal. |
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.
Nitpick: redundant "the"
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.
fixed in 6301184
|
||
/// Reversible Write Counter tracks the number of write operations in the | ||
/// call. It is incremented when a sub-call in this call succeeds by the | ||
/// number of successful writes in the sub-call. |
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.
Nitpick: perhaps "when there are successful writes in the sub-call of this call."?
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.
fixed in 6301184
zkevm-circuits/src/pi_circuit.rs
Outdated
validator_id: u64, | ||
address: Address, | ||
amount: u64, | ||
rpi_bytes_keccakrlc: &mut Value<F>, |
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.
Nitpick: perhaps rpi_bytes_keccak_rlc
?
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.
fixed in 6301184
zkevm-circuits/src/pi_circuit.rs
Outdated
amount: u64, | ||
rpi_bytes_keccakrlc: &mut Value<F>, | ||
challenges: &Challenges<Value<F>>, | ||
current_offset: &mut usize, |
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.
Perhaps document what's the difference between offset
and current_offset
.
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.
current_offset
renamed to current_rpi_offset
and fixed in 6301184
zkevm-circuits/src/pi_circuit.rs
Outdated
id: u64, | ||
validator_id: u64, | ||
address: Address, | ||
amount: u64, |
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.
Perhaps use a struct Withdrawal
for id
, validator_id
, address
, amount
to reduce the number of arguments?
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.
fixed in 6301184
zkevm-circuits/src/instance.rs
Outdated
@@ -81,6 +82,8 @@ pub struct PublicData { | |||
pub history_hashes: Vec<Word>, | |||
/// Block Transactions | |||
pub transactions: Vec<Transaction>, | |||
/// Block Transactions |
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.
Nitpick: comment copied?
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.
fixed in 6301184
public_data: PublicData, | ||
) -> Result<(), Vec<VerifyFailure>> { | ||
let mut public_data = public_data; | ||
public_data.chain_id = *MOCK_CHAIN_ID; | ||
|
||
let circuit = PiCircuit::<F>::new(max_txs, max_calldata, public_data); | ||
let circuit = PiCircuit::<F>::new(max_txs,max_withdrawals, max_calldata, public_data); |
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.
Nitpick: indentation
/// Result of the parsing of an Ethereum Withdrawal. | ||
pub struct Withdrawal { | ||
/// Unique identifier of a withdrawal. This value starts from 0 and then increases | ||
/// monotonically. |
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.
Do we need a constraint that it starts from 0 (currently there is only for the increase by 1)?
However, it's a bit confusing because the specs say: "Which means it won't be starting from 0 in most of cases."
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.
The id is unique and monotonical which means there is only one withdrawal with id == 0
in all withdrawals history. For example, in block n, withdrawal id starts from 5 to 12. In block n + 1, withdrawal id will start from 13. That's why I said: "Which means it won't be starting from 0 in most of cases.". Does it make sense to you?
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.
Ok, cool! Perhaps change to Unique identifier of a withdrawal in the whole history of withdrawals.
?
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.
fixed in cad4ea4
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.
Overall looks nice, just raised few question & suggestions
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.
Overall LGTM! 👍 👍
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.
LGTM!
Description
1st part of #1369, mainly on pi circuit integration
Issue Link
#1369
Type of change
Contents
Withdrawal
struct definition andWdTable
implementationwithdrawals
andwithdrawal_root
in block structwd_table
assignment in pi circuit