refactor: move brother_node development artifact to dev/test-nodes subdirectory

Development Artifact Cleanup:
 BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location
- dev/test-nodes/brother_node/: Moved from root directory for better organization
- Contains development configuration, test logs, and test chain data
- No impact on production systems - purely development/testing artifact

 DEVELOPMENT ARTIFACTS IDENTIFIED:
- Chain ID: aitbc-brother-chain (test/development chain)
- Ports: 8010 (P2P) and 8011 (RPC) - different from production
- Environment: .env file with test configuration
- Logs: rpc.log and node.log from development testing session (March 15, 2026)

 ROOT DIRECTORY CLEANUP: Removed development clutter from production directory
- brother_node/ moved to dev/test-nodes/brother_node/
- Root directory now contains only production-ready components
- Development artifacts properly organized in dev/ subdirectory

DIRECTORY STRUCTURE IMPROVEMENT:
📁 dev/test-nodes/: Development and testing node configurations
🏗️ Root Directory: Clean production structure with only essential components
🧪 Development Isolation: Test environments separated from production

BENEFITS:
 Clean Production Directory: No development artifacts in root
 Better Organization: Development nodes grouped in dev/ subdirectory
 Clear Separation: Production vs development environments clearly distinguished
 Maintainability: Easier to identify and manage development components

RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
This commit is contained in:
2026-03-30 17:09:06 +02:00
parent bf730dcb4a
commit 816e258d4c
11734 changed files with 2001707 additions and 0 deletions

View File

