-
Notifications
You must be signed in to change notification settings - Fork 50
contracts-v3 #393
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
base: main
Are you sure you want to change the base?
contracts-v3 #393
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Pull Request Test Coverage Report for Build 19009922002Details
💛 - Coveralls |
* fist wip sketch of AbiDecoder with variants * consolidate decoder tests * add new typeTree approach. Consolidate Topology tests and already point them to new implementation * Adjust Integrity to the new relaxed Variant rules * Use real TypeTrees internally (not the flat structure) * top level walk check, is actually an assert, data is always in bounds when that flow hits * AbiDecoder variable rename: typeNode and payload * account for CallWithinAllowance and EtherWithinAllowance in the new Decoder flow * extend test coverage particularly for variants within And/Or operators * improve AbiDecoder commentary * rename Topology library back its old name * Add more integrity checks, focusing on Ether|CallWithinAllowance location * add array.every(OR) test * adjust arrayEvery(OR) test * expand integrity tests * improve AbiDecoder docs * cleanup topology * refactor(evm): optimize Topology, by removing one duplicate bounds call * refactor(evm): break down the checks Integrity.sol for better organization * test(evm): Consolidate Integrity tests * test(evm): reorganize Topology tests * feature(evm): introduce variant array type entries, first at Topology level - We will next introduce support at Integrity and Decoder level for Array.Matches with variant type trees on different entries * test(evm): expand topology test coverage for Array TypeTrees * refactor(evm): optimize Integrity type matching and add nested variant tests - Rename _isTypeVariant to _isTypeEquivalence for clarity - Optimize _isTypeMatch to avoid buffer allocation - Add test coverage for nested logical operators (Or(Or(T1, T2))) - Add Array.Matches multi-entry test suite * refactor(evm): optimize AbiDecoder location handling and add Array.Matches tests - Fix payload location assignment to happen after overflow validation - Correct Calldata/AbiEncoded size to include length prefix - Add Array.Matches plucking tests covering homogeneous and variant cases - Add test for arrays with embedded calldata * chore(evm): bump dependencies --------- Co-authored-by: Cris <[email protected]>
* Add yarn lock * sdk: add support for EIP712 signing * tests: add eip712 encoder tests * remove eslint from tests * Add test setup for full integration test * Fix SignTypedMessageLib tests * add a chai failing test * fix integration test hardhat setup * scopeSignTypedMessage tests * format files * use renamed AbiType * Add MockEIP712Encoder test contract to expose EIP712Encoder functions * fix: replace ParameterType with AbiType in app components * docs: replace ParameterType with AbiType in examples and components --------- Co-authored-by: Jan-Felix <[email protected]> Co-authored-by: Cristóvão <[email protected]>
* First sketch of the new Serialization architecture * Patch EqualToAvatar conditions * Extract permission validation and writing into an external library bundle * Make the unpackers single loop, remove double pass * Optimize unpacker gas usage by reducing array accesses * Isolate Function loading from contract storage in new lib * Refactor: explicitly separate function storage and loading * fix avatar storage slot offset when patching * Consolidate three packer libraries into unified FunctionPacker * Reorganize permission storage into serialize/deserialize structure and consolidate unpacker files * rename permission-storage to scoped-function and consolidate supporting files * Remove PermissionLoader abstraction layer * remove uncessary constant from ImmutableStorage * improve scopeconfig comment * Clean up Deserializer and remove unused constants from Unpacker * Optimize unpacker by inlining node memory loads --------- Co-authored-by: Cristóvão <[email protected]>
56bc159 to
6e6ec4a
Compare
* Variant TypeTrees (#358) * fist wip sketch of AbiDecoder with variants * consolidate decoder tests * add new typeTree approach. Consolidate Topology tests and already point them to new implementation * Adjust Integrity to the new relaxed Variant rules * Use real TypeTrees internally (not the flat structure) * top level walk check, is actually an assert, data is always in bounds when that flow hits * AbiDecoder variable rename: typeNode and payload * account for CallWithinAllowance and EtherWithinAllowance in the new Decoder flow * extend test coverage particularly for variants within And/Or operators * improve AbiDecoder commentary * rename Topology library back its old name * Add more integrity checks, focusing on Ether|CallWithinAllowance location * add array.every(OR) test * adjust arrayEvery(OR) test * expand integrity tests * improve AbiDecoder docs * cleanup topology * refactor(evm): optimize Topology, by removing one duplicate bounds call * refactor(evm): break down the checks Integrity.sol for better organization * test(evm): Consolidate Integrity tests * test(evm): reorganize Topology tests * feature(evm): introduce variant array type entries, first at Topology level - We will next introduce support at Integrity and Decoder level for Array.Matches with variant type trees on different entries * test(evm): expand topology test coverage for Array TypeTrees * refactor(evm): optimize Integrity type matching and add nested variant tests - Rename _isTypeVariant to _isTypeEquivalence for clarity - Optimize _isTypeMatch to avoid buffer allocation - Add test coverage for nested logical operators (Or(Or(T1, T2))) - Add Array.Matches multi-entry test suite * refactor(evm): optimize AbiDecoder location handling and add Array.Matches tests - Fix payload location assignment to happen after overflow validation - Correct Calldata/AbiEncoded size to include length prefix - Add Array.Matches plucking tests covering homogeneous and variant cases - Add test for arrays with embedded calldata * chore(evm): bump dependencies --------- Co-authored-by: Cris <[email protected]> * Refactor Topology to filter nonStructural nodes from type trees * bump prettier and hardhat * Enforce non-structural children must come last in children array, at Integrity level. Tests * Swap childCount and structuralChildCount byte order in packing format * Optimize structuralChildCount by counting backwards from end * Fix underflow in structuralChildCount and add topology tests for all-None nodes * Handle structural vs non-structural children separately in permission checking * Remove unused Nor and ArraySubset operators * Refactor Context to group immutable call parameters into ContextCall struct Call parameters (to, value, operation) are never modified during permission checking, so grouping them into a ContextCall struct and passing a single reference is more efficient than copying three separate fields at every Context creation site. * Simplify consumptions initialization in _scopedFunction * Merge structural/non-structural loops into single loop with ternary * Rename variable * Use context.parentPayload instead of payload when constructing nested Context for logical nodes --------- Co-authored-by: Cris <[email protected]>
* Add WithinRatio operator for ratio-based amount validation. Sketches out test structure * Allow variable-length compValues beyond 32 bytes * Add dual price adapter support to WithinRatio operator * Add dual price adapter support to WithinRatio operator * Improve WithinRatioChecker documentation * Enhance WithinRatio tests * Refactor WithinRatioChecker for clarity adn readability * Enforce WithinRatio Integrity checks * Refactor TypeTree creation, for clarity and leveraging of nonStructural constraints * Cleanup scoped function Packer * Cleanup scoped function Unpacker * Rename TypeTree to Layout * Rename typeTree to layout in SDK EIP712 encoder to match contract changes * Refactor bitmask inline check to use payload size instead of paramType * Rename Topology to TypeTree with inspect and id functions * Extract Topology library for tree navigation utilities in flat representation * Consolidate TypeTree tests with, shorter with full coverage * Standardize on sChildCount across codebase * Test WithinRatio within different parent contexts and fix Integrity validation * Remove redundant parentPayload from Context and simplify payload handlig --------- Co-authored-by: Cristóvão <[email protected]>
* Rename AbiType to Encoding across contracts, SDK, and tests * Give consistent internal names to encoding * Remove paramType/encoding from packed condition representation (internal Condition representation) * Move unused bits to trailing position in condition nodes * Move tests folder inside contracts * Split Types.sol into individual type files --------- Co-authored-by: Cristóvão <[email protected]>
* Introduce Operator ArrayTailMatches * Enforce structural children constraints for Tuple/Array operators * Format codebase --------- Co-authored-by: Cristóvão <[email protected]>
* Extract AllowanceLoader library with assembly storage access, add AllowanceChecker with copy-on-write pattern, add timestamp to Consumption * Refactor AllowanceChecker with assembly-based _shallowClone * Refactor allowance checks to call AllowanceChecker directly * Remove Consumptions library, which was now not used * Remove allowanceKeys from condition packing/unpacking * Rename test file * Reorganize contracts folder structure * Refactor serialization: introduce ScopeConfigWriter, merge Deserializer into Unpacker * Update permission model comment in PermissionBuilder * Rename condition libraries: ConditionsTransform, ConditionPack, ConditionUnpack --------- Co-authored-by: Cristóvão <[email protected]>
* Add price adapter support for allowance checks * Add precision tests for price conversion formula --------- Co-authored-by: Cristóvão <[email protected]>
* Move tests to temporary folder, that will aid in the restructuring * Add test suite reorganization spec * Update spec file * Add test scaffold * Add accruedAllowance view function and implement allowance-tracking tests * Refactor AllowanceLoader._accrue for clarity and add inline comments * Add missing accrual tests and clean up condition-evaluation assertions * Implement onlyOwner tests * Implement role-management tests with full coverage for membership lifecycle, validity windows, usage limits, and default role resolution * Refactor clearance errors to dedicated custom errors and extract _unpackScopeConfig * Create setup.spec.ts with comprehensive tests for Setup.sol API functions * Implement authorization.spec.ts covering Authorization.sol logic * Implement membership.spec.ts tests for _authenticate functionality * Adapter tests * Implement integrity.spec.ts validation tests for condition tree serialization * Rewrite packer-unpacker tests and fix pluck index semantics * Rewrite topology.spec.ts with comprehensive tests for childBounds and isStructural * Rewrite topology.spec.ts with focused, succinct tests for childBounds and isStructural * Rewrite type-tree.spec.ts with comprehensive tests and optimize _isInlined * Rename plucking.spec.ts to traversal.spec.ts and rework/expanded coverage * Implement overflow tests * Rename allowance tests * Add reentrancy test * Add execution mechanics tests for all entry points and ensure state persistence is triggered correcly * Add module factory and master copy safety tests * refine test suite documentation * Delete old tests * Add missing decoder test scenarios * Add fallbacker test contract * Operator Pass tests * Operator And tests * Operator.Or tests * Operator Empty tests * Operator Matches tests * Make a check inside Matches an assertion, since its never triggered * Operator ArraySome tests * Operate ArrayEvery tests * Operator ArrayTailMatches tests * OperatorSlice tests * Operator EqualToAvatar tests * Operator comparison tests * Operator Bitmask tests * Extract adapter invocation into Adapter library, and adjust CustomCondition tests * Operator WithinRatio tessts * Refactor WithinRatioChecker for clarity and add a test * Adjust ViolationStatus enum name * Adjust Operator And tests * Extract CustomConditionChecker library from Adapter * Extract PriceConversion library for shared price/decimal conversion * Support decimal-only conversion in WithinAllowance * Add AllowanceValueOverflow status for uint128 overflow protection * Decouple decimal scaling from price conversion * Extract ConsumptionList library for copy-on-write array operations * Remove obsolete leading bytes test files * Convert reaminder of operator tests to use Fallbacker pattern and flattenCondition * Reorganize Operator.Matches tests and move prefix skipping to top * Remove obsolete test files superseded by reorganized test suites * Remove unused test fixtures, mocks, and setup functions * Reintroduce MockEIP712Encoder.sol * Replace TestEncoder with Interface pattern and delete unused fixture * Reintroduce ModuleProxyFactory * Consolidate TestContract into Fallbacker and update tests to use simpler Interface pattern * Rename Fallbacker to TestContract and consolidate test helper functions * Remove redundant setupAvatarAndRoles function * Refactor operator tests to use shared setup helpers * Standardize test setup patterns and improve signed integer coverage --------- Co-authored-by: Cristóvão <[email protected]>
|
@codex code review |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d225309eb1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
* Add violation context to ConditionViolation error * Add violation context tests to operator test files * Simplify ICustomCondition return type from (bool, bytes32) to bool --------- Co-authored-by: Cristóvão <[email protected]>
* Inline _transactionBundle into _authorize and update NatSpec * Reorganize Condition serialization into ConditionStorer/ConditionLoader * Remove duplicate childBounds from ConditionPacker, use Topology * Clean up AbiDecoder: reorder functions, remove unreachable overflow check * Add adapter call safety tests for WithinAllowance * Add tests for only ref and only rel adapters in WithinRatio * Refactor WithinRatioChecker: extract _scaleAndPrice helper from _convert * Remove unused accrue overload and inline _accrue in AllowanceLoader * Add test for moduleOnly modifier revert in Membership * Add Topology test --------- Co-authored-by: Cristóvão <[email protected]>
* Rewrite Integrity checks. Reorganize tests into operator-specific test files * Add _validateEncoding and comprehensive EqualTo tests when targetting non leaf * Require 32-byte compValue for EqualTo tuple/array --------- Co-authored-by: Cristóvão <[email protected]>
* refactor(evm): optimize condition serialization with linear-pass topology Refactors the condition tree processing pipeline to use a single O(N) backward pass for topology analysis, replacing redundant recursive traversals. * refactor(evm): eliminate Layout tree by computing layout directly from topology * add layout.spec.ts for full pipeline layout assertions * refactor(evm): remove TypeTree library, inline encoding resolution in Integrity * rename structural and offset flags in Topology * Simplify Topology struct and optimize resolution logic * Large condition test was breaking the coverage tooling * Simplify hasCompValue check to use compValue.length directly * prune non-first children of non-variant logical nodes from layout * replace BFS queue with linear forward pass for layout packing * rename _pruneUnreachable to _excludeFromLayout * simplify _excludeFromLayout to single-purpose subtree exclusion * clean up TopologyLib documentation * improve Topology comments and tighten typeHash calculation * prettier * Extract condition to local variable in ConditionTransform * Shave 30% off ConditionPacking costs: optimizemload/or/mstore for node and compValue Condition writes * Shave 12% of Layout packing: inline _packLayoutNode and use assembly for node writes * Merge _validateRoot into _validateBFS for single-pass validation * Optimize typeHash computation using scratch space assembly * rename maxPluckIndex to maxPluckCount * Refactor allowTarget/allowFunction to accept pre-packed condition buffers * Fix test failures after allowTarget/allowFunction refactor * Unify condition packing format with single-pass unpacking * Inline _shallowCopy in ConditionUnpacker to reduce call overhead * Fold ConditionTransform into ConditionPacker * Add big condition test case * Tighten structural detection and isInLayout for logical nodes * Add typeHash to Topology struct, use naive loop since it's now just a helper * Remove redundant local variable in ConditionPacker loops --------- Co-authored-by: Cristóvão <[email protected]>
* Lazy decoding with compacted packed format * Extract Topology library and refactor TypeTree, AbiDecoder, and ConditionLogic to simplify structural analysis, variant detection, and condition evaluation. * Remove payloadSize from Result and ConditionViolation error * Separate AbiDecoder from AbiLocator, restore decoder tests * Refactor AbiLocator overflow handling and clean up ConditionLogic * Remove aux local function from AbiLocator * Fix Topology.inlinedSize for None nodes and add AbiLocation tests * Rename AbiLocator -> AbiLocation * Add tail-offset bounds checks and return explicit overflow from AbiLocation.size * Refactor size resolution to ternary in ConditionLogic and CustomConditionChecker * Store inlined size as bytes and improve AbiLocation comments --------- Co-authored-by: Cristóvão <[email protected]>
* Add ZipSome and ZipEvery operators for multi-array iteration * ConditionLogic: consolidate zip handlers, extract _pluck * Simplify _zipIterator and _pluckedArrayLocations * Reorder ConditionLogic handlers for better grouping * Fix ZipSome/ZipEvery to validate all pluck indices in compValue * Refactor _pluckedArrayLocations to return Status directly * Simplify _pluck to always store both location and value * Use Topology.childBounds directly in type tree validation * ArrayIterator consolidation * Rename WithinRatio indices to referencePluckIndex/relativePluckIndex, add Slice test * Rename ConditionLogic to ConditionEvaluator * Refactor _compare and _compareSignedInt to take value directly * Inline _evaluate into _transaction to reduce bytecode size * Reorder Integrity operator handlers to match if-else dispatch order * Refactor __input to return bool overflow instead of Result struct * Fix WithinRatio to pass location to _result instead of 0 * Simplify AbiLocation.size * Add commentary to _tailLocation * Use calldataload for header reads in AbiLocation * Refactor _zipLocations * Return data.length + 1 so that location + size > data.length even when location is 0. --------- Co-authored-by: Cristóvão <[email protected]>
* vibe agent sandbox * set up dev container and agent scripts --------- Co-authored-by: Jan-Felix <[email protected]>
* update docs * keep ParameterType -> Encoding rename in SDK * clean out v2 docs * update lockfile --------- Co-authored-by: Jan-Felix <[email protected]>
* Rename node to condition in Integrity.sol * Inline _isWordish in Integrity.sol * Replace _isStructural with TypeTree.hash check * Rename TypeTree.inspect to resolve and remove resolvesTo * Allow Pluck operator with any encoding except None * Rename _validateTypeTrees to _validateVariantTypes * Reorder zip iterator validation and clarify variable names * Remove unnecessary shallow copy in slice evaluation * Make isVariant private and remove redundant return * Regenerate mastercopies * Simplify TypeTree resolve and _isVariant logic * Improve AbiLocation documentation * Minor TypeTree improvements * Re-extract mastercopies --------- Co-authored-by: Cristóvão <[email protected]>
Todo:
Polishing:
closes #335