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(tracing): js-tracer add coinbase into context #223

Merged
merged 2 commits into from
Oct 15, 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
4 changes: 4 additions & 0 deletions src/tracing/js/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,8 @@ pub(crate) struct JsEvmContext {
pub(crate) value: U256,
/// Number, block number
pub(crate) block: u64,
/// Address, miner of the block
pub(crate) coinbase: Address,
pub(crate) output: Bytes,
/// Number, block timestamp
pub(crate) time: String,
Expand All @@ -692,6 +694,7 @@ impl JsEvmContext {
intrinsic_gas,
value,
block,
coinbase,
output,
time,
transaction_ctx,
Expand All @@ -716,6 +719,7 @@ impl JsEvmContext {
obj.set(js_string!("intrinsicGas"), intrinsic_gas, false, ctx)?;
obj.set(js_string!("value"), to_bigint(value, ctx)?, false, ctx)?;
obj.set(js_string!("block"), block, false, ctx)?;
obj.set(js_string!("coinbase"), address_to_byte_array(coinbase, ctx)?, false, ctx)?;
obj.set(js_string!("output"), to_byte_array(output, ctx)?, false, ctx)?;
obj.set(js_string!("time"), js_string!(time), false, ctx)?;
if let Some(block_hash) = transaction_ctx.block_hash {
Expand Down
1 change: 1 addition & 0 deletions src/tracing/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ impl JsInspector {
gas_price: env.tx.gas_price.try_into().unwrap_or(u64::MAX),
value: env.tx.value,
block: env.block.number.try_into().unwrap_or(u64::MAX),
coinbase: env.block.coinbase,
output: output_bytes.unwrap_or_default(),
time: env.block.timestamp.to_string(),
intrinsic_gas: 0,
Expand Down
Loading