mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(op): Add optimism in node api, few cfg transitions (#6598)
This commit is contained in:
@ -164,6 +164,7 @@ optimism = [
|
||||
"reth-node-ethereum/optimism",
|
||||
"dep:reth-node-optimism",
|
||||
"reth-node-core/optimism",
|
||||
"reth-node-api/optimism",
|
||||
]
|
||||
|
||||
# no-op feature flag for switching between the `optimism` and default functionality in CI matrices
|
||||
|
||||
@ -68,4 +68,5 @@ optimism = [
|
||||
"reth-rpc-types/optimism",
|
||||
"reth-payload-builder/optimism",
|
||||
"reth-blockchain-tree/optimism",
|
||||
"reth-node-api/optimism",
|
||||
]
|
||||
|
||||
@ -19,3 +19,6 @@ thiserror.workspace = true
|
||||
|
||||
# io
|
||||
serde.workspace = true
|
||||
|
||||
[features]
|
||||
optimism = []
|
||||
@ -126,16 +126,22 @@ pub trait PayloadBuilderAttributes: Send + Sync + std::fmt::Debug {
|
||||
blob_excess_gas_and_price,
|
||||
};
|
||||
|
||||
let cfg_with_handler_cfg;
|
||||
#[cfg(feature = "optimism")]
|
||||
{
|
||||
let cfg_with_handler_cfg = CfgEnvWithHandlerCfg {
|
||||
cfg_with_handler_cfg = CfgEnvWithHandlerCfg {
|
||||
cfg_env: cfg,
|
||||
handler_cfg: HandlerCfg { spec_id, is_optimism: chain_spec.is_optimism() },
|
||||
handler_cfg: revm_primitives::HandlerCfg {
|
||||
spec_id,
|
||||
is_optimism: chain_spec.is_optimism(),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "optimism"))]
|
||||
let cfg_with_handler_cfg = CfgEnvWithHandlerCfg::new(cfg, spec_id);
|
||||
{
|
||||
cfg_with_handler_cfg = CfgEnvWithHandlerCfg::new(cfg, spec_id);
|
||||
}
|
||||
|
||||
(cfg_with_handler_cfg, block_env)
|
||||
}
|
||||
@ -211,7 +217,7 @@ impl PayloadAttributes for OptimismPayloadAttributes {
|
||||
if self.gas_limit.is_none() && chain_spec.is_optimism() {
|
||||
return Err(AttributesValidationError::InvalidParams(
|
||||
"MissingGasLimitInPayloadAttributes".to_string().into(),
|
||||
))
|
||||
));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@ -82,7 +82,11 @@ tracing.workspace = true
|
||||
# crypto
|
||||
alloy-rlp.workspace = true
|
||||
alloy-chains.workspace = true
|
||||
secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recovery"] }
|
||||
secp256k1 = { workspace = true, features = [
|
||||
"global-context",
|
||||
"rand-std",
|
||||
"recovery",
|
||||
] }
|
||||
|
||||
# async
|
||||
futures.workspace = true
|
||||
@ -118,6 +122,7 @@ optimism = [
|
||||
"reth-blockchain-tree/optimism",
|
||||
"reth-beacon-consensus/optimism",
|
||||
"reth-optimism-payload-builder/optimism",
|
||||
"reth-node-api/optimism",
|
||||
]
|
||||
|
||||
jemalloc = ["dep:jemalloc-ctl"]
|
||||
|
||||
@ -21,4 +21,4 @@ reth-node-api.workspace = true
|
||||
serde.workspace = true
|
||||
|
||||
[features]
|
||||
optimism = []
|
||||
optimism = ["reth-node-api/optimism"]
|
||||
|
||||
@ -54,5 +54,6 @@ optimism = [
|
||||
"reth-rpc-types/optimism",
|
||||
"reth-rpc-types-compat/optimism",
|
||||
"reth-interfaces/optimism",
|
||||
"reth-transaction-pool/optimism"
|
||||
"reth-transaction-pool/optimism",
|
||||
"reth-node-api/optimism",
|
||||
]
|
||||
|
||||
@ -37,5 +37,6 @@ optimism = [
|
||||
"reth-primitives/optimism",
|
||||
"reth-consensus-common/optimism",
|
||||
"reth-interfaces/optimism",
|
||||
"reth-node-api/optimism",
|
||||
]
|
||||
js-tracer = ["revm-inspectors/js-tracer"]
|
||||
|
||||
@ -24,3 +24,4 @@ serde_json.workspace = true
|
||||
|
||||
[features]
|
||||
client = ["jsonrpsee/client", "jsonrpsee/async-client"]
|
||||
optimism = ["reth-node-api/optimism"]
|
||||
|
||||
@ -49,4 +49,8 @@ reth-payload-builder = { workspace = true, features = ["test-utils"] }
|
||||
assert_matches.workspace = true
|
||||
|
||||
[features]
|
||||
optimism = ["reth-primitives/optimism", "reth-rpc-types/optimism"]
|
||||
optimism = [
|
||||
"reth-primitives/optimism",
|
||||
"reth-rpc-types/optimism",
|
||||
"reth-node-api/optimism",
|
||||
]
|
||||
|
||||
@ -49,7 +49,9 @@ hyper = "0.14.24"
|
||||
jsonwebtoken = "8"
|
||||
|
||||
## required for optimism sequencer delegation
|
||||
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"], optional = true }
|
||||
reqwest = { version = "0.11", default-features = false, features = [
|
||||
"rustls-tls",
|
||||
], optional = true }
|
||||
|
||||
# async
|
||||
async-trait.workspace = true
|
||||
@ -66,7 +68,11 @@ metrics.workspace = true
|
||||
|
||||
# misc
|
||||
bytes.workspace = true
|
||||
secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recovery"] }
|
||||
secp256k1 = { workspace = true, features = [
|
||||
"global-context",
|
||||
"rand-std",
|
||||
"recovery",
|
||||
] }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
thiserror.workspace = true
|
||||
@ -95,4 +101,5 @@ optimism = [
|
||||
"reth-network/optimism",
|
||||
"reth-provider/optimism",
|
||||
"reth-transaction-pool/optimism",
|
||||
"reth-node-api/optimism",
|
||||
]
|
||||
|
||||
@ -90,10 +90,10 @@ where
|
||||
while let Some((index, tx)) = transactions.next() {
|
||||
let tx_hash = tx.hash;
|
||||
let tx = tx_env_with_recovered(&tx);
|
||||
let env = EnvWithHandlerCfg::new(
|
||||
Env::boxed(cfg.cfg_env.clone(), block_env.clone(), tx),
|
||||
cfg.handler_cfg.spec_id,
|
||||
);
|
||||
let env = EnvWithHandlerCfg {
|
||||
env: Env::boxed(cfg.cfg_env.clone(), block_env.clone(), tx),
|
||||
handler_cfg: cfg.handler_cfg,
|
||||
};
|
||||
let (result, state_changes) = this
|
||||
.trace_transaction(
|
||||
opts.clone(),
|
||||
@ -237,10 +237,11 @@ where
|
||||
tx.hash,
|
||||
)?;
|
||||
|
||||
let env = EnvWithHandlerCfg::new(
|
||||
Env::boxed(cfg.cfg_env.clone(), block_env, tx_env_with_recovered(&tx)),
|
||||
cfg.handler_cfg.spec_id,
|
||||
);
|
||||
let env = EnvWithHandlerCfg {
|
||||
env: Env::boxed(cfg.cfg_env.clone(), block_env, tx_env_with_recovered(&tx)),
|
||||
handler_cfg: cfg.handler_cfg,
|
||||
};
|
||||
|
||||
this.trace_transaction(
|
||||
opts,
|
||||
env,
|
||||
@ -436,10 +437,10 @@ where
|
||||
// Execute all transactions until index
|
||||
for tx in transactions {
|
||||
let tx = tx_env_with_recovered(&tx);
|
||||
let env = EnvWithHandlerCfg::new(
|
||||
Env::boxed(cfg.cfg_env.clone(), block_env.clone(), tx),
|
||||
cfg.handler_cfg.spec_id,
|
||||
);
|
||||
let env = EnvWithHandlerCfg {
|
||||
env: Env::boxed(cfg.cfg_env.clone(), block_env.clone(), tx),
|
||||
handler_cfg: cfg.handler_cfg,
|
||||
};
|
||||
let (res, _) = transact(&mut db, env)?;
|
||||
db.commit(res.state);
|
||||
}
|
||||
|
||||
@ -63,5 +63,6 @@ rand.workspace = true
|
||||
test-utils = ["alloy-rlp", "reth-db/test-utils"]
|
||||
optimism = [
|
||||
"reth-primitives/optimism",
|
||||
"reth-interfaces/optimism"
|
||||
"reth-interfaces/optimism",
|
||||
"reth-node-api/optimism"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user