Skip to content

Commit

Permalink
fix: dencun hotfix (#316)
Browse files Browse the repository at this point in the history
* fix: dencun hotfix

* cleanup
  • Loading branch information
ncitron authored Jan 17, 2024
1 parent 4974490 commit f59dae8
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 25 deletions.
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 cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cli"
version = "0.5.2"
version = "0.5.3"
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.2"
version = "0.5.3"
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.2"
version = "0.5.3"
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.2"
version = "0.5.3"
edition = "2021"

[dependencies]
Expand Down
6 changes: 3 additions & 3 deletions config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ impl Config {
pub fn fork_version(&self, slot: u64) -> Vec<u8> {
let epoch = slot / 32;

if epoch >= self.forks.capella.epoch {
if epoch >= self.forks.deneb.epoch {
self.forks.deneb.fork_version.clone()
} else if epoch >= self.forks.capella.epoch {
self.forks.capella.fork_version.clone()
} else if epoch >= self.forks.bellatrix.epoch {
self.forks.bellatrix.fork_version.clone()
} else if epoch >= self.forks.altair.epoch {
self.forks.altair.fork_version.clone()
} else if epoch >= self.forks.deneb.epoch {
self.forks.deneb.fork_version.clone()
} else {
self.forks.genesis.fork_version.clone()
}
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.2"
version = "0.5.3"
edition = "2021"

[dependencies]
Expand Down
8 changes: 6 additions & 2 deletions consensus/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,10 @@ impl<R: ConsensusRpc> Inner<R> {

let should_apply_update = {
let has_majority = committee_bits * 3 >= 512 * 2;
if !has_majority {
tracing::warn!("skipping block with low vote count");
}

let update_is_newer = update_finalized_slot > self.store.finalized_header.slot.as_u64();
let good_update = update_is_newer || update_has_finalized_next_committee;

Expand Down Expand Up @@ -598,7 +602,7 @@ impl<R: ConsensusRpc> Inner<R> {

fn log_finality_update(&self, update: &GenericUpdate) {
let participation =
get_bits(&update.sync_aggregate.sync_committee_bits) as f32 / 512_f32 * 100f32;
get_bits(&update.sync_aggregate.sync_committee_bits) as f32 / 512f32 * 100f32;
let decimals = if participation == 100.0 { 1 } else { 2 };
let age = self.age(self.store.finalized_header.slot.as_u64());

Expand All @@ -621,7 +625,7 @@ impl<R: ConsensusRpc> Inner<R> {

fn log_optimistic_update(&self, update: &GenericUpdate) {
let participation =
get_bits(&update.sync_aggregate.sync_committee_bits) as f32 / 512_f32 * 100f32;
get_bits(&update.sync_aggregate.sync_committee_bits) as f32 / 512f32 * 100f32;
let decimals = if participation == 100.0 { 1 } else { 2 };
let age = self.age(self.store.optimistic_header.slot.as_u64());

Expand Down
4 changes: 2 additions & 2 deletions consensus/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct BeaconBlockBody {
voluntary_exits: List<SignedVoluntaryExit, 16>,
sync_aggregate: SyncAggregate,
pub execution_payload: ExecutionPayload,
#[superstruct(only(Capella))]
#[superstruct(only(Capella, Deneb))]
bls_to_execution_changes: List<SignedBlsToExecutionChange, 16>,
#[superstruct(only(Deneb))]
blob_kzg_commitments: List<ByteVector<48>, 4096>,
Expand Down Expand Up @@ -97,7 +97,7 @@ pub struct ExecutionPayload {
pub base_fee_per_gas: U256,
pub block_hash: Bytes32,
pub transactions: List<Transaction, 1048576>,
#[superstruct(only(Capella))]
#[superstruct(only(Capella, Deneb))]
withdrawals: List<Withdrawal, 16>,
#[superstruct(only(Deneb))]
blob_gas_used: U64,
Expand Down
5 changes: 3 additions & 2 deletions consensus/src/types/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl From<ExecutionPayload> for Block {
.enumerate()
.map(|(i, tx)| {
let rlp = Rlp::new(tx.as_slice());
let mut tx = Transaction::decode(&rlp).unwrap();
let mut tx = Transaction::decode(&rlp)?;

tx.block_number = Some(value.block_number().as_u64().into());
tx.block_hash = Some(H256::from_slice(value.block_hash()));
Expand All @@ -125,8 +125,9 @@ impl From<ExecutionPayload> for Block {
};
}

tx
Ok::<_, eyre::Report>(tx)
})
.filter_map(|tx| tx.ok())
.collect::<Vec<Transaction>>();

Block {
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.2"
version = "0.5.3"
edition = "2021"

[dependencies]
Expand Down
6 changes: 3 additions & 3 deletions execution/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ impl<R: ExecutionRpc> Evm<R> {

async fn call_inner(&mut self, opts: &CallOpts) -> Result<ResultAndState, EvmError> {
let env = self.get_env(opts, self.tag).await;
self.evm
_ = self
.evm
.db
.as_mut()
.unwrap()
.state
.prefetch_state(opts)
.await
.map_err(|err| EvmError::Generic(err.to_string()))?;
.await;

let tx_res = loop {
self.evm.env = env.clone();
Expand Down

0 comments on commit f59dae8

Please sign in to comment.