@@ -0,0 +1,798 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
[[package]]
name = "ascii-canvas"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6"
dependencies = [
"term",
]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bit-set"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de"
dependencies = [
"bit-vec",
]
[[package]]
name = "bit-vec"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "convert_case"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "crunchy"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
name = "ctor"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f"
dependencies = [
"quote",
"syn 2.0.66",
]
[[package]]
name = "diff"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499"
[[package]]
name = "dirs-next"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
dependencies = [
"cfg-if",
"dirs-sys-next",
]
[[package]]
name = "dirs-sys-next"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
dependencies = [
"libc",
"redox_users",
"winapi",
]
[[package]]
name = "either"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]]
name = "ena"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3"
dependencies = [
"log",
]
[[package]]
name = "fixedbitset"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e"
[[package]]
name = "getrandom"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "indexmap"
version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "itertools"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3"
dependencies = [
"either",
]
[[package]]
name = "lalrpop"
version = "0.19.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b30455341b0e18f276fa64540aff54deafb54c589de6aca68659c63dd2d5d823"
dependencies = [
"ascii-canvas",
"atty",
"bit-set",
"diff",
"ena",
"itertools",
"lalrpop-util",
"petgraph",
"pico-args",
"regex",
"regex-syntax",
"string_cache",
"term",
"tiny-keccak",
"unicode-xid",
]
[[package]]
name = "lalrpop-util"
version = "0.19.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcf796c978e9b4d983414f4caedc9273aa33ee214c5b887bd55fde84c85d2dc4"
dependencies = [
"regex",
]
[[package]]
name = "libc"
version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]]
name = "libloading"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
dependencies = [
"cfg-if",
"windows-targets",
]
[[package]]
name = "lock_api"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
]
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "napi"
version = "2.16.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfc300228808a0e6aea5a58115c82889240bcf8dab16fc25ad675b33e454b368"
dependencies = [
"bitflags 2.5.0",
"ctor",
"napi-derive",
"napi-sys",
"once_cell",
]
[[package]]
name = "napi-build"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1c0f5d67ee408a4685b61f5ab7e58605c8ae3f2b4189f0127d804ff13d5560a"
[[package]]
name = "napi-derive"
version = "2.16.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0e034ddf6155192cf83f267ede763fe6c164dfa9971585436b16173718d94c4"
dependencies = [
"cfg-if",
"convert_case",
"napi-derive-backend",
"proc-macro2",
"quote",
"syn 2.0.66",
]
[[package]]
name = "napi-derive-backend"
version = "1.0.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff2c00437f3b3266391eb5e6aa25d0029187daf5caf05b8e3271468fb5ae73e"
dependencies = [
"convert_case",
"once_cell",
"proc-macro2",
"quote",
"regex",
"semver",
"syn 2.0.66",
]
[[package]]
name = "napi-sys"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "427802e8ec3a734331fec1035594a210ce1ff4dc5bc1950530920ab717964ea3"
dependencies = [
"libloading",
]
[[package]]
name = "new_debug_unreachable"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
[[package]]
name = "nomicfoundation_solidity-analyzer"
version = "0.0.0"
dependencies = [
"napi",
"napi-build",
"napi-derive",
"solang-parser",
]
[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-sys",
]
[[package]]
name = "petgraph"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143"
dependencies = [
"fixedbitset",
"indexmap",
]
[[package]]
name = "phf"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259"
dependencies = [
"phf_macros",
"phf_shared",
"proc-macro-hack",
]
[[package]]
name = "phf_generator"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
dependencies = [
"phf_shared",
"rand",
]
[[package]]
name = "phf_macros"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0"
dependencies = [
"phf_generator",
"phf_shared",
"proc-macro-hack",
"proc-macro2",
"quote",
"syn 1.0.95",
]
[[package]]
name = "phf_shared"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
dependencies = [
"siphasher",
]
[[package]]
name = "pico-args"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468"
[[package]]
name = "ppv-lite86"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
[[package]]
name = "precomputed-hash"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
[[package]]
name = "proc-macro-hack"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro2"
version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
"getrandom",
]
[[package]]
name = "redox_syscall"
version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "redox_users"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
dependencies = [
"getrandom",
"redox_syscall",
"thiserror",
]
[[package]]
name = "regex"
version = "1.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
[[package]]
name = "rustversion"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "semver"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]]
name = "siphasher"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
[[package]]
name = "smallvec"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
[[package]]
name = "solang-parser"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "395b6e1ec5af117bd08f963c7cd80f8efd4eed51c5a332aed42b13e3f9bc860b"
dependencies = [
"itertools",
"lalrpop",
"lalrpop-util",
"phf",
"unicode-xid",
]
[[package]]
name = "string_cache"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08"
dependencies = [
"new_debug_unreachable",
"once_cell",
"parking_lot",
"phf_shared",
"precomputed-hash",
]
[[package]]
name = "syn"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "term"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
dependencies = [
"dirs-next",
"rustversion",
"winapi",
]
[[package]]
name = "thiserror"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.95",
]
[[package]]
name = "tiny-keccak"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
dependencies = [
"crunchy",
]
[[package]]
name = "unicode-ident"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee"
[[package]]
name = "unicode-segmentation"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
[[package]]
name = "unicode-xid"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04"
[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
dependencies = [
"windows_aarch64_msvc 0.36.1",
"windows_i686_gnu 0.36.1",
"windows_i686_msvc 0.36.1",
"windows_x86_64_gnu 0.36.1",
"windows_x86_64_msvc 0.36.1",
]
[[package]]
name = "windows-targets"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.52.5",
"windows_i686_gnu 0.52.5",
"windows_i686_gnullvm",
"windows_i686_msvc 0.52.5",
"windows_x86_64_gnu 0.52.5",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.52.5",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]]
name = "windows_aarch64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]]
name = "windows_i686_gnu"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
[[package]]
name = "windows_i686_gnu"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
[[package]]
name = "windows_i686_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
[[package]]
name = "windows_i686_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]]
name = "windows_x86_64_gnu"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
[[package]]
name = "windows_x86_64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"

View File

@@ -0,0 +1,19 @@
[package]
edition = "2021"
name = "nomicfoundation_solidity-analyzer"
version = "0.0.0"
[lib]
crate-type = ["cdylib"]
[dependencies]
solang-parser = "=0.1.13"
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { version = "=2.16.6", default-features = false, features = ["napi4"] }
napi-derive = "=2.16.5"
[build-dependencies]
napi-build = "=2.1.3"
[profile.release]
lto = true

View File

@@ -0,0 +1,57 @@
# `@nomicfoundation/solidity-analyzer`
`@nomicfoundation/solidity-analyzer` is an N-API library built in Rust, which exposes a single function, which takes the contents of a Solidity source file and returns its imports and version pragmas.
## Installation
```bash
npm install @nomicfoundation/solidity-analyzer
```
## API
```ts
export interface AnalysisResult {
versionPragmas: Array<string>;
imports: Array<string>;
}
export function analyze(input: string): AnalysisResult;
```
## Example
```ts
analyze(`
pragma solidity ^0.8.0;
import "./file.sol";
`);
// { versionPragmas: [ '^0.8.0' ], imports: [ './file.sol' ] }
```
## Goals
This library has two different goals:
1. Being fast
2. Being error-tolerant
Both are achieved by not parsing the Solidity source but just tokenizing it instead. This allows us to create a simple state machine that only recognizes imports and pragmas, ignoring everything else, and recovering from malformed tokens or expressions.
## Browser support
This library doesn't work in a browser.
## Testing
This project has some JavaScript unit tests in `__test__`, and it's also tested using the entire [`smart-contract-sanctuary`](https://github.com/tintinweb/smart-contract-sanctuary).
You can find the scripts to test with the sanctuary in `test-with-sanctuary/`.
## Regenerating `index.js` and `index.d.ts`
These files have to be committed because of our current Github Actions, yet, they are autogenerated.
You can run `cargo clean`, `yarn clean`, and `yarn build` to recreate them.

View File

@@ -0,0 +1,5 @@
extern crate napi_build;
fn main() {
napi_build::setup();
}

View File

@@ -0,0 +1,10 @@
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export interface AnalysisResult {
versionPragmas: Array<string>;
imports: Array<string>;
}
export function analyze(input: string): AnalysisResult;

View File

@@ -0,0 +1,328 @@
/* tslint:disable */
/* eslint-disable */
/* prettier-ignore */
/* auto-generated by NAPI-RS */
const { existsSync, readFileSync } = require('fs')
const { join } = require("path");
const { platform, arch } = process;
let nativeBinding = null;
let localFileExisted = false;
let loadError = null;
function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== "function") {
try {
const lddPath = require("child_process")
.execSync("which ldd")
.toString()
.trim();
return readFileSync(lddPath, "utf8").includes("musl");
} catch (e) {
return true;
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header;
return !glibcVersionRuntime;
}
}
switch (platform) {
case "android":
switch (arch) {
case "arm64":
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.android-arm64.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.android-arm64.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-android-arm64");
}
} catch (e) {
loadError = e;
}
break;
case "arm":
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.android-arm-eabi.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.android-arm-eabi.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-android-arm-eabi");
}
} catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on Android ${arch}`);
}
break;
case "win32":
switch (arch) {
case "x64":
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.win32-x64-msvc.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.win32-x64-msvc.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-win32-x64-msvc");
}
} catch (e) {
loadError = e;
}
break;
case "ia32":
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.win32-ia32-msvc.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.win32-ia32-msvc.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-win32-ia32-msvc");
}
} catch (e) {
loadError = e;
}
break;
case "arm64":
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.win32-arm64-msvc.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.win32-arm64-msvc.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-win32-arm64-msvc");
}
} catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on Windows: ${arch}`);
}
break;
case "darwin":
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.darwin-universal.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.darwin-universal.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-darwin-universal");
}
break;
} catch {}
switch (arch) {
case "x64":
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.darwin-x64.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.darwin-x64.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-darwin-x64");
}
} catch (e) {
loadError = e;
}
break;
case "arm64":
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.darwin-arm64.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.darwin-arm64.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-darwin-arm64");
}
} catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on macOS: ${arch}`);
}
break;
case "freebsd":
if (arch !== "x64") {
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
}
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.freebsd-x64.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.freebsd-x64.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-freebsd-x64");
}
} catch (e) {
loadError = e;
}
break;
case "linux":
switch (arch) {
case "x64":
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.linux-x64-musl.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.linux-x64-musl.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-linux-x64-musl");
}
} catch (e) {
loadError = e;
}
} else {
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.linux-x64-gnu.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.linux-x64-gnu.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-linux-x64-gnu");
}
} catch (e) {
loadError = e;
}
}
break;
case "arm64":
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.linux-arm64-musl.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.linux-arm64-musl.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-linux-arm64-musl");
}
} catch (e) {
loadError = e;
}
} else {
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.linux-arm64-gnu.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.linux-arm64-gnu.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-linux-arm64-gnu");
}
} catch (e) {
loadError = e;
}
}
break;
case "arm":
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.linux-arm-musleabihf.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.linux-arm-musleabihf.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-linux-arm-musleabihf");
}
} catch (e) {
loadError = e;
}
} else {
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.linux-arm-gnueabihf.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.linux-arm-gnueabihf.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-linux-arm-gnueabihf");
}
} catch (e) {
loadError = e;
}
}
break;
case "riscv64":
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.linux-riscv64-musl.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.linux-riscv64-musl.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-linux-riscv64-musl");
}
} catch (e) {
loadError = e;
}
} else {
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.linux-riscv64-gnu.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.linux-riscv64-gnu.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-linux-riscv64-gnu");
}
} catch (e) {
loadError = e;
}
}
break;
case "s390x":
localFileExisted = existsSync(
join(__dirname, "solidity-analyzer.linux-s390x-gnu.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./solidity-analyzer.linux-s390x-gnu.node");
} else {
nativeBinding = require("@nomicfoundation/solidity-analyzer-linux-s390x-gnu");
}
} catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`);
}
break;
default:
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
}
if (!nativeBinding) {
if (loadError) {
throw loadError;
}
throw new Error(`Failed to load native binding`);
}
const { analyze } = nativeBinding;
module.exports.analyze = analyze;

