Include new contract data function tree root in tx hash#188
Conversation
4ae9246 to
65ea927
Compare
ba5780a to
356689a
Compare
| import { BarretenbergWasm } from '../../wasm/index.js'; | ||
| import { WasmWrapper } from '@aztec/foundation/wasm'; | ||
|
|
||
| export class Grumpkin { |
There was a problem hiding this comment.
Not the biggest fan of the Wrapper name, the intent was that the generic concept was called WasmModule
There was a problem hiding this comment.
Almost any utility class could be called a Wrapper, is my reasoning, but it represents what it wraps
There was a problem hiding this comment.
Agree, and WasmModule was also my first choice for a name, but there's already a lower level WasmModule in the repo.
There was a problem hiding this comment.
Yeah I created that one, it was meant to provide everything needed to just pass around without introducing base classes
There was a problem hiding this comment.
I suppose that's not quite right though with async call state
| COPY l2-block l2-block | ||
| COPY tx tx | ||
| COPY unverified-data unverified-data | ||
| COPY . . |
There was a problem hiding this comment.
+1 if we're going to have a dependency system no reason to copy dependencies one by one (which mostly can help with docker figuring out its own dependencies)
ludamad
left a comment
There was a problem hiding this comment.
LGTM other than naming comment
|
I cannot come up with a better name for now. I'll merge and keep thinking about it. |
#23921) Fixes A-836 (Audit #188). ## Problem The CLI loaded contract artifacts via `loadContractArtifact` (`getContractArtifact` in `cli/src/utils/aztec.ts`). For an **already-processed** artifact, `loadContractArtifact` only runs the shallow `isContractArtifact` heuristic — its own JSDoc notes "The check is not exhaustive". It checks `name`/`functions`/`nonDispatchPublicFunctions` shape but never validates parameter ABIs, types, storage layout, outputs, etc. (Raw nargo output is already fully validated, since it flows through `generateContractArtifact` → `ContractArtifactSchema.parse`.) A malformed-but-superficially-shaped artifact therefore bypassed schema validation and surfaced as an opaque error later during deployment/arg-encoding rather than a clear validation failure. ## Fix Add `loadContractArtifactWithValidation` in stdlib: it runs the full `ContractArtifactSchema` over an already-processed artifact before returning, and otherwise defers to `loadContractArtifact` (raw nargo stays validated as before). The returned object is identical to `loadContractArtifact`'s — the schema parse is used purely as a validation gate. The CLI's `getContractArtifact` now uses it. Scoped deliberately to the CLI (the audit's concern). `loadContractArtifact` is called at 100+ module-load sites with wire-form JSON; adding a stricter schema gate to all of them would have a large blast radius and risk rejecting legacy artifacts, so the unguarded function is left unchanged. ## Test Added `loadContractArtifactWithValidation` tests in `contract_artifact.test.ts`: a valid already-processed artifact (wire form) loads, and one whose `functionType` is a non-enum string — which still passes the shallow `isContractArtifact` check — is rejected. The rejection test fails without the schema gate and passes with it. ## Note Severity is MEDIUM in the finding, but as the artifact is local input the deployer supplies (not an untrusted network boundary) and downstream code still throws on bad input, the practical impact is closer to LOW (a clearer error message, earlier).
Note that, since we now depend on circuits for explicitly calculating contract leaves via the
computeContractLeafcbind, the primitives wasm is left unused. I'm leaving it as part of the PR since we can leverage it in the future for more lightweight dependencies, but I wouldn't worry about this atm.Depends on AztecProtocol/aztec3-circuits#178
Fixes #154