Skip to content

Commit

Permalink
fix: Remove tx.origin (#5765)
Browse files Browse the repository at this point in the history
Fixes #5756
  • Loading branch information
spalladino authored Apr 16, 2024
1 parent 6a0713e commit c8784d7
Show file tree
Hide file tree
Showing 21 changed files with 91 additions and 181 deletions.
4 changes: 1 addition & 3 deletions avm-transpiler/src/opcodes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// All AVM opcodes
/// Keep updated with TS and docs protocol specs!
/// Keep updated with TS, cpp, and docs protocol specs!
#[derive(PartialEq, Copy, Clone, Debug)]
pub enum AvmOpcode {
// Compute
Expand All @@ -21,7 +21,6 @@ pub enum AvmOpcode {
// Execution environment
ADDRESS,
STORAGEADDRESS,
ORIGIN,
SENDER,
PORTAL,
FEEPERL1GAS,
Expand Down Expand Up @@ -102,7 +101,6 @@ impl AvmOpcode {
// Execution Environment
AvmOpcode::ADDRESS => "ADDRESS",
AvmOpcode::STORAGEADDRESS => "STORAGEADDRESS",
AvmOpcode::ORIGIN => "ORIGIN",
AvmOpcode::SENDER => "SENDER",
AvmOpcode::PORTAL => "PORTAL",
AvmOpcode::FEEPERL1GAS => "FEEPERL1GAS",
Expand Down
1 change: 0 additions & 1 deletion avm-transpiler/src/transpile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,6 @@ fn handle_getter_instruction(
let opcode = match function {
"avmOpcodeAddress" => AvmOpcode::ADDRESS,
"avmOpcodeStorageAddress" => AvmOpcode::STORAGEADDRESS,
"avmOpcodeOrigin" => AvmOpcode::ORIGIN,
"avmOpcodeSender" => AvmOpcode::SENDER,
"avmOpcodePortal" => AvmOpcode::PORTAL,
"avmOpcodeFeePerL1Gas" => AvmOpcode::FEEPERL1GAS,
Expand Down
2 changes: 0 additions & 2 deletions barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_opcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const std::unordered_map<OpCode, size_t> Bytecode::OPERANDS_NUM = {
//// Execution Environment
//{OpCode::ADDRESS, },
//{OpCode::STORAGEADDRESS, },
//{OpCode::ORIGIN, },
//{OpCode::SENDER, },
//{OpCode::PORTAL, },
//{OpCode::FEEPERL1GAS, },
Expand Down Expand Up @@ -116,7 +115,6 @@ bool Bytecode::has_in_tag(OpCode const op_code)
switch (op_code) {
case OpCode::ADDRESS:
case OpCode::STORAGEADDRESS:
case OpCode::ORIGIN:
case OpCode::SENDER:
case OpCode::PORTAL:
case OpCode::FEEPERL1GAS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ enum class OpCode : uint8_t {
// Execution Environment
ADDRESS,
STORAGEADDRESS,
ORIGIN,
SENDER,
PORTAL,
FEEPERL1GAS,
Expand Down
14 changes: 7 additions & 7 deletions docs/docs/protocol-specs/circuits/private-kernel-initial.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -714,13 +714,13 @@ TransientAccumulatedData --* PublicInputs: transient_accumulated_data

Data that represents the caller's intent.

| Field | Type | Description |
| --------------- | ------------------------------------------- | -------------------------------------------- |
| `origin` | `AztecAddress` | The Aztec address of the transaction sender. |
| `function_data` | [`FunctionData`](#functiondata) | Data of the function being called. |
| `args_hash` | `field` | Hash of the function arguments. |
| `tx_context` | [`TransactionContext`](#transactioncontext) | Information about the transaction. |
| `gas_settings` | [`GasSettings`](#gassettings) | User-defined gas limits and max fees. |
| Field | Type | Description |
| --------------- | ------------------------------------------- | ------------------------------------- |
| `origin` | `AztecAddress` | Address of the entrypoint contract. |
| `function_data` | [`FunctionData`](#functiondata) | Data of the function being called. |
| `args_hash` | `field` | Hash of the function arguments. |
| `tx_context` | [`TransactionContext`](#transactioncontext) | Information about the transaction. |
| `gas_settings` | [`GasSettings`](#gassettings) | User-defined gas limits and max fees. |

### `PrivateCall`

Expand Down
1 change: 0 additions & 1 deletion docs/docs/protocol-specs/public-vm/_nested-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ nestedContext = deriveContext(context, instr.args, isStaticCall, isDelegateCall)
Nested context derivation is defined as follows:
```jsx
nestedExecutionEnvironment = ExecutionEnvironment {
origin: context.origin,
sender: isDelegateCall ? context.sender : context.address,
address: M[addrOffset],
storageAddress: isDelegateCall ? context.storageAddress : M[addrOffset],
Expand Down
1 change: 0 additions & 1 deletion docs/docs/protocol-specs/public-vm/avm-circuit.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ The VM circuit's I/O (`AvmPublicInputs`) is defined below:
```
AvmSessionInputs {
// Initializes Execution Environment
origin: AztecAddress,
feePerL1Gas: field,
feePerL2Gas: field,
feePerDaGas: field,
Expand Down
2 changes: 0 additions & 2 deletions docs/docs/protocol-specs/public-vm/context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ A context's **execution environment** remains constant throughout a contract cal
| --- | --- | --- |
| address | `AztecAddress` | |
| storageAddress | `AztecAddress` | |
| origin | `AztecAddress` | |
| sender | `AztecAddress` | |
| portal | `EthAddress` | |
| feePerL1Gas | `field` | |
Expand Down Expand Up @@ -73,7 +72,6 @@ Given a [`PublicCallRequest`](../transactions/tx-object#public-call-request) and
INITIAL_EXECUTION_ENVIRONMENT = ExecutionEnvironment {
address: PublicCallRequest.contractAddress,
storageAddress: PublicCallRequest.CallContext.storageContractAddress,
origin: TxRequest.origin,
sender: PublicCallRequest.CallContext.msgSender,
portal: PublicCallRequest.CallContext.portalContractAddress,
feePerL1Gas: TxRequest.feePerL1Gas,
Expand Down
Loading

0 comments on commit c8784d7

Please sign in to comment.