View File

@@ -0,0 +1,63 @@
{
"name": "@nomicfoundation/solidity-analyzer",
"version": "0.1.2",
"repository": "github:NomicFoundation/solidity-analyzer",
"main": "index.js",
"types": "index.d.ts",
"files": [
"index.js",
"index.d.ts",
"Cargo.toml",
"Cargo.lock",
"build.rs",
"src/**/*.rs"
],
"napi": {
"name": "solidity-analyzer",
"triples": {
"defaults": false,
"additional": [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"x86_64-pc-windows-msvc"
]
}
},
"license": "MIT",
"devDependencies": {
"@napi-rs/cli": "2.18.3",
"ava": "5.1.1",
"prettier": "2.6.2"
},
"ava": {
"timeout": "3m"
},
"engines": {
"node": ">= 12"
},
"scripts": {
"artifacts": "napi artifacts",
"build": "napi build --platform --release",
"build:debug": "napi build --platform",
"prepublishOnly": "napi prepublish -t npm",
"test": "ava",
"universal": "napi universal",
"version": "napi version",
"clean": "rm -rf index.js index.d.ts *.node target",
"prettier": "prettier --write *.md *.json *.js *.d.ts __test__/*.mjs"
},
"packageManager": "yarn@4.2.2",
"optionalDependencies": {
"@nomicfoundation/solidity-analyzer-darwin-arm64": "0.1.2",
"@nomicfoundation/solidity-analyzer-darwin-x64": "0.1.2",
"@nomicfoundation/solidity-analyzer-linux-arm64-gnu": "0.1.2",
"@nomicfoundation/solidity-analyzer-linux-arm64-musl": "0.1.2",
"@nomicfoundation/solidity-analyzer-linux-x64-gnu": "0.1.2",
"@nomicfoundation/solidity-analyzer-linux-x64-musl": "0.1.2",
"@nomicfoundation/solidity-analyzer-win32-x64-msvc": "0.1.2"
}
}

