Skip to content

Commit

Permalink
chore: more file name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Sep 22, 2023
1 parent 8d06507 commit 046fd7a
Show file tree
Hide file tree
Showing 56 changed files with 428 additions and 428 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ The L2 -> L1 pending messages set only exist logically, as it is practically unn

### Rollup Contract

The rollup contract has a few very important responsibilities. The contract must keep track of the _L2 rollup state root_, perform _state transitions_ and ensure that the data is available for anyone else to synchronise to the current state.
The rollup contract has a few very important responsibilities. The contract must keep track of the _L2 rollup state root_, perform _state transitions_ and ensure that the data is available for anyone else to synchronize to the current state.

To ensure that _state transitions_ are performed correctly, the contract will derive public inputs for the **rollup circuit** based on the input data, and then use a _verifier_ contract to validate that inputs correctly transition the current state to the next. All data needed for the public inputs to the circuit must be from the rollup block, ensuring that the block is available. For a valid proof, the _rollup state root_ is updated and it will emit an _event_ to make it easy for anyone to find the data by event spotting.

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/dev_docs/contracts/syntax/state_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ In the following example, we define a public state with a boolean type:

#include_code state_vars-PublicState /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust

The BoolSerialisationMethods is part of the Aztec stdlib:
The BoolSerializationMethods is part of the Aztec stdlib:

#include_code state_vars-PublicStateBoolImport /yarn-project/noir-contracts/src/contracts/docs_example_contract/src/main.nr rust

Expand All @@ -36,7 +36,7 @@ It's possible to create a public state for any types. Simply define methods that

The methods should be implemented in a struct that conforms to the following interface:

#include_code TypeSerialisationInterface /yarn-project/aztec-nr/aztec/src/types/type_serialization.nr rust
#include_code TypeSerializationInterface /yarn-project/aztec-nr/aztec/src/types/type_serialization.nr rust

