mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-03 14:23:07 +00:00
Add ERC721 test (#1425)
* Add ERC721 test * Add IS_READ column to BytePacking CTL * Apply comment
This commit is contained in:
parent
a64311cfd4
commit
68b9f0ad1c
@ -76,7 +76,7 @@ pub(crate) fn ctl_looked_data<F: Field>() -> Vec<Column<F>> {
|
||||
(0..NUM_BYTES).map(|i| (index_len(i), F::from_canonical_usize(i + 1))),
|
||||
);
|
||||
|
||||
Column::singles([ADDR_CONTEXT, ADDR_SEGMENT, ADDR_VIRTUAL])
|
||||
Column::singles([IS_READ, ADDR_CONTEXT, ADDR_SEGMENT, ADDR_VIRTUAL])
|
||||
.chain([sequence_len])
|
||||
.chain(Column::singles(&[TIMESTAMP]))
|
||||
.chain(outputs)
|
||||
|
||||
@ -127,7 +127,9 @@ pub(crate) fn ctl_arithmetic_base_rows<F: Field>() -> TableWithColumns<F> {
|
||||
/// Creates the vector of `Columns` corresponding to the contents of General Purpose channels when calling byte packing.
|
||||
/// We use `ctl_data_keccak_sponge` because the `Columns` are the same as the ones computed for `KeccakSpongeStark`.
|
||||
pub(crate) fn ctl_data_byte_packing<F: Field>() -> Vec<Column<F>> {
|
||||
ctl_data_keccak_sponge()
|
||||
let mut res = vec![Column::constant(F::ONE)]; // is_read
|
||||
res.extend(ctl_data_keccak_sponge());
|
||||
res
|
||||
}
|
||||
|
||||
/// CTL filter for the `MLOAD_32BYTES` operation.
|
||||
@ -144,6 +146,8 @@ pub(crate) fn ctl_filter_byte_packing<F: Field>() -> Filter<F> {
|
||||
|
||||
/// Creates the vector of `Columns` corresponding to the contents of General Purpose channels when calling byte unpacking.
|
||||
pub(crate) fn ctl_data_byte_unpacking<F: Field>() -> Vec<Column<F>> {
|
||||
let is_read = Column::constant(F::ZERO);
|
||||
|
||||
// When executing MSTORE_32BYTES, the GP memory channels are used as follows:
|
||||
// GP channel 0: stack[-1] = context
|
||||
// GP channel 1: stack[-2] = segment
|
||||
@ -165,7 +169,7 @@ pub(crate) fn ctl_data_byte_unpacking<F: Field>() -> Vec<Column<F>> {
|
||||
let num_channels = F::from_canonical_usize(NUM_CHANNELS);
|
||||
let timestamp = Column::linear_combination([(COL_MAP.clock, num_channels)]);
|
||||
|
||||
let mut res = vec![context, segment, virt, len, timestamp];
|
||||
let mut res = vec![is_read, context, segment, virt, len, timestamp];
|
||||
res.extend(val);
|
||||
|
||||
res
|
||||
@ -186,6 +190,7 @@ pub(crate) fn ctl_filter_byte_unpacking<F: Field>() -> Filter<F> {
|
||||
/// Creates the vector of `Columns` corresponding to the contents of the CPU registers when performing a `PUSH`.
|
||||
/// `PUSH` internal reads are done by calling `BytePackingStark`.
|
||||
pub(crate) fn ctl_data_byte_packing_push<F: Field>() -> Vec<Column<F>> {
|
||||
let is_read = Column::constant(F::ONE);
|
||||
let context = Column::single(COL_MAP.code_context);
|
||||
let segment = Column::constant(F::from_canonical_usize(Segment::Code as usize));
|
||||
// The initial offset if `pc + 1`.
|
||||
@ -199,7 +204,7 @@ pub(crate) fn ctl_data_byte_packing_push<F: Field>() -> Vec<Column<F>> {
|
||||
let num_channels = F::from_canonical_usize(NUM_CHANNELS);
|
||||
let timestamp = Column::linear_combination([(COL_MAP.clock, num_channels)]);
|
||||
|
||||
let mut res = vec![context, segment, virt, len, timestamp];
|
||||
let mut res = vec![is_read, context, segment, virt, len, timestamp];
|
||||
res.extend(val);
|
||||
|
||||
res
|
||||
|
||||
314
evm/tests/erc721.rs
Normal file
314
evm/tests/erc721.rs
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user