Skip to content

Commit

Permalink
Merge branch 'master' into sync-noir
Browse files Browse the repository at this point in the history
  • Loading branch information
nventuro authored Oct 3, 2024
2 parents 37a523e + c970ced commit c0650d9
Show file tree
Hide file tree
Showing 202 changed files with 3,582 additions and 1,951 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/publish-aztec-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
build-cli-wallet-x86,
build-cli-wallet-arm,
]
runs-on: ${{ github.actor }}-x86
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -179,6 +179,7 @@ jobs:
with:
dockerhub_password: "${{ env.DOCKERHUB_PASSWORD }}"
- name: Publish aztec manifests
if: ${{ github.event.inputs.publish == 'true' }}
run: |
VERSION=${${{ env.DEPLOY_TAG }}#aztec-packages-v}
Expand Down Expand Up @@ -218,16 +219,19 @@ jobs:
publish-npm:
needs: publish-manifests
runs-on: ubuntu-latest
runs-on: ${{ github.actor }}-x86
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ env.GIT_COMMIT }}

- name: Publish NPM packages
- uses: ./.github/ci-setup-action
with:
concurrency_key: publish-npm-${{ github.actor }}
dockerhub_password: "${{ env.DOCKERHUB_PASSWORD }}"
- name: Publish yarn-project NPM packages
run: |
VERSION=${${{ env.DEPLOY_TAG }}#aztec-packages-v}
earthly-ci \
Expand All @@ -236,3 +240,15 @@ jobs:
./yarn-project+publish-npm \
--DIST_TAG=latest \
--VERSION=$VERSION
--DRY_RUN=${{ (github.event.inputs.publish == 'false') && '1' || '0' }}
- name: Publish bb.js NPM package
run: |
VERSION=${${{ env.DEPLOY_TAG }}#aztec-packages-v}
earthly-ci \
--no-output \
--secret NPM_TOKEN=${{ env.NPM_TOKEN }} \
./barretenberg/ts+publish-npm \
--DIST_TAG=latest \
--VERSION=$VERSION
--DRY_RUN=${{ (github.event.inputs.publish == 'false') && '1' || '0' }}
3 changes: 2 additions & 1 deletion avm-transpiler/scripts/compile_then_transpile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ artifacts_to_transpile=$($NARGO compile --show-artifact-paths $@ | tee /dev/tty
# If the script is run via docker, however, the user will see this output on stdout and will be able to redirect.

# Transpile each artifact
for artifact in "$artifacts_to_transpile"; do
# `$artifacts_to_transpile` needs to be unquoted here, otherwise it will break if there are multiple artifacts
for artifact in $artifacts_to_transpile; do
# transpiler input and output files are the same (modify in-place)
$TRANSPILER "$artifact" "$artifact"
done
12 changes: 4 additions & 8 deletions avm-transpiler/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub const ALL_DIRECT: u8 = 0b00000000;
pub const ZEROTH_OPERAND_INDIRECT: u8 = 0b00000001;
pub const FIRST_OPERAND_INDIRECT: u8 = 0b00000010;
pub const SECOND_OPERAND_INDIRECT: u8 = 0b00000100;
pub const THIRD_OPERAND_INDIRECT: u8 = 0b00001000;

/// A simple representation of an AVM instruction for the purpose
/// of generating an AVM bytecode from Brillig.
Expand All @@ -22,7 +21,7 @@ pub struct AvmInstruction {
/// Any instructions with memory offset operands have the indirect flag
/// Each bit is a boolean: 0:direct, 1:indirect
/// The 0th bit corresponds to an instruction's 0th offset arg, 1st to 1st, etc...
pub indirect: Option<u8>,
pub indirect: Option<AvmOperand>,

/// Some instructions have a destination xor input tag
/// Its usage will depend on the instruction.
Expand All @@ -35,7 +34,7 @@ pub struct AvmInstruction {
impl Display for AvmInstruction {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "opcode {}", self.opcode.name())?;
if let Some(indirect) = self.indirect {
if let Some(indirect) = &self.indirect {
write!(f, ", indirect: {}", indirect)?;
}
// This will be either inTag or dstTag depending on the operation
Expand All @@ -58,8 +57,8 @@ impl AvmInstruction {
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.push(indirect);
if let Some(indirect) = &self.indirect {
bytes.extend_from_slice(&indirect.to_be_bytes());
}
// This will be either inTag or dstTag depending on the operation
if let Some(tag) = self.tag {
Expand Down Expand Up @@ -109,7 +108,6 @@ pub enum AvmTypeTag {
/// Constants (as used by the SET instruction) can have size
/// different from 32 bits
pub enum AvmOperand {
U1 { value: u8 }, // same wire format as U8
U8 { value: u8 },
U16 { value: u16 },
U32 { value: u32 },
Expand All @@ -121,7 +119,6 @@ pub enum AvmOperand {
impl Display for AvmOperand {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
AvmOperand::U1 { value } => write!(f, " U1:{}", value),
AvmOperand::U8 { value } => write!(f, " U8:{}", value),
AvmOperand::U16 { value } => write!(f, " U16:{}", value),
AvmOperand::U32 { value } => write!(f, " U32:{}", value),
Expand All @@ -135,7 +132,6 @@ impl Display for AvmOperand {
impl AvmOperand {
pub fn to_be_bytes(&self) -> Vec<u8> {
match self {
AvmOperand::U1 { value } => value.to_be_bytes().to_vec(),
AvmOperand::U8 { value } => value.to_be_bytes().to_vec(),
AvmOperand::U16 { value } => value.to_be_bytes().to_vec(),
AvmOperand::U32 { value } => value.to_be_bytes().to_vec(),
Expand Down
Loading

0 comments on commit c0650d9

Please sign in to comment.