For example, to create a public state for the following type:

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/dev_docs/testing/cheat_codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ struct Storage {
impl Storage {
fn init() -> Self {
Storage {
balances: Map::new(1, |slot| PublicState::new(slot, FieldSerialisationMethods)),
balances: Map::new(1, |slot| PublicState::new(slot, FieldSerializationMethods)),
}
}
}
Expand Down Expand Up @@ -502,7 +502,7 @@ struct Storage {
impl Storage {
fn init() -> Self {
Storage {
balances: Map::new(1, |slot| PublicState::new(slot, FieldSerialisationMethods)),
balances: Map::new(1, |slot| PublicState::new(slot, FieldSerializationMethods)),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/dev_docs/tutorials/writing_token_contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ You can read more about it [here](../contracts/syntax/storage.md).

Once we have Storage defined, we need to specify how to initialize it. The `init` method creates and initializes an instance of `Storage`. We define an initialization method for each of the storage variables defined above. Storage initialization is generic and can largely be reused for similar types, across different contracts, but it is important to note that each storage variable specifies it's storage slot, starting at 1.

Also, the public storage variables define the type that they store by passing the methods by which they are serialized. Because all `PublicState` in this contract is storing Field elements, each storage variable takes `FieldSerialisationMethods`.
Also, the public storage variables define the type that they store by passing the methods by which they are serialized. Because all `PublicState` in this contract is storing Field elements, each storage variable takes `FieldSerializationMethods`.

#include_code storage_init /yarn-project/noir-contracts/src/contracts/token_contract/src/main.nr rust

Expand Down
20 changes: 10 additions & 10 deletions yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ import {
} from '@aztec/types';
import {
MerkleTrees,
ServerWorldStateSynchroniser,
ServerWorldStateSynchronizer,
WorldStateConfig,
WorldStateSynchroniser,
WorldStateSynchronizer,
computePublicDataTreeLeafIndex,
getConfigEnvVars as getWorldStateConfig,
} from '@aztec/world-state';
Expand All @@ -63,7 +63,7 @@ export class AztecNodeService implements AztecNode {
protected unencryptedLogsSource: L2LogsSource,
protected contractDataSource: ContractDataSource,
protected l1ToL2MessageSource: L1ToL2MessageSource,
protected worldStateSynchroniser: WorldStateSynchroniser,
protected worldStateSynchronizer: WorldStateSynchronizer,
protected sequencer: SequencerClient,
protected chainId: number,
protected version: number,
Expand Down Expand Up @@ -92,16 +92,16 @@ export class AztecNodeService implements AztecNode {
const merkleTreesDb = levelup(createMemDown());
const merkleTrees = await MerkleTrees.new(merkleTreesDb, await CircuitsWasm.get());
const worldStateConfig: WorldStateConfig = getWorldStateConfig();
const worldStateSynchroniser = new ServerWorldStateSynchroniser(merkleTrees, archiver, worldStateConfig);
const worldStateSynchronizer = new ServerWorldStateSynchronizer(merkleTrees, archiver, worldStateConfig);

// start both and wait for them to sync from the block source
await Promise.all([p2pClient.start(), worldStateSynchroniser.start()]);
await Promise.all([p2pClient.start(), worldStateSynchronizer.start()]);

// now create the sequencer
const sequencer = await SequencerClient.new(
config,
p2pClient,
worldStateSynchroniser,
worldStateSynchronizer,
archiver,
archiver,
archiver,
Expand All @@ -113,7 +113,7 @@ export class AztecNodeService implements AztecNode {
archiver,
archiver,
archiver,
worldStateSynchroniser,
worldStateSynchronizer,
sequencer,
config.chainId,
config.version,
Expand Down Expand Up @@ -231,7 +231,7 @@ export class AztecNodeService implements AztecNode {
public async stop() {
await this.sequencer.stop();
await this.p2pClient.stop();
await this.worldStateSynchroniser.stop();
await this.worldStateSynchronizer.stop();
await this.blockSource.stop();
this.log.info(`Stopped`);
}
Expand Down Expand Up @@ -420,7 +420,7 @@ export class AztecNodeService implements AztecNode {
} catch (err) {
this.log.error(`Error getting world state: ${err}`);
}
return this.worldStateSynchroniser.getCommitted();
return this.worldStateSynchronizer.getCommitted();
}

/**
Expand All @@ -429,6 +429,6 @@ export class AztecNodeService implements AztecNode {
*/
private async syncWorldState() {
const blockSourceHeight = await this.blockSource.getBlockNumber();
await this.worldStateSynchroniser.syncImmediate(blockSourceHeight);
await this.worldStateSynchronizer.syncImmediate(blockSourceHeight);
}
}
4 changes: 2 additions & 2 deletions yarn-project/aztec-nr/aztec/src/account.nr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::entrypoint::EntrypointPayload;
use crate::context::{PrivateContext, PublicContext, Context};
use crate::oracle::compute_selector::compute_selector;
use crate::state_vars::{map::Map, public_state::PublicState};
use crate::types::type_serialization::bool_serialization::{BoolSerialisationMethods,BOOL_SERIALIZED_LEN};
use crate::types::type_serialization::bool_serialization::{BoolSerializationMethods,BOOL_SERIALIZED_LEN};
use crate::auth::IS_VALID_SELECTOR;

struct AccountActions {
Expand All @@ -20,7 +20,7 @@ impl AccountActions {
context,
approved_action_storage_slot,
|context, slot| {
PublicState::new(context, slot, BoolSerialisationMethods)
PublicState::new(context, slot, BoolSerializationMethods)
},
),
}
Expand Down
6 changes: 3 additions & 3 deletions yarn-project/aztec-nr/aztec/src/state_vars/public_state.nr
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
use crate::context::{Context};
use crate::oracle::storage::storage_read;
use crate::oracle::storage::storage_write;
use crate::types::type_serialization::TypeSerialisationInterface;
use crate::types::type_serialization::TypeSerializationInterface;
use dep::std::option::Option;

struct PublicState<T, T_SERIALIZED_LEN> {
storage_slot: Field,
serialization_methods: TypeSerialisationInterface<T, T_SERIALIZED_LEN>,
serialization_methods: TypeSerializationInterface<T, T_SERIALIZED_LEN>,
}

impl<T, T_SERIALIZED_LEN> PublicState<T, T_SERIALIZED_LEN> {
fn new(
// Note: Passing the contexts to new(...) just to have an interface compatible with a Map.
_: Context,
storage_slot: Field,
serialization_methods: TypeSerialisationInterface<T, T_SERIALIZED_LEN>,
serialization_methods: TypeSerializationInterface<T, T_SERIALIZED_LEN>,
) -> Self {
assert(storage_slot != 0, "Storage slot 0 not allowed. Storage slots must start from 1.");
PublicState {
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/aztec-nr/aztec/src/types/point.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::types::type_serialization::TypeSerialisationInterface;
use crate::types::type_serialization::TypeSerializationInterface;

struct Point {
x: Field,
Expand All @@ -24,7 +24,7 @@ fn serializePoint(point: Point) -> [Field; POINT_SERIALIZED_LEN] {
[point.x, point.y]
}

global PointSerialisationMethods = TypeSerialisationInterface {
global PointSerializationMethods = TypeSerializationInterface {
deserialize: deserializePoint,
serialize: serializePoint,
};
6 changes: 3 additions & 3 deletions yarn-project/aztec-nr/aztec/src/types/type_serialization.nr
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ mod u32_serialization;
/**
* Before Noir supports traits, a way of specifying the serialization and deserialization methods for a type.
*/
// docs:start:TypeSerialisationInterface
struct TypeSerialisationInterface<T, N> {
// docs:start:TypeSerializationInterface
struct TypeSerializationInterface<T, N> {
deserialize: fn ([Field; N]) -> T,
serialize: fn (T) -> [Field; N],
}
// docs:end:TypeSerialisationInterface
// docs:end:TypeSerializationInterface
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::types::type_serialization::TypeSerialisationInterface;
use crate::types::type_serialization::TypeSerializationInterface;

global BOOL_SERIALIZED_LEN: Field = 1;

Expand All @@ -10,7 +10,7 @@ fn serializeBool(value: bool) -> [Field; BOOL_SERIALIZED_LEN] {
[value as Field]
}

global BoolSerialisationMethods = TypeSerialisationInterface {
global BoolSerializationMethods = TypeSerializationInterface {
deserialize: deserializeBool,
serialize: serializeBool,
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::types::type_serialization::TypeSerialisationInterface;
use crate::types::type_serialization::TypeSerializationInterface;

global FIELD_SERIALIZED_LEN: Field = 1;

Expand All @@ -10,7 +10,7 @@ fn serializeField(value: Field) -> [Field; FIELD_SERIALIZED_LEN] {
[value]
}

global FieldSerialisationMethods = TypeSerialisationInterface {
global FieldSerializationMethods = TypeSerializationInterface {
deserialize: deserializeField,
serialize: serializeField,
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::types::type_serialization::TypeSerialisationInterface;
use crate::types::type_serialization::TypeSerializationInterface;

global U32_SERIALIZED_LEN: Field = 1;

Expand All @@ -10,7 +10,7 @@ fn serializeU32(value: u32) -> [Field; U32_SERIALIZED_LEN] {
[value as Field]
}

global U32SerialisationMethods = TypeSerialisationInterface {
global U32SerializationMethods = TypeSerializationInterface {
deserialize: deserializeU32,
serialize: serializeU32,
};
2 changes: 1 addition & 1 deletion yarn-project/aztec-rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

- [Acir Simulator](../acir-simulator/)
- [Key Store](../key-store/)
- [Account State](./src/account_state/account_state.ts): It coordinates other components to synchronise and decrypt data, simulate transactions, and generate kernel proofs, for a specific account.
- [Account State](./src/account_state/account_state.ts): It coordinates other components to synchronize and decrypt data, simulate transactions, and generate kernel proofs, for a specific account.
22 changes: 11 additions & 11 deletions yarn-project/aztec-rpc/src/aztec_rpc_server/aztec_rpc_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ import { Database } from '../database/index.js';
import { KernelOracle } from '../kernel_oracle/index.js';
import { KernelProver } from '../kernel_prover/kernel_prover.js';
import { getAcirSimulator } from '../simulator/index.js';
import { Synchroniser } from '../synchroniser/index.js';
import { Synchronizer } from '../synchronizer/index.js';

/**
* A remote Aztec RPC Client implementation.
*/
export class AztecRPCServer implements AztecRPC {
private synchroniser: Synchroniser;
private synchronizer: Synchronizer;
private contractDataOracle: ContractDataOracle;
private simulator: AcirSimulator;
private log: DebugLogger;
Expand All @@ -78,7 +78,7 @@ export class AztecRPCServer implements AztecRPC {
logSuffix?: string,
) {
this.log = createDebugLogger(logSuffix ? `aztec:rpc_server_${logSuffix}` : `aztec:rpc_server`);
this.synchroniser = new Synchroniser(node, db, logSuffix);
this.synchronizer = new Synchronizer(node, db, logSuffix);
this.contractDataOracle = new ContractDataOracle(db, node);
this.simulator = getAcirSimulator(db, node, node, node, keyStore, this.contractDataOracle);

Expand All @@ -91,7 +91,7 @@ export class AztecRPCServer implements AztecRPC {
* @returns A promise that resolves when the server has started successfully.
*/
public async start() {
await this.synchroniser.start(INITIAL_L2_BLOCK_NUM, 1, this.config.l2BlockPollingIntervalMS);
await this.synchronizer.start(INITIAL_L2_BLOCK_NUM, 1, this.config.l2BlockPollingIntervalMS);
const info = await this.getNodeInfo();
this.log.info(`Started RPC server connected to chain ${info.chainId} version ${info.protocolVersion}`);
}
Expand All @@ -104,7 +104,7 @@ export class AztecRPCServer implements AztecRPC {
* @returns A Promise resolving once the server has been stopped successfully.
*/
public async stop() {
await this.synchroniser.stop();
await this.synchronizer.stop();
this.log.info('Stopped');
}

Expand All @@ -117,7 +117,7 @@ export class AztecRPCServer implements AztecRPC {
const wasAdded = await this.db.addCompleteAddress(completeAddress);
if (wasAdded) {
const pubKey = this.keyStore.addAccount(privKey);
this.synchroniser.addAccount(pubKey, this.keyStore);
this.synchronizer.addAccount(pubKey, this.keyStore);
this.log.info(`Registered account ${completeAddress.address.toString()}`);
this.log.debug(`Registered account\n ${completeAddress.toReadableString()}`);
} else {
Expand Down Expand Up @@ -576,15 +576,15 @@ export class AztecRPCServer implements AztecRPC {
);
}

public async isGlobalStateSynchronised() {
return await this.synchroniser.isGlobalStateSynchronised();
public async isGlobalStateSynchronized() {
return await this.synchronizer.isGlobalStateSynchronized();
}

public async isAccountStateSynchronised(account: AztecAddress) {
return await this.synchroniser.isAccountStateSynchronised(account);
public async isAccountStateSynchronized(account: AztecAddress) {
return await this.synchronizer.isAccountStateSynchronized(account);
}

public getSyncStatus() {
return Promise.resolve(this.synchroniser.getSyncStatus());
return Promise.resolve(this.synchronizer.getSyncStatus());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const aztecRpcTestSuite = (testName: string, aztecRpcSetup: () => Promise
expect(nodeInfo.rollupAddress.toString()).toMatch(/0x[a-fA-F0-9]+/);
});

// Note: Not testing `isGlobalStateSynchronised`, `isAccountStateSynchronised` and `getSyncStatus` as these methods
// only call synchroniser.
// Note: Not testing `isGlobalStateSynchronized`, `isAccountStateSynchronized` and `getSyncStatus` as these methods
// only call synchronizer.
});
};
8 changes: 4 additions & 4 deletions yarn-project/aztec-rpc/src/note_processor/note_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ export class NoteProcessor {
) {}

/**
* Check if the NoteProcessor is synchronised with the remote block number.
* Check if the NoteProcessor is synchronized with the remote block number.
* The function queries the remote block number from the AztecNode and compares it with the syncedToBlock value in the NoteProcessor.
* If the values are equal, then the NoteProcessor is considered to be synchronised, otherwise not.
* If the values are equal, then the NoteProcessor is considered to be synchronized, otherwise not.
*
* @returns A boolean indicating whether the NoteProcessor is synchronised with the remote block number or not.
* @returns A boolean indicating whether the NoteProcessor is synchronized with the remote block number or not.
*/
public async isSynchronised() {
public async isSynchronized() {
const remoteBlockNumber = await this.node.getBlockNumber();
return this.syncedToBlock === remoteBlockNumber;
}
Expand Down
1 change: 0 additions & 1 deletion yarn-project/aztec-rpc/src/synchroniser/index.ts

This file was deleted.

1 change: 1 addition & 0 deletions yarn-project/aztec-rpc/src/synchronizer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './synchronizer.js';
Loading

0 comments on commit 046fd7a

Please sign in to comment.