View File

@@ -0,0 +1,254 @@
#![deny(clippy::all)]
#[macro_use]
extern crate napi_derive;
use napi::Error;
use solang_parser::lexer::{Lexer, Token};
use std::result::Result;
enum State {
TopLevel,
IgnoringStatement,
CurlyBracesOpened(usize),
PragmaFound,
PragmaSolidityFound,
ImportFound,
ImportStarFound,
ImportStarAsFound,
ImportStarAsIdentifierFound,
ImportStarAsIdentifierFromFound,
ImportCurlyBracesOpened(usize),
ImportSimbolAliasesFound,
ImportSimbolAliasesFromFound,
}
#[napi(object)]
pub struct AnalysisResult {
pub version_pragmas: Vec<String>,
pub imports: Vec<String>,
}
#[napi]
pub fn analyze(input: String) -> Result<AnalysisResult, Error> {
let mut comments = Vec::new();
let lexer = Lexer::new(&input, 0, &mut comments);
let mut version_pragmas = Vec::new();
let mut imports = Vec::new();
let mut state = State::TopLevel;
for item in lexer {
if item.is_err() {
continue;
}
let (_, token, _) = item.unwrap();
match state {
State::TopLevel => match token {
Token::Pragma => {
state = State::PragmaFound;
}
Token::Import => {
state = State::ImportFound;
}
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(1);
}
Token::Semicolon => {
state = State::TopLevel;
}
Token::DocComment(_, _) => {
// Do nothing
}
_ => {
state = State::IgnoringStatement;
}
},
State::IgnoringStatement => match token {
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(1);
}
Token::Semicolon => {
state = State::TopLevel;
}
_ => {}
},
State::CurlyBracesOpened(braces) => match token {
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(braces + 1);
}
Token::CloseCurlyBrace => {
if braces == 1 {
state = State::TopLevel;
} else {
state = State::CurlyBracesOpened(braces - 1);
}
}
_ => {}
},
State::PragmaFound => match token {
Token::Identifier(id) => {
if id == "solidity" {
state = State::PragmaSolidityFound;
} else {
state = State::IgnoringStatement;
}
}
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(1);
}
Token::Semicolon => {
state = State::TopLevel;
}
_ => {
state = State::IgnoringStatement;
}
},
State::PragmaSolidityFound => match token {
Token::StringLiteral(literal) => {
version_pragmas.push(literal.replace(['\r', '\n'], ""));
state = State::IgnoringStatement;
}
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(1);
}
Token::Semicolon => {
state = State::TopLevel;
}
_ => {
state = State::IgnoringStatement;
}
},
State::ImportFound => match token {
Token::StringLiteral(literal) => {
imports.push(literal.to_string());
state = State::IgnoringStatement;
}
Token::Mul => {
state = State::ImportStarFound;
}
Token::OpenCurlyBrace => {
state = State::ImportCurlyBracesOpened(1);
}
Token::Semicolon => {
state = State::TopLevel;
}
_ => {
state = State::IgnoringStatement;
}
},
State::ImportStarFound => match token {
Token::As => {
state = State::ImportStarAsFound;
}
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(1);
}
Token::Semicolon => {
state = State::TopLevel;
}
_ => {
state = State::IgnoringStatement;
}
},
State::ImportStarAsFound => match token {
Token::Identifier(_) => {
state = State::ImportStarAsIdentifierFound;
}
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(1);
}
Token::Semicolon => {
state = State::TopLevel;
}
_ => {
state = State::IgnoringStatement;
}
},
State::ImportStarAsIdentifierFound => match token {
Token::Identifier("from") => {
state = State::ImportStarAsIdentifierFromFound;
}
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(1);
}
Token::Semicolon => {
state = State::TopLevel;
}
_ => {
state = State::IgnoringStatement;
}
},
State::ImportStarAsIdentifierFromFound => match token {
Token::StringLiteral(literal) => {
imports.push(literal.to_string());
state = State::IgnoringStatement;
}
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(1);
}
Token::Semicolon => {
state = State::TopLevel;
}
_ => {
state = State::IgnoringStatement;
}
},
State::ImportCurlyBracesOpened(braces) => match token {
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(braces + 1);
}
Token::CloseCurlyBrace => {
if braces == 1 {
state = State::ImportSimbolAliasesFound;
} else {
state = State::CurlyBracesOpened(braces - 1);
}
}
Token::Semicolon => {
state = State::TopLevel;
}
_ => {}
},
State::ImportSimbolAliasesFound => match token {
Token::Identifier("from") => {
state = State::ImportSimbolAliasesFromFound;
}
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(1);
}
Token::Semicolon => {
state = State::TopLevel;
}
_ => {
state = State::IgnoringStatement;
}
},
State::ImportSimbolAliasesFromFound => match token {
Token::StringLiteral(literal) => {
imports.push(literal.to_string());
state = State::IgnoringStatement;
}
Token::OpenCurlyBrace => {
state = State::CurlyBracesOpened(1);
}
Token::Semicolon => {
state = State::TopLevel;
}
_ => {
state = State::IgnoringStatement;
}
},
}
}
let res = AnalysisResult {
version_pragmas,
imports,
};
Ok(res)
}