-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(avm): Track gas usage in AVM simulator #5438
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @spalladino and the rest of your teammates on Graphite |
Benchmark resultsNo metrics with a significant change found. Detailed resultsAll benchmarks are run on txs on the This benchmark source data is available in JSON format on S3 here. Values are compared against data from master at commit L2 block published to L1Each column represents the number of txs on an L2 block published to L1.
L2 chain processingEach column represents the number of blocks on the L2 chain where each block has 16 txs.
Circuits statsStats on running time and I/O sizes collected for every circuit run across all benchmarks.
Tree insertion statsThe duration to insert a fixed batch of leaves into each tree type.
MiscellaneousTransaction sizes based on how many contract classes are registered in the tx.
Transaction processing duration by data writes.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general. Left a few comments. The most important one is on gasCost()
.
const TemporaryDefaultGasCost = { l1Gas: 0, l2Gas: 10, daGas: 0 }; | ||
|
||
/** Gas costs for each instruction. */ | ||
export const GasCosts: Record<Opcode, GasCost> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you wanted to do it per instruction and variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized most instructions will have a fixed cost, and it's easier to see them in a single place. Instructions with a variable cost can just override gasCost
. I'll work on one in a future PR to act as an example!
public consumeGas(gasCost: Partial<GasCost>) { | ||
// Assert there is enough gas on every dimension. | ||
const outOfGasDimensions = GasDimensions.filter( | ||
dimension => this[`${dimension}Left`] - (gasCost[dimension] ?? 0) < 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the YP says that it has to be strictly bigger than 0? It might be a mistake (I don't see why 0 would be wrong if you don't need to spend anything). Would you mind updating that in the YP? (I don't mind if you do it later).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, good catch!
} | ||
// Otherwise, charge the corresponding gas | ||
for (const dimension of GasDimensions) { | ||
this[`${dimension}Left`] -= gasCost[dimension] ?? 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we losing any static type checking by using a string here or is TS smart enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS is smart enough! GasDimensions is defined as const
so its type is not string but the actual values, and string literal types do the rest.
// If not, trigger an exceptional halt. | ||
// See https://yp-aztec.netlify.app/docs/public-vm/execution#gas-checks-and-tracking | ||
if (outOfGasDimensions.length > 0) { | ||
this.exceptionalHalt(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use this.revert([])
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert didn't set gas to zero, that's why I set up a different function. Still, I wonder whether this is needed at all, since the state seems to be discarded once an exception is thrown.
|
||
// Construct bytecode | ||
const bytecode = encodeToBytecode([ | ||
beforeAll(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you plan to add more tests here? How detailed do we want to be in checking that gas costs are set properly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm planning on adding more tests for covering the more "dynamic" gas cost functions, for checking reverts, and for testing the different type of gases.
const expectedL2GasUsed = ops.reduce((sum, op) => sum + op.gasCost().l2Gas, 0); | ||
|
||
expect(results.reverted).toBe(false); | ||
expect(results.output).toEqual([new Fr(3)]); | ||
expect(expectedL2GasUsed).toBeGreaterThan(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather have hardcoded numbers for these. Having code compute the expected outputs IMO should be avoided when possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want the tests to break when we updated gas costs for those instructions, but agree on the sentiment of hardcoding. I'll do the change!
* Instruction sub-classes can override this if their gas cost is not fixed. | ||
*/ | ||
public gasCost(): GasCost { | ||
return GasCosts[this.opcode] ?? EmptyGasCost; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this fail statically if GasCosts[this.opcode]
is undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since GasCosts: Record<Opcode, GasCost>
, it should fail statically if GasCosts
is missing an Opcode
. And since public get opcode(): Opcode
, we should be able to safely remove the ?? EmptyGasGost
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, @just-mitch you're right!
* This is the main entry point for the instruction. | ||
* @param context - The AvmContext in which the instruction executes. | ||
*/ | ||
public run(context: AvmContext): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm torn about this! But I guess it's ok and it gives us a place to put the PC changes as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me too. I wanted an "external execute" that did the orchestration and an "internal execute" that had the logic, and let each instruction override either. Problem is I couldn't come up with good names.
@@ -229,13 +229,15 @@ export class PublicExecutor { | |||
const hostStorage = new HostStorage(this.stateDb, this.contractsDb, this.commitmentsDb); | |||
const worldStateJournal = new AvmPersistableStateManager(hostStorage); | |||
const executionEnv = temporaryCreateAvmExecutionEnvironment(execution, globalVariables); | |||
const machineState = new AvmMachineState(0, 0, 0); | |||
// TODO(@spalladino) Load initial gas from the public execution request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as an FYI, there are a few other places with hardcoded/unused gas
import { Field, Uint8 } from '../avm_memory_types.js'; let gas = [/*l1_gas*/42, /*l2_gas*/24, /*da_gas*/420];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* Loads default gas cost for the instruction from the GasCosts table. | ||
* Instruction sub-classes can override this if their gas cost is not fixed. | ||
*/ | ||
public gasCost(): GasCost { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm will this work? E.g., if the gas cost depends on the inputs for the operation, you might not have enough info until you read from memory in execute
(especially if you need to do indirections).
I don't know how fancy gas calculation needs to be, so I'll leave it up to you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an upper bound we could set for a naive implementation?
In a more sophisticated calculation, could it be two parts? First check that I have enough gas to read from memory, then check that I have enough to perform the op?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an upper bound we could set for a naive implementation?
Depends on how precise you want to be. For ADD, for example, there are 3 operands, all of which could be indirect memory. So you'd have an upper bound for mem access as2*3
.
Another example is calldatacopy where you have mem reads but also a size (known at opcode construction time): there you probably want sth like 2*2 + copySize - cdOffset
.
However, assume that you have a hashing opcode HASH that takes a mem offset for the start of the message to hash, and a mem offset (!) for the size. Then the size is not known at opcode construction time, it will be retrieved from memory (this is to enable hashes in noir over vectors whose size is not fixed at compile time). Then in this case (and probably only in this case, but you should look around) you cannot know how much you'll read.
In a more sophisticated calculation, could it be two parts?
That separation sounds too add hoc so I'd prefer not. Memory reading is one possible dimension, is there going to be a new one (storage?) and we'll start having 2*dimensions parts? :) If it's going to get too complicated, then maybe it just has to be done in execute()
.
More generally, should gas cost be possible to know without executing anything at all? Then we cannot have indirect memory addresses. Otherwise if some execution (and revertion) is ok then you could just do the gas calculation as you go.
(I don't have strong opinions on this beyond not having ad-hoc phases)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the (few) cases where gas cost was intertwined with execution, my plan was to just override run
(ie the "external execute") and deal with both simultaneously there. I'll mark gasCost
as protected to ensure it's only used internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More generally, should gas cost be possible to know without executing anything at all?
Sounds like probably not then. I think I'd be fine with having the sequencer perform the work to determine the true amount required. Seems like very bounded risk.
(I don't have strong opinions on this beyond not having ad-hoc phases)
👍
* Flag an exceptional halt. Clears gas left and sets the reverted flag. No output data. | ||
*/ | ||
protected exceptionalHalt() { | ||
GasDimensions.forEach(dimension => (this[`${dimension}Left`] = 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fcarreiro @spalladino
What is the plan on how we're going to prove to the public kernel that I threw an exception due to "out of gas"?
In my mind, it would need to be something like "I had state S and was about to execute X". So it would provide S (the state before the operation) and X. In this case, we wouldn't want to zero out gas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Maddiaa0 on this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this handled by the public VM? i.e. you don't need to prove it to the kernel, the VM says so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Even still, I'm not positive on what the outputs should be. Suppose I specify an l2 gas limit of 10, and i try to run two opcodes, one that consumes 1, and another that would have consumed 100. Do we charge the user 1 gas, or 10?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I understand this is "just" the simulation side of things, the proof is produced by the circuit. And this clearing of gas is specified in the yellow paper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we charge the user 1 gas, or 10?
I understand we always charge them all of their gas (in all dimensions!) if there is an out of gas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we would charge them the gas from all dimensions would we? e.g. I wouldn't lose all my L2 gas if I emitted a note hash right at the start of public execution that breached my DA gas limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, but setting all gas dimensions to zero in the event of an OOG as specified in the YP seems to point at that. Who should we talk to if we wanted to change that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the YP should be taken as "malleable" in most things gas-related. It doesn't really change much about what the VM actually has to do, so I would defer to protocol experts (i.e., you). However, it might be worth checking if having to calculate the actual gas, etc, has any impact on the actual VM circuit. Maybe resetting all was chosen because of that? I'll bring Sean's attention to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Yep, the vm circuit can catch an underflow on the gas left column and set a reverted flag.
- Agree that it is malleable on these things. Our first pass was that reverting will consume all gas, but if we would like to be granular, we can
Thanks for the review @fcarreiro. I'll merge this one so conflicts don't pop up, and address the comments in an upcoming one. |
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-package: 0.31.0</summary> ## [0.31.0](aztec-package-v0.30.1...aztec-package-v0.31.0) (2024-03-26) ### Features * Add batched signerless contract calls ([#5313](#5313)) ([be60eb3](be60eb3)) * Dynamic proving ([#5346](#5346)) ([6a7ccca](6a7ccca)) * Less earthly runners + e2e GA runners, bb bench ([#5356](#5356)) ([2136a66](2136a66)) </details> <details><summary>barretenberg.js: 0.31.0</summary> ## [0.31.0](barretenberg.js-v0.30.1...barretenberg.js-v0.31.0) (2024-03-26) ### Features * Earthly bb tests + arm + satellites ([#5268](#5268)) ([eca12b3](eca12b3)) * Less earthly runners + e2e GA runners, bb bench ([#5356](#5356)) ([2136a66](2136a66)) * Simplified bb Honk interface ([#5319](#5319)) ([a2d138f](a2d138f)) </details> <details><summary>aztec-cli: 0.31.0</summary> ## [0.31.0](aztec-cli-v0.30.1...aztec-cli-v0.31.0) (2024-03-26) ### Features * Capture broadcasted functions in node ([#5353](#5353)) ([bc05db2](bc05db2)) ### Bug Fixes * **cli:** Support initializers not named constructor in cli ([#5397](#5397)) ([85f14c5](85f14c5)) </details> <details><summary>aztec-packages: 0.31.0</summary> ## [0.31.0](aztec-packages-v0.30.1...aztec-packages-v0.31.0) (2024-03-26) ### ⚠ BREAKING CHANGES * **avm:** per function avm run ([#5421](#5421)) * rename storage inclusion proof to historical storage read ([#5379](#5379)) * plug-in new outbox and update examples to use api to fetch inclusion proofs #4769 ([#5292](#5292)) * Mark transactions as reverted on L1 ([#5226](#5226)) ### Features * Add batched signerless contract calls ([#5313](#5313)) ([be60eb3](be60eb3)) * Add specific error for attempting `string[x] = ".."` (noir-lang/noir#4611) ([13a12d5](13a12d5)) * **AuthWit:** Chain_id and version in hash ([#5331](#5331)) ([5235c95](5235c95)) * **Authwit:** Lookup the validity of authwits ([#5316](#5316)) ([7c24870](7c24870)) * Avm lookup and/or/xor ([#5338](#5338)) ([489bc2c](489bc2c)) * **avm:** Add AvmContextInputs ([#5396](#5396)) ([12e2844](12e2844)) * **avm:** Per function avm run ([#5421](#5421)) ([f024751](f024751)) * **avm:** Track gas usage in AVM simulator ([#5438](#5438)) ([4884d83](4884d83)) * Capture broadcasted functions in node ([#5353](#5353)) ([bc05db2](bc05db2)) * Dynamic proving ([#5346](#5346)) ([6a7ccca](6a7ccca)) * Earthly bb tests + arm + satellites ([#5268](#5268)) ([eca12b3](eca12b3)) * Fix awkward snippet indention in docs ([#5367](#5367)) ([c55d3da](c55d3da)) * Fold proving key polys instead of prover polys ([#5436](#5436)) ([239ebfb](239ebfb)) * Implement serdes for u64 [#4990](#4990) ([#5411](#5411)) ([5a6bcef](5a6bcef)) * Introduce max_block_number ([#5251](#5251)) ([6573173](6573173)) * Less earthly runners + e2e GA runners, bb bench ([#5356](#5356)) ([2136a66](2136a66)) * Mark transactions as reverted on L1 ([#5226](#5226)) ([40ecc02](40ecc02)) * Plug-in new outbox and update examples to use api to fetch inclusion proofs [#4769](#4769) ([#5292](#5292)) ([fec1008](fec1008)) * Read_calldata ([#5409](#5409)) ([034fbf0](034fbf0)) * Remove NUM_FIELDS_PER_SHA256 ([#5392](#5392)) ([86a181b](86a181b)) * Rename storage inclusion proof to historical storage read ([#5379](#5379)) ([b6e7216](b6e7216)) * Returning non-nullified messages only ([#5390](#5390)) ([4c671be](4c671be)) * Simplified bb Honk interface ([#5319](#5319)) ([a2d138f](a2d138f)) * Simplify offsets and sizing using new block structure ([#5404](#5404)) ([efa0842](efa0842)) * Throw by default when awaiting a tx that reverted ([#5431](#5431)) ([c9113ec](c9113ec)) * Truncate SHA hashes inside circuits ([#5160](#5160)) ([9dc0d2a](9dc0d2a)) * Unified CircuitChecker interface ([#5343](#5343)) ([13cef1f](13cef1f)) * ZeroMorph working with IPA and integration with ECCVM ([#5246](#5246)) ([c4dce94](c4dce94)) ### Bug Fixes * Addressing flakiness of `uniswap_trade_on_l1_from_l2.test.ts` ([#5443](#5443)) ([2db9cad](2db9cad)) * **avm-simulator:** Hashing opcodes indirection ([#5376](#5376)) ([a4b1ebc](a4b1ebc)) * Broadcasting unconstrained function with empty sibling ([#5429](#5429)) ([933145e](933145e)) * **ci:** Disable uniswap test in earthly build ([#5344](#5344)) ([0d69162](0d69162)) * **cli:** Support initializers not named constructor in cli ([#5397](#5397)) ([85f14c5](85f14c5)) * Copy and deploy complete contents of l1-contracts ([#5447](#5447)) ([501c5e9](501c5e9)) * Don't cancel protocol-circuits-gate-diff in master ([#5441](#5441)) ([6894a78](6894a78)) * E2e_static_calls.test.ts bad merge ([#5405](#5405)) ([4c56536](4c56536)) * Generate noir interface for constructors ([#5352](#5352)) ([8434d2f](8434d2f)) * Limit earthly to few users ([#5375](#5375)) ([71e8ab4](71e8ab4)) * Login to dockerhub before 'docker compose' ([#5440](#5440)) ([4f7696b](4f7696b)) * Revert cbind breakage ([#5348](#5348)) ([c237193](c237193)) * **ssa:** Use accurate type during SSA AsSlice simplficiation (noir-lang/noir#4610) ([13a12d5](13a12d5)) * Track class registered count in tx stats ([#5417](#5417)) ([ff8eafc](ff8eafc)) * Watch command should not spawn more than one tsc watch ([#5391](#5391)) ([25caf4d](25caf4d)) ### Miscellaneous * Always use serialize function to get hash preimage in noir circuits or when comparing structs etc [#3595](#3595) ([#5439](#5439)) ([22e0f0d](22e0f0d)) * **aztec-nr:** Unify contexts behind interfaces ([#5294](#5294)) ([36e0f59](36e0f59)) * **bb:** Removed powers of eta in lookup and auxiliary relations ([#4695](#4695)) ([f4e62ae](f4e62ae)) * CamelCase in noir-projects -> snake_case ([#5381](#5381)) ([eea711f](eea711f)) * **ci:** Create a dedicated job for the AVM unit tests ([#5369](#5369)) ([59ca2ac](59ca2ac)), closes [#5366](#5366) * Clean out prover instance and remove instance from oink ([#5314](#5314)) ([a83368c](a83368c)) * Cleaning up messaging types ([#5442](#5442)) ([dfffe5d](dfffe5d)), closes [#5420](#5420) * Compute registerer address on the fly ([#5394](#5394)) ([5d669b9](5d669b9)) * Delete slither output from version control ([#5393](#5393)) ([41107e3](41107e3)) * Fix migration notes ([#5452](#5452)) ([8c4e576](8c4e576)) * **github:** Improve PR template "document later" checkbox description (noir-lang/noir#4625) ([13a12d5](13a12d5)) * Make get_notes fail if returning no notes [#4988](#4988) ([#5320](#5320)) ([be86ed3](be86ed3)) * Meld flavor and and circuit builder modules ([#5406](#5406)) ([f0d9d1b](f0d9d1b)) * Messaging naming fixes ([#5383](#5383)) ([0226102](0226102)) * Moving public inputs back to instance ([#5315](#5315)) ([9cbe368](9cbe368)) * Name change: gen perm sort to delta range constraint ([#5378](#5378)) ([841855f](841855f)) * Nuking l1 to l2 messages from block body ([#5272](#5272)) ([ee176d2](ee176d2)), closes [#5072](#5072) * Reduce size of revert code from Field to u8 ([#5309](#5309)) ([1868e25](1868e25)) * Remove mocking function in `EccOpQueue` again ([#5413](#5413)) ([6fb4a75](6fb4a75)) * Remove snapshots from protocol-contracts ([#5342](#5342)) ([31ca344](31ca344)) * Remove unused FunctionLeafPreimage struct ([#5354](#5354)) ([dc51c2b](dc51c2b)) * Rename reverted to revertCode ([#5301](#5301)) ([950a96d](950a96d)) * Replace relative paths to noir-protocol-circuits ([262ae02](262ae02)) * Replace relative paths to noir-protocol-circuits ([91a60db](91a60db)) * Replace relative paths to noir-protocol-circuits ([9fc9fbd](9fc9fbd)) * Replace relative paths to noir-protocol-circuits ([9939e99](9939e99)) * Replace relative paths to noir-protocol-circuits ([0b24aae](0b24aae)) * Replace relative paths to noir-protocol-circuits ([c4d89d5](c4d89d5)) * Reverting accidental changes ([#5371](#5371)) ([c1484ce](c1484ce)) * Skip foundry install if possible ([#5398](#5398)) ([060fa1e](060fa1e)) * Skip slither in docker ([#5384](#5384)) ([8a76068](8a76068)) * Update docs with function names to match version 0.25.0 specifications (noir-lang/noir#4466) ([13a12d5](13a12d5)) * Update integers.md to note support for Fields using `from_integer` (noir-lang/noir#4536) ([13a12d5](13a12d5)) * Update min compiler version of contracts ([#5305](#5305)) ([dcf6bb3](dcf6bb3)) * Use random tmp directory and cleanup afterwards ([#5368](#5368)) ([5c0e15d](5c0e15d)) ### Documentation * Update versions-updating.md ([#5358](#5358)) ([0f09b63](0f09b63)) </details> <details><summary>barretenberg: 0.31.0</summary> ## [0.31.0](barretenberg-v0.30.1...barretenberg-v0.31.0) (2024-03-26) ### Features * Avm lookup and/or/xor ([#5338](#5338)) ([489bc2c](489bc2c)) * Earthly bb tests + arm + satellites ([#5268](#5268)) ([eca12b3](eca12b3)) * Fold proving key polys instead of prover polys ([#5436](#5436)) ([239ebfb](239ebfb)) * Less earthly runners + e2e GA runners, bb bench ([#5356](#5356)) ([2136a66](2136a66)) * Read_calldata ([#5409](#5409)) ([034fbf0](034fbf0)) * Simplified bb Honk interface ([#5319](#5319)) ([a2d138f](a2d138f)) * Simplify offsets and sizing using new block structure ([#5404](#5404)) ([efa0842](efa0842)) * Unified CircuitChecker interface ([#5343](#5343)) ([13cef1f](13cef1f)) * ZeroMorph working with IPA and integration with ECCVM ([#5246](#5246)) ([c4dce94](c4dce94)) ### Bug Fixes * Revert cbind breakage ([#5348](#5348)) ([c237193](c237193)) ### Miscellaneous * **bb:** Removed powers of eta in lookup and auxiliary relations ([#4695](#4695)) ([f4e62ae](f4e62ae)) * **ci:** Create a dedicated job for the AVM unit tests ([#5369](#5369)) ([59ca2ac](59ca2ac)), closes [#5366](#5366) * Clean out prover instance and remove instance from oink ([#5314](#5314)) ([a83368c](a83368c)) * Meld flavor and and circuit builder modules ([#5406](#5406)) ([f0d9d1b](f0d9d1b)) * Moving public inputs back to instance ([#5315](#5315)) ([9cbe368](9cbe368)) * Name change: gen perm sort to delta range constraint ([#5378](#5378)) ([841855f](841855f)) * Remove mocking function in `EccOpQueue` again ([#5413](#5413)) ([6fb4a75](6fb4a75)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Apply suggestions from @fcarreiro in #5438
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-package: 0.31.0</summary> ## [0.31.0](AztecProtocol/aztec-packages@aztec-package-v0.30.1...aztec-package-v0.31.0) (2024-03-26) ### Features * Add batched signerless contract calls ([#5313](AztecProtocol/aztec-packages#5313)) ([be60eb3](AztecProtocol/aztec-packages@be60eb3)) * Dynamic proving ([#5346](AztecProtocol/aztec-packages#5346)) ([6a7ccca](AztecProtocol/aztec-packages@6a7ccca)) * Less earthly runners + e2e GA runners, bb bench ([#5356](AztecProtocol/aztec-packages#5356)) ([2136a66](AztecProtocol/aztec-packages@2136a66)) </details> <details><summary>barretenberg.js: 0.31.0</summary> ## [0.31.0](AztecProtocol/aztec-packages@barretenberg.js-v0.30.1...barretenberg.js-v0.31.0) (2024-03-26) ### Features * Earthly bb tests + arm + satellites ([#5268](AztecProtocol/aztec-packages#5268)) ([eca12b3](AztecProtocol/aztec-packages@eca12b3)) * Less earthly runners + e2e GA runners, bb bench ([#5356](AztecProtocol/aztec-packages#5356)) ([2136a66](AztecProtocol/aztec-packages@2136a66)) * Simplified bb Honk interface ([#5319](AztecProtocol/aztec-packages#5319)) ([a2d138f](AztecProtocol/aztec-packages@a2d138f)) </details> <details><summary>aztec-cli: 0.31.0</summary> ## [0.31.0](AztecProtocol/aztec-packages@aztec-cli-v0.30.1...aztec-cli-v0.31.0) (2024-03-26) ### Features * Capture broadcasted functions in node ([#5353](AztecProtocol/aztec-packages#5353)) ([bc05db2](AztecProtocol/aztec-packages@bc05db2)) ### Bug Fixes * **cli:** Support initializers not named constructor in cli ([#5397](AztecProtocol/aztec-packages#5397)) ([85f14c5](AztecProtocol/aztec-packages@85f14c5)) </details> <details><summary>aztec-packages: 0.31.0</summary> ## [0.31.0](AztecProtocol/aztec-packages@aztec-packages-v0.30.1...aztec-packages-v0.31.0) (2024-03-26) ### ⚠ BREAKING CHANGES * **avm:** per function avm run ([#5421](AztecProtocol/aztec-packages#5421)) * rename storage inclusion proof to historical storage read ([#5379](AztecProtocol/aztec-packages#5379)) * plug-in new outbox and update examples to use api to fetch inclusion proofs #4769 ([#5292](AztecProtocol/aztec-packages#5292)) * Mark transactions as reverted on L1 ([#5226](AztecProtocol/aztec-packages#5226)) ### Features * Add batched signerless contract calls ([#5313](AztecProtocol/aztec-packages#5313)) ([be60eb3](AztecProtocol/aztec-packages@be60eb3)) * Add specific error for attempting `string[x] = ".."` (noir-lang/noir#4611) ([13a12d5](AztecProtocol/aztec-packages@13a12d5)) * **AuthWit:** Chain_id and version in hash ([#5331](AztecProtocol/aztec-packages#5331)) ([5235c95](AztecProtocol/aztec-packages@5235c95)) * **Authwit:** Lookup the validity of authwits ([#5316](AztecProtocol/aztec-packages#5316)) ([7c24870](AztecProtocol/aztec-packages@7c24870)) * Avm lookup and/or/xor ([#5338](AztecProtocol/aztec-packages#5338)) ([489bc2c](AztecProtocol/aztec-packages@489bc2c)) * **avm:** Add AvmContextInputs ([#5396](AztecProtocol/aztec-packages#5396)) ([12e2844](AztecProtocol/aztec-packages@12e2844)) * **avm:** Per function avm run ([#5421](AztecProtocol/aztec-packages#5421)) ([f024751](AztecProtocol/aztec-packages@f024751)) * **avm:** Track gas usage in AVM simulator ([#5438](AztecProtocol/aztec-packages#5438)) ([4884d83](AztecProtocol/aztec-packages@4884d83)) * Capture broadcasted functions in node ([#5353](AztecProtocol/aztec-packages#5353)) ([bc05db2](AztecProtocol/aztec-packages@bc05db2)) * Dynamic proving ([#5346](AztecProtocol/aztec-packages#5346)) ([6a7ccca](AztecProtocol/aztec-packages@6a7ccca)) * Earthly bb tests + arm + satellites ([#5268](AztecProtocol/aztec-packages#5268)) ([eca12b3](AztecProtocol/aztec-packages@eca12b3)) * Fix awkward snippet indention in docs ([#5367](AztecProtocol/aztec-packages#5367)) ([c55d3da](AztecProtocol/aztec-packages@c55d3da)) * Fold proving key polys instead of prover polys ([#5436](AztecProtocol/aztec-packages#5436)) ([239ebfb](AztecProtocol/aztec-packages@239ebfb)) * Implement serdes for u64 [#4990](AztecProtocol/aztec-packages#4990) ([#5411](AztecProtocol/aztec-packages#5411)) ([5a6bcef](AztecProtocol/aztec-packages@5a6bcef)) * Introduce max_block_number ([#5251](AztecProtocol/aztec-packages#5251)) ([6573173](AztecProtocol/aztec-packages@6573173)) * Less earthly runners + e2e GA runners, bb bench ([#5356](AztecProtocol/aztec-packages#5356)) ([2136a66](AztecProtocol/aztec-packages@2136a66)) * Mark transactions as reverted on L1 ([#5226](AztecProtocol/aztec-packages#5226)) ([40ecc02](AztecProtocol/aztec-packages@40ecc02)) * Plug-in new outbox and update examples to use api to fetch inclusion proofs [#4769](AztecProtocol/aztec-packages#4769) ([#5292](AztecProtocol/aztec-packages#5292)) ([fec1008](AztecProtocol/aztec-packages@fec1008)) * Read_calldata ([#5409](AztecProtocol/aztec-packages#5409)) ([034fbf0](AztecProtocol/aztec-packages@034fbf0)) * Remove NUM_FIELDS_PER_SHA256 ([#5392](AztecProtocol/aztec-packages#5392)) ([86a181b](AztecProtocol/aztec-packages@86a181b)) * Rename storage inclusion proof to historical storage read ([#5379](AztecProtocol/aztec-packages#5379)) ([b6e7216](AztecProtocol/aztec-packages@b6e7216)) * Returning non-nullified messages only ([#5390](AztecProtocol/aztec-packages#5390)) ([4c671be](AztecProtocol/aztec-packages@4c671be)) * Simplified bb Honk interface ([#5319](AztecProtocol/aztec-packages#5319)) ([a2d138f](AztecProtocol/aztec-packages@a2d138f)) * Simplify offsets and sizing using new block structure ([#5404](AztecProtocol/aztec-packages#5404)) ([efa0842](AztecProtocol/aztec-packages@efa0842)) * Throw by default when awaiting a tx that reverted ([#5431](AztecProtocol/aztec-packages#5431)) ([c9113ec](AztecProtocol/aztec-packages@c9113ec)) * Truncate SHA hashes inside circuits ([#5160](AztecProtocol/aztec-packages#5160)) ([9dc0d2a](AztecProtocol/aztec-packages@9dc0d2a)) * Unified CircuitChecker interface ([#5343](AztecProtocol/aztec-packages#5343)) ([13cef1f](AztecProtocol/aztec-packages@13cef1f)) * ZeroMorph working with IPA and integration with ECCVM ([#5246](AztecProtocol/aztec-packages#5246)) ([c4dce94](AztecProtocol/aztec-packages@c4dce94)) ### Bug Fixes * Addressing flakiness of `uniswap_trade_on_l1_from_l2.test.ts` ([#5443](AztecProtocol/aztec-packages#5443)) ([2db9cad](AztecProtocol/aztec-packages@2db9cad)) * **avm-simulator:** Hashing opcodes indirection ([#5376](AztecProtocol/aztec-packages#5376)) ([a4b1ebc](AztecProtocol/aztec-packages@a4b1ebc)) * Broadcasting unconstrained function with empty sibling ([#5429](AztecProtocol/aztec-packages#5429)) ([933145e](AztecProtocol/aztec-packages@933145e)) * **ci:** Disable uniswap test in earthly build ([#5344](AztecProtocol/aztec-packages#5344)) ([0d69162](AztecProtocol/aztec-packages@0d69162)) * **cli:** Support initializers not named constructor in cli ([#5397](AztecProtocol/aztec-packages#5397)) ([85f14c5](AztecProtocol/aztec-packages@85f14c5)) * Copy and deploy complete contents of l1-contracts ([#5447](AztecProtocol/aztec-packages#5447)) ([501c5e9](AztecProtocol/aztec-packages@501c5e9)) * Don't cancel protocol-circuits-gate-diff in master ([#5441](AztecProtocol/aztec-packages#5441)) ([6894a78](AztecProtocol/aztec-packages@6894a78)) * E2e_static_calls.test.ts bad merge ([#5405](AztecProtocol/aztec-packages#5405)) ([4c56536](AztecProtocol/aztec-packages@4c56536)) * Generate noir interface for constructors ([#5352](AztecProtocol/aztec-packages#5352)) ([8434d2f](AztecProtocol/aztec-packages@8434d2f)) * Limit earthly to few users ([#5375](AztecProtocol/aztec-packages#5375)) ([71e8ab4](AztecProtocol/aztec-packages@71e8ab4)) * Login to dockerhub before 'docker compose' ([#5440](AztecProtocol/aztec-packages#5440)) ([4f7696b](AztecProtocol/aztec-packages@4f7696b)) * Revert cbind breakage ([#5348](AztecProtocol/aztec-packages#5348)) ([c237193](AztecProtocol/aztec-packages@c237193)) * **ssa:** Use accurate type during SSA AsSlice simplficiation (noir-lang/noir#4610) ([13a12d5](AztecProtocol/aztec-packages@13a12d5)) * Track class registered count in tx stats ([#5417](AztecProtocol/aztec-packages#5417)) ([ff8eafc](AztecProtocol/aztec-packages@ff8eafc)) * Watch command should not spawn more than one tsc watch ([#5391](AztecProtocol/aztec-packages#5391)) ([25caf4d](AztecProtocol/aztec-packages@25caf4d)) ### Miscellaneous * Always use serialize function to get hash preimage in noir circuits or when comparing structs etc [#3595](AztecProtocol/aztec-packages#3595) ([#5439](AztecProtocol/aztec-packages#5439)) ([22e0f0d](AztecProtocol/aztec-packages@22e0f0d)) * **aztec-nr:** Unify contexts behind interfaces ([#5294](AztecProtocol/aztec-packages#5294)) ([36e0f59](AztecProtocol/aztec-packages@36e0f59)) * **bb:** Removed powers of eta in lookup and auxiliary relations ([#4695](AztecProtocol/aztec-packages#4695)) ([f4e62ae](AztecProtocol/aztec-packages@f4e62ae)) * CamelCase in noir-projects -> snake_case ([#5381](AztecProtocol/aztec-packages#5381)) ([eea711f](AztecProtocol/aztec-packages@eea711f)) * **ci:** Create a dedicated job for the AVM unit tests ([#5369](AztecProtocol/aztec-packages#5369)) ([59ca2ac](AztecProtocol/aztec-packages@59ca2ac)), closes [#5366](AztecProtocol/aztec-packages#5366) * Clean out prover instance and remove instance from oink ([#5314](AztecProtocol/aztec-packages#5314)) ([a83368c](AztecProtocol/aztec-packages@a83368c)) * Cleaning up messaging types ([#5442](AztecProtocol/aztec-packages#5442)) ([dfffe5d](AztecProtocol/aztec-packages@dfffe5d)), closes [#5420](AztecProtocol/aztec-packages#5420) * Compute registerer address on the fly ([#5394](AztecProtocol/aztec-packages#5394)) ([5d669b9](AztecProtocol/aztec-packages@5d669b9)) * Delete slither output from version control ([#5393](AztecProtocol/aztec-packages#5393)) ([41107e3](AztecProtocol/aztec-packages@41107e3)) * Fix migration notes ([#5452](AztecProtocol/aztec-packages#5452)) ([8c4e576](AztecProtocol/aztec-packages@8c4e576)) * **github:** Improve PR template "document later" checkbox description (noir-lang/noir#4625) ([13a12d5](AztecProtocol/aztec-packages@13a12d5)) * Make get_notes fail if returning no notes [#4988](AztecProtocol/aztec-packages#4988) ([#5320](AztecProtocol/aztec-packages#5320)) ([be86ed3](AztecProtocol/aztec-packages@be86ed3)) * Meld flavor and and circuit builder modules ([#5406](AztecProtocol/aztec-packages#5406)) ([f0d9d1b](AztecProtocol/aztec-packages@f0d9d1b)) * Messaging naming fixes ([#5383](AztecProtocol/aztec-packages#5383)) ([0226102](AztecProtocol/aztec-packages@0226102)) * Moving public inputs back to instance ([#5315](AztecProtocol/aztec-packages#5315)) ([9cbe368](AztecProtocol/aztec-packages@9cbe368)) * Name change: gen perm sort to delta range constraint ([#5378](AztecProtocol/aztec-packages#5378)) ([841855f](AztecProtocol/aztec-packages@841855f)) * Nuking l1 to l2 messages from block body ([#5272](AztecProtocol/aztec-packages#5272)) ([ee176d2](AztecProtocol/aztec-packages@ee176d2)), closes [#5072](AztecProtocol/aztec-packages#5072) * Reduce size of revert code from Field to u8 ([#5309](AztecProtocol/aztec-packages#5309)) ([1868e25](AztecProtocol/aztec-packages@1868e25)) * Remove mocking function in `EccOpQueue` again ([#5413](AztecProtocol/aztec-packages#5413)) ([6fb4a75](AztecProtocol/aztec-packages@6fb4a75)) * Remove snapshots from protocol-contracts ([#5342](AztecProtocol/aztec-packages#5342)) ([31ca344](AztecProtocol/aztec-packages@31ca344)) * Remove unused FunctionLeafPreimage struct ([#5354](AztecProtocol/aztec-packages#5354)) ([dc51c2b](AztecProtocol/aztec-packages@dc51c2b)) * Rename reverted to revertCode ([#5301](AztecProtocol/aztec-packages#5301)) ([950a96d](AztecProtocol/aztec-packages@950a96d)) * Replace relative paths to noir-protocol-circuits ([262ae02](AztecProtocol/aztec-packages@262ae02)) * Replace relative paths to noir-protocol-circuits ([91a60db](AztecProtocol/aztec-packages@91a60db)) * Replace relative paths to noir-protocol-circuits ([9fc9fbd](AztecProtocol/aztec-packages@9fc9fbd)) * Replace relative paths to noir-protocol-circuits ([9939e99](AztecProtocol/aztec-packages@9939e99)) * Replace relative paths to noir-protocol-circuits ([0b24aae](AztecProtocol/aztec-packages@0b24aae)) * Replace relative paths to noir-protocol-circuits ([c4d89d5](AztecProtocol/aztec-packages@c4d89d5)) * Reverting accidental changes ([#5371](AztecProtocol/aztec-packages#5371)) ([c1484ce](AztecProtocol/aztec-packages@c1484ce)) * Skip foundry install if possible ([#5398](AztecProtocol/aztec-packages#5398)) ([060fa1e](AztecProtocol/aztec-packages@060fa1e)) * Skip slither in docker ([#5384](AztecProtocol/aztec-packages#5384)) ([8a76068](AztecProtocol/aztec-packages@8a76068)) * Update docs with function names to match version 0.25.0 specifications (noir-lang/noir#4466) ([13a12d5](AztecProtocol/aztec-packages@13a12d5)) * Update integers.md to note support for Fields using `from_integer` (noir-lang/noir#4536) ([13a12d5](AztecProtocol/aztec-packages@13a12d5)) * Update min compiler version of contracts ([#5305](AztecProtocol/aztec-packages#5305)) ([dcf6bb3](AztecProtocol/aztec-packages@dcf6bb3)) * Use random tmp directory and cleanup afterwards ([#5368](AztecProtocol/aztec-packages#5368)) ([5c0e15d](AztecProtocol/aztec-packages@5c0e15d)) ### Documentation * Update versions-updating.md ([#5358](AztecProtocol/aztec-packages#5358)) ([0f09b63](AztecProtocol/aztec-packages@0f09b63)) </details> <details><summary>barretenberg: 0.31.0</summary> ## [0.31.0](AztecProtocol/aztec-packages@barretenberg-v0.30.1...barretenberg-v0.31.0) (2024-03-26) ### Features * Avm lookup and/or/xor ([#5338](AztecProtocol/aztec-packages#5338)) ([489bc2c](AztecProtocol/aztec-packages@489bc2c)) * Earthly bb tests + arm + satellites ([#5268](AztecProtocol/aztec-packages#5268)) ([eca12b3](AztecProtocol/aztec-packages@eca12b3)) * Fold proving key polys instead of prover polys ([#5436](AztecProtocol/aztec-packages#5436)) ([239ebfb](AztecProtocol/aztec-packages@239ebfb)) * Less earthly runners + e2e GA runners, bb bench ([#5356](AztecProtocol/aztec-packages#5356)) ([2136a66](AztecProtocol/aztec-packages@2136a66)) * Read_calldata ([#5409](AztecProtocol/aztec-packages#5409)) ([034fbf0](AztecProtocol/aztec-packages@034fbf0)) * Simplified bb Honk interface ([#5319](AztecProtocol/aztec-packages#5319)) ([a2d138f](AztecProtocol/aztec-packages@a2d138f)) * Simplify offsets and sizing using new block structure ([#5404](AztecProtocol/aztec-packages#5404)) ([efa0842](AztecProtocol/aztec-packages@efa0842)) * Unified CircuitChecker interface ([#5343](AztecProtocol/aztec-packages#5343)) ([13cef1f](AztecProtocol/aztec-packages@13cef1f)) * ZeroMorph working with IPA and integration with ECCVM ([#5246](AztecProtocol/aztec-packages#5246)) ([c4dce94](AztecProtocol/aztec-packages@c4dce94)) ### Bug Fixes * Revert cbind breakage ([#5348](AztecProtocol/aztec-packages#5348)) ([c237193](AztecProtocol/aztec-packages@c237193)) ### Miscellaneous * **bb:** Removed powers of eta in lookup and auxiliary relations ([#4695](AztecProtocol/aztec-packages#4695)) ([f4e62ae](AztecProtocol/aztec-packages@f4e62ae)) * **ci:** Create a dedicated job for the AVM unit tests ([#5369](AztecProtocol/aztec-packages#5369)) ([59ca2ac](AztecProtocol/aztec-packages@59ca2ac)), closes [#5366](AztecProtocol/aztec-packages#5366) * Clean out prover instance and remove instance from oink ([#5314](AztecProtocol/aztec-packages#5314)) ([a83368c](AztecProtocol/aztec-packages@a83368c)) * Meld flavor and and circuit builder modules ([#5406](AztecProtocol/aztec-packages#5406)) ([f0d9d1b](AztecProtocol/aztec-packages@f0d9d1b)) * Moving public inputs back to instance ([#5315](AztecProtocol/aztec-packages#5315)) ([9cbe368](AztecProtocol/aztec-packages@9cbe368)) * Name change: gen perm sort to delta range constraint ([#5378](AztecProtocol/aztec-packages#5378)) ([841855f](AztecProtocol/aztec-packages@841855f)) * Remove mocking function in `EccOpQueue` again ([#5413](AztecProtocol/aztec-packages#5413)) ([6fb4a75](AztecProtocol/aztec-packages@6fb4a75)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Adds gas tracking for AVM instructions to the simulator. For now, every instruction consumes the same amount of gas, and executions start with an arbitrary amount of gas. If gas is exhausted, it triggers an exceptional halt as defined in the yp.