mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-04 06:43:07 +00:00
More succinct deadbeef
This commit is contained in:
parent
f951345556
commit
8bb45203f9
@ -1,5 +1,3 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use anyhow::Result;
|
||||
use ethereum_types::U256;
|
||||
use rand::{thread_rng, Rng};
|
||||
@ -17,7 +15,7 @@ fn test_exp() -> Result<()> {
|
||||
let b = U256([0; 4].map(|_| rng.gen()));
|
||||
|
||||
// Random input
|
||||
let initial_stack = vec![U256::from_str("0xdeadbeef")?, b, a];
|
||||
let initial_stack = vec![0xDEADBEEFu32.into(), b, a];
|
||||
let stack_with_kernel = run_with_kernel(&kernel, exp, initial_stack)?
|
||||
.stack()
|
||||
.to_vec();
|
||||
@ -29,7 +27,7 @@ fn test_exp() -> Result<()> {
|
||||
assert_eq!(stack_with_kernel, stack_with_opcode);
|
||||
|
||||
// 0 base
|
||||
let initial_stack = vec![U256::from_str("0xdeadbeef")?, b, U256::zero()];
|
||||
let initial_stack = vec![0xDEADBEEFu32.into(), b, U256::zero()];
|
||||
let stack_with_kernel = run_with_kernel(&kernel, exp, initial_stack)?
|
||||
.stack()
|
||||
.to_vec();
|
||||
@ -41,7 +39,7 @@ fn test_exp() -> Result<()> {
|
||||
assert_eq!(stack_with_kernel, stack_with_opcode);
|
||||
|
||||
// 0 exponent
|
||||
let initial_stack = vec![U256::from_str("0xdeadbeef")?, U256::zero(), a];
|
||||
let initial_stack = vec![0xDEADBEEFu32.into(), U256::zero(), a];
|
||||
let stack_with_kernel = run_with_kernel(&kernel, exp, initial_stack)?
|
||||
.stack()
|
||||
.to_vec();
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use anyhow::Result;
|
||||
use ethereum_types::U256;
|
||||
|
||||
@ -10,7 +8,7 @@ use crate::cpu::kernel::interpreter::Interpreter;
|
||||
fn test_decode_rlp_string_len_short() -> Result<()> {
|
||||
let decode_rlp_string_len = KERNEL.global_labels["decode_rlp_string_len"];
|
||||
|
||||
let initial_stack = vec![U256::from_str("0xdeadbeef")?, 2.into()];
|
||||
let initial_stack = vec![0xDEADBEEFu32.into(), 2.into()];
|
||||
let mut interpreter = Interpreter::new_with_kernel(decode_rlp_string_len, initial_stack);
|
||||
|
||||
// A couple dummy bytes, followed by "0x70" which is its own encoding.
|
||||
@ -27,7 +25,7 @@ fn test_decode_rlp_string_len_short() -> Result<()> {
|
||||
fn test_decode_rlp_string_len_medium() -> Result<()> {
|
||||
let decode_rlp_string_len = KERNEL.global_labels["decode_rlp_string_len"];
|
||||
|
||||
let initial_stack = vec![U256::from_str("0xdeadbeef")?, 2.into()];
|
||||
let initial_stack = vec![0xDEADBEEFu32.into(), 2.into()];
|
||||
let mut interpreter = Interpreter::new_with_kernel(decode_rlp_string_len, initial_stack);
|
||||
|
||||
// A couple dummy bytes, followed by the RLP encoding of "1 2 3 4 5".
|
||||
@ -44,7 +42,7 @@ fn test_decode_rlp_string_len_medium() -> Result<()> {
|
||||
fn test_decode_rlp_string_len_long() -> Result<()> {
|
||||
let decode_rlp_string_len = KERNEL.global_labels["decode_rlp_string_len"];
|
||||
|
||||
let initial_stack = vec![U256::from_str("0xdeadbeef")?, 2.into()];
|
||||
let initial_stack = vec![0xDEADBEEFu32.into(), 2.into()];
|
||||
let mut interpreter = Interpreter::new_with_kernel(decode_rlp_string_len, initial_stack);
|
||||
|
||||
// The RLP encoding of the string "1 2 3 ... 56".
|
||||
@ -65,7 +63,7 @@ fn test_decode_rlp_string_len_long() -> Result<()> {
|
||||
fn test_decode_rlp_list_len_short() -> Result<()> {
|
||||
let decode_rlp_list_len = KERNEL.global_labels["decode_rlp_list_len"];
|
||||
|
||||
let initial_stack = vec![U256::from_str("0xdeadbeef")?, 0.into()];
|
||||
let initial_stack = vec![0xDEADBEEFu32.into(), 0.into()];
|
||||
let mut interpreter = Interpreter::new_with_kernel(decode_rlp_list_len, initial_stack);
|
||||
|
||||
// The RLP encoding of [1, 2, [3, 4]].
|
||||
@ -82,7 +80,7 @@ fn test_decode_rlp_list_len_short() -> Result<()> {
|
||||
fn test_decode_rlp_list_len_long() -> Result<()> {
|
||||
let decode_rlp_list_len = KERNEL.global_labels["decode_rlp_list_len"];
|
||||
|
||||
let initial_stack = vec![U256::from_str("0xdeadbeef")?, 0.into()];
|
||||
let initial_stack = vec![0xDEADBEEFu32.into(), 0.into()];
|
||||
let mut interpreter = Interpreter::new_with_kernel(decode_rlp_list_len, initial_stack);
|
||||
|
||||
// The RLP encoding of [1, ..., 56].
|
||||
@ -103,7 +101,7 @@ fn test_decode_rlp_list_len_long() -> Result<()> {
|
||||
fn test_decode_rlp_scalar() -> Result<()> {
|
||||
let decode_rlp_scalar = KERNEL.global_labels["decode_rlp_scalar"];
|
||||
|
||||
let initial_stack = vec![U256::from_str("0xdeadbeef")?, 0.into()];
|
||||
let initial_stack = vec![0xDEADBEEFu32.into(), 0.into()];
|
||||
let mut interpreter = Interpreter::new_with_kernel(decode_rlp_scalar, initial_stack);
|
||||
|
||||
// The RLP encoding of "12 34 56".
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user