-
Notifications
You must be signed in to change notification settings - Fork 5
feat: implement BLE swarm registry system #99
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
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
540f23a
feat(swarms): implement BLE swarm registry system with geographic tie…
aliXsed 80c463e
test: increase coverage to 96%+ and add CI coverage checks on PRs
aliXsed 4099ddf
ci: restrict coverage check to src/swarms contracts only
aliXsed a194c9e
refactor: update SwarmRegistry swarm ID design to exclude providerId
aliXsed 2c662a7
docs(swarms): update documentation to match actual code logic
aliXsed 6947340
doc(swarms): minor fix
aliXsed 37f0d09
feat(swarms): implement UUPS upgradeable pattern for swarm contracts
aliXsed d92fef1
feat(swarms): simplify initialize with 0-defaults for bond params
aliXsed e3e2343
ci: add lcov coverage report to PR
aliXsed 2594567
refactor(swarms): use FingerprintSize enum for optimized _readFingerp…
aliXsed 4227ba7
feat(swarms): add getFilterData to L1, fix CI lcov install, improve t…
aliXsed 0fca64c
fix: use regular anvil for L1 upgrade test, add V1 initializer checks
aliXsed a2d3950
feat(swarms): add interfaces for UUPS upgradeable contracts
aliXsed 359003f
ci: remove whole-project minimum-coverage check
aliXsed 5e59643
docs(swarms): document interfaces directory
aliXsed 1d16431
chore: coverage artefact
aliXsed c11011d
fix(swarms): address review comments
aliXsed 21ff7f4
chore : remove auto approve for forge for ai assistant
aliXsed 5cce58c
doc: fix permission-less hint
aliXsed 8d602c0
Add ZkSync deployment automation and split L1/L2 deployment scripts
aliXsed 706ac3e
update yarn.lock
aliXsed 63cdb0d
fix to avoid ssh in yarn
aliXsed 2a4bfe0
refactor: expand TagType enum and add UUID encoding docs
aliXsed 23864e9
chore: add new terms to spellcheck dictionary (Eddystone, Estimote, b…
aliXsed 49dc034
refactor: expand TagType enum and add UUID encoding docs
aliXsed f663452
op: tune the deployment script
aliXsed 0f6f038
docs(swarms): consolidate spec into single PDF-ready markdown
aliXsed 4848083
ci: fix Puppeteer deps for Ubuntu 24.04 in PDF job
aliXsed 731d763
ci: fix Chrome sandbox for Puppeteer in CI
aliXsed 2f90835
fix: add missing words to spellcheck ignore list
aliXsed 51c621d
chore: tidy-up
aliXsed 6680cdc
Fix yarn.lock SSH-to-HTTPS normalization issue
aliXsed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Solidity & ZkSync Development Standards | ||
|
|
||
| ## Toolchain & Environment | ||
| - **Primary Tool**: `forge` (ZkSync fork). Use for compilation, testing, and generic scripting. | ||
| - **Secondary Tool**: `hardhat`. Use only when `forge` encounters compatibility issues (e.g., complex deployments, specific plugin needs). | ||
| - **Network Target**: ZkSync Era (Layer 2). | ||
| - **Solidity Version**: `^0.8.20` (or `0.8.24` if strictly supported by the zk-compiler). | ||
|
|
||
| ## Modern Solidity Best Practices | ||
| - **Safety First**: | ||
| - **Checks-Effects-Interactions (CEI)** pattern must be strictly followed. | ||
| - When a contract requires an owner (e.g., admin-configurable parameters), prefer `Ownable2Step` over `Ownable`. Do **not** add ownership to contracts that don't need it — many contracts are fully permissionless by design. | ||
| - Prefer `ReentrancyGuard` for external calls where appropriate. | ||
| - **Gas & Efficiency**: | ||
| - Use **Custom Errors** (`error MyError();`) instead of `require` strings. | ||
| - Use `mapping` over arrays for membership checks where possible. | ||
| - Minimize on-chain storage; use events for off-chain indexing. | ||
|
|
||
| ## Testing Standards | ||
| - **Framework**: Foundry (Forge). | ||
| - **Methodology**: | ||
| - **Unit Tests**: Comprehensive coverage for all functions. | ||
| - **Fuzz Testing**: Required for arithmetic and purely functional logic. | ||
| - **Invariant Testing**: Define invariants for stateful system properties. | ||
| - **Naming Convention**: | ||
| - `test_Description` | ||
| - `testFuzz_Description` | ||
| - `test_RevertIf_Condition` | ||
|
|
||
| ## ZkSync Specifics | ||
| - **System Contracts**: Be aware of ZkSync system contracts (e.g., `ContractDeployer`, `L2EthToken`) when interacting with low-level features. | ||
| - **Gas Model**: Account for ZkSync's different gas metering if performing low-level optimization. | ||
| - **Compiler Differences**: Be mindful of differences between `solc` and `zksolc` (e.g., `create2` address derivation). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Solidity & ZkSync Development Standards | ||
|
|
||
| ## Toolchain & Environment | ||
|
|
||
| - **Primary Tool**: `forge` (ZkSync fork). Use for compilation, testing, and generic scripting. | ||
| - **Secondary Tool**: `hardhat`. Use only when `forge` encounters compatibility issues (e.g., complex deployments, specific plugin needs). | ||
| - **Network Target**: ZkSync Era (Layer 2). | ||
| - **Solidity Version**: `^0.8.20` (or `0.8.24` if strictly supported by the zk-compiler). | ||
|
|
||
| ## Modern Solidity Best Practices | ||
|
|
||
| - **Safety First**: | ||
| - **Checks-Effects-Interactions (CEI)** pattern must be strictly followed. | ||
| - Use `Ownable2Step` over `Ownable` for privileged access. | ||
| - Prefer `ReentrancyGuard` for external calls where appropriate. | ||
| - **Gas & Efficiency**: | ||
| - Use **Custom Errors** (`error MyError();`) instead of `require` strings. | ||
| - Use `mapping` over arrays for membership checks where possible. | ||
| - Minimize on-chain storage; use events for off-chain indexing. | ||
|
|
||
| ## Testing Standards | ||
|
|
||
| - **Framework**: Foundry (Forge). | ||
| - **Methodology**: | ||
| - **Unit Tests**: Comprehensive coverage for all functions. | ||
| - **Fuzz Testing**: Required for arithmetic and purely functional logic. | ||
| - **Invariant Testing**: Define invariants for stateful system properties. | ||
| - **Naming Convention**: | ||
| - `test_Description` | ||
| - `testFuzz_Description` | ||
| - `test_RevertIf_Condition` | ||
|
|
||
| ## ZkSync Specifics | ||
|
|
||
| - **System Contracts**: Be aware of ZkSync system contracts (e.g., `ContractDeployer`, `L2EthToken`) when interacting with low-level features. | ||
| - **Gas Model**: Account for ZkSync's different gas metering if performing low-level optimization. | ||
| - **Compiler Differences**: Be mindful of differences between `solc` and `zksolc` (e.g., `create2` address derivation). | ||
|
|
||
| ## L1-Only Contracts (No --zksync flag) | ||
|
|
||
| The following contracts use opcodes/patterns incompatible with ZkSync Era and must be built/tested **without** the `--zksync` flag: | ||
|
|
||
| - **SwarmRegistryL1**: Uses `SSTORE2` (relies on `EXTCODECOPY` which is unsupported on ZkSync). | ||
|
|
||
| For these contracts, use: | ||
|
|
||
| ```bash | ||
| forge build --match-path src/swarms/SwarmRegistryL1.sol | ||
| forge test --match-path test/SwarmRegistryL1.t.sol | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "lib/forge-std": { | ||
| "rev": "1eea5bae12ae557d589f9f0f0edae2faa47cb262" | ||
| }, | ||
| "lib/zksync-storage-proofs": { | ||
| "rev": "4b20401ce44c1ec966a29d893694f65db885304b" | ||
| }, | ||
| "lib/solady": { | ||
| "tag": { | ||
| "name": "v0.1.26", | ||
| "rev": "acd959aa4bd04720d640bf4e6a5c71037510cc4b" | ||
| } | ||
| }, | ||
| "lib/era-contracts": { | ||
| "rev": "84d5e3716f645909e8144c7d50af9dd6dd9ded62" | ||
| }, | ||
| "lib/openzeppelin-contracts-upgradeable": { | ||
| "tag": { | ||
| "name": "v5.6.1", | ||
| "rev": "7bf4727aacdbfaa0f36cbd664654d0c9e1dc52bf" | ||
| } | ||
| }, | ||
| "lib/openzeppelin-contracts": { | ||
| "rev": "e4f70216d759d8e6a64144a9e1f7bbeed78e7079" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.