Skip to content

Commit

Permalink
Merge branch 'master' into sync-noir
Browse files Browse the repository at this point in the history
* master: (64 commits)
  fix: docker compose aztec up fix (#10197)
  fix: aztec-nargo curl in the earthfile also (#10199)
  chore: fix devbox (#10201)
  chore: misc cleanup (#10194)
  fix: release l1-contracts (#10095)
  git subrepo push --branch=master noir-projects/aztec-nr
  git_subrepo.sh: Fix parent in .gitrepo file. [skip ci]
  chore: replace relative paths to noir-protocol-circuits
  git subrepo push --branch=master barretenberg
  feat: Origin tags implemented in biggroup (#10002)
  fix: Revert "feat: blobs. (#9302)" (#10187)
  feat!: remove SharedImmutable (#10183)
  fix(bb.js): don't minify bb.js - webpack config (#10170)
  feat: blobs. (#9302)
  chore(avm): operands reordering (#10182)
  feat: UltraRollupRecursiveFlavor (#10088)
  feat: one liner for nodes to join rough-rhino (#10168)
  feat!: rename sharedimmutable methods (#10164)
  chore(master): Release 0.64.0 (#10043)
  feat: e2e metrics reporting (#9776)
  ...
  • Loading branch information
TomAFrench committed Nov 26, 2024
2 parents b2653c0 + d7ae959 commit 0911fb1
Show file tree
Hide file tree
Showing 361 changed files with 14,763 additions and 8,403 deletions.
4 changes: 2 additions & 2 deletions .github/spot-runner-action/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ class Ec2Instance {
Ebs: {
VolumeSize: 64,
VolumeType: 'gp3',
Throughput: 1000,
Iops: 5000
Throughput: 125,
Iops: 3000
},
},
],
Expand Down
4 changes: 2 additions & 2 deletions .github/spot-runner-action/src/ec2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ export class Ec2Instance {
Ebs: {
VolumeSize: 64,
VolumeType: 'gp3',
Throughput: 1000,
Iops: 5000
Throughput: 125,
Iops: 3000
},
},
],
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ jobs:
uses: ./.github/ensure-tester-with-images
env:
USERNAME: ${{ needs.configure.outputs.username }}
PULL_REQUEST: ${{ github.event.pull_request.number }}
with:
runner_type: ${{ steps.runner_type.outputs.type }}
builder_type: builder-x86
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-aztec-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ jobs:
with:
concurrency_key: publish-npm
dockerhub_password: "${{ env.DOCKERHUB_PASSWORD }}"

- name: Publish bb.js NPM package
run: |
DEPLOY_TAG=${{ env.DEPLOY_TAG }}
Expand Down Expand Up @@ -335,10 +335,10 @@ jobs:
working-directory: ./aztec-up/terraform
run: |
terraform init
if [ "${{ github.ref_name }}" == "master" ]; then
TAG=master
else
if [ -n "${{ env.DEPLOY_TAG }}" ]; then
TAG=${{ env.DEPLOY_TAG }}
else
TAG=${{ github.ref_name }}
fi
export TF_VAR_VERSION=${TAG#aztec-packages-v}
terraform apply -auto-approve
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ terraform.tfstate*
.secret
.bb_tmp

# Terraform
*.tfvars

# tmux
tmux-client-*.log
Expand Down
8 changes: 4 additions & 4 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
".": "0.63.1",
".": "0.64.0",
"yarn-project/cli": "0.35.1",
"yarn-project/aztec": "0.63.1",
"barretenberg": "0.63.1",
"barretenberg/ts": "0.63.1"
"yarn-project/aztec": "0.64.0",
"barretenberg": "0.64.0",
"barretenberg/ts": "0.64.0"
}
144 changes: 144 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions avm-transpiler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion avm-transpiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ license = "MIT OR Apache-2.0"
# local
acvm = { path = "../noir/noir-repo/acvm-repo/acvm", features = ["bn254"] }
noirc_errors = { path = "../noir/noir-repo/compiler/noirc_errors" }
fxhash = "0.2.1"

# external
base64 = "0.21"
Expand Down
41 changes: 40 additions & 1 deletion avm-transpiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,50 @@ This component transpiles Aztec public contracts code from Noir's Brillig byteco
## Build

```
./boostrap.sh
./bootstrap.sh
```

## Run

```
cargo run <aztec-contract-artifact-json> <transpiled-output-json>
```

## Testing Transpiler Changes

After bootstrap in `avm-transpiler`, go to `noir-contracts` and only compile avm_test_contract with:

```
nargo compile --package avm_test_contract --inliner-aggressiveness=0 --silence-warnings
```

Important: use the right nargo binary located in
`aztec-packages/noir/noir-repo/target/release/nargo`
If required, build nargo by going in `noir/noir-repo` and run
`cargo build --release`.

Then, transpile it:

```
scripts/transpile.sh
```

Go to yarn-project/simulator and run:

```
yarn build:fast
```

This takes in the TS generated by the compilation and transpilation.

Finally, run

```
yarn test src/avm/avm_simulator.test.ts
```

To test against some .cpp changes, compile the bb binary and run bb prover test:

```
yarn test src/avm_proving.test.ts
```
35 changes: 25 additions & 10 deletions avm-transpiler/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ pub struct AvmInstruction {
/// Its usage will depend on the instruction.
pub tag: Option<AvmTypeTag>,

/// Different instructions have different numbers of operands
/// Different instructions have different numbers of operands. These operands contain
/// memory addresses.
pub operands: Vec<AvmOperand>,

// Operands which are immediate, i.e., contain hardcoded constants.
pub immediates: Vec<AvmOperand>,
}

impl Display for AvmInstruction {
Expand All @@ -32,35 +36,46 @@ impl Display for AvmInstruction {
if let Some(indirect) = &self.indirect {
write!(f, ", indirect: {}", indirect)?;
}
// This will be either inTag or dstTag depending on the operation
if let Some(dst_tag) = self.tag {
write!(f, ", tag: {}", dst_tag as u8)?;
}
if !self.operands.is_empty() {
write!(f, ", operands: [")?;
for operand in &self.operands {
write!(f, "{operand}, ")?;
}
write!(f, "]")?;
};
// This will be either inTag or dstTag depending on the operation
if let Some(dst_tag) = self.tag {
write!(f, ", tag: {}", dst_tag as u8)?;
}
if !self.immediates.is_empty() {
write!(f, ", immediates: [")?;
for immediate in &self.immediates {
write!(f, "{immediate}, ")?;
}
write!(f, "]")?;
};
Ok(())
}
}

impl AvmInstruction {
/// Bytes representation for generating AVM bytecode
/// Order: INDIRECT, OPERANDS, TAG, IMMEDIATES
pub fn to_bytes(&self) -> Vec<u8> {
let mut bytes = Vec::new();
bytes.push(self.opcode as u8);
if let Some(indirect) = &self.indirect {
bytes.extend_from_slice(&indirect.to_be_bytes());
}
for operand in &self.operands {
bytes.extend_from_slice(&operand.to_be_bytes());
}
// This will be either inTag or dstTag depending on the operation
if let Some(tag) = self.tag {
bytes.extend_from_slice(&(tag as u8).to_be_bytes());
}
for operand in &self.operands {
bytes.extend_from_slice(&operand.to_be_bytes());
for immediate in &self.immediates {
bytes.extend_from_slice(&immediate.to_be_bytes());
}
bytes
}
Expand All @@ -84,6 +99,7 @@ impl Default for AvmInstruction {
indirect: None,
tag: None,
operands: vec![],
immediates: vec![],
}
}
}
Expand All @@ -102,9 +118,8 @@ pub enum AvmTypeTag {
INVALID,
}

/// Operands are usually 32 bits (offsets or jump destinations)
/// Constants (as used by the SET instruction) can have size
/// different from 32 bits
/// Operands are usually 8, 16 and 32 bits (offsets)
/// Immediates (as used by the SET instruction) can have different sizes
#[allow(non_camel_case_types)]
pub enum AvmOperand {
U8 { value: u8 },
Expand Down
Loading

0 comments on commit 0911fb1

Please sign in to comment.