From 8c33dc159cc84b02224718e296b02ca9fe8987d6 Mon Sep 17 00:00:00 2001 From: johntaiko Date: Thu, 10 Aug 2023 07:38:46 +0000 Subject: [PATCH] feat: add treasury account in the block table --- zkevm-circuits/src/table/block_table.rs | 2 ++ zkevm-circuits/src/witness/block.rs | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/zkevm-circuits/src/table/block_table.rs b/zkevm-circuits/src/table/block_table.rs index 443e993673..4c58b76377 100644 --- a/zkevm-circuits/src/table/block_table.rs +++ b/zkevm-circuits/src/table/block_table.rs @@ -21,6 +21,8 @@ pub enum BlockContextFieldTag { /// Chain ID field. Although this is not a field in the block header, we /// add it here for convenience. ChainId, + /// Treasury accounts for receiving block base fee + Treasury, } impl_expr!(BlockContextFieldTag); diff --git a/zkevm-circuits/src/witness/block.rs b/zkevm-circuits/src/witness/block.rs index 4d8d38e2f3..29dfa905cc 100644 --- a/zkevm-circuits/src/witness/block.rs +++ b/zkevm-circuits/src/witness/block.rs @@ -172,6 +172,8 @@ impl Block { pub struct BlockContext { /// The address of the miner for the block pub coinbase: Address, + /// The address of the treasury for the base fee + pub treasury: Address, /// The gas limit of the block pub gas_limit: u64, /// The number of the block @@ -200,6 +202,11 @@ impl BlockContext { Value::known(F::ZERO), Value::known(self.coinbase.to_scalar().unwrap()), ], + [ + Value::known(F::from(BlockContextFieldTag::Treasury as u64)), + Value::known(F::ZERO), + Value::known(self.treasury.to_scalar().unwrap()), + ], [ Value::known(F::from(BlockContextFieldTag::Timestamp as u64)), Value::known(F::ZERO), @@ -264,6 +271,7 @@ impl From<&circuit_input_builder::Block> for BlockContext { fn from(block: &circuit_input_builder::Block) -> Self { Self { coinbase: block.coinbase, + treasury: block.protocol_instance.meta_hash.treasury, gas_limit: block.gas_limit, number: block.number, timestamp: block.timestamp,