Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dencun mainnet configs #324

Merged
merged 4 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "helios"
version = "0.5.4"
version = "0.5.5"
edition = "2021"
autobenches = false
exclude = [
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cli"
version = "0.5.4"
version = "0.5.5"
edition = "2021"

[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "client"
version = "0.5.4"
version = "0.5.5"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "common"
version = "0.5.4"
version = "0.5.5"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "config"
version = "0.5.4"
version = "0.5.5"
edition = "2021"

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions config/src/networks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Network {
pub fn mainnet() -> BaseConfig {
BaseConfig {
default_checkpoint: hex_str_to_bytes(
"0x7e495f50102bed2aae9e698b73a2a640de548658998033d732feb1c0c0c7f80b",
"0xc7fc7b2f4b548bfc9305fa80bc1865ddc6eea4557f0a80507af5dc34db7bd9ce",
)
.unwrap(),
rpc_port: 8545,
Expand Down Expand Up @@ -103,7 +103,7 @@ pub fn mainnet() -> BaseConfig {
fork_version: hex_str_to_bytes("0x03000000").unwrap(),
},
deneb: Fork {
epoch: u64::MAX,
epoch: 269568,
fork_version: hex_str_to_bytes("0x04000000").unwrap(),
},
},
Expand Down
2 changes: 1 addition & 1 deletion consensus/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "consensus"
version = "0.5.4"
version = "0.5.5"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion execution/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "execution"
version = "0.5.4"
version = "0.5.5"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion execution/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl<R: ExecutionRpc> ExecutionClient<R> {
let is_valid = verify_proof(
&storage_proof.proof,
proof.storage_hash.as_bytes(),
&key_hash.to_vec(),
&key_hash,
&value,
);

Expand Down
16 changes: 8 additions & 8 deletions execution/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ethers::types::{Bytes, EIP1186ProofResponse};
use ethers::utils::keccak256;
use ethers::utils::rlp::{decode_list, RlpStream};

pub fn verify_proof(proof: &Vec<Bytes>, root: &[u8], path: &Vec<u8>, value: &Vec<u8>) -> bool {
pub fn verify_proof(proof: &[Bytes], root: &[u8], path: &[u8], value: &[u8]) -> bool {
let mut expected_hash = root.to_vec();
let mut path_offset = 0;

Expand Down Expand Up @@ -38,7 +38,7 @@ pub fn verify_proof(proof: &Vec<Bytes>, root: &[u8], path: &Vec<u8>, value: &Vec
}

// inclusion proof
if &node_list[1] == value {
if node_list[1] == value {
return paths_match(
&node_list[0],
skip_length(&node_list[0]),
Expand All @@ -65,7 +65,7 @@ pub fn verify_proof(proof: &Vec<Bytes>, root: &[u8], path: &Vec<u8>, value: &Vec
false
}

fn paths_match(p1: &Vec<u8>, s1: usize, p2: &Vec<u8>, s2: usize) -> bool {
fn paths_match(p1: &[u8], s1: usize, p2: &[u8], s2: usize) -> bool {
let len1 = p1.len() * 2 - s1;
let len2 = p2.len() * 2 - s2;

Expand All @@ -86,7 +86,7 @@ fn paths_match(p1: &Vec<u8>, s1: usize, p2: &Vec<u8>, s2: usize) -> bool {
}

#[allow(dead_code)]
fn get_rest_path(p: &Vec<u8>, s: usize) -> String {
fn get_rest_path(p: &[u8], s: usize) -> String {
let mut ret = String::new();
for i in s..p.len() * 2 {
let n = get_nibble(p, i);
Expand All @@ -95,7 +95,7 @@ fn get_rest_path(p: &Vec<u8>, s: usize) -> String {
ret
}

fn is_empty_value(value: &Vec<u8>) -> bool {
fn is_empty_value(value: &[u8]) -> bool {
let mut stream = RlpStream::new();
stream.begin_list(4);
stream.append_empty_data();
Expand All @@ -107,11 +107,11 @@ fn is_empty_value(value: &Vec<u8>) -> bool {
let empty_account = stream.out();

let is_empty_slot = value.len() == 1 && value[0] == 0x80;
let is_empty_account = value == &empty_account;
let is_empty_account = value == empty_account;
is_empty_slot || is_empty_account
}

fn shared_prefix_length(path: &Vec<u8>, path_offset: usize, node_path: &Vec<u8>) -> usize {
fn shared_prefix_length(path: &[u8], path_offset: usize, node_path: &[u8]) -> usize {
let skip_length = skip_length(node_path);

let len = std::cmp::min(
Expand All @@ -134,7 +134,7 @@ fn shared_prefix_length(path: &Vec<u8>, path_offset: usize, node_path: &Vec<u8>)
prefix_len
}

fn skip_length(node: &Vec<u8>) -> usize {
fn skip_length(node: &[u8]) -> usize {
if node.is_empty() {
return 0;
}
Expand Down
Loading