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",
|
"reth-node-ethereum/optimism",
|
||||||
"dep:reth-node-optimism",
|
"dep:reth-node-optimism",
|
||||||
"reth-node-core/optimism",
|
"reth-node-core/optimism",
|
||||||
|
"reth-node-api/optimism",
|
||||||
]
|
]
|
||||||
|
|
||||||
# no-op feature flag for switching between the `optimism` and default functionality in CI matrices
|
# 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-rpc-types/optimism",
|
||||||
"reth-payload-builder/optimism",
|
"reth-payload-builder/optimism",
|
||||||
"reth-blockchain-tree/optimism",
|
"reth-blockchain-tree/optimism",
|
||||||
|
"reth-node-api/optimism",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -18,4 +18,7 @@ revm-primitives.workspace = true
|
|||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
|
|
||||||
# io
|
# io
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
|
|
||||||
|
[features]
|
||||||
|
optimism = []
|
||||||
@ -126,16 +126,22 @@ pub trait PayloadBuilderAttributes: Send + Sync + std::fmt::Debug {
|
|||||||
blob_excess_gas_and_price,
|
blob_excess_gas_and_price,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let cfg_with_handler_cfg;
|
||||||
#[cfg(feature = "optimism")]
|
#[cfg(feature = "optimism")]
|
||||||
{
|
{
|
||||||
let cfg_with_handler_cfg = CfgEnvWithHandlerCfg {
|
cfg_with_handler_cfg = CfgEnvWithHandlerCfg {
|
||||||
cfg_env: cfg,
|
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"))]
|
#[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)
|
(cfg_with_handler_cfg, block_env)
|
||||||
}
|
}
|
||||||
@ -211,7 +217,7 @@ impl PayloadAttributes for OptimismPayloadAttributes {
|
|||||||
if self.gas_limit.is_none() && chain_spec.is_optimism() {
|
if self.gas_limit.is_none() && chain_spec.is_optimism() {
|
||||||
return Err(AttributesValidationError::InvalidParams(
|
return Err(AttributesValidationError::InvalidParams(
|
||||||
"MissingGasLimitInPayloadAttributes".to_string().into(),
|
"MissingGasLimitInPayloadAttributes".to_string().into(),
|
||||||
))
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@ -82,7 +82,11 @@ tracing.workspace = true
|
|||||||
# crypto
|
# crypto
|
||||||
alloy-rlp.workspace = true
|
alloy-rlp.workspace = true
|
||||||
alloy-chains.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
|
# async
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
@ -118,6 +122,7 @@ optimism = [
|
|||||||
"reth-blockchain-tree/optimism",
|
"reth-blockchain-tree/optimism",
|
||||||
"reth-beacon-consensus/optimism",
|
"reth-beacon-consensus/optimism",
|
||||||
"reth-optimism-payload-builder/optimism",
|
"reth-optimism-payload-builder/optimism",
|
||||||
|
"reth-node-api/optimism",
|
||||||
]
|
]
|
||||||
|
|
||||||
jemalloc = ["dep:jemalloc-ctl"]
|
jemalloc = ["dep:jemalloc-ctl"]
|
||||||
|
|||||||
@ -21,4 +21,4 @@ reth-node-api.workspace = true
|
|||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
optimism = []
|
optimism = ["reth-node-api/optimism"]
|
||||||
|
|||||||
@ -54,5 +54,6 @@ optimism = [
|
|||||||
"reth-rpc-types/optimism",
|
"reth-rpc-types/optimism",
|
||||||
"reth-rpc-types-compat/optimism",
|
"reth-rpc-types-compat/optimism",
|
||||||
"reth-interfaces/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-primitives/optimism",
|
||||||
"reth-consensus-common/optimism",
|
"reth-consensus-common/optimism",
|
||||||
"reth-interfaces/optimism",
|
"reth-interfaces/optimism",
|
||||||
|
"reth-node-api/optimism",
|
||||||
]
|
]
|
||||||
js-tracer = ["revm-inspectors/js-tracer"]
|
js-tracer = ["revm-inspectors/js-tracer"]
|
||||||
|
|||||||
@ -24,3 +24,4 @@ serde_json.workspace = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
client = ["jsonrpsee/client", "jsonrpsee/async-client"]
|
client = ["jsonrpsee/client", "jsonrpsee/async-client"]
|
||||||
|
optimism = ["reth-node-api/optimism"]
|
||||||
|
|||||||
@ -54,4 +54,4 @@ reth-tracing.workspace = true
|
|||||||
reth-transaction-pool = { workspace = true, features = ["test-utils"] }
|
reth-transaction-pool = { workspace = true, features = ["test-utils"] }
|
||||||
|
|
||||||
tokio = { workspace = true, features = ["rt", "rt-multi-thread"] }
|
tokio = { workspace = true, features = ["rt", "rt-multi-thread"] }
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
@ -49,4 +49,8 @@ reth-payload-builder = { workspace = true, features = ["test-utils"] }
|
|||||||
assert_matches.workspace = true
|
assert_matches.workspace = true
|
||||||
|
|
||||||
[features]
|
[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"
|
jsonwebtoken = "8"
|
||||||
|
|
||||||
## required for optimism sequencer delegation
|
## 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
|
||||||
async-trait.workspace = true
|
async-trait.workspace = true
|
||||||
@ -66,7 +68,11 @@ metrics.workspace = true
|
|||||||
|
|
||||||
# misc
|
# misc
|
||||||
bytes.workspace = true
|
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 = { workspace = true, features = ["derive"] }
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
@ -95,4 +101,5 @@ optimism = [
|
|||||||
"reth-network/optimism",
|
"reth-network/optimism",
|
||||||
"reth-provider/optimism",
|
"reth-provider/optimism",
|
||||||
"reth-transaction-pool/optimism",
|
"reth-transaction-pool/optimism",
|
||||||
|
"reth-node-api/optimism",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -90,10 +90,10 @@ where
|
|||||||
while let Some((index, tx)) = transactions.next() {
|
while let Some((index, tx)) = transactions.next() {
|
||||||
let tx_hash = tx.hash;
|
let tx_hash = tx.hash;
|
||||||
let tx = tx_env_with_recovered(&tx);
|
let tx = tx_env_with_recovered(&tx);
|
||||||
let env = EnvWithHandlerCfg::new(
|
let env = EnvWithHandlerCfg {
|
||||||
Env::boxed(cfg.cfg_env.clone(), block_env.clone(), tx),
|
env: Env::boxed(cfg.cfg_env.clone(), block_env.clone(), tx),
|
||||||
cfg.handler_cfg.spec_id,
|
handler_cfg: cfg.handler_cfg,
|
||||||
);
|
};
|
||||||
let (result, state_changes) = this
|
let (result, state_changes) = this
|
||||||
.trace_transaction(
|
.trace_transaction(
|
||||||
opts.clone(),
|
opts.clone(),
|
||||||
@ -237,10 +237,11 @@ where
|
|||||||
tx.hash,
|
tx.hash,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let env = EnvWithHandlerCfg::new(
|
let env = EnvWithHandlerCfg {
|
||||||
Env::boxed(cfg.cfg_env.clone(), block_env, tx_env_with_recovered(&tx)),
|
env: Env::boxed(cfg.cfg_env.clone(), block_env, tx_env_with_recovered(&tx)),
|
||||||
cfg.handler_cfg.spec_id,
|
handler_cfg: cfg.handler_cfg,
|
||||||
);
|
};
|
||||||
|
|
||||||
this.trace_transaction(
|
this.trace_transaction(
|
||||||
opts,
|
opts,
|
||||||
env,
|
env,
|
||||||
@ -436,10 +437,10 @@ where
|
|||||||
// Execute all transactions until index
|
// Execute all transactions until index
|
||||||
for tx in transactions {
|
for tx in transactions {
|
||||||
let tx = tx_env_with_recovered(&tx);
|
let tx = tx_env_with_recovered(&tx);
|
||||||
let env = EnvWithHandlerCfg::new(
|
let env = EnvWithHandlerCfg {
|
||||||
Env::boxed(cfg.cfg_env.clone(), block_env.clone(), tx),
|
env: Env::boxed(cfg.cfg_env.clone(), block_env.clone(), tx),
|
||||||
cfg.handler_cfg.spec_id,
|
handler_cfg: cfg.handler_cfg,
|
||||||
);
|
};
|
||||||
let (res, _) = transact(&mut db, env)?;
|
let (res, _) = transact(&mut db, env)?;
|
||||||
db.commit(res.state);
|
db.commit(res.state);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,5 +63,6 @@ rand.workspace = true
|
|||||||
test-utils = ["alloy-rlp", "reth-db/test-utils"]
|
test-utils = ["alloy-rlp", "reth-db/test-utils"]
|
||||||
optimism = [
|
optimism = [
|
||||||
"reth-primitives/optimism",
|
"reth-primitives/optimism",
|
||||||
"reth-interfaces/optimism"
|
"reth-interfaces/optimism",
|
||||||
|
"reth-node-api/optimism"
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user