Skip to content

Commit

Permalink
Add tx_fee to public_context
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed May 6, 2024
1 parent 3bffc5a commit 092fd38
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 1 addition & 2 deletions noir-projects/aztec-nr/aztec/src/context/avm_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ impl PublicContextInterface for AvmContext {
}

fn transaction_fee(self) -> Field {
assert(false, "'transaction_fee' not implemented!");
0
transaction_fee()
}

fn nullifier_exists(self, unsiloed_nullifier: Field, address: AztecAddress) -> bool {
Expand Down
1 change: 1 addition & 0 deletions noir-projects/aztec-nr/aztec/src/context/interface.nr
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ trait PublicContextInterface {
fn fee_recipient(self) -> AztecAddress;
fn fee_per_da_gas(self) -> Field;
fn fee_per_l2_gas(self) -> Field;
fn transaction_fee(self) -> Field;
fn message_portal(&mut self, recipient: EthAddress, content: Field);
fn consume_l1_to_l2_message(&mut self, content: Field, secret: Field, sender: EthAddress, leaf_index: Field);
fn emit_unencrypted_log<T,N,M>(&mut self, log: T);
Expand Down
5 changes: 2 additions & 3 deletions noir-projects/aztec-nr/aztec/src/context/public_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl PublicContext {
unencrypted_logs_hashes: BoundedVec::new(),
unencrypted_log_preimages_length: 0,
historical_header: inputs.historical_header,
prover_address: AztecAddress::zero(),
prover_address: AztecAddress::zero()
}
}

Expand Down Expand Up @@ -144,7 +144,6 @@ impl PublicContext {
}

pub fn finish(self) -> PublicCircuitPublicInputs {

// Compute the public call stack hashes
let pub_circuit_pub_inputs = PublicCircuitPublicInputs {
call_context: self.inputs.call_context, // Done
Expand Down Expand Up @@ -358,7 +357,7 @@ fn emit_unencrypted_log_oracle<T>(
_contract_address: AztecAddress,
_event_selector: Field,
_message: T,
_counter: u32,
_counter: u32
) -> Field {}

struct FunctionReturns<N> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ contract AvmTest {
context.fee_per_da_gas()
}

#[aztec(public-vm)]
fn get_transaction_fee() -> pub Field {
context.transaction_fee()
}

#[aztec(public-vm)]
fn get_chain_id() -> pub Field {
context.chain_id()
Expand Down

0 comments on commit 092fd38

Please sign in to comment.