Skip to content

Commit

Permalink
Merge branch 'main' into merge-upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
dzungngnbh authored Oct 25, 2024
2 parents 082f2cd + 19ec3e4 commit 76a41ba
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 78 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

12 changes: 6 additions & 6 deletions crates/consensus/beacon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ assert_matches.workspace = true

[features]
optimism = [
"reth-chainspec",
"reth-primitives/optimism",
"reth-provider/optimism",
"reth-blockchain-tree/optimism",
"reth-db/optimism",
"reth-db-api/optimism",
"reth-chainspec",
"reth-primitives/optimism",
"reth-provider/optimism",
"reth-blockchain-tree/optimism",
"reth-db/optimism",
"reth-db-api/optimism"
]
19 changes: 14 additions & 5 deletions crates/ethereum/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ use reth_ethereum_consensus::validate_block_post_execution;
use reth_evm::{
execute::{
BasicBlockExecutorProvider, BlockExecutionError, BlockExecutionStrategy,
BlockExecutionStrategyFactory, BlockValidationError, ExecuteOutput, ProviderError,
BlockExecutionStrategyFactory, BlockValidationError, ProviderError,
},
state_change::post_block_balance_increments,
system_calls::{OnStateHook, SystemCaller},
ConfigureEvm,
};
use reth_primitives::{BlockWithSenders, Receipt};
use reth_revm::db::State;
use reth_revm::db::{states::bundle_state::BundleRetention, BundleState, State};
use revm_primitives::{
db::{Database, DatabaseCommit},
BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState, U256,
Expand Down Expand Up @@ -152,7 +152,7 @@ where
&mut self,
block: &BlockWithSenders,
total_difficulty: U256,
) -> Result<ExecuteOutput, Self::Error> {
) -> Result<(Vec<Receipt>, u64), Self::Error> {
let env = self.evm_env_for_block(&block.header, total_difficulty);
let mut evm = self.evm_config.evm_with_env(&mut self.state, env);

Expand Down Expand Up @@ -203,7 +203,7 @@ where
},
);
}
Ok(ExecuteOutput { receipts, gas_used: cumulative_gas_used })
Ok((receipts, cumulative_gas_used))
}

fn apply_post_execution_changes(
Expand Down Expand Up @@ -264,6 +264,11 @@ where
self.system_caller.with_state_hook(hook);
}

fn finish(&mut self) -> BundleState {
self.state.merge_transitions(BundleRetention::Reverts);
self.state.take_bundle()
}

