Skip to content

Commit

Permalink
feat: update verifier contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
hduoc2003 committed Sep 23, 2024
1 parent c071c5f commit d0b15f2
Show file tree
Hide file tree
Showing 16 changed files with 20,621 additions and 3,403 deletions.
34 changes: 17 additions & 17 deletions cpu/sources/layout7/layout_specific.move
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,28 @@ module cpu_addr::layout_specific_7 {
const MM_PERIODIC_COLUMN__POSEIDON__POSEIDON__PARTIAL_ROUND_KEY1: u64 = 0x143;
// 335
const MM_RANGE_CHECK16__PERM__PUBLIC_MEMORY_PROD: u64 = 0x14f;
// 14
const OFFSET_BITWISE_BEGIN_ADDR: u64 = 0xe;
// 15
const OFFSET_BITWISE_STOP_ADDR: u64 = 0xf;
// 20
const OFFSET_N_PUBLIC_MEMORY_PAGES: u64 = 0x14;
// 8
const OFFSET_OUTPUT_BEGIN_ADDR: u64 = 0x8;
const OFFSET_BITWISE_BEGIN_ADDR: u64 = 0xf;
// 16
const OFFSET_BITWISE_STOP_PTR: u64 = 0x10;
// 21
const OFFSET_N_PUBLIC_MEMORY_PAGES: u64 = 0x15;
// 9
const OFFSET_OUTPUT_STOP_PTR: u64 = 0x9;
const OFFSET_OUTPUT_BEGIN_ADDR: u64 = 0x9;
// 10
const OFFSET_PEDERSEN_BEGIN_ADDR: u64 = 0xa;
const OFFSET_OUTPUT_STOP_PTR: u64 = 0xa;
// 11
const OFFSET_PEDERSEN_STOP_PTR: u64 = 0xb;
// 16
const OFFSET_POSEIDON_BEGIN_ADDR: u64 = 0x10;
// 17
const OFFSET_POSEIDON_STOP_PTR: u64 = 0x11;
const OFFSET_PEDERSEN_BEGIN_ADDR: u64 = 0xb;
// 12
const OFFSET_RANGE_CHECK_BEGIN_ADDR: u64 = 0xc;
const OFFSET_PEDERSEN_STOP_PTR: u64 = 0xc;
// 17
const OFFSET_POSEIDON_BEGIN_ADDR: u64 = 0x11;
// 18
const OFFSET_POSEIDON_STOP_PTR: u64 = 0x12;
// 13
const OFFSET_RANGE_CHECK_STOP_PTR: u64 = 0xd;
const OFFSET_RANGE_CHECK_BEGIN_ADDR: u64 = 0xd;
// 14
const OFFSET_RANGE_CHECK_STOP_PTR: u64 = 0xe;
// 0
const OUTPUT_BUILTIN_BIT: u256 = 0x0;
// 1
Expand Down Expand Up @@ -182,7 +182,7 @@ module cpu_addr::layout_specific_7 {
// "bitwise" memory segment.
set_el(ctx, MM_INITIAL_BITWISE_ADDR, *borrow(public_input, OFFSET_BITWISE_BEGIN_ADDR));
validate_builtin_pointers(
*borrow(ctx, MM_INITIAL_BITWISE_ADDR), *borrow(public_input, OFFSET_BITWISE_STOP_ADDR),
*borrow(ctx, MM_INITIAL_BITWISE_ADDR), *borrow(public_input, OFFSET_BITWISE_STOP_PTR),
BITWISE__RATIO, 5, n_steps);

set_el(ctx, MM_DILUTED_CHECK__PERMUTATION__PUBLIC_MEMORY_PROD, 1);
Expand Down
4 changes: 2 additions & 2 deletions cpu/sources/layout7/public_memory_offsets.move
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module cpu_addr::public_memory_offsets_7 {
// This line is used for generating constants DO NOT REMOVE!
// 1
const EADDRESS_OF_PAGE_0_IS_NOT_PART_OF_THE_PUBLIC_INPUT: u64 = 0x1;
// 21
const OFFSET_PUBLIC_MEMORY: u64 = 0x15;
// 22
const OFFSET_PUBLIC_MEMORY: u64 = 0x16;
// 0
const PAGE_INFO_ADDRESS_OFFSET: u64 = 0x0;
// 2
Expand Down
6 changes: 6 additions & 0 deletions libs/sources/bytes.move
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ module lib_addr::bytes {
vector::reverse(&mut bytes);
to_u256(bytes)
}

public fun merge_num_offset_8(a: u256, b: u256): u256 {
a = a & ((1 << 192) - 1);
b = b >> 192;
(a << 64) | b
}
}

#[test_only]
Expand Down
Loading

0 comments on commit d0b15f2

Please sign in to comment.