Skip to content

Commit f365a20

Browse files
author
AztecBot
committed
Merge branch 'next' into merge-train/barretenberg
2 parents aeb6ccd + 39e51b4 commit f365a20

File tree

9 files changed

+232
-72
lines changed

9 files changed

+232
-72
lines changed

.github/workflows/nightly-spartan-bench.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ name: Nightly Spartan Benchmarks
22

33
on:
44
schedule:
5-
# Run every night at 3:00 AM UTC (1 hour after nightly release tag at 2:00 AM)
6-
- cron: "0 3 * * *"
5+
- cron: "0 4 * * *"
76
workflow_dispatch:
87
inputs:
98
nightly_tag:

spartan/scripts/install_deps.sh

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
#!/usr/bin/env bash
2-
echo "Installing dependencies..."
32
source $(git rev-parse --show-toplevel)/ci3/source
4-
echo "Source loaded"
3+
4+
log() { echo "[INFO] $(date -Is) - $*"; }
5+
err() { echo "[ERROR] $(date -Is) - $*" >&2; }
6+
die() { err "$*"; exit 1; }
7+
require_cmd() { command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1"; }
8+
9+
log "Installing dependencies..."
510

611
# if kubectl is not installed, install it
712
if ! command -v kubectl &> /dev/null; then
8-
echo "Installing kubectl..."
9-
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/$(os)/$(arch)/kubectl"
13+
log "Installing kubectl..."
14+
curl -sLO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/$(os)/$(arch)/kubectl"
1015
chmod +x kubectl
1116
sudo mv kubectl /usr/local/bin/kubectl
1217
fi
1318

1419
# Install kind if it is not installed
1520
if ! command -v kind &> /dev/null; then
16-
echo "Installing kind..."
17-
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.23.0/kind-$(os)-$(arch)
21+
log "Installing kind..."
22+
curl -sLo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.23.0/kind-$(os)-$(arch)
1823
chmod +x ./kind
1924
sudo mv ./kind /usr/local/bin/kind
2025
fi
@@ -28,7 +33,7 @@ function get_helm_from_cache {
2833
elif [ -f ./usr/local/bin/helm ]; then
2934
sudo mv ./usr/local/bin/helm /usr/local/bin/helm
3035
else
31-
echo "Could not extract helm from cache"
36+
err "Could not extract helm from cache"
3237
return 1
3338
fi
3439
sudo chmod +x /usr/local/bin/helm
@@ -38,16 +43,16 @@ function get_helm_from_cache {
3843

3944
# Install helm if it is not installed
4045
if ! command -v helm &> /dev/null; then
41-
echo "Installing helm..."
46+
log "Installing helm..."
4247

4348
# Determine the helm artifact name based on OS and architecture
4449
helm_artifact="helm-$(os)-$(arch).tar.gz"
4550
helm_release_url="https://github.com/helm/helm/releases/tag/v3.19.0"
4651

4752
if get_helm_from_cache "$helm_artifact" >/dev/null; then
48-
echo "Using cached Helm binary"
53+
log "Using cached Helm binary"
4954
else
50-
echo "Downloading Helm from get.helm.sh..."
55+
log "Downloading Helm from get.helm.sh..."
5156
# Download and run the official Helm installer script
5257
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
5358
chmod +x get_helm.sh
@@ -63,9 +68,9 @@ if ! command -v helm &> /dev/null; then
6368
fi
6469

6570
if ! command -v stern &> /dev/null; then
66-
echo "Installing stern..."
71+
log "Installing stern..."
6772
# Download Stern
68-
curl -Lo stern.tar.gz https://github.com/stern/stern/releases/download/v1.31.0/stern_1.31.0_$(os)_$(arch).tar.gz
73+
curl -sLo stern.tar.gz https://github.com/stern/stern/releases/download/v1.31.0/stern_1.31.0_$(os)_$(arch).tar.gz
6974

7075
# Extract the binary
7176
tar -xzf stern.tar.gz
@@ -82,8 +87,8 @@ if ! command -v stern &> /dev/null; then
8287
fi
8388

8489
if ! command -v gcloud &> /dev/null; then
85-
echo "Installing gcloud..."
86-
curl -Lo google-cloud-cli.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-$os-$(arch).tar.gz
90+
log "Installing gcloud..."
91+
curl -sLo google-cloud-cli.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-$os-$(arch).tar.gz
8792
tar -xzf google-cloud-cli.tar.gz
8893
rm google-cloud-cli.tar.gz
8994

@@ -105,20 +110,17 @@ if command -v gcloud &> /dev/null; then
105110
if dpkg -l google-cloud-cli-gke-gcloud-auth-plugin 2>/dev/null | grep -q "^ii"; then
106111
: # do nothing
107112
else
108-
echo "Installing GKE auth plugin for kubectl via apt..."
113+
log "Installing GKE auth plugin for kubectl via apt..."
109114
sudo apt-get update
110115
sudo apt-get install -y google-cloud-cli-gke-gcloud-auth-plugin
111116
fi
112117
else
113-
echo "Installing GKE auth plugin for kubectl via gcloud components..."
118+
log "Installing GKE auth plugin for kubectl via gcloud components..."
114119
gcloud components install gke-gcloud-auth-plugin
115120
fi
116121
fi
117122

118123

119-
# Sanity check commands
120-
require_cmd() { command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1"; }
121-
122124
require_cmd git
123125
require_cmd kubectl
124126
require_cmd terraform

yarn-project/archiver/src/archiver/archiver_store_test_suite.ts

Lines changed: 76 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
SerializableContractInstance,
2929
computePublicBytecodeCommitment,
3030
} from '@aztec/stdlib/contract';
31-
import { LogId, PrivateLog, PublicLog } from '@aztec/stdlib/logs';
31+
import { ContractClassLog, LogId, PrivateLog, PublicLog } from '@aztec/stdlib/logs';
3232
import { InboxLeaf } from '@aztec/stdlib/messaging';
3333
import {
3434
makeContractClassPublic,
@@ -905,13 +905,15 @@ export function describeArchiverDataStore(
905905
[
906906
expect.objectContaining({
907907
blockNumber: 2,
908+
blockHash: L2BlockHash.fromField(await blocks[2 - 1].block.hash()),
908909
log: makePrivateLog(tags[0]),
909910
isFromPublic: false,
910911
}),
911912
],
912913
[
913914
expect.objectContaining({
914915
blockNumber: 1,
916+
blockHash: L2BlockHash.fromField(await blocks[1 - 1].block.hash()),
915917
log: makePrivateLog(tags[1]),
916918
isFromPublic: false,
917919
}),
@@ -929,11 +931,13 @@ export function describeArchiverDataStore(
929931
[
930932
expect.objectContaining({
931933
blockNumber: 1,
934+
blockHash: L2BlockHash.fromField(await blocks[1 - 1].block.hash()),
932935
log: makePrivateLog(tags[0]),
933936
isFromPublic: false,
934937
}),
935938
expect.objectContaining({
936939
blockNumber: 1,
940+
blockHash: L2BlockHash.fromField(await blocks[1 - 1].block.hash()),
937941
log: makePublicLog(tags[0]),
938942
isFromPublic: true,
939943
}),
@@ -959,11 +963,13 @@ export function describeArchiverDataStore(
959963
[
960964
expect.objectContaining({
961965
blockNumber: 1,
966+
blockHash: L2BlockHash.fromField(await blocks[1 - 1].block.hash()),
962967
log: makePrivateLog(tags[0]),
963968
isFromPublic: false,
964969
}),
965970
expect.objectContaining({
966971
blockNumber: newBlockNumber,
972+
blockHash: L2BlockHash.fromField(await blocks[newBlockNumber - 1].block.hash()),
967973
log: newLog,
968974
isFromPublic: false,
969975
}),
@@ -983,6 +989,7 @@ export function describeArchiverDataStore(
983989
[
984990
expect.objectContaining({
985991
blockNumber: 1,
992+
blockHash: L2BlockHash.fromField(await blocks[1 - 1].block.hash()),
986993
log: makePrivateLog(tags[1]),
987994
isFromPublic: false,
988995
}),
@@ -1050,6 +1057,17 @@ export function describeArchiverDataStore(
10501057
}
10511058
});
10521059

1060+
it('returns block hash on public log ids', async () => {
1061+
const targetBlock = blocks[0].block;
1062+
const expectedBlockHash = L2BlockHash.fromField(await targetBlock.hash());
1063+
1064+
const logs = (await store.getPublicLogs({ fromBlock: targetBlock.number, toBlock: targetBlock.number + 1 }))
1065+
.logs;
1066+
1067+
expect(logs.length).toBeGreaterThan(0);
1068+
expect(logs.every(log => log.id.blockHash.equals(expectedBlockHash))).toBe(true);
1069+
});
1070+
10531071
it('"fromBlock" and "toBlock" filter params are respected', async () => {
10541072
// Set "fromBlock" and "toBlock"
10551073
const fromBlock = 3;
@@ -1092,8 +1110,14 @@ export function describeArchiverDataStore(
10921110
const targetBlockIndex = randomInt(numBlocks);
10931111
const targetTxIndex = randomInt(txsPerBlock);
10941112
const targetLogIndex = randomInt(numPublicLogs);
1113+
const targetBlockHash = L2BlockHash.fromField(await blocks[targetBlockIndex].block.hash());
10951114

1096-
const afterLog = new LogId(BlockNumber(targetBlockIndex + INITIAL_L2_BLOCK_NUM), targetTxIndex, targetLogIndex);
1115+
const afterLog = new LogId(
1116+
BlockNumber(targetBlockIndex + INITIAL_L2_BLOCK_NUM),
1117+
targetBlockHash,
1118+
targetTxIndex,
1119+
targetLogIndex,
1120+
);
10971121

10981122
const response = await store.getPublicLogs({ afterLog });
10991123
const logs = response.logs;
@@ -1115,7 +1139,7 @@ export function describeArchiverDataStore(
11151139
it('"txHash" filter param is ignored when "afterLog" is set', async () => {
11161140
// Get random txHash
11171141
const txHash = TxHash.random();
1118-
const afterLog = new LogId(BlockNumber(1), 0, 0);
1142+
const afterLog = new LogId(BlockNumber(1), L2BlockHash.random(), 0, 0);
11191143

11201144
const response = await store.getPublicLogs({ txHash, afterLog });
11211145
expect(response.logs.length).toBeGreaterThan(1);
@@ -1147,20 +1171,25 @@ export function describeArchiverDataStore(
11471171
await store.getPublicLogs({
11481172
fromBlock: BlockNumber(2),
11491173
toBlock: BlockNumber(5),
1150-
afterLog: new LogId(BlockNumber(4), 0, 0),
1174+
afterLog: new LogId(BlockNumber(4), L2BlockHash.random(), 0, 0),
11511175
})
11521176
).logs;
11531177
blockNumbers = new Set(logs.map(log => log.id.blockNumber));
11541178
expect(blockNumbers).toEqual(new Set([4]));
11551179

1156-
logs = (await store.getPublicLogs({ toBlock: BlockNumber(5), afterLog: new LogId(BlockNumber(5), 1, 0) })).logs;
1180+
logs = (
1181+
await store.getPublicLogs({
1182+
toBlock: BlockNumber(5),
1183+
afterLog: new LogId(BlockNumber(5), L2BlockHash.random(), 1, 0),
1184+
})
1185+
).logs;
11571186
expect(logs.length).toBe(0);
11581187

11591188
logs = (
11601189
await store.getPublicLogs({
11611190
fromBlock: BlockNumber(2),
11621191
toBlock: BlockNumber(5),
1163-
afterLog: new LogId(BlockNumber(100), 0, 0),
1192+
afterLog: new LogId(BlockNumber(100), L2BlockHash.random(), 0, 0),
11641193
})
11651194
).logs;
11661195
expect(logs.length).toBe(0);
@@ -1171,8 +1200,14 @@ export function describeArchiverDataStore(
11711200
const targetBlockIndex = randomInt(numBlocks);
11721201
const targetTxIndex = randomInt(txsPerBlock);
11731202
const targetLogIndex = randomInt(numPublicLogs);
1203+
const targetBlockHash = L2BlockHash.fromField(await blocks[targetBlockIndex].block.hash());
11741204

1175-
const afterLog = new LogId(BlockNumber(targetBlockIndex + INITIAL_L2_BLOCK_NUM), targetTxIndex, targetLogIndex);
1205+
const afterLog = new LogId(
1206+
BlockNumber(targetBlockIndex + INITIAL_L2_BLOCK_NUM),
1207+
targetBlockHash,
1208+
targetTxIndex,
1209+
targetLogIndex,
1210+
);
11761211

11771212
const response = await store.getPublicLogs({ afterLog, fromBlock: afterLog.blockNumber });
11781213
const logs = response.logs;
@@ -1192,6 +1227,40 @@ export function describeArchiverDataStore(
11921227
});
11931228
});
11941229

1230+
describe('getContractClassLogs', () => {
1231+
let targetBlock: L2Block;
1232+
let expectedContractClassLog: ContractClassLog;
1233+
1234+
beforeEach(async () => {
1235+
await store.addBlocks(blocks);
1236+
1237+
targetBlock = blocks[0].block;
1238+
expectedContractClassLog = await ContractClassLog.random();
1239+
targetBlock.body.txEffects.forEach((txEffect, index) => {
1240+
txEffect.contractClassLogs = index === 0 ? [expectedContractClassLog] : [];
1241+
});
1242+
1243+
await store.addLogs([targetBlock]);
1244+
});
1245+
1246+
it('returns block hash on contract class log ids', async () => {
1247+
const result = await store.getContractClassLogs({
1248+
fromBlock: targetBlock.number,
1249+
toBlock: targetBlock.number + 1,
1250+
});
1251+
1252+
expect(result.maxLogsHit).toBeFalsy();
1253+
expect(result.logs).toHaveLength(1);
1254+
1255+
const [{ id, log }] = result.logs;
1256+
const expectedBlockHash = L2BlockHash.fromField(await targetBlock.hash());
1257+
1258+
expect(id.blockHash.equals(expectedBlockHash)).toBe(true);
1259+
expect(id.blockNumber).toEqual(targetBlock.number);
1260+
expect(log).toEqual(expectedContractClassLog);
1261+
});
1262+
});
1263+
11951264
describe('pendingChainValidationStatus', () => {
11961265
it('should return undefined when no status is set', async () => {
11971266
const status = await store.getPendingChainValidationStatus();

yarn-project/archiver/src/archiver/kv_archiver_store/kv_archiver_store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { ContractInstanceStore } from './contract_instance_store.js';
3131
import { LogStore } from './log_store.js';
3232
import { MessageStore } from './message_store.js';
3333

34-
export const ARCHIVER_DB_VERSION = 4;
34+
export const ARCHIVER_DB_VERSION = 5;
3535
export const MAX_FUNCTION_SIGNATURES = 1000;
3636
export const MAX_FUNCTION_NAME_LEN = 256;
3737

0 commit comments

Comments
 (0)