fn validate_block_post_execution(
&self,
block: &BlockWithSenders,
Expand Down Expand Up @@ -296,7 +301,7 @@ impl EthExecutorProvider {
#[cfg(test)]
mod tests {
use super::*;
use alloy_consensus::{constants::ETH_TO_WEI, Header, TxLegacy};
use alloy_consensus::{Header, TxLegacy};
use alloy_eips::{
eip2935::{HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_CODE},
eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_CODE, SYSTEM_ADDRESS},
Expand All @@ -309,6 +314,10 @@ mod tests {
BasicBlockExecutorProvider, BatchExecutor, BlockExecutorProvider, Executor,
};
use reth_execution_types::BlockExecutionOutput;
use reth_primitives::{
constants::ETH_TO_WEI, public_key_to_address, Account, Block, BlockBody, Transaction,
};
use reth_execution_types::BlockExecutionOutput;
use reth_primitives::{public_key_to_address, Account, Block, BlockBody, Transaction};
use reth_revm::{
database::StateProviderDatabase, test_utils::StateProviderTest, TransitionState,
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use reth_ethereum_engine_primitives::{
};
use reth_evm::execute::BasicBlockExecutorProvider;
use reth_evm_ethereum::execute::EthExecutionStrategyFactory;
use reth_network::{NetworkHandle, PeersInfo};
use reth_network::NetworkHandle;
use reth_node_api::{
AddOnsContext, ConfigureEvm, EngineValidator, FullNodeComponents, NodePrimitives,
NodeTypesWithDB,
Expand Down
35 changes: 17 additions & 18 deletions crates/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,23 @@ alloy-consensus.workspace = true
[features]
default = ["std"]
std = [
"dep:metrics",
"dep:reth-metrics",
"reth-consensus/std",
"reth-primitives/std",
"reth-primitives-traits/std",
"reth-revm/std",
"alloy-eips/std",
"alloy-primitives/std",
"alloy-consensus/std",
"revm-primitives/std",
"revm/std",
"dep:metrics",
"dep:reth-metrics",
"reth-consensus/std",
"reth-primitives/std",
"reth-primitives-traits/std",
"reth-revm/std",
"alloy-eips/std",
"alloy-primitives/std",
"revm-primitives/std",
"revm/std"
]
test-utils = [
"dep:parking_lot",
"reth-chainspec/test-utils",
"reth-consensus/test-utils",
"reth-primitives/test-utils",
"reth-primitives-traits/test-utils",
"reth-revm/test-utils",
"revm/test-utils",
"dep:parking_lot",
"reth-chainspec/test-utils",
"reth-consensus/test-utils",
"reth-primitives/test-utils",
"reth-primitives-traits/test-utils",
"reth-revm/test-utils",
"revm/test-utils"
]
14 changes: 11 additions & 3 deletions crates/node/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,18 @@ proptest.workspace = true
tokio.workspace = true

[features]
optimism = ["reth-primitives/optimism", "reth-db/optimism"]
optimism = [
"reth-primitives/optimism",
"reth-db/optimism"
]
# Features for vergen to generate correct env vars
jemalloc = ["reth-cli-util/jemalloc"]
asm-keccak = ["reth-primitives/asm-keccak", "alloy-primitives/asm-keccak"]
jemalloc = [
"reth-cli-util/jemalloc"
]
asm-keccak = [
"reth-primitives/asm-keccak",
"alloy-primitives/asm-keccak"
]

[build-dependencies]
vergen = { version = "8.0.0", features = ["build", "cargo", "git", "gitcl"] }
21 changes: 10 additions & 11 deletions crates/optimism/chainspec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@ op-alloy-rpc-types.workspace = true
[features]
default = ["std"]
std = [
"alloy-chains/std",
"alloy-genesis/std",
"alloy-primitives/std",
"alloy-eips/std",
"op-alloy-rpc-types/std",
"reth-chainspec/std",
"reth-ethereum-forks/std",
"reth-primitives-traits/std",
"reth-optimism-forks/std",
"alloy-consensus/std",
"once_cell/std",
"alloy-chains/std",
"alloy-genesis/std",
"alloy-primitives/std",
"op-alloy-rpc-types/std",
"reth-chainspec/std",
"reth-ethereum-forks/std",
"reth-primitives-traits/std",
"reth-optimism-forks/std",
"alloy-consensus/std",
"once_cell/std"
]
11 changes: 7 additions & 4 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ std = [
"once_cell/std",
"revm-primitives/std",
"secp256k1?/std",
"serde/std",
"serde/std"
]
reth-codec = ["dep:reth-codecs", "dep:zstd", "dep:modular-bitfield", "std"]
asm-keccak = ["alloy-primitives/asm-keccak", "revm-primitives/asm-keccak"]
asm-keccak = [
"alloy-primitives/asm-keccak",
"revm-primitives/asm-keccak"
]
arbitrary = [
"dep:arbitrary",
"alloy-eips/arbitrary",
Expand All @@ -119,7 +122,7 @@ arbitrary = [
"alloy-rpc-types?/arbitrary",
"alloy-serde?/arbitrary",
"op-alloy-consensus?/arbitrary",
"op-alloy-rpc-types?/arbitrary",
"op-alloy-rpc-types?/arbitrary"
]
secp256k1 = ["dep:secp256k1"]
c-kzg = [
Expand Down Expand Up @@ -149,7 +152,7 @@ serde-bincode-compat = [
"op-alloy-consensus?/serde-bincode-compat",
"reth-primitives-traits/serde-bincode-compat",
"serde_with",
"alloy-eips/serde-bincode-compat",
"alloy-eips/serde-bincode-compat"
]

[[bench]]
Expand Down
26 changes: 12 additions & 14 deletions crates/revm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,20 @@ alloy-consensus.workspace = true
[features]
default = ["std"]
std = [
"reth-primitives/std",
"alloy-primitives/std",
"revm/std",
"alloy-eips/std",
"alloy-consensus/std",
"reth-primitives/std",
"alloy-primitives/std",
"revm/std",
"alloy-eips/std"
]
test-utils = [
"dep:reth-trie",
"reth-primitives/test-utils",
"reth-trie?/test-utils",
"revm/test-utils",
"dep:reth-trie",
"reth-primitives/test-utils",
"reth-trie?/test-utils",
"revm/test-utils"
]
serde = [
"revm/serde",
"reth-trie?/serde",
"alloy-eips/serde",
"alloy-primitives/serde",
"alloy-consensus/serde",
"revm/serde",
"reth-trie?/serde",
"alloy-eips/serde",
"alloy-primitives/serde"
]
42 changes: 27 additions & 15 deletions etc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,60 +19,72 @@ the [docker docs](/book/installation/docker.md#using-docker-compose).

#### Adding a new metric to Grafana

To set up a new metric in Reth and its Grafana dashboard (this assumes running Reth and Grafana instances):
To set up a new metric in Reth and its Grafana dashboard:

1. Add the metric to the codebase following the [metrics section](../docs/design/metrics.md#creating-metrics)
documentation.

1. Access Grafana:
2. Build the Reth image:

```bash
docker build . -t reth:local
```

Modify the [docker-compose](./docker-compose.yml) file to use your locally built image for the Reth service.

3. Run Docker Compose:

```bash
docker compose -f etc/docker-compose.yml -f etc/lighthouse.yml up -d
```

4. Access Grafana:

- Open `http://localhost:3000/` in a browser
- Log in with username and password `admin`
- Navigate to the `Dashboards` tab

1. Create or modify a dashboard:
5. Create or modify a dashboard:

- Select an existing dashboard or create a new one
- Click `Add` > `Visualization` to create a new panel

1. Configure your metric panel:
6. Configure your metric panel:

- Set a panel title and description
- Select metric(s) from the `Metrics browser` or use the `PromQL` terminal
- Document your metric(s) by setting units, legends, etc.
- When adding multiple metrics, use field overwrites if needed

1. Save and arrange:
7. Save and arrange:

- Click `Apply` to save the panel
- Drag the panel to desired position on the dashboard

1. Export the dashboard:
8. Export the dashboard:

- Click `Share` > `Export`
- Toggle `Export for sharing externally`
- Click `Save to file`

1. Update dashboard file:
9. Update dashboard file:

- Replace the content of the corresponding file in the [dashboards folder](./grafana/dashboards) with the exported
JSON

Your new metric is now integrated into the Reth Grafana dashboard.

#### Import Grafana dashboards

If you are running Reth and Grafana outside of docker, and wish to import new Grafana dashboards or update a dashboard:
In order to import new Grafana dashboards or update a dashboard:

1. Go to `Home` > `Dashboards`

1. Click `New` > `Import`
2. Click `New` > `Import`

1. Drag the JSON dashboard file to import it
3. Drag the JSON dashboard file to import it

1. If updating an existing dashboard, you will need to change the name and UID of the imported dashboard in order to
4. If updating an existing dashboard, you will need to change the name and UID of the imported dashboard in order to
avoid conflict

1. Delete the old dashboard

If you are running Reth and Grafana using docker, after having pulled the updated dashboards from `main`, restart the
Grafana service. This will update all dashboards.
5. Delete the old dashboard

0 comments on commit 76a41ba

Please sign in to comment.