-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
91 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mod private_global_variables; | ||
mod public_global_variables; |
14 changes: 14 additions & 0 deletions
14
yarn-project/aztec-nr/aztec/src/context/globals/private_global_variables.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use dep::protocol_types::traits::Serialize; | ||
|
||
// docs:start:private-global-variables | ||
struct PrivateGlobalVariables { | ||
chain_id: Field, | ||
version: Field, | ||
} | ||
// docs:end:private-global-variables | ||
|
||
impl Serialize<2> for PrivateGlobalVariables { | ||
fn serialize(self) -> [Field; 2] { | ||
[self.chain_id, self.version] | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
yarn-project/aztec-nr/aztec/src/context/globals/public_global_variables.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use dep::protocol_types::{ | ||
address::{ | ||
AztecAddress, | ||
EthAddress, | ||
}, | ||
traits::Serialize, | ||
}; | ||
|
||
// docs:start:public-global-variables | ||
struct PublicGlobalVariables { | ||
chain_id: Field, | ||
version: Field, | ||
block_number: Field, | ||
timestamp: Field, | ||
coinbase: EthAddress, | ||
fee_recipient: AztecAddress, | ||
} | ||
// docs:end:public-global-variables | ||
|
||
impl Serialize<6> for PublicGlobalVariables { | ||
fn serialize(self) -> [Field; 6] { | ||
[ | ||
self.chain_id, | ||
self.version, | ||
self.block_number, | ||
self.timestamp, | ||
self.coinbase.to_field(), | ||
self.fee_recipient.to_field(), | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mod private_context_inputs; | ||
mod public_context_inputs; |
16 changes: 16 additions & 0 deletions
16
yarn-project/aztec-nr/aztec/src/context/inputs/private_context_inputs.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use dep::protocol_types::{ | ||
abis::call_context::CallContext, | ||
contrakt::deployment_data::ContractDeploymentData, | ||
header::Header, | ||
}; | ||
use crate::context::globals::private_global_variables::PrivateGlobalVariables; | ||
|
||
// PrivateContextInputs are expected to be provided to each private function | ||
// docs:start:private-context-inputs | ||
struct PrivateContextInputs { | ||
call_context : CallContext, | ||
historical_header: Header, | ||
contract_deployment_data: ContractDeploymentData, | ||
private_global_variables: PrivateGlobalVariables, | ||
} | ||
// docs:end:private-context-inputs |
16 changes: 16 additions & 0 deletions
16
yarn-project/aztec-nr/aztec/src/context/inputs/public_context_inputs.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crate::context::globals::public_global_variables::PublicGlobalVariables; | ||
|
||
use dep::protocol_types::{ | ||
abis::call_context::CallContext, | ||
header::Header, | ||
}; | ||
|
||
// PublicContextInputs are expected to be provided to each public function | ||
// docs:start:public-context-inputs | ||
struct PublicContextInputs { | ||
call_context: CallContext, | ||
historical_header: Header, | ||
|
||
public_global_variables: PublicGlobalVariables, | ||
} | ||
// docs:end:public-context-inputs |
2 changes: 1 addition & 1 deletion
2
...ect/aztec-nr/aztec/src/context/private.nr → ...c-nr/aztec/src/context/private_context.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ject/aztec-nr/aztec/src/context/public.nr → ...ec-nr/aztec/src/context/public_context.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
mod abi; | ||
mod avm; | ||
mod context; | ||
mod hash; | ||
|