Skip to content

Commit

Permalink
feat: add treasury account in the block table
Browse files Browse the repository at this point in the history
  • Loading branch information
johntaiko committed Aug 10, 2023
1 parent 9b64614 commit 8c33dc1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions zkevm-circuits/src/table/block_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
8 changes: 8 additions & 0 deletions zkevm-circuits/src/witness/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ impl<F: Field> Block<F> {
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
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8c33dc1

Please sign in to comment.