Skip to content

Commit

Permalink
fix: add new oracle contract to devnet in CI (#4687)
Browse files Browse the repository at this point in the history
- New L1 contract was created but not added to our devnet in CI
processes.
- Also fix check of cli arg of rollup contract address
  • Loading branch information
spypsy committed Feb 21, 2024
1 parent 96f6b2a commit 920fa10
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
4 changes: 4 additions & 0 deletions l1-contracts/scripts/ci_deploy_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ docker run \
# L1 -> L2 Inbox Address: 0xdf34a07c7da15630d3b5d6bb17651d548a6e9d8f
# L2 -> L1 Outbox address: 0xf6b1b3c2c393fe55fe577a1f528bd72a76589ab0
# Contract Deployment Emitter Address: 0xf3ecc6e9428482a74687ee5f7b96f4dff8781454
# Availability Oracle Address: 0x610178da211fef7d417bc0e6fed39f05609ad788

# Read the file line by line
while IFS= read -r line; do
Expand All @@ -59,6 +60,9 @@ while IFS= read -r line; do
elif [[ $line == *"Emitter"* ]]; then
export TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS=$address
echo "TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS=$TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS"
elif [[ $line == *"Oracle"* ]]; then
export TF_VAR_AVAILABILITY_ORACLE_CONTRACT_ADDRESS=$address
echo "TF_VAR_AVAILABILITY_ORACLE_CONTRACT_ADDRESS=$TF_VAR_AVAILABILITY_ORACLE_CONTRACT_ADDRESS"
fi
done <"$FILE_PATH"

Expand Down
9 changes: 9 additions & 0 deletions l1-contracts/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ output "rollup_contract_address" {
value = var.ROLLUP_CONTRACT_ADDRESS
}

variable "AVAILABILITY_ORACLE_CONTRACT_ADDRESS" {
type = string
default = ""
}

output "availability_oracle_contract_address" {
value = var.AVAILABILITY_ORACLE_CONTRACT_ADDRESS
}

variable "REGISTRY_CONTRACT_ADDRESS" {
type = string
default = ""
Expand Down
4 changes: 4 additions & 0 deletions yarn-project/aztec-node/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ resource "aws_ecs_task_definition" "aztec-node" {
"name": "REGISTRY_CONTRACT_ADDRESS",
"value": "${data.terraform_remote_state.l1_contracts.outputs.registry_contract_address}"
},
{
"name": "AVAILABILITY_ORACLE_CONTRACT_ADDRESS",
"value": "${data.terraform_remote_state.l1_contracts.outputs.availability_oracle_contract_address}"
},
{
"name": "API_KEY",
"value": "${var.API_KEY}"
Expand Down
1 change: 1 addition & 0 deletions yarn-project/aztec/src/cli/texts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const contractAddresses =
'inboxAddress:INBOX_CONTRACT_ADDRESS - string - The deployed L1 inbox contract address.\n' +
'outboxAddress:OUTBOX_CONTRACT_ADDRESS - string - The deployed L1 outbox contract address.\n' +
'contractDeploymentEmitterAddress:CONTRACT_DEPLOYMENT_EMITTER_ADDRESS - string - The deployed L1 contract deployment emitter contract address.\n';
('availabilityOracleAddress:AVAILABILITY_ORACLE_CONTRACT_ADDRESS - string - The deployed L1 availability oracle contract address.\n');
const p2pOptions =
'p2pBlockCheckIntervalMS:P2P_BLOCK_CHECK_INTERVAL_MS - number - The frequency in which to check for blocks. Default: 100\n' +
'p2pL2QueueSize:P2P_L2_QUEUE_SIZE - number - Size of queue of L2 blocks to store. Default: 1000\n' +
Expand Down
14 changes: 8 additions & 6 deletions yarn-project/aztec/src/cli/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import { LogFn, createConsoleLogger } from '@aztec/foundation/log';
import { P2PConfig } from '@aztec/p2p';
import { GrumpkinScalar, PXEService, PXEServiceConfig } from '@aztec/pxe';

const l1ContractsNames = ['rollupAddress', 'inboxAddress', 'outboxAddress', 'contractDeploymentEmitterAddress'];
const l1ContractsNames = [
'rollupAddress',
'inboxAddress',
'outboxAddress',
'contractDeploymentEmitterAddress',
'availabilityOracleAddress',
];

/**
* Checks if the object has l1Contracts property
Expand Down Expand Up @@ -69,10 +75,6 @@ export const mergeEnvVarsAndCliOptions = <T extends AztecNodeConfig | PXEService
contractsRequired = false,
userLog = createConsoleLogger(),
) => {
if (contractsRequired && !cliOptions.rollupAddress) {
throw new Error('Rollup contract address is required to start the service');
}

let merged = { ...envVars, ...cliOptions } as T;

if (hasL1Contracts(envVars)) {
Expand All @@ -86,7 +88,7 @@ export const mergeEnvVarsAndCliOptions = <T extends AztecNodeConfig | PXEService
}
}, {} as L1ContractAddresses);

if (hasL1Contracts(envVars) && contractsRequired && !checkContractAddresses(l1Contracts)) {
if (contractsRequired && !checkContractAddresses(l1Contracts)) {
userLog('Deployed L1 contract addresses are required to start the service');
throw new Error('Deployed L1 contract addresses are required to start the service');
}
Expand Down
1 change: 1 addition & 0 deletions yarn-project/cli/src/cmds/deploy_l1_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export async function deployL1Contracts(
log(`L1 -> L2 Inbox Address: ${l1ContractAddresses.inboxAddress.toString()}`);
log(`L2 -> L1 Outbox address: ${l1ContractAddresses.outboxAddress.toString()}`);
log(`Contract Deployment Emitter Address: ${l1ContractAddresses.contractDeploymentEmitterAddress.toString()}`);
log(`Availability Oracle Address: ${l1ContractAddresses.availabilityOracleAddress.toString()}`);
log('\n');
}

0 comments on commit 920fa10

Please sign in to comment.