From a27a5ae5c1d791c96d6707157c94cc0c42ee65a0 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 21 Jul 2024 01:46:26 -0400 Subject: [PATCH 001/121] Adds json tags to base.Address and base.Hash --- src/apps/chifra/pkg/base/address.go | 2 +- src/apps/chifra/pkg/base/hash.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/chifra/pkg/base/address.go b/src/apps/chifra/pkg/base/address.go index 1510bcc19b..665d18f2dd 100644 --- a/src/apps/chifra/pkg/base/address.go +++ b/src/apps/chifra/pkg/base/address.go @@ -15,7 +15,7 @@ import ( // Address is a wrapper for go-ethereum's Address type that always // return lower case hex. type Address struct { - common.Address + common.Address `json:"address"` } // A few well-known address. ZeroAddr, of course, is 0x0. NotAMonitor is a marker to signify the end diff --git a/src/apps/chifra/pkg/base/hash.go b/src/apps/chifra/pkg/base/hash.go index 1b20706a95..a216ede38f 100644 --- a/src/apps/chifra/pkg/base/hash.go +++ b/src/apps/chifra/pkg/base/hash.go @@ -13,7 +13,7 @@ import ( // Hash is a wrapper for go-ethereum's Hash type that always // return lower case hex. type Hash struct { - common.Hash + common.Hash `json:"hash"` } // Hex returns string representation of an hash. Unlike addresses, we do not shorten zero hashes. From 27efda92de70089ec9404ab0593b4e13c50389fb Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 21 Jul 2024 01:51:40 -0400 Subject: [PATCH 002/121] Adds some gitcoin smart contracts --- src/other/install/names/names.tab | 38 +++++++++++++++++++++++++++++++ tests | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/other/install/names/names.tab b/src/other/install/names/names.tab index e2704b7068..282c163fc5 100644 --- a/src/other/install/names/names.tab +++ b/src/other/install/names/names.tab @@ -1533,6 +1533,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x10b47177e92ef9d5c6059055d92ddf6290848991 SushiSwap LP Token SLP On chain 18 false false false true true false 50-Tokens:ERC721 0x10b66bd1e3b5a936b7f8dbc5976004311037cdf0 tBTC Deposit Token TDT On chain 18 false false false true true true 90-Individuals:Twitter 0x10bb15c252bf71622f5eda133c030642ce2005de LEVERAGED_LABS banteg on twitter false false false false false false +31-Gitcoin:Core 0x10be322de44389ded49c0b2b73d8c3a1e3b6d871 GG18 - ReFi DAO Local Node - community - OP - 30000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 31-Gitcoin:Grants 0x10c0b0da2a682c12bd36516a95cb8474c02d83de Grant 2836 - DIGIFIZZY: A native web3 metaverse publication https://gitcoin.co/grants/2836/digifizzy-a-native-web3-metaverse-publication false false false true false false 90-Individuals:Twitter 0x10c43f2e13d86131d5b9f6227c2fbf070989c96e aradtski banteg on twitter false false false false false false 90-Individuals:Twitter 0x10c4613e3667f5692735cf2a199f15a937f09183 SharpieMeow banteg on twitter false false false false false false @@ -1722,6 +1723,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x12b306fa98f4cbb8d4457fdff3a0a0a56f07ccdf Spectre.ai D-Token SXDT On chain 18 false false false true true false 90-Individuals:Twitter 0x12b394034e855baec320a0efc8b8301c631a49c3 BrittH888 banteg on twitter false false false false false false 50-Tokens:ERC20 0x12b6893ce26ea6341919fe289212ef77e51688c8 Tamadoge TAMA Rotki 18 false false false true true false +31-Gitcoin:Core 0x12bb5bbbfe596dbc489d209299b8302c3300fa40 GR17 - Web3 Open Source Software Round - program - ETH - 350000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 50-Tokens:ERC20 0x12bb890508c125661e03b09ec06e404bc9289040 Radio Caca V2 RACA Rotki 18 false false false true true false 90-Individuals:Twitter 0x12bcca9632cf7479236456eeb0446c89422d437e maybeawhile banteg on twitter false false false false false false 90-Individuals:Twitter 0x12bff8e316e627a364915e89558a18fa6a1a4dae alphaK3Y banteg on twitter false false false false false false @@ -3600,6 +3602,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC721 0x273f7f8e6489682df756151f5525576e322d51a3 MyCryptoHeroes:Hero MCHH On chain 18 false false false true true true 90-Individuals:Gitcoin Grants 0x27445c691625f9b50292050bd36b9d008062991f brendanjo Gitcoin Website false false false false false false 60-Rotki 0x2744861accb5bd435017c1cfee789b6ebab42082 AeFX.io AeFX.io Rotki 18 false false false false false false +31-Gitcoin:Core 0x274554eb289004e15a7679123901b7f070dda0fa GR17 - ZK Tech Round - program - ETH - 150000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 30-Contract:Optimism Mainnet 0x2745c24822f542bbffb41c6cb20edf766b5619f5 OVM_ExecutionManager Optimism Website false false false true false false 90-Individuals:Twitter 0x27466ee993c2b4de40d68ae6560c9af6329919e3 thal0x banteg on twitter false false false false false false 90-Individuals:Twitter 0x27508a71e0b137328554ea13bdbd35ac308abb9b teriyaki6661 banteg on twitter false false false false false false @@ -3708,6 +3711,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:Twitter 0x2869c039c20d4e09aafeb448fa873ab2fe2af1d8 alexzhan banteg on twitter false false false false false false 50-Tokens:ERC20 0x286bda1413a2df81731d4930ce2f862a35a609fe WaBi WaBi On chain 18 false false false true true false 50-Tokens:ERC20 0x286c1bdb45979901f064f11345715a64f270a747 Uniswap V2 UNI-V2 On chain 18 false false false true true false +31-Gitcoin:Core 0x2871742b184633f8dc8546c6301cbc209945033e GG18 - Web3 Community & Education - program - ETH - 250000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 90-Individuals:Twitter 0x2876a234b51cf7a8c2d64537aed02938b0d811b4 jebus911 banteg on twitter false false false false false false 90-Individuals:Twitter 0x287728b2c705f162e500cb118f7b715c11c23912 ykzl14 banteg on twitter false false false false false false 60-Rotki 0x287880ea252b52b63cc5f40a2d3e5a44aa665a76 ALPINE Fan Token ALPINE Rotki 8 false false false false false false @@ -4460,6 +4464,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x30b90d985104b803a038465c95b6ac226a355b13 KB24 KB24 On chain 18 false false false true true false 37-SelfDestructed 0x30ba1ff73a862243c08f40029074d13b10298708 TESTTEC TESTTEC On chain 18 false false false true true false 90-Individuals:Twitter 0x30bce1478047829a14a1e4e4f2d733646c9c0dc0 0xballsack banteg on twitter false false false false false false +31-Gitcoin:Core 0x30c381033aa2830ceb0aa372c2e4d28f004b3db9 GG18 - Global Chinese Community - community - OP - 25000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 90-Individuals:Kickback 0x30c4ff533fb6abce77a44e3cc2d3245e227de500 ygeezus https://kickback.events/ false false false false false false 90-Individuals:Twitter 0x30c65d3951aafc58875dfe71944ef05497f8f95f weelhunter banteg on twitter false false false false false false 31-Giveth:Project 0x30cd3e1e1da2ec44d340a3de36502b19175829f1 K9s For Warriors Tokenomics false false false false false false @@ -4647,6 +4652,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x32ba720a38dcd3a9d4c04aa398f4d7e65a7547f5 The Musk Token MUSK On chain 18 false false false true true false 90-Individuals:Twitter 0x32bac0d930a94ff2648d65a810b6052a682d304e GizaGainz banteg on twitter false false false false false false 90-Individuals 0x32be343b94f860124dc4fee278fdcbd38c102d88 Poliniex Exchange, DAO Whale 4 Vlad Zamphir 0x127 Sender 1 Sept_DDOS_ACCOUNT_1 TrueBlocks.io CarbonVote WhaleWatch.io SEPT_DDOS http://www.reddit.com/r/ethereum/ false false false false false false +31-Gitcoin:Core 0x32c49d2da5f6866a057e4aa2058c62a2974a5623 GR17 - Crypto Advocacy - community - eth - 100000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 31-Giveth:Project 0x32ccffeeceaa2ce5b3ef21898b63e95c95d1137d Familial Dysautonomia Foundation Tokenomics false false false false false false 50-Tokens:ERC20 0x32ce7e48debdccbfe0cd037cc89526e4382cb81b Uniswap V2 UNI-V2 On chain 18 false false false true true false 31-Giveth:Project 0x32cefb2dc869bbfe636f7547cda43f561bf88d5a Ethereum for Farsi speaking population Tokenomics false false false false false false @@ -4996,6 +5002,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 30-Contracts 0x36f2f9c330f8d5421c8d7143d397d8a5459f8d14 Test Reward Court TRC Etherscan false false false true true false 31-Gitcoin:Grants 0x36f322fc85b24ab13263cfe9217b28f8e2b38381 Grant 0639 區塊勢 — 說人話的區塊鏈圖文 https://gitcoin.co/grants/639/-2 false false false false false false 50-Tokens:ERC20 0x36f3fd68e7325a35eb768f1aedaae9ea0689d723 Empty Set Dollar ESD Rotki 18 false false false true true false +31-Gitcoin:Core 0x36f548e082b09b0cec5b3f5a7b78953c75de5e74 GG19 - SheFi - independent - OP - 5000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 50-Tokens:ERC20 0x36f8d0d0573ae92326827c4a82fe4ce4c244cab6 Morpho-Aave Dai Stablecoin Supply Vault maDAI Rotki 18 false false false true true false 90-Individuals:Humanity DAO 0x36faa1e49ff125ac72ceae0d5a2e35bc9add6591 RogerWuTW https://www.humanitydao.org/humans false false false false false false 30-Contracts:Set Protocol 0x3700414bb6716fcd8b14344fb10ddd91fdea59ec Kyber Network Wrapper TrueBlocks.io false false false true false false @@ -5890,6 +5897,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x404a03728afd06fb934e4b6f0eaf67796912733a #halfrekt NME On chain 18 false false false true true false 90-Individuals:Twitter 0x404c4c3e1e4cb1f9b9be8b706d251436d428f9de Stonetoday banteg on twitter false false false false false false 90-Individuals:Kickback 0x404ccec914732ed4661ae101215fc39fcd34dabe msgnu https://kickback.events/ false false false false false false +31-Gitcoin:Core 0x40511f88b87b69496a3471cdbe1d3d25ac68e408 GG19 - Build Guild - independent - OP - 11000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 80-Malicious:Shanghai 0x40525ac2fe3befe27a4e73757178d4accfef71da Possibly Malicious 0x405 TrueBlocks.io false false false false false false 30-Contracts 0x4053981a40836141cb79f05f68e9da385ff1814e LexDAO DAO Etherscan 18 false false false true true false 50-Tokens:ERC20 0x4057950247e4ec8dc7fe399ec19ea43e80b931c8 DanKoin DANK On chain 18 false false false true true false @@ -6077,6 +6085,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x4212fea9fec90236ecc51e41e2096b16ceb84555 Six Domain Asset SDA On chain 18 false false false true true false 50-Tokens:ERC20 0x4213458c69c19e6792510e1153cb0c5834665fdc Balancer Boosted Aave USD Pool yVault yvBalancer-BoostedAaveUSD SmolAssets 18 false false false true true false 90-Individuals:Humanity DAO 0x421507debcc6e26cdb8d30f46dfe6405157e0368 comex_vip https://www.humanitydao.org/humans false false false false false false +31-Gitcoin:Core 0x421510312c40486965767be5ea603aa8a5707983 GR17 - Climate Solutions - program - ETH - 350000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 50-Tokens:ERC20 0x422866a8f0b032c5cf1dfbdef31a20f4509562b0 Adshares Token ADST On chain 18 false false false true true false 91-Early:Addresses 0x4229a873bbd207deef8f41e807e563c26033d118 Triple EtherScan.io false false false true false false 31-Gitcoin:Grants 0x422ae3412510d6c877b259dad402ddeaf1fdb28e Grant 1141 Conviction Voting Cadcad Model Improvements: 1hive Luna Swarm 🐝 https://gitcoin.co/grants/1141/conviction-voting-cadcad-model-improvements-1hive false false false false false false @@ -6571,6 +6580,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x4724c952ed4fc2e1cf83a3825ad9bb100891a5cf Society STY On chain 18 false false false true true false 31-Giveth:Project 0x472507ad78595ec189f4b7a6f2bc5c595148e96b Junior Achievement of Northern California Tokenomics false false false false false false 30-Contracts 0x47252a63c723889814aebcac0683e615624cec64 nil NIL Etherscan 18 false false false true true false +31-Gitcoin:Core 0x4727e3265706c59dbc31e7c518960f4f843bb4da GG19 - GreenPill Network - independent - OP - 5000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 90-Individuals:Other 0x47284536f60ca404106c399176d4f3ee8fa6fd57 INSP Sender Airdrop TrueBlocks.io false false false false false false 31-Giveth:Project 0x472ca54d214883f1a4d38bfd17547d52d0dfd52e Jewish Community Foundation of San Diego Tokenomics false false false false false false 90-Individuals:Twitter 0x472e5c322495e031518d81b6b93677b432e109b0 PerryNFTs banteg on twitter false false false false false false @@ -8646,6 +8656,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:Twitter 0x5b939db939d5cf5219ba1c7bc311671d4e813581 brodie_beau banteg on twitter false false false false false false 90-Individuals:Gitcoin Grants 0x5b93ff82faaf241c15997ea3975419dddd8362c5 coopahtroopanew OnChain false false false false false false 31-Gitcoin:Grants 0x5b94bfd07fcd3d6b1a53ac1f7cb9e0fd9c383030 Grant 1558 ?? https://gitcoin.co/grants/1558/-7 false false false false false false +31-Gitcoin:Core 0x5b95acf46c73fd116f0fedadcbedf453530e35d0 GG18 - Zuzalu Continuous Innovation - community - OP - 25000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 30-Contracts 0x5b971730d64d8de2151d24d366c490ba7e02a668 Conflux CFX Etherscan 18 false false false true true false 90-Individuals:Gitcoin Grants 0x5b97680e165b4dbf5c45f4ff4241e85f418c66c2 kaiynne Gitcoin Website false false false false false false 60-SmolAssets 0x5b977577eb8a480f63e11fc615d6753adb8652ae WETHyVault yvWETH SmolAssets 18 false false false false false false @@ -8981,6 +8992,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:Gitcoin Grants 0x5eb5d9a3d6d71312a0acbce6516c731724273c0f alyssum1008 Gitcoin Website false false false false false false 90-Individuals:Twitter 0x5eb602f2dc147b54dee73a2d89fa911984d9143f Yukal72 banteg on twitter false false false false false false 50-Tokens:ERC20 0x5eb87caa0105a63aa87a36c7bd2573bd13e84fae BQT BQT On chain 18 false false false true true false +31-Gitcoin:Core 0x5eb890e41c8d2cff75ea942085e406bb90016561 GG19 - Climate Solutions - community - OP - 150000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 31-Gitcoin:Grants 0x5eb9373f40edd37beea5271c4b3e81a022858d6e Grant 1569 Helloipm https://gitcoin.co/grants/1569/helloipm false false false false false false 31-Giveth:Project 0x5ebbfe158dc33fefc22f009c7559bba2327a7dcc A Child's Hope Int'l Tokenomics false false false false false false 30-Contracts 0x5ebce946c00f46da6ca7123df0bc4b2d3b27b153 MONSTER DAO MOND Etherscan 18 false false false true true false @@ -9554,6 +9566,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:DevCon2 0x64a94bceb9eb49058b2814db726c9056f2f2ff47 JacobEberhardt DevCon2 Token Contract false false false false false false 40-Exchanges 0x64a9edd3f5fce0252cd708e26c8dd11205742826 Uniswap: ANJ Aragon Network Juror ANJ EtherScan.io false false false true false false 50-Tokens:ERC20 0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5 Olympus OHM Rotki 9 false false false true true false +31-Gitcoin:Core 0x64aa545c9c63944f8e765d9a65eda3cbbdc6e620 GR17 - ReFi Local Nodes - community - eth - 25000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 90-Individuals:Humanity DAO 0x64abc5b10c77d93be5038e7b4965d2f0d8279127 wesamadas https://www.humanitydao.org/humans false false false false false false 90-Individuals:Twitter 0x64ae055e346d22de07482ef71e3c48c5a950bdab _prhpsc banteg on twitter false false false false false false 90-Individuals:Kickback 0x64ae49156b71ac5e1af9da749ddf0d7257e66063 lkngtn https://kickback.events/ false false false false false false @@ -9583,6 +9596,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:Kickback 0x64df7f5c74b0765b2e4ad8a652a7d16069cf657e hgreer https://kickback.events/ false false false false false false 31-Gitcoin:Grants 0x64df823e0f9dbc32fb58d69af32aa5fe3cdd0388 Grant 0300 Ryo Cloud by Avado https://gitcoin.co/grants/300/ryo-cloud-by-avado false false false false false false 50-Tokens:ERC20 0x64e39084fce774b6e892e5a4da5a9032d7436871 AV DAO Avault.fi On chain 18 false false false true true false +31-Gitcoin:Core 0x64e5b2228ef31437909900b38fc42dd5e4b83147 GR17 - ENS Ecosystem - community - eth - 50000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 31-Gitcoin:Grants 0x64e821f43471a2e8d296aa3f151cfed0440b0d91 Grant 0606 DeFi Indonesia https://gitcoin.co/grants/606/defi-indonesia false false false false false false 31-Giveth:Project 0x64ea03f63965ef5b7576ce6ede7f087b8b578d56 The Believe In Tomorrow Children's House at Johns Hopkins Tokenomics false false false false false false 30-Contracts 0x64ed7fc387bfeee39898b553fe0e199a35fec5d6 Froggies FROGGIE Etherscan false false false true false true @@ -9829,6 +9843,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:Twitter 0x672105753ea79e62ca9b9f7232bbaed3deb4e397 kingendvy banteg on twitter false false false false false false 31-Gitcoin:Grants 0x67221b267cee49427baa0974ceac988682192977 Grant 3393 - Uniswap and DAOs library development https://gitcoin.co/grants/3393/uniswap-and-daos-library-development false false false false false false 30-Contracts 0x67258f507ee5ce6bff8d589749f4380cfa9b0131 Uniswap V2 UNI-V2 Etherscan 18 false false false true true false +31-Gitcoin:Core 0x6726fe9c89fb04eaef388c11cf55be6aa0a62fb9 GG19 - GCC - community - OP - 30000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 50-Tokens:ERC20 0x6727d78501b7f1629704168ce74330aea6e5a39b Monkey Inu MONKEY On chain 9 false false false true true false 31-Giveth:Project 0x672965707b164c2588549403ec9d7e7d78832b89 The Mississauga Food Bank Tokenomics false false false false false false 50-Tokens:ERC20 0x672a1ad4f667fb18a333af13667aa0af1f5b5bdd Verify Token CRED On chain 18 false false false true true false @@ -10113,6 +10128,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x69dc5556a91dfab39f8d50f6fe552296f2268dda Wonder WND On chain 5 false false false true true false 30-Contracts 0x69dde2e4d81720aefdb50bc7439edd32565d21f2 GODS Token GODS Etherscan 18 false false false true true false 90-Individuals:Gitcoin Grants 0x69e271483c38ed4902a55c3ea8aab9e7cc8617e5 wildmolasses Gitcoin Website false false false false false false +31-Gitcoin:Core 0x69e423181f1d3e6bebf8ab88030c36da73785f26 GG18 - Arbitrum Domain - community - eth - 100000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 31-Gitcoin:Grants 0x69e5a15af433cf54c15cc092809a3ca71ed5c958 Grant 1660 Web3.0 Collaborative Group https://gitcoin.co/grants/1660/web30-collaborative-group false false false false false false 50-Tokens:ERC20 0x69e8b9528cabda89fe846c67675b5d73d463a916 OPEN Governance Token OPEN Rotki 18 false false false true true false 50-Tokens:ERC721 0x69e92c16b66020e6c22bb6e478c6dcebb72f8b70 GU: Hyperion White Star GU:WHITESTAR On chain 18 false false false true true true @@ -10576,6 +10592,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x6e8908cfa881c9f6f2c64d3436e7b80b1bf0093f Bistroo Token BIST Rotki 18 false false false true true false 31-Giveth:Project 0x6e89497f965ed87ad198d2c157bd290396f97dbb Das Hallo Projekt Tokenomics false false false false false false 50-Tokens:ERC20 0x6e8d2b6fb24117c675c2fabc524f28cc5d81f18a Curve.fi Factory Pool: cbETH cbETHETH-f Rotki 18 false false false true true false +31-Gitcoin:Core 0x6e8dc2e623204d61b0e59e668702654ae336c9f7 GR17 - DeSci (Decentralized Science) - community - eth - 85000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 31-Gitcoin:Grants 0x6e8eb6575c62b9f9c07fa666464c9543e7ecfca4 Grant 1021 - GruPur https://gitcoin.co/grants/1021/grupur false false false false false false 30-Contracts 0x6e939360196c7f044871b17770268e8a04556121 SushiSwap LP Token SLP Etherscan 18 false false false true true false 50-Tokens:ERC20 0x6e9455d109202b426169f0d8f01a3332dae160f3 LP Yearn CRV Vault v2 lp-yCRVv2 SmolAssets 18 false false false true true false @@ -11635,6 +11652,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x790a60024bc3aea28385b60480f15a0771f26d09 Curve YFI-ETH Pool yVault yvCurve-YFIETH SmolAssets 18 false false false true true false 30-Contracts 0x790b464f053edcafbf57b767b7439889ff275184 cash.tech CATE Etherscan 18 false false false true true false 50-Tokens:ERC20 0x790cfdc6ab2e0ee45a433aac5434f183be1f6a20 Universal Store of Value anyUSV Rotki 9 false false false true true false +31-Gitcoin:Core 0x79115c9114055f16bb5b0e9bbfa450844d0fcb3a GG19 - Meta Pool - community - OP - 30000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 90-Individuals:Twitter 0x7911e7a8d9779060020a284e90cd95c08e64eb3d CobratatexAI banteg on twitter false false false false false false 30-Contracts 0x79126d32a86e6663f3aaac4527732d0701c1ae6c Dark Matter Token DMT Etherscan 18 false false false true true false 50-Tokens:ERC20 0x791425156956e39f2ab8ab06b79de189c18e95e5 IcoBay IBT On chain 18 false false false true true false @@ -12285,6 +12303,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 30-Contracts 0x7f8fe1c63dd4da8eeca9f1dd69f30bc8cedaa83b Integral.link ITGR Etherscan 18 false false false true true false 60-SmolAssets 0x7f90122bf0700f9e7e1f688fe926940e8839f353 Curve.fiUSDC/USDT 2CRV SmolAssets 18 false false false true false false 90-Individuals:Twitter 0x7f9219fc5192895988740514a037edae7ddc0213 baozia666 banteg on twitter false false false false false false +31-Gitcoin:Core 0x7f9415761afbd82e3fe2fd9e878fa643184bc729 GG19 - Cult DAO - independent - OP - 6500 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 50-Tokens:ERC20 0x7f95390927a69803e38e296eb30d619f5a7593da Nekocoin NEKO On chain 18 false false false true true false 50-Tokens:ERC721 0x7f96f68fa766d4e9b037417fe4967511152b9272 SOLOS SOLOS On chain 18 false false false true true true 30-Contracts 0x7f9a00e03c2e53a3af6031c17a150dbedaaab3dc Read This Contract RTC Etherscan 18 false false false true true false @@ -12875,6 +12894,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:Twitter 0x859a08e043e70639cab6b89c0d6d7d24036a2beb hging3 banteg on twitter false false false false false false 50-Tokens:ERC20 0x859a9c0b44cb7066d956a958b0b82e54c9e44b4b iEthereum iETH On chain 8 false false false true true false 50-Tokens:ERC20 0x859beb8615977263ee2e702f06c283f7ab990b5a GRIND+ GRD On chain 18 false false false true true false +31-Gitcoin:Core 0x859faeaa266ba13bd1e72eb6dd7a223902d1adfe GR17 - Global Chinese Community beta round - community - eth - 25000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 31-Gitcoin:Grants 0x85a363699c6864248a6ffca66e4a1a5ccf9f5567 Grant 0680 Mars Robertson's Personal Grant • Smart Contracts • Programmable Money • New World Order 🌎🌍🌏 https://gitcoin.co/grants/680/mars-robertsons-personal-grant-smart-contracts-pr false false false false false false 50-Tokens:ERC20 0x85a4e68e2a135d7cb247472b266aedfe6661a869 SHIBAKISHU SHIBAKISHU On chain 18 false false false true true false 50-Tokens:ERC20 0x85a94ba84b68d17a95bee59029b2b82e118bb56d Curve.fi Factory Crypto Pool: liq_ETH_MATIC ETH MATIC-f Rotki 18 false false false true true false @@ -13368,6 +13388,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x8a99ed8a1b204903ee46e733f2c1286f6d20b177 Fujinto NTO On chain 18 false false false true true false 50-Tokens:ERC20 0x8a9c4dfe8b9d8962b31e4e16f8321c44d48e246e NameChangeToken NCT On chain 18 false false false true true false 50-Tokens:ERC20 0x8a9c67fee641579deba04928c4bc45f66e26343a Jarvis Reward Token JRT On chain 18 false false false true true false +31-Gitcoin:Core 0x8aa06b3b8cac2970857f4e0fd78f21dc01aade94 GR17 - Metacrisis - community - eth - 25000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 50-Tokens:ERC20 0x8aa33a7899fcc8ea5fbe6a608a109c3893a1b8b2 Dao.Casino BET On chain 18 false false false true true false 31-Giveth:Project 0x8aa3e4d9f8e815bcb8a6cd129053686d5144b3a4 MusiCounts Tokenomics false false false false false false 50-Tokens:ERC20 0x8aa688ab789d1848d131c65d98ceaa8875d97ef1 MultiVAC MTV Rotki 18 false false false true true false @@ -13690,6 +13711,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 31-Gitcoin:Grants 0x8dde317041a0154b53ef3f9d275b65c8c4273b40 Grant 2767 - Orange Wallet https://gitcoin.co/grants/2767/orange-wallet false false false false false false 50-Tokens:ERC20 0x8de67d55c58540807601dbf1259537bc2dffc84d Almeela KZE On chain 18 false false false true true false 31-Giveth:Project 0x8de78a2ba93001e60d6b24d4bf8c497b50c6dec7 Church on the Rock Tokenomics false false false false false false +31-Gitcoin:Core 0x8de918f0163b2021839a8d84954dd7e8e151326d GG18 - Web3 Open Source Software - program - OP - 300000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 90-Individuals:Twitter 0x8debd276fa9fdfb72338a7eddac09ced6a005c9f immadchad banteg on twitter false false false false false false 30-Contracts 0x8deef89058090ac5655a99eeb451a4f9183d1678 Synth iXTZ iXTZ Etherscan 18 false false false true true false 50-Tokens:ERC20 0x8df0713b2a047c45a0bef21c3b309bcef91afd34 Curve.fi Factory Plain Pool: handleEUR fxEUR_CRV-f Rotki 18 false false false true true false @@ -13923,6 +13945,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 66-Ofac:Sanctioned 0x905b63fff465b9ffbf41dea908ceb12478ec7601 Tornado Cash ETH 25 Ofac website false false false true false false 50-Tokens:ERC20 0x905e337c6c8645263d3521205aa37bf4d034e745 Medical Token Currency MTC On chain 18 false false false true true false 31-Gitcoin:Grants 0x905e81b391810dcd61f949484b5430b6297a6ae4 Grant 1384 on Time - Schedule Your Transactions https://gitcoin.co/grants/1384/on-time-schedule-your-transactions false false false false false false +31-Gitcoin:Core 0x905efbabe2d52cd648fadfafcec8d6c8c60f7423 GR17 - The Phantom Menace - community - eth - 25000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 60-SmolAssets 0x906122ac1b55b71248abfa552fdc6abd3356884a Velodromev2MTA-USDC.eFactoryyVault yvVelo-MTA-USDC.e-f SmolAssets 18 false false false false false false 34-ENS 0x9062c0a6dbd6108336bcbe4593a3d1ce05512069 ENS: Old Reverse Registrar EtherScan.io false false false true false false 50-Tokens:ERC20 0x9064c91e51d7021a85ad96817e1432abf6624470 shinechain SHE On chain 18 false false false true true false @@ -14184,6 +14207,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 30-Contracts 0x932f3c2ba86a9b354dc1048df13143b1d2ef8618 af sdfsf Etherscan false false false true false true 55-Defi 0x932fc4fd0eee66f22f1e23fba74d7058391c0b15 Yearn: StrategyMKRVaultDAIDelegate EtherScan.io false false false true false false 90-Individuals:Twitter 0x933167ebff32fe77ec2e43abd0422d84c3cbe0ce matt_hashh banteg on twitter false false false false false false +31-Gitcoin:Core 0x9331fde4db7b9d9d1498c09d30149929f24cf9d5 GG18 - Web3 Social - community - OP - 25000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 90-Individuals:Gitcoin Grants 0x9334a2aa7fb7b9b6c45dc7685d841aa24dc22cc0 bigmonstermining Gitcoin Website false false false false false false 90-Individuals:Twitter 0x9334f14817069f22f2eb8840cfc863de060f162c Lance_rrr banteg on twitter false false false false false false 90-Individuals:Twitter 0x933679024fdb57a31a58a12efff0fd5516547646 AntonLtk banteg on twitter false false false false false false @@ -14705,6 +14729,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:Gitcoin Grants 0x98434b496c9c8fa5060af1731b875f63fed7de09 quamar28595 Gitcoin Website false false false false false false 60-Rotki 0x98443b96ea4b0858fdf3219cd13e98c7a4690588 Basic Attention Token BAT.e Rotki 18 false false false false false false 50-Tokens:ERC20 0x9848482da3ee3076165ce6497eda906e66bb85c5 Curve.fi Factory Pool: pETH pETH-ETH-f SmolAssets 18 false false false true true false +31-Gitcoin:Core 0x984e29dcb4286c2d9cbaa2c238afdd8a191eefbc Gitcoin Citizens Round #1 - community - OP - 20000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 80-Malicious 0x9851131b33fd9e084c56fb4a341460e8ea23e737 Probably Malicious 0x9851 TrueBlocks.io false false false false false false 91-Early:Addresses 0x985509582b2c38010bfaa3c8d2be60022d3d00da NameReg_id17_cnt13_7mo Ether Camp false false false true false false 60-Rotki 0x98550e01f6c4f2ebc017f134950d2a24ccf43bc0 Test TEST3 Rotki 18 false false false false false false @@ -15085,6 +15110,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0x9c354503c38481a7a7a51629142963f98ecc12d0 Origin DeFi Governance OGV Rotki 18 false false false true true false 90-Individuals:Twitter 0x9c366257e3fd1f814bacb4efaf261b2f967fb9d9 hue1020 banteg on twitter false false false false false false 90-Individuals:Kickback 0x9c37867fb987769f6f18b9c1990f187fa1fd553e pallabpaul https://kickback.events/ false false false false false false +31-Gitcoin:Core 0x9c3b81967eafba0a451e324417dd4f3f353b997b GR17 - Web3 Social - community - eth - 50000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 90-Individuals:Kickback 0x9c3c83fc9b8fe1dfd5409788d188348413619539 masanori https://kickback.events/ false false false false false false 90-Individuals:Other 0x9c3c9283d3e44854697cd22d3faa240cfb032889 Polygon Mumbai WMATIC https://docs.uniswap.org/protocol/reference/deployments false false false false false false 90-Individuals:Twitter 0x9c3e0eaa4aa05408d96b192ea537830fe95e4b14 Bloobooo banteg on twitter false false false false false false @@ -15303,6 +15329,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:Twitter 0x9e638dc18a8d4c0ff4de80d3abe60105ba3c1bd0 anonfungible banteg on twitter false false false false false false 90-Individuals:Kickback 0x9e64b47bbdb9c1f7b599f11987b84c416c0c4110 jamiis https://kickback.events/ false false false false false false 55-Defi 0x9e65ad11b299ca0abefc2799ddb6314ef2d91080 Yearn: Controller EtherScan.io false false false true false false +31-Gitcoin:Core 0x9e669c0a6e075f14ba9d9d98c3580ad67e20ec38 GR17 - Token Engineering - community - eth - 25000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 50-Tokens:ERC20 0x9e6a8c58f485ff18739f2d17cdce9392987c2721 Quantum Entanglement QTE On chain 18 false false false true true false 50-Tokens:ERC20 0x9e6b2b11542f2bc52f3029077ace37e8fd838d7f Hacken HKN On chain 8 false false false true true false 50-Tokens:ERC20 0x9e6c59321ceb205d5d3bc6c539c017af6159b16c MindCell MDC Rotki 18 false false false true true false @@ -16482,6 +16509,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0xaa2ce7ae64066175e0b90497ce7d9c190c315db4 Suterusu Suter Rotki 18 false false false true true false 50-Tokens:ERC20 0xaa2d49a1d66a58b8dd0687e730fefc2823649791 The Heart of Babylon hBABL Rotki 18 false false false true true false 50-Tokens:ERC20 0xaa379c2aa72529d5ec0da8a41e2f41ed7fe4b48c Curve TriCryptoUSDC Factory yVault yvCurve-3CryptoUSDC-f SmolAssets 18 false false false true true false +31-Gitcoin:Core 0xaa40e2e5c8df03d792a52b5458959c320f86ca18 GR17 - Web3 Community and Education - program - ETH - 200000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 31-Gitcoin:Grants 0xaa42aa2e1888c5aa2861e970cb2720848b868c68 Grant 0007 Eth2.0 Implementers Call Notes https://gitcoin.co/grants/7/eth20-implementers-call-notes false false false false false false 50-Tokens:ERC20 0xaa4b6506493582f169c9329ac0da99fff23c2911 ParaSpace Derivative Token WETH pWETH Rotki 18 false false false true true false 50-Tokens:ERC20 0xaa4f7562d3c25bd2fcb8fed615182667c0a7086c Balancer stafiETH Factory yVault yvBal-stafiETH-f SmolAssets 18 false false false true true false @@ -17672,6 +17700,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 60-Rotki 0xb5be8d87fce6ce87a24b90abdb019458a8ec31f9 OBORTECH OBOT Rotki 18 false false false false false false 30-Contracts 0xb5bfe528a288fbeac2b0c2624dcb53a3abbac2d4 TURTLE TRTL Etherscan 18 false false false true true false 31-Giveth:Project 0xb5c0671fc118fb0bcdb237538b189ca297c8b72c Mad Anthonys Children's Hope House Tokenomics false false false false false false +31-Gitcoin:Core 0xb5c0939a9bb0c404b028d402493b86d9998af55e GG19 - Raid Guild - independent - OP - 2500 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 90-Individuals:Twitter 0xb5c245b9ed6c02d2606e8e2760888b9844d2b2bb slayedeeyore banteg on twitter false false false false false false 50-Tokens:ERC20 0xb5c578947de0fd71303f71f2c3d41767438bd0de Decentralized Eternal Virtual Traveller DEVT Rotki 18 false false false true true false 30-Contracts 0xb5c64c7d6b374ad738e314eaa7bcc07aec194b7b BaseToken BASE Etherscan 18 false false false true true false @@ -17784,6 +17813,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0xb6b46d939d187b0fe5df9cc1e91d47bb201f592e Shiba Inu Treats TREATS 🦴 On chain 18 false false false true true false 60-Rotki 0xb6b8ccd230bb4235c7b87986274e7ab550b72261 HALO Token HALO Rotki 18 false false false false false false 31-Gitcoin:Grants 0xb6bccce9cfe99d4b593aba72f3a36028d1ade4c5 Grant 1150 Educational DeFi Content | Amadeo Brands - on DeFi https://gitcoin.co/grants/1150/educational-defi-content-amadeo-brands-on-defi false false false false false false +31-Gitcoin:Core 0xb6be0ecafdb66dd848b0480db40056ff94a9465d GG18 - Climate Solutions - program - OP - 250000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 90-Individuals:Twitter 0xb6be2e4e9deadee130c5ae758102e29e01c37c4d mataman412 banteg on twitter false false false false false false 90-Individuals:Twitter 0xb6c171185806cfba2c7746f031b714bd2d6d6221 ancha72_ banteg on twitter false false false false false false 90-Individuals:Kickback 0xb6c2e8fb7f96d2023bfaccd4d4c9963ac1057917 theblockstalk https://kickback.events/ false false false false false false @@ -18783,6 +18813,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 30-Contracts 0xc06e44a64532e8b04c41459a1756775ff41bd3a3 Uniswap V2 UNI-V2 Etherscan 18 false false false true true false 50-Tokens:ERC20 0xc07a150ecadf2cc352f5586396e344a6b17625eb BioPassport Coin BIOT Rotki 9 false false false true true false 31-Giveth:Project 0xc07d6ddb4330bb23d7175e069fd2c53fdac15e9e Vladimir Skate Film Festival Tokenomics false false false false false false +31-Gitcoin:Core 0xc08008d47e3deb10b27fc1a75a96d97d11d58cf8 GG19 - Daily Gwei - independent - OP - 5000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 50-Tokens:ERC20 0xc0829421c1d260bd3cb3e0f06cfe2d52db2ce315 Ether Token ETH On chain 18 false false false true true false 30-Contracts 0xc0844fdf1bcbde59a3af0859455d964d350a2cb6 ROYAL ROYAL Etherscan 18 false false false true true false 50-Tokens:ERC20 0xc08512927d12348f6620a698105e1baac6ecd911 GMO JPY GYEN Rotki 6 false false false true true false @@ -19066,6 +19097,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0xc343f099d3e41aa5c1b59470450e21e92e2d840b Verime Mobile VME On chain 18 false false false true true false 31-Gitcoin:Grants 0xc345b617024ac3dc6e792455cf7f7ad7e6ccda2a Grant 2974 - Ethereum Lists https://gitcoin.co/grants/2974/ethereum-lists false false false false false false 90-Individuals:Twitter 0xc34724ae12c71bc35afd3638d689d31556477350 PNajgaGihn4ALWm banteg on twitter false false false false false false +31-Gitcoin:Core 0xc34745b3852df32d5958be88df2bee0a83474001 GG19 - Web3 Social - community - OP - 22500 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 50-Tokens:ERC20 0xc34993c9adf6a5ab3b4ca27dc71b9c7894a53974 Curve.fi Factory Crypto Pool: CRV/frxETH CRVfrxETH-f Rotki 18 false false false true true false 31-Gitcoin:Grants 0xc34a86a20118644b454e9c7808a53c29df3483ac Grant 2826 - Dev Launchers - Accessible Tech Training At Scale https://gitcoin.co/grants/2826/dev-launchers-accessible-tech-training-at-scale false false false false false false 31-Gitcoin:Grants 0xc34ad4a95adcd9021182fd5607ed822db738e7c4 Grant 1183 Web3bridge https://gitcoin.co/grants/1183/web3bridge false false false false false false @@ -19341,6 +19373,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:Twitter 0xc5fa3ccb3915e5a8e32ab8c9714dfd240b19510c miomiomiow2 banteg on twitter false false false false false false 50-Tokens:ERC20 0xc5fb36dd2fb59d3b98deff88425a3f425ee469ed Dejitaru Tsuka TSUKA Rotki 9 false false false true true false 31-Giveth:Project 0xc5fc0e94a7b512912936ba932b04b856d835a2cb Beverly Bootstraps Tokenomics false false false false false false +31-Gitcoin:Core 0xc5fdf5cff79e92fac1d6efa725c319248d279200 GG18 - Token Engineering - community - OP - 25000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 31-Giveth:Project 0xc6029992e15a93c96b044fcfaf060d2d03c93966 Psychedelic Science Funders Collaborative Tokenomics false false false false false false 31-Giveth:Project 0xc6055be8996ad6da60269949b95744131bf1595c FOXG1 Research Foundation Tokenomics false false false false false false 90-Individuals:Twitter 0xc60a372bc3e64cc5682238a7cc03e2325ac1d65e tung0305tk banteg on twitter false false false false false false @@ -19683,6 +19716,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 50-Tokens:ERC20 0xc990e227d2ed9af6b3afb42f7522c99a0ef1892d DOGGY DOGGY On chain 18 false false false true true false 31-Giveth:Project 0xc99930e6eb59a373b3aafd1ad14e5aad90b3244f B2THEWORLD, INC. Tokenomics false false false false false false 55-Defi 0xc999fb87aca383a63d804a575396f65a55aa5ac8 Yearn: StrategyCurveYCRVVoter EtherScan.io false false false true false false +31-Gitcoin:Core 0xc9a01d3d2505d9d2418dd2da64d06cf53fd403a0 GG19 - Ethereum.org - independent - OP - 5000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 90-Individuals:Humanity DAO 0xc9a06469a723d0beb457e6fcdd7c41f6c9d61916 gvirtzm https://www.humanitydao.org/humans false false false false false false 30-Contracts 0xc9a1757a52f2e87a2144c8b8ec9cb075c8b50b35 Rabbids Proof-of-Plausible-Ownership POPO Etherscan false false false true false true 90-Individuals:Twitter 0xc9a1c1e99bc1880bee0564660aa5e02846141fc0 DY_the_God banteg on twitter false false false false false false @@ -20624,6 +20658,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 31-Giveth:Project 0xd306a9ba016a5e6a83802c150aa4c1a8fbdea676 Edinburgh Dog and Cat Home Tokenomics false false false false false false 60-Rotki 0xd306c124282880858a634e7396383ae58d37c79c WastedLands WAL Rotki 18 false false false false false false 90-Individuals:Twitter 0xd309605c4680e94d4d39fa23f503232e5f7f20c2 billychehab banteg on twitter false false false false false false +31-Gitcoin:Core 0xd309defd59c0b8792b14197eaa40043d9625b22b GG19 - Public Goods Africa - independent - OP - 5000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 91-Early:Addresses 0xd30ecf8897af28bccf7e05250ea9e1e275ee41d4 Early_Partners_003 Ether Camp false false false false false false 90-Individuals:Humanity DAO 0xd3133698479c52a9ffe8fb0c200de0338be46080 breton https://www.humanitydao.org/humans false false false false false false 90-Individuals:Twitter 0xd31394f6515cc3ae023db56449e9975b1a92a339 Decentralla banteg on twitter false false false false false false @@ -21842,6 +21877,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:Twitter 0xdf1f3cddf399bda06e281a99af61c2589f8c40e6 wagminda banteg on twitter false false false false false false 90-Individuals:Twitter 0xdf218fcbdf1d2dbd57b0036d3dac3b0be10cccfa changfawa banteg on twitter false false false false false false 90-Individuals:Other 0xdf21fa922215b1a56f5a6d6294e6e36c85a0acfb Probable_Exchange, oloniex's DAO Wallet Consensys, Slack Nation false false false false false false +31-Gitcoin:Core 0xdf22a2c8f6ba9376ff17ee13e6154b784ee92094 GR17 - Ethereum Infrastructure - program - ETH - 200000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 90-Individuals:Twitter 0xdf286be2e9e24c5771729eb309cb545d46b12019 lazy_moments banteg on twitter false false false false false false 31-Giveth:Project 0xdf28e7e40a3f92d40d991a67590bc9a9c46c0b75 Hope for Justice Tokenomics false false false false false false 90-Individuals:Gitcoin Grants 0xdf290293c4a4d6ebe38fd7085d7721041f927e0a mzargham Gitcoin Website false false false false false false @@ -23619,6 +23655,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 30-Contracts 0xf1b33ac32dbc6617f7267a349be6ebb004feccff Dreamloops V1 DRMLOOPS Etherscan false false false true false true 90-Individuals:Humanity DAO 0xf1b5c649c5147d2ceb8dd4c0207f35c4651a01b4 krmccraney https://www.humanitydao.org/humans false false false false false false 90-Individuals:Twitter 0xf1b90a3e49a6ce7e630c8cc79f2757abd9cceb95 haku2021 banteg on twitter false false false false false false +31-Gitcoin:Core 0xf1c021df6dc6b2dc2e5a837cdfddc2f42503233b GR17 - Mantle Grants 1 - community - eth - 50000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false false false true false false 60-Rotki 0xf1c1a3c2481a3a8a3f173a9ab5ade275292a6fa3 BLOCKv VEE Rotki 18 false false false false false false 90-Individuals:Twitter 0xf1ca71e63ab0c49ede9f3f488df1525ef0691791 RodriguezR46130 banteg on twitter false false false false false false 50-Tokens:ERC20 0xf1ca9cb74685755965c7458528a36934df52a3ef AVINOC Token AVINOC On chain 18 false false false true true false @@ -24037,6 +24074,7 @@ tags address name symbol source decimals deleted isCustom isPrefund isContract i 90-Individuals:Twitter 0xf5909392b46d50463501c90f2812ee9c04db2b0d realGina2333 banteg on twitter false false false false false false 31-Gitcoin:Grants 0xf5913759b449fae8900d61f7116d451d200c60f7 Grant 0784 Add Colony DAOs to Deep DAO https://gitcoin.co/grants/784/add-colony-daos-to-deep-dao false false false false false false 50-Tokens:ERC721 0xf5918382dd20ecba89747c50f80fb7f9f1e0524c Rainbow Rolls ROLLS On chain 18 false false false true true true +31-Gitcoin:Core 0xf591e42dfdfe8e62c2085ccaadfe05f84d89d0c6 GG18 - Meta Pool LatAm - community - OP - 25000 https://raw.githubusercontent.com/ufkhan97/gitcoin-grants-heroku/main/all_rounds.csv false true false false false false 31-Gitcoin:Grants 0xf592ee0e3a20ddd65882e0fe6bfbb4b465a98ae4 Grant 1862 Peeker Bot https://gitcoin.co/grants/1862/peeker-bot false false false false false false 90-Individuals:Twitter 0xf596703d77f7e507d184772fa131af0bca149898 SnailPrincessCh banteg on twitter false false false false false false 50-Tokens:ERC20 0xf59ae934f6fe444afc309586cc60a84a0f89aaea Polkadex PDEX Rotki 18 false false false true true false diff --git a/tests b/tests index 6bb28604a5..20f267f4c9 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 6bb28604a529d6793f7f952c53bfcaf85af0d387 +Subproject commit 20f267f4c98a8439c618e7c3fd175a83c970ef73 From ed76f675efa689fde9a27b93759bdc1547127ebe Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 21 Jul 2024 01:52:28 -0400 Subject: [PATCH 003/121] Updates go.mods --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index 04d7433520..5fa100a7c3 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index 373c7dc313..20c29f0647 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 h1:LNfFuvmDvIIJP8B2Y3Hepx9AkDxsb8eLroP7xGiCRVc= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6/go.mod h1:rLDLHdHmjdwV+hAp1YoFSNNfSVtOULOsqG1w+fEdF6U= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 h1:5kZTCjvtX9/PhxlswLLcCnhDoKxiKpgvr3xJijRXX+0= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index c07f10e8ee..7cbc3ed720 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index 49dd55ef41..d5cbadd4af 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 h1:LNfFuvmDvIIJP8B2Y3Hepx9AkDxsb8eLroP7xGiCRVc= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6/go.mod h1:rLDLHdHmjdwV+hAp1YoFSNNfSVtOULOsqG1w+fEdF6U= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 h1:5kZTCjvtX9/PhxlswLLcCnhDoKxiKpgvr3xJijRXX+0= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 170305a2cd..6a366af94b 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index 49dd55ef41..d5cbadd4af 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 h1:LNfFuvmDvIIJP8B2Y3Hepx9AkDxsb8eLroP7xGiCRVc= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6/go.mod h1:rLDLHdHmjdwV+hAp1YoFSNNfSVtOULOsqG1w+fEdF6U= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 h1:5kZTCjvtX9/PhxlswLLcCnhDoKxiKpgvr3xJijRXX+0= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index 2172e8c195..f8b0606e5d 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index 49dd55ef41..d5cbadd4af 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 h1:LNfFuvmDvIIJP8B2Y3Hepx9AkDxsb8eLroP7xGiCRVc= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6/go.mod h1:rLDLHdHmjdwV+hAp1YoFSNNfSVtOULOsqG1w+fEdF6U= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 h1:5kZTCjvtX9/PhxlswLLcCnhDoKxiKpgvr3xJijRXX+0= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index 64c5ab9314..ffc9c9c2df 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index 49dd55ef41..d5cbadd4af 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 h1:LNfFuvmDvIIJP8B2Y3Hepx9AkDxsb8eLroP7xGiCRVc= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6/go.mod h1:rLDLHdHmjdwV+hAp1YoFSNNfSVtOULOsqG1w+fEdF6U= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 h1:5kZTCjvtX9/PhxlswLLcCnhDoKxiKpgvr3xJijRXX+0= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index ae2397ae11..38f8921db0 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index f4fb7f3e5e..447f56346a 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 h1:LNfFuvmDvIIJP8B2Y3Hepx9AkDxsb8eLroP7xGiCRVc= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6/go.mod h1:rLDLHdHmjdwV+hAp1YoFSNNfSVtOULOsqG1w+fEdF6U= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 h1:5kZTCjvtX9/PhxlswLLcCnhDoKxiKpgvr3xJijRXX+0= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index c9ba24f3c2..ad0ca53916 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index fad4208533..bb9741c3be 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 h1:5kZTCjvtX9/PhxlswLLcCnhDoKxiKpgvr3xJijRXX+0= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index 4c3493654d..32320f6d0b 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index ecb64107c3..14362d3cfa 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 h1:5kZTCjvtX9/PhxlswLLcCnhDoKxiKpgvr3xJijRXX+0= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index 3f074df101..8639c5ccef 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index 49dd55ef41..d5cbadd4af 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 h1:LNfFuvmDvIIJP8B2Y3Hepx9AkDxsb8eLroP7xGiCRVc= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6/go.mod h1:rLDLHdHmjdwV+hAp1YoFSNNfSVtOULOsqG1w+fEdF6U= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 h1:5kZTCjvtX9/PhxlswLLcCnhDoKxiKpgvr3xJijRXX+0= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index 8af8d19aa3..cdbc2a9f68 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index 49dd55ef41..d5cbadd4af 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6 h1:LNfFuvmDvIIJP8B2Y3Hepx9AkDxsb8eLroP7xGiCRVc= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718044519-2c9304344dd6/go.mod h1:rLDLHdHmjdwV+hAp1YoFSNNfSVtOULOsqG1w+fEdF6U= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6 h1:5kZTCjvtX9/PhxlswLLcCnhDoKxiKpgvr3xJijRXX+0= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718044519-2c9304344dd6/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From 087a6101ff1e87a143149df8f25a960cb286ee80 Mon Sep 17 00:00:00 2001 From: yingshanghuangqiao Date: Mon, 22 Jul 2024 16:15:54 +0800 Subject: [PATCH 004/121] chore: fix some comments Signed-off-by: yingshanghuangqiao --- README.md | 2 +- src/apps/chifra/pkg/walk/walker.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7e56aaf561..2c7436878a 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Get more help on any sub-command with `chifra --help`. Full documentation ## Chifra Serve -One of `chifra's` command line tools is called `serve`. This tool provides a simple API mimicing the command line. It is intended to be used only for single user enviroments. +One of `chifra's` command line tools is called `serve`. This tool provides a simple API mimicking the command line. It is intended to be used only for single user environments. To start the server, run: diff --git a/src/apps/chifra/pkg/walk/walker.go b/src/apps/chifra/pkg/walk/walker.go index 7eeb224b25..de69f59bd6 100644 --- a/src/apps/chifra/pkg/walk/walker.go +++ b/src/apps/chifra/pkg/walk/walker.go @@ -101,7 +101,7 @@ func (walker *CacheWalker) WalkBloomFilters(blockNums []base.Blknum) error { } // TODO: This should accept unresolved block ranges, not lists of block numbers -// This routine accepts the 'resolved' block numbers. If, instead, it it received the unresolved block ranges +// This routine accepts the 'resolved' block numbers. If, instead, it received the unresolved block ranges // from the command line, it would be much more efficient. Using resolved block numbers means we have to // provide a block range that is fine-grained enough to hit on every file inside the range. For example, if // there are 100 files in the range 100000-200000, we need to create block numbers that cover every From 6aeaa1ed9a68aa9b6d32b54db2272bc11ee44b6d Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 24 Jul 2024 04:28:49 -0400 Subject: [PATCH 005/121] Small improvement to auto-code-gen --- src/dev_tools/goMaker/templates/sdk_route+internal.go.tmpl | 4 ++-- src/dev_tools/goMaker/types/types_option.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dev_tools/goMaker/templates/sdk_route+internal.go.tmpl b/src/dev_tools/goMaker/templates/sdk_route+internal.go.tmpl index 3827ff72fb..a9e5c58ca5 100644 --- a/src/dev_tools/goMaker/templates/sdk_route+internal.go.tmpl +++ b/src/dev_tools/goMaker/templates/sdk_route+internal.go.tmpl @@ -14,8 +14,8 @@ import ( ) type {{toCamel .Route}}OptionsInternal struct { -{{range .Options}}{{if not .IsDeprecated}} {{.GoSdkName}} {{.GoSdkType}} {{.JsonTag}} -{{end}}{{end}} RenderCtx *output.RenderCtx `json:"-"` +{{range .Options}}{{if not .IsDeprecated}}{{if not .IsConfig}} {{.GoSdkName}} {{.GoSdkType}} {{.JsonTag}} +{{end}}{{end}}{{end}} RenderCtx *output.RenderCtx `json:"-"` Globals } diff --git a/src/dev_tools/goMaker/types/types_option.go b/src/dev_tools/goMaker/types/types_option.go index e2f9bc7331..52c05fdb3a 100644 --- a/src/dev_tools/goMaker/types/types_option.go +++ b/src/dev_tools/goMaker/types/types_option.go @@ -810,6 +810,9 @@ func (op *Option) executeTemplate(name, tmplCode string) string { } func (op *Option) SdkIsPublic() bool { + if op.IsConfig() { + return false + } return (len(op.ReturnType) == 0 || (op.IsPositional() && !op.IsMode())) && !op.IsDeprecated() } From 7745022407c164d5f27b14876fcd53706d6f31fa Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 24 Jul 2024 05:18:34 -0400 Subject: [PATCH 006/121] Generate code for chifra scrape for GoLang SDK --- sdk/scrape.go | 36 ++++++++++++++ sdk/scrape_internal.go | 73 ++++++++++++++++++++++++++++ src/apps/chifra/sdk/scrape.go | 34 +++++++++++++ src/dev_tools/goMaker/types/utils.go | 16 ++++-- 4 files changed, 156 insertions(+), 3 deletions(-) create mode 100644 sdk/scrape.go create mode 100644 sdk/scrape_internal.go create mode 100644 src/apps/chifra/sdk/scrape.go diff --git a/sdk/scrape.go b/sdk/scrape.go new file mode 100644 index 0000000000..3425d33457 --- /dev/null +++ b/sdk/scrape.go @@ -0,0 +1,36 @@ +// Copyright 2016, 2024 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. +/* + * Parts of this file were auto generated. Edit only those parts of + * the code inside of 'EXISTING_CODE' tags. + */ + +package sdk + +import ( +// EXISTING_CODE +// EXISTING_CODE +) + +type ScrapeOptions struct { + BlockCnt uint64 `json:"blockCnt,omitempty"` + Sleep float64 `json:"sleep,omitempty"` + Touch base.Blknum `json:"touch,omitempty"` + RunCount uint64 `json:"runCount,omitempty"` + Publisher base.Address `json:"publisher,omitempty"` + DryRun bool `json:"dryRun,omitempty"` + Notify bool `json:"notify,omitempty"` + RenderCtx *output.RenderCtx `json:"-"` + Globals +} + +// String implements the stringer interface +func (opts ScrapeOptions) String() string { + bytes, _ := json.Marshal(opts) + return string(bytes) +} + +// No enums +// EXISTING_CODE +// EXISTING_CODE diff --git a/sdk/scrape_internal.go b/sdk/scrape_internal.go new file mode 100644 index 0000000000..e4e3734c88 --- /dev/null +++ b/sdk/scrape_internal.go @@ -0,0 +1,73 @@ +// Copyright 2016, 2024 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. +/* + * Parts of this file were auto generated. Edit only those parts of + * the code inside of 'EXISTING_CODE' tags. + */ + +package sdk + +import ( +// EXISTING_CODE +// EXISTING_CODE +) + +type scrapeOptionsInternal struct { + BlockCnt uint64 `json:"blockCnt,omitempty"` + Sleep float64 `json:"sleep,omitempty"` + Touch base.Blknum `json:"touch,omitempty"` + RunCount uint64 `json:"runCount,omitempty"` + Publisher base.Address `json:"publisher,omitempty"` + DryRun bool `json:"dryRun,omitempty"` + Notify bool `json:"notify,omitempty"` + RenderCtx *output.RenderCtx `json:"-"` + Globals +} + +// String implements the stringer interface +func (opts *scrapeOptionsInternal) String() string { + bytes, _ := json.Marshal(opts) + return string(bytes) +} + +// ScrapeBytes implements the chifra scrape command for the SDK. +func (opts *scrapeOptionsInternal) ScrapeBytes(w io.Writer) error { + values, err := structToValues(*opts) + if err != nil { + return fmt.Errorf("error converting scrape struct to URL values: %v", err) + } + + if opts.RenderCtx == nil { + opts.RenderCtx = output.NewRenderContext() + } + return scrape.Scrape(opts.RenderCtx, w, values) +} + +// scrapeParseFunc handles special cases such as structs and enums (if any). +func scrapeParseFunc(target any, key, value string) (bool, error) { + var found bool + _, ok := target.(*scrapeOptionsInternal) + if !ok { + return false, fmt.Errorf("parseFunc(scrape): target is not of correct type") + } + + // No enums + // EXISTING_CODE + // EXISTING_CODE + + return found, nil +} + +// GetScrapeOptions returns a filled-in options instance given a string array of arguments. +func GetScrapeOptions(args []string) (*scrapeOptionsInternal, error) { + var opts scrapeOptionsInternal + if err := assignValuesFromArgs(args, scrapeParseFunc, &opts, &opts.Globals); err != nil { + return nil, err + } + + return &opts, nil +} + +// EXISTING_CODE +// EXISTING_CODE diff --git a/src/apps/chifra/sdk/scrape.go b/src/apps/chifra/sdk/scrape.go new file mode 100644 index 0000000000..08941e3ec9 --- /dev/null +++ b/src/apps/chifra/sdk/scrape.go @@ -0,0 +1,34 @@ +// Copyright 2016, 2024 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. +/* + * Parts of this file were auto generated. Edit only those parts of + * the code inside of 'EXISTING_CODE' tags. + */ + +package sdk + +import ( + "io" + "net/url" + + scrape "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/scrape" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + outputHelpers "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output/helpers" +) + +// Scrape provides an interface to the command line chifra scrape through the SDK. +func Scrape(rCtx *output.RenderCtx, w io.Writer, values url.Values) error { + scrape.ResetOptions(sdkTestMode) + opts := scrape.ScrapeFinishParseInternal(w, values) + // EXISTING_CODE + // EXISTING_CODE + outputHelpers.InitJsonWriterApi("scrape", w, &opts.Globals) + err := opts.ScrapeInternal(rCtx) + outputHelpers.CloseJsonWriterIfNeededApi("scrape", err, &opts.Globals) + + return err +} + +// EXISTING_CODE +// EXISTING_CODE diff --git a/src/dev_tools/goMaker/types/utils.go b/src/dev_tools/goMaker/types/utils.go index 3b0b5eb206..c015f02d21 100644 --- a/src/dev_tools/goMaker/types/utils.go +++ b/src/dev_tools/goMaker/types/utils.go @@ -21,9 +21,19 @@ func shouldProcess(source, tag string) (bool, error) { return false, nil } - if strings.Contains(source, "sdk_") || strings.Contains(source, "sdkFuzzer") { - skip := tag == "explore" || tag == "scrape" || tag == "daemon" - if skip { + skip := tag == "explore" || tag == "scrape" || tag == "daemon" + isSdk := strings.Contains(source, "sdk_") + isFuzzer := strings.Contains(source, "sdkFuzzer") + if skip && (isSdk || isFuzzer) { + if tag == "scrape" { + isPython := strings.Contains(source, "python") + isTypeScript := strings.Contains(source, "typescript") + if isPython || isTypeScript || isFuzzer { + // do not generate code for scrape for Python or TypeScript SDKs + return false, nil + } + } else { + // do not generate code for daemon or explore for SDK return false, nil } } From 962f1a124256eec59429121be860d18cedf6f6ad Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 24 Jul 2024 06:33:06 -0400 Subject: [PATCH 007/121] Deprecates chifra daemon --scrape and chifra daemon --monitor --- docs | 2 +- sdk/scrape.go | 8 ++- sdk/scrape_internal.go | 11 +++- src/apps/chifra/cmd/daemon.go | 22 +++++--- src/apps/chifra/internal/daemon/README.md | 3 + src/apps/chifra/internal/daemon/options.go | 55 +++++++++++++------ src/apps/chifra/internal/slurp/options.go | 4 +- .../goMaker/templates/cmd-line-options.csv | 6 +- src/dev_tools/goMaker/types/types_command.go | 46 ++++++++++++++-- tests | 2 +- 10 files changed, 117 insertions(+), 42 deletions(-) diff --git a/docs b/docs index d03ccbf22b..d13492470e 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit d03ccbf22b4245a5e7acc26180354754ccb5925e +Subproject commit d13492470ebf03dec4fa477844bdd9af49b94654 diff --git a/sdk/scrape.go b/sdk/scrape.go index 3425d33457..a4b23ac9b6 100644 --- a/sdk/scrape.go +++ b/sdk/scrape.go @@ -9,8 +9,12 @@ package sdk import ( -// EXISTING_CODE -// EXISTING_CODE + // EXISTING_CODE + "encoding/json" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + // EXISTING_CODE ) type ScrapeOptions struct { diff --git a/sdk/scrape_internal.go b/sdk/scrape_internal.go index e4e3734c88..cb0a6538f5 100644 --- a/sdk/scrape_internal.go +++ b/sdk/scrape_internal.go @@ -9,8 +9,15 @@ package sdk import ( -// EXISTING_CODE -// EXISTING_CODE + // EXISTING_CODE + "encoding/json" + "fmt" + "io" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + scrape "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/sdk" + // EXISTING_CODE ) type scrapeOptionsInternal struct { diff --git a/src/apps/chifra/cmd/daemon.go b/src/apps/chifra/cmd/daemon.go index 27a131430b..c0f221fc0e 100644 --- a/src/apps/chifra/cmd/daemon.go +++ b/src/apps/chifra/cmd/daemon.go @@ -46,7 +46,10 @@ Notes: - To start API open terminal window and run chifra daemon. - See the API documentation (https://trueblocks.io/api) for more information. - The --port option is deprecated, use --url instead. - - The --grpc option is deprecated, there is no replacement.` + - The --grpc option is deprecated, there is no replacement. + - The --api option is deprecated, there is no replacement. + - The --scrape option is deprecated, use chifra scrape instead. + - The --monitor option is deprecated, use chifra monitors --watch instead.` func init() { var capabilities caps.Capability // capabilities for chifra daemon @@ -58,23 +61,26 @@ func init() { daemonCmd.Flags().SortFlags = false daemonCmd.Flags().StringVarP(&daemonPkg.GetOptions().Url, "url", "u", "localhost:8080", `specify the API server's url and optionally its port`) - daemonCmd.Flags().StringVarP(&daemonPkg.GetOptions().Api, "api", "a", "on", `instruct the node to start the API server (hidden) -One of [ off | on ]`) - daemonCmd.Flags().StringVarP(&daemonPkg.GetOptions().Scrape, "scrape", "s", "", `start the scraper, initialize it with either just blooms or entire index, generate for new blocks (hidden) -One of [ off | blooms | index ]`) - daemonCmd.Flags().BoolVarP(&daemonPkg.GetOptions().Monitor, "monitor", "m", false, `instruct the node to start the monitors tool (hidden)`) daemonCmd.Flags().BoolVarP(&daemonPkg.GetOptions().Silent, "silent", "", false, `disable logging (for use in SDK for example)`) daemonCmd.Flags().StringVarP(&daemonPkg.GetOptions().Port, "port", "p", ":8080", `deprecated, use --url instead (hidden)`) daemonCmd.Flags().BoolVarP(&daemonPkg.GetOptions().Grpc, "grpc", "g", false, `deprecated, there is no replacement (hidden)`) + daemonCmd.Flags().StringVarP(&daemonPkg.GetOptions().Api, "api", "a", "on", `deprecated, there is no replacement (hidden) +One of [ off | on ]`) + daemonCmd.Flags().StringVarP(&daemonPkg.GetOptions().Scrape, "scrape", "s", "", `deprecated, use chifra scrape instead (hidden) +One of [ off | blooms | index ]`) + daemonCmd.Flags().BoolVarP(&daemonPkg.GetOptions().Monitor, "monitor", "m", false, `deprecated, use chifra monitors --watch instead (hidden)`) if os.Getenv("TEST_MODE") != "true" { + _ = daemonCmd.Flags().MarkHidden("port") + _ = daemonCmd.Flags().MarkHidden("grpc") _ = daemonCmd.Flags().MarkHidden("api") _ = daemonCmd.Flags().MarkHidden("scrape") _ = daemonCmd.Flags().MarkHidden("monitor") - _ = daemonCmd.Flags().MarkHidden("port") - _ = daemonCmd.Flags().MarkHidden("grpc") } _ = daemonCmd.Flags().MarkDeprecated("port", "The --port option has been deprecated.") _ = daemonCmd.Flags().MarkDeprecated("grpc", "The --grpc option has been deprecated.") + _ = daemonCmd.Flags().MarkDeprecated("api", "The --api option has been deprecated.") + _ = daemonCmd.Flags().MarkDeprecated("scrape", "The --scrape option has been deprecated.") + _ = daemonCmd.Flags().MarkDeprecated("monitor", "The --monitor option has been deprecated.") globals.InitGlobals("daemon", daemonCmd, &daemonPkg.GetOptions().Globals, capabilities) daemonCmd.SetUsageTemplate(UsageWithNotes(notesDaemon)) diff --git a/src/apps/chifra/internal/daemon/README.md b/src/apps/chifra/internal/daemon/README.md index ad5344c464..deb1b88a72 100644 --- a/src/apps/chifra/internal/daemon/README.md +++ b/src/apps/chifra/internal/daemon/README.md @@ -37,6 +37,9 @@ Notes: - See the API documentation (https://trueblocks.io/api) for more information. - The --port option is deprecated, use --url instead. - The --grpc option is deprecated, there is no replacement. + - The --api option is deprecated, there is no replacement. + - The --scrape option is deprecated, use chifra scrape instead. + - The --monitor option is deprecated, use chifra monitors --watch instead. ``` Data models produced by this tool: diff --git a/src/apps/chifra/internal/daemon/options.go b/src/apps/chifra/internal/daemon/options.go index b8a2191bb0..ab10039e43 100644 --- a/src/apps/chifra/internal/daemon/options.go +++ b/src/apps/chifra/internal/daemon/options.go @@ -27,12 +27,12 @@ import ( // DaemonOptions provides all command options for the chifra daemon command. type DaemonOptions struct { Url string `json:"url,omitempty"` // Specify the API server's url and optionally its port - Api string `json:"api,omitempty"` // Instruct the node to start the API server - Scrape string `json:"scrape,omitempty"` // Start the scraper, initialize it with either just blooms or entire index, generate for new blocks - Monitor bool `json:"monitor,omitempty"` // Instruct the node to start the monitors tool Silent bool `json:"silent,omitempty"` // Disable logging (for use in SDK for example) Port string `json:"port,omitempty"` // Deprecated, use --url instead Grpc bool `json:"grpc,omitempty"` // Deprecated, there is no replacement + Api string `json:"api,omitempty"` // Deprecated, there is no replacement + Scrape string `json:"scrape,omitempty"` // Deprecated, use chifra scrape instead + Monitor bool `json:"monitor,omitempty"` // Deprecated, use chifra monitors --watch instead Globals globals.GlobalOptions `json:"globals,omitempty"` // The global options Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server BadFlag error `json:"badFlag,omitempty"` // An error flag if needed @@ -42,16 +42,13 @@ type DaemonOptions struct { var defaultDaemonOptions = DaemonOptions{ Url: "localhost:8080", - Api: "on", Port: ":8080", + Api: "on", } // testLog is used only during testing to export the options for this test case. func (opts *DaemonOptions) testLog() { logger.TestLog(len(opts.Url) > 0 && opts.Url != "localhost:8080", "Url: ", opts.Url) - logger.TestLog(len(opts.Api) > 0 && opts.Api != "on", "Api: ", opts.Api) - logger.TestLog(len(opts.Scrape) > 0, "Scrape: ", opts.Scrape) - logger.TestLog(opts.Monitor, "Monitor: ", opts.Monitor) logger.TestLog(opts.Silent, "Silent: ", opts.Silent) opts.Conn.TestLog(opts.getCaches()) opts.Globals.TestLog() @@ -77,24 +74,24 @@ func DaemonFinishParseInternal(w io.Writer, values url.Values) *DaemonOptions { copy.Globals.Caps = getCaps() opts := © opts.Url = "localhost:8080" - opts.Api = "on" opts.Port = ":8080" + opts.Api = "on" for key, value := range values { switch key { case "url": opts.Url = value[0] - case "api": - opts.Api = value[0] - case "scrape": - opts.Scrape = value[0] - case "monitor": - opts.Monitor = true case "silent": opts.Silent = true case "port": opts.Port = value[0] case "grpc": opts.Grpc = true + case "api": + opts.Api = value[0] + case "scrape": + opts.Scrape = value[0] + case "monitor": + opts.Monitor = true default: if !copy.Globals.Caps.HasKey(key) { err := validate.Usage("Invalid key ({0}) in {1} route.", key, "daemon") @@ -106,13 +103,25 @@ func DaemonFinishParseInternal(w io.Writer, values url.Values) *DaemonOptions { } opts.Conn = opts.Globals.FinishParseApi(w, values, opts.getCaches()) - // Deprecated, but still supported + // Deprecated... if opts.Port != ":8080" && opts.Url == "localhost:8080" { logger.Warn("The --port flag is deprecated. Please use --url instead.") opts.Url = opts.Port opts.Port = "" } + // Deprecated... + if opts.Scrape != "" { + logger.Warn("The --scrape flag is deprecated. Please use chifra scrape instead.") + opts.Scrape = "" + } + + // Deprecated... + if opts.Monitor { + logger.Warn("The --monitor flag is deprecated. Please use chifra monitors --watch instead.") + opts.Monitor = false + } + // EXISTING_CODE // EXISTING_CODE @@ -138,13 +147,25 @@ func daemonFinishParse(args []string) *DaemonOptions { opts := GetOptions() opts.Conn = opts.Globals.FinishParse(args, opts.getCaches()) - // Deprecated, but still supported + // Deprecated... if opts.Port != ":8080" && opts.Url == "localhost:8080" { logger.Warn("The --port flag is deprecated. Please use --url instead.") opts.Url = opts.Port opts.Port = "" } + // Deprecated... + if opts.Scrape != "" { + logger.Warn("The --scrape flag is deprecated. Please use chifra scrape instead.") + opts.Scrape = "" + } + + // Deprecated... + if opts.Monitor { + logger.Warn("The --monitor flag is deprecated. Please use chifra monitors --watch instead.") + opts.Monitor = false + } + // EXISTING_CODE // EXISTING_CODE if len(opts.Globals.Format) == 0 || opts.Globals.Format == "none" { @@ -180,8 +201,8 @@ func ResetOptions(testMode bool) { opts.Globals.Writer = w opts.Globals.Caps = getCaps() opts.Url = "localhost:8080" - opts.Api = "on" opts.Port = ":8080" + opts.Api = "on" defaultDaemonOptions = opts } diff --git a/src/apps/chifra/internal/slurp/options.go b/src/apps/chifra/internal/slurp/options.go index 9fa855f93c..82024d24ee 100644 --- a/src/apps/chifra/internal/slurp/options.go +++ b/src/apps/chifra/internal/slurp/options.go @@ -144,7 +144,7 @@ func SlurpFinishParseInternal(w io.Writer, values url.Values) *SlurpOptions { } opts.Conn = opts.Globals.FinishParseApi(w, values, opts.getCaches()) - // Deprecated, but still supported + // Deprecated... if len(opts.Types) > 0 && len(opts.Parts) == 0 { logger.Warn("The --types flag is deprecated. Please use --parts instead.") opts.Parts = opts.Types @@ -186,7 +186,7 @@ func slurpFinishParse(args []string) *SlurpOptions { opts := GetOptions() opts.Conn = opts.Globals.FinishParse(args, opts.getCaches()) - // Deprecated, but still supported + // Deprecated... if len(opts.Types) > 0 && len(opts.Parts) == 0 { logger.Warn("The --types flag is deprecated. Please use --parts instead.") opts.Parts = opts.Types diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index 11a0e05c6c..34ef7d0169 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -246,12 +246,12 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty # 44000,apps,Admin,daemon,flame,,,,visible|docs|notApi,,command,,,Start the Api server,[flags],verbose|version|noop|noColor|,Initialize and control long-running processes such as the API and the scrapers. 44020,apps,Admin,daemon,flame,url,u,localhost:8080,visible|docs,,flag,,,,,,specify the API server's url and optionally its port -44030,apps,Admin,daemon,flame,api,a,on,,,flag,enum[off|on*]>,,,,,instruct the node to start the API server -44040,apps,Admin,daemon,flame,scrape,s,,,,flag,enum[off|blooms|index]>,,,,,start the scraper, initialize it with either just blooms or entire index, generate for new blocks -44050,apps,Admin,daemon,flame,monitor,m,,,,switch,,,,,,instruct the node to start the monitors tool 44070,apps,Admin,daemon,flame,silent,,,visible|docs,,switch,,,,,,disable logging (for use in SDK for example) 44070,apps,Admin,daemon,flame,port,p,:8080,deprecated=url,,flag,,,,,,deprecated 44060,apps,Admin,daemon,flame,grpc,g,,deprecated=,,switch,,,,,,run gRPC server to serve names +44030,apps,Admin,daemon,flame,api,a,on,deprecated=,,flag,enum[off|on*]>,,,,,instruct the node to start the API server +44040,apps,Admin,daemon,flame,scrape,s,,deprecated=chifra scrape,,flag,enum[off|blooms|index]>,,,,,start the scraper, initialize it with either just blooms or entire index, generate for new blocks +44050,apps,Admin,daemon,flame,monitor,m,,deprecated=chifra monitors --watch,,switch,,,,,,instruct the node to start the monitors tool 44080,apps,Admin,daemon,flame,n1,,,,,note,,,,,,To start API open terminal window and run chifra daemon. 44090,apps,Admin,daemon,flame,n2,,,,,note,,,,,,See the API documentation (https://trueblocks.io/api) for more information. 44100,apps,Admin,daemon,flame,a1,,,,,alias,,,,,,serve diff --git a/src/dev_tools/goMaker/types/types_command.go b/src/dev_tools/goMaker/types/types_command.go index 1dfbec4fbd..719ff9b060 100644 --- a/src/dev_tools/goMaker/types/types_command.go +++ b/src/dev_tools/goMaker/types/types_command.go @@ -162,7 +162,11 @@ func (c *Command) Clean() { for index, op := range cleaned { if op.IsDeprecated() { parts := strings.Split(op.Attributes, "=") - msg := "deprecated, use --" + parts[1] + " instead" + msg := "deprecated, use " + if !strings.Contains(parts[1], "chifra") { + msg += "--" + } + msg += parts[1] + " instead" if len(parts[1]) == 0 { msg = "deprecated, there is no replacement" } @@ -1040,16 +1044,32 @@ func (op *Option) FindDeprecator() *Option { } } + if strings.Contains(parts[1], "chifra") { + op := Option{ + LongName: parts[1], + } + return &op + } + logger.Fatal(fmt.Sprintf("Deprecator (%s) not found for: %s", parts[1], op.LongName)) return nil } +func (op *Option) DeprecatorRep() string { + dep := op.Deprecator() + if strings.Contains(dep, "chifra") { + return dep + } else { + return "--" + dep + } +} + func (op *Option) Deprecator() string { - ret := op.FindDeprecator() - if ret == nil { + dep := op.FindDeprecator() + if dep == nil { return "" } - return ret.LongName + return dep.LongName } func (op *Option) DeprecatorIsDefault() string { @@ -1067,12 +1087,17 @@ func (op *Option) DeprecatedNotDefault() string { if op.IsArray() { return "len(opts." + op.GoName + ") > 0" } + if op.IsBool() { + return "opts." + op.GoName + } return "opts." + op.GoName + " != \"" + op.DefVal + "\"" } func (op *Option) Clear() string { if op.IsArray() { return "[]string{}" + } else if op.IsBool() { + return "false" } return "\"\"" } @@ -1083,13 +1108,22 @@ func (c *Command) DeprecatedTransfer() string { if op.IsDeprecated() { if op.FindDeprecator() != nil { tmplName := "deprecatedTransfer" - tmpl := ` // Deprecated, but still supported + tmpl := ` // Deprecated... if {{.DeprecatedNotDefault}} && {{.DeprecatorIsDefault}} { - logger.Warn("The --{{.LongName}} flag is deprecated. Please use --{{.Deprecator}} instead.") + logger.Warn("The --{{.LongName}} flag is deprecated. Please use {{.DeprecatorRep}} instead.") opts.{{firstUpper .Deprecator}} = opts.{{.GoName}} opts.{{.GoName}} = {{.Clear}} } ` + if strings.Contains(op.Deprecator(), "chifra") { + tmplName = "deprecatedTransfer2" + tmpl = ` // Deprecated... + if {{.DeprecatedNotDefault}} { + logger.Warn("The --{{.LongName}} flag is deprecated. Please use {{.DeprecatorRep}} instead.") + opts.{{.GoName}} = {{.Clear}} + } +` + } ret = append(ret, op.executeTemplate(tmplName, tmpl)) } } diff --git a/tests b/tests index 20f267f4c9..2f502e19c9 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 20f267f4c98a8439c618e7c3fd175a83c970ef73 +Subproject commit 2f502e19c9d8fe08de5e876203843e0ef10345d2 From 963dc9f05f5a64b854f5aa371d3ede7ae4d771ce Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 27 Jul 2024 17:27:23 -0400 Subject: [PATCH 008/121] A few small cleanups to start --- .../chifra/internal/chunks/handle_diff.go | 2 +- src/apps/chifra/pkg/colors/colors.go | 20 ++++++++++++ .../types/{modeler.go => types_modeler.go} | 0 src/apps/chifra/pkg/walk/walker.go | 11 ++++++- src/dev_tools/goMaker/main.go | 5 +-- src/dev_tools/goMaker/main_test.go | 2 +- .../goMaker/types/process_codebase.go | 22 ------------- .../goMaker/types/process_codebase_group.go | 31 +++++++++++++++++++ 8 files changed, 64 insertions(+), 29 deletions(-) rename src/apps/chifra/pkg/types/{modeler.go => types_modeler.go} (100%) create mode 100644 src/dev_tools/goMaker/types/process_codebase_group.go diff --git a/src/apps/chifra/internal/chunks/handle_diff.go b/src/apps/chifra/internal/chunks/handle_diff.go index dc92811b4b..aeb84c229f 100644 --- a/src/apps/chifra/internal/chunks/handle_diff.go +++ b/src/apps/chifra/internal/chunks/handle_diff.go @@ -203,7 +203,7 @@ func findFileByBlockNumber(chain, path string, bn base.Blknum) (fileName string, return true, nil // continue walking }, ) - return fileName, walker.WalkRegularFolder(path, []base.Blknum{bn}) + return fileName, walker.WalkRegularFolder(path) } func (opts *ChunksOptions) getParams(chain, path string) (string, string, base.RangeDiff) { diff --git a/src/apps/chifra/pkg/colors/colors.go b/src/apps/chifra/pkg/colors/colors.go index 6da3cd6d6c..64ac4f8eee 100644 --- a/src/apps/chifra/pkg/colors/colors.go +++ b/src/apps/chifra/pkg/colors/colors.go @@ -92,3 +92,23 @@ func ColoredWith(s string, c string) string { s += Off return s } + +var ColorMap = map[string]string{ + "off": Off, + "red": Red, + "green": Green, + "yellow": Yellow, + "blue": Blue, + "magenta": Magenta, + "cyan": Cyan, + "white": White, + "black": Black, + "brightred": BrightRed, + "brightgreen": BrightGreen, + "brightyellow": BrightYellow, + "brightblue": BrightBlue, + "brightmagenta": BrightMagenta, + "brightcyan": BrightCyan, + "brightwhite": BrightWhite, + "brightblack": BrightBlack, +} diff --git a/src/apps/chifra/pkg/types/modeler.go b/src/apps/chifra/pkg/types/types_modeler.go similarity index 100% rename from src/apps/chifra/pkg/types/modeler.go rename to src/apps/chifra/pkg/types/types_modeler.go diff --git a/src/apps/chifra/pkg/walk/walker.go b/src/apps/chifra/pkg/walk/walker.go index de69f59bd6..b3a0675ca2 100644 --- a/src/apps/chifra/pkg/walk/walker.go +++ b/src/apps/chifra/pkg/walk/walker.go @@ -8,6 +8,7 @@ import ( ) type walkerFunc func(walker *CacheWalker, path string, first bool) (bool, error) +type ForEveryFunc func(path string, vP any) (bool, error) type CacheWalker struct { chain string @@ -29,7 +30,15 @@ func (walker *CacheWalker) MaxTests() int { return walker.maxTests } -func (walker *CacheWalker) WalkRegularFolder(path string, blockNums []base.Blknum) error { +func ForEveryFileInFolder(path string, forEvery ForEveryFunc, vP any) error { + visitFunc := func(walker *CacheWalker, path string, first bool) (bool, error) { + return forEvery(path, vP) + } + walker := NewCacheWalker("", false, int(base.NOPOSI), visitFunc) + return walker.WalkRegularFolder(path) +} + +func (walker *CacheWalker) WalkRegularFolder(path string) error { filenameChan := make(chan CacheFileInfo) var nRoutines int = 1 diff --git a/src/dev_tools/goMaker/main.go b/src/dev_tools/goMaker/main.go index c416d196d9..6ad7117fb9 100644 --- a/src/dev_tools/goMaker/main.go +++ b/src/dev_tools/goMaker/main.go @@ -1,8 +1,6 @@ package main import ( - "os" - "github.com/TrueBlocks/trueblocks-core/goMaker/types" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" ) @@ -10,8 +8,7 @@ import ( func main() { codeBase, err := types.LoadCodebase() if err != nil { - logger.Error(err) - os.Exit(1) + logger.Fatal(err) } codeBase.Generate(cbTemplates) diff --git a/src/dev_tools/goMaker/main_test.go b/src/dev_tools/goMaker/main_test.go index 830f36a2ee..7b727df9a7 100644 --- a/src/dev_tools/goMaker/main_test.go +++ b/src/dev_tools/goMaker/main_test.go @@ -6,6 +6,6 @@ import ( ) func TestMainFunction(t *testing.T) { - os.Chdir("/Users/jrush/Development/trueblocks-core") + os.Chdir("/Users/jrush/Development/trueblocks-dalledress") main() } diff --git a/src/dev_tools/goMaker/types/process_codebase.go b/src/dev_tools/goMaker/types/process_codebase.go index 968d980c8b..0a53601adc 100644 --- a/src/dev_tools/goMaker/types/process_codebase.go +++ b/src/dev_tools/goMaker/types/process_codebase.go @@ -3,7 +3,6 @@ package types import ( "os" "path/filepath" - "strings" "github.com/TrueBlocks/trueblocks-core/goMaker/codeWriter" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" @@ -25,24 +24,3 @@ func (cb *CodeBase) ProcessFile(source string) error { _, err := codeWriter.WriteCode(convertToDestPath(source, "", "", "", ""), result) return err } - -// ProcessGroupFile processes a single file, applying the template to it and -// writing the result to the destination. -func (cb *CodeBase) ProcessGroupFile(source, reason, group string) error { - cwd, _ := os.Getwd() - source = filepath.Join(cwd, templateFolder, source) - if ok, err := shouldProcess(source, "codebase"); err != nil { - return err - } else if !ok { - return nil - } - - tmpl := file.AsciiFileToString(source) - dest := convertToDestPath(source, "", "", group, reason) - tmpl = strings.ReplaceAll(tmpl, "[{GROUP}]", group) - tmpl = strings.ReplaceAll(tmpl, "[{REASON}]", reason) - // fmt.Println(reason, group, tmpl) - result := cb.executeTemplate(source+group+reason, tmpl) - _, err := codeWriter.WriteCode(dest, result) - return err -} diff --git a/src/dev_tools/goMaker/types/process_codebase_group.go b/src/dev_tools/goMaker/types/process_codebase_group.go new file mode 100644 index 0000000000..0b452977e0 --- /dev/null +++ b/src/dev_tools/goMaker/types/process_codebase_group.go @@ -0,0 +1,31 @@ +package types + +import ( + "os" + "path/filepath" + "strings" + + "github.com/TrueBlocks/trueblocks-core/goMaker/codeWriter" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" +) + +// ProcessGroupFile processes a single file, applying the template to it and +// writing the result to the destination. +func (cb *CodeBase) ProcessGroupFile(source, reason, group string) error { + cwd, _ := os.Getwd() + source = filepath.Join(cwd, templateFolder, source) + if ok, err := shouldProcess(source, "codebase"); err != nil { + return err + } else if !ok { + return nil + } + + tmpl := file.AsciiFileToString(source) + dest := convertToDestPath(source, "", "", group, reason) + tmpl = strings.ReplaceAll(tmpl, "[{GROUP}]", group) + tmpl = strings.ReplaceAll(tmpl, "[{REASON}]", reason) + // fmt.Println(reason, group, tmpl) + result := cb.executeTemplate(source+group+reason, tmpl) + _, err := codeWriter.WriteCode(dest, result) + return err +} From 184fe9b608b0e1925ca70300e145aff72e2e7242 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 27 Jul 2024 17:46:39 -0400 Subject: [PATCH 009/121] Small change to chifra scrape command line options --- sdk/scrape.go | 2 +- sdk/scrape_internal.go | 2 +- src/apps/chifra/cmd/scrape.go | 2 +- src/apps/chifra/internal/scrape/options.go | 8 ++++---- src/dev_tools/goMaker/main.go | 2 +- src/dev_tools/goMaker/templates/cmd-line-options.csv | 10 +++++----- ...=> src_apps_chifra_pkg_types_types+modeler.go.tmpl} | 0 tests | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) rename src/dev_tools/goMaker/templates/{src_apps_chifra_pkg_types_modeler.go.tmpl => src_apps_chifra_pkg_types_types+modeler.go.tmpl} (100%) diff --git a/sdk/scrape.go b/sdk/scrape.go index a4b23ac9b6..44a6fe382a 100644 --- a/sdk/scrape.go +++ b/sdk/scrape.go @@ -20,9 +20,9 @@ import ( type ScrapeOptions struct { BlockCnt uint64 `json:"blockCnt,omitempty"` Sleep float64 `json:"sleep,omitempty"` + Publisher base.Address `json:"publisher,omitempty"` Touch base.Blknum `json:"touch,omitempty"` RunCount uint64 `json:"runCount,omitempty"` - Publisher base.Address `json:"publisher,omitempty"` DryRun bool `json:"dryRun,omitempty"` Notify bool `json:"notify,omitempty"` RenderCtx *output.RenderCtx `json:"-"` diff --git a/sdk/scrape_internal.go b/sdk/scrape_internal.go index cb0a6538f5..3236195a25 100644 --- a/sdk/scrape_internal.go +++ b/sdk/scrape_internal.go @@ -23,9 +23,9 @@ import ( type scrapeOptionsInternal struct { BlockCnt uint64 `json:"blockCnt,omitempty"` Sleep float64 `json:"sleep,omitempty"` + Publisher base.Address `json:"publisher,omitempty"` Touch base.Blknum `json:"touch,omitempty"` RunCount uint64 `json:"runCount,omitempty"` - Publisher base.Address `json:"publisher,omitempty"` DryRun bool `json:"dryRun,omitempty"` Notify bool `json:"notify,omitempty"` RenderCtx *output.RenderCtx `json:"-"` diff --git a/src/apps/chifra/cmd/scrape.go b/src/apps/chifra/cmd/scrape.go index 3c0685ed9c..fa744ffa01 100644 --- a/src/apps/chifra/cmd/scrape.go +++ b/src/apps/chifra/cmd/scrape.go @@ -59,9 +59,9 @@ func init() { scrapeCmd.Flags().Uint64VarP(&scrapePkg.GetOptions().BlockCnt, "block_cnt", "n", 2000, `maximum number of blocks to process per pass`) scrapeCmd.Flags().Float64VarP(&scrapePkg.GetOptions().Sleep, "sleep", "s", 14, `seconds to sleep between scraper passes`) + scrapeCmd.Flags().StringVarP(&scrapePkg.GetOptions().Publisher, "publisher", "P", "", `for some query options, the publisher of the index (hidden)`) scrapeCmd.Flags().Uint64VarP((*uint64)(&scrapePkg.GetOptions().Touch), "touch", "l", 0, `first block to visit when scraping (snapped back to most recent snap_to_grid mark)`) scrapeCmd.Flags().Uint64VarP(&scrapePkg.GetOptions().RunCount, "run_count", "u", 0, `run the scraper this many times, then quit`) - scrapeCmd.Flags().StringVarP(&scrapePkg.GetOptions().Publisher, "publisher", "P", "", `for some query options, the publisher of the index (hidden)`) scrapeCmd.Flags().BoolVarP(&scrapePkg.GetOptions().DryRun, "dry_run", "d", false, `show the configuration that would be applied if run,no changes are made`) scrapeCmd.Flags().BoolVarP(&scrapePkg.GetOptions().Notify, "notify", "o", false, `enable the notify feature`) scrapeCmd.Flags().Uint64VarP(&scrapePkg.GetOptions().Settings.AppsPerChunk, "apps_per_chunk", "", 2000000, `the number of appearances to build into a chunk before consolidating it (hidden)`) diff --git a/src/apps/chifra/internal/scrape/options.go b/src/apps/chifra/internal/scrape/options.go index f71db65548..478f482479 100644 --- a/src/apps/chifra/internal/scrape/options.go +++ b/src/apps/chifra/internal/scrape/options.go @@ -36,9 +36,9 @@ import ( type ScrapeOptions struct { BlockCnt uint64 `json:"blockCnt,omitempty"` // Maximum number of blocks to process per pass Sleep float64 `json:"sleep,omitempty"` // Seconds to sleep between scraper passes + Publisher string `json:"publisher,omitempty"` // For some query options, the publisher of the index Touch base.Blknum `json:"touch,omitempty"` // First block to visit when scraping (snapped back to most recent snap_to_grid mark) RunCount uint64 `json:"runCount,omitempty"` // Run the scraper this many times, then quit - Publisher string `json:"publisher,omitempty"` // For some query options, the publisher of the index DryRun bool `json:"dryRun,omitempty"` // Show the configuration that would be applied if run,no changes are made Notify bool `json:"notify,omitempty"` // Enable the notify feature Settings config.ScrapeSettings `json:"settings,omitempty"` // Configuration items for the scrape @@ -59,9 +59,9 @@ var defaultScrapeOptions = ScrapeOptions{ func (opts *ScrapeOptions) testLog() { logger.TestLog(opts.BlockCnt != 2000, "BlockCnt: ", opts.BlockCnt) logger.TestLog(opts.Sleep != float64(14), "Sleep: ", opts.Sleep) + logger.TestLog(len(opts.Publisher) > 0, "Publisher: ", opts.Publisher) logger.TestLog(opts.Touch != 0, "Touch: ", opts.Touch) logger.TestLog(opts.RunCount != 0, "RunCount: ", opts.RunCount) - logger.TestLog(len(opts.Publisher) > 0, "Publisher: ", opts.Publisher) logger.TestLog(opts.DryRun, "DryRun: ", opts.DryRun) logger.TestLog(opts.Notify, "Notify: ", opts.Notify) opts.Settings.TestLog(opts.Globals.Chain, opts.Globals.TestMode) @@ -102,12 +102,12 @@ func ScrapeFinishParseInternal(w io.Writer, values url.Values) *ScrapeOptions { opts.BlockCnt = base.MustParseUint64(value[0]) case "sleep": opts.Sleep = base.MustParseFloat64(value[0]) + case "publisher": + opts.Publisher = value[0] case "touch": opts.Touch = base.MustParseBlknum(value[0]) case "runCount": opts.RunCount = base.MustParseUint64(value[0]) - case "publisher": - opts.Publisher = value[0] case "dryRun": opts.DryRun = true case "notify": diff --git a/src/dev_tools/goMaker/main.go b/src/dev_tools/goMaker/main.go index 6ad7117fb9..e75c7d03e0 100644 --- a/src/dev_tools/goMaker/main.go +++ b/src/dev_tools/goMaker/main.go @@ -25,7 +25,7 @@ var cbTemplates = []types.Generator{ "docs_content_api_openapi.yaml.tmpl", "src_dev+tools_goMaker_generated_readme+chifra.md.tmpl", // "src_dev+tools_goMaker_generated_handlers.csv.tmpl", - "src_apps_chifra_pkg_types_modeler.go.tmpl", + "src_apps_chifra_pkg_types_types+modeler.go.tmpl", }, }, { diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index 34ef7d0169..4ebd709c08 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -257,13 +257,13 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 44100,apps,Admin,daemon,flame,a1,,,,,alias,,,,,,serve # 45000,apps,Admin,scrape,blockScrape,,,,visible|docs|notApi,,command,,,Scrape index,[flags],verbose|version|noop|noColor|chain|,Scan the chain and update the TrueBlocks index of appearances. -45020,apps,Admin,scrape,blockScrape,block_cnt,n,2000,visible|docs,2,flag,,,,,,maximum number of blocks to process per pass -45030,apps,Admin,scrape,blockScrape,sleep,s,14,visible|docs,,flag,,,,,,seconds to sleep between scraper passes +45010,apps,Admin,scrape,blockScrape,block_cnt,n,2000,visible|docs,2,flag,,,,,,maximum number of blocks to process per pass +45020,apps,Admin,scrape,blockScrape,sleep,s,14,visible|docs,,flag,,,,,,seconds to sleep between scraper passes +45030,apps,Admin,scrape,blockScrape,publisher,P,,,,flag,
,,,,,for some query options, the publisher of the index 45040,apps,Admin,scrape,blockScrape,touch,l,,visible|docs,1,flag,,,,,,first block to visit when scraping (snapped back to most recent snap_to_grid mark) 45050,apps,Admin,scrape,blockScrape,run_count,u,,visible|docs,,flag,,,,,,run the scraper this many times, then quit -45060,apps,Admin,scrape,blockScrape,publisher,P,,,,flag,
,,,,,for some query options, the publisher of the index -45070,apps,Admin,scrape,blockScrape,dry_run,d,,visible|docs,,switch,,,,,,show the configuration that would be applied if run,no changes are made -45075,apps,Admin,scrape,blockScrape,notify,o,,visible|docs,,switch,,,,,,enable the notify feature +45060,apps,Admin,scrape,blockScrape,dry_run,d,,visible|docs,,switch,,,,,,show the configuration that would be applied if run,no changes are made +45070,apps,Admin,scrape,blockScrape,notify,o,,visible|docs,,switch,,,,,,enable the notify feature 45080,apps,Admin,scrape,blockScrape,apps_per_chunk,,2000000,config,,flag,,,,,,the number of appearances to build into a chunk before consolidating it 45090,apps,Admin,scrape,blockScrape,snap_to_grid,,250000,config,,flag,,,,,,an override to apps_per_chunk to snap-to-grid at every modulo of this value, this allows easier corrections to the index 45100,apps,Admin,scrape,blockScrape,first_snap,,2000000,config,,flag,,,,,,the first block at which snap_to_grid is enabled diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_pkg_types_modeler.go.tmpl b/src/dev_tools/goMaker/templates/src_apps_chifra_pkg_types_types+modeler.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_pkg_types_modeler.go.tmpl rename to src/dev_tools/goMaker/templates/src_apps_chifra_pkg_types_types+modeler.go.tmpl diff --git a/tests b/tests index 2f502e19c9..d7ab08be5d 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 2f502e19c9d8fe08de5e876203843e0ef10345d2 +Subproject commit d7ab08be5d562177bbf7a74bba721ae782679002 From 9f3f55865dc824d8e2070d4faf6722a0f63d0c2d Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 27 Jul 2024 18:19:26 -0400 Subject: [PATCH 010/121] Changes where "generators" are stored to make using goMaker elsewhere easier. --- src/apps/chifra/internal/daemon/routes.go | 76 ++++++++-------- src/dev_tools/goMaker/main.go | 50 +---------- .../docs_content_api_openapi.yaml.tmpl | 0 .../src_apps_chifra_cmd_helpfile.go.tmpl | 0 ...apps_chifra_internal_daemon_routes.go.tmpl | 0 ...src_apps_chifra_pkg_types_modeler.go.tmpl} | 0 ...src_apps_chifra_pkg_version_string.go.tmpl | 0 ...ls_goMaker_generated_readme+chifra.md.tmpl | 0 .../groups}/docs_content_reason_group.md.tmpl | 0 .../routes}/sdk_python_src_+route.py.tmpl | 0 .../routes}/sdk_route+internal.go.tmpl | 0 .../{ => generators/routes}/sdk_route.go.tmpl | 0 .../sdk_typescript_src_paths_route.ts.tmpl | 0 .../routes}/src_apps_chifra_cmd_route.go.tmpl | 0 ..._apps_chifra_internal_route_README.md.tmpl | 0 ...src_apps_chifra_internal_route_doc.go.tmpl | 0 ...apps_chifra_internal_route_options.go.tmpl | 0 ..._apps_chifra_internal_route_output.go.tmpl | 0 .../routes}/src_apps_chifra_sdk_route.go.tmpl | 0 ...ols_goMaker_generated_readme+route.md.tmpl | 0 .../src_dev+tools_sdkFuzzer_route.go.tmpl | 0 .../sdk_typescript_src_types_type.ts.tmpl | 0 .../src_apps_chifra_pkg_types_type.go.tmpl | 0 ...tools_goMaker_generated_model+type.md.tmpl | 0 ...+tools_goMaker_generated_handlers.csv.tmpl | 1 - src/dev_tools/goMaker/types/generate.go | 87 +++++++++++++++---- src/dev_tools/goMaker/types/load.go | 72 +++++++-------- .../goMaker/types/process_codebase.go | 18 ++-- .../goMaker/types/process_codebase_group.go | 21 +++-- .../goMaker/types/process_command.go | 18 ++-- .../goMaker/types/process_structure.go | 36 +++----- src/dev_tools/goMaker/types/types_codebase.go | 4 +- src/dev_tools/goMaker/types/types_command.go | 53 +++++------ .../goMaker/types/types_structure.go | 11 ++- src/dev_tools/goMaker/types/utils.go | 70 +++++++++++++-- 35 files changed, 292 insertions(+), 225 deletions(-) rename src/dev_tools/goMaker/templates/{ => generators/codebase}/docs_content_api_openapi.yaml.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/codebase}/src_apps_chifra_cmd_helpfile.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/codebase}/src_apps_chifra_internal_daemon_routes.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{src_apps_chifra_pkg_types_types+modeler.go.tmpl => generators/codebase/src_apps_chifra_pkg_types_modeler.go.tmpl} (100%) rename src/dev_tools/goMaker/templates/{ => generators/codebase}/src_apps_chifra_pkg_version_string.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/codebase}/src_dev+tools_goMaker_generated_readme+chifra.md.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/groups}/docs_content_reason_group.md.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/sdk_python_src_+route.py.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/sdk_route+internal.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/sdk_route.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/sdk_typescript_src_paths_route.ts.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/src_apps_chifra_cmd_route.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/src_apps_chifra_internal_route_README.md.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/src_apps_chifra_internal_route_doc.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/src_apps_chifra_internal_route_options.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/src_apps_chifra_internal_route_output.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/src_apps_chifra_sdk_route.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/src_dev+tools_goMaker_generated_readme+route.md.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/routes}/src_dev+tools_sdkFuzzer_route.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/types}/sdk_typescript_src_types_type.ts.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/types}/src_apps_chifra_pkg_types_type.go.tmpl (100%) rename src/dev_tools/goMaker/templates/{ => generators/types}/src_dev+tools_goMaker_generated_model+type.md.tmpl (100%) delete mode 100644 src/dev_tools/goMaker/templates/src_dev+tools_goMaker_generated_handlers.csv.tmpl diff --git a/src/apps/chifra/internal/daemon/routes.go b/src/apps/chifra/internal/daemon/routes.go index 6623831740..150b77b466 100644 --- a/src/apps/chifra/internal/daemon/routes.go +++ b/src/apps/chifra/internal/daemon/routes.go @@ -46,43 +46,43 @@ type Route struct { } var routes = []Route{ - {"RouteAbis", "GET", "/abis", func(w http.ResponseWriter, r *http.Request) { - if err := abisPkg.ServeAbis(w, r); err != nil { + {"RouteList", "GET", "/list", func(w http.ResponseWriter, r *http.Request) { + if err := listPkg.ServeList(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteBlocks", "GET", "/blocks", func(w http.ResponseWriter, r *http.Request) { - if err := blocksPkg.ServeBlocks(w, r); err != nil { + {"RouteExport", "GET", "/export", func(w http.ResponseWriter, r *http.Request) { + if err := exportPkg.ServeExport(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteChunks", "GET", "/chunks", func(w http.ResponseWriter, r *http.Request) { - if err := chunksPkg.ServeChunks(w, r); err != nil { + {"RouteMonitors", "GET", "/monitors", func(w http.ResponseWriter, r *http.Request) { + if err := monitorsPkg.ServeMonitors(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteConfig", "GET", "/config", func(w http.ResponseWriter, r *http.Request) { - if err := configPkg.ServeConfig(w, r); err != nil { + {"RouteNames", "GET", "/names", func(w http.ResponseWriter, r *http.Request) { + if err := namesPkg.ServeNames(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteExplore", "GET", "/explore", func(w http.ResponseWriter, r *http.Request) { - if err := explorePkg.ServeExplore(w, r); err != nil { + {"RouteAbis", "GET", "/abis", func(w http.ResponseWriter, r *http.Request) { + if err := abisPkg.ServeAbis(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteExport", "GET", "/export", func(w http.ResponseWriter, r *http.Request) { - if err := exportPkg.ServeExport(w, r); err != nil { + {"RouteBlocks", "GET", "/blocks", func(w http.ResponseWriter, r *http.Request) { + if err := blocksPkg.ServeBlocks(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteInit", "GET", "/init", func(w http.ResponseWriter, r *http.Request) { - if err := initPkg.ServeInit(w, r); err != nil { + {"RouteTransactions", "GET", "/transactions", func(w http.ResponseWriter, r *http.Request) { + if err := transactionsPkg.ServeTransactions(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteList", "GET", "/list", func(w http.ResponseWriter, r *http.Request) { - if err := listPkg.ServeList(w, r); err != nil { + {"RouteReceipts", "GET", "/receipts", func(w http.ResponseWriter, r *http.Request) { + if err := receiptsPkg.ServeReceipts(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, @@ -91,58 +91,58 @@ var routes = []Route{ RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteMonitors", "GET", "/monitors", func(w http.ResponseWriter, r *http.Request) { - if err := monitorsPkg.ServeMonitors(w, r); err != nil { + {"RouteTraces", "GET", "/traces", func(w http.ResponseWriter, r *http.Request) { + if err := tracesPkg.ServeTraces(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteNames", "GET", "/names", func(w http.ResponseWriter, r *http.Request) { - if err := namesPkg.ServeNames(w, r); err != nil { + {"RouteWhen", "GET", "/when", func(w http.ResponseWriter, r *http.Request) { + if err := whenPkg.ServeWhen(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteReceipts", "GET", "/receipts", func(w http.ResponseWriter, r *http.Request) { - if err := receiptsPkg.ServeReceipts(w, r); err != nil { + {"RouteState", "GET", "/state", func(w http.ResponseWriter, r *http.Request) { + if err := statePkg.ServeState(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteScrape", "GET", "/scrape", func(w http.ResponseWriter, r *http.Request) { - if err := scrapePkg.ServeScrape(w, r); err != nil { + {"RouteTokens", "GET", "/tokens", func(w http.ResponseWriter, r *http.Request) { + if err := tokensPkg.ServeTokens(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteSlurp", "GET", "/slurp", func(w http.ResponseWriter, r *http.Request) { - if err := slurpPkg.ServeSlurp(w, r); err != nil { + {"RouteConfig", "GET", "/config", func(w http.ResponseWriter, r *http.Request) { + if err := configPkg.ServeConfig(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteState", "GET", "/state", func(w http.ResponseWriter, r *http.Request) { - if err := statePkg.ServeState(w, r); err != nil { + {"RouteStatus", "GET", "/status", func(w http.ResponseWriter, r *http.Request) { + if err := statusPkg.ServeStatus(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteStatus", "GET", "/status", func(w http.ResponseWriter, r *http.Request) { - if err := statusPkg.ServeStatus(w, r); err != nil { + {"RouteScrape", "GET", "/scrape", func(w http.ResponseWriter, r *http.Request) { + if err := scrapePkg.ServeScrape(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteTokens", "GET", "/tokens", func(w http.ResponseWriter, r *http.Request) { - if err := tokensPkg.ServeTokens(w, r); err != nil { + {"RouteChunks", "GET", "/chunks", func(w http.ResponseWriter, r *http.Request) { + if err := chunksPkg.ServeChunks(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteTraces", "GET", "/traces", func(w http.ResponseWriter, r *http.Request) { - if err := tracesPkg.ServeTraces(w, r); err != nil { + {"RouteInit", "GET", "/init", func(w http.ResponseWriter, r *http.Request) { + if err := initPkg.ServeInit(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteTransactions", "GET", "/transactions", func(w http.ResponseWriter, r *http.Request) { - if err := transactionsPkg.ServeTransactions(w, r); err != nil { + {"RouteExplore", "GET", "/explore", func(w http.ResponseWriter, r *http.Request) { + if err := explorePkg.ServeExplore(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, - {"RouteWhen", "GET", "/when", func(w http.ResponseWriter, r *http.Request) { - if err := whenPkg.ServeWhen(w, r); err != nil { + {"RouteSlurp", "GET", "/slurp", func(w http.ResponseWriter, r *http.Request) { + if err := slurpPkg.ServeSlurp(w, r); err != nil { RespondWithError(w, http.StatusInternalServerError, err) } }}, diff --git a/src/dev_tools/goMaker/main.go b/src/dev_tools/goMaker/main.go index e75c7d03e0..a688e41ded 100644 --- a/src/dev_tools/goMaker/main.go +++ b/src/dev_tools/goMaker/main.go @@ -10,53 +10,5 @@ func main() { if err != nil { logger.Fatal(err) } - - codeBase.Generate(cbTemplates) -} - -// generators are the templates for the codebase -var cbTemplates = []types.Generator{ - { - Against: "codebase", - Templates: []string{ - "src_apps_chifra_internal_daemon_routes.go.tmpl", - "src_apps_chifra_cmd_helpfile.go.tmpl", - "src_apps_chifra_pkg_version_string.go.tmpl", - "docs_content_api_openapi.yaml.tmpl", - "src_dev+tools_goMaker_generated_readme+chifra.md.tmpl", - // "src_dev+tools_goMaker_generated_handlers.csv.tmpl", - "src_apps_chifra_pkg_types_types+modeler.go.tmpl", - }, - }, - { - Against: "routes", - Templates: []string{ - "src_dev+tools_goMaker_generated_readme+route.md.tmpl", - "sdk_route.go.tmpl", - "sdk_route+internal.go.tmpl", - "sdk_python_src_+route.py.tmpl", - "sdk_typescript_src_paths_route.ts.tmpl", - "src_apps_chifra_cmd_route.go.tmpl", - "src_apps_chifra_internal_route_output.go.tmpl", - "src_apps_chifra_internal_route_options.go.tmpl", - "src_apps_chifra_internal_route_doc.go.tmpl", - "src_apps_chifra_internal_route_README.md.tmpl", - "src_apps_chifra_sdk_route.go.tmpl", - "src_dev+tools_sdkFuzzer_route.go.tmpl", - }, - }, - { - Against: "types", - Templates: []string{ - "src_dev+tools_goMaker_generated_model+type.md.tmpl", - "sdk_typescript_src_types_type.ts.tmpl", - "src_apps_chifra_pkg_types_type.go.tmpl", - }, - }, - { - Against: "groups", - Templates: []string{ - "docs_content_reason_group.md.tmpl", - }, - }, + codeBase.Generate() } diff --git a/src/dev_tools/goMaker/templates/docs_content_api_openapi.yaml.tmpl b/src/dev_tools/goMaker/templates/generators/codebase/docs_content_api_openapi.yaml.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/docs_content_api_openapi.yaml.tmpl rename to src/dev_tools/goMaker/templates/generators/codebase/docs_content_api_openapi.yaml.tmpl diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_cmd_helpfile.go.tmpl b/src/dev_tools/goMaker/templates/generators/codebase/src_apps_chifra_cmd_helpfile.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_cmd_helpfile.go.tmpl rename to src/dev_tools/goMaker/templates/generators/codebase/src_apps_chifra_cmd_helpfile.go.tmpl diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_internal_daemon_routes.go.tmpl b/src/dev_tools/goMaker/templates/generators/codebase/src_apps_chifra_internal_daemon_routes.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_internal_daemon_routes.go.tmpl rename to src/dev_tools/goMaker/templates/generators/codebase/src_apps_chifra_internal_daemon_routes.go.tmpl diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_pkg_types_types+modeler.go.tmpl b/src/dev_tools/goMaker/templates/generators/codebase/src_apps_chifra_pkg_types_modeler.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_pkg_types_types+modeler.go.tmpl rename to src/dev_tools/goMaker/templates/generators/codebase/src_apps_chifra_pkg_types_modeler.go.tmpl diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_pkg_version_string.go.tmpl b/src/dev_tools/goMaker/templates/generators/codebase/src_apps_chifra_pkg_version_string.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_pkg_version_string.go.tmpl rename to src/dev_tools/goMaker/templates/generators/codebase/src_apps_chifra_pkg_version_string.go.tmpl diff --git a/src/dev_tools/goMaker/templates/src_dev+tools_goMaker_generated_readme+chifra.md.tmpl b/src/dev_tools/goMaker/templates/generators/codebase/src_dev+tools_goMaker_generated_readme+chifra.md.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_dev+tools_goMaker_generated_readme+chifra.md.tmpl rename to src/dev_tools/goMaker/templates/generators/codebase/src_dev+tools_goMaker_generated_readme+chifra.md.tmpl diff --git a/src/dev_tools/goMaker/templates/docs_content_reason_group.md.tmpl b/src/dev_tools/goMaker/templates/generators/groups/docs_content_reason_group.md.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/docs_content_reason_group.md.tmpl rename to src/dev_tools/goMaker/templates/generators/groups/docs_content_reason_group.md.tmpl diff --git a/src/dev_tools/goMaker/templates/sdk_python_src_+route.py.tmpl b/src/dev_tools/goMaker/templates/generators/routes/sdk_python_src_+route.py.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/sdk_python_src_+route.py.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/sdk_python_src_+route.py.tmpl diff --git a/src/dev_tools/goMaker/templates/sdk_route+internal.go.tmpl b/src/dev_tools/goMaker/templates/generators/routes/sdk_route+internal.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/sdk_route+internal.go.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/sdk_route+internal.go.tmpl diff --git a/src/dev_tools/goMaker/templates/sdk_route.go.tmpl b/src/dev_tools/goMaker/templates/generators/routes/sdk_route.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/sdk_route.go.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/sdk_route.go.tmpl diff --git a/src/dev_tools/goMaker/templates/sdk_typescript_src_paths_route.ts.tmpl b/src/dev_tools/goMaker/templates/generators/routes/sdk_typescript_src_paths_route.ts.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/sdk_typescript_src_paths_route.ts.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/sdk_typescript_src_paths_route.ts.tmpl diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_cmd_route.go.tmpl b/src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_cmd_route.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_cmd_route.go.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_cmd_route.go.tmpl diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_README.md.tmpl b/src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_internal_route_README.md.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_README.md.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_internal_route_README.md.tmpl diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_doc.go.tmpl b/src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_internal_route_doc.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_doc.go.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_internal_route_doc.go.tmpl diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_options.go.tmpl b/src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_internal_route_options.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_options.go.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_internal_route_options.go.tmpl diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_output.go.tmpl b/src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_internal_route_output.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_internal_route_output.go.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_internal_route_output.go.tmpl diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_sdk_route.go.tmpl b/src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_sdk_route.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_sdk_route.go.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/src_apps_chifra_sdk_route.go.tmpl diff --git a/src/dev_tools/goMaker/templates/src_dev+tools_goMaker_generated_readme+route.md.tmpl b/src/dev_tools/goMaker/templates/generators/routes/src_dev+tools_goMaker_generated_readme+route.md.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_dev+tools_goMaker_generated_readme+route.md.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/src_dev+tools_goMaker_generated_readme+route.md.tmpl diff --git a/src/dev_tools/goMaker/templates/src_dev+tools_sdkFuzzer_route.go.tmpl b/src/dev_tools/goMaker/templates/generators/routes/src_dev+tools_sdkFuzzer_route.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_dev+tools_sdkFuzzer_route.go.tmpl rename to src/dev_tools/goMaker/templates/generators/routes/src_dev+tools_sdkFuzzer_route.go.tmpl diff --git a/src/dev_tools/goMaker/templates/sdk_typescript_src_types_type.ts.tmpl b/src/dev_tools/goMaker/templates/generators/types/sdk_typescript_src_types_type.ts.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/sdk_typescript_src_types_type.ts.tmpl rename to src/dev_tools/goMaker/templates/generators/types/sdk_typescript_src_types_type.ts.tmpl diff --git a/src/dev_tools/goMaker/templates/src_apps_chifra_pkg_types_type.go.tmpl b/src/dev_tools/goMaker/templates/generators/types/src_apps_chifra_pkg_types_type.go.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_apps_chifra_pkg_types_type.go.tmpl rename to src/dev_tools/goMaker/templates/generators/types/src_apps_chifra_pkg_types_type.go.tmpl diff --git a/src/dev_tools/goMaker/templates/src_dev+tools_goMaker_generated_model+type.md.tmpl b/src/dev_tools/goMaker/templates/generators/types/src_dev+tools_goMaker_generated_model+type.md.tmpl similarity index 100% rename from src/dev_tools/goMaker/templates/src_dev+tools_goMaker_generated_model+type.md.tmpl rename to src/dev_tools/goMaker/templates/generators/types/src_dev+tools_goMaker_generated_model+type.md.tmpl diff --git a/src/dev_tools/goMaker/templates/src_dev+tools_goMaker_generated_handlers.csv.tmpl b/src/dev_tools/goMaker/templates/src_dev+tools_goMaker_generated_handlers.csv.tmpl deleted file mode 100644 index 980ed1522e..0000000000 --- a/src/dev_tools/goMaker/templates/src_dev+tools_goMaker_generated_handlers.csv.tmpl +++ /dev/null @@ -1 +0,0 @@ -{{.Handlers}} diff --git a/src/dev_tools/goMaker/types/generate.go b/src/dev_tools/goMaker/types/generate.go index f0469c4a4b..d15fd72257 100644 --- a/src/dev_tools/goMaker/types/generate.go +++ b/src/dev_tools/goMaker/types/generate.go @@ -1,59 +1,72 @@ package types import ( + "path/filepath" "sort" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/colors" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" ) type Generator struct { - Against string - Templates []string + Against string `json:"against"` + Templates []string `json:"templates"` } // Generate generates the code for the codebase using the given templates. -func (cb *CodeBase) Generate(generators []Generator) { - for _, gen := range generators { - switch gen.Against { +func (cb *CodeBase) Generate() { + generatedPath := GetGeneratedPath() + file.EstablishFolder(generatedPath) + + generators, err := getGenerators() + if err != nil { + logger.Fatal(err) + } + + for _, generator := range generators { + switch generator.Against { case "codebase": - for _, source := range gen.Templates { - if err := cb.ProcessFile(source); err != nil { + for _, source := range generator.Templates { + if err := cb.ProcessFile(source, "", ""); err != nil { logger.Fatal(err) } } case "groups": - for _, source := range gen.Templates { + for _, source := range generator.Templates { for _, group := range cb.GroupList("") { - if err := cb.ProcessGroupFile(source, "readme", group.GroupName()); err != nil { + if err := cb.ProcessGroupFile(source, group.GroupName(), "readme"); err != nil { logger.Fatal(err) } } } - for _, source := range gen.Templates { + for _, source := range generator.Templates { for _, group := range cb.GroupList("") { - if err := cb.ProcessGroupFile(source, "model", group.GroupName()); err != nil { + if err := cb.ProcessGroupFile(source, group.GroupName(), "model"); err != nil { logger.Fatal(err) } } } case "routes": - for _, source := range gen.Templates { + for _, source := range generator.Templates { for _, c := range cb.Commands { - if err := c.ProcessFile(source); err != nil { + if err := c.ProcessFile(source, "", ""); err != nil { logger.Fatal(err) } } } case "types": - for _, source := range gen.Templates { + for _, source := range generator.Templates { for _, s := range cb.Structures { sort.Slice(s.Members, func(i, j int) bool { return s.Members[i].SortName() < s.Members[j].SortName() }) - if err := s.ProcessFile(source); err != nil { - logger.Fatal(err) + if !s.DisableGo { + if err := s.ProcessFile(source, "", ""); err != nil { + logger.Fatal(err) + } } } } @@ -61,3 +74,45 @@ func (cb *CodeBase) Generate(generators []Generator) { } logger.Info(colors.Green + "Done..." + strings.Repeat(" ", 120) + colors.Off + "\033[K") } + +// getGenerators returns the generators we will be using +func getGenerators() ([]Generator, error) { + thePath, err := getTemplatesPath() + if err != nil { + return []Generator{}, err + } + generatorsPath := filepath.Join(thePath, "generators/") + "/" + + theMap := make(map[string][]string) + vFunc := func(file string, vP any) (bool, error) { + if strings.HasSuffix(file, ".tmpl") { + file = strings.ReplaceAll(file, generatorsPath, "") + if strings.Contains(file, "/") { + parts := strings.Split(file, "/") + theMap[parts[0]] = append(theMap[parts[0]], file) + } + } + return true, nil + } + + walk.ForEveryFileInFolder(generatorsPath, vFunc, nil) + + ret := []Generator{} + for against, templates := range theMap { + g := Generator{ + Against: against, + } + sort.Strings(templates) + for _, template := range templates { + template = strings.ReplaceAll(template, g.Against+"/", "") + g.Templates = append(g.Templates, template) + } + ret = append(ret, g) + } + sort.Slice(ret, func(i, j int) bool { + sort.Strings(ret[i].Templates) + return ret[i].Against < ret[j].Against + }) + + return ret, nil +} diff --git a/src/dev_tools/goMaker/types/load.go b/src/dev_tools/goMaker/types/load.go index d9ca7a6b04..e9f709eed7 100644 --- a/src/dev_tools/goMaker/types/load.go +++ b/src/dev_tools/goMaker/types/load.go @@ -4,7 +4,6 @@ import ( "fmt" "io/fs" "os" - "path" "path/filepath" "sort" "strings" @@ -16,66 +15,54 @@ import ( // LoadCodebase loads the two csv files and returns the codebase which // contains all the commands (each with its own set of options). func LoadCodebase() (CodeBase, error) { - if !checkRootDirectory() { - return CodeBase{}, fmt.Errorf("this program must be run from the ./trueblocks-core folder") - } - - thePath := "src/dev_tools/goMaker/templates/" - if !file.FolderExists(thePath) { - return CodeBase{}, fmt.Errorf("the path %s does not exist", thePath) + thePath, err := getTemplatesPath() + if err != nil { + return CodeBase{}, err } - baseTypes, err := LoadCsv[Structure, any](thePath+"base-types.csv", readStructure, nil) + baseTypes, err := LoadCsv[Structure, any](filepath.Join(thePath, "base-types.csv"), readStructure, nil) if err != nil { return CodeBase{}, err } var cb CodeBase - options, err := LoadCsv[Option, any](thePath+"cmd-line-options.csv", readCmdOption, nil) + options, err := LoadCsv[Option, any](filepath.Join(thePath, "cmd-line-options.csv"), readCmdOption, nil) if err != nil { return cb, err } - dupMap := make(map[string]bool, len(options)) - for _, op := range options { - key := op.Route + ":" + op.LongName - if len(key) > 1 && dupMap[key] { - return cb, fmt.Errorf("duplicate option %s", key) - } - dupMap[key] = true + err = checkForDups(options) + if err != nil { + return cb, err } structMap := make(map[string]Structure) - err = cb.LoadStructures(thePath+"classDefinitions/", readStructure, structMap) + err = cb.LoadStructures(filepath.Join(thePath, "classDefinitions/"), readStructure, structMap) if err != nil { return cb, err } - err = cb.LoadMembers(thePath+"classDefinitions/", structMap) + err = cb.LoadMembers(filepath.Join(thePath, "classDefinitions/"), structMap) if err != nil { return cb, err } - err = cb.FinishLoad(baseTypes, options, structMap) + err = cb.FinishLoad(thePath, baseTypes, options, structMap) if err != nil { return cb, err } - if len(cb.Commands) == 0 { - return cb, fmt.Errorf("no commands were found in %s", thePath) - } - - if len(cb.Structures) == 0 { - return cb, fmt.Errorf("no structures were found in %s", thePath) - } - return cb, nil } -func checkRootDirectory() bool { - cwd, _ := os.Getwd() - test := path.Join(cwd, "src/apps/chifra") - _, err := os.Stat(test) - return err == nil +func readStructure(st *Structure, data *any) (bool, error) { + st.DocDescr = strings.ReplaceAll(st.DocDescr, ",", ",") + st.ProducedBy = strings.Replace(st.ProducedBy, " ", "", -1) + st.Producers = strings.Split(st.ProducedBy, ",") + st.Class = strings.Trim(st.Class, " ") + st.DocGroup = strings.Trim(st.DocGroup, " ") + st.DocDescr = strings.Trim(st.DocDescr, " ") + st.DocNotes = strings.Trim(st.DocNotes, " ") + return true, nil } func (cb *CodeBase) LoadStructures(thePath string, callBack func(*Structure, *any) (bool, error), structMap map[string]Structure) error { @@ -155,7 +142,7 @@ func (cb *CodeBase) LoadMembers(thePath string, structMap map[string]Structure) return nil } -func (cb *CodeBase) FinishLoad(baseTypes []Structure, options []Option, structMap map[string]Structure) error { +func (cb *CodeBase) FinishLoad(thePath string, baseTypes []Structure, options []Option, structMap map[string]Structure) error { cb.BaseTypes = baseTypes for i := 0; i < len(cb.BaseTypes); i++ { cb.BaseTypes[i].cbPtr = cb @@ -295,8 +282,9 @@ func (cb *CodeBase) FinishLoad(baseTypes []Structure, options []Option, structMa return err } - current := file.AsciiFileToString("src/dev_tools/goMaker/generated/codebase.json") - file.StringToAsciiFile("src/dev_tools/goMaker/generated/codebase.json", cb.String()) + codeBase := filepath.Join(GetGeneratedPath(), "codebase.json") + current := file.AsciiFileToString(codeBase) + file.StringToAsciiFile(codeBase, cb.String()) if current == cb.String() { return nil } @@ -307,3 +295,15 @@ func (cb *CodeBase) FinishLoad(baseTypes []Structure, options []Option, structMa return fmt.Errorf("quitting: codebase.json has changed. Rerun the command to ignore this warning") } + +func checkForDups(options []Option) error { + dupMap := make(map[string]bool, len(options)) + for _, op := range options { + key := op.Route + ":" + op.LongName + if len(key) > 1 && dupMap[key] { + return fmt.Errorf("duplicate option %s", key) + } + dupMap[key] = true + } + return nil +} diff --git a/src/dev_tools/goMaker/types/process_codebase.go b/src/dev_tools/goMaker/types/process_codebase.go index 0a53601adc..de0e94afa9 100644 --- a/src/dev_tools/goMaker/types/process_codebase.go +++ b/src/dev_tools/goMaker/types/process_codebase.go @@ -5,22 +5,26 @@ import ( "path/filepath" "github.com/TrueBlocks/trueblocks-core/goMaker/codeWriter" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" ) // ProcessFile processes a single file, applying the template to it and // writing the result to the destination. -func (cb *CodeBase) ProcessFile(source string) error { +func (item *CodeBase) ProcessFile(source, group, reason string) error { cwd, _ := os.Getwd() - source = filepath.Join(cwd, templateFolder, source) - if ok, err := shouldProcess(source, "codebase"); err != nil { + fullPath := filepath.Join(cwd, GetTemplatePath(), source) + subPath := "codebase" + if ok, err := shouldProcess(fullPath, subPath, "codebase"); err != nil { return err } else if !ok { return nil } - tmpl := file.AsciiFileToString(source) - result := cb.executeTemplate(source, tmpl) - _, err := codeWriter.WriteCode(convertToDestPath(source, "", "", "", ""), result) + tmpl := getGeneratorContents(fullPath, subPath, group, reason) + dest := convertToDestPath(fullPath, "", "", group, reason) + + tmplName := fullPath + group + reason + result := item.executeTemplate(tmplName, tmpl) + _, err := codeWriter.WriteCode(dest, result) + return err } diff --git a/src/dev_tools/goMaker/types/process_codebase_group.go b/src/dev_tools/goMaker/types/process_codebase_group.go index 0b452977e0..a9bc2ffc45 100644 --- a/src/dev_tools/goMaker/types/process_codebase_group.go +++ b/src/dev_tools/goMaker/types/process_codebase_group.go @@ -3,29 +3,28 @@ package types import ( "os" "path/filepath" - "strings" "github.com/TrueBlocks/trueblocks-core/goMaker/codeWriter" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" ) // ProcessGroupFile processes a single file, applying the template to it and // writing the result to the destination. -func (cb *CodeBase) ProcessGroupFile(source, reason, group string) error { +func (item *CodeBase) ProcessGroupFile(source, group, reason string) error { cwd, _ := os.Getwd() - source = filepath.Join(cwd, templateFolder, source) - if ok, err := shouldProcess(source, "codebase"); err != nil { + fullPath := filepath.Join(cwd, GetTemplatePath(), source) + subPath := "groups" + if ok, err := shouldProcess(fullPath, subPath, "codebase"); err != nil { return err } else if !ok { return nil } - tmpl := file.AsciiFileToString(source) - dest := convertToDestPath(source, "", "", group, reason) - tmpl = strings.ReplaceAll(tmpl, "[{GROUP}]", group) - tmpl = strings.ReplaceAll(tmpl, "[{REASON}]", reason) - // fmt.Println(reason, group, tmpl) - result := cb.executeTemplate(source+group+reason, tmpl) + tmpl := getGeneratorContents(fullPath, subPath, group, reason) + dest := convertToDestPath(fullPath, "", "", group, reason) + + tmplName := fullPath + group + reason + result := item.executeTemplate(tmplName, tmpl) _, err := codeWriter.WriteCode(dest, result) + return err } diff --git a/src/dev_tools/goMaker/types/process_command.go b/src/dev_tools/goMaker/types/process_command.go index ed20de17ee..c2341d1ed5 100644 --- a/src/dev_tools/goMaker/types/process_command.go +++ b/src/dev_tools/goMaker/types/process_command.go @@ -5,22 +5,26 @@ import ( "path/filepath" "github.com/TrueBlocks/trueblocks-core/goMaker/codeWriter" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" ) // ProcessFile processes a single file, applying the template to it and // writing the result to the destination. -func (c *Command) ProcessFile(source string) error { +func (item *Command) ProcessFile(source, group, reason string) error { cwd, _ := os.Getwd() - source = filepath.Join(cwd, templateFolder, source) - if ok, err := shouldProcess(source, c.Route); err != nil { + fullPath := filepath.Join(cwd, GetTemplatePath(), source) + subPath := "routes" + if ok, err := shouldProcess(fullPath, subPath, item.Route); err != nil { return err } else if !ok { return nil } - tmpl := file.AsciiFileToString(source) - result := c.executeTemplate(source, tmpl) - _, err := codeWriter.WriteCode(convertToDestPath(source, c.Route, "", "", ""), result) + tmpl := getGeneratorContents(fullPath, subPath, group, reason) + dest := convertToDestPath(fullPath, item.Route, "", group, reason) + + tmplName := fullPath + group + reason + result := item.executeTemplate(tmplName, tmpl) + _, err := codeWriter.WriteCode(dest, result) + return err } diff --git a/src/dev_tools/goMaker/types/process_structure.go b/src/dev_tools/goMaker/types/process_structure.go index be3c53c3d2..5f97033290 100644 --- a/src/dev_tools/goMaker/types/process_structure.go +++ b/src/dev_tools/goMaker/types/process_structure.go @@ -3,40 +3,28 @@ package types import ( "os" "path/filepath" - "strings" "github.com/TrueBlocks/trueblocks-core/goMaker/codeWriter" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" ) -func (s *Structure) ProcessFile(source string) error { - if s.DisableGo { - return nil - } - +// ProcessFile processes a single file, applying the template to it and +// writing the result to the destination. +func (item *Structure) ProcessFile(sourceIn, group, reason string) error { cwd, _ := os.Getwd() - source = filepath.Join(cwd, templateFolder, source) - if ok, err := shouldProcess(source, s.Class); err != nil { + fullPath := filepath.Join(cwd, GetTemplatePath(), sourceIn) + subPath := "types" + if ok, err := shouldProcess(fullPath, subPath, item.Class); err != nil { return err } else if !ok { return nil } - dest := convertToDestPath(source, "", s.Name(), "", "") - tmpl := file.AsciiFileToString(source) - result := s.executeTemplate(source, tmpl) - dest = strings.Replace(dest, "/src/apps/chifra/pkg/types/", "/src/apps/chifra/pkg/types/types_", -1) + tmpl := getGeneratorContents(fullPath, subPath, group, reason) + dest := convertToDestPath(fullPath, "", item.Name(), group, reason) + + tmplName := fullPath + group + reason + result := item.executeTemplate(tmplName, tmpl) _, err := codeWriter.WriteCode(dest, result) - return err -} -func readStructure(st *Structure, data *any) (bool, error) { - st.DocDescr = strings.ReplaceAll(st.DocDescr, ",", ",") - st.ProducedBy = strings.Replace(st.ProducedBy, " ", "", -1) - st.Producers = strings.Split(st.ProducedBy, ",") - st.Class = strings.Trim(st.Class, " ") - st.DocGroup = strings.Trim(st.DocGroup, " ") - st.DocDescr = strings.Trim(st.DocDescr, " ") - st.DocNotes = strings.Trim(st.DocNotes, " ") - return true, nil + return err } diff --git a/src/dev_tools/goMaker/types/types_codebase.go b/src/dev_tools/goMaker/types/types_codebase.go index e789640b1d..2c6503e26c 100644 --- a/src/dev_tools/goMaker/types/types_codebase.go +++ b/src/dev_tools/goMaker/types/types_codebase.go @@ -3,6 +3,7 @@ package types import ( "encoding/json" "fmt" + "path/filepath" "sort" "strings" @@ -36,7 +37,8 @@ func (cb *CodeBase) Version(verbose bool) string { // Description - returns the description of the codebase for the openapi.yaml file func (cb *CodeBase) Description() string { - return strings.Trim(file.AsciiFileToString("src/dev_tools/goMaker/templates/api/description.txt"), ws) + apiPath := filepath.Join(GetTemplatePath(), "api/description.txt") + return strings.Trim(file.AsciiFileToString(apiPath), ws) } // RouteToGroup - returns the group given a route diff --git a/src/dev_tools/goMaker/types/types_command.go b/src/dev_tools/goMaker/types/types_command.go index 719ff9b060..8968f916d0 100644 --- a/src/dev_tools/goMaker/types/types_command.go +++ b/src/dev_tools/goMaker/types/types_command.go @@ -3,6 +3,7 @@ package types import ( "fmt" "os" + "path/filepath" "sort" "strings" @@ -85,7 +86,8 @@ func (c *Command) HasNotes() bool { } func (c *Command) HasExample() bool { - return file.FileExists("./src/dev_tools/goMaker/templates/api/examples/" + c.Route + ".json") + examplePath := filepath.Join(GetTemplatePath(), "api/examples/"+c.Route+".json") + return file.FileExists(examplePath) } func (c *Command) HasHidden() bool { @@ -462,7 +464,7 @@ func (c *Command) TestLogs() string { } func (c *Command) PackageComments() string { - docsPath := "src/dev_tools/goMaker/templates/readme-intros/" + c.Route + ".md" + docsPath := filepath.Join(GetTemplatePath(), "readme-intros/"+c.Route+".md") lines := file.AsciiFileToLines(docsPath) ret := []string{"// " + c.Route + "Pkg implements the chifra " + c.Route + " command.\n//"} @@ -485,7 +487,8 @@ func (c *Command) IsRoute() bool { } func (c *Command) Example() string { - contents := strings.Trim(file.AsciiFileToString("./src/dev_tools/goMaker/templates/api/examples/"+c.Route+".json"), ws) + examplePath := filepath.Join(GetTemplatePath(), "api/examples/"+c.Route+".json") + contents := strings.Trim(file.AsciiFileToString(examplePath), ws) contents = strings.Replace(contents, "\n", "\n ", -1) return strings.Trim(contents, ws) + "\n" } @@ -495,17 +498,20 @@ func (c *Command) ReadmeName() string { } func (c *Command) HelpIntro() string { - thePath := "src/dev_tools/goMaker/templates/readme-intros/" + c.ReadmeName() + readmePath := filepath.Join(GetTemplatePath(), "readme-intros/", c.ReadmeName()) tmplName := "helpIntro" + c.ReadmeName() - tmpl := file.AsciiFileToString(thePath) + tmpl := file.AsciiFileToString(readmePath) + if tmpl == "" { + logger.Fatal("Could not read template file: ", readmePath) + } return strings.Trim(c.executeTemplate(tmplName, tmpl), ws) } func (c *Command) HelpText() string { - thePath := "src/dev_tools/goMaker/generated/" + c.ReadmeName() + ".tmp" - defer os.Remove(thePath) - utils.System("chifra " + c.Route + " --help 2>" + thePath) - helpText := strings.Trim(file.AsciiFileToString(thePath), wss) + readmePath := filepath.Join(GetTemplatePath(), c.ReadmeName()+".tmp") + defer os.Remove(readmePath) + utils.System("chifra " + c.Route + " --help 2>" + readmePath) + helpText := strings.Trim(file.AsciiFileToString(readmePath), wss) if strings.Contains(helpText, "unknown") { logger.Fatal("Error: " + helpText) } @@ -541,19 +547,22 @@ func (c *Command) HelpLinks() string { } func (c *Command) HelpNotes() string { - thePath := "src/dev_tools/goMaker/templates/readme-intros/" + c.ReadmeName() - thePath = strings.Replace(thePath, ".md", ".notes.md", -1) - if file.FileExists(thePath) { + readmePath := filepath.Join(GetTemplatePath(), "readme-intros/"+c.ReadmeName()) + readmePath = strings.Replace(readmePath, ".md", ".notes.md", -1) + if file.FileExists(readmePath) { tmplName := "Notes" + c.ReadmeName() - tmpl := file.AsciiFileToString(thePath) + tmpl := file.AsciiFileToString(readmePath) + if tmpl == "" { + logger.Fatal("Could not read template file: ", readmePath) + } return "\n\n" + strings.Trim(c.executeTemplate(tmplName, tmpl), ws) } return "" } func (c *Command) ReadmeFooter() string { - thePath := "src/dev_tools/goMaker/templates/readme-intros/README.footer.md" - return strings.Trim(file.AsciiFileToString(thePath), ws) + footerFile := filepath.Join(GetTemplatePath(), "readme-intros/README.footer.md") + return strings.Trim(file.AsciiFileToString(footerFile), ws) } func (c *Command) executeTemplate(name, tmplCode string) string { @@ -588,16 +597,8 @@ func (c *Command) GroupAlias(reason string) string { `, "[{GN}]", c.GroupName()) } -func getContents(fnIn string) string { - fn := "./src/dev_tools/goMaker/" + fnIn + ".md" - if !file.FileExists(fn) { - logger.Fatal("Error: file does not exist: " + fn) - } - return file.AsciiFileToString(fn) -} - func (c *Command) GroupIntro(reason string) string { - return getContents("templates/" + reason + "-groups/" + c.GroupName()) + return getTemplateContents(reason + "-groups/" + c.GroupName()) } func (c *Command) GroupMarkdowns(reason, filter string) string { @@ -608,7 +609,7 @@ func (c *Command) GroupMarkdowns(reason, filter string) string { }) for _, st := range c.cbPtr.Structures { if st.GroupName() == filter && st.Name() != "" { - ret = append(ret, getContents("generated/model_"+st.Name())) + ret = append(ret, getGeneratedContents("model_"+st.Name())) } } } else if reason == "readme" { @@ -617,7 +618,7 @@ func (c *Command) GroupMarkdowns(reason, filter string) string { }) for _, cmd := range c.cbPtr.Commands { if cmd.GroupName() == filter && cmd.Route != "" { - ret = append(ret, getContents("generated/readme_"+cmd.Route)) + ret = append(ret, getGeneratedContents("readme_"+cmd.Route)) } } } else { diff --git a/src/dev_tools/goMaker/types/types_structure.go b/src/dev_tools/goMaker/types/types_structure.go index 25f8f7ef00..37773cdc9a 100644 --- a/src/dev_tools/goMaker/types/types_structure.go +++ b/src/dev_tools/goMaker/types/types_structure.go @@ -2,6 +2,7 @@ package types import ( "encoding/json" + "path/filepath" "sort" "strings" @@ -73,8 +74,8 @@ func (s *Structure) IsSimpOnly() bool { } func (s *Structure) HasNotes() bool { - thePath := "src/dev_tools/goMaker/templates/model-intros/" + CamelCase(s.Class) + ".notes.md" - return file.FileExists(thePath) + notePath := filepath.Join(GetTemplatePath(), "model-intros/", CamelCase(s.Class)+".notes.md") + return file.FileExists(notePath) } func (s *Structure) HasTimestamp() bool { @@ -101,7 +102,7 @@ func (s *Structure) GroupName() string { func (s *Structure) ModelIntro() string { tmplName := "modelIntro" + s.Class - tmpl := strings.Trim(getContents("templates/model-intros/"+CamelCase(s.Class)), ws) + tmpl := strings.Trim(getTemplateContents("model-intros/"+CamelCase(s.Class)), ws) return s.executeTemplate(tmplName, tmpl) } @@ -135,7 +136,7 @@ func (s *Structure) ModelMembers() string { func (s *Structure) ModelNotes() string { tmplName := "Notes" + s.Class - tmpl := strings.Trim(getContents("templates/model-intros/"+CamelCase(s.Class)+".notes"), ws) + tmpl := strings.Trim(getTemplateContents("model-intros/"+CamelCase(s.Class)+".notes"), ws) return strings.Trim(s.executeTemplate(tmplName, tmpl), ws) } @@ -158,6 +159,8 @@ func (s *Structure) CacheIdStr() string { return "\"%09d\", s.BlockNumber" case "tx": return "\"%09d-%05d\", s.BlockNumber, s.TransactionIndex" + case "string": + return "\"%0s\", s.GetCacheName()" default: logger.Fatal("Unknown cache by format:", s.CacheBy) return "" diff --git a/src/dev_tools/goMaker/types/utils.go b/src/dev_tools/goMaker/types/utils.go index c015f02d21..c7dd3c7aeb 100644 --- a/src/dev_tools/goMaker/types/utils.go +++ b/src/dev_tools/goMaker/types/utils.go @@ -3,14 +3,16 @@ package types import ( "fmt" "os" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "golang.org/x/text/cases" "golang.org/x/text/language" ) -func shouldProcess(source, tag string) (bool, error) { +func shouldProcess(source, subPath, tag string) (bool, error) { single := os.Getenv("TB_MAKER_SINGLE") if single != "" && !strings.Contains(source, single) { // logger.Warn("skipping ", source, " because of ", single) @@ -38,6 +40,7 @@ func shouldProcess(source, tag string) (bool, error) { } } + source = strings.ReplaceAll(source, "/templates/", "/templates/generators/"+subPath+"/") if !file.FileExists(source) { return false, fmt.Errorf("file does not exist %s", source) } @@ -45,8 +48,20 @@ func shouldProcess(source, tag string) (bool, error) { return true, nil } +func getGeneratorContents(fullPath, subPath, group, reason string) string { + gPath := strings.ReplaceAll(fullPath, "/templates/", "/templates/generators/"+subPath+"/") + if !file.FileExists(gPath) { + logger.Fatal("Could not find generator file: ", gPath) + } + + tmpl := file.AsciiFileToString(gPath) + tmpl = strings.ReplaceAll(tmpl, "[{GROUP}]", group) + tmpl = strings.ReplaceAll(tmpl, "[{REASON}]", reason) + return tmpl +} + func convertToDestPath(source, routeTag, typeTag, groupTag, reason string) string { - dest := strings.ReplaceAll(source, templateFolder, "") + dest := strings.ReplaceAll(source, GetTemplatePath(), "") dest = strings.ReplaceAll(dest, ".tmpl", "") dest = strings.ReplaceAll(dest, "_route_", "/"+routeTag+"/") dest = strings.ReplaceAll(dest, "route+internal", routeTag+"+internal") @@ -65,10 +80,55 @@ func convertToDestPath(source, routeTag, typeTag, groupTag, reason string) strin } dest = strings.ReplaceAll(dest, "_", "/") dest = strings.ReplaceAll(dest, "+", "_") + // Hack alert + dest = strings.ReplaceAll(dest, "/src/apps/chifra/pkg/types/", "/src/apps/chifra/pkg/types/types_") return strings.ReplaceAll(dest, "//", "/") } -var templateFolder = "src/dev_tools/goMaker/templates" +var rootFolder = "src/dev_tools/goMaker/" + +func getRootFolder() string { + return filepath.Join(rootFolder) +} + +func setRootFolder(folder string) { + rootFolder = folder +} + +func getTemplatesPath() (string, error) { + paths := []string{ + "src/dev_tools/goMaker/", + "code_gen/", + } + + for _, path := range paths { + thePath := filepath.Join(path, "templates/") + if file.FolderExists(thePath) { + setRootFolder(path) + return thePath, nil + } + } + + return "", fmt.Errorf("could not find the templates directory") +} + +func GetTemplatePath() string { + return filepath.Join(getRootFolder(), "templates/") +} + +func getTemplateContents(fnIn string) string { + fn := filepath.Join(GetTemplatePath(), fnIn+".md") + return file.AsciiFileToString(fn) +} + +func GetGeneratedPath() string { + return filepath.Join(getRootFolder(), "generated/") +} + +func getGeneratedContents(fnIn string) string { + fn := filepath.Join(GetGeneratedPath(), fnIn+".md") + return file.AsciiFileToString(fn) +} func LowerNoSpaces(s string) string { return strings.ToLower(strings.ReplaceAll(s, " ", "")) @@ -131,8 +191,8 @@ func Proper(s string) string { } func Singular(s string) string { - if s == "Addresses" { - return "Address" + if strings.ToLower(s) == "addresses" { + return s[:len(s)-2] } if s != "Status" && s != "Stats" && strings.HasSuffix(s, "s") { From 0576bf464f0da9b5c0399caaa7787476dafc2364 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 27 Jul 2024 19:16:17 -0400 Subject: [PATCH 011/121] Improving scraper in SDK --- docs | 2 +- sdk/scrape.go | 25 ++++++++++-- sdk/scrape_internal.go | 40 +++++++++++++++++++ src/apps/chifra/internal/scrape/README.md | 1 + .../chifra/internal/scrape/handle_show.go | 23 ++++++++--- .../chifra/internal/scrape/handle_touch.go | 11 +++-- src/apps/chifra/internal/scrape/validate.go | 2 +- .../templates/classDefinitions/message.toml | 2 +- .../goMaker/templates/cmd-line-options.csv | 6 +-- tests | 2 +- 10 files changed, 95 insertions(+), 19 deletions(-) diff --git a/docs b/docs index d13492470e..d5d5267252 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit d13492470ebf03dec4fa477844bdd9af49b94654 +Subproject commit d5d5267252acc06672c8539d767e9096440d9ff0 diff --git a/sdk/scrape.go b/sdk/scrape.go index 44a6fe382a..c2c658bafe 100644 --- a/sdk/scrape.go +++ b/sdk/scrape.go @@ -14,6 +14,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" // EXISTING_CODE ) @@ -21,9 +22,6 @@ type ScrapeOptions struct { BlockCnt uint64 `json:"blockCnt,omitempty"` Sleep float64 `json:"sleep,omitempty"` Publisher base.Address `json:"publisher,omitempty"` - Touch base.Blknum `json:"touch,omitempty"` - RunCount uint64 `json:"runCount,omitempty"` - DryRun bool `json:"dryRun,omitempty"` Notify bool `json:"notify,omitempty"` RenderCtx *output.RenderCtx `json:"-"` Globals @@ -35,6 +33,27 @@ func (opts ScrapeOptions) String() string { return string(bytes) } +// ScrapeTouch implements the chifra scrape --touch command. +func (opts *ScrapeOptions) ScrapeTouch(val base.Blknum) ([]types.Message, *types.MetaData, error) { + in := opts.toInternal() + in.Touch = val + return queryScrape[types.Message](in) +} + +// ScrapeRunCount implements the chifra scrape --runcount command. +func (opts *ScrapeOptions) ScrapeRunCount(val uint64) ([]types.Message, *types.MetaData, error) { + in := opts.toInternal() + in.RunCount = val + return queryScrape[types.Message](in) +} + +// ScrapeDryRun implements the chifra scrape --dryrun command. +func (opts *ScrapeOptions) ScrapeDryRun() ([]types.Message, *types.MetaData, error) { + in := opts.toInternal() + in.DryRun = true + return queryScrape[types.Message](in) +} + // No enums // EXISTING_CODE // EXISTING_CODE diff --git a/sdk/scrape_internal.go b/sdk/scrape_internal.go index 3236195a25..986ec03596 100644 --- a/sdk/scrape_internal.go +++ b/sdk/scrape_internal.go @@ -10,12 +10,14 @@ package sdk import ( // EXISTING_CODE + "bytes" "encoding/json" "fmt" "io" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" scrape "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/sdk" // EXISTING_CODE ) @@ -76,5 +78,43 @@ func GetScrapeOptions(args []string) (*scrapeOptionsInternal, error) { return &opts, nil } +type scrapeGeneric interface { + types.Message +} + +func queryScrape[T scrapeGeneric](opts *scrapeOptionsInternal) ([]T, *types.MetaData, error) { + // EXISTING_CODE + // EXISTING_CODE + + buffer := bytes.Buffer{} + if err := opts.ScrapeBytes(&buffer); err != nil { + return nil, nil, err + } + + str := buffer.String() + // EXISTING_CODE + // EXISTING_CODE + + var result Result[T] + if err := json.Unmarshal([]byte(str), &result); err != nil { + debugPrint(str, result, err) + return nil, nil, err + } else { + return result.Data, &result.Meta, nil + } +} + +// toInternal converts the SDK options to the internal options format. +func (opts *ScrapeOptions) toInternal() *scrapeOptionsInternal { + return &scrapeOptionsInternal{ + BlockCnt: opts.BlockCnt, + Sleep: opts.Sleep, + Publisher: opts.Publisher, + Notify: opts.Notify, + RenderCtx: opts.RenderCtx, + Globals: opts.Globals, + } +} + // EXISTING_CODE // EXISTING_CODE diff --git a/src/apps/chifra/internal/scrape/README.md b/src/apps/chifra/internal/scrape/README.md index 5f7dc0d826..a6517c892b 100644 --- a/src/apps/chifra/internal/scrape/README.md +++ b/src/apps/chifra/internal/scrape/README.md @@ -45,6 +45,7 @@ Data models produced by this tool: - [chunkrecord](/data-model/admin/#chunkrecord) - [manifest](/data-model/admin/#manifest) +- [message](/data-model/other/#message) ### configuration diff --git a/src/apps/chifra/internal/scrape/handle_show.go b/src/apps/chifra/internal/scrape/handle_show.go index 54f72dfbbe..64748bc5fb 100644 --- a/src/apps/chifra/internal/scrape/handle_show.go +++ b/src/apps/chifra/internal/scrape/handle_show.go @@ -18,6 +18,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/sigintTrap" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/tslib" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) // criticalError means that we have to stop scraper @@ -52,12 +53,24 @@ func (opts *ScrapeOptions) HandleScrape(rCtx *output.RenderCtx) error { path = "--unchained-path--" provider = "--rpc-provider--" } - logger.Info("Scraping:") - logger.Info(" RPC: ", provider) - logger.Info(" Path: ", path) - logger.Info(" Settings:", config.GetScrape(chain)) + + msg1 := fmt.Sprintf("Scraping %s", chain) + msg2 := fmt.Sprintf(" Rpc %s", provider) + msg3 := fmt.Sprintf(" Path %s", path) + msg4 := fmt.Sprintf(" Settings %v", config.GetScrape(chain)) + if opts.DryRun { - return nil + opts.Globals.NoHeader = true + fetchData := func(modelChan chan types.Modeler, errorChan chan error) { + nl := "\n" + modelChan <- &types.Message{Msg: msg1 + nl + msg2 + nl + msg3 + nl + msg4} + } + return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) + } else { + logger.Info(msg1) + logger.Info(msg2) + logger.Info(msg3) + logger.Info(msg4) } // Handle Ctr-C, docker stop and docker compose down (provided they diff --git a/src/apps/chifra/internal/scrape/handle_touch.go b/src/apps/chifra/internal/scrape/handle_touch.go index 67c7c4e7fd..18467545c4 100644 --- a/src/apps/chifra/internal/scrape/handle_touch.go +++ b/src/apps/chifra/internal/scrape/handle_touch.go @@ -5,12 +5,15 @@ package scrapePkg import ( - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" + "fmt" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) func (opts *ScrapeOptions) HandleTouch(rCtx *output.RenderCtx) error { - // TODO: implement - logger.Error("chifra scrape --touch is not yet implemented") - return nil + fetchData := func(modelChan chan types.Modeler, errorChan chan error) { + errorChan <- fmt.Errorf("chifra scrape --touch is not yet implemented") + } + return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) } diff --git a/src/apps/chifra/internal/scrape/validate.go b/src/apps/chifra/internal/scrape/validate.go index 228d1b716d..b3cde11f5d 100644 --- a/src/apps/chifra/internal/scrape/validate.go +++ b/src/apps/chifra/internal/scrape/validate.go @@ -41,7 +41,7 @@ func (opts *ScrapeOptions) validateScrape() error { if !config.IpfsRunning() { return validate.Usage("The {0} option requires {1}.", "--notify", "a locally running IPFS daemon") } - } else if !testMode && NotifyConfigured() { + } else if !testMode && NotifyConfigured() && !opts.DryRun { msg := validate.Usage("The notify feature is configured but not running. Enable it with the {0} flag.", "--notify").Error() logger.Warn(msg) } diff --git a/src/dev_tools/goMaker/templates/classDefinitions/message.toml b/src/dev_tools/goMaker/templates/classDefinitions/message.toml index 33dfb5e23c..e345fb1ddd 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/message.toml +++ b/src/dev_tools/goMaker/templates/classDefinitions/message.toml @@ -4,4 +4,4 @@ doc_descr = "used for various responses when no real data is generated" doc_route = "518-message" attributes = "" - produced_by = "blocks, chunks, export, logs, monitors, names, state, traces, transactions, when" + produced_by = "blocks, chunks, export, logs, monitors, names, scrape, state, traces, transactions, when" diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index 4ebd709c08..1dfccc6001 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -260,9 +260,9 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 45010,apps,Admin,scrape,blockScrape,block_cnt,n,2000,visible|docs,2,flag,,,,,,maximum number of blocks to process per pass 45020,apps,Admin,scrape,blockScrape,sleep,s,14,visible|docs,,flag,,,,,,seconds to sleep between scraper passes 45030,apps,Admin,scrape,blockScrape,publisher,P,,,,flag,
,,,,,for some query options, the publisher of the index -45040,apps,Admin,scrape,blockScrape,touch,l,,visible|docs,1,flag,,,,,,first block to visit when scraping (snapped back to most recent snap_to_grid mark) -45050,apps,Admin,scrape,blockScrape,run_count,u,,visible|docs,,flag,,,,,,run the scraper this many times, then quit -45060,apps,Admin,scrape,blockScrape,dry_run,d,,visible|docs,,switch,,,,,,show the configuration that would be applied if run,no changes are made +45040,apps,Admin,scrape,blockScrape,touch,l,,visible|docs,1,flag,,message,,,,first block to visit when scraping (snapped back to most recent snap_to_grid mark) +45050,apps,Admin,scrape,blockScrape,run_count,u,,visible|docs,,flag,,message,,,,run the scraper this many times, then quit +45060,apps,Admin,scrape,blockScrape,dry_run,d,,visible|docs,,switch,,message,,,,show the configuration that would be applied if run,no changes are made 45070,apps,Admin,scrape,blockScrape,notify,o,,visible|docs,,switch,,,,,,enable the notify feature 45080,apps,Admin,scrape,blockScrape,apps_per_chunk,,2000000,config,,flag,,,,,,the number of appearances to build into a chunk before consolidating it 45090,apps,Admin,scrape,blockScrape,snap_to_grid,,250000,config,,flag,,,,,,an override to apps_per_chunk to snap-to-grid at every modulo of this value, this allows easier corrections to the index diff --git a/tests b/tests index d7ab08be5d..1d161e764c 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit d7ab08be5d562177bbf7a74bba721ae782679002 +Subproject commit 1d161e764c7f64acc879246c98ebda1473aeecfa From adc27003ddcd1831e0da6f9aba2f7397bc260061 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 28 Jul 2024 17:53:37 -0400 Subject: [PATCH 012/121] Updates go.mods --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index 5fa100a7c3..6fe256b20f 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index 20c29f0647..e051e57078 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index 7cbc3ed720..f25ebb9ebc 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index d5cbadd4af..66c9aaa281 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 6a366af94b..6c2b7fa181 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index d5cbadd4af..66c9aaa281 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index f8b0606e5d..368103994b 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index d5cbadd4af..66c9aaa281 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index ffc9c9c2df..2746da8164 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index d5cbadd4af..66c9aaa281 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index 38f8921db0..d57e61d4e7 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index 447f56346a..35cb35c439 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index ad0ca53916..b4f76e33ff 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index bb9741c3be..41fde2b04c 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index 32320f6d0b..e4ac25377a 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index 14362d3cfa..44ca297637 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index 8639c5ccef..26cbbff185 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index d5cbadd4af..66c9aaa281 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index cdbc2a9f68..9f3b1999b6 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index d5cbadd4af..66c9aaa281 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0 h1:wWeaGbu8mv+NLwDJ3EKPNpoX4UxYxL8jjtFNQdhP2tg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240718213142-3cffd1bf17f0/go.mod h1:r01Zts5Fl/rEdb5iU94jg5cMu+fPn8msgiAL3u1MIxg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0 h1:HqBhm225mNwEA0kt7zvBtfgVcilmTPZXqCA88v3pRAE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240718213142-3cffd1bf17f0/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From 37d52bff4218cb8255896b579c330a3c17b4b4d0 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 1 Aug 2024 20:36:22 -0400 Subject: [PATCH 013/121] Changes walk.CacheName to walk.WalkCacheName for clarity --- src/apps/chifra/internal/status/handle_modes.go | 2 +- src/apps/chifra/pkg/walk/walk.go | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/apps/chifra/internal/status/handle_modes.go b/src/apps/chifra/internal/status/handle_modes.go index 612297d274..268fb7d61e 100644 --- a/src/apps/chifra/internal/status/handle_modes.go +++ b/src/apps/chifra/internal/status/handle_modes.go @@ -32,7 +32,7 @@ func (opts *StatusOptions) HandleModes(rCtx *output.RenderCtx) error { nRoutines = len(opts.ModeTypes) for _, mT := range opts.ModeTypes { counterMap[mT] = &types.CacheItem{ - CacheItemType: walk.CacheName(mT), + CacheItemType: walk.WalkCacheName(mT), Items: make([]any, 0), LastCached: now.Format("2006-01-02 15:04:05"), } diff --git a/src/apps/chifra/pkg/walk/walk.go b/src/apps/chifra/pkg/walk/walk.go index 7ff0b8755a..25910a1bc0 100644 --- a/src/apps/chifra/pkg/walk/walk.go +++ b/src/apps/chifra/pkg/walk/walk.go @@ -366,7 +366,7 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil "firstApp": cacheInfo.FileRange.First, "firstTs": cacheInfo.TsRange.First, // "indexSizeBytes": file.FileSize(index.ToIndexPath(cacheInfo.Path)), - "itemType": cacheItemName(cT), + "itemType": WalkCacheName(cT) + "Item", "latestApp": cacheInfo.FileRange.Last, "latestTs": cacheInfo.TsRange.Last, }, nil @@ -392,7 +392,7 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil "address": address, "fileDate": date, "filename": display, - "itemType": cacheItemName(cT), + "itemType": WalkCacheName(cT) + "Item", "sizeInBytes": size, } if cT == Cache_Monitors { @@ -406,17 +406,13 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil return map[string]any{ "fileDate": date, "filename": display, - "itemType": cacheItemName(cT), + "itemType": WalkCacheName(cT) + "Item", "sizeInBytes": size, }, nil } } -func cacheItemName(ct CacheType) string { - return CacheName(ct) + "Item" -} - -func CacheName(ct CacheType) string { +func WalkCacheName(ct CacheType) string { // TODO: Names of caches, names of folders, names of commands are all different. This is a mess. ret := CacheTypeToFolder[ct] + "Cache" ret = strings.Replace(ret, "blooms", "bloom", -1) From 0fb2e6ef403acdbfe4652e30a9ff432a7f1d316c Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 1 Aug 2024 20:43:57 -0400 Subject: [PATCH 014/121] Removed unused class attribute simponly --- .../classDefinitions/fields/appearance.csv | 16 ++--- .../templates/classDefinitions/fields/log.csv | 26 ++++----- .../classDefinitions/fields/monitor.csv | 10 ++-- .../classDefinitions/fields/receipt.csv | 30 +++++----- .../classDefinitions/fields/result.csv | 2 +- .../classDefinitions/fields/slurp.csv | 58 +++++++++---------- .../classDefinitions/fields/trace.csv | 30 +++++----- .../classDefinitions/fields/transaction.csv | 56 +++++++++--------- src/dev_tools/goMaker/types/types_member.go | 4 -- .../goMaker/types/types_structure.go | 4 -- 10 files changed, 114 insertions(+), 122 deletions(-) diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/appearance.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/appearance.csv index 8481bca95b..bed4b2d0a6 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/appearance.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/appearance.csv @@ -1,8 +1,8 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -address ,address , , , 1 ,the address of the appearance -blockNumber ,uint32 , , , 2 ,the number of the block -transactionIndex ,uint32 , , , 3 ,the index of the transaction in the block -traceIndex ,uint32 , ,omitempty|simponly , 4 ,the zero-based index of the trace in the transaction -reason ,string , ,omitempty|simponly , 5 ,the location in the data where the appearance was found -timestamp ,timestamp , ,simponly , 6 ,the timestamp for this appearance -date ,datetime , ,calc|simponly , 7 ,the timestamp as a date +name ,type ,strDefault ,attributes ,docOrder ,description +address ,address , , , 1 ,the address of the appearance +blockNumber ,uint32 , , , 2 ,the number of the block +transactionIndex ,uint32 , , , 3 ,the index of the transaction in the block +traceIndex ,uint32 , ,omitempty , 4 ,the zero-based index of the trace in the transaction +reason ,string , ,omitempty , 5 ,the location in the data where the appearance was found +timestamp ,timestamp , , , 6 ,the timestamp for this appearance +date ,datetime , ,calc , 7 ,the timestamp as a date diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/log.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/log.csv index c946a69fee..84c066d609 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/log.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/log.csv @@ -1,13 +1,13 @@ -name ,type ,strDefault ,attributes ,upgrades ,docOrder ,description -blockNumber ,blknum , , , , 1 ,the number of the block -transactionIndex ,txnum , , , , 2 ,the zero-indexed position of the transaction in the block -logIndex ,lognum , , , , 3 ,the zero-indexed position of this log relative to the block -timestamp ,timestamp , ,omitempty|simponly , , 4 ,the timestamp of the block this log appears in -date ,datetime , ,calc , , 5 ,the timestamp as a date -address ,address , , , , 6 ,the smart contract that emitted this log -topics ,[]topic , ,omitempty , , 7 ,the first topic hashes event signature of the log, up to 3 additional index parameters may appear -data ,bytes , ,omitempty , , 8 ,any remaining un-indexed parameters to the event -transactionHash ,hash , , , , 9 ,the hash of the transction -blockHash ,hash , , , , 10 ,the hash of the block -articulatedLog ,*Function , ,omitempty|simponly , , 11 ,a human-readable version of the topic and data fields -compressedLog ,string , ,calc ,2.5.10:string , 12 ,a truncated, more readable version of the articulation +name ,type ,strDefault ,attributes ,upgrades ,docOrder ,description +blockNumber ,blknum , , , , 1 ,the number of the block +transactionIndex ,txnum , , , , 2 ,the zero-indexed position of the transaction in the block +logIndex ,lognum , , , , 3 ,the zero-indexed position of this log relative to the block +timestamp ,timestamp , ,omitempty , , 4 ,the timestamp of the block this log appears in +date ,datetime , ,calc , , 5 ,the timestamp as a date +address ,address , , , , 6 ,the smart contract that emitted this log +topics ,[]topic , ,omitempty , , 7 ,the first topic hashes event signature of the log, up to 3 additional index parameters may appear +data ,bytes , ,omitempty , , 8 ,any remaining un-indexed parameters to the event +transactionHash ,hash , , , , 9 ,the hash of the transction +blockHash ,hash , , , , 10 ,the hash of the block +articulatedLog ,*Function , ,omitempty , , 11 ,a human-readable version of the topic and data fields +compressedLog ,string , ,calc ,2.5.10:string , 12 ,a truncated, more readable version of the articulation diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv index f3b69de17e..1b8a77f2a5 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv @@ -1,6 +1,6 @@ name ,type ,strDefault ,attributes ,docOrder ,description -address ,address , ,simponly , 1 ,the address of this monitor -deleted ,bool , ,simponly , 5 ,`true` if this monitor has been deleted -fileSize ,int64 , ,simponly , 3 ,the size of this monitor on disc -lastScanned ,uint32 , ,simponly , 4 ,the last scanned block number -nRecords ,int64 , ,simponly , 2 ,the number of appearances for this monitor +address ,address , , , 1 ,the address of this monitor +deleted ,bool , , , 5 ,`true` if this monitor has been deleted +fileSize ,int64 , , , 3 ,the size of this monitor on disc +lastScanned ,uint32 , , , 4 ,the last scanned block number +nRecords ,int64 , , , 2 ,the number of appearances for this monitor diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/receipt.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/receipt.csv index f83c7f8af7..4d56f73b5d 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/receipt.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/receipt.csv @@ -1,15 +1,15 @@ -name ,type ,strDefault ,attributes ,upgrades ,docOrder ,description -blockHash ,hash , ,omitempty , , 1 , -blockNumber ,blknum , , , , 2 , -contractAddress ,address , ,omitempty , , 3 ,the address of the newly created contract, if any -cumulativeGasUsed ,gas , ,omitempty ,2.5.8:string , , -from ,address , ,omitempty , , , -gasUsed ,gas , , , , 4 ,the amount of gas actually used by the transaction -effectiveGasPrice ,gas , ,omitempty , , , -isError ,bool , ,omitempty|simponly , , 5 , -logs ,[]Log , , , , 6 ,a possibly empty array of logs -logsBloom ,string , ,omitempty|removed , , , -status ,value , , ,2.5.9:uint32 , 7 ,`1` on transaction suceess, `null` if tx preceeds Byzantium, `0` otherwise -to ,address , ,omitempty , , , -transactionHash ,hash , , , , 8 , -transactionIndex ,txnum , , , , 9 , +name ,type ,strDefault ,attributes ,upgrades ,docOrder ,description +blockHash ,hash , ,omitempty , , 1 , +blockNumber ,blknum , , , , 2 , +contractAddress ,address , ,omitempty , , 3 ,the address of the newly created contract, if any +cumulativeGasUsed ,gas , ,omitempty ,2.5.8:string , , +from ,address , ,omitempty , , , +gasUsed ,gas , , , , 4 ,the amount of gas actually used by the transaction +effectiveGasPrice ,gas , ,omitempty , , , +isError ,bool , ,omitempty , , 5 , +logs ,[]Log , , , , 6 ,a possibly empty array of logs +logsBloom ,string , ,omitempty|removed , , , +status ,value , , ,2.5.9:uint32 , 7 ,`1` on transaction suceess, `null` if tx preceeds Byzantium, `0` otherwise +to ,address , ,omitempty , , , +transactionHash ,hash , , , , 8 , +transactionIndex ,txnum , , , , 9 , diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/result.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/result.csv index bc1244daf8..3ed5e972be 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/result.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/result.csv @@ -7,4 +7,4 @@ name ,string , , , 5 ,the name of the f encoding ,string , , , 6 ,the encoding for the function call signature ,string , , , 7 ,the canonical signature of the interface encodedArguments ,string , , , 8 ,the bytes data following the encoding of the call -articulatedOut ,*Function , ,simponly , 9 ,the result of the call articulated as other models +articulatedOut ,*Function , , , 9 ,the result of the call articulated as other models diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/slurp.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/slurp.csv index 62a3ff09d8..640a0dc66f 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/slurp.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/slurp.csv @@ -1,29 +1,29 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -hash ,hash , , , 1 ,the hash of the transaction -blockHash ,hash , , , 2 ,the hash of the block containing this transaction -blockNumber ,blknum , , , 3 ,the number of the block -transactionIndex ,txnum , , , 4 ,the zero-indexed position of the transaction in the block -nonce ,value , , , 5 ,sequence number of the transactions sent by the sender -timestamp ,timestamp , , , 6 ,the Unix timestamp of the object -date ,datetime , ,calc , 7 ,the timestamp as a date -from ,address , , , 8 ,address from which the transaction was sent -to ,address , , , 9 ,address to which the transaction was sent -value ,wei , , , 10 ,the amount of wei sent with this transactions -ether ,ether , ,calc , 11 ,if --ether is specified, the value in ether -gas ,gas , , , 12 ,the maximum number of gas allowed for this transaction -gasPrice ,gas , , , 13 ,the number of wei per unit of gas the sender is willing to spend -input ,bytes , , , 14 ,byte data either containing a message or funcational data for a smart contracts. See the --articulate -hasToken ,bool , ,simponly , 15 ,`true` if the transaction is token related, `false` otherwise -articulatedTx ,*Function , ,simponly , 16 ,if present, the function that was called in the transaction -compressedTx ,string , ,calc , 17 ,truncated, more readable version of the articulation -isError ,bool , ,simponly|notag , 18 ,`true` if the transaction ended in error, `false` otherwise -functionName ,string , , , ,the name of the articulated function if any -methodId ,string , , , ,the fourbyte of the function -gasUsed ,gas , , , ,the amount of gas used by the transaction (from the receipt) -contractAddress ,address , , , ,if created, the address of the newly-created contract -cumulativeGasUsed ,string , , , ,a basically unused field showing all gas used -txReceiptStatus ,string , , , ,the status field from the receipt -withdrawalIndex ,value , , , ,for withdrawal transactions only, the index of the withdrawal since inception -validatorIndex ,value , , , ,for withdrawal transactions only, the index of the validator receiving the withdrawal -address ,address , ,removed , ,internal use only for withdrawal query, converted to 'to' after query -amount ,wei , ,removed , ,internal use only for withdrawal query, converted to 'value' after query +name ,type ,strDefault ,attributes ,docOrder ,description +hash ,hash , , , 1 ,the hash of the transaction +blockHash ,hash , , , 2 ,the hash of the block containing this transaction +blockNumber ,blknum , , , 3 ,the number of the block +transactionIndex ,txnum , , , 4 ,the zero-indexed position of the transaction in the block +nonce ,value , , , 5 ,sequence number of the transactions sent by the sender +timestamp ,timestamp , , , 6 ,the Unix timestamp of the object +date ,datetime , ,calc , 7 ,the timestamp as a date +from ,address , , , 8 ,address from which the transaction was sent +to ,address , , , 9 ,address to which the transaction was sent +value ,wei , , , 10 ,the amount of wei sent with this transactions +ether ,ether , ,calc , 11 ,if --ether is specified, the value in ether +gas ,gas , , , 12 ,the maximum number of gas allowed for this transaction +gasPrice ,gas , , , 13 ,the number of wei per unit of gas the sender is willing to spend +input ,bytes , , , 14 ,byte data either containing a message or funcational data for a smart contracts. See the --articulate +hasToken ,bool , , , 15 ,`true` if the transaction is token related, `false` otherwise +articulatedTx ,*Function , , , 16 ,if present, the function that was called in the transaction +compressedTx ,string , ,calc , 17 ,truncated, more readable version of the articulation +isError ,bool , ,notag , 18 ,`true` if the transaction ended in error, `false` otherwise +functionName ,string , , , ,the name of the articulated function if any +methodId ,string , , , ,the fourbyte of the function +gasUsed ,gas , , , ,the amount of gas used by the transaction (from the receipt) +contractAddress ,address , , , ,if created, the address of the newly-created contract +cumulativeGasUsed ,string , , , ,a basically unused field showing all gas used +txReceiptStatus ,string , , , ,the status field from the receipt +withdrawalIndex ,value , , , ,for withdrawal transactions only, the index of the withdrawal since inception +validatorIndex ,value , , , ,for withdrawal transactions only, the index of the validator receiving the withdrawal +address ,address , ,removed , ,internal use only for withdrawal query, converted to 'to' after query +amount ,wei , ,removed , ,internal use only for withdrawal query, converted to 'value' after query diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/trace.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/trace.csv index 276300a3bd..a5e735d1cb 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/trace.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/trace.csv @@ -1,15 +1,15 @@ -name ,type ,strDefault ,attributes ,upgrades ,docOrder ,description -blockHash ,hash , , , , 1 ,the hash of the block containing this trace -blockNumber ,blknum , , , , 2 ,the number of the block -subtraces ,uint64 , , , , 8 ,the number of children traces that the trace hash -traceAddress ,[]uint64 , , , , 7 ,a particular trace's address in the trace tree -transactionHash ,hash , , , , 5 ,the transaction's hash containing this trace -transactionIndex ,txnum , , , , 6 ,the zero-indexed position of the transaction in the block -type ,string , ,omitempty , , 9 ,the type of the trace -error ,string , ,omitempty , , , -action ,*TraceAction , , , , 10 ,the trace action for this trace -result ,*TraceResult , , , , 11 ,the trace result of this trace -articulatedTrace ,*Function , ,omitempty|simponly , , 12 ,human readable version of the trace action input data -compressedTrace ,string , ,calc ,2.5.10:string , 13 ,a compressed string version of the articulated trace -timestamp ,timestamp , ,simponly , , 3 ,the timestamp of the block -date ,datetime , ,omitempty|calc , , 4 ,the timestamp as a date +name ,type ,strDefault ,attributes ,upgrades ,docOrder ,description +blockHash ,hash , , , , 1 ,the hash of the block containing this trace +blockNumber ,blknum , , , , 2 ,the number of the block +subtraces ,uint64 , , , , 8 ,the number of children traces that the trace hash +traceAddress ,[]uint64 , , , , 7 ,a particular trace's address in the trace tree +transactionHash ,hash , , , , 5 ,the transaction's hash containing this trace +transactionIndex ,txnum , , , , 6 ,the zero-indexed position of the transaction in the block +type ,string , ,omitempty , , 9 ,the type of the trace +error ,string , ,omitempty , , , +action ,*TraceAction , , , , 10 ,the trace action for this trace +result ,*TraceResult , , , , 11 ,the trace result of this trace +articulatedTrace ,*Function , ,omitempty , , 12 ,human readable version of the trace action input data +compressedTrace ,string , ,calc ,2.5.10:string , 13 ,a compressed string version of the articulated trace +timestamp ,timestamp , , , , 3 ,the timestamp of the block +date ,datetime , ,omitempty|calc , , 4 ,the timestamp as a date diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/transaction.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/transaction.csv index b1ab3b4e35..319471e777 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/transaction.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/transaction.csv @@ -1,28 +1,28 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -accessList ,[]StorageSlot , ,removed , , -chainId ,string , ,removed , , -blockNumber ,blknum , , , 3 ,the number of the block -transactionIndex ,txnum , , , 4 ,the zero-indexed position of the transaction in the block -timestamp ,timestamp , ,simponly , 6 ,the Unix timestamp of the object -date ,datetime , ,calc , 7 ,the timestamp as a date -hash ,hash , , , 1 ,the hash of the transaction -blockHash ,hash , , , 2 ,the hash of the block containing this transaction -from ,address , , , 8 ,address from which the transaction was sent -to ,address , , , 9 ,address to which the transaction was sent -nonce ,value , , , 5 ,sequence number of the transactions sent by the sender -value ,wei , , , 10 ,the amount of wei sent with this transactions -ether ,ether , ,calc , 11 ,if --ether is specified, the value in ether -gas ,gas , , , 12 ,the maximum number of gas allowed for this transaction -gasPrice ,gas , , , 13 ,the number of wei per unit of gas the sender is willing to spend -maxFeePerGas ,gas , , , , -maxPriorityFeePerGas ,gas , , , , -input ,bytes , , , 14 ,byte data either containing a message or funcational data for a smart contracts. See the --articulate -isError ,bool , ,simponly , 19 ,`true` if the transaction ended in error, `false` otherwise -hasToken ,bool , ,simponly , 18 ,`true` if the transaction is token related, `false` otherwise -receipt ,*Receipt , ,simponly , 15 , -traces ,[]Trace , ,simponly , , -articulatedTx ,*Function , ,simponly , 17 , -compressedTx ,string , ,calc , 20 ,truncated, more readable version of the articulation -statements ,[]Statement , ,simponly|calc , 16 ,array of reconciliations -gasUsed ,gas , ,simponly , , -type ,string , , , , +name ,type ,strDefault ,attributes ,docOrder ,description +accessList ,[]StorageSlot , ,removed , , +chainId ,string , ,removed , , +blockNumber ,blknum , , , 3 ,the number of the block +transactionIndex ,txnum , , , 4 ,the zero-indexed position of the transaction in the block +timestamp ,timestamp , , , 6 ,the Unix timestamp of the object +date ,datetime , ,calc , 7 ,the timestamp as a date +hash ,hash , , , 1 ,the hash of the transaction +blockHash ,hash , , , 2 ,the hash of the block containing this transaction +from ,address , , , 8 ,address from which the transaction was sent +to ,address , , , 9 ,address to which the transaction was sent +nonce ,value , , , 5 ,sequence number of the transactions sent by the sender +value ,wei , , , 10 ,the amount of wei sent with this transactions +ether ,ether , ,calc , 11 ,if --ether is specified, the value in ether +gas ,gas , , , 12 ,the maximum number of gas allowed for this transaction +gasPrice ,gas , , , 13 ,the number of wei per unit of gas the sender is willing to spend +maxFeePerGas ,gas , , , , +maxPriorityFeePerGas ,gas , , , , +input ,bytes , , , 14 ,byte data either containing a message or funcational data for a smart contracts. See the --articulate +isError ,bool , , , 19 ,`true` if the transaction ended in error, `false` otherwise +hasToken ,bool , , , 18 ,`true` if the transaction is token related, `false` otherwise +receipt ,*Receipt , , , 15 , +traces ,[]Trace , , , , +articulatedTx ,*Function , , , 17 , +compressedTx ,string , ,calc , 20 ,truncated, more readable version of the articulation +statements ,[]Statement , ,calc , 16 ,array of reconciliations +gasUsed ,gas , , , , +type ,string , , , , diff --git a/src/dev_tools/goMaker/types/types_member.go b/src/dev_tools/goMaker/types/types_member.go index 12a2e12c8f..18decad1f4 100644 --- a/src/dev_tools/goMaker/types/types_member.go +++ b/src/dev_tools/goMaker/types/types_member.go @@ -70,10 +70,6 @@ func (m *Member) IsRemoved() bool { return strings.Contains(m.Attributes, "removed") } -func (m *Member) IsSimpOnly() bool { - return strings.Contains(m.Attributes, "simponly") -} - func (m *Member) IsNoTag() bool { return strings.Contains(m.Attributes, "notag") } diff --git a/src/dev_tools/goMaker/types/types_structure.go b/src/dev_tools/goMaker/types/types_structure.go index 37773cdc9a..737f7e176a 100644 --- a/src/dev_tools/goMaker/types/types_structure.go +++ b/src/dev_tools/goMaker/types/types_structure.go @@ -69,10 +69,6 @@ func (s *Structure) IsCacheAsGroup() bool { return s.CacheAs == "group" } -func (s *Structure) IsSimpOnly() bool { - return strings.Contains(s.Attributes, "simponly") -} - func (s *Structure) HasNotes() bool { notePath := filepath.Join(GetTemplatePath(), "model-intros/", CamelCase(s.Class)+".notes.md") return file.FileExists(notePath) From 69c4685f1000603fdf7cc4a05b75d1f1603111fd Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 1 Aug 2024 20:46:54 -0400 Subject: [PATCH 015/121] Removes tri-partate location creation for Caches in favor of simpler CacheLocation --- src/apps/chifra/pkg/cache/cache.go | 4 +- src/apps/chifra/pkg/cache/cache_test.go | 21 +++------- src/apps/chifra/pkg/cache/store.go | 13 ++++-- src/apps/chifra/pkg/cache/store_test.go | 12 +----- src/apps/chifra/pkg/file/pathparts.go | 15 +++++++ src/apps/chifra/pkg/types/types_block.go | 21 +++------- src/apps/chifra/pkg/types/types_lightblock.go | 21 +++------- src/apps/chifra/pkg/types/types_log.go | 31 +++++--------- src/apps/chifra/pkg/types/types_receipt.go | 31 +++++--------- src/apps/chifra/pkg/types/types_result.go | 21 +++------- src/apps/chifra/pkg/types/types_slurp.go | 33 +++++---------- src/apps/chifra/pkg/types/types_state.go | 21 +++------- src/apps/chifra/pkg/types/types_statement.go | 33 +++++---------- src/apps/chifra/pkg/types/types_trace.go | 31 +++++--------- .../chifra/pkg/types/types_transaction.go | 21 +++------- src/apps/chifra/pkg/types/types_withdrawal.go | 31 +++++--------- .../src_apps_chifra_pkg_types_type.go.tmpl | 40 +++++++------------ .../goMaker/types/types_structure.go | 15 ++++++- 18 files changed, 146 insertions(+), 269 deletions(-) create mode 100644 src/apps/chifra/pkg/file/pathparts.go diff --git a/src/apps/chifra/pkg/cache/cache.go b/src/apps/chifra/pkg/cache/cache.go index 0893f07404..da9059becc 100644 --- a/src/apps/chifra/pkg/cache/cache.go +++ b/src/apps/chifra/pkg/cache/cache.go @@ -33,9 +33,7 @@ type Storer interface { // Locator is a struct implementing the Locator interface. It can describe its // location in the cache type Locator interface { - CacheLocation() (directory string, extension string) - CacheId() string - CacheName() string + CacheLocations() (string, string, string) } // Unmarshaler is a struct implementing Unmarshaler can be read from binary by diff --git a/src/apps/chifra/pkg/cache/cache_test.go b/src/apps/chifra/pkg/cache/cache_test.go index e9aed44e6b..4bc0b285dc 100644 --- a/src/apps/chifra/pkg/cache/cache_test.go +++ b/src/apps/chifra/pkg/cache/cache_test.go @@ -68,20 +68,8 @@ func (e *ExampleBlock) UnmarshalCache(itemVersion uint64, reader io.Reader) (err // We we also implement all the methods needed for ExampleBlock to become Locator. // Locator interface job is to locate an item in cache. -// First of all, we need to tell the cache what the ID should be for ExampleBlock. -// We will make BlockNumber our ID: -func (e *ExampleBlock) CacheId() string { - return strconv.FormatUint(e.BlockNumber, 10) -} - -// We also have to provide some low level details like directory and file extension: -func (e *ExampleBlock) CacheLocation() (directory string, extension string) { - return "example", "bin" -} - -// Sometimes (e.g. in `chifra status`) we also need human readable name: -func (e *ExampleBlock) CacheName() string { - return "ExampleBlock" +func (e *ExampleBlock) CacheLocations() (string, string, string) { + return "example", strconv.FormatUint(e.BlockNumber, 10), "bin" } func Example() { @@ -95,8 +83,9 @@ func Example() { Timestamp: 1688667358, } - // We made `BlockNumber` our cache ID (see implementation of ExampleBlock.CacheId above) - fmt.Println(block.CacheId()) + // We made `BlockNumber` our cache ID + _, id, _ := block.CacheLocations() + fmt.Println(id) // we will store it in memory cache (if StoreOptions is nil, then file system // cache is used) diff --git a/src/apps/chifra/pkg/cache/store.go b/src/apps/chifra/pkg/cache/store.go index 776ddbb47b..f64d2b4c2c 100644 --- a/src/apps/chifra/pkg/cache/store.go +++ b/src/apps/chifra/pkg/cache/store.go @@ -6,6 +6,7 @@ import ( "errors" "os" "path" + "strings" "sync" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/cache/locations" @@ -64,13 +65,17 @@ func (s *Store) resolvePath(value Locator) (resolved string, err error) { return cachedPath, nil } - id := value.CacheId() - directory, extension := value.CacheLocation() + directory, id, extension := value.CacheLocations() if directory == "" || extension == "" { - err = errors.New("empty CacheLocation") + err = errors.New("empty CacheLocations") return } - resolved = path.Join(s.rootDir, directory, (id + "." + extension)) + if strings.HasPrefix(directory, "/") { + resolved = path.Join(directory, (id + "." + extension)) + } else { + resolved = path.Join(s.rootDir, directory, (id + "." + extension)) + } + return } diff --git a/src/apps/chifra/pkg/cache/store_test.go b/src/apps/chifra/pkg/cache/store_test.go index edca501f6a..68a47d6d08 100644 --- a/src/apps/chifra/pkg/cache/store_test.go +++ b/src/apps/chifra/pkg/cache/store_test.go @@ -26,16 +26,8 @@ func (t *testStoreData) UnmarshalCache(version uint64, reader io.Reader) error { return nil } -func (t *testStoreData) CacheLocation() (string, string) { - return "test", "bin" -} - -func (t *testStoreData) CacheId() string { - return t.Id -} - -func (t *testStoreData) CacheName() string { - return "StoreDataTest" +func (t *testStoreData) CacheLocations() (string, string, string) { + return "test", t.Id, "bin" } func TestStoreWrite(t *testing.T) { diff --git a/src/apps/chifra/pkg/file/pathparts.go b/src/apps/chifra/pkg/file/pathparts.go new file mode 100644 index 0000000000..aca07c602c --- /dev/null +++ b/src/apps/chifra/pkg/file/pathparts.go @@ -0,0 +1,15 @@ +package file + +import ( + "path/filepath" + "strings" +) + +func GetPathParts(fullPath string) (folder string, filename string, ext string) { + folder = filepath.Dir(fullPath) + filename = filepath.Base(fullPath) + ext = filepath.Ext(fullPath) + filename = strings.ReplaceAll(filename, ext, "") + ext = strings.ReplaceAll(ext, ".", "") + return +} diff --git a/src/apps/chifra/pkg/types/types_block.go b/src/apps/chifra/pkg/types/types_block.go index 0f02eff651..a5b83e10eb 100644 --- a/src/apps/chifra/pkg/types/types_block.go +++ b/src/apps/chifra/pkg/types/types_block.go @@ -134,26 +134,15 @@ func (s *Block) Date() string { return base.FormattedDate(s.Timestamp) } -func (s *Block) CacheName() string { - return "Block" -} - -func (s *Block) CacheId() string { - return fmt.Sprintf("%09d", s.BlockNumber) -} - -func (s *Block) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *Block) CacheLocations() (string, string, string) { + paddedId := fmt.Sprintf("%09d", s.BlockNumber) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] - - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return + subFolder := strings.ToLower("Block") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin" } func (s *Block) MarshalCache(writer io.Writer) (err error) { diff --git a/src/apps/chifra/pkg/types/types_lightblock.go b/src/apps/chifra/pkg/types/types_lightblock.go index be61a48af6..ea4ca80be7 100644 --- a/src/apps/chifra/pkg/types/types_lightblock.go +++ b/src/apps/chifra/pkg/types/types_lightblock.go @@ -104,26 +104,15 @@ func (s *LightBlock) Date() string { return base.FormattedDate(s.Timestamp) } -func (s *LightBlock) CacheName() string { - return "Block" -} - -func (s *LightBlock) CacheId() string { - return fmt.Sprintf("%09d", s.BlockNumber) -} - -func (s *LightBlock) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *LightBlock) CacheLocations() (string, string, string) { + paddedId := fmt.Sprintf("%09d", s.BlockNumber) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] - - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return + subFolder := strings.ToLower("Block") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin" } func (s *LightBlock) MarshalCache(writer io.Writer) (err error) { diff --git a/src/apps/chifra/pkg/types/types_log.go b/src/apps/chifra/pkg/types/types_log.go index af4474a6ba..91aa58e49c 100644 --- a/src/apps/chifra/pkg/types/types_log.go +++ b/src/apps/chifra/pkg/types/types_log.go @@ -145,32 +145,21 @@ func (s *Log) Date() string { return base.FormattedDate(s.Timestamp) } -type LogGroup struct { - BlockNumber base.Blknum - TransactionIndex base.Txnum - Logs []Log -} - -func (s *LogGroup) CacheName() string { - return "Log" -} - -func (s *LogGroup) CacheId() string { - return fmt.Sprintf("%09d", s.BlockNumber) -} - -func (s *LogGroup) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *LogGroup) CacheLocations() (string, string, string) { + paddedId := fmt.Sprintf("%09d", s.BlockNumber) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] + subFolder := strings.ToLower("Log") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin" +} - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return +type LogGroup struct { + BlockNumber base.Blknum + TransactionIndex base.Txnum + Logs []Log } func (s *LogGroup) MarshalCache(writer io.Writer) (err error) { diff --git a/src/apps/chifra/pkg/types/types_receipt.go b/src/apps/chifra/pkg/types/types_receipt.go index 7d68d5bf16..80ece14553 100644 --- a/src/apps/chifra/pkg/types/types_receipt.go +++ b/src/apps/chifra/pkg/types/types_receipt.go @@ -137,32 +137,21 @@ func (s *Receipt) Model(chain, format string, verbose bool, extraOpts map[string } } -type ReceiptGroup struct { - BlockNumber base.Blknum - TransactionIndex base.Txnum - Receipts []Receipt -} - -func (s *ReceiptGroup) CacheName() string { - return "Receipt" -} - -func (s *ReceiptGroup) CacheId() string { - return fmt.Sprintf("%09d", s.BlockNumber) -} - -func (s *ReceiptGroup) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *ReceiptGroup) CacheLocations() (string, string, string) { + paddedId := fmt.Sprintf("%09d", s.BlockNumber) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] + subFolder := strings.ToLower("Receipt") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin" +} - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return +type ReceiptGroup struct { + BlockNumber base.Blknum + TransactionIndex base.Txnum + Receipts []Receipt } func (s *ReceiptGroup) MarshalCache(writer io.Writer) (err error) { diff --git a/src/apps/chifra/pkg/types/types_result.go b/src/apps/chifra/pkg/types/types_result.go index c10a4ac5e4..61194d5c0a 100644 --- a/src/apps/chifra/pkg/types/types_result.go +++ b/src/apps/chifra/pkg/types/types_result.go @@ -127,26 +127,15 @@ func (s *Result) Date() string { return base.FormattedDate(s.Timestamp) } -func (s *Result) CacheName() string { - return "Result" -} - -func (s *Result) CacheId() string { - return fmt.Sprintf("%s-%s-%09d", s.Address.Hex()[2:], s.Encoding[2:], s.BlockNumber) -} - -func (s *Result) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *Result) CacheLocations() (string, string, string) { + paddedId := fmt.Sprintf("%s-%s-%09d", s.Address.Hex()[2:], s.Encoding[2:], s.BlockNumber) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] - - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return + subFolder := strings.ToLower("Result") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin" } func (s *Result) MarshalCache(writer io.Writer) (err error) { diff --git a/src/apps/chifra/pkg/types/types_slurp.go b/src/apps/chifra/pkg/types/types_slurp.go index 486c2dccbf..ef009ba232 100644 --- a/src/apps/chifra/pkg/types/types_slurp.go +++ b/src/apps/chifra/pkg/types/types_slurp.go @@ -243,33 +243,22 @@ func (s *Slurp) Date() string { return base.FormattedDate(s.Timestamp) } -type SlurpGroup struct { - BlockNumber base.Blknum - TransactionIndex base.Txnum - Address base.Address - Slurps []Slurp -} - -func (s *SlurpGroup) CacheName() string { - return "Slurp" -} - -func (s *SlurpGroup) CacheId() string { - return fmt.Sprintf("%s-%09d-%05d", s.Address.Hex()[2:], s.BlockNumber, s.TransactionIndex) -} - -func (s *SlurpGroup) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *SlurpGroup) CacheLocations() (string, string, string) { + paddedId := fmt.Sprintf("%s-%09d-%05d", s.Address.Hex()[2:], s.BlockNumber, s.TransactionIndex) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] + subFolder := strings.ToLower("Slurp") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin" +} - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return +type SlurpGroup struct { + BlockNumber base.Blknum + TransactionIndex base.Txnum + Address base.Address + Slurps []Slurp } func (s *SlurpGroup) MarshalCache(writer io.Writer) (err error) { diff --git a/src/apps/chifra/pkg/types/types_state.go b/src/apps/chifra/pkg/types/types_state.go index b77437e50e..bacff18f12 100644 --- a/src/apps/chifra/pkg/types/types_state.go +++ b/src/apps/chifra/pkg/types/types_state.go @@ -131,26 +131,15 @@ func (s *State) Date() string { return base.FormattedDate(s.Timestamp) } -func (s *State) CacheName() string { - return "State" -} - -func (s *State) CacheId() string { - return fmt.Sprintf("%s-%09d", s.Address.Hex()[2:], s.BlockNumber) -} - -func (s *State) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *State) CacheLocations() (string, string, string) { + paddedId := fmt.Sprintf("%s-%09d", s.Address.Hex()[2:], s.BlockNumber) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] - - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return + subFolder := strings.ToLower("State") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin" } func (s *State) MarshalCache(writer io.Writer) (err error) { diff --git a/src/apps/chifra/pkg/types/types_statement.go b/src/apps/chifra/pkg/types/types_statement.go index 8225967ab1..c49264dea1 100644 --- a/src/apps/chifra/pkg/types/types_statement.go +++ b/src/apps/chifra/pkg/types/types_statement.go @@ -182,33 +182,22 @@ func (s *Statement) Date() string { return base.FormattedDate(s.Timestamp) } -type StatementGroup struct { - BlockNumber base.Blknum - TransactionIndex base.Txnum - Address base.Address - Statements []Statement -} - -func (s *StatementGroup) CacheName() string { - return "Statement" -} - -func (s *StatementGroup) CacheId() string { - return fmt.Sprintf("%s-%09d-%05d", s.Address.Hex()[2:], s.BlockNumber, s.TransactionIndex) -} - -func (s *StatementGroup) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *StatementGroup) CacheLocations() (string, string, string) { + paddedId := fmt.Sprintf("%s-%09d-%05d", s.Address.Hex()[2:], s.BlockNumber, s.TransactionIndex) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] + subFolder := strings.ToLower("Statement") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin" +} - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return +type StatementGroup struct { + BlockNumber base.Blknum + TransactionIndex base.Txnum + Address base.Address + Statements []Statement } func (s *StatementGroup) MarshalCache(writer io.Writer) (err error) { diff --git a/src/apps/chifra/pkg/types/types_trace.go b/src/apps/chifra/pkg/types/types_trace.go index 2dd5edaa37..9b47ad363c 100644 --- a/src/apps/chifra/pkg/types/types_trace.go +++ b/src/apps/chifra/pkg/types/types_trace.go @@ -191,32 +191,21 @@ func (s *Trace) Date() string { return base.FormattedDate(s.Timestamp) } -type TraceGroup struct { - BlockNumber base.Blknum - TransactionIndex base.Txnum - Traces []Trace -} - -func (s *TraceGroup) CacheName() string { - return "Trace" -} - -func (s *TraceGroup) CacheId() string { - return fmt.Sprintf("%09d-%05d", s.BlockNumber, s.TransactionIndex) -} - -func (s *TraceGroup) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *TraceGroup) CacheLocations() (string, string, string) { + paddedId := fmt.Sprintf("%09d-%05d", s.BlockNumber, s.TransactionIndex) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] + subFolder := strings.ToLower("Trace") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin" +} - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return +type TraceGroup struct { + BlockNumber base.Blknum + TransactionIndex base.Txnum + Traces []Trace } func (s *TraceGroup) MarshalCache(writer io.Writer) (err error) { diff --git a/src/apps/chifra/pkg/types/types_transaction.go b/src/apps/chifra/pkg/types/types_transaction.go index 24969920b6..09df5de8a9 100644 --- a/src/apps/chifra/pkg/types/types_transaction.go +++ b/src/apps/chifra/pkg/types/types_transaction.go @@ -318,26 +318,15 @@ func (s *Transaction) Date() string { return base.FormattedDate(s.Timestamp) } -func (s *Transaction) CacheName() string { - return "Transaction" -} - -func (s *Transaction) CacheId() string { - return fmt.Sprintf("%09d-%05d", s.BlockNumber, s.TransactionIndex) -} - -func (s *Transaction) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *Transaction) CacheLocations() (string, string, string) { + paddedId := fmt.Sprintf("%09d-%05d", s.BlockNumber, s.TransactionIndex) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] - - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return + subFolder := strings.ToLower("Transaction") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin" } func (s *Transaction) MarshalCache(writer io.Writer) (err error) { diff --git a/src/apps/chifra/pkg/types/types_withdrawal.go b/src/apps/chifra/pkg/types/types_withdrawal.go index 9bef1bcbbd..dfd827e0a9 100644 --- a/src/apps/chifra/pkg/types/types_withdrawal.go +++ b/src/apps/chifra/pkg/types/types_withdrawal.go @@ -89,32 +89,21 @@ func (s *Withdrawal) Date() string { return base.FormattedDate(s.Timestamp) } -type WithdrawalGroup struct { - BlockNumber base.Blknum - TransactionIndex base.Txnum - Withdrawals []Withdrawal -} - -func (s *WithdrawalGroup) CacheName() string { - return "Withdrawal" -} - -func (s *WithdrawalGroup) CacheId() string { - return fmt.Sprintf("%09d", s.BlockNumber) -} - -func (s *WithdrawalGroup) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *WithdrawalGroup) CacheLocations() (string, string, string) { + paddedId := fmt.Sprintf("%09d", s.BlockNumber) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] + subFolder := strings.ToLower("Withdrawal") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin" +} - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return +type WithdrawalGroup struct { + BlockNumber base.Blknum + TransactionIndex base.Txnum + Withdrawals []Withdrawal } func (s *WithdrawalGroup) MarshalCache(writer io.Writer) (err error) { diff --git a/src/dev_tools/goMaker/templates/generators/types/src_apps_chifra_pkg_types_type.go.tmpl b/src/dev_tools/goMaker/templates/generators/types/src_apps_chifra_pkg_types_type.go.tmpl index 78677e92f8..a84dfb3364 100644 --- a/src/dev_tools/goMaker/templates/generators/types/src_apps_chifra_pkg_types_type.go.tmpl +++ b/src/dev_tools/goMaker/templates/generators/types/src_apps_chifra_pkg_types_type.go.tmpl @@ -43,42 +43,30 @@ func (s *{{.Class}}) Date() string { {{if .IsCachable}} {{if not .IsMarshalOnly}} -{{if .IsCacheAsGroup}} -type {{.Class}}{{if .IsCacheAsGroup}}Group{{end}} struct { - BlockNumber base.Blknum - TransactionIndex base.Txnum - {{if .NeedsAddress}}Address base.Address - {{end}}{{.Class}}s []{{.Class}} -} -{{end}} -func (s *{{.Class}}{{if .IsCacheAsGroup}}Group{{end}}) CacheName() string { - return "{{.CacheLoc}}" -} - -func (s *{{.Class}}{{if .IsCacheAsGroup}}Group{{end}}) CacheId() string { - return fmt.Sprintf({{.CacheIdStr}}) -} - -func (s *{{.Class}}{{if .IsCacheAsGroup}}Group{{end}}) CacheLocation() (directory string, extension string) { - paddedId := s.CacheId() +func (s *{{.ClassOrClassGroup}}) CacheLocations() (string, string, string) { +{{if .IsFilenameCache}} return file.GetPathParts(s.Filename){{else}} paddedId := fmt.Sprintf({{.CacheIdStr}}) parts := make([]string, 3) parts[0] = paddedId[:2] parts[1] = paddedId[2:4] parts[2] = paddedId[4:6] - - subFolder := strings.ToLower(s.CacheName()) + "s" - directory = filepath.Join(subFolder, filepath.Join(parts...)) - extension = "bin" - - return + subFolder := strings.ToLower("{{.CacheLoc}}") + "s" + directory := filepath.Join(subFolder, filepath.Join(parts...)) + return directory, paddedId, "bin"{{end}} } {{if .IsCacheAsGroup}} -func (s *{{.Class}}Group) MarshalCache(writer io.Writer) (err error) { +type {{.ClassOrClassGroup}} struct { + BlockNumber base.Blknum + TransactionIndex base.Txnum + {{if .NeedsAddress}}Address base.Address + {{end}}{{.Class}}s []{{.Class}} +} + +func (s *{{.ClassOrClassGroup}}) MarshalCache(writer io.Writer) (err error) { return cache.WriteValue(writer, s.{{.Class}}s) } -func (s *{{.Class}}Group) UnmarshalCache(vers uint64, reader io.Reader) (err error) { +func (s *{{.ClassOrClassGroup}}) UnmarshalCache(vers uint64, reader io.Reader) (err error) { return cache.ReadValue(reader, &s.{{.Class}}s, vers) } diff --git a/src/dev_tools/goMaker/types/types_structure.go b/src/dev_tools/goMaker/types/types_structure.go index 737f7e176a..a56fc02b56 100644 --- a/src/dev_tools/goMaker/types/types_structure.go +++ b/src/dev_tools/goMaker/types/types_structure.go @@ -61,10 +61,21 @@ func (s *Structure) IsCachable() bool { return s.CacheType != "" } +func (s *Structure) IsFilenameCache() bool { + return s.CacheBy == "filename" +} + func (s *Structure) IsMarshalOnly() bool { return s.CacheType == "marshal_only" } +func (s *Structure) ClassOrClassGroup() string { + if s.IsCacheAsGroup() { + return s.Class + "Group" + } + return s.Class +} + func (s *Structure) IsCacheAsGroup() bool { return s.CacheAs == "group" } @@ -155,8 +166,8 @@ func (s *Structure) CacheIdStr() string { return "\"%09d\", s.BlockNumber" case "tx": return "\"%09d-%05d\", s.BlockNumber, s.TransactionIndex" - case "string": - return "\"%0s\", s.GetCacheName()" + case "filename": + return "\"%0s\", s.Filename" default: logger.Fatal("Unknown cache by format:", s.CacheBy) return "" From 642bbee518b682ff0d4cc2f1363c7ed4447960f6 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 1 Aug 2024 22:56:39 -0400 Subject: [PATCH 016/121] Adds chifra abis --list --- docs | 2 +- sdk/abis.go | 7 ++ sdk/abis_internal.go | 4 +- sdk/python/src/_abis.py | 1 + sdk/typescript/src/paths/abis.ts | 5 +- sdk/typescript/src/types/abifile.ts | 18 +++++ src/apps/chifra/cmd/abis.go | 1 + src/apps/chifra/internal/abis/README.md | 2 + src/apps/chifra/internal/abis/handle_list.go | 65 +++++++++++++++++++ src/apps/chifra/internal/abis/options.go | 4 ++ src/apps/chifra/internal/abis/output.go | 2 + src/apps/chifra/internal/abis/validate.go | 7 +- src/apps/chifra/pkg/types/types_abifile.go | 62 ++++++++++++++++++ .../templates/classDefinitions/abifile.toml | 7 ++ .../classDefinitions/fields/abifile.csv | 5 ++ .../goMaker/templates/cmd-line-options.csv | 5 +- src/dev_tools/sdkFuzzer/abis.go | 10 +++ src/dev_tools/testRunner/testCases/abis.csv | 2 + tests | 2 +- 19 files changed, 203 insertions(+), 8 deletions(-) create mode 100644 sdk/typescript/src/types/abifile.ts create mode 100644 src/apps/chifra/internal/abis/handle_list.go create mode 100644 src/apps/chifra/pkg/types/types_abifile.go create mode 100644 src/dev_tools/goMaker/templates/classDefinitions/abifile.toml create mode 100644 src/dev_tools/goMaker/templates/classDefinitions/fields/abifile.csv diff --git a/docs b/docs index d5d5267252..3beca5c7ff 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit d5d5267252acc06672c8539d767e9096440d9ff0 +Subproject commit 3beca5c7ff7916b09671873407f7d8bbeaf97901 diff --git a/sdk/abis.go b/sdk/abis.go index 10a98eccaf..410f0b0675 100644 --- a/sdk/abis.go +++ b/sdk/abis.go @@ -40,6 +40,13 @@ func (opts *AbisOptions) Abis() ([]types.Function, *types.MetaData, error) { return queryAbis[types.Function](in) } +// AbisList implements the chifra abis --list command. +func (opts *AbisOptions) AbisList() ([]types.AbiFile, *types.MetaData, error) { + in := opts.toInternal() + in.List = true + return queryAbis[types.AbiFile](in) +} + // AbisFind implements the chifra abis --find command. func (opts *AbisOptions) AbisFind(val []string) ([]types.Function, *types.MetaData, error) { in := opts.toInternal() diff --git a/sdk/abis_internal.go b/sdk/abis_internal.go index 6056d00b90..34ce848600 100644 --- a/sdk/abis_internal.go +++ b/sdk/abis_internal.go @@ -26,6 +26,7 @@ type abisOptionsInternal struct { Addrs []string `json:"addrs,omitempty"` Known bool `json:"known,omitempty"` ProxyFor base.Address `json:"proxyFor,omitempty"` + List bool `json:"list,omitempty"` Find []string `json:"find,omitempty"` Hint []string `json:"hint,omitempty"` Encode string `json:"encode,omitempty"` @@ -83,7 +84,8 @@ func GetAbisOptions(args []string) (*abisOptionsInternal, error) { } type abisGeneric interface { - types.Function + types.Function | + types.AbiFile } func queryAbis[T abisGeneric](opts *abisOptionsInternal) ([]T, *types.MetaData, error) { diff --git a/sdk/python/src/_abis.py b/sdk/python/src/_abis.py index 43b63fa49b..63bc786fc9 100644 --- a/sdk/python/src/_abis.py +++ b/sdk/python/src/_abis.py @@ -14,6 +14,7 @@ abisOpts = { "known": {"hotkey": "-k", "type": "switch"}, "proxyFor": {"hotkey": "-r", "type": "flag"}, + "list": {"hotkey": "-l", "type": "switch"}, "find": {"hotkey": "-f", "type": "flag"}, "hint": {"hotkey": "-n", "type": "flag"}, "encode": {"hotkey": "-e", "type": "flag"}, diff --git a/sdk/typescript/src/paths/abis.ts b/sdk/typescript/src/paths/abis.ts index 7fbc7edf6d..2de6d9425b 100644 --- a/sdk/typescript/src/paths/abis.ts +++ b/sdk/typescript/src/paths/abis.ts @@ -9,13 +9,14 @@ */ import * as ApiCallers from '../lib/api_callers'; -import { address, Function } from '../types'; +import { AbiFile, address, Function } from '../types'; export function getAbis( parameters?: { addrs: address[], known?: boolean, proxyFor?: address, + list?: boolean, find?: string[], hint?: string[], encode?: string, @@ -27,7 +28,7 @@ export function getAbis( }, options?: RequestInit, ) { - return ApiCallers.fetch( + return ApiCallers.fetch( { endpoint: '/abis', method: 'get', parameters, options }, ); } diff --git a/sdk/typescript/src/types/abifile.ts b/sdk/typescript/src/types/abifile.ts new file mode 100644 index 0000000000..53e45eef24 --- /dev/null +++ b/sdk/typescript/src/types/abifile.ts @@ -0,0 +1,18 @@ +/* eslint object-curly-newline: ["error", "never"] */ +/* eslint max-len: ["error", 160] */ +/* + * Copyright 2016, 2024 The TrueBlocks Authors. All rights reserved. + * Use of this source code is governed by a license that can + * be found in the LICENSE file. + * + * This file was auto generated. DO NOT EDIT. + */ + +import { int64 } from '.'; + +export type AbiFile = { + fileSize: int64 + lastModDate: string + name: string + path: string +} diff --git a/src/apps/chifra/cmd/abis.go b/src/apps/chifra/cmd/abis.go index 73b917de36..f77072aa17 100644 --- a/src/apps/chifra/cmd/abis.go +++ b/src/apps/chifra/cmd/abis.go @@ -58,6 +58,7 @@ func init() { abisCmd.Flags().BoolVarP(&abisPkg.GetOptions().Known, "known", "k", false, `load common 'known' ABIs from cache`) abisCmd.Flags().StringVarP(&abisPkg.GetOptions().ProxyFor, "proxy_for", "r", "", `redirects the query to this implementation`) + abisCmd.Flags().BoolVarP(&abisPkg.GetOptions().List, "list", "l", false, `a list of downloaded abi files`) abisCmd.Flags().StringSliceVarP(&abisPkg.GetOptions().Find, "find", "f", nil, `search for function or event declarations given a four- or 32-byte code(s)`) abisCmd.Flags().StringSliceVarP(&abisPkg.GetOptions().Hint, "hint", "n", nil, `for the --find option only, provide hints to speed up the search`) abisCmd.Flags().StringVarP(&abisPkg.GetOptions().Encode, "encode", "e", "", `generate the 32-byte encoding for a given cannonical function or event signature`) diff --git a/src/apps/chifra/internal/abis/README.md b/src/apps/chifra/internal/abis/README.md index 828635649b..6d6a8121b9 100644 --- a/src/apps/chifra/internal/abis/README.md +++ b/src/apps/chifra/internal/abis/README.md @@ -36,6 +36,7 @@ Arguments: Flags: -k, --known load common 'known' ABIs from cache -r, --proxy_for string redirects the query to this implementation + -l, --list a list of downloaded abi files -f, --find strings search for function or event declarations given a four- or 32-byte code(s) -n, --hint strings for the --find option only, provide hints to speed up the search -e, --encode string generate the 32-byte encoding for a given cannonical function or event signature @@ -52,6 +53,7 @@ Notes: Data models produced by this tool: - [abi](/data-model/other/#abi) +- [abifile](/data-model/other/#abifile) - [function](/data-model/other/#function) - [parameter](/data-model/other/#parameter) diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go new file mode 100644 index 0000000000..57ccf948f9 --- /dev/null +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -0,0 +1,65 @@ +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package abisPkg + +import ( + "os" + "path/filepath" + "strings" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" +) + +// HandleList handles the chifra monitors --list command. +func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { + chain := opts.Globals.Chain + testMode := opts.Globals.TestMode + paths := []string{ + filepath.Join(config.PathToRootConfig(), "abis"), + filepath.Join(config.PathToCache(chain), "abis"), + } + if testMode { + paths = paths[:1] + } + + abiArray := make([]types.AbiFile, 0, 100) + vFunc := func(fn string, vP any) (bool, error) { + if strings.HasSuffix(fn, ".json") { + info, _ := os.Stat(fn) + date := info.ModTime().Format("2006-01-02 15:04:05") + if testMode { + date = "--date--" + } + abiFile := types.AbiFile{ + FileSize: file.FileSize(fn), + LastModDate: date, + } + abiFile.Path, abiFile.Name = filepath.Split(fn) + if testMode { + abiFile.Path = strings.ReplaceAll(abiFile.Path, config.PathToRootConfig(), "./") + } + if len(abiFile.Name) > 0 { + abiArray = append(abiArray, abiFile) + } + } + return true, nil + } + + for _, path := range paths { + walk.ForEveryFileInFolder(path, vFunc, nil) + } + + fetchData := func(modelChan chan types.Modeler, errorChan chan error) { + for _, abi := range abiArray { + modelChan <- &abi + } + } + + return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) +} diff --git a/src/apps/chifra/internal/abis/options.go b/src/apps/chifra/internal/abis/options.go index 1f80fcc046..db12822bd5 100644 --- a/src/apps/chifra/internal/abis/options.go +++ b/src/apps/chifra/internal/abis/options.go @@ -31,6 +31,7 @@ type AbisOptions struct { Addrs []string `json:"addrs,omitempty"` // A list of one or more smart contracts whose ABIs to display Known bool `json:"known,omitempty"` // Load common 'known' ABIs from cache ProxyFor string `json:"proxyFor,omitempty"` // Redirects the query to this implementation + List bool `json:"list,omitempty"` // A list of downloaded abi files Find []string `json:"find,omitempty"` // Search for function or event declarations given a four- or 32-byte code(s) Hint []string `json:"hint,omitempty"` // For the --find option only, provide hints to speed up the search Encode string `json:"encode,omitempty"` // Generate the 32-byte encoding for a given cannonical function or event signature @@ -48,6 +49,7 @@ func (opts *AbisOptions) testLog() { logger.TestLog(len(opts.Addrs) > 0, "Addrs: ", opts.Addrs) logger.TestLog(opts.Known, "Known: ", opts.Known) logger.TestLog(len(opts.ProxyFor) > 0, "ProxyFor: ", opts.ProxyFor) + logger.TestLog(opts.List, "List: ", opts.List) logger.TestLog(len(opts.Find) > 0, "Find: ", opts.Find) logger.TestLog(len(opts.Hint) > 0, "Hint: ", opts.Hint) logger.TestLog(len(opts.Encode) > 0, "Encode: ", opts.Encode) @@ -85,6 +87,8 @@ func AbisFinishParseInternal(w io.Writer, values url.Values) *AbisOptions { opts.Known = true case "proxyFor": opts.ProxyFor = value[0] + case "list": + opts.List = true case "find": for _, val := range value { s := strings.Split(val, " ") // may contain space separated items diff --git a/src/apps/chifra/internal/abis/output.go b/src/apps/chifra/internal/abis/output.go index 9538aa0e82..4ffba31e2c 100644 --- a/src/apps/chifra/internal/abis/output.go +++ b/src/apps/chifra/internal/abis/output.go @@ -58,6 +58,8 @@ func (opts *AbisOptions) AbisInternal(rCtx *output.RenderCtx) error { err = opts.HandleDecache(rCtx) } else if len(opts.Find) > 0 { err = opts.HandleFind(rCtx) + } else if opts.List { + err = opts.HandleList(rCtx) } else if len(opts.Encode) > 0 { err = opts.HandleEncode(rCtx) } else { diff --git a/src/apps/chifra/internal/abis/validate.go b/src/apps/chifra/internal/abis/validate.go index 60656a82dd..e2de00a2d7 100644 --- a/src/apps/chifra/internal/abis/validate.go +++ b/src/apps/chifra/internal/abis/validate.go @@ -39,7 +39,12 @@ func (opts *AbisOptions) validateAbis() error { } } - if len(opts.Globals.File) == 0 && len(opts.Encode) == 0 && len(opts.Find) == 0 && !opts.Known && !opts.Globals.Decache { + if len(opts.Globals.File) == 0 && + len(opts.Encode) == 0 && + len(opts.Find) == 0 && + !opts.List && + !opts.Known && + !opts.Globals.Decache { // If we're not find and not known we better have at least one address err := validate.ValidateAtLeastOneAddr(opts.Addrs) if err != nil { diff --git a/src/apps/chifra/pkg/types/types_abifile.go b/src/apps/chifra/pkg/types/types_abifile.go new file mode 100644 index 0000000000..6ff2a9a915 --- /dev/null +++ b/src/apps/chifra/pkg/types/types_abifile.go @@ -0,0 +1,62 @@ +// Copyright 2016, 2024 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. +/* + * Parts of this file were auto generated. Edit only those parts of + * the code inside of 'EXISTING_CODE' tags. + */ + +package types + +// EXISTING_CODE +import "encoding/json" + +// EXISTING_CODE + +type AbiFile struct { + FileSize int64 `json:"fileSize"` + LastModDate string `json:"lastModDate"` + Name string `json:"name"` + Path string `json:"path"` + // EXISTING_CODE + // EXISTING_CODE +} + +func (s AbiFile) String() string { + bytes, _ := json.Marshal(s) + return string(bytes) +} + +func (s *AbiFile) Model(chain, format string, verbose bool, extraOpts map[string]any) Model { + var model = map[string]any{} + var order = []string{} + + // EXISTING_CODE + model = map[string]any{ + "name": s.Name, + "lastModDate": s.LastModDate, + "fileSize": s.FileSize, + "path": s.Path, + } + order = []string{ + "name", + "lastModDate", + "fileSize", + "path", + } + // EXISTING_CODE + + return Model{ + Data: model, + Order: order, + } +} + +// FinishUnmarshal is used by the cache. It may be unused depending on auto-code-gen +func (s *AbiFile) FinishUnmarshal() { + // EXISTING_CODE + // EXISTING_CODE +} + +// EXISTING_CODE +// EXISTING_CODE diff --git a/src/dev_tools/goMaker/templates/classDefinitions/abifile.toml b/src/dev_tools/goMaker/templates/classDefinitions/abifile.toml new file mode 100644 index 0000000000..e81c835e51 --- /dev/null +++ b/src/dev_tools/goMaker/templates/classDefinitions/abifile.toml @@ -0,0 +1,7 @@ +[settings] + class = "AbiFile" + doc_group = "05-Other" + doc_descr = "represents an abi file stored in the cache or configuration folders" + doc_route = "512-abiFile" + attributes = "" + produced_by = "abis" diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/abifile.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/abifile.csv new file mode 100644 index 0000000000..241600d8bb --- /dev/null +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/abifile.csv @@ -0,0 +1,5 @@ +name ,type ,strDefault ,attributes ,docOrder ,description +path ,string , , , 1 ,the folder holding the abi file +name ,string , , , 2 ,the filename of the ABI (likely the smart contract address) +fileSize ,int64 , , , 3 ,the size of this file on disc +lastModDate ,string , , , 4 ,the last update date of the file diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index 1dfccc6001..d62217d67f 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -101,12 +101,13 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 15200,tools,Accounts,names,ethNames,n2,,,,,note,,,,,,The `--match_case` option enables case sensitive matching. # 16000,tools,Accounts,abis,grabABI,,,,visible|docs,,command,,,Manage Abi files,[flags]
[address...],default|caching|names|,Fetches the ABI for a smart contract. -16020,tools,Accounts,abis,grabABI,addrs,,,required|visible|docs,3,positional,list,function,,,,a list of one or more smart contracts whose ABIs to display +16020,tools,Accounts,abis,grabABI,addrs,,,required|visible|docs,4,positional,list,function,,,,a list of one or more smart contracts whose ABIs to display 16030,tools,Accounts,abis,grabABI,known,k,,visible|docs,,switch,,,,,,load common 'known' ABIs from cache 16040,tools,Accounts,abis,grabABI,proxy_for,r,,visible|docs,,flag,
,,,,,redirects the query to this implementation +16030,tools,Accounts,abis,grabABI,list,l,,visible|docs,2,switch,,abiFile,,,,a list of downloaded abi files 16050,tools,Accounts,abis,grabABI,find,f,,visible|docs,1,flag,list,function,,,,search for function or event declarations given a four- or 32-byte code(s) 16060,tools,Accounts,abis,grabABI,hint,n,,visible|docs,,flag,list,,,,,for the --find option only, provide hints to speed up the search -16070,tools,Accounts,abis,grabABI,encode,e,,visible|docs,2,flag,,function,,,,generate the 32-byte encoding for a given cannonical function or event signature +16070,tools,Accounts,abis,grabABI,encode,e,,visible|docs,3,flag,,function,,,,generate the 32-byte encoding for a given cannonical function or event signature 16090,tools,Accounts,abis,grabABI,n1,,,,,note,,,,,,Search for either four byte signatures or event signatures with the --find option. # 21000,,Chain Data,,,,,,,,group,,,,,,Access and cache blockchain-related data diff --git a/src/dev_tools/sdkFuzzer/abis.go b/src/dev_tools/sdkFuzzer/abis.go index 707027e78f..3adfb999c1 100644 --- a/src/dev_tools/sdkFuzzer/abis.go +++ b/src/dev_tools/sdkFuzzer/abis.go @@ -126,6 +126,16 @@ func TestAbis(which, value, fn string, opts *sdk.AbisOptions) { ReportOkay(fn) } } + case "list": + if list, _, err := opts.AbisList(); err != nil { + ReportError(fn, opts, err) + } else { + if err := SaveToFile[types.AbiFile](fn, list); err != nil { + ReportError2(fn, err) + } else { + ReportOkay(fn) + } + } case "find": if find, _, err := opts.AbisFind([]string{value}); err != nil { ReportError(fn, opts, err) diff --git a/src/dev_tools/testRunner/testCases/abis.csv b/src/dev_tools/testRunner/testCases/abis.csv index 2cbd98285f..98a0f71002 100644 --- a/src/dev_tools/testRunner/testCases/abis.csv +++ b/src/dev_tools/testRunner/testCases/abis.csv @@ -64,6 +64,8 @@ on ,both ,fast ,abis ,tools ,grabABI ,clean_with ,y ,addrs = on ,both ,fast ,abis ,tools ,grabABI ,no_abi_found_2 ,y ,addrs = 0x713b73c3994442b533e6a083ec968e40606810ec on ,both ,fast ,abis ,tools ,grabABI ,clean_alone ,y ,decache +on ,both ,fast ,abis ,tools ,grabABI ,list ,y ,list + # Reports inconsistent results on subsequent runs delay ,both ,fast ,abis ,tools ,grabABI ,findSig_a_lot ,n ,find = 0xea8a1af0 & find = 0x9a82a09a & find = 0x52efea6e & find = 0xd0e30db0 & find = 0x83197ef0 & find = 0x12fa6feb & find = 0x3d6a71e4 & find = 0x31ae450b & find = 0x06fdde03 & find = 0x8da5cb5b & find = 0x1aa3a008 & find = 0x2de40ce3 & find = 0x9d76ea58 & find = 0xad7a672f & find = 0x3ccfd60b & find = 0xf5074f41 & find = 0x24d7806c & find = 0xc3c5a547 & find = 0x09e69ede & find = 0xf2fde38b & find = 0xc2a2ce06 & find = 0xfdacd576 & fmt = csv diff --git a/tests b/tests index 1d161e764c..37878835cb 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 1d161e764c7f64acc879246c98ebda1473aeecfa +Subproject commit 37878835cb98b330d7c50336fd4c3e3230562ea4 From 7404265aa5439d2a11964ed359026ea6b7aafc9b Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 1 Aug 2024 23:01:45 -0400 Subject: [PATCH 017/121] Fixing lints --- src/apps/chifra/internal/abis/handle_list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index 57ccf948f9..c2cd3fc368 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -52,7 +52,7 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { } for _, path := range paths { - walk.ForEveryFileInFolder(path, vFunc, nil) + _ = walk.ForEveryFileInFolder(path, vFunc, nil) } fetchData := func(modelChan chan types.Modeler, errorChan chan error) { From 058fe499bd2f865250a84c2ef4ee1d1306740b31 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 4 Aug 2024 17:34:58 -0400 Subject: [PATCH 018/121] Removes unused AbiFile type, expands Abi type --- docs | 2 +- sdk/abis.go | 4 +- sdk/abis_internal.go | 2 +- sdk/typescript/src/paths/abis.ts | 4 +- sdk/typescript/src/types/abi.ts | 9 ++- sdk/typescript/src/types/abifile.ts | 18 ------ src/apps/chifra/internal/abis/README.md | 1 - src/apps/chifra/internal/abis/handle_list.go | 36 +++++------ src/apps/chifra/pkg/types/types_abi.go | 11 +++- src/apps/chifra/pkg/types/types_abifile.go | 62 ------------------- .../templates/classDefinitions/abifile.toml | 7 --- .../templates/classDefinitions/fields/abi.csv | 13 +++- .../classDefinitions/fields/abifile.csv | 5 -- .../goMaker/templates/cmd-line-options.csv | 2 +- src/dev_tools/sdkFuzzer/abis.go | 2 +- 15 files changed, 52 insertions(+), 126 deletions(-) delete mode 100644 sdk/typescript/src/types/abifile.ts delete mode 100644 src/apps/chifra/pkg/types/types_abifile.go delete mode 100644 src/dev_tools/goMaker/templates/classDefinitions/abifile.toml delete mode 100644 src/dev_tools/goMaker/templates/classDefinitions/fields/abifile.csv diff --git a/docs b/docs index 3beca5c7ff..ce5748d93b 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 3beca5c7ff7916b09671873407f7d8bbeaf97901 +Subproject commit ce5748d93b79299e88fb608074020e143b41e07b diff --git a/sdk/abis.go b/sdk/abis.go index 410f0b0675..4295cbfd99 100644 --- a/sdk/abis.go +++ b/sdk/abis.go @@ -41,10 +41,10 @@ func (opts *AbisOptions) Abis() ([]types.Function, *types.MetaData, error) { } // AbisList implements the chifra abis --list command. -func (opts *AbisOptions) AbisList() ([]types.AbiFile, *types.MetaData, error) { +func (opts *AbisOptions) AbisList() ([]types.Abi, *types.MetaData, error) { in := opts.toInternal() in.List = true - return queryAbis[types.AbiFile](in) + return queryAbis[types.Abi](in) } // AbisFind implements the chifra abis --find command. diff --git a/sdk/abis_internal.go b/sdk/abis_internal.go index 34ce848600..07ba2d043c 100644 --- a/sdk/abis_internal.go +++ b/sdk/abis_internal.go @@ -85,7 +85,7 @@ func GetAbisOptions(args []string) (*abisOptionsInternal, error) { type abisGeneric interface { types.Function | - types.AbiFile + types.Abi } func queryAbis[T abisGeneric](opts *abisOptionsInternal) ([]T, *types.MetaData, error) { diff --git a/sdk/typescript/src/paths/abis.ts b/sdk/typescript/src/paths/abis.ts index 2de6d9425b..1d1b06630b 100644 --- a/sdk/typescript/src/paths/abis.ts +++ b/sdk/typescript/src/paths/abis.ts @@ -9,7 +9,7 @@ */ import * as ApiCallers from '../lib/api_callers'; -import { AbiFile, address, Function } from '../types'; +import { Abi, address, Function } from '../types'; export function getAbis( parameters?: { @@ -28,7 +28,7 @@ export function getAbis( }, options?: RequestInit, ) { - return ApiCallers.fetch( + return ApiCallers.fetch( { endpoint: '/abis', method: 'get', parameters, options }, ); } diff --git a/sdk/typescript/src/types/abi.ts b/sdk/typescript/src/types/abi.ts index e57da25538..34bbbd7197 100644 --- a/sdk/typescript/src/types/abi.ts +++ b/sdk/typescript/src/types/abi.ts @@ -8,9 +8,16 @@ * This file was auto generated. DO NOT EDIT. */ -import { address, Function } from '.'; +import { address, Function, int64 } from '.'; export type Abi = { address: address + fileSize: int64 functions: Function[] + isKnown: boolean + lastModDate: string + nEvents: int64 + nFunctions: int64 + name: string + path: string } diff --git a/sdk/typescript/src/types/abifile.ts b/sdk/typescript/src/types/abifile.ts deleted file mode 100644 index 53e45eef24..0000000000 --- a/sdk/typescript/src/types/abifile.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* eslint object-curly-newline: ["error", "never"] */ -/* eslint max-len: ["error", 160] */ -/* - * Copyright 2016, 2024 The TrueBlocks Authors. All rights reserved. - * Use of this source code is governed by a license that can - * be found in the LICENSE file. - * - * This file was auto generated. DO NOT EDIT. - */ - -import { int64 } from '.'; - -export type AbiFile = { - fileSize: int64 - lastModDate: string - name: string - path: string -} diff --git a/src/apps/chifra/internal/abis/README.md b/src/apps/chifra/internal/abis/README.md index 6d6a8121b9..a6a7adba7e 100644 --- a/src/apps/chifra/internal/abis/README.md +++ b/src/apps/chifra/internal/abis/README.md @@ -53,7 +53,6 @@ Notes: Data models produced by this tool: - [abi](/data-model/other/#abi) -- [abifile](/data-model/other/#abifile) - [function](/data-model/other/#function) - [parameter](/data-model/other/#parameter) diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index c2cd3fc368..7db4325b84 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -5,12 +5,10 @@ package abisPkg import ( - "os" "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" @@ -28,25 +26,25 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { paths = paths[:1] } - abiArray := make([]types.AbiFile, 0, 100) + abiArray := make([]types.Abi, 0, 100) vFunc := func(fn string, vP any) (bool, error) { if strings.HasSuffix(fn, ".json") { - info, _ := os.Stat(fn) - date := info.ModTime().Format("2006-01-02 15:04:05") - if testMode { - date = "--date--" - } - abiFile := types.AbiFile{ - FileSize: file.FileSize(fn), - LastModDate: date, - } - abiFile.Path, abiFile.Name = filepath.Split(fn) - if testMode { - abiFile.Path = strings.ReplaceAll(abiFile.Path, config.PathToRootConfig(), "./") - } - if len(abiFile.Name) > 0 { - abiArray = append(abiArray, abiFile) - } + // info, _ := os.Stat(fn) + // date := info.ModTime().Format("2006-01-02 15:04:05") + // if testMode { + // date = "--date--" + // } + // abiFile := types.Abi{ + // FileSize: file.FileSize(fn), + // LastModDate: date, + // } + // abiFile.Path, abiFile.Name = filepath.Split(fn) + // if testMode { + // abiFile.Path = strings.ReplaceAll(abiFile.Path, config.PathToRootConfig(), "./") + // } + // if len(abiFile.Name) > 0 { + // abiArray = append(abiArray, abiFile) + // } } return true, nil } diff --git a/src/apps/chifra/pkg/types/types_abi.go b/src/apps/chifra/pkg/types/types_abi.go index 996973be89..894e49e40f 100644 --- a/src/apps/chifra/pkg/types/types_abi.go +++ b/src/apps/chifra/pkg/types/types_abi.go @@ -18,8 +18,15 @@ import ( // EXISTING_CODE type Abi struct { - Address base.Address `json:"address"` - Functions []Function `json:"functions"` + Address base.Address `json:"address"` + FileSize int64 `json:"fileSize"` + Functions []Function `json:"functions"` + IsKnown bool `json:"isKnown"` + LastModDate string `json:"lastModDate"` + NEvents int64 `json:"nEvents"` + NFunctions int64 `json:"nFunctions"` + Name string `json:"name"` + Path string `json:"path"` // EXISTING_CODE // EXISTING_CODE } diff --git a/src/apps/chifra/pkg/types/types_abifile.go b/src/apps/chifra/pkg/types/types_abifile.go deleted file mode 100644 index 6ff2a9a915..0000000000 --- a/src/apps/chifra/pkg/types/types_abifile.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2016, 2024 The TrueBlocks Authors. All rights reserved. -// Use of this source code is governed by a license that can -// be found in the LICENSE file. -/* - * Parts of this file were auto generated. Edit only those parts of - * the code inside of 'EXISTING_CODE' tags. - */ - -package types - -// EXISTING_CODE -import "encoding/json" - -// EXISTING_CODE - -type AbiFile struct { - FileSize int64 `json:"fileSize"` - LastModDate string `json:"lastModDate"` - Name string `json:"name"` - Path string `json:"path"` - // EXISTING_CODE - // EXISTING_CODE -} - -func (s AbiFile) String() string { - bytes, _ := json.Marshal(s) - return string(bytes) -} - -func (s *AbiFile) Model(chain, format string, verbose bool, extraOpts map[string]any) Model { - var model = map[string]any{} - var order = []string{} - - // EXISTING_CODE - model = map[string]any{ - "name": s.Name, - "lastModDate": s.LastModDate, - "fileSize": s.FileSize, - "path": s.Path, - } - order = []string{ - "name", - "lastModDate", - "fileSize", - "path", - } - // EXISTING_CODE - - return Model{ - Data: model, - Order: order, - } -} - -// FinishUnmarshal is used by the cache. It may be unused depending on auto-code-gen -func (s *AbiFile) FinishUnmarshal() { - // EXISTING_CODE - // EXISTING_CODE -} - -// EXISTING_CODE -// EXISTING_CODE diff --git a/src/dev_tools/goMaker/templates/classDefinitions/abifile.toml b/src/dev_tools/goMaker/templates/classDefinitions/abifile.toml deleted file mode 100644 index e81c835e51..0000000000 --- a/src/dev_tools/goMaker/templates/classDefinitions/abifile.toml +++ /dev/null @@ -1,7 +0,0 @@ -[settings] - class = "AbiFile" - doc_group = "05-Other" - doc_descr = "represents an abi file stored in the cache or configuration folders" - doc_route = "512-abiFile" - attributes = "" - produced_by = "abis" diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv index 2a28cd443a..e6569b05ff 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv @@ -1,3 +1,10 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -address ,address , , , 1 ,the address for the ABI -functions ,[]Function , , , 2 ,the functions for this address +name ,type ,strDefault ,attributes ,docOrder ,description +address ,address , , , 1 ,the address for the ABI +name ,string , , , 2 ,the filename of the ABI (likely the smart contract address) +path ,string , , , 3 ,the folder holding the abi file +fileSize ,int64 , , , 4 ,the size of this file on disc +lastModDate ,string , , , 5 ,the last update date of the file +isKnown ,bool , , , 6 ,true if this is the ABI for a known smart contract or protocol +nFunctions ,int64 , , , 7 ,if verbose, the number of functions in the ABI +nEvents ,int64 , , , 8 ,if verbose, the number of events in the ABI +functions ,[]Function , , , 9 ,the functions for this address diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/abifile.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/abifile.csv deleted file mode 100644 index 241600d8bb..0000000000 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/abifile.csv +++ /dev/null @@ -1,5 +0,0 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -path ,string , , , 1 ,the folder holding the abi file -name ,string , , , 2 ,the filename of the ABI (likely the smart contract address) -fileSize ,int64 , , , 3 ,the size of this file on disc -lastModDate ,string , , , 4 ,the last update date of the file diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index d62217d67f..05b97c7d43 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -104,7 +104,7 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 16020,tools,Accounts,abis,grabABI,addrs,,,required|visible|docs,4,positional,list,function,,,,a list of one or more smart contracts whose ABIs to display 16030,tools,Accounts,abis,grabABI,known,k,,visible|docs,,switch,,,,,,load common 'known' ABIs from cache 16040,tools,Accounts,abis,grabABI,proxy_for,r,,visible|docs,,flag,
,,,,,redirects the query to this implementation -16030,tools,Accounts,abis,grabABI,list,l,,visible|docs,2,switch,,abiFile,,,,a list of downloaded abi files +16030,tools,Accounts,abis,grabABI,list,l,,visible|docs,2,switch,,abi,,,,a list of downloaded abi files 16050,tools,Accounts,abis,grabABI,find,f,,visible|docs,1,flag,list,function,,,,search for function or event declarations given a four- or 32-byte code(s) 16060,tools,Accounts,abis,grabABI,hint,n,,visible|docs,,flag,list,,,,,for the --find option only, provide hints to speed up the search 16070,tools,Accounts,abis,grabABI,encode,e,,visible|docs,3,flag,,function,,,,generate the 32-byte encoding for a given cannonical function or event signature diff --git a/src/dev_tools/sdkFuzzer/abis.go b/src/dev_tools/sdkFuzzer/abis.go index 3adfb999c1..ecccc567c9 100644 --- a/src/dev_tools/sdkFuzzer/abis.go +++ b/src/dev_tools/sdkFuzzer/abis.go @@ -130,7 +130,7 @@ func TestAbis(which, value, fn string, opts *sdk.AbisOptions) { if list, _, err := opts.AbisList(); err != nil { ReportError(fn, opts, err) } else { - if err := SaveToFile[types.AbiFile](fn, list); err != nil { + if err := SaveToFile[types.Abi](fn, list); err != nil { ReportError2(fn, err) } else { ReportOkay(fn) From be7364434af9d62d9b7821dce65d3372cc0720ed Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 4 Aug 2024 17:36:50 -0400 Subject: [PATCH 019/121] Removes unused AbiFile type, expands Abi type --- src/apps/chifra/internal/abis/handle_list.go | 55 ++++++++++------- src/apps/chifra/internal/abis/handle_many.go | 28 +++------ src/apps/chifra/internal/abis/handle_show.go | 65 ++++++++++++-------- src/apps/chifra/pkg/types/types_abi.go | 45 +++++++++++--- src/dev_tools/testRunner/testCases/abis.csv | 1 + tests | 2 +- 6 files changed, 117 insertions(+), 79 deletions(-) diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index 7db4325b84..29c20dc0f8 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -5,10 +5,13 @@ package abisPkg import ( + "os" "path/filepath" "strings" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" @@ -18,33 +21,27 @@ import ( func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { chain := opts.Globals.Chain testMode := opts.Globals.TestMode - paths := []string{ - filepath.Join(config.PathToRootConfig(), "abis"), - filepath.Join(config.PathToCache(chain), "abis"), - } - if testMode { - paths = paths[:1] + paths := make([]string, 0, 2) + paths = append(paths, filepath.Join(config.PathToRootConfig(), "abis")) + if !testMode { + paths = append(paths, filepath.Join(config.PathToCache(chain), "abis")) } abiArray := make([]types.Abi, 0, 100) vFunc := func(fn string, vP any) (bool, error) { if strings.HasSuffix(fn, ".json") { - // info, _ := os.Stat(fn) - // date := info.ModTime().Format("2006-01-02 15:04:05") - // if testMode { - // date = "--date--" - // } - // abiFile := types.Abi{ - // FileSize: file.FileSize(fn), - // LastModDate: date, - // } - // abiFile.Path, abiFile.Name = filepath.Split(fn) - // if testMode { - // abiFile.Path = strings.ReplaceAll(abiFile.Path, config.PathToRootConfig(), "./") - // } - // if len(abiFile.Name) > 0 { - // abiArray = append(abiArray, abiFile) - // } + info, _ := os.Stat(fn) + abi := types.Abi{ + FileSize: file.FileSize(fn), + LastModDate: info.ModTime().Format("2006-01-02 15:04:05"), + IsKnown: strings.Contains(fn, "known"), + } + abi.Path, abi.Name = filepath.Split(fn) + abi.Address = base.HexToAddress(strings.Replace(abi.Name, ".json", "", -1)) + + if len(abi.Name) > 0 { + abiArray = append(abiArray, abi) + } } return true, nil } @@ -55,9 +52,21 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { fetchData := func(modelChan chan types.Modeler, errorChan chan error) { for _, abi := range abiArray { + if opts.Globals.Verbose { + contents := file.AsciiFileToString(filepath.Join(abi.Path, abi.Name)) + abi.NFunctions = int64(strings.Count(contents, "\"function\"")) + abi.NEvents = int64(strings.Count(contents, "\"event\"")) + } + if testMode { + abi.LastModDate = "--date--" + abi.Path = strings.ReplaceAll(abi.Path, config.PathToRootConfig(), "./") + } modelChan <- &abi } } - return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) + extraOpts := map[string]any{ + "list": true, + } + return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOptsWithExtra(extraOpts)) } diff --git a/src/apps/chifra/internal/abis/handle_many.go b/src/apps/chifra/internal/abis/handle_many.go index 0c2d9b1961..150cb69940 100644 --- a/src/apps/chifra/internal/abis/handle_many.go +++ b/src/apps/chifra/internal/abis/handle_many.go @@ -3,10 +3,7 @@ package abisPkg import ( "errors" "fmt" - "sort" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/abi" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/articulate" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" @@ -16,36 +13,25 @@ import ( func (opts *AbisOptions) HandleMany(rCtx *output.RenderCtx) (err error) { fetchData := func(modelChan chan types.Modeler, errorChan chan error) { for _, addr := range opts.Addrs { - abiCache := articulate.NewAbiCache(opts.Conn, opts.Known) - address := base.HexToAddress(addr) - proxy := base.HexToAddress(opts.ProxyFor) - if !proxy.IsZero() { - address = proxy - } - err = abi.LoadAbi(opts.Conn, address, &abiCache.AbiMap) + functions, which, err := opts.LoadAbis([]string{addr}, false /* known */) if err != nil { if errors.Is(err, rpc.ErrNotAContract) { - msg := fmt.Errorf("address %s is not a smart contract", address.Hex()) + msg := fmt.Errorf("address %s is not a smart contract", which) errorChan <- msg // Report but don't quit processing } else { // Cancel on all other errors errorChan <- err rCtx.Cancel() + // } else if len(opts.ProxyFor) > 0 { + // TODO: We need to copy the proxied-to ABI to the proxy (replacing) } - // } else if len(opts.ProxyFor) > 0 { - // TODO: We need to copy the proxied-to ABI to the proxy (replacing) } abi := types.Abi{} - abi.Address = address - names := abiCache.AbiMap.Keys() - sort.Strings(names) - for _, name := range names { - function := abiCache.AbiMap.GetValue(name) - if function != nil { - abi.Functions = append(abi.Functions, *function) - } + abi.Address = base.HexToAddress(addr) + for _, f := range functions { + abi.Functions = append(abi.Functions, *f) } modelChan <- &abi } diff --git a/src/apps/chifra/internal/abis/handle_show.go b/src/apps/chifra/internal/abis/handle_show.go index b613a7014f..a8239df28b 100644 --- a/src/apps/chifra/internal/abis/handle_show.go +++ b/src/apps/chifra/internal/abis/handle_show.go @@ -18,40 +18,53 @@ func (opts *AbisOptions) HandleShow(rCtx *output.RenderCtx) (err error) { return opts.HandleMany(rCtx) } - abiCache := articulate.NewAbiCache(opts.Conn, opts.Known) - fetchData := func(modelChan chan types.Modeler, errorChan chan error) { - // Note here, that known ABIs are not downloaded. They are only loaded from the local cache. - for _, addr := range opts.Addrs { - address := base.HexToAddress(addr) - proxy := base.HexToAddress(opts.ProxyFor) - if !proxy.IsZero() { - address = proxy - } - err = abi.LoadAbi(opts.Conn, address, &abiCache.AbiMap) - if err != nil { - if errors.Is(err, rpc.ErrNotAContract) { - msg := fmt.Errorf("address %s is not a smart contract", address.Hex()) - errorChan <- msg - // Report but don't quit processing - } else { - // Cancel on all other errors - errorChan <- err - rCtx.Cancel() - } + functions, which, err := opts.LoadAbis(opts.Addrs, false /* known */) + if err != nil { + if errors.Is(err, rpc.ErrNotAContract) { + msg := fmt.Errorf("address %s is not a smart contract", which) + errorChan <- msg + // Report but don't quit processing + } else { + // Cancel on all other errors + errorChan <- err + rCtx.Cancel() // } else if len(opts.ProxyFor) > 0 { // TODO: We need to copy the proxied-to ABI to the proxy (replacing) } } - names := abiCache.AbiMap.Keys() - sort.Strings(names) - - for _, name := range names { - function := abiCache.AbiMap.GetValue(name) - modelChan <- function + for _, f := range functions { + modelChan <- f } } return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) } + +func (opts *AbisOptions) LoadAbis(addrs []string, loadKnown bool) ([]*types.Function, string, error) { + abiCache := articulate.NewAbiCache(opts.Conn, opts.Known) + for _, addr := range addrs { + address := base.HexToAddress(addr) + proxy := base.HexToAddress(opts.ProxyFor) + if !proxy.IsZero() { + address = proxy + } + err := abi.LoadAbi(opts.Conn, address, &abiCache.AbiMap) + if err != nil { + return []*types.Function{}, address.Hex(), err + } + } + + names := abiCache.AbiMap.Keys() + sort.Strings(names) + + var funcs = make([]*types.Function, 0, len(names)) + for _, name := range names { + f := abiCache.AbiMap.GetValue(name) + if f != nil { + funcs = append(funcs, f) + } + } + return funcs, "", nil +} diff --git a/src/apps/chifra/pkg/types/types_abi.go b/src/apps/chifra/pkg/types/types_abi.go index 894e49e40f..09f312057f 100644 --- a/src/apps/chifra/pkg/types/types_abi.go +++ b/src/apps/chifra/pkg/types/types_abi.go @@ -41,14 +41,43 @@ func (s *Abi) Model(chain, format string, verbose bool, extraOpts map[string]any var order = []string{} // EXISTING_CODE - model[s.Address.Hex()] = s.Functions - order = append(order, s.Address.Hex()) - if name, loaded, found := nameAddress(extraOpts, s.Address); found { - model["addressName"] = name.Name - order = append(order, "addressName") - } else if loaded && format != "json" { - model["addressName"] = "" - order = append(order, "addressName") + if extraOpts["list"] == true { + model = map[string]any{ + "name": s.Name, + "lastModDate": s.LastModDate, + "fileSize": s.FileSize, + "isKnown": s.IsKnown, + } + order = []string{ + "name", + "lastModDate", + "fileSize", + "isKnown", + } + if !s.Address.IsZero() { + model["address"] = s.Address + order = append([]string{"address"}, order...) + } + + if verbose { + model["nFunctions"] = s.NFunctions + order = append(order, "nFunctions") + model["nEvents"] = s.NEvents + order = append(order, "nEvents") + model["path"] = s.Path + order = append(order, "path") + } + + } else { + model[s.Address.Hex()] = s.Functions + order = append(order, s.Address.Hex()) + if name, loaded, found := nameAddress(extraOpts, s.Address); found { + model["addressName"] = name.Name + order = append(order, "addressName") + } else if loaded && format != "json" { + model["addressName"] = "" + order = append(order, "addressName") + } } order = reorderOrdering(order) // EXISTING_CODE diff --git a/src/dev_tools/testRunner/testCases/abis.csv b/src/dev_tools/testRunner/testCases/abis.csv index 98a0f71002..d5c7688aff 100644 --- a/src/dev_tools/testRunner/testCases/abis.csv +++ b/src/dev_tools/testRunner/testCases/abis.csv @@ -65,6 +65,7 @@ on ,both ,fast ,abis ,tools ,grabABI ,no_abi_found_2 ,y ,addrs = on ,both ,fast ,abis ,tools ,grabABI ,clean_alone ,y ,decache on ,both ,fast ,abis ,tools ,grabABI ,list ,y ,list +on ,both ,fast ,abis ,tools ,grabABI ,list_verbose ,y ,list & verbose # Reports inconsistent results on subsequent runs delay ,both ,fast ,abis ,tools ,grabABI ,findSig_a_lot ,n ,find = 0xea8a1af0 & find = 0x9a82a09a & find = 0x52efea6e & find = 0xd0e30db0 & find = 0x83197ef0 & find = 0x12fa6feb & find = 0x3d6a71e4 & find = 0x31ae450b & find = 0x06fdde03 & find = 0x8da5cb5b & find = 0x1aa3a008 & find = 0x2de40ce3 & find = 0x9d76ea58 & find = 0xad7a672f & find = 0x3ccfd60b & find = 0xf5074f41 & find = 0x24d7806c & find = 0xc3c5a547 & find = 0x09e69ede & find = 0xf2fde38b & find = 0xc2a2ce06 & find = 0xfdacd576 & fmt = csv diff --git a/tests b/tests index 37878835cb..358bed5808 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 37878835cb98b330d7c50336fd4c3e3230562ea4 +Subproject commit 358bed5808d8eb574b860f68638fe6099b583a09 From b02cd634e55db079d525c86755b7f1869093797c Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 4 Aug 2024 17:40:16 -0400 Subject: [PATCH 020/121] Removes unused AbiFile type, expands Abi type --- src/apps/chifra/internal/abis/handle_list.go | 4 +++- tests | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index 29c20dc0f8..208dd3e2c7 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -37,7 +37,9 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { IsKnown: strings.Contains(fn, "known"), } abi.Path, abi.Name = filepath.Split(fn) - abi.Address = base.HexToAddress(strings.Replace(abi.Name, ".json", "", -1)) + if strings.HasPrefix(abi.Name, "0x") { + abi.Address = base.HexToAddress(strings.Replace(abi.Name, ".json", "", -1)) + } if len(abi.Name) > 0 { abiArray = append(abiArray, abi) diff --git a/tests b/tests index 358bed5808..d0710bef13 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 358bed5808d8eb574b860f68638fe6099b583a09 +Subproject commit d0710bef13ee51ccbbd29874e65a7ab18b93f220 From 808be4c5e611f79c054ff1b84e86398e74280e74 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 4 Aug 2024 21:55:36 -0400 Subject: [PATCH 021/121] Moves Parts from names package to types package because we need it in the uI --- examples/withStreaming/main.go | 2 +- src/apps/chifra/internal/globals/output.go | 9 +-- src/apps/chifra/internal/names/crud.go | 20 +++--- .../chifra/internal/names/handle_autoname.go | 2 +- .../chifra/internal/names/handle_clean.go | 4 +- .../names/handle_clean_integration_test.go | 4 +- src/apps/chifra/internal/names/handle_show.go | 3 +- src/apps/chifra/internal/names/handle_tags.go | 3 +- src/apps/chifra/internal/names/names_array.go | 12 ++-- .../chifra/internal/tokens/handle_parts.go | 2 +- .../chifra/internal/tokens/handle_show.go | 2 +- src/apps/chifra/pkg/ledger/ledger.go | 2 +- src/apps/chifra/pkg/names/custom.go | 8 +-- .../pkg/names/custom_integration_test.go | 2 +- src/apps/chifra/pkg/names/names.go | 63 ++++++++----------- src/apps/chifra/pkg/names/regular.go | 9 +-- src/apps/chifra/pkg/names/search.go | 8 +-- src/apps/chifra/pkg/types/types_name.go | 28 +++++++++ .../pkg/uniq/uniq_appearances_details.go | 2 +- 19 files changed, 99 insertions(+), 86 deletions(-) diff --git a/examples/withStreaming/main.go b/examples/withStreaming/main.go index 20ed634a58..f61bf004d6 100644 --- a/examples/withStreaming/main.go +++ b/examples/withStreaming/main.go @@ -7,7 +7,7 @@ import ( ) func main() { - namesMap, _ = names.LoadNamesMap("mainnet", names.Custom|names.Prefund|names.Regular, nil) + namesMap, _ = names.LoadNamesMap("mainnet", types.Custom|types.Prefund|types.Regular, nil) TestStreamAbis() TestStreamBlocks() diff --git a/src/apps/chifra/internal/globals/output.go b/src/apps/chifra/internal/globals/output.go index 367eebe432..1dbd50085d 100644 --- a/src/apps/chifra/internal/globals/output.go +++ b/src/apps/chifra/internal/globals/output.go @@ -8,6 +8,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/names" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" ) @@ -17,9 +18,9 @@ func (opts *GlobalOptions) OutputOpts() output.OutputOptions { "testMode": opts.TestMode, } if opts.ShouldLoadNames(false) { - parts := names.Custom | names.Prefund | names.Regular + parts := types.Custom | types.Prefund | types.Regular if opts.TestMode { - parts |= names.Testing + parts |= types.Testing } if namesMap, err := names.LoadNamesMap(opts.Chain, parts, nil); err == nil { extraOpts["namesMap"] = namesMap @@ -45,9 +46,9 @@ func (opts *GlobalOptions) OutputOptsWithExtra(extraOpts map[string]any) output. extraOpts["ether"] = opts.Ether extraOpts["testMode"] = opts.TestMode if opts.ShouldLoadNames(false) { - parts := names.Custom | names.Prefund | names.Regular + parts := types.Custom | types.Prefund | types.Regular if opts.TestMode { - parts |= names.Testing + parts |= types.Testing } if namesMap, err := names.LoadNamesMap(opts.Chain, parts, nil); err == nil { extraOpts["namesMap"] = namesMap diff --git a/src/apps/chifra/internal/names/crud.go b/src/apps/chifra/internal/names/crud.go index 1533c60d6d..9ad99ac1e9 100644 --- a/src/apps/chifra/internal/names/crud.go +++ b/src/apps/chifra/internal/names/crud.go @@ -14,38 +14,38 @@ import ( "os" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/names" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) -func (opts *NamesOptions) getType() names.Parts { - var ret names.Parts +func (opts *NamesOptions) getType() types.Parts { + var ret types.Parts if opts.Custom || opts.All || opts.anyCrud() { - ret |= names.Custom + ret |= types.Custom } if opts.Prefund || opts.All { - ret |= names.Prefund + ret |= types.Prefund } if (!opts.Custom && !opts.Prefund) || opts.All { - ret |= names.Regular + ret |= types.Regular } if opts.MatchCase { - ret |= names.MatchCase + ret |= types.MatchCase } if opts.Expand { - ret |= names.Expanded + ret |= types.Expanded } if opts.Tags { - ret |= names.Tags + ret |= types.Tags } if opts.Globals.TestMode { - ret |= names.Testing + ret |= types.Testing } return ret diff --git a/src/apps/chifra/internal/names/handle_autoname.go b/src/apps/chifra/internal/names/handle_autoname.go index f4ea55faa4..99e9bfc42e 100644 --- a/src/apps/chifra/internal/names/handle_autoname.go +++ b/src/apps/chifra/internal/names/handle_autoname.go @@ -82,7 +82,7 @@ func (opts *NamesOptions) readContractAndClean(s string) (name *types.Name, err return } - if _, err = names.LoadNamesMap(chain, names.Custom, []string{}); err != nil { + if _, err = names.LoadNamesMap(chain, types.Custom, []string{}); err != nil { return } diff --git a/src/apps/chifra/internal/names/handle_clean.go b/src/apps/chifra/internal/names/handle_clean.go index ceade25ca2..d08aaae7f2 100644 --- a/src/apps/chifra/internal/names/handle_clean.go +++ b/src/apps/chifra/internal/names/handle_clean.go @@ -67,9 +67,9 @@ func (opts *NamesOptions) HandleClean(rCtx *output.RenderCtx) error { func (opts *NamesOptions) cleanNames() (int, error) { chain := opts.Globals.Chain - parts := names.Custom + parts := types.Custom if opts.Regular { - parts = names.Regular + parts = types.Regular } // Load databases diff --git a/src/apps/chifra/internal/names/handle_clean_integration_test.go b/src/apps/chifra/internal/names/handle_clean_integration_test.go index 496fd442f2..c30bcb509e 100644 --- a/src/apps/chifra/internal/names/handle_clean_integration_test.go +++ b/src/apps/chifra/internal/names/handle_clean_integration_test.go @@ -194,7 +194,7 @@ var benchmarkLimit = 50 func BenchmarkCleanSync(b *testing.B) { chain := utils.GetTestChain() - parts := names.Regular + parts := types.Regular for i := 0; i < b.N; i++ { b.StopTimer() @@ -241,7 +241,7 @@ func BenchmarkCleanSync(b *testing.B) { func BenchmarkCleanConcurrent(b *testing.B) { chain := utils.GetTestChain() - parts := names.Regular + parts := types.Regular for i := 0; i < b.N; i++ { b.StopTimer() diff --git a/src/apps/chifra/internal/names/handle_show.go b/src/apps/chifra/internal/names/handle_show.go index d56315071d..9c3bdc719d 100644 --- a/src/apps/chifra/internal/names/handle_show.go +++ b/src/apps/chifra/internal/names/handle_show.go @@ -5,7 +5,6 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/names" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) @@ -13,7 +12,7 @@ import ( func (opts *NamesOptions) HandleShow(rCtx *output.RenderCtx) error { chain := opts.Globals.Chain testMode := opts.Globals.TestMode - namesArray, err := loadNamesArray(chain, opts.getType(), names.SortByAddress, opts.Terms) + namesArray, err := loadNamesArray(chain, opts.getType(), types.SortByAddress, opts.Terms) if err != nil { return err } diff --git a/src/apps/chifra/internal/names/handle_tags.go b/src/apps/chifra/internal/names/handle_tags.go index d91d87b4b8..4b270ea78e 100644 --- a/src/apps/chifra/internal/names/handle_tags.go +++ b/src/apps/chifra/internal/names/handle_tags.go @@ -4,14 +4,13 @@ import ( "os" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/names" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) func (opts *NamesOptions) HandleTags(rCtx *output.RenderCtx) error { chain := opts.Globals.Chain - namesArray, err := loadNamesArray(chain, opts.getType(), names.SortByTags, opts.Terms) + namesArray, err := loadNamesArray(chain, opts.getType(), types.SortByTags, opts.Terms) if err != nil { return err } diff --git a/src/apps/chifra/internal/names/names_array.go b/src/apps/chifra/internal/names/names_array.go index 23da37c858..c745d26f69 100644 --- a/src/apps/chifra/internal/names/names_array.go +++ b/src/apps/chifra/internal/names/names_array.go @@ -10,14 +10,14 @@ import ( ) // loadNamesArray loads the names from the cache and returns an array of names -func loadNamesArray(chain string, parts names.Parts, sortBy names.SortBy, terms []string) ([]types.Name, error) { +func loadNamesArray(chain string, parts types.Parts, sortBy types.SortBy, terms []string) ([]types.Name, error) { var ret []types.Name if namesMap, err := names.LoadNamesMap(chain, parts, terms); err != nil { return nil, err } else { for _, name := range namesMap { // Custom names with Individual tag or tags under 30 are private during testing - isTesting := parts&names.Testing != 0 + isTesting := parts&types.Testing != 0 isPrivate := strings.Contains(name.Tags, "Individual") || (name.IsCustom && name.Tags < "3") if !isTesting || !isPrivate { ret = append(ret, name) @@ -27,17 +27,17 @@ func loadNamesArray(chain string, parts names.Parts, sortBy names.SortBy, terms sort.Slice(ret, func(i, j int) bool { switch sortBy { - case names.SortByTags: + case types.SortByTags: return ret[i].Tags < ret[j].Tags - case names.SortByAddress: + case types.SortByAddress: fallthrough default: return ret[i].Address.Hex() < ret[j].Address.Hex() } }) - isTesting := parts&names.Testing != 0 - isTags := sortBy == names.SortByTags + isTesting := parts&types.Testing != 0 + isTags := sortBy == types.SortByTags if isTesting && !isTags { ret = ret[:base.Min(200, len(ret))] } diff --git a/src/apps/chifra/internal/tokens/handle_parts.go b/src/apps/chifra/internal/tokens/handle_parts.go index a68a36bcb9..1122062a31 100644 --- a/src/apps/chifra/internal/tokens/handle_parts.go +++ b/src/apps/chifra/internal/tokens/handle_parts.go @@ -58,7 +58,7 @@ func (opts *TokensOptions) HandleParts(rCtx *output.RenderCtx) error { "parts": opts.Parts, } if opts.Globals.ShouldLoadNames(true) { - parts := names.Custom | names.Prefund | names.Regular + parts := types.Custom | types.Prefund | types.Regular if namesMap, err := names.LoadNamesMap(chain, parts, nil); err != nil { return err } else { diff --git a/src/apps/chifra/internal/tokens/handle_show.go b/src/apps/chifra/internal/tokens/handle_show.go index 1fd4f39d66..1420f943e9 100644 --- a/src/apps/chifra/internal/tokens/handle_show.go +++ b/src/apps/chifra/internal/tokens/handle_show.go @@ -61,7 +61,7 @@ func (opts *TokensOptions) HandleShow(rCtx *output.RenderCtx) error { "parts": []string{"all_held"}, } if opts.Globals.ShouldLoadNames(true) { - parts := names.Custom | names.Prefund | names.Regular + parts := types.Custom | types.Prefund | types.Regular if namesMap, err := names.LoadNamesMap(chain, parts, nil); err != nil { return err } else { diff --git a/src/apps/chifra/pkg/ledger/ledger.go b/src/apps/chifra/pkg/ledger/ledger.go index dce654eb9c..de8eedf310 100644 --- a/src/apps/chifra/pkg/ledger/ledger.go +++ b/src/apps/chifra/pkg/ledger/ledger.go @@ -53,7 +53,7 @@ func NewLedger(conn *rpc.Connection, acctFor base.Address, fb, lb base.Blknum, a l.assetFilter = []base.Address{} } - parts := names.Custom | names.Prefund | names.Regular + parts := types.Custom | types.Prefund | types.Regular l.Names, _ = names.LoadNamesMap(conn.Chain, parts, []string{}) return l diff --git a/src/apps/chifra/pkg/names/custom.go b/src/apps/chifra/pkg/names/custom.go index b9213074a9..046b212f28 100644 --- a/src/apps/chifra/pkg/names/custom.go +++ b/src/apps/chifra/pkg/names/custom.go @@ -17,7 +17,7 @@ var customNamesLoaded = false var customNames map[base.Address]types.Name = map[base.Address]types.Name{} var customNamesMutex sync.Mutex -func loadCustomMap(chain string, terms []string, parts Parts, namesMap *map[base.Address]types.Name) (err error) { +func loadCustomMap(chain string, terms []string, parts types.Parts, namesMap *map[base.Address]types.Name) (err error) { if customNamesLoaded { // We have already loaded the data for _, name := range customNames { @@ -43,13 +43,13 @@ func loadCustomMap(chain string, terms []string, parts Parts, namesMap *map[base if err != nil { return err } - if parts&Testing != 0 { + if parts&types.Testing != 0 { loadTestNames(terms, parts, &customNames, namesMap) } return } -func unmarshallCustomNames(source io.Reader, terms []string, parts Parts, namesMap *map[base.Address]types.Name) (customNames map[base.Address]types.Name, err error) { +func unmarshallCustomNames(source io.Reader, terms []string, parts types.Parts, namesMap *map[base.Address]types.Name) (customNames map[base.Address]types.Name, err error) { customNames = map[base.Address]types.Name{} var reader NameReader @@ -81,7 +81,7 @@ func unmarshallCustomNames(source io.Reader, terms []string, parts Parts, namesM return } -func loadTestNames(terms []string, parts Parts, all *map[base.Address]types.Name, namesMap *map[base.Address]types.Name) { +func loadTestNames(terms []string, parts types.Parts, all *map[base.Address]types.Name, namesMap *map[base.Address]types.Name) { for i := 1; i < 5; i++ { addressStr := fmt.Sprintf("0x%040d", i) num := fmt.Sprintf("%d", i) diff --git a/src/apps/chifra/pkg/names/custom_integration_test.go b/src/apps/chifra/pkg/names/custom_integration_test.go index 49f4603aad..69a7c6541d 100644 --- a/src/apps/chifra/pkg/names/custom_integration_test.go +++ b/src/apps/chifra/pkg/names/custom_integration_test.go @@ -144,7 +144,7 @@ func TestCrudIntegration(t *testing.T) { // Check what was written to the file tempFile = loadTestDatabase() - testDb, err := unmarshallCustomNames(tempFile, nil, Parts(Custom), &map[base.Address]types.Name{}) + testDb, err := unmarshallCustomNames(tempFile, nil, types.Custom, &map[base.Address]types.Name{}) if err != nil && !errors.Is(err, io.EOF) { t.Fatal("remove: unmarshallCustomNames:", err) } diff --git a/src/apps/chifra/pkg/names/names.go b/src/apps/chifra/pkg/names/names.go index a0cf29782f..e489348149 100644 --- a/src/apps/chifra/pkg/names/names.go +++ b/src/apps/chifra/pkg/names/names.go @@ -15,59 +15,48 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) -type Parts int - -// Parts is a bitfield that defines what parts of a name to return and other options -const ( - None Parts = (1 << iota) - Regular - Custom - Prefund - Baddress - Testing - MatchCase - Expanded - Tags -) - -type SortBy int - -// SortBy is a bitfield that defines how to sort the names -const ( - SortByAddress SortBy = iota - SortByTags -) - // LoadNamesMap loads the names from the cache and returns a map of names -func LoadNamesMap(chain string, parts Parts, terms []string) (map[base.Address]types.Name, error) { +func LoadNamesMap(chain string, parts types.Parts, terms []string) (map[base.Address]types.Name, error) { namesMap := map[base.Address]types.Name{} // Load the prefund names first... - if parts&Prefund != 0 { - prefundPath := prefunds.GetPrefundPath(chain) - if prefundMap, err := prefunds.LoadPrefundMap(chain, prefundPath); err != nil { - return namesMap, err - } else { - for k, v := range *prefundMap { - if doSearch(&v, terms, parts) { - namesMap[k] = v - } - } - } + if parts&types.Prefund != 0 { + _ = loadPrefundMap(chain, terms, parts, &namesMap) } - if parts&Regular != 0 { + // Overlay them with regular names if present + if parts&types.Regular != 0 { _ = loadRegularMap(chain, terms, parts, &namesMap) } + // Add in the baddresses + if parts&types.Baddress != 0 { + loadKnownBadresses(chain, terms, parts, &namesMap) + } + // Load the custom names (note that these may overwrite the prefund and regular names) - if parts&Custom != 0 { + if parts&types.Custom != 0 { _ = loadCustomMap(chain, terms, parts, &namesMap) } return namesMap, nil } +// loadPrefundMap loads the prefund names from the cache +func loadPrefundMap(chain string, terms []string, parts types.Parts, ret *map[base.Address]types.Name) error { + prefundPath := prefunds.GetPrefundPath(chain) + if prefundMap, err := prefunds.LoadPrefundMap(chain, prefundPath); err != nil { + return err + } else { + for k, v := range *prefundMap { + if doSearch(&v, terms, parts) { + (*ret)[k] = v + } + } + } + return nil +} + // ClearCache removes names that are cached in-memory func ClearCache() { regularNamesMutex.Lock() diff --git a/src/apps/chifra/pkg/names/regular.go b/src/apps/chifra/pkg/names/regular.go index a27ed82fa3..b58de34df7 100644 --- a/src/apps/chifra/pkg/names/regular.go +++ b/src/apps/chifra/pkg/names/regular.go @@ -14,7 +14,7 @@ var regularNames = map[base.Address]types.Name{} var regularNamesMutex sync.Mutex // loadRegularMap loads the regular names from the cache -func loadRegularMap(chain string, terms []string, parts Parts, ret *map[base.Address]types.Name) error { +func loadRegularMap(chain string, terms []string, parts types.Parts, ret *map[base.Address]types.Name) error { if regularNamesLoaded { for _, name := range regularNames { if doSearch(&name, terms, parts) { @@ -55,15 +55,11 @@ func loadRegularMap(chain string, terms []string, parts Parts, ret *map[base.Add } } - if parts&Baddress != 0 { - loadKnownBadresses(terms, parts, ret) - } - return nil } // loadKnownBadresses loads the known bad addresses from the cache -func loadKnownBadresses(terms []string, parts Parts, ret *map[base.Address]types.Name) { +func loadKnownBadresses(unused string, terms []string, parts types.Parts, ret *map[base.Address]types.Name) error { knownBadAddresses := []types.Name{ { Address: base.PrefundSender, @@ -91,4 +87,5 @@ func loadKnownBadresses(terms []string, parts Parts, ret *map[base.Address]types (*ret)[n.Address] = n } } + return nil } diff --git a/src/apps/chifra/pkg/names/search.go b/src/apps/chifra/pkg/names/search.go index 34b23d7675..06cd350f9d 100644 --- a/src/apps/chifra/pkg/names/search.go +++ b/src/apps/chifra/pkg/names/search.go @@ -6,23 +6,23 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) -func doSearch(name *types.Name, terms []string, parts Parts) bool { +func doSearch(name *types.Name, terms []string, parts types.Parts) bool { if len(terms) == 0 { return true } cnt := 0 searchStr := name.Name + "\t" + name.Symbol + "\t" + name.Address.Hex() + "\t" + name.Tags - if parts&Expanded != 0 { + if parts&types.Expanded != 0 { searchStr += "\t" + name.Source } - if parts&Tags != 0 { + if parts&types.Tags != 0 { // only search tags searchStr = name.Tags } verb := "(?i)" - if parts&MatchCase != 0 { + if parts&types.MatchCase != 0 { verb = "(?)" } for _, term := range terms { diff --git a/src/apps/chifra/pkg/types/types_name.go b/src/apps/chifra/pkg/types/types_name.go index f7a01d21ef..eaaf3404e8 100644 --- a/src/apps/chifra/pkg/types/types_name.go +++ b/src/apps/chifra/pkg/types/types_name.go @@ -33,6 +33,7 @@ type Name struct { Tags string `json:"tags"` // EXISTING_CODE Prefund base.Wei `json:"prefund,omitempty"` + Parts Parts `json:"parts,omitempty"` // EXISTING_CODE } @@ -163,6 +164,10 @@ func (s *Name) Model(chain, format string, verbose bool, extraOpts map[string]an model["isErc721"] = true order = append(order, "isErc721") } + if s.Parts != 0 && s.Parts != None { + model["parts"] = s.Parts + order = append(order, "parts") + } } else { if len(s.Symbol) == 0 { model["symbol"] = "" @@ -202,4 +207,27 @@ func (s *Name) FinishUnmarshal() { } // EXISTING_CODE +type Parts int + +// Parts is a bitfield that defines what parts of a name to return and other options +const ( + None Parts = (1 << iota) + Regular + Custom + Prefund + Baddress + Testing + MatchCase + Expanded + Tags +) + +type SortBy int + +// SortBy is a bitfield that defines how to sort the names +const ( + SortByAddress SortBy = iota + SortByTags +) + // EXISTING_CODE diff --git a/src/apps/chifra/pkg/uniq/uniq_appearances_details.go b/src/apps/chifra/pkg/uniq/uniq_appearances_details.go index 98380d8e9c..b44ba48381 100644 --- a/src/apps/chifra/pkg/uniq/uniq_appearances_details.go +++ b/src/apps/chifra/pkg/uniq/uniq_appearances_details.go @@ -32,7 +32,7 @@ func GetUniqAddressesInBlock(chain, flow string, conn *rpc.Connection, procFunc addrMap := AddressBooleanMap{} traceid := base.NOPOSN if bn == 0 { - if namesMap, err := names.LoadNamesMap(chain, names.Prefund, []string{}); err != nil { + if namesMap, err := names.LoadNamesMap(chain, types.Prefund, []string{}); err != nil { return err } else { namesArray := make([]*types.Name, 0, len(namesMap)) From 5e7d96a01813844a806e0700f5c318fb366843c0 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 4 Aug 2024 21:57:18 -0400 Subject: [PATCH 022/121] Removes unused AbiFile type, expands Abi type --- src/apps/chifra/pkg/names/names.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/chifra/pkg/names/names.go b/src/apps/chifra/pkg/names/names.go index e489348149..0c19fa378e 100644 --- a/src/apps/chifra/pkg/names/names.go +++ b/src/apps/chifra/pkg/names/names.go @@ -31,7 +31,7 @@ func LoadNamesMap(chain string, parts types.Parts, terms []string) (map[base.Add // Add in the baddresses if parts&types.Baddress != 0 { - loadKnownBadresses(chain, terms, parts, &namesMap) + _ = loadKnownBadresses(chain, terms, parts, &namesMap) } // Load the custom names (note that these may overwrite the prefund and regular names) From a111c95a2bb9fdf514d53786e42a5534eb9dbd7b Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 4 Aug 2024 22:56:46 -0400 Subject: [PATCH 023/121] Cleaning lint --- src/apps/chifra/pkg/names/regular.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apps/chifra/pkg/names/regular.go b/src/apps/chifra/pkg/names/regular.go index b58de34df7..5c0e777204 100644 --- a/src/apps/chifra/pkg/names/regular.go +++ b/src/apps/chifra/pkg/names/regular.go @@ -60,6 +60,7 @@ func loadRegularMap(chain string, terms []string, parts types.Parts, ret *map[ba // loadKnownBadresses loads the known bad addresses from the cache func loadKnownBadresses(unused string, terms []string, parts types.Parts, ret *map[base.Address]types.Name) error { + _ = unused knownBadAddresses := []types.Name{ { Address: base.PrefundSender, From 1d55704a774c7a523afee1cc09629566815a2b68 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Mon, 5 Aug 2024 09:02:21 -0400 Subject: [PATCH 024/121] Adds name to monitor type and makes marshable --- docs | 2 +- sdk/typescript/src/types/monitor.ts | 1 + src/apps/chifra/pkg/monitor/monitor_test.go | 4 +- src/apps/chifra/pkg/types/types_monitor.go | 77 +++++++++++++++++++ .../classDefinitions/fields/monitor.csv | 9 ++- .../templates/classDefinitions/monitor.toml | 1 + 6 files changed, 87 insertions(+), 7 deletions(-) diff --git a/docs b/docs index ce5748d93b..c88475e809 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ce5748d93b79299e88fb608074020e143b41e07b +Subproject commit c88475e809d9b5f7b3f36a8a04a0a7d8cf202d25 diff --git a/sdk/typescript/src/types/monitor.ts b/sdk/typescript/src/types/monitor.ts index ab1a1a2a83..acc080d416 100644 --- a/sdk/typescript/src/types/monitor.ts +++ b/sdk/typescript/src/types/monitor.ts @@ -16,4 +16,5 @@ export type Monitor = { fileSize: int64 lastScanned: uint64 nRecords: int64 + name: string } diff --git a/src/apps/chifra/pkg/monitor/monitor_test.go b/src/apps/chifra/pkg/monitor/monitor_test.go index d441577b4a..f90ab39e7b 100644 --- a/src/apps/chifra/pkg/monitor/monitor_test.go +++ b/src/apps/chifra/pkg/monitor/monitor_test.go @@ -32,7 +32,7 @@ func Test_Monitor_Print(t *testing.T) { // The monitor should report that it has two appearances got := testClean(fmt.Sprintln(mon.toJson())) - expected := "{\"address\":\"0x049029dd41661e58f99271a0112dfd34695f7000\",\"deleted\":false,\"fileSize\":56,\"lastScanned\":2002003,\"nRecords\":6}" + expected := "{\"address\":\"0x049029dd41661e58f99271a0112dfd34695f7000\",\"deleted\":false,\"fileSize\":56,\"lastScanned\":2002003,\"nRecords\":6,\"name\":\"\"}" if got != expected { t.Error("Expected:", expected, "Got:", got) } @@ -118,7 +118,7 @@ func Test_Monitor_Delete(t *testing.T) { // The monitor should report that it has two appearances got := testClean(fmt.Sprintln(mon.toJson())) - expected := "{\"address\":\"0x049029dd41661e58f99271a0112dfd34695f7000\",\"deleted\":false,\"fileSize\":32,\"lastScanned\":2002003,\"nRecords\":3}" + expected := "{\"address\":\"0x049029dd41661e58f99271a0112dfd34695f7000\",\"deleted\":false,\"fileSize\":32,\"lastScanned\":2002003,\"nRecords\":3,\"name\":\"\"}" if got != expected { t.Error("Expected:", expected, "Got:", got) } diff --git a/src/apps/chifra/pkg/types/types_monitor.go b/src/apps/chifra/pkg/types/types_monitor.go index 1676404f0a..c171d764b1 100644 --- a/src/apps/chifra/pkg/types/types_monitor.go +++ b/src/apps/chifra/pkg/types/types_monitor.go @@ -11,8 +11,10 @@ package types // EXISTING_CODE import ( "encoding/json" + "io" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/cache" ) // EXISTING_CODE @@ -23,6 +25,7 @@ type Monitor struct { FileSize int64 `json:"fileSize"` LastScanned uint32 `json:"lastScanned"` NRecords int64 `json:"nRecords"` + Name string `json:"name"` // EXISTING_CODE // EXISTING_CODE } @@ -77,6 +80,80 @@ func (s *Monitor) Model(chain, format string, verbose bool, extraOpts map[string } } +func (s *Monitor) MarshalCache(writer io.Writer) (err error) { + // Address + if err = cache.WriteValue(writer, s.Address); err != nil { + return err + } + + // Deleted + if err = cache.WriteValue(writer, s.Deleted); err != nil { + return err + } + + // FileSize + if err = cache.WriteValue(writer, s.FileSize); err != nil { + return err + } + + // LastScanned + if err = cache.WriteValue(writer, s.LastScanned); err != nil { + return err + } + + // NRecords + if err = cache.WriteValue(writer, s.NRecords); err != nil { + return err + } + + // Name + if err = cache.WriteValue(writer, s.Name); err != nil { + return err + } + + return nil +} + +func (s *Monitor) UnmarshalCache(vers uint64, reader io.Reader) (err error) { + // Check for compatibility and return cache.ErrIncompatibleVersion to invalidate this item (see #3638) + // EXISTING_CODE + // EXISTING_CODE + + // Address + if err = cache.ReadValue(reader, &s.Address, vers); err != nil { + return err + } + + // Deleted + if err = cache.ReadValue(reader, &s.Deleted, vers); err != nil { + return err + } + + // FileSize + if err = cache.ReadValue(reader, &s.FileSize, vers); err != nil { + return err + } + + // LastScanned + if err = cache.ReadValue(reader, &s.LastScanned, vers); err != nil { + return err + } + + // NRecords + if err = cache.ReadValue(reader, &s.NRecords, vers); err != nil { + return err + } + + // Name + if err = cache.ReadValue(reader, &s.Name, vers); err != nil { + return err + } + + s.FinishUnmarshal() + + return nil +} + // FinishUnmarshal is used by the cache. It may be unused depending on auto-code-gen func (s *Monitor) FinishUnmarshal() { // EXISTING_CODE diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv index 1b8a77f2a5..12c562fcdb 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv @@ -1,6 +1,7 @@ name ,type ,strDefault ,attributes ,docOrder ,description address ,address , , , 1 ,the address of this monitor -deleted ,bool , , , 5 ,`true` if this monitor has been deleted -fileSize ,int64 , , , 3 ,the size of this monitor on disc -lastScanned ,uint32 , , , 4 ,the last scanned block number -nRecords ,int64 , , , 2 ,the number of appearances for this monitor +deleted ,bool , , , 6 ,`true` if this monitor has been deleted +fileSize ,int64 , , , 4 ,the size of this monitor on disc +lastScanned ,uint32 , , , 5 ,the last scanned block number +nRecords ,int64 , , , 3 ,the number of appearances for this monitor +name ,string , , , 2 ,the name of this monitor (if any) diff --git a/src/dev_tools/goMaker/templates/classDefinitions/monitor.toml b/src/dev_tools/goMaker/templates/classDefinitions/monitor.toml index c21f28dded..5549f339b8 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/monitor.toml +++ b/src/dev_tools/goMaker/templates/classDefinitions/monitor.toml @@ -6,3 +6,4 @@ attributes = "" produced_by = "monitors, list, export, slurp" contains = "appearance, appearancetable" + cache_type = "marshal_only" From 7ceed774f6fff643f1028ca4126a8e055b200d0d Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 7 Aug 2024 13:07:56 -0400 Subject: [PATCH 025/121] Changes type name from TimestampCount to Count --- docs | 2 +- examples/withStreaming/streamWhen.go | 2 +- sdk/chunks.go | 8 +++++++- sdk/chunks_internal.go | 4 ++-- sdk/typescript/src/paths/chunks.ts | 4 ++-- sdk/typescript/src/paths/when.ts | 4 ++-- .../src/types/{timestampCount.ts => count.ts} | 2 +- sdk/typescript/src/types/index.ts | 2 +- sdk/when.go | 4 ++-- sdk/when_internal.go | 2 +- src/apps/chifra/cmd/chunks.go | 2 +- src/apps/chifra/internal/chunks/README.md | 3 ++- src/apps/chifra/internal/chunks/options.go | 2 +- src/apps/chifra/internal/when/README.md | 2 +- .../{types_timestampcount.go => types_count.go} | 0 src/dev_tools/goMaker/generated/all_types.csv | 2 +- src/dev_tools/goMaker/templates/README.md | 2 +- .../goMaker/templates/classDefinitions/count.toml | 7 +++++++ .../templates/classDefinitions/fields/count.csv | 2 ++ .../classDefinitions/fields/timestampcount.csv | 2 -- .../templates/classDefinitions/timestampcount.toml | 7 ------- src/dev_tools/goMaker/templates/cmd-line-options.csv | 4 ++-- .../model-intros/{timestampCount.md => count.md} | 0 src/dev_tools/sdkFuzzer/chunks.go | 12 ++++++++++-- src/dev_tools/sdkFuzzer/when.go | 2 +- tests | 2 +- 26 files changed, 50 insertions(+), 35 deletions(-) rename sdk/typescript/src/types/{timestampCount.ts => count.ts} (92%) rename src/apps/chifra/pkg/types/{types_timestampcount.go => types_count.go} (100%) create mode 100644 src/dev_tools/goMaker/templates/classDefinitions/count.toml create mode 100644 src/dev_tools/goMaker/templates/classDefinitions/fields/count.csv delete mode 100644 src/dev_tools/goMaker/templates/classDefinitions/fields/timestampcount.csv delete mode 100644 src/dev_tools/goMaker/templates/classDefinitions/timestampcount.toml rename src/dev_tools/goMaker/templates/model-intros/{timestampCount.md => count.md} (100%) diff --git a/docs b/docs index c88475e809..3bd3e27bdf 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit c88475e809d9b5f7b3f36a8a04a0a7d8cf202d25 +Subproject commit 3bd3e27bdf457108d4b8907a8c61ba40247e3af5 diff --git a/examples/withStreaming/streamWhen.go b/examples/withStreaming/streamWhen.go index b630c4f6de..7d6c4d88ab 100644 --- a/examples/withStreaming/streamWhen.go +++ b/examples/withStreaming/streamWhen.go @@ -3,7 +3,7 @@ package main func TestStreamWhen() { // TODO: Add streaming examples // When ([]types.NamedBlock, *types.MetaData, error) { - // WhenCount ([]types.TimestampCount, *types.MetaData, error) { + // WhenCount ([]types.Count, *types.MetaData, error) { // WhenList ([]types.NamedBlock, *types.MetaData, error) { // WhenTimestamps ([]types.Timestamp, *types.MetaData, error) { } diff --git a/sdk/chunks.go b/sdk/chunks.go index ef6c6ca50f..0eb323b8fa 100644 --- a/sdk/chunks.go +++ b/sdk/chunks.go @@ -35,7 +35,6 @@ type ChunksOptions struct { Rewrite bool `json:"rewrite,omitempty"` List bool `json:"list,omitempty"` Unpin bool `json:"unpin,omitempty"` - Count bool `json:"count,omitempty"` Sleep float64 `json:"sleep,omitempty"` RenderCtx *output.RenderCtx `json:"-"` Globals @@ -110,6 +109,13 @@ func (opts *ChunksOptions) ChunksDiff() ([]types.Message, *types.MetaData, error return queryChunks[types.Message](in) } +// ChunksCount implements the chifra chunks --count command. +func (opts *ChunksOptions) ChunksCount() ([]types.Count, *types.MetaData, error) { + in := opts.toInternal() + in.Count = true + return queryChunks[types.Count](in) +} + // ChunksTag implements the chifra chunks --tag command. func (opts *ChunksOptions) ChunksTag(val string) ([]types.Message, *types.MetaData, error) { in := opts.toInternal() diff --git a/sdk/chunks_internal.go b/sdk/chunks_internal.go index c465dc897f..521a0ad8dd 100644 --- a/sdk/chunks_internal.go +++ b/sdk/chunks_internal.go @@ -109,7 +109,8 @@ type chunksGeneric interface { types.ChunkAddress | types.ChunkAppearance | types.ChunkStats | - types.Message + types.Message | + types.Count } func queryChunks[T chunksGeneric](opts *chunksOptionsInternal) ([]T, *types.MetaData, error) { @@ -151,7 +152,6 @@ func (opts *ChunksOptions) toInternal() *chunksOptionsInternal { Rewrite: opts.Rewrite, List: opts.List, Unpin: opts.Unpin, - Count: opts.Count, Sleep: opts.Sleep, RenderCtx: opts.RenderCtx, Globals: opts.Globals, diff --git a/sdk/typescript/src/paths/chunks.ts b/sdk/typescript/src/paths/chunks.ts index 1c19972d75..c1dd376e52 100644 --- a/sdk/typescript/src/paths/chunks.ts +++ b/sdk/typescript/src/paths/chunks.ts @@ -9,7 +9,7 @@ */ import * as ApiCallers from '../lib/api_callers'; -import { address, blknum, ChunkAddress, ChunkAppearance, ChunkBloom, ChunkIndex, ChunkManifest, ChunkPin, ChunkStats, float64, Message, uint64 } from '../types'; +import { address, blknum, ChunkAddress, ChunkAppearance, ChunkBloom, ChunkIndex, ChunkManifest, ChunkPin, ChunkStats, Count, float64, Message, uint64 } from '../types'; export function getChunks( parameters?: { @@ -33,7 +33,7 @@ export function getChunks( }, options?: RequestInit, ) { - return ApiCallers.fetch( + return ApiCallers.fetch( { endpoint: '/chunks', method: 'get', parameters, options }, ); } diff --git a/sdk/typescript/src/paths/when.ts b/sdk/typescript/src/paths/when.ts index 0c74374d78..546d09a8a6 100644 --- a/sdk/typescript/src/paths/when.ts +++ b/sdk/typescript/src/paths/when.ts @@ -9,7 +9,7 @@ */ import * as ApiCallers from '../lib/api_callers'; -import { NamedBlock, Timestamp, TimestampCount } from '../types'; +import { Count, NamedBlock, Timestamp } from '../types'; export function getWhen( parameters?: { @@ -29,7 +29,7 @@ export function getWhen( }, options?: RequestInit, ) { - return ApiCallers.fetch( + return ApiCallers.fetch( { endpoint: '/when', method: 'get', parameters, options }, ); } diff --git a/sdk/typescript/src/types/timestampCount.ts b/sdk/typescript/src/types/count.ts similarity index 92% rename from sdk/typescript/src/types/timestampCount.ts rename to sdk/typescript/src/types/count.ts index 07d6c9f6ed..e4752d83f4 100644 --- a/sdk/typescript/src/types/timestampCount.ts +++ b/sdk/typescript/src/types/count.ts @@ -10,6 +10,6 @@ import { uint64 } from '.'; -export type TimestampCount = { +export type Count = { count: uint64 } diff --git a/sdk/typescript/src/types/index.ts b/sdk/typescript/src/types/index.ts index 6a5b5cef41..263bf49625 100644 --- a/sdk/typescript/src/types/index.ts +++ b/sdk/typescript/src/types/index.ts @@ -32,7 +32,7 @@ export * from './state'; export * from './statement'; export * from './status'; export * from './timestamp'; -export * from './timestampCount'; +export * from './count'; export * from './token'; export * from './trace'; export * from './traceAction'; diff --git a/sdk/when.go b/sdk/when.go index 3de77bee27..8562e8d33d 100644 --- a/sdk/when.go +++ b/sdk/when.go @@ -56,10 +56,10 @@ func (opts *WhenOptions) WhenTimestamps() ([]types.Timestamp, *types.MetaData, e } // WhenCount implements the chifra when --count command. -func (opts *WhenOptions) WhenCount() ([]types.TimestampCount, *types.MetaData, error) { +func (opts *WhenOptions) WhenCount() ([]types.Count, *types.MetaData, error) { in := opts.toInternal() in.Count = true - return queryWhen[types.TimestampCount](in) + return queryWhen[types.Count](in) } // No enums diff --git a/sdk/when_internal.go b/sdk/when_internal.go index e8d775d510..8b6e0265d8 100644 --- a/sdk/when_internal.go +++ b/sdk/when_internal.go @@ -83,7 +83,7 @@ func GetWhenOptions(args []string) (*whenOptionsInternal, error) { type whenGeneric interface { types.NamedBlock | types.Timestamp | - types.TimestampCount + types.Count } func queryWhen[T whenGeneric](opts *whenOptionsInternal) ([]T, *types.MetaData, error) { diff --git a/src/apps/chifra/cmd/chunks.go b/src/apps/chifra/cmd/chunks.go index cd2aeff8a1..dbdb55822d 100644 --- a/src/apps/chifra/cmd/chunks.go +++ b/src/apps/chifra/cmd/chunks.go @@ -80,7 +80,7 @@ func init() { chunksCmd.Flags().BoolVarP(&chunksPkg.GetOptions().Rewrite, "rewrite", "e", false, `for the --pin --deep mode only, writes the manifest back to the index folder (see notes)`) chunksCmd.Flags().BoolVarP(&chunksPkg.GetOptions().List, "list", "l", false, `for the pins mode only, list the remote pins (hidden)`) chunksCmd.Flags().BoolVarP(&chunksPkg.GetOptions().Unpin, "unpin", "u", false, `for the pins mode only, if true reads local ./unpins file for valid CIDs and remotely unpins each (skips non-CIDs) (hidden)`) - chunksCmd.Flags().BoolVarP(&chunksPkg.GetOptions().Count, "count", "U", false, `for the pins mode only, display only the count of records`) + chunksCmd.Flags().BoolVarP(&chunksPkg.GetOptions().Count, "count", "U", false, `for certain modes only, display the count of records`) chunksCmd.Flags().StringVarP(&chunksPkg.GetOptions().Tag, "tag", "t", "", `visits each chunk and updates the headers with the supplied version string (vX.Y.Z-str) (hidden)`) chunksCmd.Flags().Float64VarP(&chunksPkg.GetOptions().Sleep, "sleep", "s", 0.0, `for --remote pinning only, seconds to sleep between API calls`) if os.Getenv("TEST_MODE") != "true" { diff --git a/src/apps/chifra/internal/chunks/README.md b/src/apps/chifra/internal/chunks/README.md index 331e94a36d..5673776161 100644 --- a/src/apps/chifra/internal/chunks/README.md +++ b/src/apps/chifra/internal/chunks/README.md @@ -29,7 +29,7 @@ Flags: -m, --max_addrs uint the max number of addresses to process in a given chunk -d, --deep if true, dig more deeply during checking (manifest only) -e, --rewrite for the --pin --deep mode only, writes the manifest back to the index folder (see notes) - -U, --count for the pins mode only, display only the count of records + -U, --count for certain modes only, display the count of records -s, --sleep float for --remote pinning only, seconds to sleep between API calls -x, --fmt string export format, one of [none|json*|txt|csv] -v, --verbose enable verbose output @@ -58,6 +58,7 @@ Data models produced by this tool: - [chunkpin](/data-model/admin/#chunkpin) - [chunkrecord](/data-model/admin/#chunkrecord) - [chunkstats](/data-model/admin/#chunkstats) +- [count](/data-model/other/#count) - [ipfspin](/data-model/admin/#ipfspin) - [manifest](/data-model/admin/#manifest) - [message](/data-model/other/#message) diff --git a/src/apps/chifra/internal/chunks/options.go b/src/apps/chifra/internal/chunks/options.go index 1693065e25..42f6e53d7f 100644 --- a/src/apps/chifra/internal/chunks/options.go +++ b/src/apps/chifra/internal/chunks/options.go @@ -54,7 +54,7 @@ type ChunksOptions struct { Rewrite bool `json:"rewrite,omitempty"` // For the --pin --deep mode only, writes the manifest back to the index folder (see notes) List bool `json:"list,omitempty"` // For the pins mode only, list the remote pins Unpin bool `json:"unpin,omitempty"` // For the pins mode only, if true reads local ./unpins file for valid CIDs and remotely unpins each (skips non-CIDs) - Count bool `json:"count,omitempty"` // For the pins mode only, display only the count of records + Count bool `json:"count,omitempty"` // For certain modes only, display the count of records Tag string `json:"tag,omitempty"` // Visits each chunk and updates the headers with the supplied version string (vX.Y.Z-str) Sleep float64 `json:"sleep,omitempty"` // For --remote pinning only, seconds to sleep between API calls Globals globals.GlobalOptions `json:"globals,omitempty"` // The global options diff --git a/src/apps/chifra/internal/when/README.md b/src/apps/chifra/internal/when/README.md index 63c0e88676..04974158c0 100644 --- a/src/apps/chifra/internal/when/README.md +++ b/src/apps/chifra/internal/when/README.md @@ -44,10 +44,10 @@ Notes: Data models produced by this tool: +- [count](/data-model/other/#count) - [message](/data-model/other/#message) - [namedblock](/data-model/chaindata/#namedblock) - [timestamp](/data-model/chaindata/#timestamp) -- [timestampcount](/data-model/chaindata/#timestampcount) ### Other Options diff --git a/src/apps/chifra/pkg/types/types_timestampcount.go b/src/apps/chifra/pkg/types/types_count.go similarity index 100% rename from src/apps/chifra/pkg/types/types_timestampcount.go rename to src/apps/chifra/pkg/types/types_count.go diff --git a/src/dev_tools/goMaker/generated/all_types.csv b/src/dev_tools/goMaker/generated/all_types.csv index 4385ddbf40..1403720952 100644 --- a/src/dev_tools/goMaker/generated/all_types.csv +++ b/src/dev_tools/goMaker/generated/all_types.csv @@ -13,7 +13,7 @@ types_cacheitem.go,CacheItem,cacheItem,,,, types_status.go,Status,<--- missing --->,,x,, types_tracecount.go,TraceCount,traceCount,,x,, types_timestamp.go,Timestamp,timestamp,,,, -types_timestampCount.go,TimestampCount,timestampCount,,,, +types_count.go,Count,count,,,, types_appearance.go,Appearance,appearance,x,,, types_block.go,Block,block,x,x,, types_chain.go,Chain,chain,x,x,, diff --git a/src/dev_tools/goMaker/templates/README.md b/src/dev_tools/goMaker/templates/README.md index ac3c3311d0..39de314c49 100644 --- a/src/dev_tools/goMaker/templates/README.md +++ b/src/dev_tools/goMaker/templates/README.md @@ -16,7 +16,7 @@ List of types that support the Modeler interface | ./internal/status | types_status.go | simpleStatus | <--- missing ---> | | x | | | ./internal/traces | types_tracecount.go | simpleTraceCount | traceCount | | x | | | ./internal/when | types_timestamp.go | simpleTimestamp | timestamp | | | | -| ./internal/when | types_timestampCount.go | simpleTimestampCount | timestampCount | | | | +| ./internal/when | types_count.go | simpleCount | count | | | | | | | | | | | | | ./pkg/types | types_appearance.go | Appearance | appearance | x | | not turned on | | ./pkg/types | types_block.go | Block | block | x | x | | diff --git a/src/dev_tools/goMaker/templates/classDefinitions/count.toml b/src/dev_tools/goMaker/templates/classDefinitions/count.toml new file mode 100644 index 0000000000..b1586662e7 --- /dev/null +++ b/src/dev_tools/goMaker/templates/classDefinitions/count.toml @@ -0,0 +1,7 @@ +[settings] + class = "Count" + doc_group = "05-Other" + doc_descr = "the number of items in the given database" + doc_route = "521-count" + attributes = "" + produced_by = "when, chunks" diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/count.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/count.csv new file mode 100644 index 0000000000..2a4e4681a1 --- /dev/null +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/count.csv @@ -0,0 +1,2 @@ +name ,type ,strDefault ,attributes ,docOrder ,description +count ,uint64 , , , 1 ,the number of items in the given database diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/timestampcount.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/timestampcount.csv deleted file mode 100644 index cc68c12b39..0000000000 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/timestampcount.csv +++ /dev/null @@ -1,2 +0,0 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -count ,uint64 , , , 1 ,the number of timestamps in the timestamps database diff --git a/src/dev_tools/goMaker/templates/classDefinitions/timestampcount.toml b/src/dev_tools/goMaker/templates/classDefinitions/timestampcount.toml deleted file mode 100644 index 3038d47e7e..0000000000 --- a/src/dev_tools/goMaker/templates/classDefinitions/timestampcount.toml +++ /dev/null @@ -1,7 +0,0 @@ -[settings] - class = "TimestampCount" - doc_group = "02-Chain Data" - doc_descr = "the number of timestamps in the timestamps database" - doc_route = "245-timestampCount" - attributes = "" - produced_by = "when" diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index 05b97c7d43..14586b283a 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -185,7 +185,7 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 27020,tools,Chain Data,when,whenBlock,blocks,,,visible|docs,3,positional,list,namedBlock,,,,one or more dates, block numbers, hashes, or special named blocks (see notes) 27030,tools,Chain Data,when,whenBlock,list,l,,visible|docs,1,switch,,namedBlock,,,,export a list of the 'special' blocks 27040,tools,Chain Data,when,whenBlock,timestamps,t,,visible|docs,2,switch,,timestamp,,,,display or process timestamps -27050,tools,Chain Data,when,whenBlock,count,U,,visible|docs,,switch,,timestampCount,,,,with --timestamps only, returns the number of timestamps in the cache +27050,tools,Chain Data,when,whenBlock,count,U,,visible|docs,,switch,,count,,,,with --timestamps only, returns the number of timestamps in the cache 27060,tools,Chain Data,when,whenBlock,truncate,n,NOPOSN,,,flag,,,,,,with --timestamps only, truncates the timestamp file at this block 27070,tools,Chain Data,when,whenBlock,repair,r,,visible|docs,,switch,,,,,,with --timestamps only, repairs block(s) in the block range by re-querying from the chain 27080,tools,Chain Data,when,whenBlock,check,c,,visible|docs,,switch,,,,,,with --timestamps only, checks the validity of the timestamp data @@ -293,7 +293,7 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 46160,apps,Admin,chunks,chunkMan,rewrite,e,,visible|docs,,switch,,,,,,for the --pin --deep mode only, writes the manifest back to the index folder (see notes) 46170,apps,Admin,chunks,chunkMan,list,l,,,2,switch,,,,,,for the pins mode only, list the remote pins 46180,apps,Admin,chunks,chunkMan,unpin,u,,,3,switch,,,,,,for the pins mode only, if true reads local ./unpins file for valid CIDs and remotely unpins each (skips non-CIDs) -46190,apps,Admin,chunks,chunkMan,count,U,,visible|docs,,switch,,,,,,for the pins mode only, display only the count of records +46190,apps,Admin,chunks,chunkMan,count,U,,visible|docs,,switch,,count,,,,for certain modes only, display the count of records 46200,apps,Admin,chunks,chunkMan,tag,t,,,4,flag,,message,,,,visits each chunk and updates the headers with the supplied version string (vX.Y.Z-str) 46210,apps,Admin,chunks,chunkMan,sleep,s,,visible|docs,,flag,,,,,,for --remote pinning only, seconds to sleep between API calls 46220,apps,Admin,chunks,chunkMan,n1,,,,,note,,,,,,Mode determines which type of data to display or process. diff --git a/src/dev_tools/goMaker/templates/model-intros/timestampCount.md b/src/dev_tools/goMaker/templates/model-intros/count.md similarity index 100% rename from src/dev_tools/goMaker/templates/model-intros/timestampCount.md rename to src/dev_tools/goMaker/templates/model-intros/count.md diff --git a/src/dev_tools/sdkFuzzer/chunks.go b/src/dev_tools/sdkFuzzer/chunks.go index 9db04632db..902e8cd558 100644 --- a/src/dev_tools/sdkFuzzer/chunks.go +++ b/src/dev_tools/sdkFuzzer/chunks.go @@ -37,7 +37,6 @@ func DoChunks() { rewrite := []bool{false, true} list := []bool{false, true} unpin := []bool{false, true} - count := []bool{false, true} // firstBlock is a --other // lastBlock is a --other // maxAddrs is a --other @@ -57,7 +56,6 @@ func DoChunks() { _ = rewrite _ = list _ = unpin - _ = count opts = sdk.ChunksOptions{ FirstBlock: 0, LastBlock: base.NOPOSN, @@ -191,6 +189,16 @@ func TestChunks(which, value, fn string, opts *sdk.ChunksOptions) { ReportOkay(fn) } } + case "count": + if count, _, err := opts.ChunksCount(); err != nil { + ReportError(fn, opts, err) + } else { + if err := SaveToFile[types.Count](fn, count); err != nil { + ReportError2(fn, err) + } else { + ReportOkay(fn) + } + } case "tag": if tag, _, err := opts.ChunksTag(value); err != nil { ReportError(fn, opts, err) diff --git a/src/dev_tools/sdkFuzzer/when.go b/src/dev_tools/sdkFuzzer/when.go index 69576357a0..869e1e2f26 100644 --- a/src/dev_tools/sdkFuzzer/when.go +++ b/src/dev_tools/sdkFuzzer/when.go @@ -104,7 +104,7 @@ func TestWhen(which, value, fn string, opts *sdk.WhenOptions) { if count, _, err := opts.WhenCount(); err != nil { ReportError(fn, opts, err) } else { - if err := SaveToFile[types.TimestampCount](fn, count); err != nil { + if err := SaveToFile[types.Count](fn, count); err != nil { ReportError2(fn, err) } else { ReportOkay(fn) diff --git a/tests b/tests index d0710bef13..e02041cd51 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit d0710bef13ee51ccbbd29874e65a7ab18b93f220 +Subproject commit e02041cd51ddf6b685d8428e27a7c2d08c20d432 From 024780f67b037d22122aacd4626b75a1766594e6 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 7 Aug 2024 13:08:48 -0400 Subject: [PATCH 026/121] Small fix to testRunner --- src/dev_tools/testRunner/api_server.go | 26 ++++++++++++++++--- .../migrations/CHANGES-PRIOR-TO-3.0.0.md | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/dev_tools/testRunner/api_server.go b/src/dev_tools/testRunner/api_server.go index 43766ce60d..b96721eb9e 100644 --- a/src/dev_tools/testRunner/api_server.go +++ b/src/dev_tools/testRunner/api_server.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "net" "os" "strings" @@ -9,12 +11,18 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" ) +var apiPort = "" + func getApiUrl() string { - port := strings.ReplaceAll(os.Getenv("TB_TEST_API_SERVER"), ":", "") - if port == "" { - port = "8080" + if apiPort != "" { + return "localhost:" + apiPort + } + + apiPort = strings.ReplaceAll(os.Getenv("TB_TEST_API_SERVER"), ":", "") + if apiPort == "" { + apiPort = fmt.Sprintf("%d", findAvailablePort()) } - return "localhost:" + port + return "localhost:" + apiPort } func startApiServer() error { @@ -24,3 +32,13 @@ func startApiServer() error { logger.Info(colors.Yellow + "Server started..." + colors.Off) return nil } + +func findAvailablePort() int { + listener, err := net.Listen("tcp", ":0") + if err != nil { + return 8080 + } + defer listener.Close() + addr := listener.Addr().(*net.TCPAddr) + return addr.Port +} diff --git a/src/other/migrations/CHANGES-PRIOR-TO-3.0.0.md b/src/other/migrations/CHANGES-PRIOR-TO-3.0.0.md index 131b79a18d..8f60c73d0f 100644 --- a/src/other/migrations/CHANGES-PRIOR-TO-3.0.0.md +++ b/src/other/migrations/CHANGES-PRIOR-TO-3.0.0.md @@ -1518,7 +1518,7 @@ There were no changes to the [Specification for the Unchained Index](https://tru - `MonitorClean` (for `chifra monitors --clean`) - `ReportCheck` (for `chifra chunks index --check`) - `Timestamp` (for `chifra when --timestamps`) - - `TimestampCount` (for `chifra when --timestamps --count`) + - `Count` (for `chifra when --timestamps --count`) - `TraceFilter` (for `chifra traces `) ## Tool Specific Changes From 3a6e69077627dd7dd6607c62fa31a5a944f78163 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 7 Aug 2024 13:12:09 -0400 Subject: [PATCH 027/121] Renames ReadManifest to LoadManifest --- src/apps/chifra/internal/chunks/handle_check.go | 4 ++-- src/apps/chifra/internal/chunks/handle_manifest.go | 2 +- src/apps/chifra/internal/chunks/handle_pin.go | 2 +- src/apps/chifra/internal/chunks/handle_tag.go | 2 +- src/apps/chifra/internal/init/handle_dryrun.go | 2 +- src/apps/chifra/internal/init/handle_init.go | 4 ++-- src/apps/chifra/internal/when/handle_ts_count.go | 2 +- src/apps/chifra/pkg/manifest/manifest_read.go | 4 ++-- src/apps/chifra/pkg/manifest/remove_chunk.go | 2 +- src/apps/chifra/pkg/monitor/monitor_freshen.go | 2 +- src/apps/chifra/pkg/types/types_count.go | 8 ++++---- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/apps/chifra/internal/chunks/handle_check.go b/src/apps/chifra/internal/chunks/handle_check.go index 1ecb408275..06a6301e07 100644 --- a/src/apps/chifra/internal/chunks/handle_check.go +++ b/src/apps/chifra/internal/chunks/handle_check.go @@ -74,12 +74,12 @@ func (opts *ChunksOptions) check(rCtx *output.RenderCtx, blockNums []base.Blknum return fileNames[i] < fileNames[j] }) - cacheManifest, err := manifest.ReadManifest(chain, opts.PublisherAddr, manifest.LocalCache) + cacheManifest, err := manifest.LoadManifest(chain, opts.PublisherAddr, manifest.LocalCache) if err != nil { return err, false } - remoteManifest, err := manifest.ReadManifest(chain, opts.PublisherAddr, manifest.TempContract) + remoteManifest, err := manifest.LoadManifest(chain, opts.PublisherAddr, manifest.TempContract) if err != nil { return err, false } diff --git a/src/apps/chifra/internal/chunks/handle_manifest.go b/src/apps/chifra/internal/chunks/handle_manifest.go index 21e34fa922..1ce1c4929e 100644 --- a/src/apps/chifra/internal/chunks/handle_manifest.go +++ b/src/apps/chifra/internal/chunks/handle_manifest.go @@ -19,7 +19,7 @@ var sourceMap = map[bool]manifest.Source{ func (opts *ChunksOptions) HandleManifest(rCtx *output.RenderCtx, blockNums []base.Blknum) error { chain := opts.Globals.Chain testMode := opts.Globals.TestMode - man, err := manifest.ReadManifest(chain, opts.PublisherAddr, sourceMap[opts.Remote]) + man, err := manifest.LoadManifest(chain, opts.PublisherAddr, sourceMap[opts.Remote]) if err != nil { return err } diff --git a/src/apps/chifra/internal/chunks/handle_pin.go b/src/apps/chifra/internal/chunks/handle_pin.go index ca987d9404..bfb46d7fbe 100644 --- a/src/apps/chifra/internal/chunks/handle_pin.go +++ b/src/apps/chifra/internal/chunks/handle_pin.go @@ -45,7 +45,7 @@ func (opts *ChunksOptions) HandlePin(rCtx *output.RenderCtx, blockNums []base.Bl outPath = config.PathToManifest(chain) } - man, err := manifest.ReadManifest(chain, opts.PublisherAddr, manifest.LocalCache) + man, err := manifest.LoadManifest(chain, opts.PublisherAddr, manifest.LocalCache) if err != nil { rCtx.Cancel() return err diff --git a/src/apps/chifra/internal/chunks/handle_tag.go b/src/apps/chifra/internal/chunks/handle_tag.go index 4baee63cab..a99765c0cc 100644 --- a/src/apps/chifra/internal/chunks/handle_tag.go +++ b/src/apps/chifra/internal/chunks/handle_tag.go @@ -35,7 +35,7 @@ func (opts *ChunksOptions) HandleTag(rCtx *output.RenderCtx, blockNums []base.Bl fetchData := func(modelChan chan types.Modeler, errorChan chan error) { nChunksTagged := 0 - man, err := manifest.ReadManifest(chain, opts.PublisherAddr, manifest.LocalCache) + man, err := manifest.LoadManifest(chain, opts.PublisherAddr, manifest.LocalCache) if err != nil { return } diff --git a/src/apps/chifra/internal/init/handle_dryrun.go b/src/apps/chifra/internal/init/handle_dryrun.go index e0ad08b593..ddd70875f0 100644 --- a/src/apps/chifra/internal/init/handle_dryrun.go +++ b/src/apps/chifra/internal/init/handle_dryrun.go @@ -15,7 +15,7 @@ import ( func (opts *InitOptions) HandleDryRun(rCtx *output.RenderCtx) error { chain := opts.Globals.Chain - remoteManifest, err := manifest.ReadManifest(chain, opts.PublisherAddr, manifest.TempContract) + remoteManifest, err := manifest.LoadManifest(chain, opts.PublisherAddr, manifest.TempContract) if err != nil { return err } diff --git a/src/apps/chifra/internal/init/handle_init.go b/src/apps/chifra/internal/init/handle_init.go index 5fb0860a04..611a45e2c0 100644 --- a/src/apps/chifra/internal/init/handle_init.go +++ b/src/apps/chifra/internal/init/handle_init.go @@ -28,12 +28,12 @@ func (opts *InitOptions) HandleInit(rCtx *output.RenderCtx) error { // scraper starts, it starts on the correct block. _ = file.CleanFolder(chain, config.PathToIndex(chain), []string{"ripe", "unripe", "maps", "staging"}) - existing, err := manifest.ReadManifest(chain, opts.PublisherAddr, manifest.LocalCache) + existing, err := manifest.LoadManifest(chain, opts.PublisherAddr, manifest.LocalCache) if err != nil { return err } - remote, err := manifest.ReadManifest(chain, opts.PublisherAddr, manifest.FromContract) + remote, err := manifest.LoadManifest(chain, opts.PublisherAddr, manifest.FromContract) if err != nil { return err } diff --git a/src/apps/chifra/internal/when/handle_ts_count.go b/src/apps/chifra/internal/when/handle_ts_count.go index cb5985edbd..40d04dd820 100644 --- a/src/apps/chifra/internal/when/handle_ts_count.go +++ b/src/apps/chifra/internal/when/handle_ts_count.go @@ -24,7 +24,7 @@ func (opts *WhenOptions) HandleTimestampsCount(rCtx *output.RenderCtx) error { count = 5000000 } - s := types.TimestampCount{ + s := types.Count{ Count: uint64(count), } diff --git a/src/apps/chifra/pkg/manifest/manifest_read.go b/src/apps/chifra/pkg/manifest/manifest_read.go index d5957c09b5..d9ace919ae 100644 --- a/src/apps/chifra/pkg/manifest/manifest_read.go +++ b/src/apps/chifra/pkg/manifest/manifest_read.go @@ -13,14 +13,14 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) -// ReadManifest reads the manifest from a file or from the Unchained Index smart contract. +// LoadManifest reads the manifest from a file or from the Unchained Index smart contract. // // It first checks if the manifest file exists. If it does, it reads the manifest from the file. // If the caller requests the contract or the cached manifest does not exist, it reads the // manifest from the contract. It then checks if the new manifest has more chunks than the existing // one. If it does (or if the file didn't exist), it saves the new manifest to the file. Finally, it // creates a map of chunks for easy lookup and sets the specification if it is not already set. -func ReadManifest(chain string, publisher base.Address, source Source) (man *Manifest, err error) { +func LoadManifest(chain string, publisher base.Address, source Source) (man *Manifest, err error) { manifestFn := config.PathToManifest(chain) exists := file.FileExists(manifestFn) man = &Manifest{} diff --git a/src/apps/chifra/pkg/manifest/remove_chunk.go b/src/apps/chifra/pkg/manifest/remove_chunk.go index fbfee60614..2b21430f6c 100644 --- a/src/apps/chifra/pkg/manifest/remove_chunk.go +++ b/src/apps/chifra/pkg/manifest/remove_chunk.go @@ -39,7 +39,7 @@ func RemoveChunk(chain string, publisher base.Address, bloomFn, indexFn string) }() var man *Manifest - man, err = ReadManifest(chain, publisher, LocalCache) + man, err = LoadManifest(chain, publisher, LocalCache) if err != nil { return err } diff --git a/src/apps/chifra/pkg/monitor/monitor_freshen.go b/src/apps/chifra/pkg/monitor/monitor_freshen.go index df59006d27..390b020b3a 100644 --- a/src/apps/chifra/pkg/monitor/monitor_freshen.go +++ b/src/apps/chifra/pkg/monitor/monitor_freshen.go @@ -281,7 +281,7 @@ func (updater *MonitorUpdate) visitChunkToFreshenFinal(fileName string, resultCh if !file.FileExists(indexFilename) { chain := updater.Chain var man *manifest.Manifest - man, err = manifest.ReadManifest(chain, updater.PublisherAddr, manifest.LocalCache) + man, err = manifest.LoadManifest(chain, updater.PublisherAddr, manifest.LocalCache) if err != nil { results = append(results, index.AppearanceResult{Range: bl.Range, Err: err}) return diff --git a/src/apps/chifra/pkg/types/types_count.go b/src/apps/chifra/pkg/types/types_count.go index 4a8703a1b9..e3ac1a9e21 100644 --- a/src/apps/chifra/pkg/types/types_count.go +++ b/src/apps/chifra/pkg/types/types_count.go @@ -15,18 +15,18 @@ import ( // EXISTING_CODE -type TimestampCount struct { +type Count struct { Count uint64 `json:"count"` // EXISTING_CODE // EXISTING_CODE } -func (s TimestampCount) String() string { +func (s Count) String() string { bytes, _ := json.Marshal(s) return string(bytes) } -func (s *TimestampCount) Model(chain, format string, verbose bool, extraOpts map[string]any) Model { +func (s *Count) Model(chain, format string, verbose bool, extraOpts map[string]any) Model { var model = map[string]any{} var order = []string{} @@ -46,7 +46,7 @@ func (s *TimestampCount) Model(chain, format string, verbose bool, extraOpts map } // FinishUnmarshal is used by the cache. It may be unused depending on auto-code-gen -func (s *TimestampCount) FinishUnmarshal() { +func (s *Count) FinishUnmarshal() { // EXISTING_CODE // EXISTING_CODE } From 92d5d54ca74b319eab898c1addf50bcd0c09cc07 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 7 Aug 2024 13:24:24 -0400 Subject: [PATCH 028/121] Implements and tests chifra chunks --count --- .../chifra/internal/chunks/handle_counts.go | 50 +++++++++++++++++++ src/apps/chifra/internal/chunks/output.go | 3 ++ src/apps/chifra/internal/chunks/validate.go | 9 +++- src/apps/chifra/pkg/pinning/list_pins.go | 6 +++ src/dev_tools/testRunner/testCases/chunks.csv | 9 ++++ tests | 2 +- 6 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 src/apps/chifra/internal/chunks/handle_counts.go diff --git a/src/apps/chifra/internal/chunks/handle_counts.go b/src/apps/chifra/internal/chunks/handle_counts.go new file mode 100644 index 0000000000..495a4e1620 --- /dev/null +++ b/src/apps/chifra/internal/chunks/handle_counts.go @@ -0,0 +1,50 @@ +package chunksPkg + +import ( + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/index" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/manifest" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/pinning" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" +) + +func (opts *ChunksOptions) HandleCounts(rCtx *output.RenderCtx, blockNums []base.Blknum) error { + chain := opts.Globals.Chain + testMode := opts.Globals.TestMode + + fetchData := func(modelChan chan types.Modeler, errorChan chan error) { + var counter types.Count + vFunc := func(path string, vP any) (bool, error) { + isBloom := path == index.ToBloomPath(path) + isIndex := path == index.ToIndexPath(path) + if isBloom || isIndex { + counter.Count++ + } + return true, nil + } + + switch opts.Mode { + case "blooms": + path := walk.GetRootPathFromCacheType(chain, walk.Index_Bloom) + walk.ForEveryFileInFolder(path, vFunc, nil) + case "index", "stats": + path := walk.GetRootPathFromCacheType(chain, walk.Index_Final) + walk.ForEveryFileInFolder(path, vFunc, nil) + case "manifest": + man, _ := manifest.LoadManifest(chain, opts.PublisherAddr, sourceMap[opts.Remote]) + counter.Count = uint64(len(man.Chunks)) + case "pins": + counter.Count = pinning.CountPins(chain, "pinned") + } + + if testMode { + counter.Count = 100 + } + + modelChan <- &counter + } + + return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) +} diff --git a/src/apps/chifra/internal/chunks/output.go b/src/apps/chifra/internal/chunks/output.go index 68de127fbd..8ed3344d96 100644 --- a/src/apps/chifra/internal/chunks/output.go +++ b/src/apps/chifra/internal/chunks/output.go @@ -63,6 +63,9 @@ func (opts *ChunksOptions) ChunksInternal(rCtx *output.RenderCtx) error { if opts.Globals.TestMode && len(blockNums) > 200 { blockNums = blockNums[:200] } + if opts.Count { + err = opts.HandleCounts(rCtx, blockNums) + } else // EXISTING_CODE if opts.Check { err = opts.HandleCheck(rCtx, blockNums) diff --git a/src/apps/chifra/internal/chunks/validate.go b/src/apps/chifra/internal/chunks/validate.go index 4925122325..8570e761da 100644 --- a/src/apps/chifra/internal/chunks/validate.go +++ b/src/apps/chifra/internal/chunks/validate.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "os" + "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" @@ -75,8 +76,12 @@ func (opts *ChunksOptions) validateChunks() error { return validate.Usage("The {0} option is only available in {1} mode.", "--list", "pins") } else if opts.Unpin { return validate.Usage("The {0} option is only available in {1} mode.", "--unpin", "pins") - } else if opts.Count { - return validate.Usage("The {0} option is only available in {1} mode.", "--count", "pins") + } + } + + if opts.Count { + if !strings.Contains("manifest|index|blooms|pins|stats", opts.Mode) { + return validate.Usage("The {0} option is only available in {1}.", "--count", "these modes: manifest|index|blooms|pins|stats") } } diff --git a/src/apps/chifra/pkg/pinning/list_pins.go b/src/apps/chifra/pkg/pinning/list_pins.go index f5d4705e85..00bc09c537 100644 --- a/src/apps/chifra/pkg/pinning/list_pins.go +++ b/src/apps/chifra/pkg/pinning/list_pins.go @@ -41,6 +41,12 @@ func getPins(chain, status string, first, cnt int) (int, []Pin) { } } +// CountPins returns the number of remote piuns +func CountPins(chain, status string) uint64 { + count, _ := getPins(chain, status, 0, 1) + return uint64(count) +} + // ListPins pins a file remotely to the pinning service func ListPins(chain, status string, showProgress, countOnly bool, perPage int, dur time.Duration) ([]string, error) { count, _ := getPins(chain, status, 0, 1) diff --git a/src/dev_tools/testRunner/testCases/chunks.csv b/src/dev_tools/testRunner/testCases/chunks.csv index 7748cee3cb..e06814a4b7 100644 --- a/src/dev_tools/testRunner/testCases/chunks.csv +++ b/src/dev_tools/testRunner/testCases/chunks.csv @@ -34,6 +34,15 @@ on ,both ,fast ,chunks ,apps ,chunkMan ,header_csv ,n ,mod index ,both ,fast ,chunks ,apps ,chunkMan ,addresses_json ,y ,mode = addresses & fmt = json on ,both ,fast ,chunks ,apps ,chunkMan ,appearances_txt ,n ,mode = appearances & fmt = txt +on ,both ,fast ,chunks ,apps ,chunkMan ,manifest_count ,y ,mode = manifest & count +on ,both ,fast ,chunks ,apps ,chunkMan ,index_count ,y ,mode = index & count +on ,both ,fast ,chunks ,apps ,chunkMan ,blooms_count ,y ,mode = blooms & count +on ,both ,fast ,chunks ,apps ,chunkMan ,pins_count ,y ,mode = pins & count +on ,both ,fast ,chunks ,apps ,chunkMan ,addresses_count_fail ,y ,mode = addresses & count +on ,both ,fast ,chunks ,apps ,chunkMan ,appearances_count_fail ,y ,mode = appearances & count +on ,both ,fast ,chunks ,apps ,chunkMan ,stats_count ,y ,mode = stats & count +on ,both ,fast ,chunks ,apps ,chunkMan ,junk_count_fail ,y ,mode = junk & count + on ,both ,fast ,chunks ,apps ,chunkMan ,fail_belongs_wrong_mode ,y ,mode = addresses & belongs = 0x0101f3be8ebb4bbd39a2e3b9a3639d4259832fd9 on ,both ,fast ,chunks ,apps ,chunkMan ,fail_belongs_no_blocks ,y ,mode = index & belongs = 0x0101f3be8ebb4bbd39a2e3b9a3639d4259832fd9 on ,both ,fast ,chunks ,apps ,chunkMan ,fail_belongs_no_addr ,y ,mode = index & belongs & blocks = 2287625 diff --git a/tests b/tests index e02041cd51..843ad08c27 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit e02041cd51ddf6b685d8428e27a7c2d08c20d432 +Subproject commit 843ad08c27e896223754998e5edf19afa8d56209 From 60f5598abdc118d40efa4c8ed68e16b0b34969f2 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 7 Aug 2024 13:25:09 -0400 Subject: [PATCH 029/121] Adds Status::ShallowCopy. More coming. --- src/apps/chifra/pkg/types/types_status.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/apps/chifra/pkg/types/types_status.go b/src/apps/chifra/pkg/types/types_status.go index 72d9ab58ad..e4bc105b9f 100644 --- a/src/apps/chifra/pkg/types/types_status.go +++ b/src/apps/chifra/pkg/types/types_status.go @@ -152,4 +152,12 @@ func (s *Status) FinishUnmarshal() { } // EXISTING_CODE +func (s *Status) ShallowCopy() Status { + caches := s.Caches + s.Caches = nil + ret := *s + s.Caches = caches + return ret +} + // EXISTING_CODE From e5ac71c6d1763dbb0029cbff32fb3cd51f2e9de4 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 7 Aug 2024 13:40:21 -0400 Subject: [PATCH 030/121] Fixes lints --- src/apps/chifra/internal/chunks/handle_counts.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/chifra/internal/chunks/handle_counts.go b/src/apps/chifra/internal/chunks/handle_counts.go index 495a4e1620..23bd096e13 100644 --- a/src/apps/chifra/internal/chunks/handle_counts.go +++ b/src/apps/chifra/internal/chunks/handle_counts.go @@ -28,10 +28,10 @@ func (opts *ChunksOptions) HandleCounts(rCtx *output.RenderCtx, blockNums []base switch opts.Mode { case "blooms": path := walk.GetRootPathFromCacheType(chain, walk.Index_Bloom) - walk.ForEveryFileInFolder(path, vFunc, nil) + _ = walk.ForEveryFileInFolder(path, vFunc, nil) case "index", "stats": path := walk.GetRootPathFromCacheType(chain, walk.Index_Final) - walk.ForEveryFileInFolder(path, vFunc, nil) + _ = walk.ForEveryFileInFolder(path, vFunc, nil) case "manifest": man, _ := manifest.LoadManifest(chain, opts.PublisherAddr, sourceMap[opts.Remote]) counter.Count = uint64(len(man.Chunks)) From 522c1b03d476f1f72a676c657e973ac792ef113f Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 05:37:49 -0400 Subject: [PATCH 031/121] Assigns part type to names --- src/apps/chifra/pkg/names/custom.go | 13 +++++++++++++ src/apps/chifra/pkg/names/names.go | 4 ++++ src/apps/chifra/pkg/names/regular.go | 23 ++++++++++++++++------- src/apps/chifra/pkg/types/types_name.go | 2 +- tests | 2 +- 5 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/apps/chifra/pkg/names/custom.go b/src/apps/chifra/pkg/names/custom.go index 046b212f28..eade68d158 100644 --- a/src/apps/chifra/pkg/names/custom.go +++ b/src/apps/chifra/pkg/names/custom.go @@ -17,11 +17,19 @@ var customNamesLoaded = false var customNames map[base.Address]types.Name = map[base.Address]types.Name{} var customNamesMutex sync.Mutex +func ClearCustomNames() { + customNamesLoaded = false +} + func loadCustomMap(chain string, terms []string, parts types.Parts, namesMap *map[base.Address]types.Name) (err error) { if customNamesLoaded { // We have already loaded the data for _, name := range customNames { if doSearch(&name, terms, parts) { + name.Parts = types.Custom + if existing, ok := (*namesMap)[name.Address]; ok { + name.Parts |= existing.Parts + } (*namesMap)[name.Address] = name } } @@ -46,6 +54,7 @@ func loadCustomMap(chain string, terms []string, parts types.Parts, namesMap *ma if parts&types.Testing != 0 { loadTestNames(terms, parts, &customNames, namesMap) } + return } @@ -75,6 +84,10 @@ func unmarshallCustomNames(source io.Reader, terms []string, parts types.Parts, } customNames[name.Address] = name if doSearch(&name, terms, parts) { + name.Parts = types.Custom + if existing, ok := (*namesMap)[name.Address]; ok { + name.Parts |= existing.Parts + } (*namesMap)[name.Address] = name } } diff --git a/src/apps/chifra/pkg/names/names.go b/src/apps/chifra/pkg/names/names.go index 0c19fa378e..048b383c3a 100644 --- a/src/apps/chifra/pkg/names/names.go +++ b/src/apps/chifra/pkg/names/names.go @@ -50,6 +50,10 @@ func loadPrefundMap(chain string, terms []string, parts types.Parts, ret *map[ba } else { for k, v := range *prefundMap { if doSearch(&v, terms, parts) { + v.Parts = types.Prefund + if existing, ok := (*ret)[k]; ok { + v.Parts |= existing.Parts + } (*ret)[k] = v } } diff --git a/src/apps/chifra/pkg/names/regular.go b/src/apps/chifra/pkg/names/regular.go index 5c0e777204..3d379ab0e8 100644 --- a/src/apps/chifra/pkg/names/regular.go +++ b/src/apps/chifra/pkg/names/regular.go @@ -18,6 +18,10 @@ func loadRegularMap(chain string, terms []string, parts types.Parts, ret *map[ba if regularNamesLoaded { for _, name := range regularNames { if doSearch(&name, terms, parts) { + name.Parts = types.Regular + if existing, ok := (*ret)[name.Address]; ok { + name.Parts |= existing.Parts + } (*ret)[name.Address] = name } } @@ -42,16 +46,20 @@ func loadRegularMap(chain string, terms []string, parts types.Parts, ret *map[ba } for { - n, err := reader.Read() + name, err := reader.Read() if err == io.EOF { break } if err != nil { logger.Fatal(err) } - regularNames[n.Address] = n - if doSearch(&n, terms, parts) { - (*ret)[n.Address] = n + regularNames[name.Address] = name + if doSearch(&name, terms, parts) { + name.Parts = types.Regular + if existing, ok := (*ret)[name.Address]; ok { + name.Parts |= existing.Parts + } + (*ret)[name.Address] = name } } @@ -83,9 +91,10 @@ func loadKnownBadresses(unused string, terms []string, parts types.Parts, ret *m Tags: "75-Baddress", }, } - for _, n := range knownBadAddresses { - if doSearch(&n, terms, parts) { - (*ret)[n.Address] = n + for _, name := range knownBadAddresses { + if doSearch(&name, terms, parts) { + name.Parts = types.Baddress + (*ret)[name.Address] = name } } return nil diff --git a/src/apps/chifra/pkg/types/types_name.go b/src/apps/chifra/pkg/types/types_name.go index eaaf3404e8..a8285ec590 100644 --- a/src/apps/chifra/pkg/types/types_name.go +++ b/src/apps/chifra/pkg/types/types_name.go @@ -164,7 +164,7 @@ func (s *Name) Model(chain, format string, verbose bool, extraOpts map[string]an model["isErc721"] = true order = append(order, "isErc721") } - if s.Parts != 0 && s.Parts != None { + if verbose && s.Parts != 0 && s.Parts != None { model["parts"] = s.Parts order = append(order, "parts") } diff --git a/tests b/tests index 843ad08c27..a8bdd996bd 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 843ad08c27e896223754998e5edf19afa8d56209 +Subproject commit a8bdd996bd133a886b569c6fec996036f4c17c29 From 00c5412e1f39aefe56909a5daafebc643991cd77 Mon Sep 17 00:00:00 2001 From: doylet Date: Thu, 16 May 2024 21:39:04 +1000 Subject: [PATCH 032/121] Don't apply nix flags on Windows build, do glob via CMake - Doing GLOB in cmake lets us have a cross-platform glob implemented by CMake for enumerating .go files for build. - Skip the GCC/clang style flags for Windows builds --- src/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e64537b64d..782a289244 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -68,11 +68,17 @@ add_custom_target(examples ALL COMMAND ${SCRIPTS_DIR}/build-examples.sh WORKING_ # ---------------------------------------------------------------------------------------- function(ADD_GO_INSTALLABLE_PROGRAM NAME MAIN_SRC DEST_DIR) get_filename_component(MAIN_SRC_ABS ${MAIN_SRC} ABSOLUTE) + file(GLOB SRC_FILE_LIST "*.go") + set(EXE_NAME ${NAME}) + if (WIN32) + set(EXE_NAME ${NAME}.exe) + endif() + add_custom_target(${NAME} ALL) add_custom_command(TARGET ${NAME} COMMAND go build - -o "${DEST_DIR}/${NAME}" - ${CMAKE_GO_FLAGS} ${MAIN_SRC} + -o "${DEST_DIR}/${EXE_NAME}" + ${CMAKE_GO_FLAGS} ${SRC_FILE_LIST} WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} DEPENDS ${MAIN_SRC_ABS} ${MAIN_SRC}) endfunction(ADD_GO_INSTALLABLE_PROGRAM) From aba8b8f1bd5967a7c799730fa5bed6d8022be8c1 Mon Sep 17 00:00:00 2001 From: doylet Date: Thu, 16 May 2024 21:41:47 +1000 Subject: [PATCH 033/121] Install config files to AppData/Local/trueblocks on Windows --- src/other/install/init_configs.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/other/install/init_configs.cmake b/src/other/install/init_configs.cmake index a0f7ba5e47..68c3f644ed 100644 --- a/src/other/install/init_configs.cmake +++ b/src/other/install/init_configs.cmake @@ -54,7 +54,7 @@ set(INSTALL_DEST "$ENV{XDG_CONFIG_HOME}") if("${INSTALL_DEST}" STREQUAL "") if(WIN32) - PrintLine("Windows build is not supported") + set(INSTALL_DEST "$ENV{LOCALAPPDATA}/trueblocks") elseif(APPLE) set(INSTALL_DEST "$ENV{HOME}/Library/Application Support/TrueBlocks") else() From 2904484067c3f0856cd7b8e537242c689cd437ad Mon Sep 17 00:00:00 2001 From: doylet Date: Thu, 16 May 2024 21:46:33 +1000 Subject: [PATCH 034/121] Separate OS impl into files, support windows and adjust paths - I seperated platform specific functionality into files that get built using the build constraints of Go - The codebase is fairly liberal with appending '/' and prepending '/' paths as well as some dodgy '/' checks that'd break on Windows because the path separators are different. I've made this agnostic to the OS by using os.PathSeparator. However there are still many instances left, in some cases paths emitted to Windows with '/' are typically permitted by most APIs. But some of the logic in chifra uses Go's path libraries which is OS agnostic but then does string compares with a OS specific path seperator causing various nesting of folders bugs. - Constructing URLs by appending the IPFS hash onto the URL was broken on Windows because we used 'filepath.Join'. This is similar behaviour as I previously mentioned where Go is agnostic and emits a '\' to the path instead of a '/' because we are constructing a URL which broke CURL requests on Windows. I've fixed this just by appending the strings together. - There is some OS functionality which I've stubbed out that needs to be implemented like using LockFileEx, UnlockFile & co on Windows to replace POSIX's flock. --- src/apps/chifra/cmd/root_initialize.go | 6 +-- src/apps/chifra/pkg/config/config.go | 10 ++-- src/apps/chifra/pkg/config/paths.go | 8 +-- src/apps/chifra/pkg/file/lock.go | 43 +--------------- src/apps/chifra/pkg/file/lock_linux.go | 50 +++++++++++++++++++ src/apps/chifra/pkg/file/lock_windows.go | 17 +++++++ src/apps/chifra/pkg/index/download_chunks.go | 3 +- src/apps/chifra/pkg/manifest/download.go | 3 +- src/apps/chifra/pkg/progress/scanbar.go | 19 ------- src/apps/chifra/pkg/progress/scanbar_linux.go | 28 +++++++++++ .../chifra/pkg/progress/scanbar_windows.go | 9 ++++ src/apps/chifra/pkg/tslib/establish.go | 3 +- 12 files changed, 120 insertions(+), 79 deletions(-) create mode 100644 src/apps/chifra/pkg/file/lock_linux.go create mode 100644 src/apps/chifra/pkg/file/lock_windows.go create mode 100644 src/apps/chifra/pkg/progress/scanbar_linux.go create mode 100644 src/apps/chifra/pkg/progress/scanbar_windows.go diff --git a/src/apps/chifra/cmd/root_initialize.go b/src/apps/chifra/cmd/root_initialize.go index 1b2c268c3f..add4650219 100644 --- a/src/apps/chifra/cmd/root_initialize.go +++ b/src/apps/chifra/cmd/root_initialize.go @@ -28,11 +28,7 @@ func Initialize() bool { // VerifyOs will panic if the operating system isn't cooperating func VerifyOs() { userOs := runtime.GOOS - if userOs == "windows" { - logger.Fatal("Windows is not supported\n") - } - - if userOs != "linux" && userOs != "darwin" { + if userOs != "linux" && userOs != "darwin" && userOs != "windows" { logger.Fatal("Unsupported operating system: ", userOs, "\n") } diff --git a/src/apps/chifra/pkg/config/config.go b/src/apps/chifra/pkg/config/config.go index 2b4de09134..04d557c954 100644 --- a/src/apps/chifra/pkg/config/config.go +++ b/src/apps/chifra/pkg/config/config.go @@ -83,22 +83,22 @@ func GetRootConfig() *ConfigFile { cachePath := trueBlocksConfig.Settings.CachePath if len(cachePath) == 0 || cachePath == "" { - cachePath = filepath.Join(configPath, "cache") + "/" + cachePath = filepath.Join(configPath, "cache") + string(os.PathSeparator) } cachePath = strings.Replace(cachePath, "$HOME", user.HomeDir, -1) cachePath = strings.Replace(cachePath, "~", user.HomeDir, -1) - if !strings.Contains(cachePath, "/cache") { + if !strings.Contains(cachePath, string(os.PathSeparator) + "cache") { cachePath = filepath.Join(cachePath, "cache") } trueBlocksConfig.Settings.CachePath = cachePath indexPath := trueBlocksConfig.Settings.IndexPath if len(indexPath) == 0 || indexPath == "" { - indexPath = filepath.Join(configPath, "unchained") + "/" + indexPath = filepath.Join(configPath, "unchained") + string(os.PathSeparator) } indexPath = strings.Replace(indexPath, "$HOME", user.HomeDir, -1) indexPath = strings.Replace(indexPath, "~", user.HomeDir, -1) - if !strings.Contains(indexPath, "/unchained") { + if !strings.Contains(indexPath, string(os.PathSeparator) + "unchained") { indexPath = filepath.Join(indexPath, "unchained") } trueBlocksConfig.Settings.IndexPath = indexPath @@ -181,6 +181,8 @@ func PathToRootConfig() string { osPath := ".local/share/trueblocks" if userOs == "darwin" { osPath = "Library/Application Support/TrueBlocks" + } else if userOs == "windows" { + osPath = "AppData/Local/trueblocks" } return filepath.Join(user.HomeDir, osPath) + "/" diff --git a/src/apps/chifra/pkg/config/paths.go b/src/apps/chifra/pkg/config/paths.go index bece876be4..d1037614e9 100644 --- a/src/apps/chifra/pkg/config/paths.go +++ b/src/apps/chifra/pkg/config/paths.go @@ -54,7 +54,7 @@ func PathToIndex(chain string) string { } // Probably already true, but can't hurt to be sure - if !strings.Contains(indexPath, "/unchained") { + if !strings.Contains(indexPath, string(os.PathSeparator) + "unchained") { indexPath = filepath.Join(indexPath, "unchained") } @@ -64,7 +64,7 @@ func PathToIndex(chain string) string { } // We know what we want, create it if it doesn't exist and return it - newPath := filepath.Join(indexPath, chain) + "/" + newPath := filepath.Join(indexPath, chain) + string(os.PathSeparator) EstablishIndexPaths(newPath) return newPath } @@ -80,7 +80,7 @@ func PathToCache(chain string) string { } // Probably already true, but can't hurt to be sure - if !strings.Contains(cachePath, "/cache") { + if !strings.Contains(cachePath, string(os.PathSeparator) + "cache") { cachePath = filepath.Join(cachePath, "cache") } @@ -90,7 +90,7 @@ func PathToCache(chain string) string { } // We know what we want, create it if it doesn't exist and return it - newPath := filepath.Join(cachePath, chain) + "/" + newPath := filepath.Join(cachePath, chain) + string(os.PathSeparator) EstablishCachePaths(newPath) return newPath } diff --git a/src/apps/chifra/pkg/file/lock.go b/src/apps/chifra/pkg/file/lock.go index 8ca9d53a2c..ae9e9db982 100644 --- a/src/apps/chifra/pkg/file/lock.go +++ b/src/apps/chifra/pkg/file/lock.go @@ -5,53 +5,14 @@ package file import ( - "errors" - "io" "os" - "syscall" "time" + "syscall" + "errors" ) var maxSecondsLock = 3 -// Lock asks the OS to lock a file for the current process -func Lock(file *os.File) error { - // Lock configuration. We want both read (F_RDLCK) and - // write (F_WRLCK) locks, and by Start to be interpreted - // as the start of the file (Whence set to SEEK_SET). - // - // More: https://man7.org/linux/man-pages/man2/fcntl.2.html - lockConfig := &syscall.Flock_t{ - Type: syscall.F_RDLCK | syscall.F_WRLCK, - Whence: int16(io.SeekStart), - Start: 0, - Len: 0, - } - - return changeLock(file, lockConfig) -} - -// Unlock removes OS-level file lock -func Unlock(file *os.File) error { - lockConfig := &syscall.Flock_t{ - Type: syscall.F_UNLCK, - Whence: int16(io.SeekStart), - Start: 0, - Len: 0, - } - - return changeLock(file, lockConfig) -} - -// changeLock is a helper function that sends the syscall to either lock or -// unlock a file -func changeLock(file *os.File, lockConfig *syscall.Flock_t) error { - // We use fcntl lock, which locks a file to a specific process - // - // More: https://stackoverflow.com/questions/29611352/what-is-the-difference-between-locking-with-fcntl-and-flock - return syscall.FcntlFlock(file.Fd(), syscall.F_SETLK, lockConfig) -} - var DefaultOpenFlags = os.O_RDWR | os.O_CREATE var DefaultOpenFlagsAppend = os.O_RDWR | os.O_CREATE | os.O_APPEND diff --git a/src/apps/chifra/pkg/file/lock_linux.go b/src/apps/chifra/pkg/file/lock_linux.go new file mode 100644 index 0000000000..921603a022 --- /dev/null +++ b/src/apps/chifra/pkg/file/lock_linux.go @@ -0,0 +1,50 @@ +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package file + +import ( + "errors" + "os" + "syscall" +) + + +// Lock asks the OS to lock a file for the current process +func Lock(file *os.File) error { + // Lock configuration. We want both read (F_RDLCK) and + // write (F_WRLCK) locks, and by Start to be interpreted + // as the start of the file (Whence set to SEEK_SET). + // + // More: https://man7.org/linux/man-pages/man2/fcntl.2.html + lockConfig := &syscall.Flock_t{ + Type: syscall.F_RDLCK | syscall.F_WRLCK, + Whence: int16(io.SeekStart), + Start: 0, + Len: 0, + } + + return changeLock(file, lockConfig) +} + +// Unlock removes OS-level file lock +func Unlock(file *os.File) error { + lockConfig := &syscall.Flock_t{ + Type: syscall.F_UNLCK, + Whence: int16(io.SeekStart), + Start: 0, + Len: 0, + } + + return changeLock(file, lockConfig) +} + +// changeLock is a helper function that sends the syscall to either lock or +// unlock a file +func changeLock(file *os.File, lockConfig *syscall.Flock_t) error { + // We use fcntl lock, which locks a file to a specific process + // + // More: https://stackoverflow.com/questions/29611352/what-is-the-difference-between-locking-with-fcntl-and-flock + return syscall.FcntlFlock(file.Fd(), syscall.F_SETLK, lockConfig) +} diff --git a/src/apps/chifra/pkg/file/lock_windows.go b/src/apps/chifra/pkg/file/lock_windows.go new file mode 100644 index 0000000000..12be98b3aa --- /dev/null +++ b/src/apps/chifra/pkg/file/lock_windows.go @@ -0,0 +1,17 @@ +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package file + +import ( + "os" +) + +func Lock(file *os.File) error { + return nil +} + +func Unlock(file *os.File) error { + return nil +} diff --git a/src/apps/chifra/pkg/index/download_chunks.go b/src/apps/chifra/pkg/index/download_chunks.go index c3da55592b..a50c65322f 100644 --- a/src/apps/chifra/pkg/index/download_chunks.go +++ b/src/apps/chifra/pkg/index/download_chunks.go @@ -14,7 +14,6 @@ import ( "net/http" "net/url" "os" - "path/filepath" "strconv" "strings" "sync" @@ -153,7 +152,7 @@ type fetchResult struct { // fetchFromIpfsGateway downloads a chunk from an IPFS gateway using HTTP func fetchFromIpfsGateway(ctx context.Context, gateway, hash string) (*fetchResult, error) { url, _ := url.Parse(gateway) - url.Path = filepath.Join(url.Path, hash) + url.Path += hash debug.DebugCurlStr(url.String()) request, err := http.NewRequestWithContext(ctx, "GET", url.String(), nil) diff --git a/src/apps/chifra/pkg/manifest/download.go b/src/apps/chifra/pkg/manifest/download.go index a332fd0a07..fa29ab8333 100644 --- a/src/apps/chifra/pkg/manifest/download.go +++ b/src/apps/chifra/pkg/manifest/download.go @@ -10,7 +10,6 @@ import ( "net/http" "net/url" "os" - "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/abi" @@ -69,7 +68,7 @@ func downloadManifest(chain, gatewayUrl, cid string) (*Manifest, error) { if err != nil { return nil, err } - url.Path = filepath.Join(url.Path, cid) + url.Path += cid debug.DebugCurlStr(url.String()) resp, err := http.Get(url.String()) diff --git a/src/apps/chifra/pkg/progress/scanbar.go b/src/apps/chifra/pkg/progress/scanbar.go index 2dcd7c2dec..203529fc75 100644 --- a/src/apps/chifra/pkg/progress/scanbar.go +++ b/src/apps/chifra/pkg/progress/scanbar.go @@ -8,10 +8,6 @@ import ( "fmt" "io" "strings" - "syscall" - "unsafe" - - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" ) type ScanBar struct { @@ -69,18 +65,3 @@ type winsize struct { Xpixel uint16 Ypixel uint16 } - -func screenWidth() uint { - ws := &winsize{} - retCode, _, _ := syscall.Syscall(syscall.SYS_IOCTL, - uintptr(syscall.Stdin), - uintptr(syscall.TIOCGWINSZ), - uintptr(unsafe.Pointer(ws))) - - if int(retCode) == -1 { - // This is okay if we're debugging in VSCode for example - // logger.Error("System call to syscall.SYS_IOCTL returned: ", errno) - return 120 // default reasonably - } - return uint(ws.Col) -} diff --git a/src/apps/chifra/pkg/progress/scanbar_linux.go b/src/apps/chifra/pkg/progress/scanbar_linux.go new file mode 100644 index 0000000000..821e0c6d3e --- /dev/null +++ b/src/apps/chifra/pkg/progress/scanbar_linux.go @@ -0,0 +1,28 @@ +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package progress + +import ( + "fmt" + "io" + "strings" + "syscall" + "unsafe" +) + +func screenWidth() uint { + ws := &winsize{} + retCode, _, _ := syscall.Syscall(syscall.SYS_IOCTL, + uintptr(syscall.Stdin), + uintptr(syscall.TIOCGWINSZ), + uintptr(unsafe.Pointer(ws))) + + if int(retCode) == -1 { + // This is okay if we're debugging in VSCode for example + // logger.Error("System call to syscall.SYS_IOCTL returned: ", errno) + return 120 // default reasonably + } + return uint(ws.Col) +} diff --git a/src/apps/chifra/pkg/progress/scanbar_windows.go b/src/apps/chifra/pkg/progress/scanbar_windows.go new file mode 100644 index 0000000000..0706580dc9 --- /dev/null +++ b/src/apps/chifra/pkg/progress/scanbar_windows.go @@ -0,0 +1,9 @@ +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package progress + +func screenWidth() uint { + return 120 // default reasonably +} diff --git a/src/apps/chifra/pkg/tslib/establish.go b/src/apps/chifra/pkg/tslib/establish.go index 0fe618689b..f10151425c 100644 --- a/src/apps/chifra/pkg/tslib/establish.go +++ b/src/apps/chifra/pkg/tslib/establish.go @@ -7,7 +7,6 @@ import ( "net/http" "net/url" "os" - "path/filepath" "time" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -54,7 +53,7 @@ func downloadTimestamps(chain, database, outputFn, cid string) (error, bool) { if err != nil { return err, false } - url.Path = filepath.Join(url.Path, cid) + url.Path += cid debug.DebugCurlStr(url.String()) From 080dee414e4415f3a35f0595c50ed78da342a467 Mon Sep 17 00:00:00 2001 From: doylet Date: Thu, 16 May 2024 22:10:46 +1000 Subject: [PATCH 035/121] Link to CURL using target_link_libraries --- src/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 782a289244..3d97e0dc3c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,7 +17,6 @@ find_package(Python COMPONENTS Interpreter Development) # ---------------------------------------------------------------------------------------- message(STATUS "======== LOOKING FOR CURL ========================") find_package(CURL REQUIRED) -include_directories(${CURL_INCLUDE_DIRS}) # ---------------------------------------------------------------------------------------- message(STATUS "======== LOOKING FOR GOLANG ========================") From 989fd7518e8122f74252d3c32127290b1820716d Mon Sep 17 00:00:00 2001 From: doylet Date: Mon, 20 May 2024 20:44:36 +1000 Subject: [PATCH 036/121] Fix more hardcoded '/' path seperators in chifra --- .../internal/scrape/scrape_consolidate.go | 2 +- src/apps/chifra/pkg/base/fileRange.go | 5 +++-- src/apps/chifra/pkg/config/paths.go | 4 ++-- src/apps/chifra/pkg/index/download_chunks.go | 4 ++-- src/apps/chifra/pkg/index/paths.go | 19 +++++++++++++------ 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/apps/chifra/internal/scrape/scrape_consolidate.go b/src/apps/chifra/internal/scrape/scrape_consolidate.go index b54e261b2c..4064132e2a 100644 --- a/src/apps/chifra/internal/scrape/scrape_consolidate.go +++ b/src/apps/chifra/internal/scrape/scrape_consolidate.go @@ -96,7 +96,7 @@ func (bm *BlazeManager) Consolidate(ctx context.Context, blocks []base.Blknum) e isOvertop := nAppearances >= int(bm.PerChunk()) // Does this block overtop a chunk? if isSnap || isOvertop { // Make a chunk - i.e., consolidate - chunkPath := indexPath + "finalized/" + chunkRange.String() + ".bin" + chunkPath := indexPath + "finalized" + string(os.PathSeparator) + chunkRange.String() + ".bin" publisher := base.ZeroAddr var chunk index.Chunk if report, err := chunk.Write(chain, publisher, chunkPath, appMap, nAppearances); err != nil { diff --git a/src/apps/chifra/pkg/base/fileRange.go b/src/apps/chifra/pkg/base/fileRange.go index ca8df66ddb..beba0850bf 100644 --- a/src/apps/chifra/pkg/base/fileRange.go +++ b/src/apps/chifra/pkg/base/fileRange.go @@ -10,6 +10,7 @@ import ( "path/filepath" "regexp" "strings" + "os" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" ) @@ -67,7 +68,7 @@ func RangeFromFilenameE(path string) (blkRange FileRange, err error) { // RangeFromRangeString returns a file range from a string func RangeFromRangeString(rngStr string) FileRange { - return RangeFromFilename(config.PathToIndex("mainnet") + "finalized/" + rngStr + ".bin") // okay to use mainnet since we're only interested in range + return RangeFromFilename(config.PathToIndex("mainnet") + "finalized" + string(os.PathSeparator) + rngStr + ".bin") // okay to use mainnet since we're only interested in range } func (r FileRange) String() string { @@ -76,7 +77,7 @@ func (r FileRange) String() string { // RangeToFilename returns a fileName and existence bool given a file range and a type func (r *FileRange) RangeToFilename(chain string) string { - return config.PathToIndex(chain) + "finalized/" + r.String() + ".bin" + return config.PathToIndex(chain) + "finalized" + string(os.PathSeparator) + r.String() + ".bin" } // Follows returns true if the range is strictly after the needle range. diff --git a/src/apps/chifra/pkg/config/paths.go b/src/apps/chifra/pkg/config/paths.go index d1037614e9..4f8be40a5d 100644 --- a/src/apps/chifra/pkg/config/paths.go +++ b/src/apps/chifra/pkg/config/paths.go @@ -28,7 +28,7 @@ func PathToChainConfig(chain string) (string, error) { ret := PathToRootConfig() // Our configuration files are always in ./config folder relative to top most folder - cfgFolder := filepath.Join(ret, "config/", chain) + "/" + cfgFolder := filepath.Join(ret, "config", chain) + string(os.PathSeparator) _, err := os.Stat(cfgFolder) return cfgFolder, err } @@ -100,7 +100,7 @@ func EstablishCachePaths(cachePath string) { folders := []string{ "abis", "monitors", - "monitors/staging", + filepath.Join("monitors", "staging"), "names", "tmp", "v1", diff --git a/src/apps/chifra/pkg/index/download_chunks.go b/src/apps/chifra/pkg/index/download_chunks.go index a50c65322f..732c36b029 100644 --- a/src/apps/chifra/pkg/index/download_chunks.go +++ b/src/apps/chifra/pkg/index/download_chunks.go @@ -113,7 +113,7 @@ func getDownloadWorker(chain string, workerArgs downloadWorkerArguments, chunkTy if workerArgs.ctx.Err() != nil { // User hit control + c - clean up both peices for the current chunk - chunkPath := config.PathToIndex(chain) + "finalized/" + chunk.Range + ".bin" + chunkPath := config.PathToIndex(chain) + "finalized" + string(os.PathSeparator) + chunk.Range + ".bin" removeLocalFile(ToIndexPath(chunkPath), "user canceled", progressChannel) removeLocalFile(ToBloomPath(chunkPath), "user canceled", progressChannel) progressChannel <- &progress.ProgressMsg{ @@ -307,7 +307,7 @@ func DownloadChunks(chain string, chunksToDownload []types.ChunkRecord, chunkTyp // writeBytesToDisc save the downloaded bytes to disc func writeBytesToDisc(chain string, chunkType walk.CacheType, res *jobResult) error { - fullPath := config.PathToIndex(chain) + "finalized/" + res.rng + ".bin" + fullPath := config.PathToIndex(chain) + "finalized" + string(os.PathSeparator) + res.rng + ".bin" if chunkType == walk.Index_Bloom { fullPath = ToBloomPath(fullPath) } diff --git a/src/apps/chifra/pkg/index/paths.go b/src/apps/chifra/pkg/index/paths.go index ea4ac5bf0f..28a4712432 100644 --- a/src/apps/chifra/pkg/index/paths.go +++ b/src/apps/chifra/pkg/index/paths.go @@ -2,6 +2,13 @@ package index import ( "strings" + "os" +) + +const ( + blooms_str = string(os.PathSeparator) + "blooms" + string(os.PathSeparator) + staging_str = string(os.PathSeparator) + "staging" + string(os.PathSeparator) + finalized_str = string(os.PathSeparator) + "finalized" + string(os.PathSeparator) ) func isCacheType(path string, folder, extension string) bool { @@ -21,8 +28,8 @@ func ToBloomPath(pathIn string) string { } ret := strings.Replace(pathIn, ".bin", ".bloom", -1) ret = strings.Replace(ret, ".txt", ".bloom", -1) - ret = strings.Replace(ret, "/finalized/", "/blooms/", -1) - ret = strings.Replace(ret, "/staging/", "/blooms/", -1) + ret = strings.Replace(ret, finalized_str, blooms_str, -1) + ret = strings.Replace(ret, staging_str, blooms_str, -1) return ret } @@ -34,8 +41,8 @@ func ToIndexPath(pathIn string) string { ret := strings.Replace(pathIn, ".bloom", ".bin", -1) ret = strings.Replace(ret, ".txt", ".bin", -1) - ret = strings.Replace(ret, "/blooms/", "/finalized/", -1) - ret = strings.Replace(ret, "/staging/", "/finalized/", -1) + ret = strings.Replace(ret, blooms_str, finalized_str, -1) + ret = strings.Replace(ret, staging_str, finalized_str, -1) return ret } @@ -47,7 +54,7 @@ func ToStagingPath(pathIn string) string { ret := strings.Replace(pathIn, ".bin", ".txt", -1) ret = strings.Replace(ret, ".bloom", ".txt", -1) - ret = strings.Replace(ret, "/finalized/", "/staging/", -1) - ret = strings.Replace(ret, "/blooms/", "/staging/", -1) + ret = strings.Replace(ret, finalized_str, staging_str, -1) + ret = strings.Replace(ret, blooms_str, staging_str, -1) return ret } From 2c8cf2c87c10626b5e1a30885d39adaee77bf6fb Mon Sep 17 00:00:00 2001 From: doylet Date: Wed, 22 May 2024 11:06:58 +1000 Subject: [PATCH 037/121] Fix more hardcoded '/' path seperators in chifra --- src/apps/chifra/pkg/monitor/monitor_freshen.go | 4 ++-- src/apps/chifra/pkg/walk/walk.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apps/chifra/pkg/monitor/monitor_freshen.go b/src/apps/chifra/pkg/monitor/monitor_freshen.go index 390b020b3a..5a9165377c 100644 --- a/src/apps/chifra/pkg/monitor/monitor_freshen.go +++ b/src/apps/chifra/pkg/monitor/monitor_freshen.go @@ -128,7 +128,7 @@ func (updater *MonitorUpdate) FreshenMonitors(monitorArray *[]Monitor) (bool, er return canceled, nil } - bloomPath := filepath.Join(config.PathToIndex(updater.Chain), "blooms/") + bloomPath := filepath.Join(config.PathToIndex(updater.Chain), "blooms" + string(os.PathSeparator)) files, err := os.ReadDir(bloomPath) if err != nil { return canceled, err @@ -144,7 +144,7 @@ func (updater *MonitorUpdate) FreshenMonitors(monitorArray *[]Monitor) (bool, er continue } if !info.IsDir() { - fileName := bloomPath + "/" + info.Name() + fileName := bloomPath + string(os.PathSeparator) + info.Name() if !walk.IsCacheType(fileName, walk.Index_Bloom, true /* checkExt */) { continue // sometimes there are .gz files in this folder, for example } diff --git a/src/apps/chifra/pkg/walk/walk.go b/src/apps/chifra/pkg/walk/walk.go index 25910a1bc0..2798581568 100644 --- a/src/apps/chifra/pkg/walk/walk.go +++ b/src/apps/chifra/pkg/walk/walk.go @@ -154,7 +154,7 @@ func GetRootPathFromCacheType(chain string, cacheType CacheType) string { case Cache_Names: fallthrough case Cache_Tmp: - return filepath.Join(config.PathToCache(chain), CacheTypeToFolder[cacheType]) + "/" + return filepath.Join(config.PathToCache(chain), CacheTypeToFolder[cacheType]) + string(os.PathSeparator) case Cache_Blocks: fallthrough @@ -177,7 +177,7 @@ func GetRootPathFromCacheType(chain string, cacheType CacheType) string { case Cache_Transactions: fallthrough case Cache_Withdrawals: - return filepath.Join(config.PathToCache(chain), "v1", CacheTypeToFolder[cacheType]) + "/" + return filepath.Join(config.PathToCache(chain), "v1", CacheTypeToFolder[cacheType]) + string(os.PathSeparator) case Index_Bloom: fallthrough @@ -190,7 +190,7 @@ func GetRootPathFromCacheType(chain string, cacheType CacheType) string { case Index_Unripe: fallthrough case Index_Maps: - return filepath.Join(config.PathToIndex(chain), CacheTypeToFolder[cacheType]) + "/" + return filepath.Join(config.PathToIndex(chain), CacheTypeToFolder[cacheType]) + string(os.PathSeparator) case Config: return config.PathToRootConfig() case Cache_NotACache: From 1aabe0a62840c40eac694c47977e2ddb772271bf Mon Sep 17 00:00:00 2001 From: doylet Date: Wed, 22 May 2024 20:18:27 +1000 Subject: [PATCH 038/121] Rebase onto develop, add go scripts for Windows to fix build --- scripts/go-mod-tidy.bat | 19 ++++++++++++++ scripts/go-work-sync.bat | 35 +++++++++++++++++++++++++ src/CMakeLists.txt | 10 +++---- src/apps/chifra/pkg/progress/scanbar.go | 1 + 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 scripts/go-mod-tidy.bat create mode 100644 scripts/go-work-sync.bat diff --git a/scripts/go-mod-tidy.bat b/scripts/go-mod-tidy.bat new file mode 100644 index 0000000000..77466546bc --- /dev/null +++ b/scripts/go-mod-tidy.bat @@ -0,0 +1,19 @@ +@echo off +setlocal + +:: Get the directory where the script is located +set SCRIPT_DIR_BACKSLASH=%~dp0 +set SCRIPT_DIR=%script_dir_backslash:~0,-1% +set ROOT_DIR=%SCRIPT_DIR%\.. + +:: Find all go.mod files and tidy them +cd /d %ROOT_DIR%\examples\balanceChart && go mod tidy +cd /d %ROOT_DIR%\examples\findFirst && go mod tidy +cd /d %ROOT_DIR%\examples\simple && go mod tidy +cd /d %ROOT_DIR%\src\apps\chifra && go mod tidy +cd /d %ROOT_DIR%\src\dev_tools\goMaker && go mod tidy +cd /d %ROOT_DIR%\src\dev_tools\sdkFuzzer && go mod tidy +cd /d %ROOT_DIR%\src\dev_tools\testRunner && go mod tidy + +:: Return to the original directory and exit +exit /b diff --git a/scripts/go-work-sync.bat b/scripts/go-work-sync.bat new file mode 100644 index 0000000000..b757057b8d --- /dev/null +++ b/scripts/go-work-sync.bat @@ -0,0 +1,35 @@ +@echo off +setlocal + +:: Get the directory where the script is located +set SCRIPT_DIR_BACKSLASH=%~dp0 +set SCRIPT_DIR=%script_dir_backslash:~0,-1% +set ROOT_DIR=%SCRIPT_DIR%\.. + +:: Regenerate the go.work file +set GO_WORK_FILE=%ROOT_DIR%\go.work +echo // Go Version > "%GO_WORK_FILE%" +echo go 1.22 >> "%GO_WORK_FILE%" + +:: Find all go.mod files in the src directory and add their directories to go.work +cd %ROOT_DIR% && go work use .\examples\balanceChart +cd %ROOT_DIR% && go work use .\examples\findFirst +cd %ROOT_DIR% && go work use .\examples\simple +cd %ROOT_DIR% && go work use .\src\apps\chifra +cd %ROOT_DIR% && go work use .\src\dev_tools\goMaker +cd %ROOT_DIR% && go work use .\src\dev_tools\sdkFuzzer +cd %ROOT_DIR% && go work use .\src\dev_tools\testRunner + +:: Run go work sync +cd /d %ROOT_DIR% && go work sync + +:: Display the contents of go.work +echo Created go.work with these contents. +type "%GO_WORK_FILE%" + +:: Run go-mod-tidy script +call "%SCRIPT_DIR%\go-mod-tidy.bat" + +:: Return to the original directory and exit +cd /d "%SCRIPT_DIR%" +exit /b diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3d97e0dc3c..e2033744fe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,7 +67,7 @@ add_custom_target(examples ALL COMMAND ${SCRIPTS_DIR}/build-examples.sh WORKING_ # ---------------------------------------------------------------------------------------- function(ADD_GO_INSTALLABLE_PROGRAM NAME MAIN_SRC DEST_DIR) get_filename_component(MAIN_SRC_ABS ${MAIN_SRC} ABSOLUTE) - file(GLOB SRC_FILE_LIST "*.go") + file(GLOB SRC_FILE_LIST "${MAIN_SRC}/*.go") set(EXE_NAME ${NAME}) if (WIN32) set(EXE_NAME ${NAME}.exe) @@ -85,10 +85,10 @@ endfunction(ADD_GO_INSTALLABLE_PROGRAM) # ---------------------------------------------------------------------------------------- add_subdirectory(other/install) -ADD_GO_INSTALLABLE_PROGRAM(chifra ${CMAKE_SOURCE_DIR}/apps/chifra/*.go ${BIN_DIR}) -ADD_GO_INSTALLABLE_PROGRAM(goMaker ${CMAKE_SOURCE_DIR}/dev_tools/goMaker/*.go ${BIN_DIR}) -ADD_GO_INSTALLABLE_PROGRAM(testRunner ${CMAKE_SOURCE_DIR}/dev_tools/testRunner/*.go ${BIN_DIR}) -ADD_GO_INSTALLABLE_PROGRAM(sdkFuzzer ${CMAKE_SOURCE_DIR}/dev_tools/sdkFuzzer/*.go ${BIN_DIR}) +ADD_GO_INSTALLABLE_PROGRAM(chifra ${CMAKE_SOURCE_DIR}/apps/chifra ${BIN_DIR}) +ADD_GO_INSTALLABLE_PROGRAM(goMaker ${CMAKE_SOURCE_DIR}/dev_tools/goMaker ${BIN_DIR}) +ADD_GO_INSTALLABLE_PROGRAM(testRunner ${CMAKE_SOURCE_DIR}/dev_tools/testRunner ${BIN_DIR}) +ADD_GO_INSTALLABLE_PROGRAM(sdkFuzzer ${CMAKE_SOURCE_DIR}/dev_tools/sdkFuzzer ${BIN_DIR}) add_dependencies(testRunner goMaker) add_dependencies(sdkFuzzer goMaker) diff --git a/src/apps/chifra/pkg/progress/scanbar.go b/src/apps/chifra/pkg/progress/scanbar.go index 203529fc75..a7222dbc4f 100644 --- a/src/apps/chifra/pkg/progress/scanbar.go +++ b/src/apps/chifra/pkg/progress/scanbar.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "strings" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" ) type ScanBar struct { From 2bd601e5d764bd1698239b2eb67c8f3fc74ee3dd Mon Sep 17 00:00:00 2001 From: doylet Date: Tue, 6 Aug 2024 22:05:50 +1000 Subject: [PATCH 039/121] Add new examples to scripts after rebase to develop --- scripts/go-mod-tidy.bat | 3 +++ scripts/go-work-sync.bat | 3 +++ 2 files changed, 6 insertions(+) diff --git a/scripts/go-mod-tidy.bat b/scripts/go-mod-tidy.bat index 77466546bc..b31a58797f 100644 --- a/scripts/go-mod-tidy.bat +++ b/scripts/go-mod-tidy.bat @@ -8,8 +8,11 @@ set ROOT_DIR=%SCRIPT_DIR%\.. :: Find all go.mod files and tidy them cd /d %ROOT_DIR%\examples\balanceChart && go mod tidy +cd /d %ROOT_DIR%\examples\cancelContext && go mod tidy cd /d %ROOT_DIR%\examples\findFirst && go mod tidy +cd /d %ROOT_DIR%\examples\nameManager && go mod tidy cd /d %ROOT_DIR%\examples\simple && go mod tidy +cd /d %ROOT_DIR%\examples\withStreaming && go mod tidy cd /d %ROOT_DIR%\src\apps\chifra && go mod tidy cd /d %ROOT_DIR%\src\dev_tools\goMaker && go mod tidy cd /d %ROOT_DIR%\src\dev_tools\sdkFuzzer && go mod tidy diff --git a/scripts/go-work-sync.bat b/scripts/go-work-sync.bat index b757057b8d..56aae47287 100644 --- a/scripts/go-work-sync.bat +++ b/scripts/go-work-sync.bat @@ -13,8 +13,11 @@ echo go 1.22 >> "%GO_WORK_FILE%" :: Find all go.mod files in the src directory and add their directories to go.work cd %ROOT_DIR% && go work use .\examples\balanceChart +cd %ROOT_DIR% && go work use .\examples\cancelContext cd %ROOT_DIR% && go work use .\examples\findFirst +cd %ROOT_DIR% && go work use .\examples\nameManager cd %ROOT_DIR% && go work use .\examples\simple +cd %ROOT_DIR% && go work use .\examples\withStreaming cd %ROOT_DIR% && go work use .\src\apps\chifra cd %ROOT_DIR% && go work use .\src\dev_tools\goMaker cd %ROOT_DIR% && go work use .\src\dev_tools\sdkFuzzer From 2e2149a2eada6397644936b754e2c233b7289d59 Mon Sep 17 00:00:00 2001 From: doylet Date: Tue, 6 Aug 2024 22:06:30 +1000 Subject: [PATCH 040/121] Use cross-platform glob for docker target, skip sdkFuzzer sdkFuzzer is complaining about a missing AbisList on Windows. This can be fixed in a subsequent commit, for the main purposes of Windows support we're looking to get a build of chifra.exe successfully. --- src/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e2033744fe..30ff990409 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -88,13 +88,17 @@ add_subdirectory(other/install) ADD_GO_INSTALLABLE_PROGRAM(chifra ${CMAKE_SOURCE_DIR}/apps/chifra ${BIN_DIR}) ADD_GO_INSTALLABLE_PROGRAM(goMaker ${CMAKE_SOURCE_DIR}/dev_tools/goMaker ${BIN_DIR}) ADD_GO_INSTALLABLE_PROGRAM(testRunner ${CMAKE_SOURCE_DIR}/dev_tools/testRunner ${BIN_DIR}) -ADD_GO_INSTALLABLE_PROGRAM(sdkFuzzer ${CMAKE_SOURCE_DIR}/dev_tools/sdkFuzzer ${BIN_DIR}) +if (NOT WIN32) + ADD_GO_INSTALLABLE_PROGRAM(sdkFuzzer ${CMAKE_SOURCE_DIR}/dev_tools/sdkFuzzer ${BIN_DIR}) + add_dependencies(sdkFuzzer goMaker) +endif() add_dependencies(testRunner goMaker) -add_dependencies(sdkFuzzer goMaker) add_dependencies(chifra testRunner) add_dependencies(examples chifra) + +file(GLOB CHIFRA_FOR_DOCKER_FILES "${CMAKE_SOURCE_DIR}/apps/chifra/*.go") add_custom_target(chifra-for-docker ALL - COMMAND ${GO_EXECUTABLE} build -o ${BIN_DIR}/chifra ${CMAKE_SOURCE_DIR}/apps/chifra/*.go + COMMAND ${GO_EXECUTABLE} build -o ${BIN_DIR}/chifra ${CHIFRA_FOR_DOCKER_FILES} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/apps/chifra - DEPENDS ${CMAKE_SOURCE_DIR}/apps/chifra/*.go) + DEPENDS ${CHIFRA_FOR_DOCKER_FILES}) From 615bc2f38fd9b88feb30057f1209edd3167c1d12 Mon Sep 17 00:00:00 2001 From: doylet Date: Tue, 6 Aug 2024 22:46:07 +1000 Subject: [PATCH 041/121] Fix more hardcoded unix '/' path separators --- src/apps/chifra/internal/abis/handle_decache.go | 2 +- src/apps/chifra/internal/abis/handle_list.go | 2 +- src/apps/chifra/internal/chunks/handle_diff.go | 6 +++--- src/apps/chifra/internal/init/handle_init_prepare.go | 2 +- src/apps/chifra/internal/monitors/handle_watch.go | 3 ++- src/apps/chifra/internal/scrape/scrape_blaze.go | 4 ++-- src/apps/chifra/pkg/cache/store.go | 2 +- src/apps/chifra/pkg/config/config.go | 6 +++--- src/apps/chifra/pkg/monitor/monitor.go | 4 ++-- src/apps/chifra/pkg/monitor/monitor_freshen.go | 2 +- src/apps/chifra/pkg/walk/walk.go | 4 ++-- 11 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/apps/chifra/internal/abis/handle_decache.go b/src/apps/chifra/internal/abis/handle_decache.go index bcbf678053..aceb369459 100644 --- a/src/apps/chifra/internal/abis/handle_decache.go +++ b/src/apps/chifra/internal/abis/handle_decache.go @@ -68,7 +68,7 @@ func (opts *AbisOptions) HandleDecache(rCtx *output.RenderCtx) error { } } else { for _, addr := range opts.Addrs { - path := config.PathToCache(chain) + "abis/" + addr + ".json" + path := config.PathToCache(chain) + "abis" + string(os.PathSeparator) + addr + ".json" if file.FileExists(path) { if err := os.Remove(path); err != nil { logger.Warn(colors.Red+"Could not remove abi for address", addr, ":", err, "."+colors.Off) diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index 208dd3e2c7..b1afb4e7ea 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -61,7 +61,7 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { } if testMode { abi.LastModDate = "--date--" - abi.Path = strings.ReplaceAll(abi.Path, config.PathToRootConfig(), "./") + abi.Path = strings.ReplaceAll(abi.Path, config.PathToRootConfig(), "." + string(os.PathSeparator)) } modelChan <- &abi } diff --git a/src/apps/chifra/internal/chunks/handle_diff.go b/src/apps/chifra/internal/chunks/handle_diff.go index aeb84c229f..5dcc790c45 100644 --- a/src/apps/chifra/internal/chunks/handle_diff.go +++ b/src/apps/chifra/internal/chunks/handle_diff.go @@ -75,7 +75,7 @@ func (opts *ChunksOptions) handleDiff(chain, path string) (bool, error) { } func writeArray(disp, dest, fn string, lines []string) error { - outputFolder, _ := filepath.Abs("./" + dest) + outputFolder, _ := filepath.Abs("." + string(os.PathSeparator) + dest) if !file.FolderExists(outputFolder) { if err := os.MkdirAll(outputFolder, os.ModePerm); err != nil { return err @@ -218,8 +218,8 @@ func (opts *ChunksOptions) getParams(chain, path string) (string, string, base.R func toDiffPath(chain string, middleMark base.Blknum) string { diffPath := os.Getenv("TB_CHUNKS_DIFFPATH") - if !strings.Contains(diffPath, "unchained/") { - diffPath = filepath.Join(diffPath, "unchained/", chain, "finalized") + if !strings.Contains(diffPath, "unchained" + string(os.PathSeparator)) { + diffPath = filepath.Join(diffPath, "unchained" + string(os.PathSeparator), chain, "finalized") } diffPath, _ = filepath.Abs(diffPath) diffPath, _ = findFileByBlockNumber(chain, diffPath, middleMark) diff --git a/src/apps/chifra/internal/init/handle_init_prepare.go b/src/apps/chifra/internal/init/handle_init_prepare.go index ff5bbc1431..fcf70e295d 100644 --- a/src/apps/chifra/internal/init/handle_init_prepare.go +++ b/src/apps/chifra/internal/init/handle_init_prepare.go @@ -209,7 +209,7 @@ func (opts *InitOptions) reportReason(prefix string, status InitReason, path str col := colors.BrightMagenta if status == FILE_ERROR || status == NOT_IN_MANIFEST { col = colors.BrightRed - } else if strings.Contains(path, "/blooms/") { + } else if strings.Contains(path, string(os.PathSeparator) + "blooms" + string(os.PathSeparator)) { col = colors.BrightYellow } rng := base.RangeFromFilename(path) diff --git a/src/apps/chifra/internal/monitors/handle_watch.go b/src/apps/chifra/internal/monitors/handle_watch.go index 0d1e902be4..8951cce37f 100644 --- a/src/apps/chifra/internal/monitors/handle_watch.go +++ b/src/apps/chifra/internal/monitors/handle_watch.go @@ -11,6 +11,7 @@ import ( "strings" "sync" "time" + "os" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/colors" @@ -42,7 +43,7 @@ func (opts *MonitorsOptions) RunMonitorScraper(wg *sync.WaitGroup, s *Scraper) { defer wg.Done() chain := opts.Globals.Chain - tmpPath := config.PathToCache(chain) + "tmp/" + tmpPath := config.PathToCache(chain) + "tmp" + string(os.PathSeparator) s.ChangeState(true, tmpPath) diff --git a/src/apps/chifra/internal/scrape/scrape_blaze.go b/src/apps/chifra/internal/scrape/scrape_blaze.go index b0119461e8..698b923da9 100644 --- a/src/apps/chifra/internal/scrape/scrape_blaze.go +++ b/src/apps/chifra/internal/scrape/scrape_blaze.go @@ -161,8 +161,8 @@ var writeMutex sync.Mutex // WriteAppearances writes the appearance for a chunk to a file func (bm *BlazeManager) WriteAppearances(bn base.Blknum, addrMap uniq.AddressBooleanMap) (err error) { - ripePath := config.PathToIndex(bm.chain) + "ripe/" - unripePath := config.PathToIndex(bm.chain) + "unripe/" + ripePath := config.PathToIndex(bm.chain) + "ripe" + string(os.PathSeparator) + unripePath := config.PathToIndex(bm.chain) + "unripe" + string(os.PathSeparator) appendScrapeError := func(err error) { bm.errors = append(bm.errors, scrapeError{block: bn, err: err}) } diff --git a/src/apps/chifra/pkg/cache/store.go b/src/apps/chifra/pkg/cache/store.go index f64d2b4c2c..431e73b438 100644 --- a/src/apps/chifra/pkg/cache/store.go +++ b/src/apps/chifra/pkg/cache/store.go @@ -70,7 +70,7 @@ func (s *Store) resolvePath(value Locator) (resolved string, err error) { err = errors.New("empty CacheLocations") return } - if strings.HasPrefix(directory, "/") { + if strings.HasPrefix(directory, string(os.PathSeparator)) { resolved = path.Join(directory, (id + "." + extension)) } else { resolved = path.Join(s.rootDir, directory, (id + "." + extension)) diff --git a/src/apps/chifra/pkg/config/config.go b/src/apps/chifra/pkg/config/config.go index 04d557c954..2be6abc8f5 100644 --- a/src/apps/chifra/pkg/config/config.go +++ b/src/apps/chifra/pkg/config/config.go @@ -43,9 +43,9 @@ type ConfigFile struct { // init sets up default values for the given configuration func init() { // The location of the per chain caches - cachePath = PathToRootConfig() + "cache/" + cachePath = PathToRootConfig() + "cache" + string(os.PathSeparator); // The location of the per chain unchained indexes - indexPath = PathToRootConfig() + "unchained/" + indexPath = PathToRootConfig() + "unchained" + string(os.PathSeparator); } var configMutex sync.Mutex @@ -185,7 +185,7 @@ func PathToRootConfig() string { osPath = "AppData/Local/trueblocks" } - return filepath.Join(user.HomeDir, osPath) + "/" + return filepath.Join(user.HomeDir, osPath) + string(os.PathSeparator) } func pathFromXDG(envVar string) (string, error) { diff --git a/src/apps/chifra/pkg/monitor/monitor.go b/src/apps/chifra/pkg/monitor/monitor.go index f9acc7d122..c46a5004c5 100644 --- a/src/apps/chifra/pkg/monitor/monitor.go +++ b/src/apps/chifra/pkg/monitor/monitor.go @@ -97,9 +97,9 @@ func (mon Monitor) String() string { // Path returns the path to the Monitor file func (mon *Monitor) Path() (path string) { if mon.Staged { - path = config.PathToCache(mon.Chain) + "monitors/staging/" + mon.Address.Hex() + Ext + path = config.PathToCache(mon.Chain) + "monitors" + string(os.PathSeparator) + "staging" + string(os.PathSeparator) + mon.Address.Hex() + Ext } else { - path = config.PathToCache(mon.Chain) + "monitors/" + mon.Address.Hex() + Ext + path = config.PathToCache(mon.Chain) + "monitors" + string(os.PathSeparator) + mon.Address.Hex() + Ext } return } diff --git a/src/apps/chifra/pkg/monitor/monitor_freshen.go b/src/apps/chifra/pkg/monitor/monitor_freshen.go index 5a9165377c..bb8e4d9292 100644 --- a/src/apps/chifra/pkg/monitor/monitor_freshen.go +++ b/src/apps/chifra/pkg/monitor/monitor_freshen.go @@ -362,7 +362,7 @@ func needsMigration(addr string) error { mon := Monitor{Address: base.HexToAddress(addr)} path := strings.Replace(mon.Path(), ".mon.bin", ".acct.bin", -1) if file.FileExists(path) { - path = strings.Replace(path, config.PathToCache(mon.Chain), "./", -1) + path = strings.Replace(path, config.PathToCache(mon.Chain), "." + string(os.PathSeparator), -1) return validate.Usage("Old style monitor found at {0}. Please run '{1}'", path, "chifra config --migrate cache") } return nil diff --git a/src/apps/chifra/pkg/walk/walk.go b/src/apps/chifra/pkg/walk/walk.go index 2798581568..b386d426e2 100644 --- a/src/apps/chifra/pkg/walk/walk.go +++ b/src/apps/chifra/pkg/walk/walk.go @@ -347,8 +347,8 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil } display := cacheInfo.Path - display = strings.Replace(display, config.PathToCache(chain), "./", -1) - display = strings.Replace(display, config.PathToIndex(chain), "./", -1) + display = strings.Replace(display, config.PathToCache(chain), "." + string(os.PathSeparator), -1) + display = strings.Replace(display, config.PathToIndex(chain), "." + string(os.PathSeparator), -1) switch cT { case Index_Maps: From e29d9ecf183c14330884701396bcc87be074cb51 Mon Sep 17 00:00:00 2001 From: doylet Date: Tue, 6 Aug 2024 23:05:44 +1000 Subject: [PATCH 042/121] Fix unused imports in _linux files error --- src/apps/chifra/pkg/file/lock_linux.go | 2 +- src/apps/chifra/pkg/progress/scanbar_linux.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/apps/chifra/pkg/file/lock_linux.go b/src/apps/chifra/pkg/file/lock_linux.go index 921603a022..f51c93402d 100644 --- a/src/apps/chifra/pkg/file/lock_linux.go +++ b/src/apps/chifra/pkg/file/lock_linux.go @@ -5,7 +5,7 @@ package file import ( - "errors" + "io" "os" "syscall" ) diff --git a/src/apps/chifra/pkg/progress/scanbar_linux.go b/src/apps/chifra/pkg/progress/scanbar_linux.go index 821e0c6d3e..465f3782d6 100644 --- a/src/apps/chifra/pkg/progress/scanbar_linux.go +++ b/src/apps/chifra/pkg/progress/scanbar_linux.go @@ -5,9 +5,6 @@ package progress import ( - "fmt" - "io" - "strings" "syscall" "unsafe" ) From 4556c1cc7b77acb3ff319c5037a9427480683f57 Mon Sep 17 00:00:00 2001 From: doylet Date: Wed, 7 Aug 2024 22:44:36 +1000 Subject: [PATCH 043/121] Use filepath.Join conservatively where possible instead of string(os.PathSeparator) --- src/apps/chifra/internal/abis/handle_decache.go | 2 +- src/apps/chifra/internal/chunks/handle_diff.go | 2 +- src/apps/chifra/internal/monitors/handle_watch.go | 2 +- src/apps/chifra/internal/scrape/scrape_blaze.go | 5 +++-- src/apps/chifra/internal/scrape/scrape_consolidate.go | 2 +- src/apps/chifra/pkg/base/fileRange.go | 5 ++--- src/apps/chifra/pkg/config/config.go | 4 ++-- src/apps/chifra/pkg/index/download_chunks.go | 5 +++-- src/apps/chifra/pkg/monitor/monitor.go | 4 ++-- src/apps/chifra/pkg/monitor/monitor_freshen.go | 2 +- 10 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/apps/chifra/internal/abis/handle_decache.go b/src/apps/chifra/internal/abis/handle_decache.go index aceb369459..1060e707de 100644 --- a/src/apps/chifra/internal/abis/handle_decache.go +++ b/src/apps/chifra/internal/abis/handle_decache.go @@ -68,7 +68,7 @@ func (opts *AbisOptions) HandleDecache(rCtx *output.RenderCtx) error { } } else { for _, addr := range opts.Addrs { - path := config.PathToCache(chain) + "abis" + string(os.PathSeparator) + addr + ".json" + path := filepath.Join(config.PathToCache(chain), "abis", addr + ".json") if file.FileExists(path) { if err := os.Remove(path); err != nil { logger.Warn(colors.Red+"Could not remove abi for address", addr, ":", err, "."+colors.Off) diff --git a/src/apps/chifra/internal/chunks/handle_diff.go b/src/apps/chifra/internal/chunks/handle_diff.go index 5dcc790c45..2a4361cf41 100644 --- a/src/apps/chifra/internal/chunks/handle_diff.go +++ b/src/apps/chifra/internal/chunks/handle_diff.go @@ -219,7 +219,7 @@ func (opts *ChunksOptions) getParams(chain, path string) (string, string, base.R func toDiffPath(chain string, middleMark base.Blknum) string { diffPath := os.Getenv("TB_CHUNKS_DIFFPATH") if !strings.Contains(diffPath, "unchained" + string(os.PathSeparator)) { - diffPath = filepath.Join(diffPath, "unchained" + string(os.PathSeparator), chain, "finalized") + diffPath = filepath.Join(diffPath, "unchained", chain, "finalized") } diffPath, _ = filepath.Abs(diffPath) diffPath, _ = findFileByBlockNumber(chain, diffPath, middleMark) diff --git a/src/apps/chifra/internal/monitors/handle_watch.go b/src/apps/chifra/internal/monitors/handle_watch.go index 8951cce37f..7ec44d6f50 100644 --- a/src/apps/chifra/internal/monitors/handle_watch.go +++ b/src/apps/chifra/internal/monitors/handle_watch.go @@ -43,7 +43,7 @@ func (opts *MonitorsOptions) RunMonitorScraper(wg *sync.WaitGroup, s *Scraper) { defer wg.Done() chain := opts.Globals.Chain - tmpPath := config.PathToCache(chain) + "tmp" + string(os.PathSeparator) + tmpPath := filepath.Join(config.PathToCache(chain), "tmp") + string(os.PathSeparator) s.ChangeState(true, tmpPath) diff --git a/src/apps/chifra/internal/scrape/scrape_blaze.go b/src/apps/chifra/internal/scrape/scrape_blaze.go index 698b923da9..5593abfa53 100644 --- a/src/apps/chifra/internal/scrape/scrape_blaze.go +++ b/src/apps/chifra/internal/scrape/scrape_blaze.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "os" + "path/filepath" "sort" "strings" "sync" @@ -161,8 +162,8 @@ var writeMutex sync.Mutex // WriteAppearances writes the appearance for a chunk to a file func (bm *BlazeManager) WriteAppearances(bn base.Blknum, addrMap uniq.AddressBooleanMap) (err error) { - ripePath := config.PathToIndex(bm.chain) + "ripe" + string(os.PathSeparator) - unripePath := config.PathToIndex(bm.chain) + "unripe" + string(os.PathSeparator) + ripePath := filepath.Join(config.PathToIndex(bm.chain), "ripe") + unripePath := filepath.Join(config.PathToIndex(bm.chain), "unripe") appendScrapeError := func(err error) { bm.errors = append(bm.errors, scrapeError{block: bn, err: err}) } diff --git a/src/apps/chifra/internal/scrape/scrape_consolidate.go b/src/apps/chifra/internal/scrape/scrape_consolidate.go index 4064132e2a..2ad1fdd7a2 100644 --- a/src/apps/chifra/internal/scrape/scrape_consolidate.go +++ b/src/apps/chifra/internal/scrape/scrape_consolidate.go @@ -96,7 +96,7 @@ func (bm *BlazeManager) Consolidate(ctx context.Context, blocks []base.Blknum) e isOvertop := nAppearances >= int(bm.PerChunk()) // Does this block overtop a chunk? if isSnap || isOvertop { // Make a chunk - i.e., consolidate - chunkPath := indexPath + "finalized" + string(os.PathSeparator) + chunkRange.String() + ".bin" + chunkPath := filepath.Join(indexPath, "finalized", chunkRange.String() + ".bin") publisher := base.ZeroAddr var chunk index.Chunk if report, err := chunk.Write(chain, publisher, chunkPath, appMap, nAppearances); err != nil { diff --git a/src/apps/chifra/pkg/base/fileRange.go b/src/apps/chifra/pkg/base/fileRange.go index beba0850bf..93b87994e5 100644 --- a/src/apps/chifra/pkg/base/fileRange.go +++ b/src/apps/chifra/pkg/base/fileRange.go @@ -10,7 +10,6 @@ import ( "path/filepath" "regexp" "strings" - "os" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" ) @@ -68,7 +67,7 @@ func RangeFromFilenameE(path string) (blkRange FileRange, err error) { // RangeFromRangeString returns a file range from a string func RangeFromRangeString(rngStr string) FileRange { - return RangeFromFilename(config.PathToIndex("mainnet") + "finalized" + string(os.PathSeparator) + rngStr + ".bin") // okay to use mainnet since we're only interested in range + return RangeFromFilename(filepath.Join(config.PathToIndex("mainnet"), "finalized", rngStr + ".bin")) // okay to use mainnet since we're only interested in range } func (r FileRange) String() string { @@ -77,7 +76,7 @@ func (r FileRange) String() string { // RangeToFilename returns a fileName and existence bool given a file range and a type func (r *FileRange) RangeToFilename(chain string) string { - return config.PathToIndex(chain) + "finalized" + string(os.PathSeparator) + r.String() + ".bin" + return filepath.Join(config.PathToIndex(chain), "finalized", r.String() + ".bin") } // Follows returns true if the range is strictly after the needle range. diff --git a/src/apps/chifra/pkg/config/config.go b/src/apps/chifra/pkg/config/config.go index 2be6abc8f5..1c3ea8e545 100644 --- a/src/apps/chifra/pkg/config/config.go +++ b/src/apps/chifra/pkg/config/config.go @@ -43,9 +43,9 @@ type ConfigFile struct { // init sets up default values for the given configuration func init() { // The location of the per chain caches - cachePath = PathToRootConfig() + "cache" + string(os.PathSeparator); + cachePath = filepath.Join(PathToRootConfig(), "cache") + string(os.PathSeparator) // The location of the per chain unchained indexes - indexPath = PathToRootConfig() + "unchained" + string(os.PathSeparator); + indexPath = filepath.Join(PathToRootConfig(), "unchained") + string(os.PathSeparator) } var configMutex sync.Mutex diff --git a/src/apps/chifra/pkg/index/download_chunks.go b/src/apps/chifra/pkg/index/download_chunks.go index 732c36b029..d105cd2091 100644 --- a/src/apps/chifra/pkg/index/download_chunks.go +++ b/src/apps/chifra/pkg/index/download_chunks.go @@ -14,6 +14,7 @@ import ( "net/http" "net/url" "os" + "path/filepath" "strconv" "strings" "sync" @@ -113,7 +114,7 @@ func getDownloadWorker(chain string, workerArgs downloadWorkerArguments, chunkTy if workerArgs.ctx.Err() != nil { // User hit control + c - clean up both peices for the current chunk - chunkPath := config.PathToIndex(chain) + "finalized" + string(os.PathSeparator) + chunk.Range + ".bin" + chunkPath := filepath.Join(config.PathToIndex(chain), "finalized", chunk.Range + ".bin") removeLocalFile(ToIndexPath(chunkPath), "user canceled", progressChannel) removeLocalFile(ToBloomPath(chunkPath), "user canceled", progressChannel) progressChannel <- &progress.ProgressMsg{ @@ -307,7 +308,7 @@ func DownloadChunks(chain string, chunksToDownload []types.ChunkRecord, chunkTyp // writeBytesToDisc save the downloaded bytes to disc func writeBytesToDisc(chain string, chunkType walk.CacheType, res *jobResult) error { - fullPath := config.PathToIndex(chain) + "finalized" + string(os.PathSeparator) + res.rng + ".bin" + fullPath := filepath.Join(config.PathToIndex(chain), "finalized", res.rng + ".bin") if chunkType == walk.Index_Bloom { fullPath = ToBloomPath(fullPath) } diff --git a/src/apps/chifra/pkg/monitor/monitor.go b/src/apps/chifra/pkg/monitor/monitor.go index c46a5004c5..a6236e75d7 100644 --- a/src/apps/chifra/pkg/monitor/monitor.go +++ b/src/apps/chifra/pkg/monitor/monitor.go @@ -97,9 +97,9 @@ func (mon Monitor) String() string { // Path returns the path to the Monitor file func (mon *Monitor) Path() (path string) { if mon.Staged { - path = config.PathToCache(mon.Chain) + "monitors" + string(os.PathSeparator) + "staging" + string(os.PathSeparator) + mon.Address.Hex() + Ext + path = filepath.Join(config.PathToCache(mon.Chain), "monitors", "staging", mon.Address.Hex() + Ext) } else { - path = config.PathToCache(mon.Chain) + "monitors" + string(os.PathSeparator) + mon.Address.Hex() + Ext + path = filepath.Join(config.PathToCache(mon.Chain), "monitors", mon.Address.Hex() + Ext) } return } diff --git a/src/apps/chifra/pkg/monitor/monitor_freshen.go b/src/apps/chifra/pkg/monitor/monitor_freshen.go index bb8e4d9292..eca28d56ba 100644 --- a/src/apps/chifra/pkg/monitor/monitor_freshen.go +++ b/src/apps/chifra/pkg/monitor/monitor_freshen.go @@ -144,7 +144,7 @@ func (updater *MonitorUpdate) FreshenMonitors(monitorArray *[]Monitor) (bool, er continue } if !info.IsDir() { - fileName := bloomPath + string(os.PathSeparator) + info.Name() + fileName := filepath.Join(bloomPath, info.Name()) if !walk.IsCacheType(fileName, walk.Index_Bloom, true /* checkExt */) { continue // sometimes there are .gz files in this folder, for example } From cf90b53c94e2364b0a40de88946f600d3a19d81e Mon Sep 17 00:00:00 2001 From: doylet Date: Thu, 8 Aug 2024 20:51:04 +1000 Subject: [PATCH 044/121] Remove appending of / path separator from strings where possible --- src/apps/chifra/internal/abis/handle_list.go | 2 +- src/apps/chifra/internal/chunks/handle_diff.go | 7 +++---- src/apps/chifra/internal/monitors/handle_watch.go | 3 +-- src/apps/chifra/pkg/config/config.go | 14 +++++++------- src/apps/chifra/pkg/config/paths.go | 11 +++++------ src/apps/chifra/pkg/monitor/monitor_freshen.go | 4 ++-- src/apps/chifra/pkg/walk/walk.go | 10 +++++----- 7 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index b1afb4e7ea..4ee9cc86dc 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -61,7 +61,7 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { } if testMode { abi.LastModDate = "--date--" - abi.Path = strings.ReplaceAll(abi.Path, config.PathToRootConfig(), "." + string(os.PathSeparator)) + abi.Path = filepath.Clean(strings.ReplaceAll(abi.Path, config.PathToRootConfig(), "./")) } modelChan <- &abi } diff --git a/src/apps/chifra/internal/chunks/handle_diff.go b/src/apps/chifra/internal/chunks/handle_diff.go index 2a4361cf41..8804607b37 100644 --- a/src/apps/chifra/internal/chunks/handle_diff.go +++ b/src/apps/chifra/internal/chunks/handle_diff.go @@ -4,10 +4,9 @@ import ( "encoding/binary" "fmt" "io" - "os" "path/filepath" "sort" - "strings" + "os" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/colors" @@ -75,7 +74,7 @@ func (opts *ChunksOptions) handleDiff(chain, path string) (bool, error) { } func writeArray(disp, dest, fn string, lines []string) error { - outputFolder, _ := filepath.Abs("." + string(os.PathSeparator) + dest) + outputFolder, _ := filepath.Abs("./" + dest) if !file.FolderExists(outputFolder) { if err := os.MkdirAll(outputFolder, os.ModePerm); err != nil { return err @@ -218,7 +217,7 @@ func (opts *ChunksOptions) getParams(chain, path string) (string, string, base.R func toDiffPath(chain string, middleMark base.Blknum) string { diffPath := os.Getenv("TB_CHUNKS_DIFFPATH") - if !strings.Contains(diffPath, "unchained" + string(os.PathSeparator)) { + if filepath.Base(diffPath) != "unchained" { diffPath = filepath.Join(diffPath, "unchained", chain, "finalized") } diffPath, _ = filepath.Abs(diffPath) diff --git a/src/apps/chifra/internal/monitors/handle_watch.go b/src/apps/chifra/internal/monitors/handle_watch.go index 7ec44d6f50..1c0b3750e2 100644 --- a/src/apps/chifra/internal/monitors/handle_watch.go +++ b/src/apps/chifra/internal/monitors/handle_watch.go @@ -11,7 +11,6 @@ import ( "strings" "sync" "time" - "os" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/colors" @@ -43,7 +42,7 @@ func (opts *MonitorsOptions) RunMonitorScraper(wg *sync.WaitGroup, s *Scraper) { defer wg.Done() chain := opts.Globals.Chain - tmpPath := filepath.Join(config.PathToCache(chain), "tmp") + string(os.PathSeparator) + tmpPath := filepath.Join(config.PathToCache(chain), "tmp") s.ChangeState(true, tmpPath) diff --git a/src/apps/chifra/pkg/config/config.go b/src/apps/chifra/pkg/config/config.go index 1c3ea8e545..ff8899d65e 100644 --- a/src/apps/chifra/pkg/config/config.go +++ b/src/apps/chifra/pkg/config/config.go @@ -43,9 +43,9 @@ type ConfigFile struct { // init sets up default values for the given configuration func init() { // The location of the per chain caches - cachePath = filepath.Join(PathToRootConfig(), "cache") + string(os.PathSeparator) + cachePath = filepath.Join(PathToRootConfig(), "cache") // The location of the per chain unchained indexes - indexPath = filepath.Join(PathToRootConfig(), "unchained") + string(os.PathSeparator) + indexPath = filepath.Join(PathToRootConfig(), "unchained") } var configMutex sync.Mutex @@ -83,22 +83,22 @@ func GetRootConfig() *ConfigFile { cachePath := trueBlocksConfig.Settings.CachePath if len(cachePath) == 0 || cachePath == "" { - cachePath = filepath.Join(configPath, "cache") + string(os.PathSeparator) + cachePath = filepath.Join(configPath, "cache") } cachePath = strings.Replace(cachePath, "$HOME", user.HomeDir, -1) cachePath = strings.Replace(cachePath, "~", user.HomeDir, -1) - if !strings.Contains(cachePath, string(os.PathSeparator) + "cache") { + if filepath.Base(cachePath) != "cache" { cachePath = filepath.Join(cachePath, "cache") } trueBlocksConfig.Settings.CachePath = cachePath indexPath := trueBlocksConfig.Settings.IndexPath if len(indexPath) == 0 || indexPath == "" { - indexPath = filepath.Join(configPath, "unchained") + string(os.PathSeparator) + indexPath = filepath.Join(configPath, "unchained") } indexPath = strings.Replace(indexPath, "$HOME", user.HomeDir, -1) indexPath = strings.Replace(indexPath, "~", user.HomeDir, -1) - if !strings.Contains(indexPath, string(os.PathSeparator) + "unchained") { + if filepath.Base(indexPath) != "unchained" { indexPath = filepath.Join(indexPath, "unchained") } trueBlocksConfig.Settings.IndexPath = indexPath @@ -185,7 +185,7 @@ func PathToRootConfig() string { osPath = "AppData/Local/trueblocks" } - return filepath.Join(user.HomeDir, osPath) + string(os.PathSeparator) + return filepath.Join(user.HomeDir, filepath.Clean(osPath)) } func pathFromXDG(envVar string) (string, error) { diff --git a/src/apps/chifra/pkg/config/paths.go b/src/apps/chifra/pkg/config/paths.go index 4f8be40a5d..780dfb9ab6 100644 --- a/src/apps/chifra/pkg/config/paths.go +++ b/src/apps/chifra/pkg/config/paths.go @@ -7,7 +7,6 @@ package config import ( "os" "path/filepath" - "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" @@ -28,7 +27,7 @@ func PathToChainConfig(chain string) (string, error) { ret := PathToRootConfig() // Our configuration files are always in ./config folder relative to top most folder - cfgFolder := filepath.Join(ret, "config", chain) + string(os.PathSeparator) + cfgFolder := filepath.Join(ret, "config", chain) _, err := os.Stat(cfgFolder) return cfgFolder, err } @@ -54,7 +53,7 @@ func PathToIndex(chain string) string { } // Probably already true, but can't hurt to be sure - if !strings.Contains(indexPath, string(os.PathSeparator) + "unchained") { + if filepath.Base(indexPath) != "unchained" { indexPath = filepath.Join(indexPath, "unchained") } @@ -64,7 +63,7 @@ func PathToIndex(chain string) string { } // We know what we want, create it if it doesn't exist and return it - newPath := filepath.Join(indexPath, chain) + string(os.PathSeparator) + newPath := filepath.Join(indexPath, chain) EstablishIndexPaths(newPath) return newPath } @@ -80,7 +79,7 @@ func PathToCache(chain string) string { } // Probably already true, but can't hurt to be sure - if !strings.Contains(cachePath, string(os.PathSeparator) + "cache") { + if filepath.Base(cachePath) != "cache" { cachePath = filepath.Join(cachePath, "cache") } @@ -90,7 +89,7 @@ func PathToCache(chain string) string { } // We know what we want, create it if it doesn't exist and return it - newPath := filepath.Join(cachePath, chain) + string(os.PathSeparator) + newPath := filepath.Join(cachePath, chain) EstablishCachePaths(newPath) return newPath } diff --git a/src/apps/chifra/pkg/monitor/monitor_freshen.go b/src/apps/chifra/pkg/monitor/monitor_freshen.go index eca28d56ba..3c588e869d 100644 --- a/src/apps/chifra/pkg/monitor/monitor_freshen.go +++ b/src/apps/chifra/pkg/monitor/monitor_freshen.go @@ -128,7 +128,7 @@ func (updater *MonitorUpdate) FreshenMonitors(monitorArray *[]Monitor) (bool, er return canceled, nil } - bloomPath := filepath.Join(config.PathToIndex(updater.Chain), "blooms" + string(os.PathSeparator)) + bloomPath := filepath.Join(config.PathToIndex(updater.Chain), "blooms") files, err := os.ReadDir(bloomPath) if err != nil { return canceled, err @@ -362,7 +362,7 @@ func needsMigration(addr string) error { mon := Monitor{Address: base.HexToAddress(addr)} path := strings.Replace(mon.Path(), ".mon.bin", ".acct.bin", -1) if file.FileExists(path) { - path = strings.Replace(path, config.PathToCache(mon.Chain), "." + string(os.PathSeparator), -1) + path = filepath.Clean(strings.Replace(path, config.PathToCache(mon.Chain), "./", -1)) return validate.Usage("Old style monitor found at {0}. Please run '{1}'", path, "chifra config --migrate cache") } return nil diff --git a/src/apps/chifra/pkg/walk/walk.go b/src/apps/chifra/pkg/walk/walk.go index b386d426e2..e52cf90561 100644 --- a/src/apps/chifra/pkg/walk/walk.go +++ b/src/apps/chifra/pkg/walk/walk.go @@ -154,7 +154,7 @@ func GetRootPathFromCacheType(chain string, cacheType CacheType) string { case Cache_Names: fallthrough case Cache_Tmp: - return filepath.Join(config.PathToCache(chain), CacheTypeToFolder[cacheType]) + string(os.PathSeparator) + return filepath.Join(config.PathToCache(chain), CacheTypeToFolder[cacheType]) case Cache_Blocks: fallthrough @@ -177,7 +177,7 @@ func GetRootPathFromCacheType(chain string, cacheType CacheType) string { case Cache_Transactions: fallthrough case Cache_Withdrawals: - return filepath.Join(config.PathToCache(chain), "v1", CacheTypeToFolder[cacheType]) + string(os.PathSeparator) + return filepath.Join(config.PathToCache(chain), "v1", CacheTypeToFolder[cacheType]) case Index_Bloom: fallthrough @@ -190,7 +190,7 @@ func GetRootPathFromCacheType(chain string, cacheType CacheType) string { case Index_Unripe: fallthrough case Index_Maps: - return filepath.Join(config.PathToIndex(chain), CacheTypeToFolder[cacheType]) + string(os.PathSeparator) + return filepath.Join(config.PathToIndex(chain), CacheTypeToFolder[cacheType]) case Config: return config.PathToRootConfig() case Cache_NotACache: @@ -347,8 +347,8 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil } display := cacheInfo.Path - display = strings.Replace(display, config.PathToCache(chain), "." + string(os.PathSeparator), -1) - display = strings.Replace(display, config.PathToIndex(chain), "." + string(os.PathSeparator), -1) + display = filepath.Clean(strings.Replace(display, config.PathToCache(chain), "./", -1)) + display = filepath.Clean(strings.Replace(display, config.PathToIndex(chain), "./", -1)) switch cT { case Index_Maps: From f27f25e084ed8a805df713a8b1f33e92ad016e39 Mon Sep 17 00:00:00 2001 From: doylet Date: Thu, 8 Aug 2024 21:12:15 +1000 Subject: [PATCH 045/121] Remove unnecessary Clean on path, join cleans the path --- src/apps/chifra/pkg/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/chifra/pkg/config/config.go b/src/apps/chifra/pkg/config/config.go index ff8899d65e..acfe9b08d5 100644 --- a/src/apps/chifra/pkg/config/config.go +++ b/src/apps/chifra/pkg/config/config.go @@ -185,7 +185,7 @@ func PathToRootConfig() string { osPath = "AppData/Local/trueblocks" } - return filepath.Join(user.HomeDir, filepath.Clean(osPath)) + return filepath.Join(user.HomeDir, osPath) } func pathFromXDG(envVar string) (string, error) { From 025f4bc0cb46e76088b2926c489e503234a6f592 Mon Sep 17 00:00:00 2001 From: doylet Date: Thu, 8 Aug 2024 21:12:38 +1000 Subject: [PATCH 046/121] Put import os back to where it originally was to avoid churn --- src/apps/chifra/internal/chunks/handle_diff.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/chifra/internal/chunks/handle_diff.go b/src/apps/chifra/internal/chunks/handle_diff.go index 8804607b37..e71294954c 100644 --- a/src/apps/chifra/internal/chunks/handle_diff.go +++ b/src/apps/chifra/internal/chunks/handle_diff.go @@ -4,9 +4,9 @@ import ( "encoding/binary" "fmt" "io" + "os" "path/filepath" "sort" - "os" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/colors" From df9f5c785c0ee22683e648d2ba993b4de75c64a2 Mon Sep 17 00:00:00 2001 From: doylet Date: Thu, 8 Aug 2024 21:20:55 +1000 Subject: [PATCH 047/121] Disable testRunner on Windows due to new issues I now get this error which I'm not privvy with the knowledge to fix just yet. ``` FAILED: CMakeFiles/testRunner.util cmd.exe /C "cd /D C:\Home\Code\trueblocks-core\src && go build -o C:/Home/Code/trueblocks-core/src/../bin/testRunner.exe C:/Home/Code/trueblocks-core/src/dev_tools/testRunner/api_server.go C:/Home/Code/trueblocks-core/src/dev_tools/testRunner/filter.go C:/Home/Code/trueblocks-core/src/dev_tools/testRunner/main.go C:/Home/Code/trueblocks-core/src/dev_tools/testRunner/main_test.go C:/Home/Code/trueblocks-core/src/dev_tools/testRunner/prepare.go C:/Home/Code/trueblocks-core/src/dev_tools/testRunner/run_api.go C:/Home/Code/trueblocks-core/src/dev_tools/testRunner/run_cmd.go C:/Home/Code/trueblocks-core/src/dev_tools/testRunner/run_sdk.go C:/Home/Code/trueblocks-core/src/dev_tools/testRunner/test_case.go C:/Home/Code/trueblocks-core/src/dev_tools/testRunner/test_runner.go" C:\Users\\go\pkg\mod\github.com\!true!blocks\trueblocks-core\sdk\v3@v3.0.0-20240728020742-8b2832e69983\when_internal.go:86:9: undefined: types.TimestampCount C:\Users\\go\pkg\mod\github.com\!true!blocks\trueblocks-core\sdk\v3@v3.0.0-20240728020742-8b2832e69983\when.go:59:47: undefined: types.TimestampCount C:\Users\\go\pkg\mod\github.com\!true!blocks\trueblocks-core\sdk\v3@v3.0.0-20240728020742-8b2832e69983\when.go:62:25: undefined: types.TimestampCount ``` --- src/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30ff990409..f4a4786209 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -87,14 +87,14 @@ add_subdirectory(other/install) ADD_GO_INSTALLABLE_PROGRAM(chifra ${CMAKE_SOURCE_DIR}/apps/chifra ${BIN_DIR}) ADD_GO_INSTALLABLE_PROGRAM(goMaker ${CMAKE_SOURCE_DIR}/dev_tools/goMaker ${BIN_DIR}) -ADD_GO_INSTALLABLE_PROGRAM(testRunner ${CMAKE_SOURCE_DIR}/dev_tools/testRunner ${BIN_DIR}) if (NOT WIN32) + ADD_GO_INSTALLABLE_PROGRAM(testRunner ${CMAKE_SOURCE_DIR}/dev_tools/testRunner ${BIN_DIR}) ADD_GO_INSTALLABLE_PROGRAM(sdkFuzzer ${CMAKE_SOURCE_DIR}/dev_tools/sdkFuzzer ${BIN_DIR}) add_dependencies(sdkFuzzer goMaker) + add_dependencies(testRunner goMaker) + add_dependencies(chifra testRunner) endif() -add_dependencies(testRunner goMaker) -add_dependencies(chifra testRunner) add_dependencies(examples chifra) file(GLOB CHIFRA_FOR_DOCKER_FILES "${CMAKE_SOURCE_DIR}/apps/chifra/*.go") From 93844581547c292c2b3840843ee1254eff966660 Mon Sep 17 00:00:00 2001 From: doylet Date: Thu, 8 Aug 2024 21:30:55 +1000 Subject: [PATCH 048/121] Fix trueblocks.toml incorrectly appending file path instead of joining --- src/apps/chifra/cmd/root_initialize.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/chifra/cmd/root_initialize.go b/src/apps/chifra/cmd/root_initialize.go index add4650219..fbf40194c5 100644 --- a/src/apps/chifra/cmd/root_initialize.go +++ b/src/apps/chifra/cmd/root_initialize.go @@ -67,7 +67,7 @@ func VerifyMigrations() { } // ...and the config file better exist. - configFile := filepath.Join(configFolder + "trueBlocks.toml") + configFile := filepath.Join(configFolder, "trueBlocks.toml") if _, err := os.Stat(configFile); err != nil { msg := strings.Replace(doesNotExist, "{0}", "{"+configFile+"}", -1) msg = colors.ColoredWith(msg, colors.Yellow) From 946a6a3493fe01e4f800de7455bbb5b945d20d61 Mon Sep 17 00:00:00 2001 From: doylet Date: Thu, 8 Aug 2024 21:54:30 +1000 Subject: [PATCH 049/121] Fix .bloom file incorrectly being saved to finalized folder --- src/apps/chifra/pkg/index/paths.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/apps/chifra/pkg/index/paths.go b/src/apps/chifra/pkg/index/paths.go index 28a4712432..a2649f00a2 100644 --- a/src/apps/chifra/pkg/index/paths.go +++ b/src/apps/chifra/pkg/index/paths.go @@ -3,6 +3,7 @@ package index import ( "strings" "os" + "path/filepath" ) const ( @@ -26,7 +27,7 @@ func ToBloomPath(pathIn string) string { if isCacheType(pathIn, "blooms", "bloom") { return pathIn } - ret := strings.Replace(pathIn, ".bin", ".bloom", -1) + ret := strings.Replace(filepath.Clean(pathIn), ".bin", ".bloom", -1)) ret = strings.Replace(ret, ".txt", ".bloom", -1) ret = strings.Replace(ret, finalized_str, blooms_str, -1) ret = strings.Replace(ret, staging_str, blooms_str, -1) @@ -39,7 +40,7 @@ func ToIndexPath(pathIn string) string { return pathIn } - ret := strings.Replace(pathIn, ".bloom", ".bin", -1) + ret := strings.Replace(filepath.Clean(pathIn), ".bloom", ".bin", -1)) ret = strings.Replace(ret, ".txt", ".bin", -1) ret = strings.Replace(ret, blooms_str, finalized_str, -1) ret = strings.Replace(ret, staging_str, finalized_str, -1) @@ -52,7 +53,7 @@ func ToStagingPath(pathIn string) string { return pathIn } - ret := strings.Replace(pathIn, ".bin", ".txt", -1) + ret := strings.Replace(filepath.Clean(pathIn), ".bin", ".txt", -1)) ret = strings.Replace(ret, ".bloom", ".txt", -1) ret = strings.Replace(ret, finalized_str, staging_str, -1) ret = strings.Replace(ret, blooms_str, staging_str, -1) From a2ee10e135c50d159d65acf042723df53b9069a9 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 21:57:15 -0400 Subject: [PATCH 050/121] Updates go.mods --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index 6fe256b20f..084ccacf3b 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index e051e57078..ffde232b76 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index f25ebb9ebc..ce449a3fde 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 6c2b7fa181..290baf684b 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index 368103994b..0a43d25099 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index 2746da8164..07c081ce5a 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index d57e61d4e7..7f192ff45e 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index 35cb35c439..fd1bd5f818 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index b4f76e33ff..fb0135799f 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index 41fde2b04c..37dfa47b68 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index e4ac25377a..e6fa35c6bb 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index 44ca297637..bd44a607a9 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index 26cbbff185..cffad971cc 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index 9f3b1999b6..bd15bea50c 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From 43932c80d8de750655a49b93d6308d69e763ad57 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:05:32 -0400 Subject: [PATCH 051/121] Small step towards Windows support --- src/CMakeLists.txt | 34 +++-- src/apps/chifra/pkg/file/lock.go | 43 +----- src/apps/chifra/pkg/file/lock_unix.go | 52 ++++++++ src/apps/chifra/pkg/file/lock_windows.go | 19 +++ src/apps/chifra/pkg/progress/scanbar.go | 18 --- src/apps/chifra/pkg/progress/scanbar_unix.go | 28 ++++ .../chifra/pkg/progress/scanbar_windows.go | 10 ++ src/dev_tools/goMaker/types/check.go | 124 ------------------ src/other/install/init_configs.cmake | 2 +- 9 files changed, 134 insertions(+), 196 deletions(-) create mode 100644 src/apps/chifra/pkg/file/lock_unix.go create mode 100644 src/apps/chifra/pkg/file/lock_windows.go create mode 100644 src/apps/chifra/pkg/progress/scanbar_unix.go create mode 100644 src/apps/chifra/pkg/progress/scanbar_windows.go delete mode 100644 src/dev_tools/goMaker/types/check.go diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e64537b64d..4741c0ac36 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,7 +17,6 @@ find_package(Python COMPONENTS Interpreter Development) # ---------------------------------------------------------------------------------------- message(STATUS "======== LOOKING FOR CURL ========================") find_package(CURL REQUIRED) -include_directories(${CURL_INCLUDE_DIRS}) # ---------------------------------------------------------------------------------------- message(STATUS "======== LOOKING FOR GOLANG ========================") @@ -68,11 +67,17 @@ add_custom_target(examples ALL COMMAND ${SCRIPTS_DIR}/build-examples.sh WORKING_ # ---------------------------------------------------------------------------------------- function(ADD_GO_INSTALLABLE_PROGRAM NAME MAIN_SRC DEST_DIR) get_filename_component(MAIN_SRC_ABS ${MAIN_SRC} ABSOLUTE) + file(GLOB SRC_FILE_LIST "${MAIN_SRC}/*.go") + set(EXE_NAME ${NAME}) + if (WIN32) + set(EXE_NAME ${NAME}.exe) + endif() + add_custom_target(${NAME} ALL) add_custom_command(TARGET ${NAME} COMMAND go build - -o "${DEST_DIR}/${NAME}" - ${CMAKE_GO_FLAGS} ${MAIN_SRC} + -o "${DEST_DIR}/${EXE_NAME}" + ${CMAKE_GO_FLAGS} ${SRC_FILE_LIST} WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} DEPENDS ${MAIN_SRC_ABS} ${MAIN_SRC}) endfunction(ADD_GO_INSTALLABLE_PROGRAM) @@ -80,16 +85,21 @@ endfunction(ADD_GO_INSTALLABLE_PROGRAM) # ---------------------------------------------------------------------------------------- add_subdirectory(other/install) -ADD_GO_INSTALLABLE_PROGRAM(chifra ${CMAKE_SOURCE_DIR}/apps/chifra/*.go ${BIN_DIR}) -ADD_GO_INSTALLABLE_PROGRAM(goMaker ${CMAKE_SOURCE_DIR}/dev_tools/goMaker/*.go ${BIN_DIR}) -ADD_GO_INSTALLABLE_PROGRAM(testRunner ${CMAKE_SOURCE_DIR}/dev_tools/testRunner/*.go ${BIN_DIR}) -ADD_GO_INSTALLABLE_PROGRAM(sdkFuzzer ${CMAKE_SOURCE_DIR}/dev_tools/sdkFuzzer/*.go ${BIN_DIR}) +ADD_GO_INSTALLABLE_PROGRAM(chifra ${CMAKE_SOURCE_DIR}/apps/chifra ${BIN_DIR}) +ADD_GO_INSTALLABLE_PROGRAM(goMaker ${CMAKE_SOURCE_DIR}/dev_tools/goMaker ${BIN_DIR}) +if (NOT WIN32) + ADD_GO_INSTALLABLE_PROGRAM(testRunner ${CMAKE_SOURCE_DIR}/dev_tools/testRunner ${BIN_DIR}) + ADD_GO_INSTALLABLE_PROGRAM(sdkFuzzer ${CMAKE_SOURCE_DIR}/dev_tools/sdkFuzzer ${BIN_DIR}) + add_dependencies(testRunner goMaker) + add_dependencies(sdkFuzzer goMaker) + add_dependencies(chifra testRunner) +endif() -add_dependencies(testRunner goMaker) -add_dependencies(sdkFuzzer goMaker) -add_dependencies(chifra testRunner) add_dependencies(examples chifra) + +file(GLOB CHIFRA_FOR_DOCKER_FILES "${CMAKE_SOURCE_DIR}/apps/chifra/*.go") add_custom_target(chifra-for-docker ALL - COMMAND ${GO_EXECUTABLE} build -o ${BIN_DIR}/chifra ${CMAKE_SOURCE_DIR}/apps/chifra/*.go + COMMAND ${GO_EXECUTABLE} build -o ${BIN_DIR}/chifra ${CHIFRA_FOR_DOCKER_FILES} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/apps/chifra - DEPENDS ${CMAKE_SOURCE_DIR}/apps/chifra/*.go) + DEPENDS ${CHIFRA_FOR_DOCKER_FILES} +) diff --git a/src/apps/chifra/pkg/file/lock.go b/src/apps/chifra/pkg/file/lock.go index 8ca9d53a2c..ae9e9db982 100644 --- a/src/apps/chifra/pkg/file/lock.go +++ b/src/apps/chifra/pkg/file/lock.go @@ -5,53 +5,14 @@ package file import ( - "errors" - "io" "os" - "syscall" "time" + "syscall" + "errors" ) var maxSecondsLock = 3 -// Lock asks the OS to lock a file for the current process -func Lock(file *os.File) error { - // Lock configuration. We want both read (F_RDLCK) and - // write (F_WRLCK) locks, and by Start to be interpreted - // as the start of the file (Whence set to SEEK_SET). - // - // More: https://man7.org/linux/man-pages/man2/fcntl.2.html - lockConfig := &syscall.Flock_t{ - Type: syscall.F_RDLCK | syscall.F_WRLCK, - Whence: int16(io.SeekStart), - Start: 0, - Len: 0, - } - - return changeLock(file, lockConfig) -} - -// Unlock removes OS-level file lock -func Unlock(file *os.File) error { - lockConfig := &syscall.Flock_t{ - Type: syscall.F_UNLCK, - Whence: int16(io.SeekStart), - Start: 0, - Len: 0, - } - - return changeLock(file, lockConfig) -} - -// changeLock is a helper function that sends the syscall to either lock or -// unlock a file -func changeLock(file *os.File, lockConfig *syscall.Flock_t) error { - // We use fcntl lock, which locks a file to a specific process - // - // More: https://stackoverflow.com/questions/29611352/what-is-the-difference-between-locking-with-fcntl-and-flock - return syscall.FcntlFlock(file.Fd(), syscall.F_SETLK, lockConfig) -} - var DefaultOpenFlags = os.O_RDWR | os.O_CREATE var DefaultOpenFlagsAppend = os.O_RDWR | os.O_CREATE | os.O_APPEND diff --git a/src/apps/chifra/pkg/file/lock_unix.go b/src/apps/chifra/pkg/file/lock_unix.go new file mode 100644 index 0000000000..834acafb44 --- /dev/null +++ b/src/apps/chifra/pkg/file/lock_unix.go @@ -0,0 +1,52 @@ +//go:build !windows +// +build !windows + +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package file + +import ( + "io" + "os" + "syscall" +) + +// Lock asks the OS to lock a file for the current process +func Lock(file *os.File) error { + // Lock configuration. We want both read (F_RDLCK) and + // write (F_WRLCK) locks, and by Start to be interpreted + // as the start of the file (Whence set to SEEK_SET). + // + // More: https://man7.org/linux/man-pages/man2/fcntl.2.html + lockConfig := &syscall.Flock_t{ + Type: syscall.F_RDLCK | syscall.F_WRLCK, + Whence: int16(io.SeekStart), + Start: 0, + Len: 0, + } + + return changeLock(file, lockConfig) +} + +// Unlock removes OS-level file lock +func Unlock(file *os.File) error { + lockConfig := &syscall.Flock_t{ + Type: syscall.F_UNLCK, + Whence: int16(io.SeekStart), + Start: 0, + Len: 0, + } + + return changeLock(file, lockConfig) +} + +// changeLock is a helper function that sends the syscall to either lock or +// unlock a file +func changeLock(file *os.File, lockConfig *syscall.Flock_t) error { + // We use fcntl lock, which locks a file to a specific process + // + // More: https://stackoverflow.com/questions/29611352/what-is-the-difference-between-locking-with-fcntl-and-flock + return syscall.FcntlFlock(file.Fd(), syscall.F_SETLK, lockConfig) +} diff --git a/src/apps/chifra/pkg/file/lock_windows.go b/src/apps/chifra/pkg/file/lock_windows.go new file mode 100644 index 0000000000..3a95a711c1 --- /dev/null +++ b/src/apps/chifra/pkg/file/lock_windows.go @@ -0,0 +1,19 @@ +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package file + +import ( + "os" +) + +func Lock(file *os.File) error { + // TODO: Don't we need this? + return nil +} + +func Unlock(file *os.File) error { + // TODO: DOn't we need this? + return nil +} diff --git a/src/apps/chifra/pkg/progress/scanbar.go b/src/apps/chifra/pkg/progress/scanbar.go index 2dcd7c2dec..a7222dbc4f 100644 --- a/src/apps/chifra/pkg/progress/scanbar.go +++ b/src/apps/chifra/pkg/progress/scanbar.go @@ -8,9 +8,6 @@ import ( "fmt" "io" "strings" - "syscall" - "unsafe" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" ) @@ -69,18 +66,3 @@ type winsize struct { Xpixel uint16 Ypixel uint16 } - -func screenWidth() uint { - ws := &winsize{} - retCode, _, _ := syscall.Syscall(syscall.SYS_IOCTL, - uintptr(syscall.Stdin), - uintptr(syscall.TIOCGWINSZ), - uintptr(unsafe.Pointer(ws))) - - if int(retCode) == -1 { - // This is okay if we're debugging in VSCode for example - // logger.Error("System call to syscall.SYS_IOCTL returned: ", errno) - return 120 // default reasonably - } - return uint(ws.Col) -} diff --git a/src/apps/chifra/pkg/progress/scanbar_unix.go b/src/apps/chifra/pkg/progress/scanbar_unix.go new file mode 100644 index 0000000000..78c39b3a0a --- /dev/null +++ b/src/apps/chifra/pkg/progress/scanbar_unix.go @@ -0,0 +1,28 @@ +//go:build !windows +// +build !windows + +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package progress + +import ( + "syscall" + "unsafe" +) + +func screenWidth() uint { + ws := &winsize{} + retCode, _, _ := syscall.Syscall(syscall.SYS_IOCTL, + uintptr(syscall.Stdin), + uintptr(syscall.TIOCGWINSZ), + uintptr(unsafe.Pointer(ws))) + + if int(retCode) == -1 { + // This is okay if we're debugging in VSCode for example + // logger.Error("System call to syscall.SYS_IOCTL returned: ", errno) + return 120 // default reasonably + } + return uint(ws.Col) +} diff --git a/src/apps/chifra/pkg/progress/scanbar_windows.go b/src/apps/chifra/pkg/progress/scanbar_windows.go new file mode 100644 index 0000000000..ac8694fc97 --- /dev/null +++ b/src/apps/chifra/pkg/progress/scanbar_windows.go @@ -0,0 +1,10 @@ +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package progress + +func screenWidth() uint { + // TODO: Can we read the screen width? + return 120 // default reasonably +} diff --git a/src/dev_tools/goMaker/types/check.go b/src/dev_tools/goMaker/types/check.go deleted file mode 100644 index 0d4eb187d1..0000000000 --- a/src/dev_tools/goMaker/types/check.go +++ /dev/null @@ -1,124 +0,0 @@ -package types - -// handle_gocmds_docfile -// verifyGoEnumValidators -// verifyDescriptions -// replaceAll(source, "opts.LastBlock != base.NOPOS", "opts.LastBlock != 0 && opts.LastBlock != base.NOPOS"); -// string_q n = "readme-intros/" + substitute(toLower(cmd.group), " ", "") + "-" + cmd.a pi_route + ".config.md"; -// string_q configDocs = getDocsPathTemplates(n); -// ::remove(configDocs.c_str()); // remove it if it exists, we will replace it -// ostringstream os; -// bool hasConfig = 0; -// for (auto member : *((C CommandOptionArray*)cmd.members)) { -// if (member.generate == "config") { -// ostringstream dd; -// if (!hasConfig) { -// dd << "| " << padRight("Item", 18) << " | " << padRight("Type", 12) << " | " << padRight("Default", 12) -// << " | Description / Default |" << endl; -// dd << "| " << string_q(18, '-') << " | " << string_q(12, '-') << " | " << string_q(12, '-') -// << " | --------- |" << endl; -// } -// string_q x = toCamelCase(member.Format("[{LONGNAME}]")); -// dd << "| " << padRight(x, 18) << " | " << padRight(member.Format("[{GO_INTYPE}]"), 12) << " | " -// << padRight(member.Format("[{DEF_VAL}]"), 12) << " | " << member.Format("[{DESCRIPTION}]") << " |" -// << endl; -// appendToAsciiFile(configDocs, dd.str()); -// hasConfig = true; -// continue; -// } -// string_q var = member.Format("[{VARIABLE}]"); -// string_q type = member.Format("[{GO_INTYPE}]"); -// ONE(os, var, varWidth, type, typeWidth, member.description); -// if (contains(var, "Blocks") && contains(member.go_intype, "[]string")) { -// ONE(os, "BlockIds", varWidth, "[]identifiers.Identifier", typeWidth, "block identifiers"); -// } -// if (contains(var, "Transactions") && contains(member.go_intype, "[]string")) { -// ONE(os, "TransactionIds", varWidth, "[]identifiers.Identifier", typeWidth, "transaction identifiers"); -// } -// } -// if (hasConfig) { -// string type = cmd.Format("config.[{PROPER}]Settings"); -// ONE(os, "Settings", varWidth, type, typeWidth, "Configuration items for the " + cmd.a pi_route); -// } -// ONE(os, "Globals", varWidth, "globals.GlobalOptions", typeWidth, "the global options"); -// ONE(os, "Conn", varWidth, "*rpc.Connection", typeWidth, "the connection to the RPC server"); -// ONE(os, "BadFlag", varWidth, "error", typeWidth, "an error flag if needed"); -// hasValidator(const string_q& route, const string_q& str) { -// string_q contents = asciiFileToString(getPathToSourc e("apps/chifra/internal/" + route + "/validate.go")); -// CStringArray parts; -// explode(parts, str, '|'); -// for (auto part : parts) { -// if (!contains(contents, part)) -// return false; -// } -// return true; -// } - -// //--------------------------------------------------------------------------------------------------- -// void COptions::verifyGoEnumValidators(void) { -// string_q e = p.data_type; -// replace(e, "enum", ""); -// replace(e, "list", ""); -// replaceAny(e, "<[*]>", ""); -// e = "[" + e + "]"; -// if (!hasValidator(p.a pi_route, e)) { -// LOG_WARN("\t", bRed, p.a pi_route, " has no enum validator for ", e, cOff); -// exit(0); -// } -// } -// if (p.generate == "deprecated") { -// if (!hasValidator(p.a pi_route, "deprecated|--" + p.longName)) { -// ostringstream os; -// os << "The '" << p.a pi_route << " --" << p.longName -// << "' option is deprecated, but no usage message in validate.go"; -// LOG_WARN("\t", bRed, os.str(), cOff); -// } -// } -// } -// } - -// //--------------------------------------------------------------------------------------------------- -// bool COptions::handle_gocmds_docfile(const CCommandOption& ep) { -// string_q source = asciiFileToString(getPathToTemplates("blank_doc.go.tmpl")); -// string_q fn = getPathToSourc e("apps/chifra/internal/" + ep.a pi_route + "/doc.go"); -// establishFolder(fn); - -// string_q docFn = substitute(toLower(ep.group), " ", "") + "-" + ep.a pi_route + ".md"; -// string_q docSource = getDocsPathTemplates("readme-intros/" + docFn); -// const char* STR_WHAT = "// Package [{a pi_route}]Pkg handles the chifra [{a pi_route}] command. It "; -// string_q contents = STR_WHAT + asciiFileToString(docSource); -// contents = substitute(substitute(substitute(contents, "\n", " "), "\t", " "), "\r", " "); -// replaceAll(contents, " ", " "); -// replaceAll(contents, "`", ""); -// replaceAll(contents, "[{NAME}]", "[chifra {ROUTE}]"); -// replaceAll(source, "TEXT_TEMPLATE", contents); -// replaceAll(source, "[{ROUTE}]", ep.a pi_route); -// replaceAll(source, "[{LOWER}]", toLower(ep.a pi_route)); -// source = ep.Format(source); - -// codewrite_t cw(fn, source); -// cw.nSpaces = 0; -// cw.stripEOFNL = false; -// counter.nProcessed += writeCod eIn(this, cw); -// counter.nVisited++; - -// return true; -// } -//--------------------------------------------------------------------------------------------------- -// void COptions::verifyDescriptions(void) { -// for (auto ep : endpointAr ray) { -// if (!ep.is_visible) -// continue; -// for (auto option : cmdOptionArra y) { -// if (ep.a pi_route == option.a pi_route && option.option_type == "comm and") { -// if (ep.description != option.description) { -// ostringstream os; -// os << "Endpoint descriptions for " << ep.a pi_route << " do not agree:" << endl; -// os << "\tendpoint: " << ep.description << endl; -// os << "\toption: " << option.description << endl; -// LOG_WARN(os.str()); -// } -// } -// } -// } -// } diff --git a/src/other/install/init_configs.cmake b/src/other/install/init_configs.cmake index a0f7ba5e47..68c3f644ed 100644 --- a/src/other/install/init_configs.cmake +++ b/src/other/install/init_configs.cmake @@ -54,7 +54,7 @@ set(INSTALL_DEST "$ENV{XDG_CONFIG_HOME}") if("${INSTALL_DEST}" STREQUAL "") if(WIN32) - PrintLine("Windows build is not supported") + set(INSTALL_DEST "$ENV{LOCALAPPDATA}/trueblocks") elseif(APPLE) set(INSTALL_DEST "$ENV{HOME}/Library/Application Support/TrueBlocks") else() From c95102c76aea22ac4e595fbac1c53fa8b438e9d3 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:13:47 -0400 Subject: [PATCH 052/121] cleaning --- src/other/four_bytes/pkg/fourBytes/generate.go | 17 ++++++++++------- src/other/four_bytes/pkg/fourBytes/verify.go | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/other/four_bytes/pkg/fourBytes/generate.go b/src/other/four_bytes/pkg/fourBytes/generate.go index 008d1216a3..cd35574514 100644 --- a/src/other/four_bytes/pkg/fourBytes/generate.go +++ b/src/other/four_bytes/pkg/fourBytes/generate.go @@ -5,7 +5,7 @@ import ( "fmt" "io" "os" - "path" + "path/filepath" "runtime" "sync" @@ -43,7 +43,7 @@ func collectWorker(i interface{}) { args := i.(*collectWorkerArgs) var offset uint32 = 0 - key := path.Join(args.DirName, args.FileName) + key := filepath.Join(args.DirName, args.FileName) // lock mutex for writing mu.Lock() @@ -79,7 +79,7 @@ func writeWorker(i interface{}) { defer writeWg.Done() args := i.(*writePoolArgs) - out, err := os.OpenFile(path.Join(args.outDir, args.key), os.O_RDWR|os.O_CREATE, 0666) + out, err := os.OpenFile(filepath.Join(args.outDir, args.key), os.O_RDWR|os.O_CREATE, 0666) if err != nil { panic(err) } @@ -93,15 +93,18 @@ func writeWorker(i interface{}) { // GenerateFromFiles reads input files and creates four bytes database. It then sends it to writeWorkers to save // chunk files. func GenerateFromFiles(outDir string) (err error) { - sigsFile, err := os.OpenFile(path.Join(config.PathToRootConfig(), "abis/known-000/uniq_sigs.tab"), os.O_RDONLY, 0) + sigsFn := filepath.Join(config.PathToRootConfig(), "abis/known-000/uniq_sigs.tab") + sigsFile, err := os.OpenFile(sigsFn, os.O_RDONLY, 0) if err != nil { return } - funcsFile, err := os.OpenFile(path.Join(config.PathToRootConfig(), "abis/known-000/uniq_funcs.tab"), os.O_RDONLY, 0) + funcsFn := filepath.Join(config.PathToRootConfig(), "abis/known-000/uniq_funcs.tab") + funcsFile, err := os.OpenFile(funcsFn, os.O_RDONLY, 0) if err != nil { return } - eventsFile, err := os.OpenFile(path.Join(config.PathToRootConfig(), "abis/known-000/uniq_events.tab"), os.O_RDONLY, 0) + eventsFn := filepath.Join(config.PathToRootConfig(), "abis/known-000/uniq_events.tab") + eventsFile, err := os.OpenFile(eventsFn, os.O_RDONLY, 0) if err != nil { return } @@ -157,7 +160,7 @@ func GenerateFromFiles(outDir string) (err error) { fileName := fmt.Sprintf("%x", encoded[:2]) dirName := fileName[:2] - err := file.EstablishFolder(path.Join(outDir, dirName)) + err := file.EstablishFolder(filepath.Join(outDir, dirName)) if err != nil { return err } diff --git a/src/other/four_bytes/pkg/fourBytes/verify.go b/src/other/four_bytes/pkg/fourBytes/verify.go index 04ceb4a3a4..10860e9a8f 100644 --- a/src/other/four_bytes/pkg/fourBytes/verify.go +++ b/src/other/four_bytes/pkg/fourBytes/verify.go @@ -3,7 +3,7 @@ package fourbytes import ( "fmt" "os" - "path" + "path/filepath" ) func logError(filename string, err string) { @@ -23,7 +23,7 @@ func Verify(chunks *map[string]mapRecord, outDir string) { logError(filePath, "empty") continue } - file, err := os.OpenFile(path.Join(outDir, filePath), os.O_RDONLY, 0) + file, err := os.OpenFile(filepath.Join(outDir, filePath), os.O_RDONLY, 0) if err != nil { logError(filePath, err.Error()) file.Close() From 54db5a9ed9b0d2d066e229d5eaca411c5e8035d8 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:16:41 -0400 Subject: [PATCH 053/121] Cleaning testRunner use of filepath --- src/dev_tools/testRunner/main.go | 14 +++++++------- src/dev_tools/testRunner/test_case.go | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dev_tools/testRunner/main.go b/src/dev_tools/testRunner/main.go index 1cd554634a..ee043a82d9 100644 --- a/src/dev_tools/testRunner/main.go +++ b/src/dev_tools/testRunner/main.go @@ -49,7 +49,7 @@ func main() { summary := NewSummary() for _, item := range routeList { - source := casesPath + item + ".csv" + source := filepath.Join(casesPath, item+".csv") for _, mode := range modeList { tr := NewRunner(testMap, item, mode, source) for _, testCase := range testMap[source] { @@ -120,7 +120,7 @@ func parseCsv(filePath string) ([]TestCase, error) { record: rec, IsEnabled: rec.Enabled == "on", HasShorthand: strings.Contains(rec.Options, "@"), - WorkingPath: filepath.Join(getWorkingPath(), rec.Path, rec.Tool) + "/", + WorkingPath: filepath.Join(getWorkingPath(), rec.Path, rec.Tool), OrigOptions: rec.Options, SourceFile: filePath, } @@ -315,15 +315,15 @@ func getRepoRoot() string { } func getCasesPath() string { - return filepath.Join(getRepoRoot(), "src/dev_tools/testRunner/testCases") + "/" + return filepath.Join(getRepoRoot(), "src/dev_tools/testRunner/testCases") } func getGeneratedPath() string { - return filepath.Join(getRepoRoot(), "src/dev_tools/testRunner/generated") + "/" + return filepath.Join(getRepoRoot(), "src/dev_tools/testRunner/generated") } func getWorkingPath() string { - return filepath.Join(getRepoRoot(), "tests/working") + "/" + return filepath.Join(getRepoRoot(), "tests/working") } func getTempFilePath(goldFn string) string { @@ -331,7 +331,7 @@ func getTempFilePath(goldFn string) string { } func getLogFile(mode string) string { - return getGeneratedPath() + "test_" + mode + ".log" + return filepath.Join(getGeneratedPath(), "test_"+mode+".log") } func loadTestCases() (map[string][]TestCase, string, error) { @@ -360,6 +360,6 @@ func loadTestCases() (map[string][]TestCase, string, error) { return testMap, casesPath, fmt.Errorf("error walking the path %q: %v", casesPath, err) } - file.StringToAsciiFile(getGeneratedPath()+"testCases.json", toJson(testMap)) + file.StringToAsciiFile(filepath.Join(getGeneratedPath(), "testCases.json"), toJson(testMap)) return testMap, casesPath, nil } diff --git a/src/dev_tools/testRunner/test_case.go b/src/dev_tools/testRunner/test_case.go index a67fb4201c..3cacaa78f7 100644 --- a/src/dev_tools/testRunner/test_case.go +++ b/src/dev_tools/testRunner/test_case.go @@ -82,14 +82,14 @@ func (t *TestCase) ShouldRun(mode string) bool { func (t *TestCase) GetOutputPaths(mode string) (string, string, string, string) { working := t.WorkingPath if mode != "cmd" { - working = filepath.Join(t.WorkingPath, mode+"_tests") + "/" + working = filepath.Join(t.WorkingPath, mode+"_tests") } gold := strings.ReplaceAll(working, "working", "gold") workFn := filepath.Join(working, t.Tool+"_"+t.Filename+".txt") goldFn := filepath.Join(gold, t.Tool+"_"+t.Filename+".txt") testRoot := func(s string) string { - return strings.ReplaceAll(strings.ReplaceAll(s, "sdk_tests/", ""), "api_tests/", "") + return strings.ReplaceAll(strings.ReplaceAll(s, "sdk_tests", ""), "api_tests", "") } envFn := filepath.Join(testRoot(gold), t.Filename+".env") if !file.FileExists(envFn) { From aa3df607bd260eeeb8aeed58413c930671c05e1f Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:20:07 -0400 Subject: [PATCH 054/121] Improves use of filepath in dev_tools --- src/dev_tools/goMaker/types/generate.go | 8 ++++-- src/dev_tools/goMaker/types/load.go | 2 +- src/dev_tools/goMaker/types/types_command.go | 2 +- .../goMaker/types/types_structure.go | 4 +-- src/dev_tools/goMaker/types/utils.go | 2 +- .../goMaker/types/verifyValidators.go | 27 +++++++++++++++++++ src/dev_tools/sdkFuzzer/globals.go | 3 ++- 7 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 src/dev_tools/goMaker/types/verifyValidators.go diff --git a/src/dev_tools/goMaker/types/generate.go b/src/dev_tools/goMaker/types/generate.go index d15fd72257..381c417fd6 100644 --- a/src/dev_tools/goMaker/types/generate.go +++ b/src/dev_tools/goMaker/types/generate.go @@ -1,6 +1,7 @@ package types import ( + "os" "path/filepath" "sort" "strings" @@ -18,6 +19,9 @@ type Generator struct { // Generate generates the code for the codebase using the given templates. func (cb *CodeBase) Generate() { + // Before we start, we need to verify that the validators are in place + cb.verifyValidators() + generatedPath := GetGeneratedPath() file.EstablishFolder(generatedPath) @@ -87,8 +91,8 @@ func getGenerators() ([]Generator, error) { vFunc := func(file string, vP any) (bool, error) { if strings.HasSuffix(file, ".tmpl") { file = strings.ReplaceAll(file, generatorsPath, "") - if strings.Contains(file, "/") { - parts := strings.Split(file, "/") + if strings.Contains(file, string(os.PathSeparator)) { + parts := strings.Split(file, string(os.PathSeparator)) theMap[parts[0]] = append(theMap[parts[0]], file) } } diff --git a/src/dev_tools/goMaker/types/load.go b/src/dev_tools/goMaker/types/load.go index e9f709eed7..9f5f50cfce 100644 --- a/src/dev_tools/goMaker/types/load.go +++ b/src/dev_tools/goMaker/types/load.go @@ -142,7 +142,7 @@ func (cb *CodeBase) LoadMembers(thePath string, structMap map[string]Structure) return nil } -func (cb *CodeBase) FinishLoad(thePath string, baseTypes []Structure, options []Option, structMap map[string]Structure) error { +func (cb *CodeBase) FinishLoad(unused string, baseTypes []Structure, options []Option, structMap map[string]Structure) error { cb.BaseTypes = baseTypes for i := 0; i < len(cb.BaseTypes); i++ { cb.BaseTypes[i].cbPtr = cb diff --git a/src/dev_tools/goMaker/types/types_command.go b/src/dev_tools/goMaker/types/types_command.go index 8968f916d0..ea62b739f7 100644 --- a/src/dev_tools/goMaker/types/types_command.go +++ b/src/dev_tools/goMaker/types/types_command.go @@ -547,7 +547,7 @@ func (c *Command) HelpLinks() string { } func (c *Command) HelpNotes() string { - readmePath := filepath.Join(GetTemplatePath(), "readme-intros/"+c.ReadmeName()) + readmePath := filepath.Join(GetTemplatePath(), "readme-intros", c.ReadmeName()) readmePath = strings.Replace(readmePath, ".md", ".notes.md", -1) if file.FileExists(readmePath) { tmplName := "Notes" + c.ReadmeName() diff --git a/src/dev_tools/goMaker/types/types_structure.go b/src/dev_tools/goMaker/types/types_structure.go index a56fc02b56..74a2cc8885 100644 --- a/src/dev_tools/goMaker/types/types_structure.go +++ b/src/dev_tools/goMaker/types/types_structure.go @@ -109,7 +109,7 @@ func (s *Structure) GroupName() string { func (s *Structure) ModelIntro() string { tmplName := "modelIntro" + s.Class - tmpl := strings.Trim(getTemplateContents("model-intros/"+CamelCase(s.Class)), ws) + tmpl := strings.Trim(getTemplateContents(filepath.Join("model-intros", CamelCase(s.Class))), ws) return s.executeTemplate(tmplName, tmpl) } @@ -143,7 +143,7 @@ func (s *Structure) ModelMembers() string { func (s *Structure) ModelNotes() string { tmplName := "Notes" + s.Class - tmpl := strings.Trim(getTemplateContents("model-intros/"+CamelCase(s.Class)+".notes"), ws) + tmpl := strings.Trim(getTemplateContents(filepath.Join("model-intros", CamelCase(s.Class)+".notes")), ws) return strings.Trim(s.executeTemplate(tmplName, tmpl), ws) } diff --git a/src/dev_tools/goMaker/types/utils.go b/src/dev_tools/goMaker/types/utils.go index c7dd3c7aeb..a4e39ee39d 100644 --- a/src/dev_tools/goMaker/types/utils.go +++ b/src/dev_tools/goMaker/types/utils.go @@ -102,7 +102,7 @@ func getTemplatesPath() (string, error) { } for _, path := range paths { - thePath := filepath.Join(path, "templates/") + thePath := filepath.Join(path, "templates") if file.FolderExists(thePath) { setRootFolder(path) return thePath, nil diff --git a/src/dev_tools/goMaker/types/verifyValidators.go b/src/dev_tools/goMaker/types/verifyValidators.go new file mode 100644 index 0000000000..1b0403d9e5 --- /dev/null +++ b/src/dev_tools/goMaker/types/verifyValidators.go @@ -0,0 +1,27 @@ +package types + +import ( + "fmt" + "os" + "path/filepath" + "strings" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" +) + +func (cb *CodeBase) verifyValidators() { + cwd, _ := os.Getwd() + for _, cmd := range cb.Commands { + path := filepath.Join(cwd, "src/apps/chifra/internal/", cmd.Route, "validate.go") + for _, opts := range cmd.Options { + if len(opts.Enums) > 0 { + contents := file.AsciiFileToString(path) + want := strings.Join(opts.Enums, "|") + if !strings.Contains(contents, want) { + logger.Fatal(fmt.Sprintf("Missing enum validator (%s) for %s", want, path)) + } + } + } + } +} diff --git a/src/dev_tools/sdkFuzzer/globals.go b/src/dev_tools/sdkFuzzer/globals.go index 1c60c803e7..90b98d3d29 100644 --- a/src/dev_tools/sdkFuzzer/globals.go +++ b/src/dev_tools/sdkFuzzer/globals.go @@ -3,6 +3,7 @@ package main import ( "fmt" "os" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/sdk/v3" @@ -44,7 +45,7 @@ func getFilename(baseName string, g *sdk.Globals) string { app += "-verbose" } - return "sdkFuzzer-output/" + baseName + app + ".json" + return filepath.Join("sdkFuzzer-output", baseName+app+".json") } var spaces = strings.Repeat(" ", 30) From aea32f4972a9d37ce7dfcf3500fa0f022e211519 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:27:19 -0400 Subject: [PATCH 055/121] Improves use of filepath in pkg/abis and pkg/cache --- src/apps/chifra/pkg/abi/load_abi.go | 19 +++++++++---------- src/apps/chifra/pkg/cache/cache.go | 3 ++- src/apps/chifra/pkg/cache/store.go | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/apps/chifra/pkg/abi/load_abi.go b/src/apps/chifra/pkg/abi/load_abi.go index bc5808b915..8139b731cd 100644 --- a/src/apps/chifra/pkg/abi/load_abi.go +++ b/src/apps/chifra/pkg/abi/load_abi.go @@ -10,7 +10,6 @@ import ( "io" "io/fs" "os" - "path" "path/filepath" "strings" @@ -385,7 +384,7 @@ func readFunction(reader *bufio.Reader) (function *types.Function, err error) { // getAbis reads all ABIs stored in the cache func getAbis(chain string) ([]types.Function, error) { - fullPath := path.Join(config.PathToCache(chain), walk.CacheTypeToFolder[walk.Cache_Abis], "known.bin") + fullPath := filepath.Join(config.PathToCache(chain), walk.CacheTypeToFolder[walk.Cache_Abis], "known.bin") if f, err := os.OpenFile(fullPath, os.O_RDONLY, 0); err != nil { return nil, err @@ -597,7 +596,7 @@ func writeAbis(writer *bufio.Writer, abis []types.Function) (err error) { // setAbis writes ABIs to the cache func setAbis(chain string, abis []types.Function) (err error) { - var abisFilePath = path.Join(walk.CacheTypeToFolder[walk.Cache_Abis], "known.bin") + var abisFilePath = filepath.Join(walk.CacheTypeToFolder[walk.Cache_Abis], "known.bin") buf := bytes.Buffer{} writer := bufio.NewWriter(&buf) if err = writeAbis(writer, abis); err != nil { @@ -613,7 +612,7 @@ func setAbis(chain string, abis []types.Function) (err error) { // save writes contents of `content` Reader to a file func save(chain string, filePath string, content io.Reader) (err error) { cacheDir := config.PathToCache(chain) - fullPath := path.Join(cacheDir, filePath) + fullPath := filepath.Join(cacheDir, filePath) var f *os.File if file.FileExists(fullPath) { @@ -641,8 +640,8 @@ func save(chain string, filePath string, content io.Reader) (err error) { // LoadKnownAbis loads known ABI files into abiMap, refreshing binary cache if needed func (abiMap *SelectorSyncMap) LoadKnownAbis(chain string) (err error) { isUpToDate := func(chain string) (bool, error) { - testFn := path.Join(config.PathToCache(chain), "abis/known.bin") - testDir := path.Join(config.PathToRootConfig(), "abis") + testFn := filepath.Join(config.PathToCache(chain), "abis/known.bin") + testDir := filepath.Join(config.PathToRootConfig(), "abis") if cacheFile, err := os.Stat(testFn); os.IsNotExist(err) { return false, nil @@ -686,7 +685,7 @@ func (abiMap *SelectorSyncMap) LoadKnownAbis(chain string) (err error) { } func getKnownAbiPaths() (filePaths []string, err error) { - knownDirPath := path.Join(config.PathToRootConfig(), "abis") + knownDirPath := filepath.Join(config.PathToRootConfig(), "abis") err = filepath.WalkDir(knownDirPath, func(path string, d fs.DirEntry, err error) error { if err != nil { return err @@ -752,7 +751,7 @@ func loadAbiFromAddress(conn *rpc.Connection, address base.Address, abiMap *Sele // insertAbi copies file (e.g. opened local file) into cache func insertAbi(chain string, address base.Address, inputReader io.Reader) error { - fullPath := path.Join(config.PathToCache(chain), walk.CacheTypeToFolder[walk.Cache_Abis], address.Hex()+".json") + fullPath := filepath.Join(config.PathToCache(chain), walk.CacheTypeToFolder[walk.Cache_Abis], address.Hex()+".json") if file, err := os.OpenFile(fullPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666); err != nil { return err } else { @@ -766,8 +765,8 @@ func insertAbi(chain string, address base.Address, inputReader io.Reader) error // getAbi returns single ABI per address. ABI-per-address are stored as JSON, not binary. func getAbi(chain string, address base.Address) (simpleAbis []types.Function, err error) { - filePath := path.Join(walk.CacheTypeToFolder[walk.Cache_Abis], address.Hex()+".json") - fullPath := path.Join(config.PathToCache(chain), filePath) + filePath := filepath.Join(walk.CacheTypeToFolder[walk.Cache_Abis], address.Hex()+".json") + fullPath := filepath.Join(config.PathToCache(chain), filePath) f, err := os.OpenFile(fullPath, os.O_RDONLY, 0) if err != nil { return diff --git a/src/apps/chifra/pkg/cache/cache.go b/src/apps/chifra/pkg/cache/cache.go index da9059becc..c3beea34c9 100644 --- a/src/apps/chifra/pkg/cache/cache.go +++ b/src/apps/chifra/pkg/cache/cache.go @@ -3,6 +3,7 @@ package cache import ( "io" "log" + "path/filepath" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/cache/locations" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" @@ -90,7 +91,7 @@ func (s *StoreOptions) rootDir() (dir string) { if dir != "" { // TODO: v1 suffix - return dir + "/v1" + return filepath.Join(dir, "v1") } return s.RootDir diff --git a/src/apps/chifra/pkg/cache/store.go b/src/apps/chifra/pkg/cache/store.go index f64d2b4c2c..b41daed4c8 100644 --- a/src/apps/chifra/pkg/cache/store.go +++ b/src/apps/chifra/pkg/cache/store.go @@ -5,7 +5,7 @@ import ( "context" "errors" "os" - "path" + "path/filepath" "strings" "sync" @@ -70,10 +70,10 @@ func (s *Store) resolvePath(value Locator) (resolved string, err error) { err = errors.New("empty CacheLocations") return } - if strings.HasPrefix(directory, "/") { - resolved = path.Join(directory, (id + "." + extension)) + if filepath.IsAbs(directory) { + resolved = filepath.Join(directory, (id + "." + extension)) } else { - resolved = path.Join(s.rootDir, directory, (id + "." + extension)) + resolved = filepath.Join(s.rootDir, directory, (id + "." + extension)) } return From dbf6efb6fed8c6410ffd7a120482ca059d009495 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:45:58 -0400 Subject: [PATCH 056/121] Fixes use of filepath in pkg --- src/apps/chifra/pkg/base/fileRange.go | 4 +-- src/apps/chifra/pkg/base/fileRange_test.go | 3 ++- src/apps/chifra/pkg/config/config.go | 27 +++++++++++-------- src/apps/chifra/pkg/config/config_test.go | 21 ++++++++------- src/apps/chifra/pkg/config/paths.go | 13 +++++---- .../pkg/config/paths_integration_test.go | 6 ++--- src/apps/chifra/pkg/config/unchainedGroup.go | 5 ++-- src/apps/chifra/pkg/index/checkVersion.go | 3 ++- src/apps/chifra/pkg/index/download_chunks.go | 7 ++--- src/apps/chifra/pkg/index/paths.go | 19 ++++++------- src/apps/chifra/pkg/manifest/download.go | 5 ++-- src/apps/chifra/pkg/monitor/monitor.go | 6 ++--- .../chifra/pkg/monitor/monitor_decache.go | 4 +-- .../chifra/pkg/monitor/monitor_freshen.go | 8 +++--- .../pkg/names/custom_integration_test.go | 6 ++--- src/apps/chifra/pkg/pinning/unpin_pin.go | 3 ++- src/apps/chifra/pkg/tslib/establish.go | 4 +-- src/apps/chifra/pkg/utils/system.go | 23 ---------------- src/apps/chifra/pkg/walk/walk.go | 16 +++++------ 19 files changed, 86 insertions(+), 97 deletions(-) diff --git a/src/apps/chifra/pkg/base/fileRange.go b/src/apps/chifra/pkg/base/fileRange.go index ca8df66ddb..93b87994e5 100644 --- a/src/apps/chifra/pkg/base/fileRange.go +++ b/src/apps/chifra/pkg/base/fileRange.go @@ -67,7 +67,7 @@ func RangeFromFilenameE(path string) (blkRange FileRange, err error) { // RangeFromRangeString returns a file range from a string func RangeFromRangeString(rngStr string) FileRange { - return RangeFromFilename(config.PathToIndex("mainnet") + "finalized/" + rngStr + ".bin") // okay to use mainnet since we're only interested in range + return RangeFromFilename(filepath.Join(config.PathToIndex("mainnet"), "finalized", rngStr + ".bin")) // okay to use mainnet since we're only interested in range } func (r FileRange) String() string { @@ -76,7 +76,7 @@ func (r FileRange) String() string { // RangeToFilename returns a fileName and existence bool given a file range and a type func (r *FileRange) RangeToFilename(chain string) string { - return config.PathToIndex(chain) + "finalized/" + r.String() + ".bin" + return filepath.Join(config.PathToIndex(chain), "finalized", r.String() + ".bin") } // Follows returns true if the range is strictly after the needle range. diff --git a/src/apps/chifra/pkg/base/fileRange_test.go b/src/apps/chifra/pkg/base/fileRange_test.go index 690d8f5417..315f2db0b6 100644 --- a/src/apps/chifra/pkg/base/fileRange_test.go +++ b/src/apps/chifra/pkg/base/fileRange_test.go @@ -6,6 +6,7 @@ package base import ( "fmt" + "os" "strings" "testing" ) @@ -88,7 +89,7 @@ func TestFilenameFromRange(t *testing.T) { fR := FileRange{0, 100} want := "mainnet/finalized/000000000-000000100.bin" got := fR.RangeToFilename("mainnet") - parts := strings.Split(got, "unchained/") + parts := strings.Split(got, "unchained"+string(os.PathSeparator)) if len(parts) != 2 || parts[1] != want { t.Errorf("FilenameFromRange() = %v, want %v", got, parts[1]) } diff --git a/src/apps/chifra/pkg/config/config.go b/src/apps/chifra/pkg/config/config.go index 2b4de09134..c5a837ddd6 100644 --- a/src/apps/chifra/pkg/config/config.go +++ b/src/apps/chifra/pkg/config/config.go @@ -43,9 +43,9 @@ type ConfigFile struct { // init sets up default values for the given configuration func init() { // The location of the per chain caches - cachePath = PathToRootConfig() + "cache/" + cachePath = filepath.Join(PathToRootConfig(), "cache") // The location of the per chain unchained indexes - indexPath = PathToRootConfig() + "unchained/" + indexPath = filepath.Join(PathToRootConfig(), "unchained") } var configMutex sync.Mutex @@ -70,7 +70,8 @@ func GetRootConfig() *ConfigFile { trueBlocksConfig = *defaultConfig // Load TOML file - if err := loadFromTomlFile(filepath.Join(configPath, "trueBlocks.toml"), &trueBlocksConfig); err != nil { + tomlConfigFn := filepath.Join(configPath, "trueBlocks.toml") + if err := loadFromTomlFile(tomlConfigFn, &trueBlocksConfig); err != nil { log.Fatal("loading config from .toml file:", err) } @@ -82,23 +83,25 @@ func GetRootConfig() *ConfigFile { user, _ := user.Current() cachePath := trueBlocksConfig.Settings.CachePath + cachePath = strings.Replace(cachePath, "/", string(os.PathSeparator), -1) if len(cachePath) == 0 || cachePath == "" { - cachePath = filepath.Join(configPath, "cache") + "/" + cachePath = filepath.Join(configPath, "cache") } cachePath = strings.Replace(cachePath, "$HOME", user.HomeDir, -1) cachePath = strings.Replace(cachePath, "~", user.HomeDir, -1) - if !strings.Contains(cachePath, "/cache") { + if filepath.Base(cachePath) != "cache" { cachePath = filepath.Join(cachePath, "cache") } trueBlocksConfig.Settings.CachePath = cachePath indexPath := trueBlocksConfig.Settings.IndexPath + indexPath = strings.Replace(indexPath, "/", string(os.PathSeparator), -1) if len(indexPath) == 0 || indexPath == "" { - indexPath = filepath.Join(configPath, "unchained") + "/" + indexPath = filepath.Join(configPath, "unchained") } indexPath = strings.Replace(indexPath, "$HOME", user.HomeDir, -1) indexPath = strings.Replace(indexPath, "~", user.HomeDir, -1) - if !strings.Contains(indexPath, "/unchained") { + if filepath.Base(indexPath) != "unchained" { indexPath = filepath.Join(indexPath, "unchained") } trueBlocksConfig.Settings.IndexPath = indexPath @@ -171,7 +174,7 @@ func PathToRootConfig() string { return configPath } - // The migration code will have already checked for invalid operating systems (i.e. Windows) + // The migration code will have already checked for invalid operating systems userOs := runtime.GOOS if len(os.Getenv("TEST_OS")) > 0 { userOs = os.Getenv("TEST_OS") @@ -181,9 +184,11 @@ func PathToRootConfig() string { osPath := ".local/share/trueblocks" if userOs == "darwin" { osPath = "Library/Application Support/TrueBlocks" + } else if userOs == "windows" { + osPath = "AppData/Local/trueblocks" } - return filepath.Join(user.HomeDir, osPath) + "/" + return filepath.Join(user.HomeDir, osPath) } func pathFromXDG(envVar string) (string, error) { @@ -193,7 +198,7 @@ func pathFromXDG(envVar string) (string, error) { return "", nil // it's okay if it's empty } - if xdg[0] != '/' { + if xdg[0] != string(os.PathSeparator)[0] { return "", usage.Usage("The {0} value ({1}), must be fully qualified.", envVar, xdg) } @@ -201,7 +206,7 @@ func pathFromXDG(envVar string) (string, error) { return "", usage.Usage("The {0} folder ({1}) must exist.", envVar, xdg) } - return filepath.Join(xdg, "") + "/", nil + return filepath.Join(xdg, ""), nil } func validateRpcEndpoint(chain, provider string) error { diff --git a/src/apps/chifra/pkg/config/config_test.go b/src/apps/chifra/pkg/config/config_test.go index ffff6d6764..8dfde0c87c 100644 --- a/src/apps/chifra/pkg/config/config_test.go +++ b/src/apps/chifra/pkg/config/config_test.go @@ -5,6 +5,7 @@ package config import ( + "os" "testing" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" @@ -14,28 +15,28 @@ func Test_ReadTrueBlocks(t *testing.T) { if len(GetSettings().CachePath) == 0 { t.Error("CachePath is empty") } - if GetSettings().CachePath[len(GetSettings().CachePath)-1] != '/' { - // the path may not end with a slash, but the returned path better + if GetSettings().CachePath[len(GetSettings().CachePath)-1] == os.PathSeparator { + // the user's path may end with a slash, but the returned path does not ret := PathToCache(utils.GetTestChain()) - if len(ret) > 0 && ret[len(ret)-1] != '/' { - t.Error("CachePath does not end with a '/'") + if len(ret) > 0 && ret[len(ret)-1] == os.PathSeparator { + t.Error("CachePath ends with a '/'. It should not.") } } - if GetSettings().CachePath[0] != '/' { + if GetSettings().CachePath[0] != os.PathSeparator { t.Error("CachePath is not an absolute path") } if len(GetSettings().IndexPath) == 0 { t.Error("IndexPath is empty") } - if GetSettings().IndexPath[len(GetSettings().IndexPath)-1] != '/' { - // the path may not end with a slash, but the returned path better + if GetSettings().IndexPath[len(GetSettings().IndexPath)-1] == os.PathSeparator { + // the user's path may end with a slash, but the returned path does not ret := PathToIndex(utils.GetTestChain()) - if len(ret) > 0 && ret[len(ret)-1] != '/' { - t.Error("IndexPath does not end with a '/'") + if len(ret) > 0 && ret[len(ret)-1] == string(os.PathSeparator)[0] { + t.Error("IndexPath ends with a '/'. It should not.") } } settings := GetSettings() - if settings.IndexPath[0] != '/' { + if settings.IndexPath[0] != os.PathSeparator { t.Error("IndexPath is not an absolute path") } if len(GetSettings().DefaultChain) == 0 { diff --git a/src/apps/chifra/pkg/config/paths.go b/src/apps/chifra/pkg/config/paths.go index bece876be4..780dfb9ab6 100644 --- a/src/apps/chifra/pkg/config/paths.go +++ b/src/apps/chifra/pkg/config/paths.go @@ -7,7 +7,6 @@ package config import ( "os" "path/filepath" - "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" @@ -28,7 +27,7 @@ func PathToChainConfig(chain string) (string, error) { ret := PathToRootConfig() // Our configuration files are always in ./config folder relative to top most folder - cfgFolder := filepath.Join(ret, "config/", chain) + "/" + cfgFolder := filepath.Join(ret, "config", chain) _, err := os.Stat(cfgFolder) return cfgFolder, err } @@ -54,7 +53,7 @@ func PathToIndex(chain string) string { } // Probably already true, but can't hurt to be sure - if !strings.Contains(indexPath, "/unchained") { + if filepath.Base(indexPath) != "unchained" { indexPath = filepath.Join(indexPath, "unchained") } @@ -64,7 +63,7 @@ func PathToIndex(chain string) string { } // We know what we want, create it if it doesn't exist and return it - newPath := filepath.Join(indexPath, chain) + "/" + newPath := filepath.Join(indexPath, chain) EstablishIndexPaths(newPath) return newPath } @@ -80,7 +79,7 @@ func PathToCache(chain string) string { } // Probably already true, but can't hurt to be sure - if !strings.Contains(cachePath, "/cache") { + if filepath.Base(cachePath) != "cache" { cachePath = filepath.Join(cachePath, "cache") } @@ -90,7 +89,7 @@ func PathToCache(chain string) string { } // We know what we want, create it if it doesn't exist and return it - newPath := filepath.Join(cachePath, chain) + "/" + newPath := filepath.Join(cachePath, chain) EstablishCachePaths(newPath) return newPath } @@ -100,7 +99,7 @@ func EstablishCachePaths(cachePath string) { folders := []string{ "abis", "monitors", - "monitors/staging", + filepath.Join("monitors", "staging"), "names", "tmp", "v1", diff --git a/src/apps/chifra/pkg/config/paths_integration_test.go b/src/apps/chifra/pkg/config/paths_integration_test.go index 2bce8296d9..588f5b875e 100644 --- a/src/apps/chifra/pkg/config/paths_integration_test.go +++ b/src/apps/chifra/pkg/config/paths_integration_test.go @@ -58,17 +58,17 @@ func Test_GetPathTo(t *testing.T) { } } else if test.group == "Cache" { os.Setenv("XDG_CACHE_HOME", test.xdg) - testPath = PathToCache(test.chain) + test.part + testPath = filepath.Join(PathToCache(test.chain), test.part) } else if test.group == "Index" { os.Setenv("XDG_CACHE_HOME", test.xdg) - testPath = PathToIndex(test.chain) + test.part + testPath = filepath.Join(PathToIndex(test.chain), test.part) } testPath = strings.Replace(testPath, user.HomeDir, "$HOME", -1) if test.expected == "" { fmt.Println("") } else { - test.expected = strings.Replace(test.expected, "{CHAIN}/", test.chain+"/", -1) + test.expected = strings.ReplaceAll(test.expected, "{CHAIN}", test.chain) if testPath != test.expected { test.Report(index, testPath) t.Error(index, "Paths don't match (", test.expected, testPath, ")") diff --git a/src/apps/chifra/pkg/config/unchainedGroup.go b/src/apps/chifra/pkg/config/unchainedGroup.go index 52461cbf0b..4811afb7b3 100644 --- a/src/apps/chifra/pkg/config/unchainedGroup.go +++ b/src/apps/chifra/pkg/config/unchainedGroup.go @@ -1,6 +1,7 @@ package config import ( + "path/filepath" "strings" "sync" @@ -58,7 +59,7 @@ var m sync.Mutex func ExpectedVersion() string { if headerVersion == "" { m.Lock() - historyFile := PathToRootConfig() + "unchained.txt" + historyFile := filepath.Join(PathToRootConfig(), "unchained.txt") headerVersion = history.FromHistory(historyFile, "headerVersion") if headerVersion == "" { headerVersion = "trueblocks-core@v2.0.0-release" @@ -70,7 +71,7 @@ func ExpectedVersion() string { func SetExpectedVersion(version string) { m.Lock() - historyFile := PathToRootConfig() + "unchained.txt" + historyFile := filepath.Join(PathToRootConfig(), "unchained.txt") _ = history.ToHistory(historyFile, "headerVersion", version) headerVersion = version m.Unlock() diff --git a/src/apps/chifra/pkg/index/checkVersion.go b/src/apps/chifra/pkg/index/checkVersion.go index 83258cd151..f91acd1dbf 100644 --- a/src/apps/chifra/pkg/index/checkVersion.go +++ b/src/apps/chifra/pkg/index/checkVersion.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "os" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/colors" @@ -18,7 +19,7 @@ var ErrIncorrectHash = errors.New("incorrect header hash") // IsInitialized returns an error if the version in the header is not as requested func IsInitialized(chain, required string) error { - fileName := config.PathToIndex(chain) + "blooms/000000000-000000000.bloom" + fileName := filepath.Join(config.PathToIndex(chain), "blooms/000000000-000000000.bloom") if !file.FileExists(fileName) { const indexNotInitialized string = ` diff --git a/src/apps/chifra/pkg/index/download_chunks.go b/src/apps/chifra/pkg/index/download_chunks.go index c3da55592b..6e87e3c839 100644 --- a/src/apps/chifra/pkg/index/download_chunks.go +++ b/src/apps/chifra/pkg/index/download_chunks.go @@ -14,6 +14,7 @@ import ( "net/http" "net/url" "os" + "path" "path/filepath" "strconv" "strings" @@ -114,7 +115,7 @@ func getDownloadWorker(chain string, workerArgs downloadWorkerArguments, chunkTy if workerArgs.ctx.Err() != nil { // User hit control + c - clean up both peices for the current chunk - chunkPath := config.PathToIndex(chain) + "finalized/" + chunk.Range + ".bin" + chunkPath := filepath.Join(config.PathToIndex(chain), "finalized", chunk.Range+".bin") removeLocalFile(ToIndexPath(chunkPath), "user canceled", progressChannel) removeLocalFile(ToBloomPath(chunkPath), "user canceled", progressChannel) progressChannel <- &progress.ProgressMsg{ @@ -153,7 +154,7 @@ type fetchResult struct { // fetchFromIpfsGateway downloads a chunk from an IPFS gateway using HTTP func fetchFromIpfsGateway(ctx context.Context, gateway, hash string) (*fetchResult, error) { url, _ := url.Parse(gateway) - url.Path = filepath.Join(url.Path, hash) + url.Path = path.Join(url.Path, hash) debug.DebugCurlStr(url.String()) request, err := http.NewRequestWithContext(ctx, "GET", url.String(), nil) @@ -308,7 +309,7 @@ func DownloadChunks(chain string, chunksToDownload []types.ChunkRecord, chunkTyp // writeBytesToDisc save the downloaded bytes to disc func writeBytesToDisc(chain string, chunkType walk.CacheType, res *jobResult) error { - fullPath := config.PathToIndex(chain) + "finalized/" + res.rng + ".bin" + fullPath := filepath.Join(config.PathToIndex(chain), "finalized", res.rng+".bin") if chunkType == walk.Index_Bloom { fullPath = ToBloomPath(fullPath) } diff --git a/src/apps/chifra/pkg/index/paths.go b/src/apps/chifra/pkg/index/paths.go index ea4ac5bf0f..e0e224916a 100644 --- a/src/apps/chifra/pkg/index/paths.go +++ b/src/apps/chifra/pkg/index/paths.go @@ -1,6 +1,7 @@ package index import ( + "path/filepath" "strings" ) @@ -19,10 +20,10 @@ func ToBloomPath(pathIn string) string { if isCacheType(pathIn, "blooms", "bloom") { return pathIn } - ret := strings.Replace(pathIn, ".bin", ".bloom", -1) + ret := strings.Replace(filepath.Clean(pathIn), ".bin", ".bloom", -1) ret = strings.Replace(ret, ".txt", ".bloom", -1) - ret = strings.Replace(ret, "/finalized/", "/blooms/", -1) - ret = strings.Replace(ret, "/staging/", "/blooms/", -1) + ret = strings.Replace(ret, "finalized", "blooms", -1) + ret = strings.Replace(ret, "staging", "blooms", -1) return ret } @@ -32,10 +33,10 @@ func ToIndexPath(pathIn string) string { return pathIn } - ret := strings.Replace(pathIn, ".bloom", ".bin", -1) + ret := strings.Replace(filepath.Clean(pathIn), ".bloom", ".bin", -1) ret = strings.Replace(ret, ".txt", ".bin", -1) - ret = strings.Replace(ret, "/blooms/", "/finalized/", -1) - ret = strings.Replace(ret, "/staging/", "/finalized/", -1) + ret = strings.Replace(ret, "blooms", "finalized", -1) + ret = strings.Replace(ret, "staging", "finalized", -1) return ret } @@ -45,9 +46,9 @@ func ToStagingPath(pathIn string) string { return pathIn } - ret := strings.Replace(pathIn, ".bin", ".txt", -1) + ret := strings.Replace(filepath.Clean(pathIn), ".bin", ".txt", -1) ret = strings.Replace(ret, ".bloom", ".txt", -1) - ret = strings.Replace(ret, "/finalized/", "/staging/", -1) - ret = strings.Replace(ret, "/blooms/", "/staging/", -1) + ret = strings.Replace(ret, "finalized", "staging", -1) + ret = strings.Replace(ret, "blooms", "staging", -1) return ret } diff --git a/src/apps/chifra/pkg/manifest/download.go b/src/apps/chifra/pkg/manifest/download.go index a332fd0a07..b3f4e24b6c 100644 --- a/src/apps/chifra/pkg/manifest/download.go +++ b/src/apps/chifra/pkg/manifest/download.go @@ -10,7 +10,7 @@ import ( "net/http" "net/url" "os" - "path/filepath" + "path" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/abi" @@ -65,11 +65,12 @@ func ReadUnchainedIndex(chain string, publisher base.Address, database string) ( // Manifest struct. Both JSON and TSV formats are supported, but the server has // to set the correct Content-Type header. func downloadManifest(chain, gatewayUrl, cid string) (*Manifest, error) { + _ = chain // linter url, err := url.Parse(gatewayUrl) if err != nil { return nil, err } - url.Path = filepath.Join(url.Path, cid) + url.Path = path.Join(url.Path, cid) debug.DebugCurlStr(url.String()) resp, err := http.Get(url.String()) diff --git a/src/apps/chifra/pkg/monitor/monitor.go b/src/apps/chifra/pkg/monitor/monitor.go index f9acc7d122..9a7d3b8548 100644 --- a/src/apps/chifra/pkg/monitor/monitor.go +++ b/src/apps/chifra/pkg/monitor/monitor.go @@ -97,9 +97,9 @@ func (mon Monitor) String() string { // Path returns the path to the Monitor file func (mon *Monitor) Path() (path string) { if mon.Staged { - path = config.PathToCache(mon.Chain) + "monitors/staging/" + mon.Address.Hex() + Ext + path = filepath.Join(config.PathToCache(mon.Chain), "monitors", "staging", mon.Address.Hex()+Ext) } else { - path = config.PathToCache(mon.Chain) + "monitors/" + mon.Address.Hex() + Ext + path = filepath.Join(config.PathToCache(mon.Chain), "monitors", mon.Address.Hex()+Ext) } return } @@ -211,7 +211,7 @@ func ListMonitors(chain, watchList string, monitorChan chan<- Monitor) { return nil } - path := config.PathToCache(chain) + "monitors" + path := filepath.Join(config.PathToCache(chain), "monitors") _ = filepath.Walk(path, walkFunc) } diff --git a/src/apps/chifra/pkg/monitor/monitor_decache.go b/src/apps/chifra/pkg/monitor/monitor_decache.go index e7a4730530..853c1db838 100644 --- a/src/apps/chifra/pkg/monitor/monitor_decache.go +++ b/src/apps/chifra/pkg/monitor/monitor_decache.go @@ -3,7 +3,7 @@ package monitor import ( "fmt" "os" - "path" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/decache" @@ -41,7 +41,7 @@ func (mon *Monitor) Decache(conn *rpc.Connection, showProgress bool) (string, er } } - abiPath := path.Join(walk.GetRootPathFromCacheType(conn.Chain, walk.Cache_Abis), mon.Address.Hex()+".json") + abiPath := filepath.Join(walk.GetRootPathFromCacheType(conn.Chain, walk.Cache_Abis), mon.Address.Hex()+".json") if file.FileExists(abiPath) { os.Remove(abiPath) logger.Progress(showProgress, "Abi "+abiPath+" file removed.") diff --git a/src/apps/chifra/pkg/monitor/monitor_freshen.go b/src/apps/chifra/pkg/monitor/monitor_freshen.go index 390b020b3a..f25099d60a 100644 --- a/src/apps/chifra/pkg/monitor/monitor_freshen.go +++ b/src/apps/chifra/pkg/monitor/monitor_freshen.go @@ -128,7 +128,7 @@ func (updater *MonitorUpdate) FreshenMonitors(monitorArray *[]Monitor) (bool, er return canceled, nil } - bloomPath := filepath.Join(config.PathToIndex(updater.Chain), "blooms/") + bloomPath := filepath.Join(config.PathToIndex(updater.Chain), "blooms") files, err := os.ReadDir(bloomPath) if err != nil { return canceled, err @@ -144,7 +144,7 @@ func (updater *MonitorUpdate) FreshenMonitors(monitorArray *[]Monitor) (bool, er continue } if !info.IsDir() { - fileName := bloomPath + "/" + info.Name() + fileName := filepath.Join(bloomPath, info.Name()) if !walk.IsCacheType(fileName, walk.Index_Bloom, true /* checkExt */) { continue // sometimes there are .gz files in this folder, for example } @@ -196,7 +196,7 @@ func (updater *MonitorUpdate) FreshenMonitors(monitorArray *[]Monitor) (bool, er if !updater.TestMode { // TODO: Note we could actually test this if we had the concept of a FAKE_HEAD block - stagePath := index.ToStagingPath(config.PathToIndex(updater.Chain) + "staging") + stagePath := index.ToStagingPath(filepath.Join(config.PathToIndex(updater.Chain), "staging")) stageFn, _ := file.LatestFileInFolder(stagePath) rng := base.RangeFromFilename(stageFn) lines := []string{} @@ -362,7 +362,7 @@ func needsMigration(addr string) error { mon := Monitor{Address: base.HexToAddress(addr)} path := strings.Replace(mon.Path(), ".mon.bin", ".acct.bin", -1) if file.FileExists(path) { - path = strings.Replace(path, config.PathToCache(mon.Chain), "./", -1) + path = filepath.Clean(strings.ReplaceAll(path, config.PathToCache(mon.Chain), "./")) return validate.Usage("Old style monitor found at {0}. Please run '{1}'", path, "chifra config --migrate cache") } return nil diff --git a/src/apps/chifra/pkg/names/custom_integration_test.go b/src/apps/chifra/pkg/names/custom_integration_test.go index 69a7c6541d..eacee824dc 100644 --- a/src/apps/chifra/pkg/names/custom_integration_test.go +++ b/src/apps/chifra/pkg/names/custom_integration_test.go @@ -6,7 +6,7 @@ import ( "fmt" "io" "os" - "path" + "path/filepath" "testing" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -16,7 +16,7 @@ import ( func TestCrudIntegration(t *testing.T) { chain := utils.GetTestChain() - tmpDirPath := path.Join(os.TempDir(), "trueblocks") + tmpDirPath := filepath.Join(os.TempDir(), "trueblocks") if err := os.MkdirAll(tmpDirPath, 0777); err != nil { t.Fatal(err) } @@ -27,7 +27,7 @@ func TestCrudIntegration(t *testing.T) { }() loadTestDatabase := func() *os.File { tempFile, err := os.OpenFile( - path.Join(os.TempDir(), "trueblocks", "names_custom.tab"), + filepath.Join(os.TempDir(), "trueblocks", "names_custom.tab"), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777, ) diff --git a/src/apps/chifra/pkg/pinning/unpin_pin.go b/src/apps/chifra/pkg/pinning/unpin_pin.go index 45015e4f6e..41d7438c1f 100644 --- a/src/apps/chifra/pkg/pinning/unpin_pin.go +++ b/src/apps/chifra/pkg/pinning/unpin_pin.go @@ -3,6 +3,7 @@ package pinning import ( "fmt" "net/http" + "path/filepath" "time" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -42,7 +43,7 @@ func unpinOne(chain string, i, total int, hash base.IpfsHash) error { } func Unpin(chain string, count bool, sleep float64) error { - lines := file.AsciiFileToLines("./unpins") + lines := file.AsciiFileToLines(filepath.Join(".", "unpins")) if count { logger.Info("There are", len(lines), "pins to unpin.") } else { diff --git a/src/apps/chifra/pkg/tslib/establish.go b/src/apps/chifra/pkg/tslib/establish.go index 0fe618689b..436aeeaea1 100644 --- a/src/apps/chifra/pkg/tslib/establish.go +++ b/src/apps/chifra/pkg/tslib/establish.go @@ -7,7 +7,7 @@ import ( "net/http" "net/url" "os" - "path/filepath" + "path" "time" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -54,7 +54,7 @@ func downloadTimestamps(chain, database, outputFn, cid string) (error, bool) { if err != nil { return err, false } - url.Path = filepath.Join(url.Path, cid) + url.Path = path.Join(url.Path, cid) debug.DebugCurlStr(url.String()) diff --git a/src/apps/chifra/pkg/utils/system.go b/src/apps/chifra/pkg/utils/system.go index 5212c65ddf..df1162a553 100644 --- a/src/apps/chifra/pkg/utils/system.go +++ b/src/apps/chifra/pkg/utils/system.go @@ -28,26 +28,3 @@ func System(cmd string) int { return -1 } - -/* -func systemToString(cmd string) string { - c := exec.Command("sh", "-c", cmd) - c.Stdin = os.Stdin - - if ff, err := os.Create("/tmp/output.txt"); err != nil { - return err.Error() - - } else { - c.Stdout = ff - c.Stderr = ff - - if err := c.Run(); err != nil { - return err.Error() - } - - ret := file.AsciiFileToString("/tmp/output.txt") - os.Remove("/tmp/output.txt") - return strings.Trim(ret, "\n\r\t ,") - } -} -*/ diff --git a/src/apps/chifra/pkg/walk/walk.go b/src/apps/chifra/pkg/walk/walk.go index 25910a1bc0..3b682596c4 100644 --- a/src/apps/chifra/pkg/walk/walk.go +++ b/src/apps/chifra/pkg/walk/walk.go @@ -154,7 +154,7 @@ func GetRootPathFromCacheType(chain string, cacheType CacheType) string { case Cache_Names: fallthrough case Cache_Tmp: - return filepath.Join(config.PathToCache(chain), CacheTypeToFolder[cacheType]) + "/" + return filepath.Join(config.PathToCache(chain), CacheTypeToFolder[cacheType]) case Cache_Blocks: fallthrough @@ -177,7 +177,7 @@ func GetRootPathFromCacheType(chain string, cacheType CacheType) string { case Cache_Transactions: fallthrough case Cache_Withdrawals: - return filepath.Join(config.PathToCache(chain), "v1", CacheTypeToFolder[cacheType]) + "/" + return filepath.Join(config.PathToCache(chain), "v1", CacheTypeToFolder[cacheType]) case Index_Bloom: fallthrough @@ -190,7 +190,7 @@ func GetRootPathFromCacheType(chain string, cacheType CacheType) string { case Index_Unripe: fallthrough case Index_Maps: - return filepath.Join(config.PathToIndex(chain), CacheTypeToFolder[cacheType]) + "/" + return filepath.Join(config.PathToIndex(chain), CacheTypeToFolder[cacheType]) case Config: return config.PathToRootConfig() case Cache_NotACache: @@ -347,8 +347,8 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil } display := cacheInfo.Path - display = strings.Replace(display, config.PathToCache(chain), "./", -1) - display = strings.Replace(display, config.PathToIndex(chain), "./", -1) + display = filepath.Clean(strings.ReplaceAll(display, config.PathToCache(chain)+"/", "./")) + display = filepath.Clean(strings.ReplaceAll(display, config.PathToIndex(chain)+"/", "./")) switch cT { case Index_Maps: @@ -357,7 +357,7 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil fallthrough case Index_Final: if testMode { - display = strings.Replace(cacheInfo.Path, config.PathToIndex(chain), "$indexPath/", 1) + display = strings.Replace(cacheInfo.Path, config.PathToIndex(chain)+"/", "$indexPath/", 1) } return map[string]any{ // "bloomSizeBytes": file.FileSize(index.ToBloomPath(cacheInfo.Path)), @@ -376,7 +376,7 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil fallthrough case Cache_Abis: address := "" - parts := strings.Split(cacheInfo.Path, "/") + parts := strings.Split(cacheInfo.Path, string(os.PathSeparator)) for _, part := range parts { if strings.HasPrefix(part, "0x") { address = part @@ -384,7 +384,7 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil } } if testMode { - display = strings.Replace(cacheInfo.Path, config.PathToCache(chain), "$cachePath/", 1) + display = strings.Replace(cacheInfo.Path, config.PathToCache(chain)+"/", "$cachePath/", 1) display = strings.Replace(display, address, "--address--", -1) address = "--address--" } From b1b286e6d07aaf10cedcc7ea3b2691e3533ab8a8 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:48:29 -0400 Subject: [PATCH 057/121] Fixes use of filepath in some tools --- src/apps/chifra/cmd/root_initialize.go | 8 ++--- src/apps/chifra/internal/explore/options.go | 7 ++-- .../chifra/internal/monitors/handle_watch.go | 35 +++++++++---------- src/apps/chifra/internal/monitors/scraper.go | 3 +- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/apps/chifra/cmd/root_initialize.go b/src/apps/chifra/cmd/root_initialize.go index 1b2c268c3f..fbf40194c5 100644 --- a/src/apps/chifra/cmd/root_initialize.go +++ b/src/apps/chifra/cmd/root_initialize.go @@ -28,11 +28,7 @@ func Initialize() bool { // VerifyOs will panic if the operating system isn't cooperating func VerifyOs() { userOs := runtime.GOOS - if userOs == "windows" { - logger.Fatal("Windows is not supported\n") - } - - if userOs != "linux" && userOs != "darwin" { + if userOs != "linux" && userOs != "darwin" && userOs != "windows" { logger.Fatal("Unsupported operating system: ", userOs, "\n") } @@ -71,7 +67,7 @@ func VerifyMigrations() { } // ...and the config file better exist. - configFile := filepath.Join(configFolder + "trueBlocks.toml") + configFile := filepath.Join(configFolder, "trueBlocks.toml") if _, err := os.Stat(configFile); err != nil { msg := strings.Replace(doesNotExist, "{0}", "{"+configFile+"}", -1) msg = colors.ColoredWith(msg, colors.Yellow) diff --git a/src/apps/chifra/internal/explore/options.go b/src/apps/chifra/internal/explore/options.go index f5089bdfdb..8ea30fc454 100644 --- a/src/apps/chifra/internal/explore/options.go +++ b/src/apps/chifra/internal/explore/options.go @@ -14,6 +14,7 @@ import ( "io" "net/http" "net/url" + "path" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/globals" @@ -198,13 +199,13 @@ func (u *ExploreUrl) getUrl(opts *ExploreOptions) string { case ExploreNone: // do nothing case ExploreTx: - query = "tx/" + u.term + query = path.Join("tx", u.term) case ExploreBlock: - query = "block/" + u.term + query = path.Join("block", u.term) case ExploreAddress: fallthrough default: - query = "address/" + u.term + query = path.Join("address", u.term) } if opts.Local { diff --git a/src/apps/chifra/internal/monitors/handle_watch.go b/src/apps/chifra/internal/monitors/handle_watch.go index 0d1e902be4..2b50aa81a1 100644 --- a/src/apps/chifra/internal/monitors/handle_watch.go +++ b/src/apps/chifra/internal/monitors/handle_watch.go @@ -7,6 +7,7 @@ package monitorsPkg import ( "encoding/json" "fmt" + "os" "path/filepath" "strings" "sync" @@ -42,7 +43,7 @@ func (opts *MonitorsOptions) RunMonitorScraper(wg *sync.WaitGroup, s *Scraper) { defer wg.Done() chain := opts.Globals.Chain - tmpPath := config.PathToCache(chain) + "tmp/" + tmpPath := filepath.Join(config.PathToCache(chain), "tmp") s.ChangeState(true, tmpPath) @@ -265,47 +266,45 @@ func (opts *MonitorsOptions) getOutputFolder(orig string) (string, error) { logger.Fatal(s) } + cwd, _ := os.Getwd() cmdLine += " " folder := "unknown" if parts[1] == "export" { - folder = "./export" if strings.Contains(cmdLine, "-p ") || strings.Contains(cmdLine, "--appearances ") { - folder += "/appearances" + folder = filepath.Join(cwd, parts[1], "appearances") } else if strings.Contains(cmdLine, "-r ") || strings.Contains(cmdLine, "--receipts ") { - folder += "/receipts" + folder = filepath.Join(cwd, parts[1], "receipts") } else if strings.Contains(cmdLine, "-l ") || strings.Contains(cmdLine, "--logs ") { - folder += "/logs" + folder = filepath.Join(cwd, parts[1], "logs") } else if strings.Contains(cmdLine, "-t ") || strings.Contains(cmdLine, "--traces ") { - folder += "/traces" + folder = filepath.Join(cwd, parts[1], "traces") } else if strings.Contains(cmdLine, "-n ") || strings.Contains(cmdLine, "--neighbors ") { - folder += "/neighbors" + folder = filepath.Join(cwd, parts[1], "neighbors") } else if strings.Contains(cmdLine, "-C ") || strings.Contains(cmdLine, "--accounting ") { - folder += "/accounting" + folder = filepath.Join(cwd, parts[1], "accounting") } else if strings.Contains(cmdLine, "-A ") || strings.Contains(cmdLine, "--statements ") { - folder += "/statements" + folder = filepath.Join(cwd, parts[1], "statements") } else if strings.Contains(cmdLine, "-b ") || strings.Contains(cmdLine, "--balances ") { - folder += "/balances" + folder = filepath.Join(cwd, parts[1], "balances") } else { - folder += "/transactions" + folder = filepath.Join(cwd, parts[1], "transactions") } } else if parts[1] == "list" { - folder = "./list/appearances" + folder = filepath.Join(cwd, parts[1], "appearances") } else if parts[1] == "state" { - folder = "./state" if strings.Contains(cmdLine, "-l ") || strings.Contains(cmdLine, "--call ") { - folder += "/calls" + folder = filepath.Join(cwd, parts[1], "calls") } else { - folder += "/blocks" + folder = filepath.Join(cwd, parts[1], "blocks") } } else if parts[1] == "tokens" { - folder = "./tokens" if strings.Contains(cmdLine, "-b ") || strings.Contains(cmdLine, "--by_acct ") { - folder += "/by_acct" + folder = filepath.Join(cwd, parts[1], "by_acct") } else { - folder += "/blocks" + folder = filepath.Join(cwd, parts[1], "blocks") } } diff --git a/src/apps/chifra/internal/monitors/scraper.go b/src/apps/chifra/internal/monitors/scraper.go index bc987e1a2f..cec888f22d 100644 --- a/src/apps/chifra/internal/monitors/scraper.go +++ b/src/apps/chifra/internal/monitors/scraper.go @@ -7,6 +7,7 @@ package monitorsPkg import ( "fmt" "os" + "path/filepath" "time" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" @@ -30,7 +31,7 @@ func (scraper *Scraper) ChangeState(onOff bool, tmpPath string) bool { prev := scraper.Running scraper.Running = onOff str := "false" - fileName := tmpPath + scraper.Name + ".txt" + fileName := filepath.Join(tmpPath, scraper.Name+".txt") err := os.WriteFile(fileName, []byte(str), 0644) // Uses os.O_WRONLY|os.O_CREATE|os.O_TRUNC if err != nil { logger.Fatal(err) From 425a6ffd537c4de98dfaf877e8026b1c037c1fd2 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:49:05 -0400 Subject: [PATCH 058/121] Fixes use of filepath in some chifra abis --- src/apps/chifra/internal/abis/handle_decache.go | 2 +- src/apps/chifra/internal/abis/handle_find.go | 7 +++++-- src/apps/chifra/internal/abis/handle_list.go | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/apps/chifra/internal/abis/handle_decache.go b/src/apps/chifra/internal/abis/handle_decache.go index bcbf678053..1060e707de 100644 --- a/src/apps/chifra/internal/abis/handle_decache.go +++ b/src/apps/chifra/internal/abis/handle_decache.go @@ -68,7 +68,7 @@ func (opts *AbisOptions) HandleDecache(rCtx *output.RenderCtx) error { } } else { for _, addr := range opts.Addrs { - path := config.PathToCache(chain) + "abis/" + addr + ".json" + path := filepath.Join(config.PathToCache(chain), "abis", addr + ".json") if file.FileExists(path) { if err := os.Remove(path); err != nil { logger.Warn(colors.Red+"Could not remove abi for address", addr, ":", err, "."+colors.Off) diff --git a/src/apps/chifra/internal/abis/handle_find.go b/src/apps/chifra/internal/abis/handle_find.go index 5027d96640..7e59966771 100644 --- a/src/apps/chifra/internal/abis/handle_find.go +++ b/src/apps/chifra/internal/abis/handle_find.go @@ -10,6 +10,7 @@ import ( "encoding/hex" "io" "os" + "path/filepath" "runtime" "sort" "strings" @@ -66,7 +67,8 @@ func (opts *AbisOptions) HandleFind(rCtx *output.RenderCtx) error { defer checkOne.Release() // TODO: UnchainedIndex --> This could be part of unchained index - sigsFile, err := os.OpenFile(config.PathToRootConfig()+"abis/known-000/uniq_sigs.tab", os.O_RDONLY, 0) + sigFile := filepath.Join(config.PathToRootConfig(), "abis", "known-000", "uniq_sigs.tab") + sigsFile, err := os.OpenFile(sigFile, os.O_RDONLY, 0) if err != nil { errorChan <- err rCtx.Cancel() @@ -80,7 +82,8 @@ func (opts *AbisOptions) HandleFind(rCtx *output.RenderCtx) error { sigsScanner.Split(bufio.ScanLines) // TODO: UnchainedIndex --> This could be part of unchained index - funcsFile, _ := os.OpenFile(config.PathToRootConfig()+"abis/known-000/uniq_funcs.tab", os.O_RDONLY, 0) + funcFile := filepath.Join(config.PathToRootConfig(), "abis", "known-000", "uniq_funcs.tab") + funcsFile, _ := os.OpenFile(funcFile, os.O_RDONLY, 0) defer func() { funcsFile.Close() }() diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index 208dd3e2c7..c144716e51 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -61,7 +61,7 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { } if testMode { abi.LastModDate = "--date--" - abi.Path = strings.ReplaceAll(abi.Path, config.PathToRootConfig(), "./") + abi.Path = strings.ReplaceAll(abi.Path, config.PathToRootConfig(), ".") } modelChan <- &abi } From 4cda3bb8ef8bebbbe6bf0eea0fe5adb79e6461ee Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:50:08 -0400 Subject: [PATCH 059/121] Fixes use of filepath in some chifra chunks --- src/apps/chifra/internal/chunks/handle_address.go | 2 +- src/apps/chifra/internal/chunks/handle_check.go | 3 ++- src/apps/chifra/internal/chunks/handle_check_staging.go | 3 ++- src/apps/chifra/internal/chunks/handle_diff.go | 4 ++-- src/apps/chifra/internal/chunks/handle_truncate.go | 2 +- src/apps/chifra/internal/chunks/validate.go | 5 +++-- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/apps/chifra/internal/chunks/handle_address.go b/src/apps/chifra/internal/chunks/handle_address.go index 1792ee9f68..6c821c1c31 100644 --- a/src/apps/chifra/internal/chunks/handle_address.go +++ b/src/apps/chifra/internal/chunks/handle_address.go @@ -38,7 +38,7 @@ func (opts *ChunksOptions) HandleAddresses(rCtx *output.RenderCtx, blockNums []b if !file.FileExists(path) { // This is okay, if the user used chifra init without the --all option. Warn them and continue msg := "" - path = strings.Replace(path, config.PathToIndex(chain), "$indexPath", 1) + path = strings.Replace(path, config.PathToIndex(chain)+"/", "$indexPath/", 1) if been_here < 3 { msg = fmt.Sprintf("index file %s does not exist. Run 'chifra init --all' to create it.", path) } else if been_here == 3 { diff --git a/src/apps/chifra/internal/chunks/handle_check.go b/src/apps/chifra/internal/chunks/handle_check.go index 06a6301e07..ff6f5f32fd 100644 --- a/src/apps/chifra/internal/chunks/handle_check.go +++ b/src/apps/chifra/internal/chunks/handle_check.go @@ -7,6 +7,7 @@ package chunksPkg import ( "errors" "fmt" + "path/filepath" "sort" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -83,7 +84,7 @@ func (opts *ChunksOptions) check(rCtx *output.RenderCtx, blockNums []base.Blknum if err != nil { return err, false } - historyFile := config.PathToRootConfig() + "unchained.txt" + historyFile := filepath.Join(config.PathToRootConfig(), "unchained.txt") saved := history.FromHistory(historyFile, "headerVersion") defer func() { _ = history.ToHistory(historyFile, "headerVersion", saved) diff --git a/src/apps/chifra/internal/chunks/handle_check_staging.go b/src/apps/chifra/internal/chunks/handle_check_staging.go index 283190e4bd..6a2548d4be 100644 --- a/src/apps/chifra/internal/chunks/handle_check_staging.go +++ b/src/apps/chifra/internal/chunks/handle_check_staging.go @@ -6,6 +6,7 @@ package chunksPkg import ( "fmt" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -22,7 +23,7 @@ import ( // 4. Makes sure that the last block inside is == last if allow_missing == false, < otherwise func (opts *ChunksOptions) CheckStaging(lastBlock uint64, allow_missing bool, report *types.ReportCheck) error { chain := opts.Globals.Chain - stagePath := index.ToStagingPath(config.PathToIndex(chain) + "staging") + stagePath := index.ToStagingPath(filepath.Join(config.PathToIndex(chain), "staging")) stageFn, _ := file.LatestFileInFolder(stagePath) if !file.FileExists(stageFn) { return nil diff --git a/src/apps/chifra/internal/chunks/handle_diff.go b/src/apps/chifra/internal/chunks/handle_diff.go index aeb84c229f..b4197de294 100644 --- a/src/apps/chifra/internal/chunks/handle_diff.go +++ b/src/apps/chifra/internal/chunks/handle_diff.go @@ -218,8 +218,8 @@ func (opts *ChunksOptions) getParams(chain, path string) (string, string, base.R func toDiffPath(chain string, middleMark base.Blknum) string { diffPath := os.Getenv("TB_CHUNKS_DIFFPATH") - if !strings.Contains(diffPath, "unchained/") { - diffPath = filepath.Join(diffPath, "unchained/", chain, "finalized") + if !strings.Contains(diffPath, "unchained") { + diffPath = filepath.Join(diffPath, "unchained", chain, "finalized") } diffPath, _ = filepath.Abs(diffPath) diffPath, _ = findFileByBlockNumber(chain, diffPath, middleMark) diff --git a/src/apps/chifra/internal/chunks/handle_truncate.go b/src/apps/chifra/internal/chunks/handle_truncate.go index 9b348d65a1..99dca478bd 100644 --- a/src/apps/chifra/internal/chunks/handle_truncate.go +++ b/src/apps/chifra/internal/chunks/handle_truncate.go @@ -126,7 +126,7 @@ func (opts *ChunksOptions) HandleTruncate(rCtx *output.RenderCtx, blockNums []ba } return nil } - _ = filepath.Walk(config.PathToCache(chain)+"monitors", truncateMonitor) + _ = filepath.Walk(filepath.Join(config.PathToCache(chain), "monitors"), truncateMonitor) bar.Prefix = fmt.Sprintf("Truncated monitors to %d ", opts.Truncate) bar.Finish(true /* newLine */) diff --git a/src/apps/chifra/internal/chunks/validate.go b/src/apps/chifra/internal/chunks/validate.go index 8570e761da..c7031b7bdb 100644 --- a/src/apps/chifra/internal/chunks/validate.go +++ b/src/apps/chifra/internal/chunks/validate.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "os" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -54,12 +55,12 @@ func (opts *ChunksOptions) validateChunks() error { } if opts.Unpin { - if !file.FileExists("./unpins") { + if !file.FileExists(filepath.Join(".", "unpins")) { return validate.Usage("The file {0} was not found in the local folder.", "./unpins") } hasOne := false - lines := file.AsciiFileToLines("./unpins") + lines := file.AsciiFileToLines(filepath.Join(".", "unpins")) for _, line := range lines { if pinning.IsValid(line) { hasOne = true From 48451454edce5a249c95f96cf8b9ba1e256253a2 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:51:23 -0400 Subject: [PATCH 060/121] Fixes use of filepath in some chifra init --- src/apps/chifra/internal/init/handle_dryrun.go | 3 ++- src/apps/chifra/internal/init/handle_example.go | 15 ++++++++------- src/apps/chifra/internal/init/handle_init.go | 3 ++- .../chifra/internal/init/handle_init_prepare.go | 2 +- src/apps/chifra/internal/init/validate.go | 3 ++- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/apps/chifra/internal/init/handle_dryrun.go b/src/apps/chifra/internal/init/handle_dryrun.go index ddd70875f0..359a36dcd0 100644 --- a/src/apps/chifra/internal/init/handle_dryrun.go +++ b/src/apps/chifra/internal/init/handle_dryrun.go @@ -3,6 +3,7 @@ package initPkg import ( "errors" "fmt" + "path/filepath" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" @@ -19,7 +20,7 @@ func (opts *InitOptions) HandleDryRun(rCtx *output.RenderCtx) error { if err != nil { return err } - historyFile := config.PathToRootConfig() + "unchained.txt" + historyFile := filepath.Join(config.PathToRootConfig(), "unchained.txt") saved := history.FromHistory(historyFile, "headerVersion") defer func() { _ = history.ToHistory(historyFile, "headerVersion", saved) diff --git a/src/apps/chifra/internal/init/handle_example.go b/src/apps/chifra/internal/init/handle_example.go index 786b8bb833..773d7d19a1 100644 --- a/src/apps/chifra/internal/init/handle_example.go +++ b/src/apps/chifra/internal/init/handle_example.go @@ -6,6 +6,7 @@ package initPkg import ( "os" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" @@ -18,14 +19,14 @@ import ( // of the files needed to run an example. This is a convenience function for // developers to quickly get started with the example. func (opts *InitOptions) HandleExample(rCtx *output.RenderCtx) error { - template := "base/" // will use opts.Template in the future - tmplFolder := "./templates/" + template // will later support opts.Template - exampleDir := "./" + opts.Example + template := "base/" // will use opts.Template in the future + tmplFolder := filepath.Join("./templates", template) // will later support opts.Template + exampleDir := filepath.Join("./", opts.Example) // We already know that the folder does not exist since it passed validation... _ = os.MkdirAll(exampleDir, 0755) - logger.Info("Example created in ./" + opts.Example + " from " + tmplFolder) + logger.Info("Example created in ", filepath.Join("./", opts.Example)+" from "+tmplFolder) for _, fn := range []string{"main.go", "main_test.go", "go.mod", "README.md"} { copyOne(fn, opts.Example, tmplFolder) @@ -38,17 +39,17 @@ func (opts *InitOptions) HandleExample(rCtx *output.RenderCtx) error { utils.System(cmd) // update the go.work file - os.Remove("../go.work") + os.Remove(filepath.Join("..", "go.work")) utils.System("source ../scripts/go-work-sync.sh") return nil } func copyOne(fn, exName, tmplFolder string) { - contents := file.AsciiFileToString(tmplFolder + fn + ".tmpl") + contents := file.AsciiFileToString(filepath.Join(tmplFolder, fn+".tmpl")) contents = strings.ReplaceAll(contents, "[{NAME}]", utils.MakeFirstUpperCase(exName)) contents = strings.ReplaceAll(contents, "[{LOWER}]", exName) - fn = "./" + exName + "/" + fn + fn = filepath.Join("./", exName, fn) _ = file.StringToAsciiFile(fn, contents) logger.Info("\t==> " + fn) } diff --git a/src/apps/chifra/internal/init/handle_init.go b/src/apps/chifra/internal/init/handle_init.go index 611a45e2c0..4a67298aaf 100644 --- a/src/apps/chifra/internal/init/handle_init.go +++ b/src/apps/chifra/internal/init/handle_init.go @@ -6,6 +6,7 @@ package initPkg import ( "fmt" + "path/filepath" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" @@ -58,7 +59,7 @@ func (opts *InitOptions) HandleInit(rCtx *output.RenderCtx) error { logger.InfoTable("Files deleted:", fmt.Sprintf("%d", nDeleted)) logger.InfoTable("Files downloaded:", fmt.Sprintf("%d", nToDownload)) - historyFile := config.PathToCache(chain) + "tmp/history.txt" + historyFile := filepath.Join(config.PathToCache(chain), "tmp/history.txt") if opts.All && !history.FromHistoryBool(historyFile, "init") { _ = history.ToHistory(historyFile, "init", "true") } diff --git a/src/apps/chifra/internal/init/handle_init_prepare.go b/src/apps/chifra/internal/init/handle_init_prepare.go index ff5bbc1431..fcf70e295d 100644 --- a/src/apps/chifra/internal/init/handle_init_prepare.go +++ b/src/apps/chifra/internal/init/handle_init_prepare.go @@ -209,7 +209,7 @@ func (opts *InitOptions) reportReason(prefix string, status InitReason, path str col := colors.BrightMagenta if status == FILE_ERROR || status == NOT_IN_MANIFEST { col = colors.BrightRed - } else if strings.Contains(path, "/blooms/") { + } else if strings.Contains(path, string(os.PathSeparator) + "blooms" + string(os.PathSeparator)) { col = colors.BrightYellow } rng := base.RangeFromFilename(path) diff --git a/src/apps/chifra/internal/init/validate.go b/src/apps/chifra/internal/init/validate.go index c48bf0be94..dfdfe009ee 100644 --- a/src/apps/chifra/internal/init/validate.go +++ b/src/apps/chifra/internal/init/validate.go @@ -7,6 +7,7 @@ package initPkg import ( "fmt" "os" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" @@ -57,7 +58,7 @@ func (opts *InitOptions) validateInit() error { // } else if len(opts.Template) > 0 { // return validate.Usage("The {0} option requires the {1} flag.", "--template", "--example") } else { - historyFile := config.PathToCache(chain) + "tmp/history.txt" + historyFile := filepath.Join(config.PathToCache(chain), "tmp/history.txt") if history.FromHistoryBool(historyFile, "init") && !opts.All { return validate.Usage("You previously called chifra init --all. You must continue to do so.") } From b121acc582fb833c372b02763ddd7c1f32fcf7fc Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:52:05 -0400 Subject: [PATCH 061/121] Fixes use of filepath in some chifra scrape --- src/apps/chifra/internal/scrape/options.go | 4 ++-- src/apps/chifra/internal/scrape/scrape_blaze.go | 9 +++++---- src/apps/chifra/internal/scrape/scrape_consolidate.go | 6 ++---- src/apps/chifra/internal/scrape/scrape_prepare.go | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/apps/chifra/internal/scrape/options.go b/src/apps/chifra/internal/scrape/options.go index 478f482479..0c82b48e87 100644 --- a/src/apps/chifra/internal/scrape/options.go +++ b/src/apps/chifra/internal/scrape/options.go @@ -231,7 +231,7 @@ func (opts *ScrapeOptions) getPidFilePath() string { var pidfileDir string if runtime.GOOS == "darwin" { // MacOS - pidfileDir = "/usr/local/var/run" + pidfileDir = filepath.Join("/usr/local/var", "run") } else { // Linux // On Linux only root can write to the main directory /run, but every logged-in @@ -245,7 +245,7 @@ func (opts *ScrapeOptions) getPidFilePath() string { if pidfileDir == "" || !file.FolderExists(pidfileDir) { pidfileDir = os.TempDir() } - return filepath.Join(pidfileDir, "chifra/scrape", strings.ToLower(opts.Globals.Chain)+".pid") + return filepath.Join(pidfileDir, "chifra", "scrape", strings.ToLower(opts.Globals.Chain)+".pid") } func getConfigCmdsFromArgs() map[string]string { diff --git a/src/apps/chifra/internal/scrape/scrape_blaze.go b/src/apps/chifra/internal/scrape/scrape_blaze.go index b0119461e8..4cf1736fae 100644 --- a/src/apps/chifra/internal/scrape/scrape_blaze.go +++ b/src/apps/chifra/internal/scrape/scrape_blaze.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "os" + "path/filepath" "sort" "strings" "sync" @@ -161,8 +162,8 @@ var writeMutex sync.Mutex // WriteAppearances writes the appearance for a chunk to a file func (bm *BlazeManager) WriteAppearances(bn base.Blknum, addrMap uniq.AddressBooleanMap) (err error) { - ripePath := config.PathToIndex(bm.chain) + "ripe/" - unripePath := config.PathToIndex(bm.chain) + "unripe/" + ripePath := filepath.Join(config.PathToIndex(bm.chain), "ripe") + unripePath := filepath.Join(config.PathToIndex(bm.chain), "unripe") appendScrapeError := func(err error) { bm.errors = append(bm.errors, scrapeError{block: bn, err: err}) } @@ -185,9 +186,9 @@ func (bm *BlazeManager) WriteAppearances(bn base.Blknum, addrMap uniq.AddressBoo sort.Strings(appearanceArray) blockNumStr := utils.PadNum(int(bn), 9) - fileName := ripePath + blockNumStr + ".txt" + fileName := filepath.Join(ripePath, blockNumStr + ".txt") if bn > bm.ripeBlock { - fileName = unripePath + blockNumStr + ".txt" + fileName = filepath.Join(unripePath, blockNumStr + ".txt") } toWrite := []byte(strings.Join(appearanceArray[:], "\n") + "\n") diff --git a/src/apps/chifra/internal/scrape/scrape_consolidate.go b/src/apps/chifra/internal/scrape/scrape_consolidate.go index b54e261b2c..e64a18e5f8 100644 --- a/src/apps/chifra/internal/scrape/scrape_consolidate.go +++ b/src/apps/chifra/internal/scrape/scrape_consolidate.go @@ -25,12 +25,10 @@ func (bm *BlazeManager) Consolidate(ctx context.Context, blocks []base.Blknum) e var err error chain := bm.chain - indexPath := config.PathToIndex(chain) - backup := file.BackupFile{} stageFn, _ := file.LatestFileInFolder(bm.StageFolder()) // it may not exist... if file.FileExists(stageFn) { - backup, err = file.MakeBackup(filepath.Join(config.PathToCache(chain)+"tmp"), stageFn) + backup, err = file.MakeBackup(filepath.Join(config.PathToCache(chain), "tmp"), stageFn) if err != nil { return errors.New("Could not create backup file: " + err.Error()) } @@ -96,7 +94,7 @@ func (bm *BlazeManager) Consolidate(ctx context.Context, blocks []base.Blknum) e isOvertop := nAppearances >= int(bm.PerChunk()) // Does this block overtop a chunk? if isSnap || isOvertop { // Make a chunk - i.e., consolidate - chunkPath := indexPath + "finalized/" + chunkRange.String() + ".bin" + chunkPath := filepath.Join(config.PathToIndex(chain), "finalized", chunkRange.String()+".bin") publisher := base.ZeroAddr var chunk index.Chunk if report, err := chunk.Write(chain, publisher, chunkPath, appMap, nAppearances); err != nil { diff --git a/src/apps/chifra/internal/scrape/scrape_prepare.go b/src/apps/chifra/internal/scrape/scrape_prepare.go index 98e246492f..aec5709ac8 100644 --- a/src/apps/chifra/internal/scrape/scrape_prepare.go +++ b/src/apps/chifra/internal/scrape/scrape_prepare.go @@ -27,7 +27,7 @@ func (opts *ScrapeOptions) Prepare() (ok bool, err error) { _ = cleanEphemeralIndexFolders(chain) // If the file already exists, we're done. - bloomPath := config.PathToIndex(chain) + "blooms/000000000-000000000.bloom" + bloomPath := filepath.Join(config.PathToIndex(chain), "blooms/000000000-000000000.bloom") if file.FileExists(bloomPath) { return true, nil } From 4174fd921d4b353bb2b4597dbb01f7b3913de8e5 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:54:59 -0400 Subject: [PATCH 062/121] Fixes build --- src/apps/chifra/pkg/cache/store.go | 1 - 1 file changed, 1 deletion(-) diff --git a/src/apps/chifra/pkg/cache/store.go b/src/apps/chifra/pkg/cache/store.go index b41daed4c8..9b2d524e1f 100644 --- a/src/apps/chifra/pkg/cache/store.go +++ b/src/apps/chifra/pkg/cache/store.go @@ -6,7 +6,6 @@ import ( "errors" "os" "path/filepath" - "strings" "sync" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/cache/locations" From 32975fa95de4a99a8bfea42652b473a7b9bad89f Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 21:57:15 -0400 Subject: [PATCH 063/121] Updates go.mods --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index 6fe256b20f..084ccacf3b 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index e051e57078..ffde232b76 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index f25ebb9ebc..ce449a3fde 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 6c2b7fa181..290baf684b 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index 368103994b..0a43d25099 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index 2746da8164..07c081ce5a 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index d57e61d4e7..7f192ff45e 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index 35cb35c439..fd1bd5f818 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index b4f76e33ff..fb0135799f 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index 41fde2b04c..37dfa47b68 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index e4ac25377a..e6fa35c6bb 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index 44ca297637..bd44a607a9 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index 26cbbff185..cffad971cc 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index 9f3b1999b6..bd15bea50c 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index 66c9aaa281..4869bfd3bf 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983 h1:r2sWkOzDQBKbtZ5gr4vvA1Ra/oaPWKpsLhAAY8rRHrY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240728020742-8b2832e69983/go.mod h1:KvhLK6KQxaus9XuMV7gpziPxQi/SPDI5j4EeEN8uWhw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983 h1:FofaEM47nTnt3ASo38s8FXmV5+AvHcTV0KwqKMWIhxw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240728020742-8b2832e69983/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From 5dd554d9e2af530c34564ea74d0c58a0a4b935e5 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:05:32 -0400 Subject: [PATCH 064/121] Small step towards Windows support --- src/CMakeLists.txt | 10 ++ src/apps/chifra/internal/abis/handle_list.go | 2 +- .../pkg/file/{lock_linux.go => lock_unix.go} | 4 +- src/apps/chifra/pkg/file/lock_windows.go | 2 + .../{scanbar_linux.go => scanbar_unix.go} | 3 + .../chifra/pkg/progress/scanbar_windows.go | 1 + src/dev_tools/goMaker/types/check.go | 124 ------------------ 7 files changed, 20 insertions(+), 126 deletions(-) rename src/apps/chifra/pkg/file/{lock_linux.go => lock_unix.go} (97%) rename src/apps/chifra/pkg/progress/{scanbar_linux.go => scanbar_unix.go} (93%) delete mode 100644 src/dev_tools/goMaker/types/check.go diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f4a4786209..f15d01303e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -90,8 +90,13 @@ ADD_GO_INSTALLABLE_PROGRAM(goMaker ${CMAKE_SOURCE_DIR}/dev_tools/goMaker ${BIN_D if (NOT WIN32) ADD_GO_INSTALLABLE_PROGRAM(testRunner ${CMAKE_SOURCE_DIR}/dev_tools/testRunner ${BIN_DIR}) ADD_GO_INSTALLABLE_PROGRAM(sdkFuzzer ${CMAKE_SOURCE_DIR}/dev_tools/sdkFuzzer ${BIN_DIR}) +<<<<<<< HEAD add_dependencies(sdkFuzzer goMaker) add_dependencies(testRunner goMaker) +======= + add_dependencies(testRunner goMaker) + add_dependencies(sdkFuzzer goMaker) +>>>>>>> 43932c80d (Small step towards Windows support) add_dependencies(chifra testRunner) endif() @@ -101,4 +106,9 @@ file(GLOB CHIFRA_FOR_DOCKER_FILES "${CMAKE_SOURCE_DIR}/apps/chifra/*.go") add_custom_target(chifra-for-docker ALL COMMAND ${GO_EXECUTABLE} build -o ${BIN_DIR}/chifra ${CHIFRA_FOR_DOCKER_FILES} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/apps/chifra +<<<<<<< HEAD DEPENDS ${CHIFRA_FOR_DOCKER_FILES}) +======= + DEPENDS ${CHIFRA_FOR_DOCKER_FILES} +) +>>>>>>> 43932c80d (Small step towards Windows support) diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index 4ee9cc86dc..c144716e51 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -61,7 +61,7 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { } if testMode { abi.LastModDate = "--date--" - abi.Path = filepath.Clean(strings.ReplaceAll(abi.Path, config.PathToRootConfig(), "./")) + abi.Path = strings.ReplaceAll(abi.Path, config.PathToRootConfig(), ".") } modelChan <- &abi } diff --git a/src/apps/chifra/pkg/file/lock_linux.go b/src/apps/chifra/pkg/file/lock_unix.go similarity index 97% rename from src/apps/chifra/pkg/file/lock_linux.go rename to src/apps/chifra/pkg/file/lock_unix.go index f51c93402d..834acafb44 100644 --- a/src/apps/chifra/pkg/file/lock_linux.go +++ b/src/apps/chifra/pkg/file/lock_unix.go @@ -1,3 +1,6 @@ +//go:build !windows +// +build !windows + // Copyright 2021 The TrueBlocks Authors. All rights reserved. // Use of this source code is governed by a license that can // be found in the LICENSE file. @@ -10,7 +13,6 @@ import ( "syscall" ) - // Lock asks the OS to lock a file for the current process func Lock(file *os.File) error { // Lock configuration. We want both read (F_RDLCK) and diff --git a/src/apps/chifra/pkg/file/lock_windows.go b/src/apps/chifra/pkg/file/lock_windows.go index 12be98b3aa..3a95a711c1 100644 --- a/src/apps/chifra/pkg/file/lock_windows.go +++ b/src/apps/chifra/pkg/file/lock_windows.go @@ -9,9 +9,11 @@ import ( ) func Lock(file *os.File) error { + // TODO: Don't we need this? return nil } func Unlock(file *os.File) error { + // TODO: DOn't we need this? return nil } diff --git a/src/apps/chifra/pkg/progress/scanbar_linux.go b/src/apps/chifra/pkg/progress/scanbar_unix.go similarity index 93% rename from src/apps/chifra/pkg/progress/scanbar_linux.go rename to src/apps/chifra/pkg/progress/scanbar_unix.go index 465f3782d6..78c39b3a0a 100644 --- a/src/apps/chifra/pkg/progress/scanbar_linux.go +++ b/src/apps/chifra/pkg/progress/scanbar_unix.go @@ -1,3 +1,6 @@ +//go:build !windows +// +build !windows + // Copyright 2021 The TrueBlocks Authors. All rights reserved. // Use of this source code is governed by a license that can // be found in the LICENSE file. diff --git a/src/apps/chifra/pkg/progress/scanbar_windows.go b/src/apps/chifra/pkg/progress/scanbar_windows.go index 0706580dc9..ac8694fc97 100644 --- a/src/apps/chifra/pkg/progress/scanbar_windows.go +++ b/src/apps/chifra/pkg/progress/scanbar_windows.go @@ -5,5 +5,6 @@ package progress func screenWidth() uint { + // TODO: Can we read the screen width? return 120 // default reasonably } diff --git a/src/dev_tools/goMaker/types/check.go b/src/dev_tools/goMaker/types/check.go deleted file mode 100644 index 0d4eb187d1..0000000000 --- a/src/dev_tools/goMaker/types/check.go +++ /dev/null @@ -1,124 +0,0 @@ -package types - -// handle_gocmds_docfile -// verifyGoEnumValidators -// verifyDescriptions -// replaceAll(source, "opts.LastBlock != base.NOPOS", "opts.LastBlock != 0 && opts.LastBlock != base.NOPOS"); -// string_q n = "readme-intros/" + substitute(toLower(cmd.group), " ", "") + "-" + cmd.a pi_route + ".config.md"; -// string_q configDocs = getDocsPathTemplates(n); -// ::remove(configDocs.c_str()); // remove it if it exists, we will replace it -// ostringstream os; -// bool hasConfig = 0; -// for (auto member : *((C CommandOptionArray*)cmd.members)) { -// if (member.generate == "config") { -// ostringstream dd; -// if (!hasConfig) { -// dd << "| " << padRight("Item", 18) << " | " << padRight("Type", 12) << " | " << padRight("Default", 12) -// << " | Description / Default |" << endl; -// dd << "| " << string_q(18, '-') << " | " << string_q(12, '-') << " | " << string_q(12, '-') -// << " | --------- |" << endl; -// } -// string_q x = toCamelCase(member.Format("[{LONGNAME}]")); -// dd << "| " << padRight(x, 18) << " | " << padRight(member.Format("[{GO_INTYPE}]"), 12) << " | " -// << padRight(member.Format("[{DEF_VAL}]"), 12) << " | " << member.Format("[{DESCRIPTION}]") << " |" -// << endl; -// appendToAsciiFile(configDocs, dd.str()); -// hasConfig = true; -// continue; -// } -// string_q var = member.Format("[{VARIABLE}]"); -// string_q type = member.Format("[{GO_INTYPE}]"); -// ONE(os, var, varWidth, type, typeWidth, member.description); -// if (contains(var, "Blocks") && contains(member.go_intype, "[]string")) { -// ONE(os, "BlockIds", varWidth, "[]identifiers.Identifier", typeWidth, "block identifiers"); -// } -// if (contains(var, "Transactions") && contains(member.go_intype, "[]string")) { -// ONE(os, "TransactionIds", varWidth, "[]identifiers.Identifier", typeWidth, "transaction identifiers"); -// } -// } -// if (hasConfig) { -// string type = cmd.Format("config.[{PROPER}]Settings"); -// ONE(os, "Settings", varWidth, type, typeWidth, "Configuration items for the " + cmd.a pi_route); -// } -// ONE(os, "Globals", varWidth, "globals.GlobalOptions", typeWidth, "the global options"); -// ONE(os, "Conn", varWidth, "*rpc.Connection", typeWidth, "the connection to the RPC server"); -// ONE(os, "BadFlag", varWidth, "error", typeWidth, "an error flag if needed"); -// hasValidator(const string_q& route, const string_q& str) { -// string_q contents = asciiFileToString(getPathToSourc e("apps/chifra/internal/" + route + "/validate.go")); -// CStringArray parts; -// explode(parts, str, '|'); -// for (auto part : parts) { -// if (!contains(contents, part)) -// return false; -// } -// return true; -// } - -// //--------------------------------------------------------------------------------------------------- -// void COptions::verifyGoEnumValidators(void) { -// string_q e = p.data_type; -// replace(e, "enum", ""); -// replace(e, "list", ""); -// replaceAny(e, "<[*]>", ""); -// e = "[" + e + "]"; -// if (!hasValidator(p.a pi_route, e)) { -// LOG_WARN("\t", bRed, p.a pi_route, " has no enum validator for ", e, cOff); -// exit(0); -// } -// } -// if (p.generate == "deprecated") { -// if (!hasValidator(p.a pi_route, "deprecated|--" + p.longName)) { -// ostringstream os; -// os << "The '" << p.a pi_route << " --" << p.longName -// << "' option is deprecated, but no usage message in validate.go"; -// LOG_WARN("\t", bRed, os.str(), cOff); -// } -// } -// } -// } - -// //--------------------------------------------------------------------------------------------------- -// bool COptions::handle_gocmds_docfile(const CCommandOption& ep) { -// string_q source = asciiFileToString(getPathToTemplates("blank_doc.go.tmpl")); -// string_q fn = getPathToSourc e("apps/chifra/internal/" + ep.a pi_route + "/doc.go"); -// establishFolder(fn); - -// string_q docFn = substitute(toLower(ep.group), " ", "") + "-" + ep.a pi_route + ".md"; -// string_q docSource = getDocsPathTemplates("readme-intros/" + docFn); -// const char* STR_WHAT = "// Package [{a pi_route}]Pkg handles the chifra [{a pi_route}] command. It "; -// string_q contents = STR_WHAT + asciiFileToString(docSource); -// contents = substitute(substitute(substitute(contents, "\n", " "), "\t", " "), "\r", " "); -// replaceAll(contents, " ", " "); -// replaceAll(contents, "`", ""); -// replaceAll(contents, "[{NAME}]", "[chifra {ROUTE}]"); -// replaceAll(source, "TEXT_TEMPLATE", contents); -// replaceAll(source, "[{ROUTE}]", ep.a pi_route); -// replaceAll(source, "[{LOWER}]", toLower(ep.a pi_route)); -// source = ep.Format(source); - -// codewrite_t cw(fn, source); -// cw.nSpaces = 0; -// cw.stripEOFNL = false; -// counter.nProcessed += writeCod eIn(this, cw); -// counter.nVisited++; - -// return true; -// } -//--------------------------------------------------------------------------------------------------- -// void COptions::verifyDescriptions(void) { -// for (auto ep : endpointAr ray) { -// if (!ep.is_visible) -// continue; -// for (auto option : cmdOptionArra y) { -// if (ep.a pi_route == option.a pi_route && option.option_type == "comm and") { -// if (ep.description != option.description) { -// ostringstream os; -// os << "Endpoint descriptions for " << ep.a pi_route << " do not agree:" << endl; -// os << "\tendpoint: " << ep.description << endl; -// os << "\toption: " << option.description << endl; -// LOG_WARN(os.str()); -// } -// } -// } -// } -// } From d69f3d86b5c6d6658c5673a944dc96d7befee3d0 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:13:47 -0400 Subject: [PATCH 065/121] cleaning --- src/other/four_bytes/pkg/fourBytes/generate.go | 17 ++++++++++------- src/other/four_bytes/pkg/fourBytes/verify.go | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/other/four_bytes/pkg/fourBytes/generate.go b/src/other/four_bytes/pkg/fourBytes/generate.go index 008d1216a3..cd35574514 100644 --- a/src/other/four_bytes/pkg/fourBytes/generate.go +++ b/src/other/four_bytes/pkg/fourBytes/generate.go @@ -5,7 +5,7 @@ import ( "fmt" "io" "os" - "path" + "path/filepath" "runtime" "sync" @@ -43,7 +43,7 @@ func collectWorker(i interface{}) { args := i.(*collectWorkerArgs) var offset uint32 = 0 - key := path.Join(args.DirName, args.FileName) + key := filepath.Join(args.DirName, args.FileName) // lock mutex for writing mu.Lock() @@ -79,7 +79,7 @@ func writeWorker(i interface{}) { defer writeWg.Done() args := i.(*writePoolArgs) - out, err := os.OpenFile(path.Join(args.outDir, args.key), os.O_RDWR|os.O_CREATE, 0666) + out, err := os.OpenFile(filepath.Join(args.outDir, args.key), os.O_RDWR|os.O_CREATE, 0666) if err != nil { panic(err) } @@ -93,15 +93,18 @@ func writeWorker(i interface{}) { // GenerateFromFiles reads input files and creates four bytes database. It then sends it to writeWorkers to save // chunk files. func GenerateFromFiles(outDir string) (err error) { - sigsFile, err := os.OpenFile(path.Join(config.PathToRootConfig(), "abis/known-000/uniq_sigs.tab"), os.O_RDONLY, 0) + sigsFn := filepath.Join(config.PathToRootConfig(), "abis/known-000/uniq_sigs.tab") + sigsFile, err := os.OpenFile(sigsFn, os.O_RDONLY, 0) if err != nil { return } - funcsFile, err := os.OpenFile(path.Join(config.PathToRootConfig(), "abis/known-000/uniq_funcs.tab"), os.O_RDONLY, 0) + funcsFn := filepath.Join(config.PathToRootConfig(), "abis/known-000/uniq_funcs.tab") + funcsFile, err := os.OpenFile(funcsFn, os.O_RDONLY, 0) if err != nil { return } - eventsFile, err := os.OpenFile(path.Join(config.PathToRootConfig(), "abis/known-000/uniq_events.tab"), os.O_RDONLY, 0) + eventsFn := filepath.Join(config.PathToRootConfig(), "abis/known-000/uniq_events.tab") + eventsFile, err := os.OpenFile(eventsFn, os.O_RDONLY, 0) if err != nil { return } @@ -157,7 +160,7 @@ func GenerateFromFiles(outDir string) (err error) { fileName := fmt.Sprintf("%x", encoded[:2]) dirName := fileName[:2] - err := file.EstablishFolder(path.Join(outDir, dirName)) + err := file.EstablishFolder(filepath.Join(outDir, dirName)) if err != nil { return err } diff --git a/src/other/four_bytes/pkg/fourBytes/verify.go b/src/other/four_bytes/pkg/fourBytes/verify.go index 04ceb4a3a4..10860e9a8f 100644 --- a/src/other/four_bytes/pkg/fourBytes/verify.go +++ b/src/other/four_bytes/pkg/fourBytes/verify.go @@ -3,7 +3,7 @@ package fourbytes import ( "fmt" "os" - "path" + "path/filepath" ) func logError(filename string, err string) { @@ -23,7 +23,7 @@ func Verify(chunks *map[string]mapRecord, outDir string) { logError(filePath, "empty") continue } - file, err := os.OpenFile(path.Join(outDir, filePath), os.O_RDONLY, 0) + file, err := os.OpenFile(filepath.Join(outDir, filePath), os.O_RDONLY, 0) if err != nil { logError(filePath, err.Error()) file.Close() From c6d02be23f648d3e5975e1141afea6373e88d118 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:16:41 -0400 Subject: [PATCH 066/121] Cleaning testRunner use of filepath --- src/dev_tools/testRunner/main.go | 14 +++++++------- src/dev_tools/testRunner/test_case.go | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dev_tools/testRunner/main.go b/src/dev_tools/testRunner/main.go index 1cd554634a..ee043a82d9 100644 --- a/src/dev_tools/testRunner/main.go +++ b/src/dev_tools/testRunner/main.go @@ -49,7 +49,7 @@ func main() { summary := NewSummary() for _, item := range routeList { - source := casesPath + item + ".csv" + source := filepath.Join(casesPath, item+".csv") for _, mode := range modeList { tr := NewRunner(testMap, item, mode, source) for _, testCase := range testMap[source] { @@ -120,7 +120,7 @@ func parseCsv(filePath string) ([]TestCase, error) { record: rec, IsEnabled: rec.Enabled == "on", HasShorthand: strings.Contains(rec.Options, "@"), - WorkingPath: filepath.Join(getWorkingPath(), rec.Path, rec.Tool) + "/", + WorkingPath: filepath.Join(getWorkingPath(), rec.Path, rec.Tool), OrigOptions: rec.Options, SourceFile: filePath, } @@ -315,15 +315,15 @@ func getRepoRoot() string { } func getCasesPath() string { - return filepath.Join(getRepoRoot(), "src/dev_tools/testRunner/testCases") + "/" + return filepath.Join(getRepoRoot(), "src/dev_tools/testRunner/testCases") } func getGeneratedPath() string { - return filepath.Join(getRepoRoot(), "src/dev_tools/testRunner/generated") + "/" + return filepath.Join(getRepoRoot(), "src/dev_tools/testRunner/generated") } func getWorkingPath() string { - return filepath.Join(getRepoRoot(), "tests/working") + "/" + return filepath.Join(getRepoRoot(), "tests/working") } func getTempFilePath(goldFn string) string { @@ -331,7 +331,7 @@ func getTempFilePath(goldFn string) string { } func getLogFile(mode string) string { - return getGeneratedPath() + "test_" + mode + ".log" + return filepath.Join(getGeneratedPath(), "test_"+mode+".log") } func loadTestCases() (map[string][]TestCase, string, error) { @@ -360,6 +360,6 @@ func loadTestCases() (map[string][]TestCase, string, error) { return testMap, casesPath, fmt.Errorf("error walking the path %q: %v", casesPath, err) } - file.StringToAsciiFile(getGeneratedPath()+"testCases.json", toJson(testMap)) + file.StringToAsciiFile(filepath.Join(getGeneratedPath(), "testCases.json"), toJson(testMap)) return testMap, casesPath, nil } diff --git a/src/dev_tools/testRunner/test_case.go b/src/dev_tools/testRunner/test_case.go index a67fb4201c..3cacaa78f7 100644 --- a/src/dev_tools/testRunner/test_case.go +++ b/src/dev_tools/testRunner/test_case.go @@ -82,14 +82,14 @@ func (t *TestCase) ShouldRun(mode string) bool { func (t *TestCase) GetOutputPaths(mode string) (string, string, string, string) { working := t.WorkingPath if mode != "cmd" { - working = filepath.Join(t.WorkingPath, mode+"_tests") + "/" + working = filepath.Join(t.WorkingPath, mode+"_tests") } gold := strings.ReplaceAll(working, "working", "gold") workFn := filepath.Join(working, t.Tool+"_"+t.Filename+".txt") goldFn := filepath.Join(gold, t.Tool+"_"+t.Filename+".txt") testRoot := func(s string) string { - return strings.ReplaceAll(strings.ReplaceAll(s, "sdk_tests/", ""), "api_tests/", "") + return strings.ReplaceAll(strings.ReplaceAll(s, "sdk_tests", ""), "api_tests", "") } envFn := filepath.Join(testRoot(gold), t.Filename+".env") if !file.FileExists(envFn) { From 33087fbb16efd8978a24aff9e7675b970f51c211 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:20:07 -0400 Subject: [PATCH 067/121] Improves use of filepath in dev_tools --- src/dev_tools/goMaker/types/generate.go | 8 ++++-- src/dev_tools/goMaker/types/load.go | 2 +- src/dev_tools/goMaker/types/types_command.go | 2 +- .../goMaker/types/types_structure.go | 4 +-- src/dev_tools/goMaker/types/utils.go | 2 +- .../goMaker/types/verifyValidators.go | 27 +++++++++++++++++++ src/dev_tools/sdkFuzzer/globals.go | 3 ++- 7 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 src/dev_tools/goMaker/types/verifyValidators.go diff --git a/src/dev_tools/goMaker/types/generate.go b/src/dev_tools/goMaker/types/generate.go index d15fd72257..381c417fd6 100644 --- a/src/dev_tools/goMaker/types/generate.go +++ b/src/dev_tools/goMaker/types/generate.go @@ -1,6 +1,7 @@ package types import ( + "os" "path/filepath" "sort" "strings" @@ -18,6 +19,9 @@ type Generator struct { // Generate generates the code for the codebase using the given templates. func (cb *CodeBase) Generate() { + // Before we start, we need to verify that the validators are in place + cb.verifyValidators() + generatedPath := GetGeneratedPath() file.EstablishFolder(generatedPath) @@ -87,8 +91,8 @@ func getGenerators() ([]Generator, error) { vFunc := func(file string, vP any) (bool, error) { if strings.HasSuffix(file, ".tmpl") { file = strings.ReplaceAll(file, generatorsPath, "") - if strings.Contains(file, "/") { - parts := strings.Split(file, "/") + if strings.Contains(file, string(os.PathSeparator)) { + parts := strings.Split(file, string(os.PathSeparator)) theMap[parts[0]] = append(theMap[parts[0]], file) } } diff --git a/src/dev_tools/goMaker/types/load.go b/src/dev_tools/goMaker/types/load.go index e9f709eed7..9f5f50cfce 100644 --- a/src/dev_tools/goMaker/types/load.go +++ b/src/dev_tools/goMaker/types/load.go @@ -142,7 +142,7 @@ func (cb *CodeBase) LoadMembers(thePath string, structMap map[string]Structure) return nil } -func (cb *CodeBase) FinishLoad(thePath string, baseTypes []Structure, options []Option, structMap map[string]Structure) error { +func (cb *CodeBase) FinishLoad(unused string, baseTypes []Structure, options []Option, structMap map[string]Structure) error { cb.BaseTypes = baseTypes for i := 0; i < len(cb.BaseTypes); i++ { cb.BaseTypes[i].cbPtr = cb diff --git a/src/dev_tools/goMaker/types/types_command.go b/src/dev_tools/goMaker/types/types_command.go index 8968f916d0..ea62b739f7 100644 --- a/src/dev_tools/goMaker/types/types_command.go +++ b/src/dev_tools/goMaker/types/types_command.go @@ -547,7 +547,7 @@ func (c *Command) HelpLinks() string { } func (c *Command) HelpNotes() string { - readmePath := filepath.Join(GetTemplatePath(), "readme-intros/"+c.ReadmeName()) + readmePath := filepath.Join(GetTemplatePath(), "readme-intros", c.ReadmeName()) readmePath = strings.Replace(readmePath, ".md", ".notes.md", -1) if file.FileExists(readmePath) { tmplName := "Notes" + c.ReadmeName() diff --git a/src/dev_tools/goMaker/types/types_structure.go b/src/dev_tools/goMaker/types/types_structure.go index a56fc02b56..74a2cc8885 100644 --- a/src/dev_tools/goMaker/types/types_structure.go +++ b/src/dev_tools/goMaker/types/types_structure.go @@ -109,7 +109,7 @@ func (s *Structure) GroupName() string { func (s *Structure) ModelIntro() string { tmplName := "modelIntro" + s.Class - tmpl := strings.Trim(getTemplateContents("model-intros/"+CamelCase(s.Class)), ws) + tmpl := strings.Trim(getTemplateContents(filepath.Join("model-intros", CamelCase(s.Class))), ws) return s.executeTemplate(tmplName, tmpl) } @@ -143,7 +143,7 @@ func (s *Structure) ModelMembers() string { func (s *Structure) ModelNotes() string { tmplName := "Notes" + s.Class - tmpl := strings.Trim(getTemplateContents("model-intros/"+CamelCase(s.Class)+".notes"), ws) + tmpl := strings.Trim(getTemplateContents(filepath.Join("model-intros", CamelCase(s.Class)+".notes")), ws) return strings.Trim(s.executeTemplate(tmplName, tmpl), ws) } diff --git a/src/dev_tools/goMaker/types/utils.go b/src/dev_tools/goMaker/types/utils.go index c7dd3c7aeb..a4e39ee39d 100644 --- a/src/dev_tools/goMaker/types/utils.go +++ b/src/dev_tools/goMaker/types/utils.go @@ -102,7 +102,7 @@ func getTemplatesPath() (string, error) { } for _, path := range paths { - thePath := filepath.Join(path, "templates/") + thePath := filepath.Join(path, "templates") if file.FolderExists(thePath) { setRootFolder(path) return thePath, nil diff --git a/src/dev_tools/goMaker/types/verifyValidators.go b/src/dev_tools/goMaker/types/verifyValidators.go new file mode 100644 index 0000000000..1b0403d9e5 --- /dev/null +++ b/src/dev_tools/goMaker/types/verifyValidators.go @@ -0,0 +1,27 @@ +package types + +import ( + "fmt" + "os" + "path/filepath" + "strings" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" +) + +func (cb *CodeBase) verifyValidators() { + cwd, _ := os.Getwd() + for _, cmd := range cb.Commands { + path := filepath.Join(cwd, "src/apps/chifra/internal/", cmd.Route, "validate.go") + for _, opts := range cmd.Options { + if len(opts.Enums) > 0 { + contents := file.AsciiFileToString(path) + want := strings.Join(opts.Enums, "|") + if !strings.Contains(contents, want) { + logger.Fatal(fmt.Sprintf("Missing enum validator (%s) for %s", want, path)) + } + } + } + } +} diff --git a/src/dev_tools/sdkFuzzer/globals.go b/src/dev_tools/sdkFuzzer/globals.go index 1c60c803e7..90b98d3d29 100644 --- a/src/dev_tools/sdkFuzzer/globals.go +++ b/src/dev_tools/sdkFuzzer/globals.go @@ -3,6 +3,7 @@ package main import ( "fmt" "os" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/sdk/v3" @@ -44,7 +45,7 @@ func getFilename(baseName string, g *sdk.Globals) string { app += "-verbose" } - return "sdkFuzzer-output/" + baseName + app + ".json" + return filepath.Join("sdkFuzzer-output", baseName+app+".json") } var spaces = strings.Repeat(" ", 30) From dc10118dda08e8cf5356f68008a64ac42387a1c1 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:27:19 -0400 Subject: [PATCH 068/121] Improves use of filepath in pkg/abis and pkg/cache --- src/CMakeLists.txt | 9 ------- src/apps/chifra/pkg/abi/load_abi.go | 19 +++++++------ src/apps/chifra/pkg/base/fileRange_test.go | 3 ++- src/apps/chifra/pkg/cache/cache.go | 3 ++- src/apps/chifra/pkg/cache/store.go | 9 +++---- src/apps/chifra/pkg/config/config.go | 13 +++++---- src/apps/chifra/pkg/config/config_test.go | 21 ++++++++------- .../pkg/config/paths_integration_test.go | 6 ++--- src/apps/chifra/pkg/config/unchainedGroup.go | 5 ++-- src/apps/chifra/pkg/index/checkVersion.go | 3 ++- src/apps/chifra/pkg/index/download_chunks.go | 7 ++--- src/apps/chifra/pkg/index/paths.go | 27 +++++++------------ src/apps/chifra/pkg/manifest/download.go | 4 ++- src/apps/chifra/pkg/monitor/monitor.go | 6 ++--- .../chifra/pkg/monitor/monitor_decache.go | 4 +-- .../chifra/pkg/monitor/monitor_freshen.go | 4 +-- .../pkg/names/custom_integration_test.go | 6 ++--- src/apps/chifra/pkg/pinning/unpin_pin.go | 3 ++- src/apps/chifra/pkg/tslib/establish.go | 3 ++- src/apps/chifra/pkg/utils/system.go | 23 ---------------- src/apps/chifra/pkg/walk/walk.go | 10 +++---- 21 files changed, 80 insertions(+), 108 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f15d01303e..4741c0ac36 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -90,13 +90,8 @@ ADD_GO_INSTALLABLE_PROGRAM(goMaker ${CMAKE_SOURCE_DIR}/dev_tools/goMaker ${BIN_D if (NOT WIN32) ADD_GO_INSTALLABLE_PROGRAM(testRunner ${CMAKE_SOURCE_DIR}/dev_tools/testRunner ${BIN_DIR}) ADD_GO_INSTALLABLE_PROGRAM(sdkFuzzer ${CMAKE_SOURCE_DIR}/dev_tools/sdkFuzzer ${BIN_DIR}) -<<<<<<< HEAD - add_dependencies(sdkFuzzer goMaker) - add_dependencies(testRunner goMaker) -======= add_dependencies(testRunner goMaker) add_dependencies(sdkFuzzer goMaker) ->>>>>>> 43932c80d (Small step towards Windows support) add_dependencies(chifra testRunner) endif() @@ -106,9 +101,5 @@ file(GLOB CHIFRA_FOR_DOCKER_FILES "${CMAKE_SOURCE_DIR}/apps/chifra/*.go") add_custom_target(chifra-for-docker ALL COMMAND ${GO_EXECUTABLE} build -o ${BIN_DIR}/chifra ${CHIFRA_FOR_DOCKER_FILES} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/apps/chifra -<<<<<<< HEAD - DEPENDS ${CHIFRA_FOR_DOCKER_FILES}) -======= DEPENDS ${CHIFRA_FOR_DOCKER_FILES} ) ->>>>>>> 43932c80d (Small step towards Windows support) diff --git a/src/apps/chifra/pkg/abi/load_abi.go b/src/apps/chifra/pkg/abi/load_abi.go index bc5808b915..8139b731cd 100644 --- a/src/apps/chifra/pkg/abi/load_abi.go +++ b/src/apps/chifra/pkg/abi/load_abi.go @@ -10,7 +10,6 @@ import ( "io" "io/fs" "os" - "path" "path/filepath" "strings" @@ -385,7 +384,7 @@ func readFunction(reader *bufio.Reader) (function *types.Function, err error) { // getAbis reads all ABIs stored in the cache func getAbis(chain string) ([]types.Function, error) { - fullPath := path.Join(config.PathToCache(chain), walk.CacheTypeToFolder[walk.Cache_Abis], "known.bin") + fullPath := filepath.Join(config.PathToCache(chain), walk.CacheTypeToFolder[walk.Cache_Abis], "known.bin") if f, err := os.OpenFile(fullPath, os.O_RDONLY, 0); err != nil { return nil, err @@ -597,7 +596,7 @@ func writeAbis(writer *bufio.Writer, abis []types.Function) (err error) { // setAbis writes ABIs to the cache func setAbis(chain string, abis []types.Function) (err error) { - var abisFilePath = path.Join(walk.CacheTypeToFolder[walk.Cache_Abis], "known.bin") + var abisFilePath = filepath.Join(walk.CacheTypeToFolder[walk.Cache_Abis], "known.bin") buf := bytes.Buffer{} writer := bufio.NewWriter(&buf) if err = writeAbis(writer, abis); err != nil { @@ -613,7 +612,7 @@ func setAbis(chain string, abis []types.Function) (err error) { // save writes contents of `content` Reader to a file func save(chain string, filePath string, content io.Reader) (err error) { cacheDir := config.PathToCache(chain) - fullPath := path.Join(cacheDir, filePath) + fullPath := filepath.Join(cacheDir, filePath) var f *os.File if file.FileExists(fullPath) { @@ -641,8 +640,8 @@ func save(chain string, filePath string, content io.Reader) (err error) { // LoadKnownAbis loads known ABI files into abiMap, refreshing binary cache if needed func (abiMap *SelectorSyncMap) LoadKnownAbis(chain string) (err error) { isUpToDate := func(chain string) (bool, error) { - testFn := path.Join(config.PathToCache(chain), "abis/known.bin") - testDir := path.Join(config.PathToRootConfig(), "abis") + testFn := filepath.Join(config.PathToCache(chain), "abis/known.bin") + testDir := filepath.Join(config.PathToRootConfig(), "abis") if cacheFile, err := os.Stat(testFn); os.IsNotExist(err) { return false, nil @@ -686,7 +685,7 @@ func (abiMap *SelectorSyncMap) LoadKnownAbis(chain string) (err error) { } func getKnownAbiPaths() (filePaths []string, err error) { - knownDirPath := path.Join(config.PathToRootConfig(), "abis") + knownDirPath := filepath.Join(config.PathToRootConfig(), "abis") err = filepath.WalkDir(knownDirPath, func(path string, d fs.DirEntry, err error) error { if err != nil { return err @@ -752,7 +751,7 @@ func loadAbiFromAddress(conn *rpc.Connection, address base.Address, abiMap *Sele // insertAbi copies file (e.g. opened local file) into cache func insertAbi(chain string, address base.Address, inputReader io.Reader) error { - fullPath := path.Join(config.PathToCache(chain), walk.CacheTypeToFolder[walk.Cache_Abis], address.Hex()+".json") + fullPath := filepath.Join(config.PathToCache(chain), walk.CacheTypeToFolder[walk.Cache_Abis], address.Hex()+".json") if file, err := os.OpenFile(fullPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666); err != nil { return err } else { @@ -766,8 +765,8 @@ func insertAbi(chain string, address base.Address, inputReader io.Reader) error // getAbi returns single ABI per address. ABI-per-address are stored as JSON, not binary. func getAbi(chain string, address base.Address) (simpleAbis []types.Function, err error) { - filePath := path.Join(walk.CacheTypeToFolder[walk.Cache_Abis], address.Hex()+".json") - fullPath := path.Join(config.PathToCache(chain), filePath) + filePath := filepath.Join(walk.CacheTypeToFolder[walk.Cache_Abis], address.Hex()+".json") + fullPath := filepath.Join(config.PathToCache(chain), filePath) f, err := os.OpenFile(fullPath, os.O_RDONLY, 0) if err != nil { return diff --git a/src/apps/chifra/pkg/base/fileRange_test.go b/src/apps/chifra/pkg/base/fileRange_test.go index 690d8f5417..315f2db0b6 100644 --- a/src/apps/chifra/pkg/base/fileRange_test.go +++ b/src/apps/chifra/pkg/base/fileRange_test.go @@ -6,6 +6,7 @@ package base import ( "fmt" + "os" "strings" "testing" ) @@ -88,7 +89,7 @@ func TestFilenameFromRange(t *testing.T) { fR := FileRange{0, 100} want := "mainnet/finalized/000000000-000000100.bin" got := fR.RangeToFilename("mainnet") - parts := strings.Split(got, "unchained/") + parts := strings.Split(got, "unchained"+string(os.PathSeparator)) if len(parts) != 2 || parts[1] != want { t.Errorf("FilenameFromRange() = %v, want %v", got, parts[1]) } diff --git a/src/apps/chifra/pkg/cache/cache.go b/src/apps/chifra/pkg/cache/cache.go index da9059becc..c3beea34c9 100644 --- a/src/apps/chifra/pkg/cache/cache.go +++ b/src/apps/chifra/pkg/cache/cache.go @@ -3,6 +3,7 @@ package cache import ( "io" "log" + "path/filepath" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/cache/locations" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" @@ -90,7 +91,7 @@ func (s *StoreOptions) rootDir() (dir string) { if dir != "" { // TODO: v1 suffix - return dir + "/v1" + return filepath.Join(dir, "v1") } return s.RootDir diff --git a/src/apps/chifra/pkg/cache/store.go b/src/apps/chifra/pkg/cache/store.go index 431e73b438..9b2d524e1f 100644 --- a/src/apps/chifra/pkg/cache/store.go +++ b/src/apps/chifra/pkg/cache/store.go @@ -5,8 +5,7 @@ import ( "context" "errors" "os" - "path" - "strings" + "path/filepath" "sync" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/cache/locations" @@ -70,10 +69,10 @@ func (s *Store) resolvePath(value Locator) (resolved string, err error) { err = errors.New("empty CacheLocations") return } - if strings.HasPrefix(directory, string(os.PathSeparator)) { - resolved = path.Join(directory, (id + "." + extension)) + if filepath.IsAbs(directory) { + resolved = filepath.Join(directory, (id + "." + extension)) } else { - resolved = path.Join(s.rootDir, directory, (id + "." + extension)) + resolved = filepath.Join(s.rootDir, directory, (id + "." + extension)) } return diff --git a/src/apps/chifra/pkg/config/config.go b/src/apps/chifra/pkg/config/config.go index acfe9b08d5..c5a837ddd6 100644 --- a/src/apps/chifra/pkg/config/config.go +++ b/src/apps/chifra/pkg/config/config.go @@ -70,7 +70,8 @@ func GetRootConfig() *ConfigFile { trueBlocksConfig = *defaultConfig // Load TOML file - if err := loadFromTomlFile(filepath.Join(configPath, "trueBlocks.toml"), &trueBlocksConfig); err != nil { + tomlConfigFn := filepath.Join(configPath, "trueBlocks.toml") + if err := loadFromTomlFile(tomlConfigFn, &trueBlocksConfig); err != nil { log.Fatal("loading config from .toml file:", err) } @@ -82,6 +83,7 @@ func GetRootConfig() *ConfigFile { user, _ := user.Current() cachePath := trueBlocksConfig.Settings.CachePath + cachePath = strings.Replace(cachePath, "/", string(os.PathSeparator), -1) if len(cachePath) == 0 || cachePath == "" { cachePath = filepath.Join(configPath, "cache") } @@ -93,6 +95,7 @@ func GetRootConfig() *ConfigFile { trueBlocksConfig.Settings.CachePath = cachePath indexPath := trueBlocksConfig.Settings.IndexPath + indexPath = strings.Replace(indexPath, "/", string(os.PathSeparator), -1) if len(indexPath) == 0 || indexPath == "" { indexPath = filepath.Join(configPath, "unchained") } @@ -171,7 +174,7 @@ func PathToRootConfig() string { return configPath } - // The migration code will have already checked for invalid operating systems (i.e. Windows) + // The migration code will have already checked for invalid operating systems userOs := runtime.GOOS if len(os.Getenv("TEST_OS")) > 0 { userOs = os.Getenv("TEST_OS") @@ -182,7 +185,7 @@ func PathToRootConfig() string { if userOs == "darwin" { osPath = "Library/Application Support/TrueBlocks" } else if userOs == "windows" { - osPath = "AppData/Local/trueblocks" + osPath = "AppData/Local/trueblocks" } return filepath.Join(user.HomeDir, osPath) @@ -195,7 +198,7 @@ func pathFromXDG(envVar string) (string, error) { return "", nil // it's okay if it's empty } - if xdg[0] != '/' { + if xdg[0] != string(os.PathSeparator)[0] { return "", usage.Usage("The {0} value ({1}), must be fully qualified.", envVar, xdg) } @@ -203,7 +206,7 @@ func pathFromXDG(envVar string) (string, error) { return "", usage.Usage("The {0} folder ({1}) must exist.", envVar, xdg) } - return filepath.Join(xdg, "") + "/", nil + return filepath.Join(xdg, ""), nil } func validateRpcEndpoint(chain, provider string) error { diff --git a/src/apps/chifra/pkg/config/config_test.go b/src/apps/chifra/pkg/config/config_test.go index ffff6d6764..8dfde0c87c 100644 --- a/src/apps/chifra/pkg/config/config_test.go +++ b/src/apps/chifra/pkg/config/config_test.go @@ -5,6 +5,7 @@ package config import ( + "os" "testing" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" @@ -14,28 +15,28 @@ func Test_ReadTrueBlocks(t *testing.T) { if len(GetSettings().CachePath) == 0 { t.Error("CachePath is empty") } - if GetSettings().CachePath[len(GetSettings().CachePath)-1] != '/' { - // the path may not end with a slash, but the returned path better + if GetSettings().CachePath[len(GetSettings().CachePath)-1] == os.PathSeparator { + // the user's path may end with a slash, but the returned path does not ret := PathToCache(utils.GetTestChain()) - if len(ret) > 0 && ret[len(ret)-1] != '/' { - t.Error("CachePath does not end with a '/'") + if len(ret) > 0 && ret[len(ret)-1] == os.PathSeparator { + t.Error("CachePath ends with a '/'. It should not.") } } - if GetSettings().CachePath[0] != '/' { + if GetSettings().CachePath[0] != os.PathSeparator { t.Error("CachePath is not an absolute path") } if len(GetSettings().IndexPath) == 0 { t.Error("IndexPath is empty") } - if GetSettings().IndexPath[len(GetSettings().IndexPath)-1] != '/' { - // the path may not end with a slash, but the returned path better + if GetSettings().IndexPath[len(GetSettings().IndexPath)-1] == os.PathSeparator { + // the user's path may end with a slash, but the returned path does not ret := PathToIndex(utils.GetTestChain()) - if len(ret) > 0 && ret[len(ret)-1] != '/' { - t.Error("IndexPath does not end with a '/'") + if len(ret) > 0 && ret[len(ret)-1] == string(os.PathSeparator)[0] { + t.Error("IndexPath ends with a '/'. It should not.") } } settings := GetSettings() - if settings.IndexPath[0] != '/' { + if settings.IndexPath[0] != os.PathSeparator { t.Error("IndexPath is not an absolute path") } if len(GetSettings().DefaultChain) == 0 { diff --git a/src/apps/chifra/pkg/config/paths_integration_test.go b/src/apps/chifra/pkg/config/paths_integration_test.go index 2bce8296d9..588f5b875e 100644 --- a/src/apps/chifra/pkg/config/paths_integration_test.go +++ b/src/apps/chifra/pkg/config/paths_integration_test.go @@ -58,17 +58,17 @@ func Test_GetPathTo(t *testing.T) { } } else if test.group == "Cache" { os.Setenv("XDG_CACHE_HOME", test.xdg) - testPath = PathToCache(test.chain) + test.part + testPath = filepath.Join(PathToCache(test.chain), test.part) } else if test.group == "Index" { os.Setenv("XDG_CACHE_HOME", test.xdg) - testPath = PathToIndex(test.chain) + test.part + testPath = filepath.Join(PathToIndex(test.chain), test.part) } testPath = strings.Replace(testPath, user.HomeDir, "$HOME", -1) if test.expected == "" { fmt.Println("") } else { - test.expected = strings.Replace(test.expected, "{CHAIN}/", test.chain+"/", -1) + test.expected = strings.ReplaceAll(test.expected, "{CHAIN}", test.chain) if testPath != test.expected { test.Report(index, testPath) t.Error(index, "Paths don't match (", test.expected, testPath, ")") diff --git a/src/apps/chifra/pkg/config/unchainedGroup.go b/src/apps/chifra/pkg/config/unchainedGroup.go index 52461cbf0b..4811afb7b3 100644 --- a/src/apps/chifra/pkg/config/unchainedGroup.go +++ b/src/apps/chifra/pkg/config/unchainedGroup.go @@ -1,6 +1,7 @@ package config import ( + "path/filepath" "strings" "sync" @@ -58,7 +59,7 @@ var m sync.Mutex func ExpectedVersion() string { if headerVersion == "" { m.Lock() - historyFile := PathToRootConfig() + "unchained.txt" + historyFile := filepath.Join(PathToRootConfig(), "unchained.txt") headerVersion = history.FromHistory(historyFile, "headerVersion") if headerVersion == "" { headerVersion = "trueblocks-core@v2.0.0-release" @@ -70,7 +71,7 @@ func ExpectedVersion() string { func SetExpectedVersion(version string) { m.Lock() - historyFile := PathToRootConfig() + "unchained.txt" + historyFile := filepath.Join(PathToRootConfig(), "unchained.txt") _ = history.ToHistory(historyFile, "headerVersion", version) headerVersion = version m.Unlock() diff --git a/src/apps/chifra/pkg/index/checkVersion.go b/src/apps/chifra/pkg/index/checkVersion.go index 83258cd151..f91acd1dbf 100644 --- a/src/apps/chifra/pkg/index/checkVersion.go +++ b/src/apps/chifra/pkg/index/checkVersion.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "os" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/colors" @@ -18,7 +19,7 @@ var ErrIncorrectHash = errors.New("incorrect header hash") // IsInitialized returns an error if the version in the header is not as requested func IsInitialized(chain, required string) error { - fileName := config.PathToIndex(chain) + "blooms/000000000-000000000.bloom" + fileName := filepath.Join(config.PathToIndex(chain), "blooms/000000000-000000000.bloom") if !file.FileExists(fileName) { const indexNotInitialized string = ` diff --git a/src/apps/chifra/pkg/index/download_chunks.go b/src/apps/chifra/pkg/index/download_chunks.go index d105cd2091..6e87e3c839 100644 --- a/src/apps/chifra/pkg/index/download_chunks.go +++ b/src/apps/chifra/pkg/index/download_chunks.go @@ -14,6 +14,7 @@ import ( "net/http" "net/url" "os" + "path" "path/filepath" "strconv" "strings" @@ -114,7 +115,7 @@ func getDownloadWorker(chain string, workerArgs downloadWorkerArguments, chunkTy if workerArgs.ctx.Err() != nil { // User hit control + c - clean up both peices for the current chunk - chunkPath := filepath.Join(config.PathToIndex(chain), "finalized", chunk.Range + ".bin") + chunkPath := filepath.Join(config.PathToIndex(chain), "finalized", chunk.Range+".bin") removeLocalFile(ToIndexPath(chunkPath), "user canceled", progressChannel) removeLocalFile(ToBloomPath(chunkPath), "user canceled", progressChannel) progressChannel <- &progress.ProgressMsg{ @@ -153,7 +154,7 @@ type fetchResult struct { // fetchFromIpfsGateway downloads a chunk from an IPFS gateway using HTTP func fetchFromIpfsGateway(ctx context.Context, gateway, hash string) (*fetchResult, error) { url, _ := url.Parse(gateway) - url.Path += hash + url.Path = path.Join(url.Path, hash) debug.DebugCurlStr(url.String()) request, err := http.NewRequestWithContext(ctx, "GET", url.String(), nil) @@ -308,7 +309,7 @@ func DownloadChunks(chain string, chunksToDownload []types.ChunkRecord, chunkTyp // writeBytesToDisc save the downloaded bytes to disc func writeBytesToDisc(chain string, chunkType walk.CacheType, res *jobResult) error { - fullPath := filepath.Join(config.PathToIndex(chain), "finalized", res.rng + ".bin") + fullPath := filepath.Join(config.PathToIndex(chain), "finalized", res.rng+".bin") if chunkType == walk.Index_Bloom { fullPath = ToBloomPath(fullPath) } diff --git a/src/apps/chifra/pkg/index/paths.go b/src/apps/chifra/pkg/index/paths.go index a2649f00a2..e0e224916a 100644 --- a/src/apps/chifra/pkg/index/paths.go +++ b/src/apps/chifra/pkg/index/paths.go @@ -1,15 +1,8 @@ package index import ( - "strings" - "os" "path/filepath" -) - -const ( - blooms_str = string(os.PathSeparator) + "blooms" + string(os.PathSeparator) - staging_str = string(os.PathSeparator) + "staging" + string(os.PathSeparator) - finalized_str = string(os.PathSeparator) + "finalized" + string(os.PathSeparator) + "strings" ) func isCacheType(path string, folder, extension string) bool { @@ -27,10 +20,10 @@ func ToBloomPath(pathIn string) string { if isCacheType(pathIn, "blooms", "bloom") { return pathIn } - ret := strings.Replace(filepath.Clean(pathIn), ".bin", ".bloom", -1)) + ret := strings.Replace(filepath.Clean(pathIn), ".bin", ".bloom", -1) ret = strings.Replace(ret, ".txt", ".bloom", -1) - ret = strings.Replace(ret, finalized_str, blooms_str, -1) - ret = strings.Replace(ret, staging_str, blooms_str, -1) + ret = strings.Replace(ret, "finalized", "blooms", -1) + ret = strings.Replace(ret, "staging", "blooms", -1) return ret } @@ -40,10 +33,10 @@ func ToIndexPath(pathIn string) string { return pathIn } - ret := strings.Replace(filepath.Clean(pathIn), ".bloom", ".bin", -1)) + ret := strings.Replace(filepath.Clean(pathIn), ".bloom", ".bin", -1) ret = strings.Replace(ret, ".txt", ".bin", -1) - ret = strings.Replace(ret, blooms_str, finalized_str, -1) - ret = strings.Replace(ret, staging_str, finalized_str, -1) + ret = strings.Replace(ret, "blooms", "finalized", -1) + ret = strings.Replace(ret, "staging", "finalized", -1) return ret } @@ -53,9 +46,9 @@ func ToStagingPath(pathIn string) string { return pathIn } - ret := strings.Replace(filepath.Clean(pathIn), ".bin", ".txt", -1)) + ret := strings.Replace(filepath.Clean(pathIn), ".bin", ".txt", -1) ret = strings.Replace(ret, ".bloom", ".txt", -1) - ret = strings.Replace(ret, finalized_str, staging_str, -1) - ret = strings.Replace(ret, blooms_str, staging_str, -1) + ret = strings.Replace(ret, "finalized", "staging", -1) + ret = strings.Replace(ret, "blooms", "staging", -1) return ret } diff --git a/src/apps/chifra/pkg/manifest/download.go b/src/apps/chifra/pkg/manifest/download.go index fa29ab8333..b3f4e24b6c 100644 --- a/src/apps/chifra/pkg/manifest/download.go +++ b/src/apps/chifra/pkg/manifest/download.go @@ -10,6 +10,7 @@ import ( "net/http" "net/url" "os" + "path" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/abi" @@ -64,11 +65,12 @@ func ReadUnchainedIndex(chain string, publisher base.Address, database string) ( // Manifest struct. Both JSON and TSV formats are supported, but the server has // to set the correct Content-Type header. func downloadManifest(chain, gatewayUrl, cid string) (*Manifest, error) { + _ = chain // linter url, err := url.Parse(gatewayUrl) if err != nil { return nil, err } - url.Path += cid + url.Path = path.Join(url.Path, cid) debug.DebugCurlStr(url.String()) resp, err := http.Get(url.String()) diff --git a/src/apps/chifra/pkg/monitor/monitor.go b/src/apps/chifra/pkg/monitor/monitor.go index a6236e75d7..9a7d3b8548 100644 --- a/src/apps/chifra/pkg/monitor/monitor.go +++ b/src/apps/chifra/pkg/monitor/monitor.go @@ -97,9 +97,9 @@ func (mon Monitor) String() string { // Path returns the path to the Monitor file func (mon *Monitor) Path() (path string) { if mon.Staged { - path = filepath.Join(config.PathToCache(mon.Chain), "monitors", "staging", mon.Address.Hex() + Ext) + path = filepath.Join(config.PathToCache(mon.Chain), "monitors", "staging", mon.Address.Hex()+Ext) } else { - path = filepath.Join(config.PathToCache(mon.Chain), "monitors", mon.Address.Hex() + Ext) + path = filepath.Join(config.PathToCache(mon.Chain), "monitors", mon.Address.Hex()+Ext) } return } @@ -211,7 +211,7 @@ func ListMonitors(chain, watchList string, monitorChan chan<- Monitor) { return nil } - path := config.PathToCache(chain) + "monitors" + path := filepath.Join(config.PathToCache(chain), "monitors") _ = filepath.Walk(path, walkFunc) } diff --git a/src/apps/chifra/pkg/monitor/monitor_decache.go b/src/apps/chifra/pkg/monitor/monitor_decache.go index e7a4730530..853c1db838 100644 --- a/src/apps/chifra/pkg/monitor/monitor_decache.go +++ b/src/apps/chifra/pkg/monitor/monitor_decache.go @@ -3,7 +3,7 @@ package monitor import ( "fmt" "os" - "path" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/decache" @@ -41,7 +41,7 @@ func (mon *Monitor) Decache(conn *rpc.Connection, showProgress bool) (string, er } } - abiPath := path.Join(walk.GetRootPathFromCacheType(conn.Chain, walk.Cache_Abis), mon.Address.Hex()+".json") + abiPath := filepath.Join(walk.GetRootPathFromCacheType(conn.Chain, walk.Cache_Abis), mon.Address.Hex()+".json") if file.FileExists(abiPath) { os.Remove(abiPath) logger.Progress(showProgress, "Abi "+abiPath+" file removed.") diff --git a/src/apps/chifra/pkg/monitor/monitor_freshen.go b/src/apps/chifra/pkg/monitor/monitor_freshen.go index 3c588e869d..f25099d60a 100644 --- a/src/apps/chifra/pkg/monitor/monitor_freshen.go +++ b/src/apps/chifra/pkg/monitor/monitor_freshen.go @@ -196,7 +196,7 @@ func (updater *MonitorUpdate) FreshenMonitors(monitorArray *[]Monitor) (bool, er if !updater.TestMode { // TODO: Note we could actually test this if we had the concept of a FAKE_HEAD block - stagePath := index.ToStagingPath(config.PathToIndex(updater.Chain) + "staging") + stagePath := index.ToStagingPath(filepath.Join(config.PathToIndex(updater.Chain), "staging")) stageFn, _ := file.LatestFileInFolder(stagePath) rng := base.RangeFromFilename(stageFn) lines := []string{} @@ -362,7 +362,7 @@ func needsMigration(addr string) error { mon := Monitor{Address: base.HexToAddress(addr)} path := strings.Replace(mon.Path(), ".mon.bin", ".acct.bin", -1) if file.FileExists(path) { - path = filepath.Clean(strings.Replace(path, config.PathToCache(mon.Chain), "./", -1)) + path = filepath.Clean(strings.ReplaceAll(path, config.PathToCache(mon.Chain), "./")) return validate.Usage("Old style monitor found at {0}. Please run '{1}'", path, "chifra config --migrate cache") } return nil diff --git a/src/apps/chifra/pkg/names/custom_integration_test.go b/src/apps/chifra/pkg/names/custom_integration_test.go index 69a7c6541d..eacee824dc 100644 --- a/src/apps/chifra/pkg/names/custom_integration_test.go +++ b/src/apps/chifra/pkg/names/custom_integration_test.go @@ -6,7 +6,7 @@ import ( "fmt" "io" "os" - "path" + "path/filepath" "testing" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -16,7 +16,7 @@ import ( func TestCrudIntegration(t *testing.T) { chain := utils.GetTestChain() - tmpDirPath := path.Join(os.TempDir(), "trueblocks") + tmpDirPath := filepath.Join(os.TempDir(), "trueblocks") if err := os.MkdirAll(tmpDirPath, 0777); err != nil { t.Fatal(err) } @@ -27,7 +27,7 @@ func TestCrudIntegration(t *testing.T) { }() loadTestDatabase := func() *os.File { tempFile, err := os.OpenFile( - path.Join(os.TempDir(), "trueblocks", "names_custom.tab"), + filepath.Join(os.TempDir(), "trueblocks", "names_custom.tab"), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777, ) diff --git a/src/apps/chifra/pkg/pinning/unpin_pin.go b/src/apps/chifra/pkg/pinning/unpin_pin.go index 45015e4f6e..41d7438c1f 100644 --- a/src/apps/chifra/pkg/pinning/unpin_pin.go +++ b/src/apps/chifra/pkg/pinning/unpin_pin.go @@ -3,6 +3,7 @@ package pinning import ( "fmt" "net/http" + "path/filepath" "time" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -42,7 +43,7 @@ func unpinOne(chain string, i, total int, hash base.IpfsHash) error { } func Unpin(chain string, count bool, sleep float64) error { - lines := file.AsciiFileToLines("./unpins") + lines := file.AsciiFileToLines(filepath.Join(".", "unpins")) if count { logger.Info("There are", len(lines), "pins to unpin.") } else { diff --git a/src/apps/chifra/pkg/tslib/establish.go b/src/apps/chifra/pkg/tslib/establish.go index f10151425c..436aeeaea1 100644 --- a/src/apps/chifra/pkg/tslib/establish.go +++ b/src/apps/chifra/pkg/tslib/establish.go @@ -7,6 +7,7 @@ import ( "net/http" "net/url" "os" + "path" "time" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -53,7 +54,7 @@ func downloadTimestamps(chain, database, outputFn, cid string) (error, bool) { if err != nil { return err, false } - url.Path += cid + url.Path = path.Join(url.Path, cid) debug.DebugCurlStr(url.String()) diff --git a/src/apps/chifra/pkg/utils/system.go b/src/apps/chifra/pkg/utils/system.go index 5212c65ddf..df1162a553 100644 --- a/src/apps/chifra/pkg/utils/system.go +++ b/src/apps/chifra/pkg/utils/system.go @@ -28,26 +28,3 @@ func System(cmd string) int { return -1 } - -/* -func systemToString(cmd string) string { - c := exec.Command("sh", "-c", cmd) - c.Stdin = os.Stdin - - if ff, err := os.Create("/tmp/output.txt"); err != nil { - return err.Error() - - } else { - c.Stdout = ff - c.Stderr = ff - - if err := c.Run(); err != nil { - return err.Error() - } - - ret := file.AsciiFileToString("/tmp/output.txt") - os.Remove("/tmp/output.txt") - return strings.Trim(ret, "\n\r\t ,") - } -} -*/ diff --git a/src/apps/chifra/pkg/walk/walk.go b/src/apps/chifra/pkg/walk/walk.go index e52cf90561..3b682596c4 100644 --- a/src/apps/chifra/pkg/walk/walk.go +++ b/src/apps/chifra/pkg/walk/walk.go @@ -347,8 +347,8 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil } display := cacheInfo.Path - display = filepath.Clean(strings.Replace(display, config.PathToCache(chain), "./", -1)) - display = filepath.Clean(strings.Replace(display, config.PathToIndex(chain), "./", -1)) + display = filepath.Clean(strings.ReplaceAll(display, config.PathToCache(chain)+"/", "./")) + display = filepath.Clean(strings.ReplaceAll(display, config.PathToIndex(chain)+"/", "./")) switch cT { case Index_Maps: @@ -357,7 +357,7 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil fallthrough case Index_Final: if testMode { - display = strings.Replace(cacheInfo.Path, config.PathToIndex(chain), "$indexPath/", 1) + display = strings.Replace(cacheInfo.Path, config.PathToIndex(chain)+"/", "$indexPath/", 1) } return map[string]any{ // "bloomSizeBytes": file.FileSize(index.ToBloomPath(cacheInfo.Path)), @@ -376,7 +376,7 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil fallthrough case Cache_Abis: address := "" - parts := strings.Split(cacheInfo.Path, "/") + parts := strings.Split(cacheInfo.Path, string(os.PathSeparator)) for _, part := range parts { if strings.HasPrefix(part, "0x") { address = part @@ -384,7 +384,7 @@ func GetCacheItem(chain string, testMode bool, cT CacheType, cacheInfo *CacheFil } } if testMode { - display = strings.Replace(cacheInfo.Path, config.PathToCache(chain), "$cachePath/", 1) + display = strings.Replace(cacheInfo.Path, config.PathToCache(chain)+"/", "$cachePath/", 1) display = strings.Replace(display, address, "--address--", -1) address = "--address--" } From f982096edd9786ed8a3963f3d12292e7f1859ab4 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:48:29 -0400 Subject: [PATCH 069/121] Fixes use of filepath in some tools --- src/apps/chifra/internal/explore/options.go | 7 ++-- .../chifra/internal/monitors/handle_watch.go | 33 +++++++++---------- src/apps/chifra/internal/monitors/scraper.go | 3 +- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/apps/chifra/internal/explore/options.go b/src/apps/chifra/internal/explore/options.go index f5089bdfdb..8ea30fc454 100644 --- a/src/apps/chifra/internal/explore/options.go +++ b/src/apps/chifra/internal/explore/options.go @@ -14,6 +14,7 @@ import ( "io" "net/http" "net/url" + "path" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/globals" @@ -198,13 +199,13 @@ func (u *ExploreUrl) getUrl(opts *ExploreOptions) string { case ExploreNone: // do nothing case ExploreTx: - query = "tx/" + u.term + query = path.Join("tx", u.term) case ExploreBlock: - query = "block/" + u.term + query = path.Join("block", u.term) case ExploreAddress: fallthrough default: - query = "address/" + u.term + query = path.Join("address", u.term) } if opts.Local { diff --git a/src/apps/chifra/internal/monitors/handle_watch.go b/src/apps/chifra/internal/monitors/handle_watch.go index 1c0b3750e2..2b50aa81a1 100644 --- a/src/apps/chifra/internal/monitors/handle_watch.go +++ b/src/apps/chifra/internal/monitors/handle_watch.go @@ -7,6 +7,7 @@ package monitorsPkg import ( "encoding/json" "fmt" + "os" "path/filepath" "strings" "sync" @@ -265,47 +266,45 @@ func (opts *MonitorsOptions) getOutputFolder(orig string) (string, error) { logger.Fatal(s) } + cwd, _ := os.Getwd() cmdLine += " " folder := "unknown" if parts[1] == "export" { - folder = "./export" if strings.Contains(cmdLine, "-p ") || strings.Contains(cmdLine, "--appearances ") { - folder += "/appearances" + folder = filepath.Join(cwd, parts[1], "appearances") } else if strings.Contains(cmdLine, "-r ") || strings.Contains(cmdLine, "--receipts ") { - folder += "/receipts" + folder = filepath.Join(cwd, parts[1], "receipts") } else if strings.Contains(cmdLine, "-l ") || strings.Contains(cmdLine, "--logs ") { - folder += "/logs" + folder = filepath.Join(cwd, parts[1], "logs") } else if strings.Contains(cmdLine, "-t ") || strings.Contains(cmdLine, "--traces ") { - folder += "/traces" + folder = filepath.Join(cwd, parts[1], "traces") } else if strings.Contains(cmdLine, "-n ") || strings.Contains(cmdLine, "--neighbors ") { - folder += "/neighbors" + folder = filepath.Join(cwd, parts[1], "neighbors") } else if strings.Contains(cmdLine, "-C ") || strings.Contains(cmdLine, "--accounting ") { - folder += "/accounting" + folder = filepath.Join(cwd, parts[1], "accounting") } else if strings.Contains(cmdLine, "-A ") || strings.Contains(cmdLine, "--statements ") { - folder += "/statements" + folder = filepath.Join(cwd, parts[1], "statements") } else if strings.Contains(cmdLine, "-b ") || strings.Contains(cmdLine, "--balances ") { - folder += "/balances" + folder = filepath.Join(cwd, parts[1], "balances") } else { - folder += "/transactions" + folder = filepath.Join(cwd, parts[1], "transactions") } } else if parts[1] == "list" { - folder = "./list/appearances" + folder = filepath.Join(cwd, parts[1], "appearances") } else if parts[1] == "state" { - folder = "./state" if strings.Contains(cmdLine, "-l ") || strings.Contains(cmdLine, "--call ") { - folder += "/calls" + folder = filepath.Join(cwd, parts[1], "calls") } else { - folder += "/blocks" + folder = filepath.Join(cwd, parts[1], "blocks") } } else if parts[1] == "tokens" { - folder = "./tokens" if strings.Contains(cmdLine, "-b ") || strings.Contains(cmdLine, "--by_acct ") { - folder += "/by_acct" + folder = filepath.Join(cwd, parts[1], "by_acct") } else { - folder += "/blocks" + folder = filepath.Join(cwd, parts[1], "blocks") } } diff --git a/src/apps/chifra/internal/monitors/scraper.go b/src/apps/chifra/internal/monitors/scraper.go index bc987e1a2f..cec888f22d 100644 --- a/src/apps/chifra/internal/monitors/scraper.go +++ b/src/apps/chifra/internal/monitors/scraper.go @@ -7,6 +7,7 @@ package monitorsPkg import ( "fmt" "os" + "path/filepath" "time" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" @@ -30,7 +31,7 @@ func (scraper *Scraper) ChangeState(onOff bool, tmpPath string) bool { prev := scraper.Running scraper.Running = onOff str := "false" - fileName := tmpPath + scraper.Name + ".txt" + fileName := filepath.Join(tmpPath, scraper.Name+".txt") err := os.WriteFile(fileName, []byte(str), 0644) // Uses os.O_WRONLY|os.O_CREATE|os.O_TRUNC if err != nil { logger.Fatal(err) From 08f6545ae2181cb47988884b7169305700f76544 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:49:05 -0400 Subject: [PATCH 070/121] Fixes use of filepath in some chifra abis --- src/apps/chifra/internal/abis/handle_find.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/apps/chifra/internal/abis/handle_find.go b/src/apps/chifra/internal/abis/handle_find.go index 5027d96640..7e59966771 100644 --- a/src/apps/chifra/internal/abis/handle_find.go +++ b/src/apps/chifra/internal/abis/handle_find.go @@ -10,6 +10,7 @@ import ( "encoding/hex" "io" "os" + "path/filepath" "runtime" "sort" "strings" @@ -66,7 +67,8 @@ func (opts *AbisOptions) HandleFind(rCtx *output.RenderCtx) error { defer checkOne.Release() // TODO: UnchainedIndex --> This could be part of unchained index - sigsFile, err := os.OpenFile(config.PathToRootConfig()+"abis/known-000/uniq_sigs.tab", os.O_RDONLY, 0) + sigFile := filepath.Join(config.PathToRootConfig(), "abis", "known-000", "uniq_sigs.tab") + sigsFile, err := os.OpenFile(sigFile, os.O_RDONLY, 0) if err != nil { errorChan <- err rCtx.Cancel() @@ -80,7 +82,8 @@ func (opts *AbisOptions) HandleFind(rCtx *output.RenderCtx) error { sigsScanner.Split(bufio.ScanLines) // TODO: UnchainedIndex --> This could be part of unchained index - funcsFile, _ := os.OpenFile(config.PathToRootConfig()+"abis/known-000/uniq_funcs.tab", os.O_RDONLY, 0) + funcFile := filepath.Join(config.PathToRootConfig(), "abis", "known-000", "uniq_funcs.tab") + funcsFile, _ := os.OpenFile(funcFile, os.O_RDONLY, 0) defer func() { funcsFile.Close() }() From b5c2ff67e1ba1527d1d070963e7a82488ced9b0a Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 8 Aug 2024 22:50:08 -0400 Subject: [PATCH 071/121] Fixes use of filepath in some chifra chunks --- src/apps/chifra/internal/chunks/handle_address.go | 2 +- src/apps/chifra/internal/chunks/handle_check.go | 3 ++- .../internal/chunks/handle_check_staging.go | 3 ++- src/apps/chifra/internal/chunks/handle_diff.go | 3 ++- .../chifra/internal/chunks/handle_truncate.go | 2 +- src/apps/chifra/internal/chunks/validate.go | 5 +++-- src/apps/chifra/internal/init/handle_dryrun.go | 3 ++- src/apps/chifra/internal/init/handle_example.go | 15 ++++++++------- src/apps/chifra/internal/init/handle_init.go | 3 ++- src/apps/chifra/internal/init/validate.go | 3 ++- src/apps/chifra/internal/scrape/options.go | 4 ++-- src/apps/chifra/internal/scrape/scrape_blaze.go | 4 ++-- .../chifra/internal/scrape/scrape_consolidate.go | 6 ++---- src/apps/chifra/internal/scrape/scrape_prepare.go | 2 +- 14 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/apps/chifra/internal/chunks/handle_address.go b/src/apps/chifra/internal/chunks/handle_address.go index 1792ee9f68..6c821c1c31 100644 --- a/src/apps/chifra/internal/chunks/handle_address.go +++ b/src/apps/chifra/internal/chunks/handle_address.go @@ -38,7 +38,7 @@ func (opts *ChunksOptions) HandleAddresses(rCtx *output.RenderCtx, blockNums []b if !file.FileExists(path) { // This is okay, if the user used chifra init without the --all option. Warn them and continue msg := "" - path = strings.Replace(path, config.PathToIndex(chain), "$indexPath", 1) + path = strings.Replace(path, config.PathToIndex(chain)+"/", "$indexPath/", 1) if been_here < 3 { msg = fmt.Sprintf("index file %s does not exist. Run 'chifra init --all' to create it.", path) } else if been_here == 3 { diff --git a/src/apps/chifra/internal/chunks/handle_check.go b/src/apps/chifra/internal/chunks/handle_check.go index 06a6301e07..ff6f5f32fd 100644 --- a/src/apps/chifra/internal/chunks/handle_check.go +++ b/src/apps/chifra/internal/chunks/handle_check.go @@ -7,6 +7,7 @@ package chunksPkg import ( "errors" "fmt" + "path/filepath" "sort" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -83,7 +84,7 @@ func (opts *ChunksOptions) check(rCtx *output.RenderCtx, blockNums []base.Blknum if err != nil { return err, false } - historyFile := config.PathToRootConfig() + "unchained.txt" + historyFile := filepath.Join(config.PathToRootConfig(), "unchained.txt") saved := history.FromHistory(historyFile, "headerVersion") defer func() { _ = history.ToHistory(historyFile, "headerVersion", saved) diff --git a/src/apps/chifra/internal/chunks/handle_check_staging.go b/src/apps/chifra/internal/chunks/handle_check_staging.go index 283190e4bd..6a2548d4be 100644 --- a/src/apps/chifra/internal/chunks/handle_check_staging.go +++ b/src/apps/chifra/internal/chunks/handle_check_staging.go @@ -6,6 +6,7 @@ package chunksPkg import ( "fmt" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -22,7 +23,7 @@ import ( // 4. Makes sure that the last block inside is == last if allow_missing == false, < otherwise func (opts *ChunksOptions) CheckStaging(lastBlock uint64, allow_missing bool, report *types.ReportCheck) error { chain := opts.Globals.Chain - stagePath := index.ToStagingPath(config.PathToIndex(chain) + "staging") + stagePath := index.ToStagingPath(filepath.Join(config.PathToIndex(chain), "staging")) stageFn, _ := file.LatestFileInFolder(stagePath) if !file.FileExists(stageFn) { return nil diff --git a/src/apps/chifra/internal/chunks/handle_diff.go b/src/apps/chifra/internal/chunks/handle_diff.go index e71294954c..b4197de294 100644 --- a/src/apps/chifra/internal/chunks/handle_diff.go +++ b/src/apps/chifra/internal/chunks/handle_diff.go @@ -7,6 +7,7 @@ import ( "os" "path/filepath" "sort" + "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/colors" @@ -217,7 +218,7 @@ func (opts *ChunksOptions) getParams(chain, path string) (string, string, base.R func toDiffPath(chain string, middleMark base.Blknum) string { diffPath := os.Getenv("TB_CHUNKS_DIFFPATH") - if filepath.Base(diffPath) != "unchained" { + if !strings.Contains(diffPath, "unchained") { diffPath = filepath.Join(diffPath, "unchained", chain, "finalized") } diffPath, _ = filepath.Abs(diffPath) diff --git a/src/apps/chifra/internal/chunks/handle_truncate.go b/src/apps/chifra/internal/chunks/handle_truncate.go index 9b348d65a1..99dca478bd 100644 --- a/src/apps/chifra/internal/chunks/handle_truncate.go +++ b/src/apps/chifra/internal/chunks/handle_truncate.go @@ -126,7 +126,7 @@ func (opts *ChunksOptions) HandleTruncate(rCtx *output.RenderCtx, blockNums []ba } return nil } - _ = filepath.Walk(config.PathToCache(chain)+"monitors", truncateMonitor) + _ = filepath.Walk(filepath.Join(config.PathToCache(chain), "monitors"), truncateMonitor) bar.Prefix = fmt.Sprintf("Truncated monitors to %d ", opts.Truncate) bar.Finish(true /* newLine */) diff --git a/src/apps/chifra/internal/chunks/validate.go b/src/apps/chifra/internal/chunks/validate.go index 8570e761da..c7031b7bdb 100644 --- a/src/apps/chifra/internal/chunks/validate.go +++ b/src/apps/chifra/internal/chunks/validate.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "os" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -54,12 +55,12 @@ func (opts *ChunksOptions) validateChunks() error { } if opts.Unpin { - if !file.FileExists("./unpins") { + if !file.FileExists(filepath.Join(".", "unpins")) { return validate.Usage("The file {0} was not found in the local folder.", "./unpins") } hasOne := false - lines := file.AsciiFileToLines("./unpins") + lines := file.AsciiFileToLines(filepath.Join(".", "unpins")) for _, line := range lines { if pinning.IsValid(line) { hasOne = true diff --git a/src/apps/chifra/internal/init/handle_dryrun.go b/src/apps/chifra/internal/init/handle_dryrun.go index ddd70875f0..359a36dcd0 100644 --- a/src/apps/chifra/internal/init/handle_dryrun.go +++ b/src/apps/chifra/internal/init/handle_dryrun.go @@ -3,6 +3,7 @@ package initPkg import ( "errors" "fmt" + "path/filepath" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" @@ -19,7 +20,7 @@ func (opts *InitOptions) HandleDryRun(rCtx *output.RenderCtx) error { if err != nil { return err } - historyFile := config.PathToRootConfig() + "unchained.txt" + historyFile := filepath.Join(config.PathToRootConfig(), "unchained.txt") saved := history.FromHistory(historyFile, "headerVersion") defer func() { _ = history.ToHistory(historyFile, "headerVersion", saved) diff --git a/src/apps/chifra/internal/init/handle_example.go b/src/apps/chifra/internal/init/handle_example.go index 786b8bb833..773d7d19a1 100644 --- a/src/apps/chifra/internal/init/handle_example.go +++ b/src/apps/chifra/internal/init/handle_example.go @@ -6,6 +6,7 @@ package initPkg import ( "os" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" @@ -18,14 +19,14 @@ import ( // of the files needed to run an example. This is a convenience function for // developers to quickly get started with the example. func (opts *InitOptions) HandleExample(rCtx *output.RenderCtx) error { - template := "base/" // will use opts.Template in the future - tmplFolder := "./templates/" + template // will later support opts.Template - exampleDir := "./" + opts.Example + template := "base/" // will use opts.Template in the future + tmplFolder := filepath.Join("./templates", template) // will later support opts.Template + exampleDir := filepath.Join("./", opts.Example) // We already know that the folder does not exist since it passed validation... _ = os.MkdirAll(exampleDir, 0755) - logger.Info("Example created in ./" + opts.Example + " from " + tmplFolder) + logger.Info("Example created in ", filepath.Join("./", opts.Example)+" from "+tmplFolder) for _, fn := range []string{"main.go", "main_test.go", "go.mod", "README.md"} { copyOne(fn, opts.Example, tmplFolder) @@ -38,17 +39,17 @@ func (opts *InitOptions) HandleExample(rCtx *output.RenderCtx) error { utils.System(cmd) // update the go.work file - os.Remove("../go.work") + os.Remove(filepath.Join("..", "go.work")) utils.System("source ../scripts/go-work-sync.sh") return nil } func copyOne(fn, exName, tmplFolder string) { - contents := file.AsciiFileToString(tmplFolder + fn + ".tmpl") + contents := file.AsciiFileToString(filepath.Join(tmplFolder, fn+".tmpl")) contents = strings.ReplaceAll(contents, "[{NAME}]", utils.MakeFirstUpperCase(exName)) contents = strings.ReplaceAll(contents, "[{LOWER}]", exName) - fn = "./" + exName + "/" + fn + fn = filepath.Join("./", exName, fn) _ = file.StringToAsciiFile(fn, contents) logger.Info("\t==> " + fn) } diff --git a/src/apps/chifra/internal/init/handle_init.go b/src/apps/chifra/internal/init/handle_init.go index 611a45e2c0..4a67298aaf 100644 --- a/src/apps/chifra/internal/init/handle_init.go +++ b/src/apps/chifra/internal/init/handle_init.go @@ -6,6 +6,7 @@ package initPkg import ( "fmt" + "path/filepath" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" @@ -58,7 +59,7 @@ func (opts *InitOptions) HandleInit(rCtx *output.RenderCtx) error { logger.InfoTable("Files deleted:", fmt.Sprintf("%d", nDeleted)) logger.InfoTable("Files downloaded:", fmt.Sprintf("%d", nToDownload)) - historyFile := config.PathToCache(chain) + "tmp/history.txt" + historyFile := filepath.Join(config.PathToCache(chain), "tmp/history.txt") if opts.All && !history.FromHistoryBool(historyFile, "init") { _ = history.ToHistory(historyFile, "init", "true") } diff --git a/src/apps/chifra/internal/init/validate.go b/src/apps/chifra/internal/init/validate.go index c48bf0be94..dfdfe009ee 100644 --- a/src/apps/chifra/internal/init/validate.go +++ b/src/apps/chifra/internal/init/validate.go @@ -7,6 +7,7 @@ package initPkg import ( "fmt" "os" + "path/filepath" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" @@ -57,7 +58,7 @@ func (opts *InitOptions) validateInit() error { // } else if len(opts.Template) > 0 { // return validate.Usage("The {0} option requires the {1} flag.", "--template", "--example") } else { - historyFile := config.PathToCache(chain) + "tmp/history.txt" + historyFile := filepath.Join(config.PathToCache(chain), "tmp/history.txt") if history.FromHistoryBool(historyFile, "init") && !opts.All { return validate.Usage("You previously called chifra init --all. You must continue to do so.") } diff --git a/src/apps/chifra/internal/scrape/options.go b/src/apps/chifra/internal/scrape/options.go index 478f482479..0c82b48e87 100644 --- a/src/apps/chifra/internal/scrape/options.go +++ b/src/apps/chifra/internal/scrape/options.go @@ -231,7 +231,7 @@ func (opts *ScrapeOptions) getPidFilePath() string { var pidfileDir string if runtime.GOOS == "darwin" { // MacOS - pidfileDir = "/usr/local/var/run" + pidfileDir = filepath.Join("/usr/local/var", "run") } else { // Linux // On Linux only root can write to the main directory /run, but every logged-in @@ -245,7 +245,7 @@ func (opts *ScrapeOptions) getPidFilePath() string { if pidfileDir == "" || !file.FolderExists(pidfileDir) { pidfileDir = os.TempDir() } - return filepath.Join(pidfileDir, "chifra/scrape", strings.ToLower(opts.Globals.Chain)+".pid") + return filepath.Join(pidfileDir, "chifra", "scrape", strings.ToLower(opts.Globals.Chain)+".pid") } func getConfigCmdsFromArgs() map[string]string { diff --git a/src/apps/chifra/internal/scrape/scrape_blaze.go b/src/apps/chifra/internal/scrape/scrape_blaze.go index 5593abfa53..4cf1736fae 100644 --- a/src/apps/chifra/internal/scrape/scrape_blaze.go +++ b/src/apps/chifra/internal/scrape/scrape_blaze.go @@ -186,9 +186,9 @@ func (bm *BlazeManager) WriteAppearances(bn base.Blknum, addrMap uniq.AddressBoo sort.Strings(appearanceArray) blockNumStr := utils.PadNum(int(bn), 9) - fileName := ripePath + blockNumStr + ".txt" + fileName := filepath.Join(ripePath, blockNumStr + ".txt") if bn > bm.ripeBlock { - fileName = unripePath + blockNumStr + ".txt" + fileName = filepath.Join(unripePath, blockNumStr + ".txt") } toWrite := []byte(strings.Join(appearanceArray[:], "\n") + "\n") diff --git a/src/apps/chifra/internal/scrape/scrape_consolidate.go b/src/apps/chifra/internal/scrape/scrape_consolidate.go index 2ad1fdd7a2..e64a18e5f8 100644 --- a/src/apps/chifra/internal/scrape/scrape_consolidate.go +++ b/src/apps/chifra/internal/scrape/scrape_consolidate.go @@ -25,12 +25,10 @@ func (bm *BlazeManager) Consolidate(ctx context.Context, blocks []base.Blknum) e var err error chain := bm.chain - indexPath := config.PathToIndex(chain) - backup := file.BackupFile{} stageFn, _ := file.LatestFileInFolder(bm.StageFolder()) // it may not exist... if file.FileExists(stageFn) { - backup, err = file.MakeBackup(filepath.Join(config.PathToCache(chain)+"tmp"), stageFn) + backup, err = file.MakeBackup(filepath.Join(config.PathToCache(chain), "tmp"), stageFn) if err != nil { return errors.New("Could not create backup file: " + err.Error()) } @@ -96,7 +94,7 @@ func (bm *BlazeManager) Consolidate(ctx context.Context, blocks []base.Blknum) e isOvertop := nAppearances >= int(bm.PerChunk()) // Does this block overtop a chunk? if isSnap || isOvertop { // Make a chunk - i.e., consolidate - chunkPath := filepath.Join(indexPath, "finalized", chunkRange.String() + ".bin") + chunkPath := filepath.Join(config.PathToIndex(chain), "finalized", chunkRange.String()+".bin") publisher := base.ZeroAddr var chunk index.Chunk if report, err := chunk.Write(chain, publisher, chunkPath, appMap, nAppearances); err != nil { diff --git a/src/apps/chifra/internal/scrape/scrape_prepare.go b/src/apps/chifra/internal/scrape/scrape_prepare.go index 98e246492f..aec5709ac8 100644 --- a/src/apps/chifra/internal/scrape/scrape_prepare.go +++ b/src/apps/chifra/internal/scrape/scrape_prepare.go @@ -27,7 +27,7 @@ func (opts *ScrapeOptions) Prepare() (ok bool, err error) { _ = cleanEphemeralIndexFolders(chain) // If the file already exists, we're done. - bloomPath := config.PathToIndex(chain) + "blooms/000000000-000000000.bloom" + bloomPath := filepath.Join(config.PathToIndex(chain), "blooms/000000000-000000000.bloom") if file.FileExists(bloomPath) { return true, nil } From 53e9f058face13f80234934b971f00e27ef80b5f Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 17 Aug 2024 08:10:19 -0400 Subject: [PATCH 072/121] Fixes a bug related to turning off loggers --- src/apps/chifra/internal/daemon/routes_support.go | 3 ++- src/apps/chifra/pkg/logger/logger.go | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/apps/chifra/internal/daemon/routes_support.go b/src/apps/chifra/internal/daemon/routes_support.go index 1003851443..f31249d29f 100644 --- a/src/apps/chifra/internal/daemon/routes_support.go +++ b/src/apps/chifra/internal/daemon/routes_support.go @@ -7,6 +7,7 @@ package daemonPkg import ( "encoding/json" "fmt" + "io" "net/http" "time" @@ -101,7 +102,7 @@ func Logger(silent bool, inner http.Handler, name string) http.Handler { if silent { w := logger.GetLoggerWriter() defer logger.SetLoggerWriter(w) - logger.SetLoggerWriter(nil) + logger.SetLoggerWriter(io.Discard) } inner.ServeHTTP(w, r) if !silent { diff --git a/src/apps/chifra/pkg/logger/logger.go b/src/apps/chifra/pkg/logger/logger.go index 950deb9ff5..a52358e32f 100644 --- a/src/apps/chifra/pkg/logger/logger.go +++ b/src/apps/chifra/pkg/logger/logger.go @@ -89,6 +89,14 @@ func init() { loggerWriter = os.Stderr } +// SetLoggerWriter sets the writer to which log messages are written. Do not send +// nil as a writer if you wish to disable logging. Instead, use +// +// w := logger.GetLoggerWriter() +// defer logger.SetLoggerWriter(w) +// logger.SetLoggerWriter(io.Discard) +// +// Setting to `nil` will core dump. func SetLoggerWriter(w io.Writer) { loggerWriter = w } From 818d01eef74fd4ecd838b2d420ae20c56dde0d56 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Tue, 20 Aug 2024 21:17:37 -0400 Subject: [PATCH 073/121] Updates go.mods --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index 084ccacf3b..9802b505da 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index ffde232b76..311e1826bc 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index ce449a3fde..9dc1609a7f 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index 4869bfd3bf..082a386841 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 290baf684b..c926601b6d 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index 4869bfd3bf..082a386841 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index 0a43d25099..baa59b97a4 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index 4869bfd3bf..082a386841 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index 07c081ce5a..2ef9d65053 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index 4869bfd3bf..082a386841 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index 7f192ff45e..ee87c4080d 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index fd1bd5f818..6fa23d79de 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index fb0135799f..3516aa03f0 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index 37dfa47b68..2eb5c7fda3 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index e6fa35c6bb..aff7465396 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index bd44a607a9..d9a7b5d832 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index cffad971cc..bcedd92934 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index 4869bfd3bf..082a386841 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index bd15bea50c..d59455338f 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index 4869bfd3bf..082a386841 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a h1:ktDmw4dSD/zLuWYjmZtrcsyoVTKVO/H/FhHuSUEVNJY= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240808100829-648e5249703a/go.mod h1:wXoRpMI5AxgAnYDf9RQcjiNgrjQNZNMxbJwpScVFuUI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a h1:yhf0uu0TjM2CAT6so1DMCuvgUE/VX1Iwwzw2fF6jR3k= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240808100829-648e5249703a/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From fb584c146f0503532b5e15b0c4d5753d48f5d0ef Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 21 Aug 2024 20:20:26 -0400 Subject: [PATCH 074/121] Extends easier crud operations to the SDK --- sdk/names.go | 22 +++ src/apps/chifra/internal/names/crud.go | 126 +-------------- src/apps/chifra/internal/names/handle_crud.go | 9 +- src/apps/chifra/internal/names/options.go | 3 +- src/apps/chifra/internal/names/output_test.go | 27 ++-- src/apps/chifra/pkg/crud/crud.go | 143 ++++++++++++++++++ src/apps/chifra/pkg/crud/doc.go | 2 + 7 files changed, 192 insertions(+), 140 deletions(-) create mode 100644 src/apps/chifra/pkg/crud/crud.go create mode 100644 src/apps/chifra/pkg/crud/doc.go diff --git a/sdk/names.go b/sdk/names.go index 93851233a6..95e2e90812 100644 --- a/sdk/names.go +++ b/sdk/names.go @@ -11,8 +11,10 @@ package sdk import ( // EXISTING_CODE "encoding/json" + "errors" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/crud" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" // EXISTING_CODE @@ -108,4 +110,24 @@ func (opts *NamesOptions) NamesRemove() ([]types.Name, *types.MetaData, error) { // No enums // EXISTING_CODE +func (opts *NamesOptions) ModifyName(op crud.NameOperation, cd *crud.NameCrud) ([]types.Name, *types.MetaData, error) { + defer func() { + cd.Unsetenv() + }() + + cd.SetEnv() + switch op { + case Create: + case Update: + return opts.NamesUpdate() + case Delete: + return opts.NamesDelete() + case Undelete: + return opts.NamesUndelete() + case Remove: + return opts.NamesRemove() + } + return nil, nil, errors.New("invalid operation " + string(op)) +} + // EXISTING_CODE diff --git a/src/apps/chifra/internal/names/crud.go b/src/apps/chifra/internal/names/crud.go index 9ad99ac1e9..948a8de85d 100644 --- a/src/apps/chifra/internal/names/crud.go +++ b/src/apps/chifra/internal/names/crud.go @@ -9,11 +9,10 @@ package namesPkg import ( - "errors" "net/http" - "os" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/crud" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) @@ -51,123 +50,10 @@ func (opts *NamesOptions) getType() types.Parts { return ret } -type CrudData struct { - Address crudDataField[base.Address] - Name crudDataField[string] - Tags crudDataField[string] - Source crudDataField[string] - Symbol crudDataField[string] - Decimals crudDataField[string] -} -type crudValue interface { - base.Address | string -} -type crudDataField[CV crudValue] struct { - Value CV - Updated bool -} - -func (opts *NamesOptions) getCrudDataHttp(r *http.Request) (data *CrudData, err error) { - if err = r.ParseForm(); err != nil { - return - } - if len(r.PostForm) == 0 { - err = errors.New("empty form") - return - } - - data = &CrudData{ - Address: crudDataField[base.Address]{ - Value: base.HexToAddress(r.PostForm.Get("address")), - Updated: r.PostForm.Has("address"), - }, - Name: crudDataField[string]{ - Value: r.PostForm.Get("name"), - Updated: r.PostForm.Has("name"), - }, - Tags: crudDataField[string]{ - Value: r.PostForm.Get("tags"), - Updated: r.PostForm.Has("tags"), - }, - Source: crudDataField[string]{ - Value: r.PostForm.Get("source"), - Updated: r.PostForm.Has("source"), - }, - Symbol: crudDataField[string]{ - Value: r.PostForm.Get("symbol"), - Updated: r.PostForm.Has("symbol"), - }, - Decimals: crudDataField[string]{ - Value: r.PostForm.Get("decimals"), - Updated: r.PostForm.Has("decimals"), - }, - } - if err = opts.validateCrudData(data); err != nil { - return nil, err - } - - return -} - -func (opts *NamesOptions) getCrudDataEnv() (data *CrudData, err error) { - data = &CrudData{} - address, addressUpdated := os.LookupEnv("TB_NAME_ADDRESS") - data.Address = crudDataField[base.Address]{ - Value: base.HexToAddress(address), - Updated: addressUpdated, - } - name, nameUpdated := os.LookupEnv("TB_NAME_NAME") - data.Name = crudDataField[string]{ - Value: name, - Updated: nameUpdated, - } - tags, tagsUpdated := os.LookupEnv("TB_NAME_TAGS") - data.Tags = crudDataField[string]{ - Value: tags, - Updated: tagsUpdated, - } - source, sourceUpdated := os.LookupEnv("TB_NAME_SOURCE") - data.Source = crudDataField[string]{ - Value: source, - Updated: sourceUpdated, - } - symbol, symbolUpdated := os.LookupEnv("TB_NAME_SYMBOL") - data.Symbol = crudDataField[string]{ - Value: symbol, - Updated: symbolUpdated, - } - decimals, decimalsUpdated := os.LookupEnv("TB_NAME_DECIMALS") - data.Decimals = crudDataField[string]{ - Value: decimals, - Updated: decimalsUpdated, - } - - if err = opts.validateCrudData(data); err != nil { - return nil, err - } - - return -} - -func (opts *NamesOptions) validateCrudData(data *CrudData) error { - if data.Address.Value.IsZero() { - // TODO: In the c++ this would pick up opts.Term[0] if it was present and use that - return errors.New("address is required") - } - if data.Name.Value == "" { - // TODO: In the c++ this would pick up opts.Term[0] if it was present and use that - return errors.New("address is required") - } - // TODO: I think a name is also required here (but not in AutoName mode in which case - // TODO: name is picked up from the contract) - - return nil -} - func (opts *NamesOptions) LoadCrudDataIfNeeded(request *http.Request) error { if opts.Delete || opts.Undelete || opts.Remove { - opts.crudData = &CrudData{ - Address: crudDataField[base.Address]{ + opts.crudData = &crud.NameCrud{ + Address: crud.Field[base.Address]{ Value: base.HexToAddress(opts.Terms[0]), }, } @@ -179,10 +65,6 @@ func (opts *NamesOptions) LoadCrudDataIfNeeded(request *http.Request) error { } var err error - if request == nil { - opts.crudData, err = opts.getCrudDataEnv() - } else { - opts.crudData, err = opts.getCrudDataHttp(request) - } + opts.crudData, err = crud.NewNameCrud(len(opts.Autoname) > 0, request) return err } diff --git a/src/apps/chifra/internal/names/handle_crud.go b/src/apps/chifra/internal/names/handle_crud.go index cd9c8816be..07a6783bae 100644 --- a/src/apps/chifra/internal/names/handle_crud.go +++ b/src/apps/chifra/internal/names/handle_crud.go @@ -3,6 +3,7 @@ package namesPkg import ( "strconv" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/crud" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/names" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" @@ -52,7 +53,7 @@ func (opts *NamesOptions) HandleCrud(rCtx *output.RenderCtx) (err error) { return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOptsWithExtra(extraOpts)) } -func handleCreate(chain string, data *CrudData) (name *types.Name, err error) { +func handleCreate(chain string, data *crud.NameCrud) (name *types.Name, err error) { var decimals uint64 if data.Decimals.Updated { decimals, err = strconv.ParseUint(data.Decimals.Value, 10, 64) @@ -74,14 +75,14 @@ func handleCreate(chain string, data *CrudData) (name *types.Name, err error) { return name, names.CreateName(names.DatabaseCustom, chain, name) } -func handleDelete(chain string, data *CrudData) (*types.Name, error) { +func handleDelete(chain string, data *crud.NameCrud) (*types.Name, error) { return names.SetDeleted(names.DatabaseCustom, chain, data.Address.Value, true) } -func handleUndelete(chain string, data *CrudData) (*types.Name, error) { +func handleUndelete(chain string, data *crud.NameCrud) (*types.Name, error) { return names.SetDeleted(names.DatabaseCustom, chain, data.Address.Value, false) } -func handleRemove(chain string, data *CrudData) (*types.Name, error) { +func handleRemove(chain string, data *crud.NameCrud) (*types.Name, error) { return names.RemoveName(names.DatabaseCustom, chain, data.Address.Value) } diff --git a/src/apps/chifra/internal/names/options.go b/src/apps/chifra/internal/names/options.go index 4ea2d14ab1..e6bdb70cff 100644 --- a/src/apps/chifra/internal/names/options.go +++ b/src/apps/chifra/internal/names/options.go @@ -19,6 +19,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/globals" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/caps" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/crud" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" @@ -49,7 +50,7 @@ type NamesOptions struct { Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server BadFlag error `json:"badFlag,omitempty"` // An error flag if needed // EXISTING_CODE - crudData *CrudData + crudData *crud.NameCrud AutonameAddr base.Address `json:"-"` OrigTerms []string `json:"-"` // EXISTING_CODE diff --git a/src/apps/chifra/internal/names/output_test.go b/src/apps/chifra/internal/names/output_test.go index 1f6165fd6e..8969b09e41 100644 --- a/src/apps/chifra/internal/names/output_test.go +++ b/src/apps/chifra/internal/names/output_test.go @@ -15,6 +15,7 @@ import ( "testing" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/crud" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" ) @@ -30,7 +31,7 @@ func TestNamesOptions_getCrudDataHttp(t *testing.T) { name string fields fields args args - wantData *CrudData + wantData *crud.NameCrud wantErr bool }{ { @@ -47,12 +48,12 @@ func TestNamesOptions_getCrudDataHttp(t *testing.T) { return })(), }, - wantData: &CrudData{ - Address: crudDataField[base.Address]{ + wantData: &crud.NameCrud{ + Address: crud.Field[base.Address]{ Value: base.HexToAddress("0x199d5ed7f45f4ee35960cf22eade2076e95b253f"), Updated: true, }, - Name: crudDataField[string]{ + Name: crud.Field[string]{ Value: "some name 1", Updated: true, }, @@ -98,7 +99,7 @@ func TestNamesOptions_getCrudDataHttp(t *testing.T) { } func TestNamesOptions_getCrudDataEnv(t *testing.T) { - setEnvs := func(data *CrudData) { + setEnvs := func(data *crud.NameCrud) { if data.Address.Value.Hex() != "" { os.Setenv("TB_NAME_ADDRESS", data.Address.Value.Hex()) } @@ -118,18 +119,18 @@ func TestNamesOptions_getCrudDataEnv(t *testing.T) { os.Setenv("TB_NAME_DECIMALS", data.Decimals.Value) } } - var expected *CrudData - var result *CrudData + var expected *crud.NameCrud + var result *crud.NameCrud var err error var opts *NamesOptions // valid envs - expected = &CrudData{ - Address: crudDataField[base.Address]{ + expected = &crud.NameCrud{ + Address: crud.Field[base.Address]{ Value: base.HexToAddress("0x199d5ed7f45f4ee35960cf22eade2076e95b253f"), Updated: true, }, - Name: crudDataField[string]{ + Name: crud.Field[string]{ Value: "some name", Updated: true, }, @@ -148,12 +149,12 @@ func TestNamesOptions_getCrudDataEnv(t *testing.T) { os.Clearenv() // invalid envs - expected = &CrudData{ - Address: crudDataField[base.Address]{ + expected = &crud.NameCrud{ + Address: crud.Field[base.Address]{ Value: base.ZeroAddr, Updated: true, }, - Name: crudDataField[string]{ + Name: crud.Field[string]{ Value: "some name", Updated: true, }, diff --git a/src/apps/chifra/pkg/crud/crud.go b/src/apps/chifra/pkg/crud/crud.go new file mode 100644 index 0000000000..051c3d8e23 --- /dev/null +++ b/src/apps/chifra/pkg/crud/crud.go @@ -0,0 +1,143 @@ +package crud + +import ( + "errors" + "net/http" + "os" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" +) + +type crudValue interface { + base.Address | string +} + +type Field[CV crudValue] struct { + Value CV + Updated bool +} + +type NameCrud struct { + Address Field[base.Address] + Name Field[string] + Tags Field[string] + Source Field[string] + Symbol Field[string] + Decimals Field[string] +} + +type NameOperation string + +const ( + Create NameOperation = "create" + Update NameOperation = "update" + Delete NameOperation = "delete" + Undelete NameOperation = "undelete" + Remove NameOperation = "remove" + Autoname NameOperation = "autoname" +) + +func (cd *NameCrud) Validate(requireName bool) error { + if cd.Address.Value.IsZero() { + return errors.New("address is required in crud.Validate") + } + if requireName && cd.Name.Value == "" { + return errors.New("address is required in crud.Validate") + } + return nil +} + +func NewNameCrud(requireName bool, r *http.Request) (*NameCrud, error) { + cd := &NameCrud{} + if r != nil { + if err := r.ParseForm(); err != nil { + return nil, err + } + + if len(r.PostForm) == 0 { + return nil, errors.New("empty form") + } + + cd = &NameCrud{ + Address: Field[base.Address]{ + Value: base.HexToAddress(r.PostForm.Get("address")), + Updated: r.PostForm.Has("address"), + }, + Name: Field[string]{ + Value: r.PostForm.Get("name"), + Updated: r.PostForm.Has("name"), + }, + Tags: Field[string]{ + Value: r.PostForm.Get("tags"), + Updated: r.PostForm.Has("tags"), + }, + Source: Field[string]{ + Value: r.PostForm.Get("source"), + Updated: r.PostForm.Has("source"), + }, + Symbol: Field[string]{ + Value: r.PostForm.Get("symbol"), + Updated: r.PostForm.Has("symbol"), + }, + Decimals: Field[string]{ + Value: r.PostForm.Get("decimals"), + Updated: r.PostForm.Has("decimals"), + }, + } + } else { + address, addressUpdated := os.LookupEnv("TB_NAME_ADDRESS") + cd.Address = Field[base.Address]{ + Value: base.HexToAddress(address), + Updated: addressUpdated, + } + name, nameUpdated := os.LookupEnv("TB_NAME_NAME") + cd.Name = Field[string]{ + Value: name, + Updated: nameUpdated, + } + tags, tagsUpdated := os.LookupEnv("TB_NAME_TAGS") + cd.Tags = Field[string]{ + Value: tags, + Updated: tagsUpdated, + } + source, sourceUpdated := os.LookupEnv("TB_NAME_SOURCE") + cd.Source = Field[string]{ + Value: source, + Updated: sourceUpdated, + } + symbol, symbolUpdated := os.LookupEnv("TB_NAME_SYMBOL") + cd.Symbol = Field[string]{ + Value: symbol, + Updated: symbolUpdated, + } + decimals, decimalsUpdated := os.LookupEnv("TB_NAME_DECIMALS") + cd.Decimals = Field[string]{ + Value: decimals, + Updated: decimalsUpdated, + } + } + + if err := cd.Validate(requireName); err != nil { + return nil, err + } + + return cd, nil +} + +func (cd *NameCrud) SetEnv() { + os.Setenv("TB_NAME_ADDRESS", cd.Address.Value.String()) + os.Setenv("TB_NAME_NAME", cd.Name.Value) + os.Setenv("TB_NAME_TAGS", cd.Tags.Value) + os.Setenv("TB_NAME_SOURCE", cd.Source.Value) + os.Setenv("TB_NAME_SYMBOL", cd.Symbol.Value) + os.Setenv("TB_NAME_DECIMALS", cd.Decimals.Value) +} + +func (cd *NameCrud) Unsetenv() { + os.Unsetenv("TB_NAME_ADDRESS") + os.Unsetenv("TB_NAME_NAME") + os.Unsetenv("TB_NAME_TAGS") + os.Unsetenv("TB_NAME_SOURCE") + os.Unsetenv("TB_NAME_SYMBOL") + os.Unsetenv("TB_NAME_DECIMALS") +} diff --git a/src/apps/chifra/pkg/crud/doc.go b/src/apps/chifra/pkg/crud/doc.go new file mode 100644 index 0000000000..9910880516 --- /dev/null +++ b/src/apps/chifra/pkg/crud/doc.go @@ -0,0 +1,2 @@ +// Package crud prodives tools to accept data from a server request or the environment. +package crud From ce16fddf4d3199c4ee797ece9c405e6c5c4f2538 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 21 Aug 2024 20:29:18 -0400 Subject: [PATCH 075/121] Fixes tests --- sdk/names.go | 11 ++++++----- src/apps/chifra/internal/names/output_test.go | 14 +++----------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/sdk/names.go b/sdk/names.go index 95e2e90812..4a606cacaa 100644 --- a/sdk/names.go +++ b/sdk/names.go @@ -117,16 +117,17 @@ func (opts *NamesOptions) ModifyName(op crud.NameOperation, cd *crud.NameCrud) ( cd.SetEnv() switch op { - case Create: - case Update: + case crud.Create: + case crud.Update: return opts.NamesUpdate() - case Delete: + case crud.Delete: return opts.NamesDelete() - case Undelete: + case crud.Undelete: return opts.NamesUndelete() - case Remove: + case crud.Remove: return opts.NamesRemove() } + return nil, nil, errors.New("invalid operation " + string(op)) } diff --git a/src/apps/chifra/internal/names/output_test.go b/src/apps/chifra/internal/names/output_test.go index 8969b09e41..7b775e4490 100644 --- a/src/apps/chifra/internal/names/output_test.go +++ b/src/apps/chifra/internal/names/output_test.go @@ -16,8 +16,6 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/crud" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils" ) func TestNamesOptions_getCrudDataHttp(t *testing.T) { @@ -86,7 +84,7 @@ func TestNamesOptions_getCrudDataHttp(t *testing.T) { opts := &NamesOptions{ Autoname: tt.fields.Autoname, } - gotData, err := opts.getCrudDataHttp(tt.args.r) + gotData, err := crud.NewNameCrud(len(opts.Autoname) > 0, tt.args.r) if (err != nil) != tt.wantErr { t.Errorf("NamesOptions.getCrudDataHttp() error = %v, wantErr %v", err, tt.wantErr) return @@ -122,7 +120,6 @@ func TestNamesOptions_getCrudDataEnv(t *testing.T) { var expected *crud.NameCrud var result *crud.NameCrud var err error - var opts *NamesOptions // valid envs expected = &crud.NameCrud{ @@ -136,10 +133,7 @@ func TestNamesOptions_getCrudDataEnv(t *testing.T) { }, } setEnvs(expected) - opts = &NamesOptions{} - chain := utils.GetTestChain() - opts.Conn = rpc.TempConnection(chain) - result, err = opts.getCrudDataEnv() + result, err = crud.NewNameCrud(true /* nameRequired */, nil /* request */) if err != nil { t.Fatal(err) } @@ -160,9 +154,7 @@ func TestNamesOptions_getCrudDataEnv(t *testing.T) { }, } setEnvs(expected) - opts = &NamesOptions{} - opts.Conn = rpc.TempConnection(chain) - _, err = opts.getCrudDataEnv() + _, err = crud.NewNameCrud(true /* nameRequired */, nil /* request */) if err == nil { t.Fatal("error expected") } From 46dd505c9f2023c3b25097ff0bff13c6d3ff1ab4 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 21 Aug 2024 20:58:08 -0400 Subject: [PATCH 076/121] Updates go.mods --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index 9802b505da..ece59cd1fb 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index 311e1826bc..ff677df14b 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index 9dc1609a7f..a9b13f2f10 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index 082a386841..d380e486f6 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index c926601b6d..1ae6fbd4dc 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index 082a386841..d380e486f6 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index baa59b97a4..6d87ddbde0 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index 082a386841..d380e486f6 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index 2ef9d65053..7beda96bb6 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index 082a386841..d380e486f6 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index ee87c4080d..9f6c9a667d 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index 6fa23d79de..1b3adfba50 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index 3516aa03f0..39d48fbf7c 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index 2eb5c7fda3..877967fcf5 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index aff7465396..4ad8377be4 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index d9a7b5d832..2c8c5e7e90 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index bcedd92934..606970b06e 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index 082a386841..d380e486f6 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index d59455338f..acdb56a905 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index 082a386841..d380e486f6 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333 h1:qMoghSerE+0CFFXW0X6j+AprqVjuKbMdn7Qkxlma+Ro= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240817132510-9417c54ac333/go.mod h1:2Kx0Si5r8BLc+Y8BestN/AotIyhzVWa+6dVubXhi2Nc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333 h1:IRL2qgB+aJEQyaGbyDUQgJHImvnu+rEzODlU2tlN//Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240817132510-9417c54ac333/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From 0fdd147f4fabe214c32f60b0210256b4d964d695 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 22 Aug 2024 09:51:23 -0400 Subject: [PATCH 077/121] Updates go.mod files --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index ece59cd1fb..d561825032 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index ff677df14b..6819947092 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index a9b13f2f10..9502b44e3f 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index d380e486f6..a4112d904d 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 1ae6fbd4dc..bb2cee2264 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index d380e486f6..a4112d904d 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index 6d87ddbde0..46fa3c52c1 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index d380e486f6..a4112d904d 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index 7beda96bb6..536571978e 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index d380e486f6..a4112d904d 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index 9f6c9a667d..2f4ddc0e62 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index 1b3adfba50..d181ac6ffc 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index 39d48fbf7c..b0f8fd9936 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index 877967fcf5..4c3403f1bb 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index 4ad8377be4..2a10fd5d89 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index 2c8c5e7e90..578ce5463d 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index 606970b06e..302a853a8f 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index d380e486f6..a4112d904d 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index acdb56a905..b341e621eb 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index d380e486f6..a4112d904d 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f h1:2L3Y75hwUFgCUfLSAardPrOwq0PmS+vUwzmAyHMh1IQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240821011737-818d01eef74f/go.mod h1:Z1iw/U7jQ1GGGf77Q7Qi1KbDfa/aIqC6gBmZkyrStMc= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f h1:VfSYoG21nlsgiehVw+l+Ho1ahhEBf+WXc+Kldl3p4lE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240821011737-818d01eef74f/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From d49b44842c6f9d2f89647c06d94b4ac72e223562 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 22 Aug 2024 09:55:55 -0400 Subject: [PATCH 078/121] Adds blockRange type --- docs | 2 +- sdk/typescript/src/types/rangebounds.ts | 18 +++++++ src/apps/chifra/internal/chunks/README.md | 1 + .../chifra/pkg/types/types_rangebounds.go | 52 +++++++++++++++++++ .../classDefinitions/fields/rangebounds.csv | 5 ++ .../classDefinitions/rangebounds.toml | 7 +++ 6 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 sdk/typescript/src/types/rangebounds.ts create mode 100644 src/apps/chifra/pkg/types/types_rangebounds.go create mode 100644 src/dev_tools/goMaker/templates/classDefinitions/fields/rangebounds.csv create mode 100644 src/dev_tools/goMaker/templates/classDefinitions/rangebounds.toml diff --git a/docs b/docs index 3bd3e27bdf..f9a9925054 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 3bd3e27bdf457108d4b8907a8c61ba40247e3af5 +Subproject commit f9a9925054d93c98cb9a6d8d63d02f12631fc86e diff --git a/sdk/typescript/src/types/rangebounds.ts b/sdk/typescript/src/types/rangebounds.ts new file mode 100644 index 0000000000..f1fea27666 --- /dev/null +++ b/sdk/typescript/src/types/rangebounds.ts @@ -0,0 +1,18 @@ +/* eslint object-curly-newline: ["error", "never"] */ +/* eslint max-len: ["error", 160] */ +/* + * Copyright 2016, 2024 The TrueBlocks Authors. All rights reserved. + * Use of this source code is governed by a license that can + * be found in the LICENSE file. + * + * This file was auto generated. DO NOT EDIT. + */ + +import { datetime, timestamp } from '.'; + +export type RangeBounds = { + firstDate?: datetime + firstTs: timestamp + lastDate?: datetime + lastTs: timestamp +} diff --git a/src/apps/chifra/internal/chunks/README.md b/src/apps/chifra/internal/chunks/README.md index 5673776161..410c843c81 100644 --- a/src/apps/chifra/internal/chunks/README.md +++ b/src/apps/chifra/internal/chunks/README.md @@ -62,6 +62,7 @@ Data models produced by this tool: - [ipfspin](/data-model/admin/#ipfspin) - [manifest](/data-model/admin/#manifest) - [message](/data-model/other/#message) +- [rangebounds](/data-model/admin/#rangebounds) - [reportcheck](/data-model/admin/#reportcheck) ### Other Options diff --git a/src/apps/chifra/pkg/types/types_rangebounds.go b/src/apps/chifra/pkg/types/types_rangebounds.go new file mode 100644 index 0000000000..590d396dac --- /dev/null +++ b/src/apps/chifra/pkg/types/types_rangebounds.go @@ -0,0 +1,52 @@ +// Copyright 2016, 2024 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. +/* + * Parts of this file were auto generated. Edit only those parts of + * the code inside of 'EXISTING_CODE' tags. + */ + +package types + +// EXISTING_CODE +import ( + "encoding/json" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" +) + +// EXISTING_CODE + +type RangeBounds struct { + FirstTs base.Timestamp `json:"firstTs"` + LastTs base.Timestamp `json:"lastTs"` + // EXISTING_CODE + // EXISTING_CODE +} + +func (s RangeBounds) String() string { + bytes, _ := json.Marshal(s) + return string(bytes) +} + +func (s *RangeBounds) Model(chain, format string, verbose bool, extraOpts map[string]any) Model { + var model = map[string]any{} + var order = []string{} + + // EXISTING_CODE + // EXISTING_CODE + + return Model{ + Data: model, + Order: order, + } +} + +// FinishUnmarshal is used by the cache. It may be unused depending on auto-code-gen +func (s *RangeBounds) FinishUnmarshal() { + // EXISTING_CODE + // EXISTING_CODE +} + +// EXISTING_CODE +// EXISTING_CODE diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/rangebounds.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/rangebounds.csv new file mode 100644 index 0000000000..d470e73188 --- /dev/null +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/rangebounds.csv @@ -0,0 +1,5 @@ +name ,type ,strDefault ,attributes ,docOrder ,description +firstTs ,timestamp , ,omitempty , 1 ,the timestamp of the first block in this range +firstDate ,datetime , ,omitempty|calc , 2 ,the first timestamp as a date +lastTs ,timestamp , ,omitempty , 3 ,the timestamp of the most recent block in this range +lastDate ,datetime , ,omitempty|calc , 4 ,the last timestamp as a date diff --git a/src/dev_tools/goMaker/templates/classDefinitions/rangebounds.toml b/src/dev_tools/goMaker/templates/classDefinitions/rangebounds.toml new file mode 100644 index 0000000000..0fd6f30c8d --- /dev/null +++ b/src/dev_tools/goMaker/templates/classDefinitions/rangebounds.toml @@ -0,0 +1,7 @@ +[settings] + class = "RangeBounds" + doc_group = "04-Admin" + doc_descr = "shows first and last timestamps and dates for a given block range" + doc_route = "442-rangeBounds" + attributes = "" + produced_by = "chunks" From 95eef8a37eea4b9dd856956e1360bea444defd81 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 22 Aug 2024 10:02:58 -0400 Subject: [PATCH 079/121] Adds blockRange type --- docs | 2 +- sdk/typescript/src/types/rangebounds.ts | 4 ++-- src/apps/chifra/pkg/types/types_rangebounds.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs b/docs index f9a9925054..ca5f872969 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f9a9925054d93c98cb9a6d8d63d02f12631fc86e +Subproject commit ca5f8729695211e2f092c8833e54f4d41cb5377e diff --git a/sdk/typescript/src/types/rangebounds.ts b/sdk/typescript/src/types/rangebounds.ts index f1fea27666..3c7981f01b 100644 --- a/sdk/typescript/src/types/rangebounds.ts +++ b/sdk/typescript/src/types/rangebounds.ts @@ -12,7 +12,7 @@ import { datetime, timestamp } from '.'; export type RangeBounds = { firstDate?: datetime - firstTs: timestamp + firstTs?: timestamp lastDate?: datetime - lastTs: timestamp + lastTs?: timestamp } diff --git a/src/apps/chifra/pkg/types/types_rangebounds.go b/src/apps/chifra/pkg/types/types_rangebounds.go index 590d396dac..f5f0c04ffa 100644 --- a/src/apps/chifra/pkg/types/types_rangebounds.go +++ b/src/apps/chifra/pkg/types/types_rangebounds.go @@ -18,8 +18,8 @@ import ( // EXISTING_CODE type RangeBounds struct { - FirstTs base.Timestamp `json:"firstTs"` - LastTs base.Timestamp `json:"lastTs"` + FirstTs base.Timestamp `json:"firstTs,omitempty"` + LastTs base.Timestamp `json:"lastTs,omitempty"` // EXISTING_CODE // EXISTING_CODE } From a32cea794623d87d1d2f744f885c44a1156f4d2e Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 22 Aug 2024 10:24:41 -0400 Subject: [PATCH 080/121] Change rangeBounds to rangeDates --- docs | 2 +- .../src/types/{rangebounds.ts => rangedates.ts} | 2 +- src/apps/chifra/internal/chunks/README.md | 2 +- .../{types_rangebounds.go => types_rangedates.go} | 14 ++++++++------ .../classDefinitions/fields/rangebounds.csv | 5 ----- .../classDefinitions/fields/rangedates.csv | 5 +++++ .../{rangebounds.toml => rangedates.toml} | 4 ++-- 7 files changed, 18 insertions(+), 16 deletions(-) rename sdk/typescript/src/types/{rangebounds.ts => rangedates.ts} (94%) rename src/apps/chifra/pkg/types/{types_rangebounds.go => types_rangedates.go} (66%) delete mode 100644 src/dev_tools/goMaker/templates/classDefinitions/fields/rangebounds.csv create mode 100644 src/dev_tools/goMaker/templates/classDefinitions/fields/rangedates.csv rename src/dev_tools/goMaker/templates/classDefinitions/{rangebounds.toml => rangedates.toml} (73%) diff --git a/docs b/docs index ca5f872969..a2d4826b52 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ca5f8729695211e2f092c8833e54f4d41cb5377e +Subproject commit a2d4826b520025b0528a572308edc97addbf48d9 diff --git a/sdk/typescript/src/types/rangebounds.ts b/sdk/typescript/src/types/rangedates.ts similarity index 94% rename from sdk/typescript/src/types/rangebounds.ts rename to sdk/typescript/src/types/rangedates.ts index 3c7981f01b..0f46f7f1f8 100644 --- a/sdk/typescript/src/types/rangebounds.ts +++ b/sdk/typescript/src/types/rangedates.ts @@ -10,7 +10,7 @@ import { datetime, timestamp } from '.'; -export type RangeBounds = { +export type RangeDates = { firstDate?: datetime firstTs?: timestamp lastDate?: datetime diff --git a/src/apps/chifra/internal/chunks/README.md b/src/apps/chifra/internal/chunks/README.md index 410c843c81..87a0f9b765 100644 --- a/src/apps/chifra/internal/chunks/README.md +++ b/src/apps/chifra/internal/chunks/README.md @@ -62,7 +62,7 @@ Data models produced by this tool: - [ipfspin](/data-model/admin/#ipfspin) - [manifest](/data-model/admin/#manifest) - [message](/data-model/other/#message) -- [rangebounds](/data-model/admin/#rangebounds) +- [rangedates](/data-model/admin/#rangedates) - [reportcheck](/data-model/admin/#reportcheck) ### Other Options diff --git a/src/apps/chifra/pkg/types/types_rangebounds.go b/src/apps/chifra/pkg/types/types_rangedates.go similarity index 66% rename from src/apps/chifra/pkg/types/types_rangebounds.go rename to src/apps/chifra/pkg/types/types_rangedates.go index f5f0c04ffa..abecb1a092 100644 --- a/src/apps/chifra/pkg/types/types_rangebounds.go +++ b/src/apps/chifra/pkg/types/types_rangedates.go @@ -17,19 +17,21 @@ import ( // EXISTING_CODE -type RangeBounds struct { - FirstTs base.Timestamp `json:"firstTs,omitempty"` - LastTs base.Timestamp `json:"lastTs,omitempty"` +type RangeDates struct { + FirstDate string `json:"firstDate,omitempty"` + FirstTs base.Timestamp `json:"firstTs,omitempty"` + LastDate string `json:"lastDate,omitempty"` + LastTs base.Timestamp `json:"lastTs,omitempty"` // EXISTING_CODE // EXISTING_CODE } -func (s RangeBounds) String() string { +func (s RangeDates) String() string { bytes, _ := json.Marshal(s) return string(bytes) } -func (s *RangeBounds) Model(chain, format string, verbose bool, extraOpts map[string]any) Model { +func (s *RangeDates) Model(chain, format string, verbose bool, extraOpts map[string]any) Model { var model = map[string]any{} var order = []string{} @@ -43,7 +45,7 @@ func (s *RangeBounds) Model(chain, format string, verbose bool, extraOpts map[st } // FinishUnmarshal is used by the cache. It may be unused depending on auto-code-gen -func (s *RangeBounds) FinishUnmarshal() { +func (s *RangeDates) FinishUnmarshal() { // EXISTING_CODE // EXISTING_CODE } diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/rangebounds.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/rangebounds.csv deleted file mode 100644 index d470e73188..0000000000 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/rangebounds.csv +++ /dev/null @@ -1,5 +0,0 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -firstTs ,timestamp , ,omitempty , 1 ,the timestamp of the first block in this range -firstDate ,datetime , ,omitempty|calc , 2 ,the first timestamp as a date -lastTs ,timestamp , ,omitempty , 3 ,the timestamp of the most recent block in this range -lastDate ,datetime , ,omitempty|calc , 4 ,the last timestamp as a date diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/rangedates.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/rangedates.csv new file mode 100644 index 0000000000..f11d135a19 --- /dev/null +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/rangedates.csv @@ -0,0 +1,5 @@ +name ,type ,strDefault ,attributes ,docOrder ,description +firstTs ,timestamp , ,omitempty , 1 ,the timestamp of the first block in this range +firstDate ,datetime , ,omitempty , 2 ,the first timestamp as a date +lastTs ,timestamp , ,omitempty , 3 ,the timestamp of the most recent block in this range +lastDate ,datetime , ,omitempty , 4 ,the last timestamp as a date diff --git a/src/dev_tools/goMaker/templates/classDefinitions/rangebounds.toml b/src/dev_tools/goMaker/templates/classDefinitions/rangedates.toml similarity index 73% rename from src/dev_tools/goMaker/templates/classDefinitions/rangebounds.toml rename to src/dev_tools/goMaker/templates/classDefinitions/rangedates.toml index 0fd6f30c8d..84551caf9f 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/rangebounds.toml +++ b/src/dev_tools/goMaker/templates/classDefinitions/rangedates.toml @@ -1,7 +1,7 @@ [settings] - class = "RangeBounds" + class = "RangeDates" doc_group = "04-Admin" doc_descr = "shows first and last timestamps and dates for a given block range" - doc_route = "442-rangeBounds" + doc_route = "442-rangeDates" attributes = "" produced_by = "chunks" From 91ba4e43e4c3d0736c65a6103cd30268669d3b07 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 22 Aug 2024 14:46:24 -0400 Subject: [PATCH 081/121] Removes rangeEnd from chunkStats in prep for adding rangeDates --- docs | 2 +- sdk/typescript/src/types/chunkAddress.ts | 3 ++- sdk/typescript/src/types/chunkBloom.ts | 3 ++- sdk/typescript/src/types/chunkIndex.ts | 3 ++- sdk/typescript/src/types/chunkRecord.ts | 3 ++- sdk/typescript/src/types/chunkStats.ts | 4 ++-- sdk/typescript/src/types/index.ts | 1 + .../chifra/internal/chunks/handle_address.go | 4 +++- .../chifra/internal/chunks/handle_blooms.go | 7 +++++- .../chifra/internal/chunks/handle_index.go | 1 + .../chifra/internal/chunks/handle_manifest.go | 13 +++++++---- src/apps/chifra/internal/chunks/options.go | 21 ++++++++--------- src/apps/chifra/pkg/base/fileRange.go | 4 ++-- src/apps/chifra/pkg/tslib/range.go | 18 +++++++++++++++ src/apps/chifra/pkg/types/types_chunkstats.go | 3 --- .../classDefinitions/fields/chunkstats.csv | 23 +++++++++---------- src/dev_tools/testRunner/testCases/chunks.csv | 20 ++++++++-------- tests | 2 +- 18 files changed, 83 insertions(+), 52 deletions(-) create mode 100644 src/apps/chifra/pkg/tslib/range.go diff --git a/docs b/docs index a2d4826b52..d9c8b80db2 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit a2d4826b520025b0528a572308edc97addbf48d9 +Subproject commit d9c8b80db23aab019219a98afac12dead32b0926 diff --git a/sdk/typescript/src/types/chunkAddress.ts b/sdk/typescript/src/types/chunkAddress.ts index dbaa0dca7b..d069e7d63b 100644 --- a/sdk/typescript/src/types/chunkAddress.ts +++ b/sdk/typescript/src/types/chunkAddress.ts @@ -8,10 +8,11 @@ * This file was auto generated. DO NOT EDIT. */ -import { address, blkrange, uint64 } from '.'; +import { address, blkrange, rangeDates, uint64 } from '.'; export type ChunkAddress = { address: address + rangeDates: rangeDates count: uint64 offset: uint64 range: blkrange diff --git a/sdk/typescript/src/types/chunkBloom.ts b/sdk/typescript/src/types/chunkBloom.ts index e6338c2ccf..634a39e93f 100644 --- a/sdk/typescript/src/types/chunkBloom.ts +++ b/sdk/typescript/src/types/chunkBloom.ts @@ -8,9 +8,10 @@ * This file was auto generated. DO NOT EDIT. */ -import { blkrange, hash, uint64 } from '.'; +import { blkrange, rangeDates, hash, uint64 } from '.'; export type ChunkBloom = { + rangeDates: rangeDates byteWidth: uint64 hash: hash magic: string diff --git a/sdk/typescript/src/types/chunkIndex.ts b/sdk/typescript/src/types/chunkIndex.ts index 1c080fadb3..5835a7f801 100644 --- a/sdk/typescript/src/types/chunkIndex.ts +++ b/sdk/typescript/src/types/chunkIndex.ts @@ -8,9 +8,10 @@ * This file was auto generated. DO NOT EDIT. */ -import { blkrange, hash, uint64 } from '.'; +import { blkrange, rangeDates, hash, uint64 } from '.'; export type ChunkIndex = { + rangeDates: rangeDates hash: hash magic: string nAddresses: uint64 diff --git a/sdk/typescript/src/types/chunkRecord.ts b/sdk/typescript/src/types/chunkRecord.ts index 8bd67c909d..f2e745bff0 100644 --- a/sdk/typescript/src/types/chunkRecord.ts +++ b/sdk/typescript/src/types/chunkRecord.ts @@ -8,11 +8,12 @@ * This file was auto generated. DO NOT EDIT. */ -import { blkrange, int64, ipfshash } from '.'; +import { blkrange, rangeDates, int64, ipfshash } from '.'; export type ChunkRecord = { bloomHash: ipfshash bloomSize: int64 + rangeDates: rangeDates indexHash: ipfshash indexSize: int64 range: blkrange diff --git a/sdk/typescript/src/types/chunkStats.ts b/sdk/typescript/src/types/chunkStats.ts index d524d6c415..362edfbc65 100644 --- a/sdk/typescript/src/types/chunkStats.ts +++ b/sdk/typescript/src/types/chunkStats.ts @@ -8,20 +8,20 @@ * This file was auto generated. DO NOT EDIT. */ -import { blkrange, datetime, float64, uint64 } from '.'; +import { blkrange, rangeDates, float64, uint64 } from '.'; export type ChunkStats = { addrsPerBlock: float64 appsPerAddr: float64 appsPerBlock: float64 bloomSz: uint64 + rangeDates: rangeDates chunkSz: uint64 nAddrs: uint64 nApps: uint64 nBlocks: uint64 nBlooms: uint64 range: blkrange - rangeEnd: datetime ratio: float64 recWid: uint64 } diff --git a/sdk/typescript/src/types/index.ts b/sdk/typescript/src/types/index.ts index 263bf49625..4a9e091a22 100644 --- a/sdk/typescript/src/types/index.ts +++ b/sdk/typescript/src/types/index.ts @@ -24,6 +24,7 @@ export * from './monitorClean'; export * from './name'; export * from './namedBlock'; export * from './parameter'; +export * from "./rangedates"; export * from './receipt'; export * from './reportCheck'; export * from './result'; diff --git a/src/apps/chifra/internal/chunks/handle_address.go b/src/apps/chifra/internal/chunks/handle_address.go index 6c821c1c31..a6c3c492ef 100644 --- a/src/apps/chifra/internal/chunks/handle_address.go +++ b/src/apps/chifra/internal/chunks/handle_address.go @@ -73,12 +73,14 @@ func (opts *ChunksOptions) HandleAddresses(rCtx *output.RenderCtx, blockNums []b return false, err } + rng := indexChunk.Range s := types.ChunkAddress{ Address: obj.Address, - Range: indexChunk.Range.String(), + Range: rng.String(), Offset: uint64(obj.Offset), Count: uint64(obj.Count), } + // s.Bounds = tslib.RangeToBounds(chain, &rng) modelChan <- &s cnt++ diff --git a/src/apps/chifra/internal/chunks/handle_blooms.go b/src/apps/chifra/internal/chunks/handle_blooms.go index c6b7131b4a..ea28c0bd8b 100644 --- a/src/apps/chifra/internal/chunks/handle_blooms.go +++ b/src/apps/chifra/internal/chunks/handle_blooms.go @@ -40,15 +40,20 @@ func (opts *ChunksOptions) HandleBlooms(rCtx *output.RenderCtx, blockNums []base return false, err } + rng, err := base.RangeFromFilenameE(path) + if err != nil { + return false, err + } s := types.ChunkBloom{ Magic: fmt.Sprintf("0x%x", bl.Header.Magic), Hash: bl.Header.Hash, Size: stats.BloomSz, - Range: base.RangeFromFilename(path).String(), + Range: rng.String(), NBlooms: stats.NBlooms, ByteWidth: index.BLOOM_WIDTH_IN_BYTES, NInserted: uint64(nInserted), } + // s.Bounds = tslib.RangeToBounds(chain, &rng) modelChan <- &s return true, nil diff --git a/src/apps/chifra/internal/chunks/handle_index.go b/src/apps/chifra/internal/chunks/handle_index.go index 9098723b71..bcfe2748f3 100644 --- a/src/apps/chifra/internal/chunks/handle_index.go +++ b/src/apps/chifra/internal/chunks/handle_index.go @@ -52,6 +52,7 @@ func (opts *ChunksOptions) HandleIndex(rCtx *output.RenderCtx, blockNums []base. NAppearances: uint64(indexChunk.Header.AppearanceCount), Size: uint64(file.FileSize(fileName)), } + // s.Bounds = tslib.RangeToBounds(chain, &rng) modelChan <- &s return true, nil diff --git a/src/apps/chifra/internal/chunks/handle_manifest.go b/src/apps/chifra/internal/chunks/handle_manifest.go index 1ce1c4929e..6d90fc7c8f 100644 --- a/src/apps/chifra/internal/chunks/handle_manifest.go +++ b/src/apps/chifra/internal/chunks/handle_manifest.go @@ -33,13 +33,15 @@ func (opts *ChunksOptions) HandleManifest(rCtx *output.RenderCtx, blockNums []ba if opts.Globals.Format == "txt" || opts.Globals.Format == "csv" { fetchData := func(modelChan chan types.Modeler, errorChan chan error) { for _, chunk := range man.Chunks { + rng := base.RangeFromRangeString(chunk.Range) s := types.ChunkRecord{ - Range: chunk.Range, + Range: rng.String(), BloomHash: chunk.BloomHash, BloomSize: chunk.BloomSize, IndexHash: chunk.IndexHash, IndexSize: chunk.IndexSize, } + // s.Bounds = tslib.RangeToBounds(chain, &rng) modelChan <- &s } } @@ -54,13 +56,16 @@ func (opts *ChunksOptions) HandleManifest(rCtx *output.RenderCtx, blockNums []ba Specification: man.Specification, } for _, chunk := range man.Chunks { - s.Chunks = append(s.Chunks, types.ChunkRecord{ - Range: chunk.Range, + rng := base.RangeFromRangeString(chunk.Range) + ch := types.ChunkRecord{ + Range: rng.String(), BloomHash: chunk.BloomHash, BloomSize: chunk.BloomSize, IndexHash: chunk.IndexHash, IndexSize: chunk.IndexSize, - }) + } + // ch.Bounds = tslib.RangeToBounds(chain, &rng) + s.Chunks = append(s.Chunks, ch) } modelChan <- &s } diff --git a/src/apps/chifra/internal/chunks/options.go b/src/apps/chifra/internal/chunks/options.go index 42f6e53d7f..7276ff1b52 100644 --- a/src/apps/chifra/internal/chunks/options.go +++ b/src/apps/chifra/internal/chunks/options.go @@ -26,7 +26,6 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/index" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/tslib" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" @@ -301,18 +300,18 @@ func GetChunkStats(chain, path string) (s types.ChunkStats, err error) { } defer chunk.Close() - ts, _ := tslib.FromBnToTs(chain, chunk.Range.Last) + rng := chunk.Range s = types.ChunkStats{ - Range: chunk.Range.String(), - RangeEnd: base.FormattedDate(ts), - NBlocks: uint64(chunk.Range.Last - chunk.Range.First + 1), - NAddrs: uint64(chunk.Index.Header.AddressCount), - NApps: uint64(chunk.Index.Header.AppearanceCount), - NBlooms: uint64(chunk.Bloom.Count), - BloomSz: uint64(file.FileSize(index.ToBloomPath(path))), - ChunkSz: uint64(file.FileSize(index.ToIndexPath(path))), - RecWid: 4 + index.BLOOM_WIDTH_IN_BYTES, + Range: rng.String(), + NBlocks: uint64(chunk.Range.Last - chunk.Range.First + 1), + NAddrs: uint64(chunk.Index.Header.AddressCount), + NApps: uint64(chunk.Index.Header.AppearanceCount), + NBlooms: uint64(chunk.Bloom.Count), + BloomSz: uint64(file.FileSize(index.ToBloomPath(path))), + ChunkSz: uint64(file.FileSize(index.ToIndexPath(path))), + RecWid: 4 + index.BLOOM_WIDTH_IN_BYTES, } + // s.Bounds = tslib.RangeToBounds(chain, &rng) if s.NBlocks > 0 { s.AddrsPerBlock = float64(s.NAddrs) / float64(s.NBlocks) diff --git a/src/apps/chifra/pkg/base/fileRange.go b/src/apps/chifra/pkg/base/fileRange.go index 93b87994e5..617d068fa4 100644 --- a/src/apps/chifra/pkg/base/fileRange.go +++ b/src/apps/chifra/pkg/base/fileRange.go @@ -67,7 +67,7 @@ func RangeFromFilenameE(path string) (blkRange FileRange, err error) { // RangeFromRangeString returns a file range from a string func RangeFromRangeString(rngStr string) FileRange { - return RangeFromFilename(filepath.Join(config.PathToIndex("mainnet"), "finalized", rngStr + ".bin")) // okay to use mainnet since we're only interested in range + return RangeFromFilename(filepath.Join(config.PathToIndex("mainnet"), "finalized", rngStr+".bin")) // okay to use mainnet since we're only interested in range } func (r FileRange) String() string { @@ -76,7 +76,7 @@ func (r FileRange) String() string { // RangeToFilename returns a fileName and existence bool given a file range and a type func (r *FileRange) RangeToFilename(chain string) string { - return filepath.Join(config.PathToIndex(chain), "finalized", r.String() + ".bin") + return filepath.Join(config.PathToIndex(chain), "finalized", r.String()+".bin") } // Follows returns true if the range is strictly after the needle range. diff --git a/src/apps/chifra/pkg/tslib/range.go b/src/apps/chifra/pkg/tslib/range.go new file mode 100644 index 0000000000..52a9b39c7b --- /dev/null +++ b/src/apps/chifra/pkg/tslib/range.go @@ -0,0 +1,18 @@ +package tslib + +import ( + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" +) + +func RangeToBounds(chain string, rng *base.FileRange) types.RangeDates { + firstTs, _ := FromBnToTs(chain, base.Value(rng.First)) + lastTs, _ := FromBnToTs(chain, base.Value(rng.Last)) + ret := types.RangeDates{ + FirstTs: firstTs, + FirstDate: base.FormattedDate(firstTs), + LastTs: lastTs, + LastDate: base.FormattedDate(lastTs), + } + return ret +} diff --git a/src/apps/chifra/pkg/types/types_chunkstats.go b/src/apps/chifra/pkg/types/types_chunkstats.go index ae387f4366..3f90f77ec9 100644 --- a/src/apps/chifra/pkg/types/types_chunkstats.go +++ b/src/apps/chifra/pkg/types/types_chunkstats.go @@ -24,7 +24,6 @@ type ChunkStats struct { NBlocks uint64 `json:"nBlocks"` NBlooms uint64 `json:"nBlooms"` Range string `json:"range"` - RangeEnd string `json:"rangeEnd"` Ratio float64 `json:"ratio"` RecWid uint64 `json:"recWid"` // EXISTING_CODE @@ -54,11 +53,9 @@ func (s *ChunkStats) Model(chain, format string, verbose bool, extraOpts map[str "nBlooms": s.NBlooms, "ratio": s.Ratio, "recWid": s.RecWid, - "rangeEnd": s.RangeEnd, } order = []string{ "range", - "rangeEnd", "nAddrs", "nApps", "nBlocks", diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv index b126c3b8f6..3128a4cfd9 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv @@ -1,14 +1,13 @@ name ,type ,strDefault ,attributes ,docOrder ,description range ,blkrange , , , 1 ,the block range (inclusive) covered by this chunk -rangeEnd ,datetime , , , 2 ,the date of the last block in this range -nAddrs ,uint64 , , , 3 ,the number of addresses in the chunk -nApps ,uint64 , , , 4 ,the number of appearances in the chunk -nBlocks ,uint64 , , , 5 ,the number of blocks in the chunk -nBlooms ,uint64 , , , 6 ,the number of bloom filters in the chunk's bloom -recWid ,uint64 , , , 7 ,the record width of a single bloom filter -bloomSz ,uint64 , , , 8 ,the size of the bloom filters on disc in bytes -chunkSz ,uint64 , , , 9 ,the size of the chunks on disc in bytes -addrsPerBlock ,float64 , , , 10 ,the average number of addresses per block -appsPerBlock ,float64 , , , 11 ,the average number of appearances per block -appsPerAddr ,float64 , , , 12 ,the average number of appearances per address -ratio ,float64 , , , 13 ,the ratio of appearances to addresses +nAddrs ,uint64 , , , 2 ,the number of addresses in the chunk +nApps ,uint64 , , , 3 ,the number of appearances in the chunk +nBlocks ,uint64 , , , 4 ,the number of blocks in the chunk +nBlooms ,uint64 , , , 5 ,the number of bloom filters in the chunk's bloom +recWid ,uint64 , , , 6 ,the record width of a single bloom filter +bloomSz ,uint64 , , , 7 ,the size of the bloom filters on disc in bytes +chunkSz ,uint64 , , , 8 ,the size of the chunks on disc in bytes +addrsPerBlock ,float64 , , , 9 ,the average number of addresses per block +appsPerBlock ,float64 , , , 10 ,the average number of appearances per block +appsPerAddr ,float64 , , , 11 ,the average number of appearances per address +ratio ,float64 , , , 12 ,the ratio of appearances to addresses diff --git a/src/dev_tools/testRunner/testCases/chunks.csv b/src/dev_tools/testRunner/testCases/chunks.csv index e06814a4b7..00a03bc1ca 100644 --- a/src/dev_tools/testRunner/testCases/chunks.csv +++ b/src/dev_tools/testRunner/testCases/chunks.csv @@ -12,13 +12,13 @@ on ,both ,fast ,chunks ,apps ,chunkMan ,fail_detail_belong ,y ,mod on ,both ,fast ,chunks ,apps ,chunkMan ,list_check ,y ,mode = monitors & check -index ,both ,fast ,chunks ,apps ,chunkMan ,stats_default ,y ,mode = stats -index ,both ,fast ,chunks ,apps ,chunkMan ,manifest_default ,y ,mode = manifest -index ,both ,fast ,chunks ,apps ,chunkMan ,index_default ,y ,mode = index -index ,both ,fast ,chunks ,apps ,chunkMan ,blooms_default ,y ,mode = blooms +on ,both ,fast ,chunks ,apps ,chunkMan ,stats_default ,y ,mode = stats +on ,both ,fast ,chunks ,apps ,chunkMan ,manifest_default ,y ,mode = manifest +on ,both ,fast ,chunks ,apps ,chunkMan ,index_default ,y ,mode = index +on ,both ,fast ,chunks ,apps ,chunkMan ,blooms_default ,y ,mode = blooms on ,both ,fast ,chunks ,apps ,chunkMan ,header_default ,y ,mode = header on ,both ,fast ,chunks ,apps ,chunkMan ,pins_default ,y ,mode = pins -index ,both ,fast ,chunks ,apps ,chunkMan ,addresses_default ,y ,mode = addresses +on ,both ,fast ,chunks ,apps ,chunkMan ,addresses_default ,y ,mode = addresses on ,both ,fast ,chunks ,apps ,chunkMan ,appearances_default ,y ,mode = appearances on ,both ,fast ,chunks ,apps ,chunkMan ,not_pins_list ,y ,mode = index & list @@ -26,12 +26,12 @@ on ,both ,fast ,chunks ,apps ,chunkMan ,pins_list ,y ,mod on ,both ,fast ,chunks ,apps ,chunkMan ,not_pins_unpin ,y ,mode = index & unpin = 12 on ,both ,fast ,chunks ,apps ,chunkMan ,pins_bad_hash ,y ,mode = pins & unpin = 12 -index ,both ,fast ,chunks ,apps ,chunkMan ,stats_txt ,n ,mode = stats & fmt = txt -index ,both ,fast ,chunks ,apps ,chunkMan ,manifest_csv ,n ,mode = manifest & fmt = csv -index ,both ,fast ,chunks ,apps ,chunkMan ,index_json ,y ,mode = index & fmt = json -index ,both ,fast ,chunks ,apps ,chunkMan ,blooms_txt ,n ,mode = blooms & fmt = txt +on ,both ,fast ,chunks ,apps ,chunkMan ,stats_txt ,n ,mode = stats & fmt = txt +on ,both ,fast ,chunks ,apps ,chunkMan ,manifest_csv ,n ,mode = manifest & fmt = csv +on ,both ,fast ,chunks ,apps ,chunkMan ,index_json ,y ,mode = index & fmt = json +on ,both ,fast ,chunks ,apps ,chunkMan ,blooms_txt ,n ,mode = blooms & fmt = txt on ,both ,fast ,chunks ,apps ,chunkMan ,header_csv ,n ,mode = header & fmt = csv -index ,both ,fast ,chunks ,apps ,chunkMan ,addresses_json ,y ,mode = addresses & fmt = json +on ,both ,fast ,chunks ,apps ,chunkMan ,addresses_json ,y ,mode = addresses & fmt = json on ,both ,fast ,chunks ,apps ,chunkMan ,appearances_txt ,n ,mode = appearances & fmt = txt on ,both ,fast ,chunks ,apps ,chunkMan ,manifest_count ,y ,mode = manifest & count diff --git a/tests b/tests index a8bdd996bd..5b9cf0f871 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit a8bdd996bd133a886b569c6fec996036f4c17c29 +Subproject commit 5b9cf0f871823648b7343fa8b142051cddd18e07 From 76f03689da676474b4ce54d38b5e8dc8b104a48c Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 22 Aug 2024 16:12:15 -0400 Subject: [PATCH 082/121] Chunks now include dates --- sdk/typescript/src/types/chunkAddress.ts | 4 ++-- sdk/typescript/src/types/chunkBloom.ts | 4 ++-- sdk/typescript/src/types/chunkIndex.ts | 4 ++-- sdk/typescript/src/types/chunkRecord.ts | 4 ++-- sdk/typescript/src/types/chunkStats.ts | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sdk/typescript/src/types/chunkAddress.ts b/sdk/typescript/src/types/chunkAddress.ts index d069e7d63b..7e676560e9 100644 --- a/sdk/typescript/src/types/chunkAddress.ts +++ b/sdk/typescript/src/types/chunkAddress.ts @@ -8,12 +8,12 @@ * This file was auto generated. DO NOT EDIT. */ -import { address, blkrange, rangeDates, uint64 } from '.'; +import { address, blkrange, RangeDates, uint64 } from '.'; export type ChunkAddress = { address: address - rangeDates: rangeDates count: uint64 offset: uint64 range: blkrange + rangeDates: RangeDates } diff --git a/sdk/typescript/src/types/chunkBloom.ts b/sdk/typescript/src/types/chunkBloom.ts index 634a39e93f..f6e981f200 100644 --- a/sdk/typescript/src/types/chunkBloom.ts +++ b/sdk/typescript/src/types/chunkBloom.ts @@ -8,15 +8,15 @@ * This file was auto generated. DO NOT EDIT. */ -import { blkrange, rangeDates, hash, uint64 } from '.'; +import { blkrange, hash, RangeDates, uint64 } from '.'; export type ChunkBloom = { - rangeDates: rangeDates byteWidth: uint64 hash: hash magic: string nBlooms: uint64 nInserted: uint64 range: blkrange + rangeDates: RangeDates size: uint64 } diff --git a/sdk/typescript/src/types/chunkIndex.ts b/sdk/typescript/src/types/chunkIndex.ts index 5835a7f801..a825621bd6 100644 --- a/sdk/typescript/src/types/chunkIndex.ts +++ b/sdk/typescript/src/types/chunkIndex.ts @@ -8,14 +8,14 @@ * This file was auto generated. DO NOT EDIT. */ -import { blkrange, rangeDates, hash, uint64 } from '.'; +import { blkrange, hash, RangeDates, uint64 } from '.'; export type ChunkIndex = { - rangeDates: rangeDates hash: hash magic: string nAddresses: uint64 nAppearances: uint64 range: blkrange + rangeDates: RangeDates size: uint64 } diff --git a/sdk/typescript/src/types/chunkRecord.ts b/sdk/typescript/src/types/chunkRecord.ts index f2e745bff0..28e8f78c89 100644 --- a/sdk/typescript/src/types/chunkRecord.ts +++ b/sdk/typescript/src/types/chunkRecord.ts @@ -8,13 +8,13 @@ * This file was auto generated. DO NOT EDIT. */ -import { blkrange, rangeDates, int64, ipfshash } from '.'; +import { blkrange, int64, ipfshash, RangeDates } from '.'; export type ChunkRecord = { bloomHash: ipfshash bloomSize: int64 - rangeDates: rangeDates indexHash: ipfshash indexSize: int64 range: blkrange + rangeDates: RangeDates } diff --git a/sdk/typescript/src/types/chunkStats.ts b/sdk/typescript/src/types/chunkStats.ts index 362edfbc65..0e2c96677a 100644 --- a/sdk/typescript/src/types/chunkStats.ts +++ b/sdk/typescript/src/types/chunkStats.ts @@ -8,20 +8,20 @@ * This file was auto generated. DO NOT EDIT. */ -import { blkrange, rangeDates, float64, uint64 } from '.'; +import { blkrange, float64, RangeDates, uint64 } from '.'; export type ChunkStats = { addrsPerBlock: float64 appsPerAddr: float64 appsPerBlock: float64 bloomSz: uint64 - rangeDates: rangeDates chunkSz: uint64 nAddrs: uint64 nApps: uint64 nBlocks: uint64 nBlooms: uint64 range: blkrange + rangeDates: RangeDates ratio: float64 recWid: uint64 } From b84c8e99d9ccf140a19f03ed63cd7ec79a5c0675 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 22 Aug 2024 16:12:26 -0400 Subject: [PATCH 083/121] Chunks now include dates --- src/apps/chifra/internal/chunks/handle_address.go | 3 ++- src/apps/chifra/internal/chunks/handle_blooms.go | 3 ++- src/apps/chifra/internal/chunks/handle_index.go | 3 ++- src/apps/chifra/internal/chunks/handle_index_belongs.go | 7 ++++++- src/apps/chifra/internal/chunks/handle_manifest.go | 5 +++-- src/apps/chifra/internal/chunks/options.go | 3 ++- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/apps/chifra/internal/chunks/handle_address.go b/src/apps/chifra/internal/chunks/handle_address.go index a6c3c492ef..fc78a94139 100644 --- a/src/apps/chifra/internal/chunks/handle_address.go +++ b/src/apps/chifra/internal/chunks/handle_address.go @@ -15,6 +15,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/index" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/tslib" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" ) @@ -80,7 +81,7 @@ func (opts *ChunksOptions) HandleAddresses(rCtx *output.RenderCtx, blockNums []b Offset: uint64(obj.Offset), Count: uint64(obj.Count), } - // s.Bounds = tslib.RangeToBounds(chain, &rng) + s.RangeDates = tslib.RangeToBounds(chain, &rng) modelChan <- &s cnt++ diff --git a/src/apps/chifra/internal/chunks/handle_blooms.go b/src/apps/chifra/internal/chunks/handle_blooms.go index ea28c0bd8b..e7b049a92a 100644 --- a/src/apps/chifra/internal/chunks/handle_blooms.go +++ b/src/apps/chifra/internal/chunks/handle_blooms.go @@ -11,6 +11,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/index" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/tslib" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" ) @@ -53,7 +54,7 @@ func (opts *ChunksOptions) HandleBlooms(rCtx *output.RenderCtx, blockNums []base ByteWidth: index.BLOOM_WIDTH_IN_BYTES, NInserted: uint64(nInserted), } - // s.Bounds = tslib.RangeToBounds(chain, &rng) + s.RangeDates = tslib.RangeToBounds(chain, &rng) modelChan <- &s return true, nil diff --git a/src/apps/chifra/internal/chunks/handle_index.go b/src/apps/chifra/internal/chunks/handle_index.go index bcfe2748f3..b668647fc0 100644 --- a/src/apps/chifra/internal/chunks/handle_index.go +++ b/src/apps/chifra/internal/chunks/handle_index.go @@ -11,6 +11,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/index" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/tslib" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" ) @@ -52,7 +53,7 @@ func (opts *ChunksOptions) HandleIndex(rCtx *output.RenderCtx, blockNums []base. NAppearances: uint64(indexChunk.Header.AppearanceCount), Size: uint64(file.FileSize(fileName)), } - // s.Bounds = tslib.RangeToBounds(chain, &rng) + s.RangeDates = tslib.RangeToBounds(chain, &rng) modelChan <- &s return true, nil diff --git a/src/apps/chifra/internal/chunks/handle_index_belongs.go b/src/apps/chifra/internal/chunks/handle_index_belongs.go index 7a7684e790..7d51c59caa 100644 --- a/src/apps/chifra/internal/chunks/handle_index_belongs.go +++ b/src/apps/chifra/internal/chunks/handle_index_belongs.go @@ -13,6 +13,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/index" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/tslib" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" ) @@ -112,6 +113,8 @@ func (opts *ChunksOptions) handleResolvedRecords(modelChan chan types.Modeler, w // HandleAddresses and HandleAppearances. It is called once for each chunk in the index and // depends on the values of opts.Globals.Verbose and opts.Belongs. func (opts *ChunksOptions) handleResolvedRecords1(modelChan chan types.Modeler, walker *walk.CacheWalker, path string) (bool, error) { + chain := opts.Globals.Chain + if path != index.ToBloomPath(path) { return false, fmt.Errorf("should not happen in showAddressesBelongs") } @@ -166,12 +169,14 @@ func (opts *ChunksOptions) handleResolvedRecords1(modelChan chan types.Modeler, if len(s.Appearances) == 0 { continue } + rng := indexChunk.Range ss := types.ChunkAddress{ Address: s.AddressRecord.Address, Count: uint64(s.AddressRecord.Count), Offset: uint64(s.AddressRecord.Offset), - // Range string `json:"range"` + Range: rng.String(), } + ss.RangeDates = tslib.RangeToBounds(chain, &rng) modelChan <- &ss cnt++ } diff --git a/src/apps/chifra/internal/chunks/handle_manifest.go b/src/apps/chifra/internal/chunks/handle_manifest.go index 6d90fc7c8f..3d5a9704bb 100644 --- a/src/apps/chifra/internal/chunks/handle_manifest.go +++ b/src/apps/chifra/internal/chunks/handle_manifest.go @@ -8,6 +8,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/manifest" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/tslib" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) @@ -41,7 +42,7 @@ func (opts *ChunksOptions) HandleManifest(rCtx *output.RenderCtx, blockNums []ba IndexHash: chunk.IndexHash, IndexSize: chunk.IndexSize, } - // s.Bounds = tslib.RangeToBounds(chain, &rng) + s.RangeDates = tslib.RangeToBounds(chain, &rng) modelChan <- &s } } @@ -64,7 +65,7 @@ func (opts *ChunksOptions) HandleManifest(rCtx *output.RenderCtx, blockNums []ba IndexHash: chunk.IndexHash, IndexSize: chunk.IndexSize, } - // ch.Bounds = tslib.RangeToBounds(chain, &rng) + ch.RangeDates = tslib.RangeToBounds(chain, &rng) s.Chunks = append(s.Chunks, ch) } modelChan <- &s diff --git a/src/apps/chifra/internal/chunks/options.go b/src/apps/chifra/internal/chunks/options.go index 7276ff1b52..0619b297c7 100644 --- a/src/apps/chifra/internal/chunks/options.go +++ b/src/apps/chifra/internal/chunks/options.go @@ -26,6 +26,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/index" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/tslib" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/validate" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" @@ -311,7 +312,7 @@ func GetChunkStats(chain, path string) (s types.ChunkStats, err error) { ChunkSz: uint64(file.FileSize(index.ToIndexPath(path))), RecWid: 4 + index.BLOOM_WIDTH_IN_BYTES, } - // s.Bounds = tslib.RangeToBounds(chain, &rng) + s.RangeDates = tslib.RangeToBounds(chain, &rng) if s.NBlocks > 0 { s.AddrsPerBlock = float64(s.NAddrs) / float64(s.NBlocks) From c03e2f5b0d699186aa767d0e6f34cea92c0ba538 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 22 Aug 2024 16:12:47 -0400 Subject: [PATCH 084/121] Chunks now include dates --- .../chifra/pkg/types/types_chunkaddress.go | 21 +++++++++-- src/apps/chifra/pkg/types/types_chunkbloom.go | 27 ++++++++++---- src/apps/chifra/pkg/types/types_chunkindex.go | 25 ++++++++++--- .../chifra/pkg/types/types_chunkrecord.go | 23 +++++++++--- src/apps/chifra/pkg/types/types_chunkstats.go | 37 +++++++++++++------ src/apps/chifra/pkg/types/types_rangedates.go | 12 ++++++ .../classDefinitions/fields/chunkaddress.csv | 11 +++--- .../classDefinitions/fields/chunkbloom.csv | 17 +++++---- .../classDefinitions/fields/chunkindex.csv | 15 ++++---- .../classDefinitions/fields/chunkrecord.csv | 13 ++++--- .../classDefinitions/fields/chunkstats.csv | 27 +++++++------- src/dev_tools/testRunner/testCases/chunks.csv | 5 +++ 12 files changed, 160 insertions(+), 73 deletions(-) diff --git a/src/apps/chifra/pkg/types/types_chunkaddress.go b/src/apps/chifra/pkg/types/types_chunkaddress.go index ca12001433..768389fc83 100644 --- a/src/apps/chifra/pkg/types/types_chunkaddress.go +++ b/src/apps/chifra/pkg/types/types_chunkaddress.go @@ -18,10 +18,11 @@ import ( // EXISTING_CODE type ChunkAddress struct { - Address base.Address `json:"address"` - Count uint64 `json:"count"` - Offset uint64 `json:"offset"` - Range string `json:"range"` + Address base.Address `json:"address"` + Count uint64 `json:"count"` + Offset uint64 `json:"offset"` + Range string `json:"range"` + RangeDates RangeDates `json:"rangeDates"` // EXISTING_CODE // EXISTING_CODE } @@ -48,6 +49,18 @@ func (s *ChunkAddress) Model(chain, format string, verbose bool, extraOpts map[s "offset", "count", } + + if verbose { + if format == "json" { + model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + } else { + model["firstTs"] = s.RangeDates.FirstTs + model["firstDate"] = s.RangeDates.FirstDate + model["lastTs"] = s.RangeDates.LastTs + model["lastDate"] = s.RangeDates.LastDate + order = append(order, []string{"firstTs", "firstDate", "lastTs", "lastDate"}...) + } + } // EXISTING_CODE return Model{ diff --git a/src/apps/chifra/pkg/types/types_chunkbloom.go b/src/apps/chifra/pkg/types/types_chunkbloom.go index 986a568145..33d7a9f9ef 100644 --- a/src/apps/chifra/pkg/types/types_chunkbloom.go +++ b/src/apps/chifra/pkg/types/types_chunkbloom.go @@ -20,13 +20,14 @@ import ( // EXISTING_CODE type ChunkBloom struct { - ByteWidth uint64 `json:"byteWidth"` - Hash base.Hash `json:"hash"` - Magic string `json:"magic"` - NBlooms uint64 `json:"nBlooms"` - NInserted uint64 `json:"nInserted"` - Range string `json:"range"` - Size uint64 `json:"size"` + ByteWidth uint64 `json:"byteWidth"` + Hash base.Hash `json:"hash"` + Magic string `json:"magic"` + NBlooms uint64 `json:"nBlooms"` + NInserted uint64 `json:"nInserted"` + Range string `json:"range"` + RangeDates RangeDates `json:"rangeDates"` + Size uint64 `json:"size"` // EXISTING_CODE // EXISTING_CODE } @@ -63,6 +64,18 @@ func (s *ChunkBloom) Model(chain, format string, verbose bool, extraOpts map[str model["hash"] = s.Hash.Hex() model["hashValue"] = FormattedTag(verbose, s.Hash) } + + if verbose { + if format == "json" { + model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + } else { + model["firstTs"] = s.RangeDates.FirstTs + model["firstDate"] = s.RangeDates.FirstDate + model["lastTs"] = s.RangeDates.LastTs + model["lastDate"] = s.RangeDates.LastDate + order = append(order, []string{"firstTs", "firstDate", "lastTs", "lastDate"}...) + } + } // EXISTING_CODE return Model{ diff --git a/src/apps/chifra/pkg/types/types_chunkindex.go b/src/apps/chifra/pkg/types/types_chunkindex.go index 99396e65e4..877efde668 100644 --- a/src/apps/chifra/pkg/types/types_chunkindex.go +++ b/src/apps/chifra/pkg/types/types_chunkindex.go @@ -18,12 +18,13 @@ import ( // EXISTING_CODE type ChunkIndex struct { - Hash base.Hash `json:"hash"` - Magic string `json:"magic"` - NAddresses uint64 `json:"nAddresses"` - NAppearances uint64 `json:"nAppearances"` - Range string `json:"range"` - Size uint64 `json:"size"` + Hash base.Hash `json:"hash"` + Magic string `json:"magic"` + NAddresses uint64 `json:"nAddresses"` + NAppearances uint64 `json:"nAppearances"` + Range string `json:"range"` + RangeDates RangeDates `json:"rangeDates"` + Size uint64 `json:"size"` // EXISTING_CODE // EXISTING_CODE } @@ -58,6 +59,18 @@ func (s *ChunkIndex) Model(chain, format string, verbose bool, extraOpts map[str model["hash"] = s.Hash.Hex() model["hashValue"] = FormattedTag(verbose, s.Hash) } + + if verbose { + if format == "json" { + model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + } else { + model["firstTs"] = s.RangeDates.FirstTs + model["firstDate"] = s.RangeDates.FirstDate + model["lastTs"] = s.RangeDates.LastTs + model["lastDate"] = s.RangeDates.LastDate + order = append(order, []string{"firstTs", "firstDate", "lastTs", "lastDate"}...) + } + } // EXISTING_CODE return Model{ diff --git a/src/apps/chifra/pkg/types/types_chunkrecord.go b/src/apps/chifra/pkg/types/types_chunkrecord.go index 05802c78e4..e5f7dc4e28 100644 --- a/src/apps/chifra/pkg/types/types_chunkrecord.go +++ b/src/apps/chifra/pkg/types/types_chunkrecord.go @@ -18,11 +18,12 @@ import ( // EXISTING_CODE type ChunkRecord struct { - BloomHash base.IpfsHash `json:"bloomHash"` - BloomSize int64 `json:"bloomSize"` - IndexHash base.IpfsHash `json:"indexHash"` - IndexSize int64 `json:"indexSize"` - Range string `json:"range"` + BloomHash base.IpfsHash `json:"bloomHash"` + BloomSize int64 `json:"bloomSize"` + IndexHash base.IpfsHash `json:"indexHash"` + IndexSize int64 `json:"indexSize"` + Range string `json:"range"` + RangeDates RangeDates `json:"rangeDates"` // EXISTING_CODE // EXISTING_CODE } @@ -51,6 +52,18 @@ func (s *ChunkRecord) Model(chain, format string, verbose bool, extraOpts map[st "indexHash", "indexSize", } + + if verbose { + if format == "json" { + model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + } else { + model["firstTs"] = s.RangeDates.FirstTs + model["firstDate"] = s.RangeDates.FirstDate + model["lastTs"] = s.RangeDates.LastTs + model["lastDate"] = s.RangeDates.LastDate + order = append(order, []string{"firstTs", "firstDate", "lastTs", "lastDate"}...) + } + } // EXISTING_CODE return Model{ diff --git a/src/apps/chifra/pkg/types/types_chunkstats.go b/src/apps/chifra/pkg/types/types_chunkstats.go index 3f90f77ec9..2f1799c017 100644 --- a/src/apps/chifra/pkg/types/types_chunkstats.go +++ b/src/apps/chifra/pkg/types/types_chunkstats.go @@ -14,18 +14,19 @@ import "encoding/json" // EXISTING_CODE type ChunkStats struct { - AddrsPerBlock float64 `json:"addrsPerBlock"` - AppsPerAddr float64 `json:"appsPerAddr"` - AppsPerBlock float64 `json:"appsPerBlock"` - BloomSz uint64 `json:"bloomSz"` - ChunkSz uint64 `json:"chunkSz"` - NAddrs uint64 `json:"nAddrs"` - NApps uint64 `json:"nApps"` - NBlocks uint64 `json:"nBlocks"` - NBlooms uint64 `json:"nBlooms"` - Range string `json:"range"` - Ratio float64 `json:"ratio"` - RecWid uint64 `json:"recWid"` + AddrsPerBlock float64 `json:"addrsPerBlock"` + AppsPerAddr float64 `json:"appsPerAddr"` + AppsPerBlock float64 `json:"appsPerBlock"` + BloomSz uint64 `json:"bloomSz"` + ChunkSz uint64 `json:"chunkSz"` + NAddrs uint64 `json:"nAddrs"` + NApps uint64 `json:"nApps"` + NBlocks uint64 `json:"nBlocks"` + NBlooms uint64 `json:"nBlooms"` + Range string `json:"range"` + RangeDates RangeDates `json:"rangeDates"` + Ratio float64 `json:"ratio"` + RecWid uint64 `json:"recWid"` // EXISTING_CODE // EXISTING_CODE } @@ -68,6 +69,18 @@ func (s *ChunkStats) Model(chain, format string, verbose bool, extraOpts map[str "appsPerAddr", "ratio", } + + if verbose { + if format == "json" { + model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + } else { + model["firstTs"] = s.RangeDates.FirstTs + model["firstDate"] = s.RangeDates.FirstDate + model["lastTs"] = s.RangeDates.LastTs + model["lastDate"] = s.RangeDates.LastDate + order = append(order, []string{"firstTs", "firstDate", "lastTs", "lastDate"}...) + } + } // EXISTING_CODE return Model{ diff --git a/src/apps/chifra/pkg/types/types_rangedates.go b/src/apps/chifra/pkg/types/types_rangedates.go index abecb1a092..7662d8e0ea 100644 --- a/src/apps/chifra/pkg/types/types_rangedates.go +++ b/src/apps/chifra/pkg/types/types_rangedates.go @@ -36,6 +36,18 @@ func (s *RangeDates) Model(chain, format string, verbose bool, extraOpts map[str var order = []string{} // EXISTING_CODE + model = map[string]any{ + "firstDate": s.FirstDate, + "firstTs": s.FirstTs, + "lastDate": s.LastDate, + "lastTs": s.LastTs, + } + order = []string{ + "firstDate", + "firstTs", + "lastDate", + "lastTs", + } // EXISTING_CODE return Model{ diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkaddress.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkaddress.csv index d70a67567c..fec19794b8 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkaddress.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkaddress.csv @@ -1,5 +1,6 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -address ,address , , , 1 ,the address in this record -range ,blkrange , , , 2 ,the block range of the chunk from which this address record was taken -offset ,uint64 , , , 3 ,the offset into the appearance table of the first record for this address -count ,uint64 , , , 4 ,the number of records in teh appearance table for this address +name ,type ,strDefault ,attributes ,docOrder ,description +address ,address , , , 1 ,the address in this record +range ,blkrange , , , 2 ,the block range of the chunk from which this address record was taken +offset ,uint64 , , , 3 ,the offset into the appearance table of the first record for this address +count ,uint64 , , , 4 ,the number of records in teh appearance table for this address +rangeDates ,RangeDates , , , 5 ,if verbose, the block and timestamp bounds of the chunk diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkbloom.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkbloom.csv index a0314bf04b..be953838b2 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkbloom.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkbloom.csv @@ -1,8 +1,9 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -range ,blkrange , , , 1 ,the block range (inclusive) covered by this chunk -magic ,string , , , 2 ,an internal use only magic number to indicate file format -hash ,hash , , , 3 ,the hash of the specification under which this chunk was generated -nBlooms ,uint64 , , , 4 ,the number of individual bloom filters in this bloom file -nInserted ,uint64 , , , 5 ,the number of addresses inserted into the bloom file -size ,uint64 , , , 6 ,the size on disc in bytes of this bloom file -byteWidth ,uint64 , , , 7 ,the width of the bloom filter +name ,type ,strDefault ,attributes ,docOrder ,description +range ,blkrange , , , 1 ,the block range (inclusive) covered by this chunk +magic ,string , , , 2 ,an internal use only magic number to indicate file format +hash ,hash , , , 3 ,the hash of the specification under which this chunk was generated +nBlooms ,uint64 , , , 4 ,the number of individual bloom filters in this bloom file +nInserted ,uint64 , , , 5 ,the number of addresses inserted into the bloom file +size ,uint64 , , , 6 ,the size on disc in bytes of this bloom file +byteWidth ,uint64 , , , 7 ,the width of the bloom filter +rangeDates ,RangeDates , , , 8 ,if verbose, the block and timestamp bounds of the chunk diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkindex.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkindex.csv index 6f92347e35..ce542f8626 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkindex.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkindex.csv @@ -1,7 +1,8 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -range ,blkrange , , , 1 ,the block range (inclusive) covered by this chunk -magic ,string , , , 2 ,an internal use only magic number to indicate file format -hash ,hash , , , 3 ,the hash of the specification under which this chunk was generated -nAddresses ,uint64 , , , 4 ,the number of addresses in this chunk -nAppearances ,uint64 , , , 5 ,the number of appearances in this chunk -size ,uint64 , , , 6 ,the size of the chunk in bytes +name ,type ,strDefault ,attributes ,docOrder ,description +range ,blkrange , , , 1 ,the block range (inclusive) covered by this chunk +magic ,string , , , 2 ,an internal use only magic number to indicate file format +hash ,hash , , , 3 ,the hash of the specification under which this chunk was generated +nAddresses ,uint64 , , , 4 ,the number of addresses in this chunk +nAppearances ,uint64 , , , 5 ,the number of appearances in this chunk +size ,uint64 , , , 6 ,the size of the chunk in bytes +rangeDates ,RangeDates , , , 7 ,if verbose, the block and timestamp bounds of the chunk diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkrecord.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkrecord.csv index aef73eb86c..3252825796 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkrecord.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkrecord.csv @@ -1,6 +1,7 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -range ,blkrange , , , 1 ,the block range (inclusive) covered by this chunk -bloomHash ,ipfshash , , , 2 ,the IPFS hash of the bloom filter at that range -indexHash ,ipfshash , , , 3 ,the IPFS hash of the index chunk at that range -bloomSize ,int64 , , , 4 ,the size of the bloom filter in bytes -indexSize ,int64 , , , 5 ,the size of the index portion in bytes +name ,type ,strDefault ,attributes ,docOrder ,description +range ,blkrange , , , 1 ,the block range (inclusive) covered by this chunk +bloomHash ,ipfshash , , , 2 ,the IPFS hash of the bloom filter at that range +indexHash ,ipfshash , , , 3 ,the IPFS hash of the index chunk at that range +bloomSize ,int64 , , , 4 ,the size of the bloom filter in bytes +indexSize ,int64 , , , 5 ,the size of the index portion in bytes +rangeDates ,RangeDates , , , 6 ,if verbose, the block and timestamp bounds of the chunk diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv index 3128a4cfd9..a9d024a7b6 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv @@ -1,13 +1,14 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -range ,blkrange , , , 1 ,the block range (inclusive) covered by this chunk -nAddrs ,uint64 , , , 2 ,the number of addresses in the chunk -nApps ,uint64 , , , 3 ,the number of appearances in the chunk -nBlocks ,uint64 , , , 4 ,the number of blocks in the chunk -nBlooms ,uint64 , , , 5 ,the number of bloom filters in the chunk's bloom -recWid ,uint64 , , , 6 ,the record width of a single bloom filter -bloomSz ,uint64 , , , 7 ,the size of the bloom filters on disc in bytes -chunkSz ,uint64 , , , 8 ,the size of the chunks on disc in bytes -addrsPerBlock ,float64 , , , 9 ,the average number of addresses per block -appsPerBlock ,float64 , , , 10 ,the average number of appearances per block -appsPerAddr ,float64 , , , 11 ,the average number of appearances per address -ratio ,float64 , , , 12 ,the ratio of appearances to addresses +name ,type ,strDefault ,attributes ,docOrder ,description +range ,blkrange , , , 1 ,the block range (inclusive) covered by this chunk +nAddrs ,uint64 , , , 2 ,the number of addresses in the chunk +nApps ,uint64 , , , 3 ,the number of appearances in the chunk +nBlocks ,uint64 , , , 4 ,the number of blocks in the chunk +nBlooms ,uint64 , , , 5 ,the number of bloom filters in the chunk's bloom +recWid ,uint64 , , , 6 ,the record width of a single bloom filter +bloomSz ,uint64 , , , 7 ,the size of the bloom filters on disc in bytes +chunkSz ,uint64 , , , 8 ,the size of the chunks on disc in bytes +addrsPerBlock ,float64 , , , 9 ,the average number of addresses per block +appsPerBlock ,float64 , , , 10 ,the average number of appearances per block +appsPerAddr ,float64 , , , 11 ,the average number of appearances per address +ratio ,float64 , , , 12 ,the ratio of appearances to addresses +rangeDates ,RangeDates , , , 13 ,if verbose, the block and timestamp bounds of the chunk diff --git a/src/dev_tools/testRunner/testCases/chunks.csv b/src/dev_tools/testRunner/testCases/chunks.csv index 00a03bc1ca..93b7fbca31 100644 --- a/src/dev_tools/testRunner/testCases/chunks.csv +++ b/src/dev_tools/testRunner/testCases/chunks.csv @@ -13,12 +13,17 @@ on ,both ,fast ,chunks ,apps ,chunkMan ,fail_detail_belong ,y ,mod on ,both ,fast ,chunks ,apps ,chunkMan ,list_check ,y ,mode = monitors & check on ,both ,fast ,chunks ,apps ,chunkMan ,stats_default ,y ,mode = stats +on ,both ,fast ,chunks ,apps ,chunkMan ,stats_default_v ,y ,mode = stats & verbose on ,both ,fast ,chunks ,apps ,chunkMan ,manifest_default ,y ,mode = manifest +on ,both ,fast ,chunks ,apps ,chunkMan ,manifest_default_v ,y ,mode = manifest & verbose on ,both ,fast ,chunks ,apps ,chunkMan ,index_default ,y ,mode = index +on ,both ,fast ,chunks ,apps ,chunkMan ,index_default_v ,y ,mode = index & verbose on ,both ,fast ,chunks ,apps ,chunkMan ,blooms_default ,y ,mode = blooms +on ,both ,fast ,chunks ,apps ,chunkMan ,blooms_default_v ,y ,mode = blooms & verbose on ,both ,fast ,chunks ,apps ,chunkMan ,header_default ,y ,mode = header on ,both ,fast ,chunks ,apps ,chunkMan ,pins_default ,y ,mode = pins on ,both ,fast ,chunks ,apps ,chunkMan ,addresses_default ,y ,mode = addresses +on ,both ,fast ,chunks ,apps ,chunkMan ,addresses_default_v ,y ,mode = addresses & verbose on ,both ,fast ,chunks ,apps ,chunkMan ,appearances_default ,y ,mode = appearances on ,both ,fast ,chunks ,apps ,chunkMan ,not_pins_list ,y ,mode = index & list From 6c354797c703254250f9e38ef3170364981bda75 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 22 Aug 2024 16:13:42 -0400 Subject: [PATCH 085/121] Chunks now include dates --- docs | 2 +- tests | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index d9c8b80db2..be3f9dd058 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit d9c8b80db23aab019219a98afac12dead32b0926 +Subproject commit be3f9dd0589c205d3cea38e72605204a4ae35573 diff --git a/tests b/tests index 5b9cf0f871..08e79a4bb2 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 5b9cf0f871823648b7343fa8b142051cddd18e07 +Subproject commit 08e79a4bb20a54348c54062109a318d02accfba5 From fe57f66a6acabd88689f7052587deb18d059e7bb Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 22 Aug 2024 16:56:46 -0400 Subject: [PATCH 086/121] Fixes tests --- src/dev_tools/testRunner/testCases/chunks.csv | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/dev_tools/testRunner/testCases/chunks.csv b/src/dev_tools/testRunner/testCases/chunks.csv index 93b7fbca31..0df5e4bdd7 100644 --- a/src/dev_tools/testRunner/testCases/chunks.csv +++ b/src/dev_tools/testRunner/testCases/chunks.csv @@ -13,19 +13,20 @@ on ,both ,fast ,chunks ,apps ,chunkMan ,fail_detail_belong ,y ,mod on ,both ,fast ,chunks ,apps ,chunkMan ,list_check ,y ,mode = monitors & check on ,both ,fast ,chunks ,apps ,chunkMan ,stats_default ,y ,mode = stats -on ,both ,fast ,chunks ,apps ,chunkMan ,stats_default_v ,y ,mode = stats & verbose on ,both ,fast ,chunks ,apps ,chunkMan ,manifest_default ,y ,mode = manifest -on ,both ,fast ,chunks ,apps ,chunkMan ,manifest_default_v ,y ,mode = manifest & verbose on ,both ,fast ,chunks ,apps ,chunkMan ,index_default ,y ,mode = index -on ,both ,fast ,chunks ,apps ,chunkMan ,index_default_v ,y ,mode = index & verbose on ,both ,fast ,chunks ,apps ,chunkMan ,blooms_default ,y ,mode = blooms -on ,both ,fast ,chunks ,apps ,chunkMan ,blooms_default_v ,y ,mode = blooms & verbose on ,both ,fast ,chunks ,apps ,chunkMan ,header_default ,y ,mode = header on ,both ,fast ,chunks ,apps ,chunkMan ,pins_default ,y ,mode = pins on ,both ,fast ,chunks ,apps ,chunkMan ,addresses_default ,y ,mode = addresses -on ,both ,fast ,chunks ,apps ,chunkMan ,addresses_default_v ,y ,mode = addresses & verbose on ,both ,fast ,chunks ,apps ,chunkMan ,appearances_default ,y ,mode = appearances +slow ,both ,fast ,chunks ,apps ,chunkMan ,stats_default_v ,y ,mode = stats & verbose +slow ,both ,fast ,chunks ,apps ,chunkMan ,manifest_default_v ,y ,mode = manifest & verbose +slow ,both ,fast ,chunks ,apps ,chunkMan ,index_default_v ,y ,mode = index & verbose +slow ,both ,fast ,chunks ,apps ,chunkMan ,blooms_default_v ,y ,mode = blooms & verbose +slow ,both ,fast ,chunks ,apps ,chunkMan ,addresses_default_v ,y ,mode = addresses & verbose + on ,both ,fast ,chunks ,apps ,chunkMan ,not_pins_list ,y ,mode = index & list on ,both ,fast ,chunks ,apps ,chunkMan ,pins_list ,y ,mode = pins & list on ,both ,fast ,chunks ,apps ,chunkMan ,not_pins_unpin ,y ,mode = index & unpin = 12 From b50d1aaa6418722e172f7463bd01678d38594fca Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 22 Aug 2024 17:28:43 -0400 Subject: [PATCH 087/121] Fixes tests --- tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests b/tests index 08e79a4bb2..a946cd4265 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 08e79a4bb20a54348c54062109a318d02accfba5 +Subproject commit a946cd4265ba8ec3533b5d25f42f6b0eee799cd5 From 00d349e384c4b25f59e3a41c218cb38d73696859 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Fri, 23 Aug 2024 09:32:03 -0400 Subject: [PATCH 088/121] Adds .gitignore to ./examples --- examples/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 examples/.gitignore diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 0000000000..6b77021d76 --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1 @@ +abiTesting From e00604d8682b96f33a7dd3a506f3685eff4a372a Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Fri, 23 Aug 2024 09:47:38 -0400 Subject: [PATCH 089/121] Adds test cases for chifra abis --count) not implemented. --- src/dev_tools/testRunner/main.go | 7 ++++++- src/dev_tools/testRunner/testCases/abis.csv | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/dev_tools/testRunner/main.go b/src/dev_tools/testRunner/main.go index ee043a82d9..32b00e0441 100644 --- a/src/dev_tools/testRunner/main.go +++ b/src/dev_tools/testRunner/main.go @@ -82,6 +82,7 @@ func parseCsv(filePath string) ([]TestCase, error) { const requiredFields = 9 lineNumber := 0 testCases := make([]TestCase, 0, 200) + enableMark := os.Getenv("TB_TEST_ENABLE") for { lineNumber++ csvRecord, err := reader.Read() @@ -116,9 +117,13 @@ func parseCsv(filePath string) ([]TestCase, error) { Options: strings.Trim(csvRecord[8], " "), } + isEnabled := rec.Enabled == "on" + if enableMark != "" { + isEnabled = rec.Enabled == enableMark + } testCase := TestCase{ record: rec, - IsEnabled: rec.Enabled == "on", + IsEnabled: isEnabled, HasShorthand: strings.Contains(rec.Options, "@"), WorkingPath: filepath.Join(getWorkingPath(), rec.Path, rec.Tool), OrigOptions: rec.Options, diff --git a/src/dev_tools/testRunner/testCases/abis.csv b/src/dev_tools/testRunner/testCases/abis.csv index d5c7688aff..df4f10e67c 100644 --- a/src/dev_tools/testRunner/testCases/abis.csv +++ b/src/dev_tools/testRunner/testCases/abis.csv @@ -66,6 +66,10 @@ on ,both ,fast ,abis ,tools ,grabABI ,clean_alone ,y ,decache on ,both ,fast ,abis ,tools ,grabABI ,list ,y ,list on ,both ,fast ,abis ,tools ,grabABI ,list_verbose ,y ,list & verbose +jink ,both ,fast ,abis ,tools ,grabABI ,count ,y ,count +jink ,both ,fast ,abis ,tools ,grabABI ,count_v ,y ,count +jink ,both ,fast ,abis ,tools ,grabABI ,count_list ,y ,count & list +jink ,both ,fast ,abis ,tools ,grabABI ,count_fail ,y ,count & find # Reports inconsistent results on subsequent runs delay ,both ,fast ,abis ,tools ,grabABI ,findSig_a_lot ,n ,find = 0xea8a1af0 & find = 0x9a82a09a & find = 0x52efea6e & find = 0xd0e30db0 & find = 0x83197ef0 & find = 0x12fa6feb & find = 0x3d6a71e4 & find = 0x31ae450b & find = 0x06fdde03 & find = 0x8da5cb5b & find = 0x1aa3a008 & find = 0x2de40ce3 & find = 0x9d76ea58 & find = 0xad7a672f & find = 0x3ccfd60b & find = 0xf5074f41 & find = 0x24d7806c & find = 0xc3c5a547 & find = 0x09e69ede & find = 0xf2fde38b & find = 0xc2a2ce06 & find = 0xfdacd576 & fmt = csv From dc2b8a6cb1a934411b42bb227db7b16911de0056 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Fri, 23 Aug 2024 11:04:25 -0400 Subject: [PATCH 090/121] Adds --count to chifra abis --- docs | 2 +- sdk/abis.go | 7 ++ sdk/abis_internal.go | 4 +- sdk/python/src/_abis.py | 1 + sdk/typescript/src/paths/abis.ts | 5 +- src/apps/chifra/cmd/abis.go | 1 + src/apps/chifra/internal/abis/README.md | 1 + src/apps/chifra/internal/abis/handle_count.go | 42 +++++++++++ src/apps/chifra/internal/abis/handle_list.go | 69 ++++++++----------- src/apps/chifra/internal/abis/options.go | 4 ++ src/apps/chifra/internal/abis/output.go | 2 + src/apps/chifra/internal/abis/validate.go | 6 ++ src/apps/chifra/internal/abis/walk_folders.go | 26 +++++++ .../goMaker/templates/cmd-line-options.csv | 13 ++-- src/dev_tools/sdkFuzzer/abis.go | 10 +++ src/dev_tools/testRunner/testCases/abis.csv | 8 +-- tests | 2 +- 17 files changed, 148 insertions(+), 55 deletions(-) create mode 100644 src/apps/chifra/internal/abis/handle_count.go create mode 100644 src/apps/chifra/internal/abis/walk_folders.go diff --git a/docs b/docs index be3f9dd058..63a30daed9 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit be3f9dd0589c205d3cea38e72605204a4ae35573 +Subproject commit 63a30daed9f87973cb076c56d1410342179356b6 diff --git a/sdk/abis.go b/sdk/abis.go index 4295cbfd99..0a19e729e4 100644 --- a/sdk/abis.go +++ b/sdk/abis.go @@ -47,6 +47,13 @@ func (opts *AbisOptions) AbisList() ([]types.Abi, *types.MetaData, error) { return queryAbis[types.Abi](in) } +// AbisCount implements the chifra abis --count command. +func (opts *AbisOptions) AbisCount() ([]types.Count, *types.MetaData, error) { + in := opts.toInternal() + in.Count = true + return queryAbis[types.Count](in) +} + // AbisFind implements the chifra abis --find command. func (opts *AbisOptions) AbisFind(val []string) ([]types.Function, *types.MetaData, error) { in := opts.toInternal() diff --git a/sdk/abis_internal.go b/sdk/abis_internal.go index 07ba2d043c..674e6a1e4c 100644 --- a/sdk/abis_internal.go +++ b/sdk/abis_internal.go @@ -27,6 +27,7 @@ type abisOptionsInternal struct { Known bool `json:"known,omitempty"` ProxyFor base.Address `json:"proxyFor,omitempty"` List bool `json:"list,omitempty"` + Count bool `json:"count,omitempty"` Find []string `json:"find,omitempty"` Hint []string `json:"hint,omitempty"` Encode string `json:"encode,omitempty"` @@ -85,7 +86,8 @@ func GetAbisOptions(args []string) (*abisOptionsInternal, error) { type abisGeneric interface { types.Function | - types.Abi + types.Abi | + types.Count } func queryAbis[T abisGeneric](opts *abisOptionsInternal) ([]T, *types.MetaData, error) { diff --git a/sdk/python/src/_abis.py b/sdk/python/src/_abis.py index 63bc786fc9..8b2ec69cfe 100644 --- a/sdk/python/src/_abis.py +++ b/sdk/python/src/_abis.py @@ -15,6 +15,7 @@ "known": {"hotkey": "-k", "type": "switch"}, "proxyFor": {"hotkey": "-r", "type": "flag"}, "list": {"hotkey": "-l", "type": "switch"}, + "count": {"hotkey": "-c", "type": "switch"}, "find": {"hotkey": "-f", "type": "flag"}, "hint": {"hotkey": "-n", "type": "flag"}, "encode": {"hotkey": "-e", "type": "flag"}, diff --git a/sdk/typescript/src/paths/abis.ts b/sdk/typescript/src/paths/abis.ts index 1d1b06630b..10b4355de0 100644 --- a/sdk/typescript/src/paths/abis.ts +++ b/sdk/typescript/src/paths/abis.ts @@ -9,7 +9,7 @@ */ import * as ApiCallers from '../lib/api_callers'; -import { Abi, address, Function } from '../types'; +import { Abi, address, Count, Function } from '../types'; export function getAbis( parameters?: { @@ -17,6 +17,7 @@ export function getAbis( known?: boolean, proxyFor?: address, list?: boolean, + count?: boolean, find?: string[], hint?: string[], encode?: string, @@ -28,7 +29,7 @@ export function getAbis( }, options?: RequestInit, ) { - return ApiCallers.fetch( + return ApiCallers.fetch( { endpoint: '/abis', method: 'get', parameters, options }, ); } diff --git a/src/apps/chifra/cmd/abis.go b/src/apps/chifra/cmd/abis.go index f77072aa17..3e2240a31b 100644 --- a/src/apps/chifra/cmd/abis.go +++ b/src/apps/chifra/cmd/abis.go @@ -59,6 +59,7 @@ func init() { abisCmd.Flags().BoolVarP(&abisPkg.GetOptions().Known, "known", "k", false, `load common 'known' ABIs from cache`) abisCmd.Flags().StringVarP(&abisPkg.GetOptions().ProxyFor, "proxy_for", "r", "", `redirects the query to this implementation`) abisCmd.Flags().BoolVarP(&abisPkg.GetOptions().List, "list", "l", false, `a list of downloaded abi files`) + abisCmd.Flags().BoolVarP(&abisPkg.GetOptions().Count, "count", "c", false, `show the number of abis downloaded`) abisCmd.Flags().StringSliceVarP(&abisPkg.GetOptions().Find, "find", "f", nil, `search for function or event declarations given a four- or 32-byte code(s)`) abisCmd.Flags().StringSliceVarP(&abisPkg.GetOptions().Hint, "hint", "n", nil, `for the --find option only, provide hints to speed up the search`) abisCmd.Flags().StringVarP(&abisPkg.GetOptions().Encode, "encode", "e", "", `generate the 32-byte encoding for a given cannonical function or event signature`) diff --git a/src/apps/chifra/internal/abis/README.md b/src/apps/chifra/internal/abis/README.md index a6a7adba7e..029bd26778 100644 --- a/src/apps/chifra/internal/abis/README.md +++ b/src/apps/chifra/internal/abis/README.md @@ -37,6 +37,7 @@ Flags: -k, --known load common 'known' ABIs from cache -r, --proxy_for string redirects the query to this implementation -l, --list a list of downloaded abi files + -c, --count show the number of abis downloaded -f, --find strings search for function or event declarations given a four- or 32-byte code(s) -n, --hint strings for the --find option only, provide hints to speed up the search -e, --encode string generate the 32-byte encoding for a given cannonical function or event signature diff --git a/src/apps/chifra/internal/abis/handle_count.go b/src/apps/chifra/internal/abis/handle_count.go new file mode 100644 index 0000000000..d1dd741226 --- /dev/null +++ b/src/apps/chifra/internal/abis/handle_count.go @@ -0,0 +1,42 @@ +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package abisPkg + +import ( + "path/filepath" + "strings" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" +) + +// HandleCount handles the chifra abis --count command. +func (opts *AbisOptions) HandleCount(rCtx *output.RenderCtx) error { + testMode := opts.Globals.TestMode + + fetchData := func(modelChan chan types.Modeler, errorChan chan error) { + count := uint64(0) + if testMode { + count = 199 + } else { + vFunc := func(fn string, vP any) (bool, error) { + _, name := filepath.Split(fn) + if strings.HasSuffix(name, ".json") { + count++ + } + return true, nil + } + opts.ForEveryAbi(true, vFunc, nil) + } + + s := types.Count{ + Count: count, + } + + modelChan <- &s + } + + return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) +} diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index c144716e51..8d11c4d1c9 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -14,55 +14,44 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" ) -// HandleList handles the chifra monitors --list command. +// HandleList handles the chifra abis --list command. func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { - chain := opts.Globals.Chain testMode := opts.Globals.TestMode - paths := make([]string, 0, 2) - paths = append(paths, filepath.Join(config.PathToRootConfig(), "abis")) - if !testMode { - paths = append(paths, filepath.Join(config.PathToCache(chain), "abis")) - } - - abiArray := make([]types.Abi, 0, 100) - vFunc := func(fn string, vP any) (bool, error) { - if strings.HasSuffix(fn, ".json") { - info, _ := os.Stat(fn) - abi := types.Abi{ - FileSize: file.FileSize(fn), - LastModDate: info.ModTime().Format("2006-01-02 15:04:05"), - IsKnown: strings.Contains(fn, "known"), - } - abi.Path, abi.Name = filepath.Split(fn) - if strings.HasPrefix(abi.Name, "0x") { - abi.Address = base.HexToAddress(strings.Replace(abi.Name, ".json", "", -1)) - } - if len(abi.Name) > 0 { - abiArray = append(abiArray, abi) + fetchData := func(modelChan chan types.Modeler, errorChan chan error) { + abiArray := make([]types.Abi, 0, 100) + vFunc := func(fn string, vP any) (bool, error) { + if strings.HasSuffix(fn, ".json") { + info, _ := os.Stat(fn) + abi := types.Abi{ + FileSize: file.FileSize(fn), + LastModDate: info.ModTime().Format("2006-01-02 15:04:05"), + IsKnown: strings.Contains(fn, "known"), + } + abi.Path, abi.Name = filepath.Split(fn) + if len(abi.Name) > 0 { + if strings.HasPrefix(abi.Name, "0x") { + abi.Address = base.HexToAddress(strings.Replace(abi.Name, ".json", "", -1)) + } + if testMode { + abi.LastModDate = "--date--" + abi.Path = strings.ReplaceAll(abi.Path, config.PathToRootConfig(), ".") + } + if opts.Globals.Verbose { + contents := file.AsciiFileToString(filepath.Join(abi.Path, abi.Name)) + abi.NFunctions = int64(strings.Count(contents, "\"function\"")) + abi.NEvents = int64(strings.Count(contents, "\"event\"")) + } + abiArray = append(abiArray, abi) + } } + return true, nil } - return true, nil - } - for _, path := range paths { - _ = walk.ForEveryFileInFolder(path, vFunc, nil) - } - - fetchData := func(modelChan chan types.Modeler, errorChan chan error) { + opts.ForEveryAbi(true, vFunc, nil) for _, abi := range abiArray { - if opts.Globals.Verbose { - contents := file.AsciiFileToString(filepath.Join(abi.Path, abi.Name)) - abi.NFunctions = int64(strings.Count(contents, "\"function\"")) - abi.NEvents = int64(strings.Count(contents, "\"event\"")) - } - if testMode { - abi.LastModDate = "--date--" - abi.Path = strings.ReplaceAll(abi.Path, config.PathToRootConfig(), ".") - } modelChan <- &abi } } diff --git a/src/apps/chifra/internal/abis/options.go b/src/apps/chifra/internal/abis/options.go index db12822bd5..71aaeeba60 100644 --- a/src/apps/chifra/internal/abis/options.go +++ b/src/apps/chifra/internal/abis/options.go @@ -32,6 +32,7 @@ type AbisOptions struct { Known bool `json:"known,omitempty"` // Load common 'known' ABIs from cache ProxyFor string `json:"proxyFor,omitempty"` // Redirects the query to this implementation List bool `json:"list,omitempty"` // A list of downloaded abi files + Count bool `json:"count,omitempty"` // Show the number of abis downloaded Find []string `json:"find,omitempty"` // Search for function or event declarations given a four- or 32-byte code(s) Hint []string `json:"hint,omitempty"` // For the --find option only, provide hints to speed up the search Encode string `json:"encode,omitempty"` // Generate the 32-byte encoding for a given cannonical function or event signature @@ -50,6 +51,7 @@ func (opts *AbisOptions) testLog() { logger.TestLog(opts.Known, "Known: ", opts.Known) logger.TestLog(len(opts.ProxyFor) > 0, "ProxyFor: ", opts.ProxyFor) logger.TestLog(opts.List, "List: ", opts.List) + logger.TestLog(opts.Count, "Count: ", opts.Count) logger.TestLog(len(opts.Find) > 0, "Find: ", opts.Find) logger.TestLog(len(opts.Hint) > 0, "Hint: ", opts.Hint) logger.TestLog(len(opts.Encode) > 0, "Encode: ", opts.Encode) @@ -89,6 +91,8 @@ func AbisFinishParseInternal(w io.Writer, values url.Values) *AbisOptions { opts.ProxyFor = value[0] case "list": opts.List = true + case "count": + opts.Count = true case "find": for _, val := range value { s := strings.Split(val, " ") // may contain space separated items diff --git a/src/apps/chifra/internal/abis/output.go b/src/apps/chifra/internal/abis/output.go index 4ffba31e2c..eea7264c55 100644 --- a/src/apps/chifra/internal/abis/output.go +++ b/src/apps/chifra/internal/abis/output.go @@ -58,6 +58,8 @@ func (opts *AbisOptions) AbisInternal(rCtx *output.RenderCtx) error { err = opts.HandleDecache(rCtx) } else if len(opts.Find) > 0 { err = opts.HandleFind(rCtx) + } else if opts.Count { + err = opts.HandleCount(rCtx) } else if opts.List { err = opts.HandleList(rCtx) } else if len(opts.Encode) > 0 { diff --git a/src/apps/chifra/internal/abis/validate.go b/src/apps/chifra/internal/abis/validate.go index e2de00a2d7..6d7fce763d 100644 --- a/src/apps/chifra/internal/abis/validate.go +++ b/src/apps/chifra/internal/abis/validate.go @@ -42,6 +42,7 @@ func (opts *AbisOptions) validateAbis() error { if len(opts.Globals.File) == 0 && len(opts.Encode) == 0 && len(opts.Find) == 0 && + !opts.Count && !opts.List && !opts.Known && !opts.Globals.Decache { @@ -52,6 +53,11 @@ func (opts *AbisOptions) validateAbis() error { } } + other := len(opts.Encode) != 0 || len(opts.Find) != 0 || opts.Globals.Decache + if other && (opts.Count || opts.List) { + return validate.Usage("The {0} options must be used alone.", "--count and --list") + } + if len(opts.Find) > 0 && len(opts.Encode) > 0 { return validate.Usage("Please choose only one of {0}.", "--find or --encode") } diff --git a/src/apps/chifra/internal/abis/walk_folders.go b/src/apps/chifra/internal/abis/walk_folders.go new file mode 100644 index 0000000000..9fd366382d --- /dev/null +++ b/src/apps/chifra/internal/abis/walk_folders.go @@ -0,0 +1,26 @@ +package abisPkg + +import ( + "path/filepath" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" +) + +func (opts *AbisOptions) ForEveryAbi(known bool, vFunc walk.ForEveryFunc, errorChan chan error) { + chain := opts.Globals.Chain + testMode := opts.Globals.TestMode + + paths := make([]string, 0, 2) + if known { + paths = append(paths, filepath.Join(config.PathToRootConfig(), "abis")) + } + + if !testMode { + paths = append(paths, filepath.Join(config.PathToCache(chain), "abis")) + } + + for _, path := range paths { + _ = walk.ForEveryFileInFolder(path, vFunc, errorChan) + } +} diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index 14586b283a..280fc6b37f 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -101,14 +101,15 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 15200,tools,Accounts,names,ethNames,n2,,,,,note,,,,,,The `--match_case` option enables case sensitive matching. # 16000,tools,Accounts,abis,grabABI,,,,visible|docs,,command,,,Manage Abi files,[flags]
[address...],default|caching|names|,Fetches the ABI for a smart contract. -16020,tools,Accounts,abis,grabABI,addrs,,,required|visible|docs,4,positional,list,function,,,,a list of one or more smart contracts whose ABIs to display +16020,tools,Accounts,abis,grabABI,addrs,,,required|visible|docs,5,positional,list,function,,,,a list of one or more smart contracts whose ABIs to display 16030,tools,Accounts,abis,grabABI,known,k,,visible|docs,,switch,,,,,,load common 'known' ABIs from cache 16040,tools,Accounts,abis,grabABI,proxy_for,r,,visible|docs,,flag,
,,,,,redirects the query to this implementation -16030,tools,Accounts,abis,grabABI,list,l,,visible|docs,2,switch,,abi,,,,a list of downloaded abi files -16050,tools,Accounts,abis,grabABI,find,f,,visible|docs,1,flag,list,function,,,,search for function or event declarations given a four- or 32-byte code(s) -16060,tools,Accounts,abis,grabABI,hint,n,,visible|docs,,flag,list,,,,,for the --find option only, provide hints to speed up the search -16070,tools,Accounts,abis,grabABI,encode,e,,visible|docs,3,flag,,function,,,,generate the 32-byte encoding for a given cannonical function or event signature -16090,tools,Accounts,abis,grabABI,n1,,,,,note,,,,,,Search for either four byte signatures or event signatures with the --find option. +16050,tools,Accounts,abis,grabABI,list,l,,visible|docs,3,switch,,abi,,,,a list of downloaded abi files +16060,tools,Accounts,abis,grabABI,count,c,,visible|docs,2,switch,,count,,,,show the number of abis downloaded +16070,tools,Accounts,abis,grabABI,find,f,,visible|docs,1,flag,list,function,,,,search for function or event declarations given a four- or 32-byte code(s) +16080,tools,Accounts,abis,grabABI,hint,n,,visible|docs,,flag,list,,,,,for the --find option only, provide hints to speed up the search +16090,tools,Accounts,abis,grabABI,encode,e,,visible|docs,4,flag,,function,,,,generate the 32-byte encoding for a given cannonical function or event signature +16100,tools,Accounts,abis,grabABI,n1,,,,,note,,,,,,Search for either four byte signatures or event signatures with the --find option. # 21000,,Chain Data,,,,,,,,group,,,,,,Access and cache blockchain-related data # diff --git a/src/dev_tools/sdkFuzzer/abis.go b/src/dev_tools/sdkFuzzer/abis.go index ecccc567c9..81e3dda3be 100644 --- a/src/dev_tools/sdkFuzzer/abis.go +++ b/src/dev_tools/sdkFuzzer/abis.go @@ -136,6 +136,16 @@ func TestAbis(which, value, fn string, opts *sdk.AbisOptions) { ReportOkay(fn) } } + case "count": + if count, _, err := opts.AbisCount(); err != nil { + ReportError(fn, opts, err) + } else { + if err := SaveToFile[types.Count](fn, count); err != nil { + ReportError2(fn, err) + } else { + ReportOkay(fn) + } + } case "find": if find, _, err := opts.AbisFind([]string{value}); err != nil { ReportError(fn, opts, err) diff --git a/src/dev_tools/testRunner/testCases/abis.csv b/src/dev_tools/testRunner/testCases/abis.csv index df4f10e67c..e85d054270 100644 --- a/src/dev_tools/testRunner/testCases/abis.csv +++ b/src/dev_tools/testRunner/testCases/abis.csv @@ -66,10 +66,10 @@ on ,both ,fast ,abis ,tools ,grabABI ,clean_alone ,y ,decache on ,both ,fast ,abis ,tools ,grabABI ,list ,y ,list on ,both ,fast ,abis ,tools ,grabABI ,list_verbose ,y ,list & verbose -jink ,both ,fast ,abis ,tools ,grabABI ,count ,y ,count -jink ,both ,fast ,abis ,tools ,grabABI ,count_v ,y ,count -jink ,both ,fast ,abis ,tools ,grabABI ,count_list ,y ,count & list -jink ,both ,fast ,abis ,tools ,grabABI ,count_fail ,y ,count & find +on ,both ,fast ,abis ,tools ,grabABI ,count ,y ,count +on ,both ,fast ,abis ,tools ,grabABI ,count_v ,y ,count & no_header +on ,both ,fast ,abis ,tools ,grabABI ,count_list ,y ,count & list +on ,both ,fast ,abis ,tools ,grabABI ,count_fail ,y ,count & find = 0x1aa3a008 # Reports inconsistent results on subsequent runs delay ,both ,fast ,abis ,tools ,grabABI ,findSig_a_lot ,n ,find = 0xea8a1af0 & find = 0x9a82a09a & find = 0x52efea6e & find = 0xd0e30db0 & find = 0x83197ef0 & find = 0x12fa6feb & find = 0x3d6a71e4 & find = 0x31ae450b & find = 0x06fdde03 & find = 0x8da5cb5b & find = 0x1aa3a008 & find = 0x2de40ce3 & find = 0x9d76ea58 & find = 0xad7a672f & find = 0x3ccfd60b & find = 0xf5074f41 & find = 0x24d7806c & find = 0xc3c5a547 & find = 0x09e69ede & find = 0xf2fde38b & find = 0xc2a2ce06 & find = 0xfdacd576 & fmt = csv diff --git a/tests b/tests index a946cd4265..0eea16fa45 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit a946cd4265ba8ec3533b5d25f42f6b0eee799cd5 +Subproject commit 0eea16fa45d0695c137644b633e0acb883fc12e1 From 5cc6636e5ed7c8cbe2e42e9d0b34e3e75dcd8d41 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Fri, 23 Aug 2024 11:54:46 -0400 Subject: [PATCH 091/121] Fixes tests --- src/apps/chifra/internal/abis/handle_list.go | 8 ++++---- tests | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index 8d11c4d1c9..3d0f48f935 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -35,15 +35,15 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { if strings.HasPrefix(abi.Name, "0x") { abi.Address = base.HexToAddress(strings.Replace(abi.Name, ".json", "", -1)) } - if testMode { - abi.LastModDate = "--date--" - abi.Path = strings.ReplaceAll(abi.Path, config.PathToRootConfig(), ".") - } if opts.Globals.Verbose { contents := file.AsciiFileToString(filepath.Join(abi.Path, abi.Name)) abi.NFunctions = int64(strings.Count(contents, "\"function\"")) abi.NEvents = int64(strings.Count(contents, "\"event\"")) } + if testMode { + abi.LastModDate = "--date--" + abi.Path = strings.ReplaceAll(abi.Path, config.PathToRootConfig(), ".") + } abiArray = append(abiArray, abi) } } diff --git a/tests b/tests index 0eea16fa45..806f7d715c 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 0eea16fa45d0695c137644b633e0acb883fc12e1 +Subproject commit 806f7d715cb6fa4fc5c573c74f7dc4d1afcefa44 From 4f6bfbd631cb3f7ef772e4ad6a261faabe2ffc9d Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Fri, 23 Aug 2024 23:04:31 -0400 Subject: [PATCH 092/121] Implements first version of built in sorting for a type --- src/apps/chifra/internal/abis/handle_list.go | 9 +- src/apps/chifra/internal/globals/output.go | 4 +- .../chifra/internal/tokens/handle_parts.go | 12 +-- .../chifra/internal/tokens/handle_show.go | 12 +-- src/apps/chifra/pkg/types/namer.go | 2 +- src/apps/chifra/pkg/types/sort.go | 8 ++ src/apps/chifra/pkg/types/types_abi.go | 14 ++- src/apps/chifra/pkg/types/types_abi_sort.go | 85 +++++++++++++++++++ src/apps/chifra/pkg/types/types_abi_test.go | 69 +++++++++++++++ 9 files changed, 188 insertions(+), 27 deletions(-) create mode 100644 src/apps/chifra/pkg/types/sort.go create mode 100644 src/apps/chifra/pkg/types/types_abi_sort.go create mode 100644 src/apps/chifra/pkg/types/types_abi_test.go diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index 3d0f48f935..ce95e35f83 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -51,13 +51,20 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { } opts.ForEveryAbi(true, vFunc, nil) + // sort.Slice(abiArray, + // types.Cmp(abiArray, + // types.AbiBy(types.AbiIsKnown, types.Descending), + // types.AbiBy(types.AbiName, types.Ascending), + // ), + // ) for _, abi := range abiArray { modelChan <- &abi } } extraOpts := map[string]any{ - "list": true, + "list": true, + "loadNames": true, } return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOptsWithExtra(extraOpts)) } diff --git a/src/apps/chifra/internal/globals/output.go b/src/apps/chifra/internal/globals/output.go index 1dbd50085d..1a08535d94 100644 --- a/src/apps/chifra/internal/globals/output.go +++ b/src/apps/chifra/internal/globals/output.go @@ -17,7 +17,7 @@ func (opts *GlobalOptions) OutputOpts() output.OutputOptions { "ether": opts.Ether, "testMode": opts.TestMode, } - if opts.ShouldLoadNames(false) { + if opts.ShouldLoadNames(extraOpts["loadNames"] == true) { parts := types.Custom | types.Prefund | types.Regular if opts.TestMode { parts |= types.Testing @@ -45,7 +45,7 @@ func (opts *GlobalOptions) OutputOptsWithExtra(extraOpts map[string]any) output. if extraOpts != nil { extraOpts["ether"] = opts.Ether extraOpts["testMode"] = opts.TestMode - if opts.ShouldLoadNames(false) { + if opts.ShouldLoadNames(extraOpts["loadNames"] == true) { parts := types.Custom | types.Prefund | types.Regular if opts.TestMode { parts |= types.Testing diff --git a/src/apps/chifra/internal/tokens/handle_parts.go b/src/apps/chifra/internal/tokens/handle_parts.go index 1122062a31..f43ab69e7d 100644 --- a/src/apps/chifra/internal/tokens/handle_parts.go +++ b/src/apps/chifra/internal/tokens/handle_parts.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/names" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/tslib" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" @@ -55,15 +54,8 @@ func (opts *TokensOptions) HandleParts(rCtx *output.RenderCtx) error { } extraOpts := map[string]any{ - "parts": opts.Parts, - } - if opts.Globals.ShouldLoadNames(true) { - parts := types.Custom | types.Prefund | types.Regular - if namesMap, err := names.LoadNamesMap(chain, parts, nil); err != nil { - return err - } else { - extraOpts["namesMap"] = namesMap - } + "parts": opts.Parts, + "loadNames": true, } return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOptsWithExtra(extraOpts)) diff --git a/src/apps/chifra/internal/tokens/handle_show.go b/src/apps/chifra/internal/tokens/handle_show.go index 1420f943e9..8489220491 100644 --- a/src/apps/chifra/internal/tokens/handle_show.go +++ b/src/apps/chifra/internal/tokens/handle_show.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/names" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/tslib" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" @@ -58,15 +57,8 @@ func (opts *TokensOptions) HandleShow(rCtx *output.RenderCtx) error { } extraOpts := map[string]any{ - "parts": []string{"all_held"}, - } - if opts.Globals.ShouldLoadNames(true) { - parts := types.Custom | types.Prefund | types.Regular - if namesMap, err := names.LoadNamesMap(chain, parts, nil); err != nil { - return err - } else { - extraOpts["namesMap"] = namesMap - } + "parts": []string{"all_held"}, + "loadNames": true, } return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOptsWithExtra(extraOpts)) diff --git a/src/apps/chifra/pkg/types/namer.go b/src/apps/chifra/pkg/types/namer.go index b16bd933ee..5162a97333 100644 --- a/src/apps/chifra/pkg/types/namer.go +++ b/src/apps/chifra/pkg/types/namer.go @@ -17,7 +17,7 @@ func nameAddress(extraOpts map[string]any, address base.Address) (Name, bool, bo } name := extraOpts["namesMap"].(map[base.Address]Name)[address] - if name.Address.Hex() == "0x0" { + if name.Address.IsZero() { return Name{}, true, false } diff --git a/src/apps/chifra/pkg/types/sort.go b/src/apps/chifra/pkg/types/sort.go new file mode 100644 index 0000000000..1e40ddc2be --- /dev/null +++ b/src/apps/chifra/pkg/types/sort.go @@ -0,0 +1,8 @@ +package types + +type SortOrder bool + +const ( + Ascending SortOrder = true + Descending SortOrder = false +) diff --git a/src/apps/chifra/pkg/types/types_abi.go b/src/apps/chifra/pkg/types/types_abi.go index 09f312057f..b1e5fca333 100644 --- a/src/apps/chifra/pkg/types/types_abi.go +++ b/src/apps/chifra/pkg/types/types_abi.go @@ -43,20 +43,28 @@ func (s *Abi) Model(chain, format string, verbose bool, extraOpts map[string]any // EXISTING_CODE if extraOpts["list"] == true { model = map[string]any{ + "address": s.Address, "name": s.Name, "lastModDate": s.LastModDate, "fileSize": s.FileSize, "isKnown": s.IsKnown, } order = []string{ + "address", "name", "lastModDate", "fileSize", "isKnown", } - if !s.Address.IsZero() { - model["address"] = s.Address - order = append([]string{"address"}, order...) + + if s.IsKnown { + model["address"] = "" + } else { + if name, loaded, found := nameAddress(extraOpts, s.Address); found { + model["name"] = name.Name + } else if loaded { + model["name"] = "" + } } if verbose { diff --git a/src/apps/chifra/pkg/types/types_abi_sort.go b/src/apps/chifra/pkg/types/types_abi_sort.go new file mode 100644 index 0000000000..362d4dd9e7 --- /dev/null +++ b/src/apps/chifra/pkg/types/types_abi_sort.go @@ -0,0 +1,85 @@ +package types + +type AbiField string + +const ( + AbiAddress AbiField = "address" + AbiFileSize AbiField = "fileSize" + AbiNFunctions AbiField = "nFunctions" + AbiNEvents AbiField = "nEvents" + AbiIsKnown AbiField = "isKnown" + AbiLastModDate AbiField = "lastModDate" + AbiName AbiField = "name" +) + +func AbiBy(field AbiField, order SortOrder) func(p1, p2 Abi) bool { + switch field { + case AbiAddress: + return func(p1, p2 Abi) bool { + cmp := p1.Address.Cmp(p2.Address.Address) + if order == Ascending { + return cmp == -1 + } + return cmp == 1 + } + case AbiFileSize: + return func(p1, p2 Abi) bool { + if order == Ascending { + return p1.FileSize < p2.FileSize + } + return p1.FileSize > p2.FileSize + } + case AbiNFunctions: + return func(p1, p2 Abi) bool { + if order == Ascending { + return p1.NFunctions < p2.NFunctions + } + return p1.NFunctions > p2.NFunctions + } + case AbiNEvents: + return func(p1, p2 Abi) bool { + if order == Ascending { + return p1.NEvents < p2.NEvents + } + return p1.NEvents > p2.NEvents + } + case AbiIsKnown: + return func(p1, p2 Abi) bool { + if order == Ascending { + return !p1.IsKnown && p2.IsKnown // False < True + } + return p1.IsKnown && !p2.IsKnown // True < False + } + case AbiLastModDate: + return func(p1, p2 Abi) bool { + if order == Ascending { + return p1.LastModDate < p2.LastModDate + } + return p1.LastModDate > p2.LastModDate + } + case AbiName: + return func(p1, p2 Abi) bool { + if order == Ascending { + return p1.Name < p2.Name + } + return p1.Name > p2.Name + } + } + panic("Should not happen in AbiBy") +} + +// Cmp function that accepts a slice and variadic comparison functions +func Cmp(slice []Abi, orders ...func(p1, p2 Abi) bool) func(i, j int) bool { + return func(i, j int) bool { + p1, p2 := slice[i], slice[j] + for _, order := range orders { + if order(p1, p2) { + return true + } + if order(p2, p1) { + return false + } + } + return false + } +} diff --git a/src/apps/chifra/pkg/types/types_abi_test.go b/src/apps/chifra/pkg/types/types_abi_test.go new file mode 100644 index 0000000000..9d745c7c63 --- /dev/null +++ b/src/apps/chifra/pkg/types/types_abi_test.go @@ -0,0 +1,69 @@ +package types + +import ( + "reflect" + "sort" + "testing" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" +) + +func TestSortByAddressAscending(t *testing.T) { + abis := []Abi{ + {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + } + + expected := []Abi{ + {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + } + + sort.Slice(abis, Cmp(abis, AbiBy(AbiAddress, Ascending))) + + if !reflect.DeepEqual(abis, expected) { + t.Errorf("got %v, want %v", abis, expected) + } +} + +func TestSortByFileSizeDescending(t *testing.T) { + abis := []Abi{ + {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + } + + expected := []Abi{ + {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + } + + sort.Slice(abis, Cmp(abis, AbiBy(AbiFileSize, Descending))) + + if !reflect.DeepEqual(abis, expected) { + t.Errorf("got %v, want %v", abis, expected) + } +} + +func TestSortByIsKnownDescendingThenByNameAscending(t *testing.T) { + abis := []Abi{ + {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + } + + expected := []Abi{ + {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + } + + sort.Slice(abis, Cmp(abis, AbiBy(AbiIsKnown, Descending), AbiBy(AbiName, Ascending))) + + if !reflect.DeepEqual(abis, expected) { + t.Errorf("got %v, want %v", abis, expected) + } +} From a0254dc3f802d7369c75dc502c998e72d70633be Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Fri, 23 Aug 2024 23:33:53 -0400 Subject: [PATCH 093/121] Adds built in sorting test for ABIs and adds isEmpty field --- src/apps/chifra/internal/abis/handle_list.go | 7 +- src/apps/chifra/pkg/abi/download.go | 3 + src/apps/chifra/pkg/types/types_abi.go | 14 +++- src/apps/chifra/pkg/types/types_abi_sort.go | 8 +++ .../chifra/pkg/types/types_abi_sort_test.go | 69 +++++++++++++++++++ src/apps/chifra/pkg/types/types_abi_test.go | 69 ------------------- .../templates/classDefinitions/fields/abi.csv | 17 ++--- tests | 2 +- 8 files changed, 104 insertions(+), 85 deletions(-) create mode 100644 src/apps/chifra/pkg/types/types_abi_sort_test.go delete mode 100644 src/apps/chifra/pkg/types/types_abi_test.go diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index ce95e35f83..9d9b76b267 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -39,6 +39,7 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { contents := file.AsciiFileToString(filepath.Join(abi.Path, abi.Name)) abi.NFunctions = int64(strings.Count(contents, "\"function\"")) abi.NEvents = int64(strings.Count(contents, "\"event\"")) + abi.IsEmpty = abi.FileSize == 42 // See AbiNotFound } if testMode { abi.LastModDate = "--date--" @@ -51,12 +52,6 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { } opts.ForEveryAbi(true, vFunc, nil) - // sort.Slice(abiArray, - // types.Cmp(abiArray, - // types.AbiBy(types.AbiIsKnown, types.Descending), - // types.AbiBy(types.AbiName, types.Ascending), - // ), - // ) for _, abi := range abiArray { modelChan <- &abi } diff --git a/src/apps/chifra/pkg/abi/download.go b/src/apps/chifra/pkg/abi/download.go index b4fed73c92..330b601c3e 100644 --- a/src/apps/chifra/pkg/abi/download.go +++ b/src/apps/chifra/pkg/abi/download.go @@ -22,6 +22,9 @@ func init() { perfTiming = os.Getenv("TB_TIMER_ON") == "true" } +// DO NOT CHANGE THIS VALUE. It is used to cache the error response from Etherscan. +// It's length is 42 bytes and is used to test for this case + var AbiNotFound = `[{"name":"AbiNotFound","type":"function"}]` // downloadAbi downloads the ABI for the given address and saves it to the cache. diff --git a/src/apps/chifra/pkg/types/types_abi.go b/src/apps/chifra/pkg/types/types_abi.go index b1e5fca333..633b7e6cc6 100644 --- a/src/apps/chifra/pkg/types/types_abi.go +++ b/src/apps/chifra/pkg/types/types_abi.go @@ -18,10 +18,11 @@ import ( // EXISTING_CODE type Abi struct { - Address base.Address `json:"address"` + Address base.Address `json:"address,omitempty"` FileSize int64 `json:"fileSize"` Functions []Function `json:"functions"` IsKnown bool `json:"isKnown"` + IsEmpty bool `json:"isEmpty,omitempty"` LastModDate string `json:"lastModDate"` NEvents int64 `json:"nEvents"` NFunctions int64 `json:"nFunctions"` @@ -66,8 +67,19 @@ func (s *Abi) Model(chain, format string, verbose bool, extraOpts map[string]any model["name"] = "" } } + if format == "json" && s.Address.IsZero() { + delete(model, "address") + } if verbose { + if format == "json" { + if s.IsEmpty { + model["isEmpty"] = s.IsEmpty + } + } else { + model["isEmpty"] = s.IsEmpty + order = append(order, "isEmpty") + } model["nFunctions"] = s.NFunctions order = append(order, "nFunctions") model["nEvents"] = s.NEvents diff --git a/src/apps/chifra/pkg/types/types_abi_sort.go b/src/apps/chifra/pkg/types/types_abi_sort.go index 362d4dd9e7..23cf38904a 100644 --- a/src/apps/chifra/pkg/types/types_abi_sort.go +++ b/src/apps/chifra/pkg/types/types_abi_sort.go @@ -8,6 +8,7 @@ const ( AbiNFunctions AbiField = "nFunctions" AbiNEvents AbiField = "nEvents" AbiIsKnown AbiField = "isKnown" + AbiIsEmpty AbiField = "isEmpty" AbiLastModDate AbiField = "lastModDate" AbiName AbiField = "name" ) @@ -50,6 +51,13 @@ func AbiBy(field AbiField, order SortOrder) func(p1, p2 Abi) bool { } return p1.IsKnown && !p2.IsKnown // True < False } + case AbiIsEmpty: + return func(p1, p2 Abi) bool { + if order == Ascending { + return !p1.IsEmpty && p2.IsEmpty // False < True + } + return p1.IsEmpty && !p2.IsEmpty // True < False + } case AbiLastModDate: return func(p1, p2 Abi) bool { if order == Ascending { diff --git a/src/apps/chifra/pkg/types/types_abi_sort_test.go b/src/apps/chifra/pkg/types/types_abi_sort_test.go new file mode 100644 index 0000000000..68bd216018 --- /dev/null +++ b/src/apps/chifra/pkg/types/types_abi_sort_test.go @@ -0,0 +1,69 @@ +package types + +import ( + "reflect" + "sort" + "testing" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" +) + +func TestSortByAddressAscending(t *testing.T) { + abis := []Abi{ + {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + } + + expected := []Abi{ + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + } + + sort.Slice(abis, Cmp(abis, AbiBy(AbiAddress, Ascending))) + + if !reflect.DeepEqual(abis, expected) { + t.Errorf("got %v, want %v", abis, expected) + } +} + +func TestSortByFileSizeDescending(t *testing.T) { + abis := []Abi{ + {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + } + + expected := []Abi{ + {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + } + + sort.Slice(abis, Cmp(abis, AbiBy(AbiFileSize, Descending))) + + if !reflect.DeepEqual(abis, expected) { + t.Errorf("got %v, want %v", abis, expected) + } +} + +func TestSortByIsKnownDescendingThenByNameAscending(t *testing.T) { + abis := []Abi{ + {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + } + + expected := []Abi{ + {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + } + + sort.Slice(abis, Cmp(abis, AbiBy(AbiIsKnown, Descending), AbiBy(AbiName, Ascending))) + + if !reflect.DeepEqual(abis, expected) { + t.Errorf("got %v, want %v", abis, expected) + } +} diff --git a/src/apps/chifra/pkg/types/types_abi_test.go b/src/apps/chifra/pkg/types/types_abi_test.go deleted file mode 100644 index 9d745c7c63..0000000000 --- a/src/apps/chifra/pkg/types/types_abi_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package types - -import ( - "reflect" - "sort" - "testing" - - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" -) - -func TestSortByAddressAscending(t *testing.T) { - abis := []Abi{ - {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, - } - - expected := []Abi{ - {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, - {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - } - - sort.Slice(abis, Cmp(abis, AbiBy(AbiAddress, Ascending))) - - if !reflect.DeepEqual(abis, expected) { - t.Errorf("got %v, want %v", abis, expected) - } -} - -func TestSortByFileSizeDescending(t *testing.T) { - abis := []Abi{ - {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, - } - - expected := []Abi{ - {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, - } - - sort.Slice(abis, Cmp(abis, AbiBy(AbiFileSize, Descending))) - - if !reflect.DeepEqual(abis, expected) { - t.Errorf("got %v, want %v", abis, expected) - } -} - -func TestSortByIsKnownDescendingThenByNameAscending(t *testing.T) { - abis := []Abi{ - {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, - {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - } - - expected := []Abi{ - {base.HexToAddress("0x3"), 4096, []Function{}, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - {base.HexToAddress("0x2"), 2048, []Function{}, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x1"), 1024, []Function{}, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, - } - - sort.Slice(abis, Cmp(abis, AbiBy(AbiIsKnown, Descending), AbiBy(AbiName, Ascending))) - - if !reflect.DeepEqual(abis, expected) { - t.Errorf("got %v, want %v", abis, expected) - } -} diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv index e6569b05ff..665959c13c 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv @@ -1,10 +1,11 @@ name ,type ,strDefault ,attributes ,docOrder ,description -address ,address , , , 1 ,the address for the ABI -name ,string , , , 2 ,the filename of the ABI (likely the smart contract address) +address ,address , ,sorts , 1 ,the address for the ABI +name ,string , ,sorts , 2 ,the filename of the ABI (likely the smart contract address) path ,string , , , 3 ,the folder holding the abi file -fileSize ,int64 , , , 4 ,the size of this file on disc -lastModDate ,string , , , 5 ,the last update date of the file -isKnown ,bool , , , 6 ,true if this is the ABI for a known smart contract or protocol -nFunctions ,int64 , , , 7 ,if verbose, the number of functions in the ABI -nEvents ,int64 , , , 8 ,if verbose, the number of events in the ABI -functions ,[]Function , , , 9 ,the functions for this address +fileSize ,int64 , ,sorts , 4 ,the size of this file on disc +lastModDate ,string , ,sorts , 5 ,the last update date of the file +isKnown ,bool , ,sorts , 6 ,true if this is the ABI for a known smart contract or protocol +isEmpty ,bool , ,sorts , 7 ,true if the ABI could not be found (and won't be looked for again) +nFunctions ,int64 , ,sorts , 8 ,if verbose, the number of functions in the ABI +nEvents ,int64 , ,sorts , 9 ,if verbose, the number of events in the ABI +functions ,[]Function , , , 10 ,the functions for this address diff --git a/tests b/tests index 806f7d715c..7df1f9f3d5 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 806f7d715cb6fa4fc5c573c74f7dc4d1afcefa44 +Subproject commit 7df1f9f3d5a6c25a739cf87cdebb4957892115bd From 4323722f32ddf3ff6a7fa07282ff58340fd31254 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Fri, 23 Aug 2024 23:53:07 -0400 Subject: [PATCH 094/121] Fixes autogen for isEmpty --- docs | 2 +- sdk/typescript/src/types/abi.ts | 1 + src/apps/chifra/pkg/types/types_abi.go | 4 ++-- .../chifra/pkg/types/types_abi_sort_test.go | 24 +++++++++---------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/docs b/docs index 63a30daed9..c2ffd45a9e 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 63a30daed9f87973cb076c56d1410342179356b6 +Subproject commit c2ffd45a9e411a150dff8a1afc22705256ab8701 diff --git a/sdk/typescript/src/types/abi.ts b/sdk/typescript/src/types/abi.ts index 34bbbd7197..94ac57664c 100644 --- a/sdk/typescript/src/types/abi.ts +++ b/sdk/typescript/src/types/abi.ts @@ -14,6 +14,7 @@ export type Abi = { address: address fileSize: int64 functions: Function[] + isEmpty: boolean isKnown: boolean lastModDate: string nEvents: int64 diff --git a/src/apps/chifra/pkg/types/types_abi.go b/src/apps/chifra/pkg/types/types_abi.go index 633b7e6cc6..fb6afd1613 100644 --- a/src/apps/chifra/pkg/types/types_abi.go +++ b/src/apps/chifra/pkg/types/types_abi.go @@ -18,11 +18,11 @@ import ( // EXISTING_CODE type Abi struct { - Address base.Address `json:"address,omitempty"` + Address base.Address `json:"address"` FileSize int64 `json:"fileSize"` Functions []Function `json:"functions"` + IsEmpty bool `json:"isEmpty"` IsKnown bool `json:"isKnown"` - IsEmpty bool `json:"isEmpty,omitempty"` LastModDate string `json:"lastModDate"` NEvents int64 `json:"nEvents"` NFunctions int64 `json:"nFunctions"` diff --git a/src/apps/chifra/pkg/types/types_abi_sort_test.go b/src/apps/chifra/pkg/types/types_abi_sort_test.go index 68bd216018..d9f9e011f5 100644 --- a/src/apps/chifra/pkg/types/types_abi_sort_test.go +++ b/src/apps/chifra/pkg/types/types_abi_sort_test.go @@ -10,15 +10,15 @@ import ( func TestSortByAddressAscending(t *testing.T) { abis := []Abi{ - {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, } expected := []Abi{ {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, - {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, } sort.Slice(abis, Cmp(abis, AbiBy(AbiAddress, Ascending))) @@ -30,14 +30,14 @@ func TestSortByAddressAscending(t *testing.T) { func TestSortByFileSizeDescending(t *testing.T) { abis := []Abi{ - {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, } expected := []Abi{ - {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, } @@ -50,14 +50,14 @@ func TestSortByFileSizeDescending(t *testing.T) { func TestSortByIsKnownDescendingThenByNameAscending(t *testing.T) { abis := []Abi{ - {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, - {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, } expected := []Abi{ - {base.HexToAddress("0x3"), 4096, []Function{}, true, false, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - {base.HexToAddress("0x2"), 2048, []Function{}, true, false, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, } From 3c15d2d261505678191554bdb06426dfab797bb3 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 24 Aug 2024 10:27:05 -0400 Subject: [PATCH 095/121] Adds hasConstructor and hasFallback to Abi type; fixes tests --- docs | 2 +- sdk/abis.go | 26 +++++++ sdk/typescript/src/types/abi.ts | 2 + src/apps/chifra/internal/abis/handle_list.go | 8 ++ src/apps/chifra/pkg/types/types_abi.go | 35 ++++++--- src/apps/chifra/pkg/types/types_abi_sort.go | 73 +++++++++++++------ .../chifra/pkg/types/types_abi_sort_test.go | 42 +++++------ .../templates/classDefinitions/fields/abi.csv | 24 +++--- tests | 2 +- 9 files changed, 148 insertions(+), 66 deletions(-) diff --git a/docs b/docs index c2ffd45a9e..2a29141589 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit c2ffd45a9e411a150dff8a1afc22705256ab8701 +Subproject commit 2a29141589ff1cddccc8ee1df6a97824ac95e052 diff --git a/sdk/abis.go b/sdk/abis.go index 0a19e729e4..4cb33f94a7 100644 --- a/sdk/abis.go +++ b/sdk/abis.go @@ -12,6 +12,8 @@ import ( // EXISTING_CODE "encoding/json" + "fmt" + "sort" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" @@ -70,4 +72,28 @@ func (opts *AbisOptions) AbisEncode(val string) ([]types.Function, *types.MetaDa // No enums // EXISTING_CODE +type SortOrder = types.SortOrder + +const ( + Asc SortOrder = types.Ascending + Dec SortOrder = types.Descending +) + +func SortAbis(abis []types.Abi, fields []string, dir []SortOrder) error { + if len(fields) != len(dir) { + return fmt.Errorf("fields and dir must have the same length") + } + + sorts := make([]func(p1, p2 types.Abi) bool, len(fields)) + for i, field := range fields { + if !types.IsValidAbiField(field) { + return fmt.Errorf("%s is not an Abi sort field", field) + } + sorts[i] = types.AbiBy(types.AbiField(field), types.SortOrder(dir[i])) + } + + sort.Slice(abis, types.AbiCmp(abis, sorts...)) + return nil +} + // EXISTING_CODE diff --git a/sdk/typescript/src/types/abi.ts b/sdk/typescript/src/types/abi.ts index 94ac57664c..a5854827de 100644 --- a/sdk/typescript/src/types/abi.ts +++ b/sdk/typescript/src/types/abi.ts @@ -14,6 +14,8 @@ export type Abi = { address: address fileSize: int64 functions: Function[] + hasConstructor: boolean + hasFallback: boolean isEmpty: boolean isKnown: boolean lastModDate: string diff --git a/src/apps/chifra/internal/abis/handle_list.go b/src/apps/chifra/internal/abis/handle_list.go index 9d9b76b267..4eceb0ed55 100644 --- a/src/apps/chifra/internal/abis/handle_list.go +++ b/src/apps/chifra/internal/abis/handle_list.go @@ -39,7 +39,15 @@ func (opts *AbisOptions) HandleList(rCtx *output.RenderCtx) error { contents := file.AsciiFileToString(filepath.Join(abi.Path, abi.Name)) abi.NFunctions = int64(strings.Count(contents, "\"function\"")) abi.NEvents = int64(strings.Count(contents, "\"event\"")) + abi.HasConstructor = strings.Count(contents, "\"constructor\"") > 0 + abi.HasFallback = strings.Count(contents, "\"fallback\"") > 0 abi.IsEmpty = abi.FileSize == 42 // See AbiNotFound + if abi.IsEmpty { + abi.NFunctions = 0 + abi.NEvents = 0 + abi.HasConstructor = false + abi.HasFallback = false + } } if testMode { abi.LastModDate = "--date--" diff --git a/src/apps/chifra/pkg/types/types_abi.go b/src/apps/chifra/pkg/types/types_abi.go index fb6afd1613..79948b17fc 100644 --- a/src/apps/chifra/pkg/types/types_abi.go +++ b/src/apps/chifra/pkg/types/types_abi.go @@ -18,16 +18,18 @@ import ( // EXISTING_CODE type Abi struct { - Address base.Address `json:"address"` - FileSize int64 `json:"fileSize"` - Functions []Function `json:"functions"` - IsEmpty bool `json:"isEmpty"` - IsKnown bool `json:"isKnown"` - LastModDate string `json:"lastModDate"` - NEvents int64 `json:"nEvents"` - NFunctions int64 `json:"nFunctions"` - Name string `json:"name"` - Path string `json:"path"` + Address base.Address `json:"address"` + FileSize int64 `json:"fileSize"` + Functions []Function `json:"functions"` + HasConstructor bool `json:"hasConstructor"` + HasFallback bool `json:"hasFallback"` + IsEmpty bool `json:"isEmpty"` + IsKnown bool `json:"isKnown"` + LastModDate string `json:"lastModDate"` + NEvents int64 `json:"nEvents"` + NFunctions int64 `json:"nFunctions"` + Name string `json:"name"` + Path string `json:"path"` // EXISTING_CODE // EXISTING_CODE } @@ -84,6 +86,19 @@ func (s *Abi) Model(chain, format string, verbose bool, extraOpts map[string]any order = append(order, "nFunctions") model["nEvents"] = s.NEvents order = append(order, "nEvents") + if format == "json" { + if s.HasConstructor { + model["hasConstructor"] = s.HasConstructor + } + if s.HasFallback { + model["hasFallback"] = s.HasFallback + } + } else { + model["hasConstructor"] = s.HasConstructor + order = append(order, "hasConstructor") + model["hasFallback"] = s.HasFallback + order = append(order, "hasFallback") + } model["path"] = s.Path order = append(order, "path") } diff --git a/src/apps/chifra/pkg/types/types_abi_sort.go b/src/apps/chifra/pkg/types/types_abi_sort.go index 23cf38904a..95d35bea02 100644 --- a/src/apps/chifra/pkg/types/types_abi_sort.go +++ b/src/apps/chifra/pkg/types/types_abi_sort.go @@ -2,17 +2,31 @@ package types type AbiField string +// Fields in the Abi struct available for sorting. const ( - AbiAddress AbiField = "address" - AbiFileSize AbiField = "fileSize" - AbiNFunctions AbiField = "nFunctions" - AbiNEvents AbiField = "nEvents" - AbiIsKnown AbiField = "isKnown" - AbiIsEmpty AbiField = "isEmpty" - AbiLastModDate AbiField = "lastModDate" - AbiName AbiField = "name" + AbiAddress AbiField = "address" + AbiFileSize AbiField = "fileSize" + AbiHasConstructor AbiField = "hasConstructor" + AbiHasFallback AbiField = "hasFallback" + AbiIsEmpty AbiField = "isEmpty" + AbiIsKnown AbiField = "isKnown" + AbiLastModDate AbiField = "lastModDate" + AbiName AbiField = "name" + AbiNEvents AbiField = "nEvents" + AbiNFunctions AbiField = "nFunctions" ) +// IsValidAbiField returns true if the given field is a valid sortable Abi field. +func IsValidAbiField(field string) bool { + switch field { + case "address", "fileSize", "hasConstructor", "hasFallback", "isEmpty", "isKnown", "lastModDate", "name", "nEvents", "nFunctions": + return true + } + return false +} + +// AbiBy returns a comparison function for sorting Abi instances by the given field. +// These comparison functions may be strung together by the CmdAbis function. func AbiBy(field AbiField, order SortOrder) func(p1, p2 Abi) bool { switch field { case AbiAddress: @@ -30,33 +44,33 @@ func AbiBy(field AbiField, order SortOrder) func(p1, p2 Abi) bool { } return p1.FileSize > p2.FileSize } - case AbiNFunctions: + case AbiHasConstructor: return func(p1, p2 Abi) bool { if order == Ascending { - return p1.NFunctions < p2.NFunctions + return !p1.HasConstructor && p2.HasConstructor // False < True } - return p1.NFunctions > p2.NFunctions + return p1.HasConstructor && !p2.HasConstructor // True < False } - case AbiNEvents: + case AbiHasFallback: return func(p1, p2 Abi) bool { if order == Ascending { - return p1.NEvents < p2.NEvents + return !p1.HasFallback && p2.HasFallback // False < True } - return p1.NEvents > p2.NEvents + return p1.HasFallback && !p2.HasFallback // True < False } - case AbiIsKnown: + case AbiIsEmpty: return func(p1, p2 Abi) bool { if order == Ascending { - return !p1.IsKnown && p2.IsKnown // False < True + return !p1.IsEmpty && p2.IsEmpty // False < True } - return p1.IsKnown && !p2.IsKnown // True < False + return p1.IsEmpty && !p2.IsEmpty // True < False } - case AbiIsEmpty: + case AbiIsKnown: return func(p1, p2 Abi) bool { if order == Ascending { - return !p1.IsEmpty && p2.IsEmpty // False < True + return !p1.IsKnown && p2.IsKnown // False < True } - return p1.IsEmpty && !p2.IsEmpty // True < False + return p1.IsKnown && !p2.IsKnown // True < False } case AbiLastModDate: return func(p1, p2 Abi) bool { @@ -72,12 +86,27 @@ func AbiBy(field AbiField, order SortOrder) func(p1, p2 Abi) bool { } return p1.Name > p2.Name } + case AbiNEvents: + return func(p1, p2 Abi) bool { + if order == Ascending { + return p1.NEvents < p2.NEvents + } + return p1.NEvents > p2.NEvents + } + case AbiNFunctions: + return func(p1, p2 Abi) bool { + if order == Ascending { + return p1.NFunctions < p2.NFunctions + } + return p1.NFunctions > p2.NFunctions + } } panic("Should not happen in AbiBy") } -// Cmp function that accepts a slice and variadic comparison functions -func Cmp(slice []Abi, orders ...func(p1, p2 Abi) bool) func(i, j int) bool { +// AbiCmp accepts a slice and variadic comparison functions and returns a functions +// that can be used to sort the slice. +func AbiCmp(slice []Abi, orders ...func(p1, p2 Abi) bool) func(i, j int) bool { return func(i, j int) bool { p1, p2 := slice[i], slice[j] for _, order := range orders { diff --git a/src/apps/chifra/pkg/types/types_abi_sort_test.go b/src/apps/chifra/pkg/types/types_abi_sort_test.go index d9f9e011f5..94bb78e0fe 100644 --- a/src/apps/chifra/pkg/types/types_abi_sort_test.go +++ b/src/apps/chifra/pkg/types/types_abi_sort_test.go @@ -10,18 +10,18 @@ import ( func TestSortByAddressAscending(t *testing.T) { abis := []Abi{ - {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, false, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, false, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, } expected := []Abi{ - {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, - {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, false, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, false, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, } - sort.Slice(abis, Cmp(abis, AbiBy(AbiAddress, Ascending))) + sort.Slice(abis, AbiCmp(abis, AbiBy(AbiAddress, Ascending))) if !reflect.DeepEqual(abis, expected) { t.Errorf("got %v, want %v", abis, expected) @@ -30,18 +30,18 @@ func TestSortByAddressAscending(t *testing.T) { func TestSortByFileSizeDescending(t *testing.T) { abis := []Abi{ - {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, false, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, false, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, } expected := []Abi{ - {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, false, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, false, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, } - sort.Slice(abis, Cmp(abis, AbiBy(AbiFileSize, Descending))) + sort.Slice(abis, AbiCmp(abis, AbiBy(AbiFileSize, Descending))) if !reflect.DeepEqual(abis, expected) { t.Errorf("got %v, want %v", abis, expected) @@ -50,18 +50,18 @@ func TestSortByFileSizeDescending(t *testing.T) { func TestSortByIsKnownDescendingThenByNameAscending(t *testing.T) { abis := []Abi{ - {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, - {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, false, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, false, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, } expected := []Abi{ - {base.HexToAddress("0x3"), 4096, []Function{}, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, - {base.HexToAddress("0x2"), 2048, []Function{}, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, - {base.HexToAddress("0x1"), 1024, []Function{}, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, + {base.HexToAddress("0x3"), 4096, []Function{}, false, false, false, true, "2024-08-03", 12, 3, "AbiThree", "/path/three"}, + {base.HexToAddress("0x2"), 2048, []Function{}, false, false, false, true, "2024-08-01", 10, 5, "AbiTwo", "/path/two"}, + {base.HexToAddress("0x1"), 1024, []Function{}, false, false, false, false, "2024-08-02", 8, 6, "AbiOne", "/path/one"}, } - sort.Slice(abis, Cmp(abis, AbiBy(AbiIsKnown, Descending), AbiBy(AbiName, Ascending))) + sort.Slice(abis, AbiCmp(abis, AbiBy(AbiIsKnown, Descending), AbiBy(AbiName, Ascending))) if !reflect.DeepEqual(abis, expected) { t.Errorf("got %v, want %v", abis, expected) diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv index 665959c13c..04061184b4 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/abi.csv @@ -1,11 +1,13 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -address ,address , ,sorts , 1 ,the address for the ABI -name ,string , ,sorts , 2 ,the filename of the ABI (likely the smart contract address) -path ,string , , , 3 ,the folder holding the abi file -fileSize ,int64 , ,sorts , 4 ,the size of this file on disc -lastModDate ,string , ,sorts , 5 ,the last update date of the file -isKnown ,bool , ,sorts , 6 ,true if this is the ABI for a known smart contract or protocol -isEmpty ,bool , ,sorts , 7 ,true if the ABI could not be found (and won't be looked for again) -nFunctions ,int64 , ,sorts , 8 ,if verbose, the number of functions in the ABI -nEvents ,int64 , ,sorts , 9 ,if verbose, the number of events in the ABI -functions ,[]Function , , , 10 ,the functions for this address +name ,type ,strDefault ,attributes ,docOrder ,description +address ,address , ,sorts , 1 ,the address for the ABI +name ,string , ,sorts , 2 ,the filename of the ABI (likely the smart contract address) +path ,string , , , 3 ,the folder holding the abi file +fileSize ,int64 , ,sorts , 4 ,the size of this file on disc +lastModDate ,string , ,sorts , 5 ,the last update date of the file +isKnown ,bool , ,sorts , 6 ,true if this is the ABI for a known smart contract or protocol +isEmpty ,bool , ,sorts , 7 ,true if the ABI could not be found (and won't be looked for again) +nFunctions ,int64 , ,sorts , 8 ,if verbose, the number of functions in the ABI +nEvents ,int64 , ,sorts , 9 ,if verbose, the number of events in the ABI +hasConstructor ,bool , ,sorts , 10 ,if verbose and the abi has a constructor, then `true`, else `false` +hasFallback ,bool , ,sorts , 11 ,if verbose and the abi has a fallback, then `true`, else `false` +functions ,[]Function , , , 12 ,the functions for this address diff --git a/tests b/tests index 7df1f9f3d5..d45940aa59 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 7df1f9f3d5a6c25a739cf87cdebb4957892115bd +Subproject commit d45940aa5996923c652f0e228d55ae82b15c4765 From f3d04c84a6998016a8dd27bd91710164588d45c2 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 24 Aug 2024 11:58:50 -0400 Subject: [PATCH 096/121] Updates go.mods --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index d561825032..d3e5c23538 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index 6819947092..9ded82dce9 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index 9502b44e3f..11381249be 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index a4112d904d..b0ebdc8da1 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index bb2cee2264..433bff74a0 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index a4112d904d..b0ebdc8da1 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index 46fa3c52c1..f2dbffe6c6 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index a4112d904d..b0ebdc8da1 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index 536571978e..331ab58c15 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index a4112d904d..b0ebdc8da1 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index 2f4ddc0e62..9caf955278 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index d181ac6ffc..02bb0be85b 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index b0f8fd9936..06f34359dd 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index 4c3403f1bb..061a2faed5 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index 2a10fd5d89..3300617e83 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index 578ce5463d..cd86c27921 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index 302a853a8f..3c0d560175 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index a4112d904d..b0ebdc8da1 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index b341e621eb..6d57791ee3 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index a4112d904d..b0ebdc8da1 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20 h1:KmnMcqV/igrDtHqSUEQCUu1irdC+jSvUnzUbqp/JKYQ= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240822005808-46dd505c9f20/go.mod h1:HFhl/nStkQhRw6ZoS/FvLG7TG0f+MjcrZEGL59GcFIw= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20 h1:IVoG/6iq+9OVIjj070jul+EV1L2WkuLm7yPDRdHBGQE= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240822005808-46dd505c9f20/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From 537aa5c6a4a4aa11a95c2f28daa4add59cb65c4f Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 25 Aug 2024 18:29:48 -0400 Subject: [PATCH 097/121] Adds --count to chifra monitors --- docs | 2 +- sdk/monitors.go | 7 + sdk/monitors_internal.go | 4 +- sdk/python/src/_monitors.py | 3 +- sdk/typescript/src/paths/monitors.ts | 5 +- src/apps/chifra/cmd/monitors.go | 3 +- src/apps/chifra/internal/monitors/README.md | 3 +- .../chifra/internal/monitors/handle_clean.go | 1 + .../chifra/internal/monitors/handle_count.go | 46 ++++++ src/apps/chifra/internal/monitors/options.go | 4 + src/apps/chifra/internal/monitors/output.go | 2 + src/apps/chifra/internal/monitors/validate.go | 132 +++++++++--------- .../goMaker/templates/cmd-line-options.csv | 11 +- src/dev_tools/sdkFuzzer/monitors.go | 10 ++ .../testRunner/testCases/monitors.csv | 3 + tests | 2 +- 16 files changed, 160 insertions(+), 78 deletions(-) create mode 100644 src/apps/chifra/internal/monitors/handle_count.go diff --git a/docs b/docs index 2a29141589..9840ce0dc9 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 2a29141589ff1cddccc8ee1df6a97824ac95e052 +Subproject commit 9840ce0dc92265210e460462be4418cf09012bdd diff --git a/sdk/monitors.go b/sdk/monitors.go index c30380d2c8..d1e5483c89 100644 --- a/sdk/monitors.go +++ b/sdk/monitors.go @@ -58,6 +58,13 @@ func (opts *MonitorsOptions) MonitorsList() ([]types.Monitor, *types.MetaData, e return queryMonitors[types.Monitor](in) } +// MonitorsCount implements the chifra monitors --count command. +func (opts *MonitorsOptions) MonitorsCount() ([]types.Count, *types.MetaData, error) { + in := opts.toInternal() + in.Count = true + return queryMonitors[types.Count](in) +} + // No enums // EXISTING_CODE // EXISTING_CODE diff --git a/sdk/monitors_internal.go b/sdk/monitors_internal.go index 4ef123c977..54780c4868 100644 --- a/sdk/monitors_internal.go +++ b/sdk/monitors_internal.go @@ -28,6 +28,7 @@ type monitorsOptionsInternal struct { Remove bool `json:"remove,omitempty"` Clean bool `json:"clean,omitempty"` List bool `json:"list,omitempty"` + Count bool `json:"count,omitempty"` Watch bool `json:"watch,omitempty"` Watchlist string `json:"watchlist,omitempty"` Commands string `json:"commands,omitempty"` @@ -85,7 +86,8 @@ func GetMonitorsOptions(args []string) (*monitorsOptionsInternal, error) { type monitorsGeneric interface { types.Message | types.MonitorClean | - types.Monitor + types.Monitor | + types.Count } func queryMonitors[T monitorsGeneric](opts *monitorsOptionsInternal) ([]T, *types.MetaData, error) { diff --git a/sdk/python/src/_monitors.py b/sdk/python/src/_monitors.py index e9074f9433..76d6905298 100644 --- a/sdk/python/src/_monitors.py +++ b/sdk/python/src/_monitors.py @@ -17,9 +17,10 @@ "remove": {"hotkey": "", "type": "switch"}, "clean": {"hotkey": "-C", "type": "switch"}, "list": {"hotkey": "-l", "type": "switch"}, + "count": {"hotkey": "-c", "type": "switch"}, "watch": {"hotkey": "-w", "type": "switch"}, "watchlist": {"hotkey": "-a", "type": "flag"}, - "commands": {"hotkey": "-c", "type": "flag"}, + "commands": {"hotkey": "-d", "type": "flag"}, "batchSize": {"hotkey": "-b", "type": "flag"}, "runCount": {"hotkey": "-u", "type": "flag"}, "sleep": {"hotkey": "-s", "type": "flag"}, diff --git a/sdk/typescript/src/paths/monitors.ts b/sdk/typescript/src/paths/monitors.ts index 6a2fbeae6f..8916f06f7f 100644 --- a/sdk/typescript/src/paths/monitors.ts +++ b/sdk/typescript/src/paths/monitors.ts @@ -9,7 +9,7 @@ */ import * as ApiCallers from '../lib/api_callers'; -import { address, float64, Message, Monitor, MonitorClean, uint64 } from '../types'; +import { address, Count, float64, Message, Monitor, MonitorClean, uint64 } from '../types'; export function getMonitors( parameters?: { @@ -19,6 +19,7 @@ export function getMonitors( remove?: boolean, clean?: boolean, list?: boolean, + count?: boolean, watch?: boolean, watchlist?: string, commands?: string, @@ -33,7 +34,7 @@ export function getMonitors( }, options?: RequestInit, ) { - return ApiCallers.fetch( + return ApiCallers.fetch( { endpoint: '/monitors', method: 'get', parameters, options }, ); } diff --git a/src/apps/chifra/cmd/monitors.go b/src/apps/chifra/cmd/monitors.go index e3ebb81162..002862c225 100644 --- a/src/apps/chifra/cmd/monitors.go +++ b/src/apps/chifra/cmd/monitors.go @@ -65,9 +65,10 @@ func init() { monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Remove, "remove", "", false, `remove a previously deleted monitor`) monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Clean, "clean", "C", false, `clean (i.e. remove duplicate appearances) from monitors`) monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().List, "list", "l", false, `list monitors in the cache (--verbose for more detail)`) + monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Count, "count", "c", false, `show the number of active monitors (included deleted but not removed monitors)`) monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Watch, "watch", "w", false, `continually scan for new blocks and extract data as per the command file`) monitorsCmd.Flags().StringVarP(&monitorsPkg.GetOptions().Watchlist, "watchlist", "a", "", `available with --watch option only, a file containing the addresses to watch`) - monitorsCmd.Flags().StringVarP(&monitorsPkg.GetOptions().Commands, "commands", "c", "", `available with --watch option only, the file containing the list of commands to apply to each watched address`) + monitorsCmd.Flags().StringVarP(&monitorsPkg.GetOptions().Commands, "commands", "d", "", `available with --watch option only, the file containing the list of commands to apply to each watched address`) monitorsCmd.Flags().Uint64VarP(&monitorsPkg.GetOptions().BatchSize, "batch_size", "b", 8, `available with --watch option only, the number of monitors to process in each batch`) monitorsCmd.Flags().Uint64VarP(&monitorsPkg.GetOptions().RunCount, "run_count", "u", 0, `available with --watch option only, run the monitor this many times, then quit`) monitorsCmd.Flags().Float64VarP(&monitorsPkg.GetOptions().Sleep, "sleep", "s", 14, `available with --watch option only, the number of seconds to sleep between runs`) diff --git a/src/apps/chifra/internal/monitors/README.md b/src/apps/chifra/internal/monitors/README.md index ae02c4569c..ef7d092f8d 100644 --- a/src/apps/chifra/internal/monitors/README.md +++ b/src/apps/chifra/internal/monitors/README.md @@ -58,9 +58,10 @@ Flags: --remove remove a previously deleted monitor -C, --clean clean (i.e. remove duplicate appearances) from monitors -l, --list list monitors in the cache (--verbose for more detail) + -c, --count show the number of active monitors (included deleted but not removed monitors) -w, --watch continually scan for new blocks and extract data as per the command file -a, --watchlist string available with --watch option only, a file containing the addresses to watch - -c, --commands string available with --watch option only, the file containing the list of commands to apply to each watched address + -d, --commands string available with --watch option only, the file containing the list of commands to apply to each watched address -b, --batch_size uint available with --watch option only, the number of monitors to process in each batch (default 8) -u, --run_count uint available with --watch option only, run the monitor this many times, then quit -s, --sleep float available with --watch option only, the number of seconds to sleep between runs (default 14) diff --git a/src/apps/chifra/internal/monitors/handle_clean.go b/src/apps/chifra/internal/monitors/handle_clean.go index 9ce46f080f..bfa6c80a38 100644 --- a/src/apps/chifra/internal/monitors/handle_clean.go +++ b/src/apps/chifra/internal/monitors/handle_clean.go @@ -43,6 +43,7 @@ func (opts *MonitorsOptions) HandleClean(rCtx *output.RenderCtx) error { if s.SizeThen > 0 { modelChan <- &s } + // delete empty monitors } } diff --git a/src/apps/chifra/internal/monitors/handle_count.go b/src/apps/chifra/internal/monitors/handle_count.go new file mode 100644 index 0000000000..cfc0b1e3da --- /dev/null +++ b/src/apps/chifra/internal/monitors/handle_count.go @@ -0,0 +1,46 @@ +// Copyright 2021 The TrueBlocks Authors. All rights reserved. +// Use of this source code is governed by a license that can +// be found in the LICENSE file. + +package monitorsPkg + +import ( + "path/filepath" + "strings" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" +) + +// HandleCount handles the chifra abis --count command. +func (opts *MonitorsOptions) HandleCount(rCtx *output.RenderCtx) error { + testMode := opts.Globals.TestMode + chain := opts.Globals.Chain + + fetchData := func(modelChan chan types.Modeler, errorChan chan error) { + count := uint64(0) + if testMode { + count = 199 + } else { + vFunc := func(fn string, vP any) (bool, error) { + _, name := filepath.Split(fn) + if !strings.Contains(fn, "staging") && strings.HasSuffix(name, ".bin") { + count++ + } + return true, nil + } + path := filepath.Join(config.PathToCache(chain), "monitors") + _ = walk.ForEveryFileInFolder(path, vFunc, errorChan) + } + + s := types.Count{ + Count: count, + } + + modelChan <- &s + } + + return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) +} diff --git a/src/apps/chifra/internal/monitors/options.go b/src/apps/chifra/internal/monitors/options.go index 0bc75fd242..976a4076dd 100644 --- a/src/apps/chifra/internal/monitors/options.go +++ b/src/apps/chifra/internal/monitors/options.go @@ -34,6 +34,7 @@ type MonitorsOptions struct { Remove bool `json:"remove,omitempty"` // Remove a previously deleted monitor Clean bool `json:"clean,omitempty"` // Clean (i.e. remove duplicate appearances) from monitors List bool `json:"list,omitempty"` // List monitors in the cache (--verbose for more detail) + Count bool `json:"count,omitempty"` // Show the number of active monitors (included deleted but not removed monitors) Watch bool `json:"watch,omitempty"` // Continually scan for new blocks and extract data as per the command file Watchlist string `json:"watchlist,omitempty"` // Available with --watch option only, a file containing the addresses to watch Commands string `json:"commands,omitempty"` // Available with --watch option only, the file containing the list of commands to apply to each watched address @@ -60,6 +61,7 @@ func (opts *MonitorsOptions) testLog() { logger.TestLog(opts.Remove, "Remove: ", opts.Remove) logger.TestLog(opts.Clean, "Clean: ", opts.Clean) logger.TestLog(opts.List, "List: ", opts.List) + logger.TestLog(opts.Count, "Count: ", opts.Count) logger.TestLog(opts.Watch, "Watch: ", opts.Watch) logger.TestLog(len(opts.Watchlist) > 0, "Watchlist: ", opts.Watchlist) logger.TestLog(len(opts.Commands) > 0, "Commands: ", opts.Commands) @@ -108,6 +110,8 @@ func MonitorsFinishParseInternal(w io.Writer, values url.Values) *MonitorsOption opts.Clean = true case "list": opts.List = true + case "count": + opts.Count = true case "watch": opts.Watch = true case "watchlist": diff --git a/src/apps/chifra/internal/monitors/output.go b/src/apps/chifra/internal/monitors/output.go index e390a1dce3..f9086e2a3f 100644 --- a/src/apps/chifra/internal/monitors/output.go +++ b/src/apps/chifra/internal/monitors/output.go @@ -76,6 +76,8 @@ func (opts *MonitorsOptions) MonitorsInternal(rCtx *output.RenderCtx) error { // EXISTING_CODE if opts.Globals.Decache { err = opts.HandleDecache(rCtx) + } else if opts.Count { + err = opts.HandleCount(rCtx) } else if opts.Clean { err = opts.HandleClean(rCtx) } else if opts.List { diff --git a/src/apps/chifra/internal/monitors/validate.go b/src/apps/chifra/internal/monitors/validate.go index 4f79ddb989..3427296fa6 100644 --- a/src/apps/chifra/internal/monitors/validate.go +++ b/src/apps/chifra/internal/monitors/validate.go @@ -32,89 +32,91 @@ func (opts *MonitorsOptions) validateMonitors() error { // All other options are ignored } else { - if opts.Watch { - if opts.Globals.IsApiMode() { - return validate.Usage("The {0} options is not available from the API", "--watch") - } - - if len(opts.Globals.File) > 0 { - return validate.Usage("The {0} option is not allowed with the {1} option. Use {2} instead.", "--file", "--watch", "--commands") - } - - if len(opts.Commands) == 0 { - return validate.Usage("The {0} option requires {1}.", "--watch", "a --commands file") - } else { - cmdFile, err := filepath.Abs(opts.Commands) - if err != nil || !file.FileExists(cmdFile) { - return validate.Usage("The {0} option requires {1} to exist.", "--watch", opts.Commands) + // Count dominates if present + if !opts.Count { + if opts.Watch { + if opts.Globals.IsApiMode() { + return validate.Usage("The {0} options is not available from the API", "--watch") } - if file.FileSize(cmdFile) == 0 { - logger.Fatal(validate.Usage("The file you specified ({0}) was found but contained no commands.", cmdFile).Error()) + + if len(opts.Globals.File) > 0 { + return validate.Usage("The {0} option is not allowed with the {1} option. Use {2} instead.", "--file", "--watch", "--commands") } - } - if len(opts.Watchlist) == 0 { - return validate.Usage("The {0} option requires {1}.", "--watch", "a --watchlist file") - } else { - if opts.Watchlist != "existing" { - watchList, err := filepath.Abs(opts.Watchlist) - if err != nil || !file.FileExists(watchList) { - return validate.Usage("The {0} option requires {1} to exist.", "--watch", opts.Watchlist) + if len(opts.Commands) == 0 { + return validate.Usage("The {0} option requires {1}.", "--watch", "a --commands file") + } else { + cmdFile, err := filepath.Abs(opts.Commands) + if err != nil || !file.FileExists(cmdFile) { + return validate.Usage("The {0} option requires {1} to exist.", "--watch", opts.Commands) } - if file.FileSize(watchList) == 0 { - logger.Fatal(validate.Usage("The file you specified ({0}) was found but contained no addresses.", watchList).Error()) + if file.FileSize(cmdFile) == 0 { + logger.Fatal(validate.Usage("The file you specified ({0}) was found but contained no commands.", cmdFile).Error()) } } - } - if err := index.IsInitialized(chain, config.ExpectedVersion()); err != nil { - if (errors.Is(err, index.ErrNotInitialized) || errors.Is(err, index.ErrIncorrectHash)) && !opts.Globals.IsApiMode() { - logger.Fatal(err) + if len(opts.Watchlist) == 0 { + return validate.Usage("The {0} option requires {1}.", "--watch", "a --watchlist file") + } else { + if opts.Watchlist != "existing" { + watchList, err := filepath.Abs(opts.Watchlist) + if err != nil || !file.FileExists(watchList) { + return validate.Usage("The {0} option requires {1} to exist.", "--watch", opts.Watchlist) + } + if file.FileSize(watchList) == 0 { + logger.Fatal(validate.Usage("The file you specified ({0}) was found but contained no addresses.", watchList).Error()) + } + } } - return err - } - if opts.BatchSize < 1 { - return validate.Usage("The {0} option must be greater than zero.", "--batch_size") - } + if err := index.IsInitialized(chain, config.ExpectedVersion()); err != nil { + if (errors.Is(err, index.ErrNotInitialized) || errors.Is(err, index.ErrIncorrectHash)) && !opts.Globals.IsApiMode() { + logger.Fatal(err) + } + return err + } - } else { - if opts.BatchSize != 8 { - return validate.Usage("The {0} option is not available{1}.", "--batch_size", " without --watch") + if opts.BatchSize < 1 { + return validate.Usage("The {0} option must be greater than zero.", "--batch_size") + } } else { - opts.BatchSize = 0 - } + if opts.BatchSize != 8 { + return validate.Usage("The {0} option is not available{1}.", "--batch_size", " without --watch") + } else { + opts.BatchSize = 0 + } - if opts.RunCount > 0 { - return validate.Usage("The {0} option is not available{1}.", "--run_count", " without --watch") - } + if opts.RunCount > 0 { + return validate.Usage("The {0} option is not available{1}.", "--run_count", " without --watch") + } - if opts.Sleep != 14 { - return validate.Usage("The {0} option is not available{1}.", "--sleep", " without --watch") - } + if opts.Sleep != 14 { + return validate.Usage("The {0} option is not available{1}.", "--sleep", " without --watch") + } - // We validate some of the simpler curd commands here and the rest in HandleCrud - if opts.Undelete { - if opts.Delete || opts.Remove { - return validate.Usage("The --undelete option may not be used with --delete or --remove.") + // We validate some of the simpler curd commands here and the rest in HandleCrud + if opts.Undelete { + if opts.Delete || opts.Remove { + return validate.Usage("The --undelete option may not be used with --delete or --remove.") + } } - } - if !opts.Clean && len(opts.Addrs) == 0 { - return validate.Usage("You must provide at least one Ethereum address for this command.") - } + if !opts.Clean && len(opts.Addrs) == 0 { + return validate.Usage("You must provide at least one Ethereum address for this command.") + } - if !opts.Clean && !opts.Delete && !opts.Undelete && !opts.Remove && !opts.Globals.Decache { - return validate.Usage("Please provide either --clean or one of the CRUD commands.") - } + if !opts.Clean && !opts.Delete && !opts.Undelete && !opts.Remove && !opts.Globals.Decache { + return validate.Usage("Please provide either --clean or one of the CRUD commands.") + } - if !opts.Globals.IsApiMode() && !opts.Clean { - if len(opts.Globals.File) > 0 { - // Do nothing - } else { - err := validate.ValidateAtLeastOneNonSentinal(opts.Addrs) - if err != nil { - return err + if !opts.Globals.IsApiMode() && !opts.Clean { + if len(opts.Globals.File) > 0 { + // Do nothing + } else { + err := validate.ValidateAtLeastOneNonSentinal(opts.Addrs) + if err != nil { + return err + } } } } diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index 280fc6b37f..1280f863e8 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -61,15 +61,16 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 13430,apps,Accounts,export,acctExport,n12,,,,,note,,,,,,The --traces option requires your RPC to provide trace data. See the README for more information. # 14000,apps,Accounts,monitors,acctExport,,,,visible|docs,,command,,,Manage monitors,[flags]
[address...],default|caching|names|,Add, remove, clean, and list address monitors. -14020,apps,Accounts,monitors,acctExport,addrs,,,visible|docs,4,positional,list,message,,,,one or more addresses (0x...) to process +14020,apps,Accounts,monitors,acctExport,addrs,,,visible|docs,5,positional,list,message,,,,one or more addresses (0x...) to process 14030,apps,Accounts,monitors,acctExport,delete,,,visible|docs|crud,,switch,,,,,,delete a monitor, but do not remove it 14040,apps,Accounts,monitors,acctExport,undelete,,,visible|docs|crud,,switch,,,,,,undelete a previously deleted monitor 14050,apps,Accounts,monitors,acctExport,remove,,,visible|docs|crud,,switch,,,,,,remove a previously deleted monitor -14060,apps,Accounts,monitors,acctExport,clean,C,,visible|docs,1,switch,,monitorClean,,,,clean (i.e. remove duplicate appearances) from monitors -14070,apps,Accounts,monitors,acctExport,list,l,,visible|docs,2,switch,,monitor,,,,list monitors in the cache (--verbose for more detail) -14080,apps,Accounts,monitors,acctExport,watch,w,,visible|docs|notApi,3,switch,,,,,,continually scan for new blocks and extract data as per the command file +14060,apps,Accounts,monitors,acctExport,clean,C,,visible|docs,2,switch,,monitorClean,,,,clean (i.e. remove duplicate appearances) from monitors +14070,apps,Accounts,monitors,acctExport,list,l,,visible|docs,3,switch,,monitor,,,,list monitors in the cache (--verbose for more detail) +14075,apps,Accounts,monitors,acctExport,count,c,,visible|docs,1,switch,,count,,,,show the number of active monitors (included deleted but not removed monitors) +14080,apps,Accounts,monitors,acctExport,watch,w,,visible|docs|notApi,4,switch,,,,,,continually scan for new blocks and extract data as per the command file 14090,apps,Accounts,monitors,acctExport,watchlist,a,,visible|docs|notApi,,flag,,,,,,available with --watch option only, a file containing the addresses to watch -14100,apps,Accounts,monitors,acctExport,commands,c,,visible|docs|notApi,,flag,,,,,,available with --watch option only, the file containing the list of commands to apply to each watched address +14100,apps,Accounts,monitors,acctExport,commands,d,,visible|docs|notApi,,flag,,,,,,available with --watch option only, the file containing the list of commands to apply to each watched address 14110,apps,Accounts,monitors,acctExport,batch_size,b,8,visible|docs|notApi,,flag,,,,,,available with --watch option only, the number of monitors to process in each batch 14120,apps,Accounts,monitors,acctExport,run_count,u,,visible|docs|notApi,,flag,,,,,,available with --watch option only, run the monitor this many times, then quit 14130,apps,Accounts,monitors,acctExport,sleep,s,14,visible|docs|notApi,,flag,,,,,,available with --watch option only, the number of seconds to sleep between runs diff --git a/src/dev_tools/sdkFuzzer/monitors.go b/src/dev_tools/sdkFuzzer/monitors.go index 9990d73566..155f04231e 100644 --- a/src/dev_tools/sdkFuzzer/monitors.go +++ b/src/dev_tools/sdkFuzzer/monitors.go @@ -135,6 +135,16 @@ func TestMonitors(which, value, fn string, opts *sdk.MonitorsOptions) { ReportOkay(fn) } } + case "count": + if count, _, err := opts.MonitorsCount(); err != nil { + ReportError(fn, opts, err) + } else { + if err := SaveToFile[types.Count](fn, count); err != nil { + ReportError2(fn, err) + } else { + ReportOkay(fn) + } + } default: ReportError(fn, opts, fmt.Errorf("unknown which: %s", which)) logger.Fatal("Quitting...") diff --git a/src/dev_tools/testRunner/testCases/monitors.csv b/src/dev_tools/testRunner/testCases/monitors.csv index f1c2d9eca3..7aad45c80e 100644 --- a/src/dev_tools/testRunner/testCases/monitors.csv +++ b/src/dev_tools/testRunner/testCases/monitors.csv @@ -33,6 +33,9 @@ on ,both ,fast ,monitors ,apps ,acctExport ,monitors_decache_again ,y on ,both ,fast ,monitors ,apps ,acctExport ,monitors_list2 ,n ,addrs = 0x00ad1a7b0ef4d3c5070d73b9412b6ed22efb7533 & list & fmt = csv on ,both ,fast ,monitors ,apps ,acctExport ,monitors_list2_v ,n ,addrs = 0x00ad1a7b0ef4d3c5070d73b9412b6ed22efb7533 & list & fmt = csv & verbose on ,both ,fast ,monitors ,apps ,acctExport ,monitors_list_not_in ,y ,addrs = 0x00ad1a7b0ef4d3c5070d73b9412b6ed22efb7512 & list +on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count ,y ,count +on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count_list ,y ,count & list & no_header +on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count_other ,y ,count & clean # Capabilities # chain & fmt & help & nocolor & noop & version & verbose & no_header & file & output & append & cache & decache & ether diff --git a/tests b/tests index d45940aa59..cbce7e7411 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit d45940aa5996923c652f0e228d55ae82b15c4765 +Subproject commit cbce7e7411698ac37a2e2d749df43ee78f646c28 From ff630da6b330df6e6d90532bc2d49ad1fc3e5af9 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 25 Aug 2024 23:16:18 -0400 Subject: [PATCH 098/121] Adds IsEmpty and IsStaged to monitors. Improves chifra monitors --list. Bumps version to 3.1.3 due to change in monitors structure --- VERSION | 2 +- sdk/typescript/src/types/monitor.ts | 2 + .../chifra/internal/monitors/handle_count.go | 6 +- .../chifra/internal/monitors/handle_list.go | 65 ++++++++++--------- src/apps/chifra/internal/monitors/validate.go | 4 ++ src/apps/chifra/pkg/base/address.go | 4 +- src/apps/chifra/pkg/monitor/monitor_test.go | 25 ++++++- src/apps/chifra/pkg/types/types_monitor.go | 42 ++++++++++-- src/apps/chifra/pkg/version/string.go | 2 +- .../classDefinitions/fields/monitor.csv | 16 +++-- src/dev_tools/goMaker/types/types_member.go | 12 ++++ .../testRunner/testCases/monitors.csv | 1 + 12 files changed, 133 insertions(+), 48 deletions(-) diff --git a/VERSION b/VERSION index ef538c2810..ff365e06b9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.1.2 +3.1.3 diff --git a/sdk/typescript/src/types/monitor.ts b/sdk/typescript/src/types/monitor.ts index acc080d416..0e44c580cc 100644 --- a/sdk/typescript/src/types/monitor.ts +++ b/sdk/typescript/src/types/monitor.ts @@ -14,6 +14,8 @@ export type Monitor = { address: address deleted: boolean fileSize: int64 + isEmpty: boolean + isStaged: boolean lastScanned: uint64 nRecords: int64 name: string diff --git a/src/apps/chifra/internal/monitors/handle_count.go b/src/apps/chifra/internal/monitors/handle_count.go index cfc0b1e3da..07aebb0bd1 100644 --- a/src/apps/chifra/internal/monitors/handle_count.go +++ b/src/apps/chifra/internal/monitors/handle_count.go @@ -26,7 +26,11 @@ func (opts *MonitorsOptions) HandleCount(rCtx *output.RenderCtx) error { } else { vFunc := func(fn string, vP any) (bool, error) { _, name := filepath.Split(fn) - if !strings.Contains(fn, "staging") && strings.HasSuffix(name, ".bin") { + isVerbose := opts.Globals.Verbose + isStaging := strings.Contains(fn, "staging") + isMonitor := strings.HasSuffix(name, ".mon.bin") + include := isMonitor && (isVerbose || !isStaging) + if include { count++ } return true, nil diff --git a/src/apps/chifra/internal/monitors/handle_list.go b/src/apps/chifra/internal/monitors/handle_list.go index 6db987254e..b02608b966 100644 --- a/src/apps/chifra/internal/monitors/handle_list.go +++ b/src/apps/chifra/internal/monitors/handle_list.go @@ -5,53 +5,60 @@ package monitorsPkg import ( - "fmt" + "path/filepath" + "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/monitor" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/walk" ) // HandleList handles the chifra monitors --list command. func (opts *MonitorsOptions) HandleList(rCtx *output.RenderCtx) error { - chain := opts.Globals.Chain - monitorMap, monArray := monitor.GetMonitorMap(chain) - if opts.Globals.Verbose { - for i := 0; i < len(monArray); i++ { - _ = monArray[i].ReadMonitorHeader() - monArray[i].Close() - } - } - - errors := make([]error, 0) - addrMap := map[base.Address]bool{} - for _, addr := range opts.Addrs { - a := base.HexToAddress(addr) - addrMap[a] = true - if monitorMap[a] == nil { - errors = append(errors, fmt.Errorf("address %s is not being monitored", addr)) - } + testMode := opts.Globals.TestMode + if testMode { + logger.Info("chifra monitors --list not tested") + return nil } + chain := opts.Globals.Chain fetchData := func(modelChan chan types.Modeler, errorChan chan error) { - for _, e := range errors { - errorChan <- e - } - - for _, mon := range monArray { - if len(addrMap) == 0 || addrMap[mon.Address] { + vFunc := func(fn string, vP any) (bool, error) { + _, name := filepath.Split(fn) + isVerbose := opts.Globals.Verbose + isStaging := strings.Contains(fn, "staging") + isMonitor := strings.HasSuffix(name, ".mon.bin") + include := isMonitor && (isVerbose || !isStaging) + if include { + address, _ := base.AddressFromPath(fn, ".mon.bin") s := types.Monitor{ - Address: mon.Address, - NRecords: mon.Count(), - FileSize: file.FileSize(mon.Path()), - LastScanned: mon.LastScanned, - Deleted: mon.Deleted, + Address: address, + NRecords: (file.FileSize(fn) / 8) - 1, // two 32 bit integers and a 32 bit header + FileSize: file.FileSize(fn), + IsStaged: isStaging, + } + s.IsEmpty = s.NRecords == 0 + if isVerbose { + var mon monitor.Monitor + mon.Address = address + mon.Staged = isStaging + _ = mon.ReadMonitorHeader() + mon.Close() + s.LastScanned = mon.LastScanned + s.Deleted = mon.Deleted } modelChan <- &s } + return true, nil } + + path := filepath.Join(config.PathToCache(chain), "monitors") + _ = walk.ForEveryFileInFolder(path, vFunc, errorChan) } return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) diff --git a/src/apps/chifra/internal/monitors/validate.go b/src/apps/chifra/internal/monitors/validate.go index 3427296fa6..f4cbe0af9a 100644 --- a/src/apps/chifra/internal/monitors/validate.go +++ b/src/apps/chifra/internal/monitors/validate.go @@ -28,6 +28,10 @@ func (opts *MonitorsOptions) validateMonitors() error { return validate.Usage("chain {0} is not properly configured.", chain) } + if len(opts.Addrs) > 0 && (opts.List || opts.Count) { + return validate.Usage("Do not provide addresses with {0} or {1}.", "--list", "--count") + } + if opts.List { // All other options are ignored diff --git a/src/apps/chifra/pkg/base/address.go b/src/apps/chifra/pkg/base/address.go index 665d18f2dd..62056bd962 100644 --- a/src/apps/chifra/pkg/base/address.go +++ b/src/apps/chifra/pkg/base/address.go @@ -110,11 +110,11 @@ func AddressFromPath(path, fileType string) (Address, error) { _, fileName := filepath.Split(path) if !strings.HasSuffix(fileName, fileType) { - log.Fatal("should not happen ==> path should contain fileType") + log.Fatal("should not happen ==> path should contain fileType: " + path + " " + fileType) } if !strings.HasPrefix(fileType, ".") { - log.Fatal("should not happen ==> fileType should have a leading dot") + log.Fatal("should not happen ==> fileType should have a leading dot: " + path + " " + fileType) } if len(fileName) < (42+len(fileType)) || !strings.HasPrefix(fileName, "0x") || !strings.Contains(fileName, ".") { diff --git a/src/apps/chifra/pkg/monitor/monitor_test.go b/src/apps/chifra/pkg/monitor/monitor_test.go index f90ab39e7b..0771f3621f 100644 --- a/src/apps/chifra/pkg/monitor/monitor_test.go +++ b/src/apps/chifra/pkg/monitor/monitor_test.go @@ -32,7 +32,17 @@ func Test_Monitor_Print(t *testing.T) { // The monitor should report that it has two appearances got := testClean(fmt.Sprintln(mon.toJson())) - expected := "{\"address\":\"0x049029dd41661e58f99271a0112dfd34695f7000\",\"deleted\":false,\"fileSize\":56,\"lastScanned\":2002003,\"nRecords\":6,\"name\":\"\"}" + e := ` +{ + "address": "0x049029dd41661e58f99271a0112dfd34695f7000", + "deleted": false, + "fileSize": 56, + "isEmpty": false, + "isStaged": false, + "lastScanned": 2002003, + "nRecords":6, "name":"" +}` + expected := strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(e, "\n", ""), "\t", ""), " ", "") if got != expected { t.Error("Expected:", expected, "Got:", got) } @@ -118,7 +128,18 @@ func Test_Monitor_Delete(t *testing.T) { // The monitor should report that it has two appearances got := testClean(fmt.Sprintln(mon.toJson())) - expected := "{\"address\":\"0x049029dd41661e58f99271a0112dfd34695f7000\",\"deleted\":false,\"fileSize\":32,\"lastScanned\":2002003,\"nRecords\":3,\"name\":\"\"}" + e := ` +{ + "address": "0x049029dd41661e58f99271a0112dfd34695f7000", + "deleted": false, + "fileSize": 32, + "isEmpty": false, + "isStaged": false, + "lastScanned": 2002003, + "nRecords": 3, + "name": "" +}` + expected := strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(e, "\n", ""), "\t", ""), " ", "") if got != expected { t.Error("Expected:", expected, "Got:", got) } diff --git a/src/apps/chifra/pkg/types/types_monitor.go b/src/apps/chifra/pkg/types/types_monitor.go index c171d764b1..3255fd4e72 100644 --- a/src/apps/chifra/pkg/types/types_monitor.go +++ b/src/apps/chifra/pkg/types/types_monitor.go @@ -15,6 +15,7 @@ import ( "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/cache" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/version" ) // EXISTING_CODE @@ -23,6 +24,8 @@ type Monitor struct { Address base.Address `json:"address"` Deleted bool `json:"deleted"` FileSize int64 `json:"fileSize"` + IsEmpty bool `json:"isEmpty"` + IsStaged bool `json:"isStaged"` LastScanned uint32 `json:"lastScanned"` NRecords int64 `json:"nRecords"` Name string `json:"name"` @@ -43,15 +46,16 @@ func (s *Monitor) Model(chain, format string, verbose bool, extraOpts map[string model = map[string]any{ "address": s.Address, "nRecords": s.NRecords, + "fileSize": s.FileSize, + "isEmpty": s.IsEmpty, + "isStaged": s.IsStaged, } order = []string{ "address", "nRecords", - } - - if s.FileSize > 0 { - model["fileSize"] = s.FileSize - order = append(order, "fileSize") + "fileSize", + "isEmpty", + "isStaged", } if verbose { @@ -96,6 +100,16 @@ func (s *Monitor) MarshalCache(writer io.Writer) (err error) { return err } + // IsEmpty + if err = cache.WriteValue(writer, s.IsEmpty); err != nil { + return err + } + + // IsStaged + if err = cache.WriteValue(writer, s.IsStaged); err != nil { + return err + } + // LastScanned if err = cache.WriteValue(writer, s.LastScanned); err != nil { return err @@ -134,6 +148,24 @@ func (s *Monitor) UnmarshalCache(vers uint64, reader io.Reader) (err error) { return err } + // IsEmpty + vIsEmpty := version.NewVersion("3.1.2") + if vers > vIsEmpty.Uint64() { + // IsEmpty + if err = cache.ReadValue(reader, &s.IsEmpty, vers); err != nil { + return err + } + } + + // IsStaged + vIsStaged := version.NewVersion("3.1.2") + if vers > vIsStaged.Uint64() { + // IsStaged + if err = cache.ReadValue(reader, &s.IsStaged, vers); err != nil { + return err + } + } + // LastScanned if err = cache.ReadValue(reader, &s.LastScanned, vers); err != nil { return err diff --git a/src/apps/chifra/pkg/version/string.go b/src/apps/chifra/pkg/version/string.go index a5b84dd9f7..65b0531087 100644 --- a/src/apps/chifra/pkg/version/string.go +++ b/src/apps/chifra/pkg/version/string.go @@ -7,4 +7,4 @@ package version -const LibraryVersion = "GHC-TrueBlocks//3.1.2-release" +const LibraryVersion = "GHC-TrueBlocks//3.1.3-release" diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv index 12c562fcdb..fdced83b4a 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/monitor.csv @@ -1,7 +1,9 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -address ,address , , , 1 ,the address of this monitor -deleted ,bool , , , 6 ,`true` if this monitor has been deleted -fileSize ,int64 , , , 4 ,the size of this monitor on disc -lastScanned ,uint32 , , , 5 ,the last scanned block number -nRecords ,int64 , , , 3 ,the number of appearances for this monitor -name ,string , , , 2 ,the name of this monitor (if any) +name ,type ,strDefault ,attributes ,upgrades ,docOrder ,description +address ,address , , , , 1 ,the address of this monitor +deleted ,bool , , , , 8 ,`true` if this monitor has been deleted, `false` otherwise +isEmpty ,bool , , ,>3.1.2:bool , 6 ,`true` if the monitor has no appearances, `false` otherwise +isStaged ,bool , , ,>3.1.2:bool , 7 ,`true` if the monitor file in on the stage, `false` otherwise +fileSize ,int64 , , , , 4 ,the size of this monitor on disc +lastScanned ,uint32 , , , , 5 ,the last scanned block number +nRecords ,int64 , , , , 3 ,the number of appearances for this monitor +name ,string , , , , 2 ,the name of this monitor (if any) diff --git a/src/dev_tools/goMaker/types/types_member.go b/src/dev_tools/goMaker/types/types_member.go index 18decad1f4..ce2a4d0ca3 100644 --- a/src/dev_tools/goMaker/types/types_member.go +++ b/src/dev_tools/goMaker/types/types_member.go @@ -371,6 +371,9 @@ func (m *Member) UnmarshalCode() string { code := m.executeTemplate(tmplName, tmpl) if m.HasUpgrade() { + wasAdded := strings.Contains(m.Upgrades, ">") + m.Upgrades = strings.ReplaceAll(m.Upgrades, ">", "") + if wasRemoved { tmplName = "upgrageRemoved" tmpl = ` // Used to be {{.GoName}}, since removed @@ -382,6 +385,15 @@ func (m *Member) UnmarshalCode() string { } } +` + } else if wasAdded { + tmplName = "upgrageAdded" + tmpl = ` // {{.GoName}} + v{{.GoName}} := version.NewVersion("++VERS++") + if vers > v{{.GoName}}.Uint64() { + ++CODE++ + } + ` } else { tmplName = "upgrage" diff --git a/src/dev_tools/testRunner/testCases/monitors.csv b/src/dev_tools/testRunner/testCases/monitors.csv index 7aad45c80e..9461f69f4a 100644 --- a/src/dev_tools/testRunner/testCases/monitors.csv +++ b/src/dev_tools/testRunner/testCases/monitors.csv @@ -36,6 +36,7 @@ on ,both ,fast ,monitors ,apps ,acctExport ,monitors_list_not_in ,y on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count ,y ,count on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count_list ,y ,count & list & no_header on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count_other ,y ,count & clean +on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count_v ,y ,count & verbose # Capabilities # chain & fmt & help & nocolor & noop & version & verbose & no_header & file & output & append & cache & decache & ether From 9777e9925455d4ada70c0b199650c82d29808847 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 25 Aug 2024 23:17:37 -0400 Subject: [PATCH 099/121] Adds IsEmpty and IsStaged to monitors --- docs | 2 +- tests | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 9840ce0dc9..5969a13409 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 9840ce0dc92265210e460462be4418cf09012bdd +Subproject commit 5969a1340905f22d7aef7468315f5a4072c2fbf3 diff --git a/tests b/tests index cbce7e7411..6087e39c6e 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit cbce7e7411698ac37a2e2d749df43ee78f646c28 +Subproject commit 6087e39c6eb4d9d1d4b6843902fa496e2a6279ab From 9d6d9d98159a718912d3ae797539eea1e7b75a97 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 25 Aug 2024 23:29:33 -0400 Subject: [PATCH 100/121] Adds IsEmpty and IsStaged to monitors --- src/apps/chifra/internal/monitors/handle_list.go | 6 +++++- src/apps/chifra/pkg/types/types_monitor.go | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/apps/chifra/internal/monitors/handle_list.go b/src/apps/chifra/internal/monitors/handle_list.go index b02608b966..62b99c09ff 100644 --- a/src/apps/chifra/internal/monitors/handle_list.go +++ b/src/apps/chifra/internal/monitors/handle_list.go @@ -61,5 +61,9 @@ func (opts *MonitorsOptions) HandleList(rCtx *output.RenderCtx) error { _ = walk.ForEveryFileInFolder(path, vFunc, errorChan) } - return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) + extraOpts := map[string]any{ + "list": true, + } + + return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOptsWithExtra(extraOpts)) } diff --git a/src/apps/chifra/pkg/types/types_monitor.go b/src/apps/chifra/pkg/types/types_monitor.go index 3255fd4e72..61b492e4ff 100644 --- a/src/apps/chifra/pkg/types/types_monitor.go +++ b/src/apps/chifra/pkg/types/types_monitor.go @@ -47,15 +47,18 @@ func (s *Monitor) Model(chain, format string, verbose bool, extraOpts map[string "address": s.Address, "nRecords": s.NRecords, "fileSize": s.FileSize, - "isEmpty": s.IsEmpty, - "isStaged": s.IsStaged, } order = []string{ "address", "nRecords", "fileSize", - "isEmpty", - "isStaged", + } + + if extraOpts["list"] == true { + model["isEmpty"] = s.IsEmpty + model["isStaged"] = s.IsStaged + order = append(order, "isEmpty") + order = append(order, "isStaged") } if verbose { From 9b106eea0247b06b07e398c0066319c4a8787f9a Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sun, 25 Aug 2024 23:51:02 -0400 Subject: [PATCH 101/121] Updates go.mods --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index d3e5c23538..c674894979 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index 9ded82dce9..b4cd88037f 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index 11381249be..09b6234032 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index b0ebdc8da1..5227785dd2 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 433bff74a0..4b2914905d 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index b0ebdc8da1..5227785dd2 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index f2dbffe6c6..646576f86a 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index b0ebdc8da1..5227785dd2 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index 331ab58c15..51a72dfb19 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index b0ebdc8da1..5227785dd2 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index 9caf955278..ca3aa77245 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index 02bb0be85b..aca35319af 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index 06f34359dd..0a68503d05 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index 061a2faed5..e9c42529fa 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index 3300617e83..d7a569a909 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index cd86c27921..19ac82df59 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index 3c0d560175..e6417188a9 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index b0ebdc8da1..5227785dd2 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index 6d57791ee3..8499c37a63 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index b0ebdc8da1..5227785dd2 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597 h1:9JwPuD3qihjPeP74HL7uuqwI+wBE6YgB2+7AdQ8l8es= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155716-96b9bae47597/go.mod h1:suPlE4GWlgpcMLbNKgoURrcwmMHKVcMmjV6qv+an914= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d h1:qyQpCPQ1e4YIDDjaMuPL4iCcZcr6oCtlCfze6Evk1oM= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824041557-9259099dd92d/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From e8bc34d7c57a38814a97658831179baaea1526ab Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Mon, 26 Aug 2024 07:11:59 -0400 Subject: [PATCH 102/121] Adds --staged to chifra monitors --- docs | 2 +- sdk/monitors.go | 1 + sdk/monitors_internal.go | 2 ++ sdk/python/src/_monitors.py | 1 + sdk/typescript/src/paths/monitors.ts | 1 + sdk/typescript/src/types/monitorClean.ts | 2 ++ src/apps/chifra/cmd/monitors.go | 3 ++- src/apps/chifra/internal/monitors/README.md | 3 ++- .../chifra/internal/monitors/handle_clean_test.go | 12 ------------ src/apps/chifra/internal/monitors/options.go | 6 +++++- src/apps/chifra/pkg/types/types_monitorclean.go | 8 ++++++++ .../classDefinitions/fields/monitorclean.csv | 2 ++ src/dev_tools/goMaker/templates/cmd-line-options.csv | 3 ++- src/dev_tools/sdkFuzzer/monitors.go | 2 ++ tests | 2 +- 15 files changed, 32 insertions(+), 18 deletions(-) delete mode 100644 src/apps/chifra/internal/monitors/handle_clean_test.go diff --git a/docs b/docs index 5969a13409..56e2512408 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 5969a1340905f22d7aef7468315f5a4072c2fbf3 +Subproject commit 56e25124088b90168379d5e015f44c13c7464419 diff --git a/sdk/monitors.go b/sdk/monitors.go index d1e5483c89..b0bde5f7d7 100644 --- a/sdk/monitors.go +++ b/sdk/monitors.go @@ -22,6 +22,7 @@ type MonitorsOptions struct { Delete bool `json:"delete,omitempty"` Undelete bool `json:"undelete,omitempty"` Remove bool `json:"remove,omitempty"` + Staged bool `json:"staged,omitempty"` Watch bool `json:"watch,omitempty"` Watchlist string `json:"watchlist,omitempty"` Commands string `json:"commands,omitempty"` diff --git a/sdk/monitors_internal.go b/sdk/monitors_internal.go index 54780c4868..bd65137330 100644 --- a/sdk/monitors_internal.go +++ b/sdk/monitors_internal.go @@ -29,6 +29,7 @@ type monitorsOptionsInternal struct { Clean bool `json:"clean,omitempty"` List bool `json:"list,omitempty"` Count bool `json:"count,omitempty"` + Staged bool `json:"staged,omitempty"` Watch bool `json:"watch,omitempty"` Watchlist string `json:"watchlist,omitempty"` Commands string `json:"commands,omitempty"` @@ -119,6 +120,7 @@ func (opts *MonitorsOptions) toInternal() *monitorsOptionsInternal { Delete: opts.Delete, Undelete: opts.Undelete, Remove: opts.Remove, + Staged: opts.Staged, Watch: opts.Watch, Watchlist: opts.Watchlist, Commands: opts.Commands, diff --git a/sdk/python/src/_monitors.py b/sdk/python/src/_monitors.py index 76d6905298..998a5990b2 100644 --- a/sdk/python/src/_monitors.py +++ b/sdk/python/src/_monitors.py @@ -18,6 +18,7 @@ "clean": {"hotkey": "-C", "type": "switch"}, "list": {"hotkey": "-l", "type": "switch"}, "count": {"hotkey": "-c", "type": "switch"}, + "staged": {"hotkey": "-S", "type": "switch"}, "watch": {"hotkey": "-w", "type": "switch"}, "watchlist": {"hotkey": "-a", "type": "flag"}, "commands": {"hotkey": "-d", "type": "flag"}, diff --git a/sdk/typescript/src/paths/monitors.ts b/sdk/typescript/src/paths/monitors.ts index 8916f06f7f..7174d8911f 100644 --- a/sdk/typescript/src/paths/monitors.ts +++ b/sdk/typescript/src/paths/monitors.ts @@ -20,6 +20,7 @@ export function getMonitors( clean?: boolean, list?: boolean, count?: boolean, + staged?: boolean, watch?: boolean, watchlist?: string, commands?: string, diff --git a/sdk/typescript/src/types/monitorClean.ts b/sdk/typescript/src/types/monitorClean.ts index a188d198e7..f5805615d0 100644 --- a/sdk/typescript/src/types/monitorClean.ts +++ b/sdk/typescript/src/types/monitorClean.ts @@ -13,6 +13,8 @@ import { address, int64 } from '.'; export type MonitorClean = { address: address dups: int64 + removed: boolean sizeNow: int64 sizeThen: int64 + staged: boolean } diff --git a/src/apps/chifra/cmd/monitors.go b/src/apps/chifra/cmd/monitors.go index 002862c225..d924a89446 100644 --- a/src/apps/chifra/cmd/monitors.go +++ b/src/apps/chifra/cmd/monitors.go @@ -63,9 +63,10 @@ func init() { monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Delete, "delete", "", false, `delete a monitor, but do not remove it`) monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Undelete, "undelete", "", false, `undelete a previously deleted monitor`) monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Remove, "remove", "", false, `remove a previously deleted monitor`) - monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Clean, "clean", "C", false, `clean (i.e. remove duplicate appearances) from monitors`) + monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Clean, "clean", "C", false, `clean (i.e. remove duplicate appearances) from monitors, optionally clear stage`) monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().List, "list", "l", false, `list monitors in the cache (--verbose for more detail)`) monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Count, "count", "c", false, `show the number of active monitors (included deleted but not removed monitors)`) + monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Staged, "staged", "S", false, `for --clean, --list, and --count options only, include staged monitors`) monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Watch, "watch", "w", false, `continually scan for new blocks and extract data as per the command file`) monitorsCmd.Flags().StringVarP(&monitorsPkg.GetOptions().Watchlist, "watchlist", "a", "", `available with --watch option only, a file containing the addresses to watch`) monitorsCmd.Flags().StringVarP(&monitorsPkg.GetOptions().Commands, "commands", "d", "", `available with --watch option only, the file containing the list of commands to apply to each watched address`) diff --git a/src/apps/chifra/internal/monitors/README.md b/src/apps/chifra/internal/monitors/README.md index ef7d092f8d..d70556302f 100644 --- a/src/apps/chifra/internal/monitors/README.md +++ b/src/apps/chifra/internal/monitors/README.md @@ -56,9 +56,10 @@ Flags: --delete delete a monitor, but do not remove it --undelete undelete a previously deleted monitor --remove remove a previously deleted monitor - -C, --clean clean (i.e. remove duplicate appearances) from monitors + -C, --clean clean (i.e. remove duplicate appearances) from monitors, optionally clear stage -l, --list list monitors in the cache (--verbose for more detail) -c, --count show the number of active monitors (included deleted but not removed monitors) + -S, --staged for --clean, --list, and --count options only, include staged monitors -w, --watch continually scan for new blocks and extract data as per the command file -a, --watchlist string available with --watch option only, a file containing the addresses to watch -d, --commands string available with --watch option only, the file containing the list of commands to apply to each watched address diff --git a/src/apps/chifra/internal/monitors/handle_clean_test.go b/src/apps/chifra/internal/monitors/handle_clean_test.go deleted file mode 100644 index 21462d1234..0000000000 --- a/src/apps/chifra/internal/monitors/handle_clean_test.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2021 The TrueBlocks Authors. All rights reserved. -// Use of this source code is governed by a license that can -// be found in the LICENSE file. - -package monitorsPkg - -import ( - "testing" -) - -func Test_HandleClean(t *testing.T) { -} diff --git a/src/apps/chifra/internal/monitors/options.go b/src/apps/chifra/internal/monitors/options.go index 976a4076dd..27a3f4846a 100644 --- a/src/apps/chifra/internal/monitors/options.go +++ b/src/apps/chifra/internal/monitors/options.go @@ -32,9 +32,10 @@ type MonitorsOptions struct { Delete bool `json:"delete,omitempty"` // Delete a monitor, but do not remove it Undelete bool `json:"undelete,omitempty"` // Undelete a previously deleted monitor Remove bool `json:"remove,omitempty"` // Remove a previously deleted monitor - Clean bool `json:"clean,omitempty"` // Clean (i.e. remove duplicate appearances) from monitors + Clean bool `json:"clean,omitempty"` // Clean (i.e. remove duplicate appearances) from monitors, optionally clear stage List bool `json:"list,omitempty"` // List monitors in the cache (--verbose for more detail) Count bool `json:"count,omitempty"` // Show the number of active monitors (included deleted but not removed monitors) + Staged bool `json:"staged,omitempty"` // For --clean, --list, and --count options only, include staged monitors Watch bool `json:"watch,omitempty"` // Continually scan for new blocks and extract data as per the command file Watchlist string `json:"watchlist,omitempty"` // Available with --watch option only, a file containing the addresses to watch Commands string `json:"commands,omitempty"` // Available with --watch option only, the file containing the list of commands to apply to each watched address @@ -62,6 +63,7 @@ func (opts *MonitorsOptions) testLog() { logger.TestLog(opts.Clean, "Clean: ", opts.Clean) logger.TestLog(opts.List, "List: ", opts.List) logger.TestLog(opts.Count, "Count: ", opts.Count) + logger.TestLog(opts.Staged, "Staged: ", opts.Staged) logger.TestLog(opts.Watch, "Watch: ", opts.Watch) logger.TestLog(len(opts.Watchlist) > 0, "Watchlist: ", opts.Watchlist) logger.TestLog(len(opts.Commands) > 0, "Commands: ", opts.Commands) @@ -112,6 +114,8 @@ func MonitorsFinishParseInternal(w io.Writer, values url.Values) *MonitorsOption opts.List = true case "count": opts.Count = true + case "staged": + opts.Staged = true case "watch": opts.Watch = true case "watchlist": diff --git a/src/apps/chifra/pkg/types/types_monitorclean.go b/src/apps/chifra/pkg/types/types_monitorclean.go index a088d521fb..38ec4745aa 100644 --- a/src/apps/chifra/pkg/types/types_monitorclean.go +++ b/src/apps/chifra/pkg/types/types_monitorclean.go @@ -20,8 +20,10 @@ import ( type MonitorClean struct { Address base.Address `json:"address"` Dups int64 `json:"dups"` + Removed bool `json:"removed"` SizeNow int64 `json:"sizeNow"` SizeThen int64 `json:"sizeThen"` + Staged bool `json:"staged"` // EXISTING_CODE // EXISTING_CODE } @@ -48,6 +50,12 @@ func (s *MonitorClean) Model(chain, format string, verbose bool, extraOpts map[s "sizeThen", "dups", } + + if extraOpts["staged"] == true { + model["staged"] = s.Staged + model["removed"] = s.Removed + order = append(order, "staged", "removed") + } // EXISTING_CODE return Model{ diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/monitorclean.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/monitorclean.csv index 776cdf2876..0a908b0dad 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/monitorclean.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/monitorclean.csv @@ -3,3 +3,5 @@ address ,address , , , 1 ,the address being cleaned sizeThen ,int64 , , , 2 ,the number of appearances in the monitor prior to cleaning sizeNow ,int64 , , , 3 ,the number of appearances in the monitor after cleaning dups ,int64 , , , 4 ,the number of duplicates removed +staged ,bool , , , 5 ,`true` if the address is in the stage, `false` otherwise +removed ,bool , , , 6 ,`true` if the address was removed from the stage, `false` otherwise diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index 1280f863e8..9dbd068b9c 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -65,9 +65,10 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 14030,apps,Accounts,monitors,acctExport,delete,,,visible|docs|crud,,switch,,,,,,delete a monitor, but do not remove it 14040,apps,Accounts,monitors,acctExport,undelete,,,visible|docs|crud,,switch,,,,,,undelete a previously deleted monitor 14050,apps,Accounts,monitors,acctExport,remove,,,visible|docs|crud,,switch,,,,,,remove a previously deleted monitor -14060,apps,Accounts,monitors,acctExport,clean,C,,visible|docs,2,switch,,monitorClean,,,,clean (i.e. remove duplicate appearances) from monitors +14060,apps,Accounts,monitors,acctExport,clean,C,,visible|docs,2,switch,,monitorClean,,,,clean (i.e. remove duplicate appearances) from monitors, optionally clear stage 14070,apps,Accounts,monitors,acctExport,list,l,,visible|docs,3,switch,,monitor,,,,list monitors in the cache (--verbose for more detail) 14075,apps,Accounts,monitors,acctExport,count,c,,visible|docs,1,switch,,count,,,,show the number of active monitors (included deleted but not removed monitors) +14065,apps,Accounts,monitors,acctExport,staged,S,,visible|docs,,switch,,,,,,for --clean, --list, and --count options only, include staged monitors 14080,apps,Accounts,monitors,acctExport,watch,w,,visible|docs|notApi,4,switch,,,,,,continually scan for new blocks and extract data as per the command file 14090,apps,Accounts,monitors,acctExport,watchlist,a,,visible|docs|notApi,,flag,,,,,,available with --watch option only, a file containing the addresses to watch 14100,apps,Accounts,monitors,acctExport,commands,d,,visible|docs|notApi,,flag,,,,,,available with --watch option only, the file containing the list of commands to apply to each watched address diff --git a/src/dev_tools/sdkFuzzer/monitors.go b/src/dev_tools/sdkFuzzer/monitors.go index 155f04231e..2803ee4ce3 100644 --- a/src/dev_tools/sdkFuzzer/monitors.go +++ b/src/dev_tools/sdkFuzzer/monitors.go @@ -30,6 +30,7 @@ func DoMonitors() { delete := []bool{false, true} undelete := []bool{false, true} remove := []bool{false, true} + staged := []bool{false, true} watch := []bool{false, true} // watchlist is not fuzzed // commands is not fuzzed @@ -43,6 +44,7 @@ func DoMonitors() { _ = remove _ = watch _ = globs + _ = staged opts = sdk.MonitorsOptions{ Addrs: []string{fuzzAddresses[0]}, } diff --git a/tests b/tests index 6087e39c6e..e7be4925c3 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 6087e39c6eb4d9d1d4b6843902fa496e2a6279ab +Subproject commit e7be4925c30c1d3468794e52582be8262cdad740 From 37fc74548b553fd8a18bf13e9479a2e4daad4b62 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Mon, 26 Aug 2024 07:13:41 -0400 Subject: [PATCH 103/121] Adds --staged option to chifra monitors. --- .../chifra/internal/monitors/handle_clean.go | 42 +++++++++++- .../chifra/internal/monitors/handle_count.go | 7 +- .../chifra/internal/monitors/handle_list.go | 6 +- .../chifra/internal/monitors/handle_watch.go | 2 +- src/apps/chifra/pkg/monitor/monitor.go | 65 +++++++------------ .../testRunner/testCases/monitors.csv | 2 + 6 files changed, 74 insertions(+), 50 deletions(-) diff --git a/src/apps/chifra/internal/monitors/handle_clean.go b/src/apps/chifra/internal/monitors/handle_clean.go index bfa6c80a38..f64155d707 100644 --- a/src/apps/chifra/internal/monitors/handle_clean.go +++ b/src/apps/chifra/internal/monitors/handle_clean.go @@ -5,6 +5,9 @@ package monitorsPkg import ( + "sort" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/monitor" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" @@ -14,13 +17,14 @@ import ( func (opts *MonitorsOptions) HandleClean(rCtx *output.RenderCtx) error { chain := opts.Globals.Chain testMode := opts.Globals.TestMode - _, monArray := monitor.GetMonitorMap(chain) fetchData := func(modelChan chan types.Modeler, errorChan chan error) { + _, monArray := GetMonitorMap(chain) for _, mon := range monArray { addr := mon.Address.Hex() s := types.MonitorClean{ Address: mon.Address, + Staged: mon.Staged, } if testMode { if addr == "0x001d14804b399c6ef80e64576f657660804fec0b" || @@ -38,14 +42,46 @@ func (opts *MonitorsOptions) HandleClean(rCtx *output.RenderCtx) error { s.SizeThen = int64(then) s.SizeNow = int64(now) s.Dups = s.SizeThen - s.SizeNow + if opts.Staged && mon.Staged { + s.Removed = true + mon.Close() + mon.Delete() + mon.Remove() + } } if s.SizeThen > 0 { modelChan <- &s } - // delete empty monitors } } - return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) + extraOpts := map[string]any{ + "staged": opts.Staged, + } + return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOptsWithExtra(extraOpts)) +} + +func GetMonitorMap(chain string) (map[base.Address]*monitor.Monitor, []*monitor.Monitor) { + monitorChan := make(chan monitor.Monitor) + + go monitor.ListExistingMonitors(chain, monitorChan) + + monMap := make(map[base.Address]*monitor.Monitor) + monArray := []*monitor.Monitor{} + for mon := range monitorChan { + switch mon.Address { + case base.NotAMonitor: + close(monitorChan) + default: + monMap[mon.Address] = &mon + monArray = append(monArray, &mon) + } + } + + sort.Slice(monArray, func(i, j int) bool { + return monArray[i].Address.Hex() < monArray[j].Address.Hex() + }) + + return monMap, monArray } diff --git a/src/apps/chifra/internal/monitors/handle_count.go b/src/apps/chifra/internal/monitors/handle_count.go index 07aebb0bd1..d942d20e2c 100644 --- a/src/apps/chifra/internal/monitors/handle_count.go +++ b/src/apps/chifra/internal/monitors/handle_count.go @@ -23,13 +23,16 @@ func (opts *MonitorsOptions) HandleCount(rCtx *output.RenderCtx) error { count := uint64(0) if testMode { count = 199 + if opts.Staged { + count = 99 + } } else { vFunc := func(fn string, vP any) (bool, error) { _, name := filepath.Split(fn) - isVerbose := opts.Globals.Verbose + incStaged := opts.Staged isStaging := strings.Contains(fn, "staging") isMonitor := strings.HasSuffix(name, ".mon.bin") - include := isMonitor && (isVerbose || !isStaging) + include := isMonitor && (incStaged || !isStaging) if include { count++ } diff --git a/src/apps/chifra/internal/monitors/handle_list.go b/src/apps/chifra/internal/monitors/handle_list.go index 62b99c09ff..3ab8e3f019 100644 --- a/src/apps/chifra/internal/monitors/handle_list.go +++ b/src/apps/chifra/internal/monitors/handle_list.go @@ -30,10 +30,10 @@ func (opts *MonitorsOptions) HandleList(rCtx *output.RenderCtx) error { fetchData := func(modelChan chan types.Modeler, errorChan chan error) { vFunc := func(fn string, vP any) (bool, error) { _, name := filepath.Split(fn) - isVerbose := opts.Globals.Verbose + incStaged := opts.Staged isStaging := strings.Contains(fn, "staging") isMonitor := strings.HasSuffix(name, ".mon.bin") - include := isMonitor && (isVerbose || !isStaging) + include := isMonitor && (incStaged || !isStaging) if include { address, _ := base.AddressFromPath(fn, ".mon.bin") s := types.Monitor{ @@ -43,7 +43,7 @@ func (opts *MonitorsOptions) HandleList(rCtx *output.RenderCtx) error { IsStaged: isStaging, } s.IsEmpty = s.NRecords == 0 - if isVerbose { + if opts.Globals.Verbose { var mon monitor.Monitor mon.Address = address mon.Staged = isStaging diff --git a/src/apps/chifra/internal/monitors/handle_watch.go b/src/apps/chifra/internal/monitors/handle_watch.go index 2b50aa81a1..f73453b5f4 100644 --- a/src/apps/chifra/internal/monitors/handle_watch.go +++ b/src/apps/chifra/internal/monitors/handle_watch.go @@ -323,7 +323,7 @@ func (opts *MonitorsOptions) getMonitorList() []monitor.Monitor { var monitors []monitor.Monitor monitorChan := make(chan monitor.Monitor) - go monitor.ListMonitors(opts.Globals.Chain, opts.Watchlist, monitorChan) + go monitor.ListWatchedMonitors(opts.Globals.Chain, opts.Watchlist, monitorChan) for result := range monitorChan { switch result.Address { diff --git a/src/apps/chifra/pkg/monitor/monitor.go b/src/apps/chifra/pkg/monitor/monitor.go index 9a7d3b8548..3c585b4c2f 100644 --- a/src/apps/chifra/pkg/monitor/monitor.go +++ b/src/apps/chifra/pkg/monitor/monitor.go @@ -10,7 +10,6 @@ import ( "io/fs" "os" "path/filepath" - "sort" "strings" "sync" @@ -174,28 +173,33 @@ func (mon *Monitor) Remove() (bool, error) { return !file.FileExists(mon.Path()), nil } -// ListMonitors puts a list of Monitors into the monitorChannel. The list of monitors is built from -// a file called addresses.tsv in the current folder or, if not present, from existing monitors -func ListMonitors(chain, watchList string, monitorChan chan<- Monitor) { +// ListWatchedMonitors puts a list of Monitors into the monitorChannel. The list of monitors is +// built from a file called addresses.tsv in the current folder +func ListWatchedMonitors(chain, watchList string, monitorChan chan<- Monitor) { defer func() { monitorChan <- Monitor{Address: base.NotAMonitor} }() - if watchList != "existing" { - logger.Info("Reading address list from", watchList) - lines := file.AsciiFileToLines(watchList) - addrMap := make(map[base.Address]bool) - for _, line := range lines { - line = utils.StripComments(line) - addr := base.HexToAddress(line) - if !addrMap[addr] && !addr.IsZero() && base.IsValidAddress(addr.Hex()) { - mon, _ := NewMonitor(chain, addr, true /* create */) - monitorChan <- mon - } - addrMap[addr] = true + logger.Info("Reading address list from", watchList) + lines := file.AsciiFileToLines(watchList) + addrMap := make(map[base.Address]bool) + for _, line := range lines { + line = utils.StripComments(line) + addr := base.HexToAddress(line) + if !addrMap[addr] && !addr.IsZero() && base.IsValidAddress(addr.Hex()) { + mon, _ := NewMonitor(chain, addr, true /* create */) + monitorChan <- mon } - return + addrMap[addr] = true } +} + +// ListExistingMonitors puts a list of Monitors into the monitorChannel. The list of monitors is built from +// a file called addresses.tsv in the current folder or, if not present, from existing monitors +func ListExistingMonitors(chain string, monitorChan chan<- Monitor) { + defer func() { + monitorChan <- Monitor{Address: base.NotAMonitor} + }() walkFunc := func(path string, info fs.FileInfo, err error) error { if err != nil { @@ -205,6 +209,9 @@ func ListMonitors(chain, watchList string, monitorChan chan<- Monitor) { addr, _ := base.AddressFromPath(path, ".mon.bin") if !addr.IsZero() { mon, _ := NewMonitor(chain, addr, true /* create */) + if strings.Contains(path, "staging") { + mon.Staged = true + } monitorChan <- mon } } @@ -241,27 +248,3 @@ func (mon *Monitor) MoveToProduction() error { return err } - -func GetMonitorMap(chain string) (map[base.Address]*Monitor, []*Monitor) { - monitorChan := make(chan Monitor) - - go ListMonitors(chain, "existing", monitorChan) - - monMap := make(map[base.Address]*Monitor) - monArray := []*Monitor{} - for mon := range monitorChan { - switch mon.Address { - case base.NotAMonitor: - close(monitorChan) - default: - monMap[mon.Address] = &mon - monArray = append(monArray, &mon) - } - } - - sort.Slice(monArray, func(i, j int) bool { - return monArray[i].Address.Hex() < monArray[j].Address.Hex() - }) - - return monMap, monArray -} diff --git a/src/dev_tools/testRunner/testCases/monitors.csv b/src/dev_tools/testRunner/testCases/monitors.csv index 9461f69f4a..fe50bcec1d 100644 --- a/src/dev_tools/testRunner/testCases/monitors.csv +++ b/src/dev_tools/testRunner/testCases/monitors.csv @@ -34,7 +34,9 @@ on ,both ,fast ,monitors ,apps ,acctExport ,monitors_list2 ,n on ,both ,fast ,monitors ,apps ,acctExport ,monitors_list2_v ,n ,addrs = 0x00ad1a7b0ef4d3c5070d73b9412b6ed22efb7533 & list & fmt = csv & verbose on ,both ,fast ,monitors ,apps ,acctExport ,monitors_list_not_in ,y ,addrs = 0x00ad1a7b0ef4d3c5070d73b9412b6ed22efb7512 & list on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count ,y ,count +on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count_s ,y ,count & staged on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count_list ,y ,count & list & no_header +on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count_list_s ,y ,count & list & no_header & staged on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count_other ,y ,count & clean on ,both ,fast ,monitors ,apps ,acctExport ,monitors_count_v ,y ,count & verbose From 259dc18be814f0cd805ac2597d7e0ad81d2b93c5 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Mon, 26 Aug 2024 07:19:12 -0400 Subject: [PATCH 104/121] Cleans lint --- src/apps/chifra/internal/monitors/handle_clean.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/chifra/internal/monitors/handle_clean.go b/src/apps/chifra/internal/monitors/handle_clean.go index f64155d707..b1cb0acf7a 100644 --- a/src/apps/chifra/internal/monitors/handle_clean.go +++ b/src/apps/chifra/internal/monitors/handle_clean.go @@ -45,8 +45,8 @@ func (opts *MonitorsOptions) HandleClean(rCtx *output.RenderCtx) error { if opts.Staged && mon.Staged { s.Removed = true mon.Close() - mon.Delete() - mon.Remove() + _ = mon.Delete() + _, _ = mon.Remove() } } From 416b1f6dfe1726ef5836408b8078cced7fbd96ef Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Mon, 26 Aug 2024 07:46:17 -0400 Subject: [PATCH 105/121] Updates go.mods --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index c674894979..1c1947760b 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index b4cd88037f..24123e6d71 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index 09b6234032..b00c61005b 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index 5227785dd2..268f29b85e 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 4b2914905d..11b2ebf2af 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index 5227785dd2..268f29b85e 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index 646576f86a..c9da222bc6 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index 5227785dd2..268f29b85e 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index 51a72dfb19..bdfa976054 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index 5227785dd2..268f29b85e 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index ca3aa77245..efd542b38a 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index aca35319af..2fed74c3de 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index 0a68503d05..11ce5ebb12 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index e9c42529fa..5f532c3ade 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index d7a569a909..99db5a8918 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index 19ac82df59..4760ce0aeb 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index e6417188a9..71f93e565a 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index 5227785dd2..268f29b85e 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index 8499c37a63..237460dbc4 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index 5227785dd2..268f29b85e 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699 h1:rUgIJm/PswQ0p2h3WVGCfcTi+3rWYRok6W4iaf6ZI+s= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240824155850-f3d04c84a699/go.mod h1:4ZJhrlrqYaAAeQMTGTUhFm4bWsJkUx3MTv/o2fjNZ9Y= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699 h1:Cx5FdQXsbbmgOaZRSB3/OXYxK+FVNk/yNyRfdblCxNg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240824155850-f3d04c84a699/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From e6187b20dcf272e50af82d10931bb530cb71191c Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Tue, 27 Aug 2024 13:38:04 -0400 Subject: [PATCH 106/121] Adds hidden --dalle option to chifra explore --- sdk/abis.go | 7 ------- sdk/sort.go | 10 ++++++++++ src/apps/chifra/cmd/explore.go | 4 ++++ src/apps/chifra/internal/explore/options.go | 9 +++++++++ src/apps/chifra/internal/explore/validate.go | 12 ++++++++++++ src/dev_tools/goMaker/codeWriter/code_writer.go | 4 ++++ src/dev_tools/goMaker/templates/cmd-line-options.csv | 1 + src/dev_tools/goMaker/types/types_enums.go | 1 + src/dev_tools/goMaker/types/types_notes.go | 1 + src/dev_tools/goMaker/types/types_sorts.go | 1 + tests | 2 +- 11 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 sdk/sort.go create mode 100644 src/dev_tools/goMaker/types/types_enums.go create mode 100644 src/dev_tools/goMaker/types/types_notes.go create mode 100644 src/dev_tools/goMaker/types/types_sorts.go diff --git a/sdk/abis.go b/sdk/abis.go index 4cb33f94a7..1858bcfcfd 100644 --- a/sdk/abis.go +++ b/sdk/abis.go @@ -72,13 +72,6 @@ func (opts *AbisOptions) AbisEncode(val string) ([]types.Function, *types.MetaDa // No enums // EXISTING_CODE -type SortOrder = types.SortOrder - -const ( - Asc SortOrder = types.Ascending - Dec SortOrder = types.Descending -) - func SortAbis(abis []types.Abi, fields []string, dir []SortOrder) error { if len(fields) != len(dir) { return fmt.Errorf("fields and dir must have the same length") diff --git a/sdk/sort.go b/sdk/sort.go new file mode 100644 index 0000000000..81a1a3f0ee --- /dev/null +++ b/sdk/sort.go @@ -0,0 +1,10 @@ +package sdk + +import "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" + +type SortOrder = types.SortOrder + +const ( + Asc SortOrder = types.Ascending + Dec SortOrder = types.Descending +) diff --git a/src/apps/chifra/cmd/explore.go b/src/apps/chifra/cmd/explore.go index be9a36ef7e..7973f3f851 100644 --- a/src/apps/chifra/cmd/explore.go +++ b/src/apps/chifra/cmd/explore.go @@ -59,6 +59,10 @@ func init() { exploreCmd.Flags().BoolVarP(&explorePkg.GetOptions().Local, "local", "l", false, `open the local TrueBlocks explorer`) exploreCmd.Flags().BoolVarP(&explorePkg.GetOptions().Google, "google", "g", false, `search google excluding popular blockchain explorers`) + exploreCmd.Flags().BoolVarP(&explorePkg.GetOptions().Dalle, "dalle", "d", false, `open the address to the DalleDress explorer (hidden)`) + if os.Getenv("TEST_MODE") != "true" { + _ = exploreCmd.Flags().MarkHidden("dalle") + } globals.InitGlobals("explore", exploreCmd, &explorePkg.GetOptions().Globals, capabilities) exploreCmd.SetUsageTemplate(UsageWithNotes(notesExplore)) diff --git a/src/apps/chifra/internal/explore/options.go b/src/apps/chifra/internal/explore/options.go index 8ea30fc454..9259f45066 100644 --- a/src/apps/chifra/internal/explore/options.go +++ b/src/apps/chifra/internal/explore/options.go @@ -32,6 +32,7 @@ type ExploreOptions struct { Terms []string `json:"terms,omitempty"` // One or more address, name, block, or transaction identifier Local bool `json:"local,omitempty"` // Open the local TrueBlocks explorer Google bool `json:"google,omitempty"` // Search google excluding popular blockchain explorers + Dalle bool `json:"dalle,omitempty"` // Open the address to the DalleDress explorer Globals globals.GlobalOptions `json:"globals,omitempty"` // The global options Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server BadFlag error `json:"badFlag,omitempty"` // An error flag if needed @@ -46,6 +47,7 @@ func (opts *ExploreOptions) testLog() { logger.TestLog(len(opts.Terms) > 0, "Terms: ", opts.Terms) logger.TestLog(opts.Local, "Local: ", opts.Local) logger.TestLog(opts.Google, "Google: ", opts.Google) + logger.TestLog(opts.Dalle, "Dalle: ", opts.Dalle) opts.Conn.TestLog(opts.getCaches()) opts.Globals.TestLog() } @@ -80,6 +82,8 @@ func ExploreFinishParseInternal(w io.Writer, values url.Values) *ExploreOptions opts.Local = true case "google": opts.Google = true + case "dalle": + opts.Dalle = true default: if !copy.Globals.Caps.HasKey(key) { err := validate.Usage("Invalid key ({0}) in {1} route.", key, "explore") @@ -181,6 +185,11 @@ func (u *ExploreUrl) getUrl(opts *ExploreOptions) string { return query } + if opts.Dalle { + var query = "http://192.34.63.136:8080/dalle/simple/[{TERM}]" + return strings.Replace(query, "[{TERM}]", u.term, -1) + } + if u.termType == ExploreFourByte { var query = "https://www.4byte.directory/signatures/?bytes4_signature=[{TERM}]" query = strings.Replace(query, "[{TERM}]", u.term, -1) diff --git a/src/apps/chifra/internal/explore/validate.go b/src/apps/chifra/internal/explore/validate.go index bd63b9e0f9..9d2baa021f 100644 --- a/src/apps/chifra/internal/explore/validate.go +++ b/src/apps/chifra/internal/explore/validate.go @@ -54,6 +54,14 @@ func (opts *ExploreOptions) validateExplore() error { return validate.Usage("The {0} option is not available{1}.", "--local", " with the --google option") } + if opts.Dalle && opts.Local { + return validate.Usage("The {0} option is not available{1}.", "--local", " with the --dalle option") + } + + if len(opts.Terms) == 0 && (opts.Dalle || opts.Google) { + return validate.Usage("The {0} options require {1}.", "--dalle and --google", "an address term") + } + for _, arg := range opts.Terms { arg = strings.ToLower(arg) @@ -72,6 +80,10 @@ func (opts *ExploreOptions) validateExplore() error { return validate.Usage("The {0} option requires {1}.", "--google", "an address term") } + if opts.Dalle { + return validate.Usage("The {0} option requires {1}.", "--dalle", "an address term") + } + valid, _ := validate.IsValidTransId(chain, []string{arg}, validate.ValidTransId) if valid { txHash, err := opts.idToTxHash(arg, validate.IsBlockHash) diff --git a/src/dev_tools/goMaker/codeWriter/code_writer.go b/src/dev_tools/goMaker/codeWriter/code_writer.go index f45be7d551..c831ac9da4 100644 --- a/src/dev_tools/goMaker/codeWriter/code_writer.go +++ b/src/dev_tools/goMaker/codeWriter/code_writer.go @@ -16,6 +16,10 @@ import ( ) func WriteCode(existingFn, newCode string) (bool, error) { + if len(strings.Trim(newCode, "\n\t\r")) == 0 { + return false, nil + } + if !file.FileExists(existingFn) { if !strings.Contains(existingFn, "/generated/") { if !file.FolderExists(filepath.Dir(existingFn)) { diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index 9dbd068b9c..f35042ef43 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -327,6 +327,7 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 52020,apps,Other,explore,fireStorm,terms,,,visible|docs,1,positional,list,,,,,one or more address, name, block, or transaction identifier 52030,apps,Other,explore,fireStorm,local,l,,visible|docs,,switch,,,,,,open the local TrueBlocks explorer 52040,apps,Other,explore,fireStorm,google,g,,visible|docs,,switch,,,,,,search google excluding popular blockchain explorers +52050,apps,Other,explore,fireStorm,dalle,d,,,,switch,,,,,,open the address to the DalleDress explorer # 53000,tools,Other,slurp,ethslurp,,,,visible|docs,,command,,,Slurp Api services,[flags]
[address...] [block...],default|caching|ether|names|,Fetch data from Etherscan and other APIs for any address. 53020,tools,Other,slurp,ethslurp,addrs,,,required|visible|docs,3,positional,list,slurp,,,,one or more addresses to slurp from Etherscan diff --git a/src/dev_tools/goMaker/types/types_enums.go b/src/dev_tools/goMaker/types/types_enums.go new file mode 100644 index 0000000000..ab1254f4c2 --- /dev/null +++ b/src/dev_tools/goMaker/types/types_enums.go @@ -0,0 +1 @@ +package types diff --git a/src/dev_tools/goMaker/types/types_notes.go b/src/dev_tools/goMaker/types/types_notes.go new file mode 100644 index 0000000000..ab1254f4c2 --- /dev/null +++ b/src/dev_tools/goMaker/types/types_notes.go @@ -0,0 +1 @@ +package types diff --git a/src/dev_tools/goMaker/types/types_sorts.go b/src/dev_tools/goMaker/types/types_sorts.go new file mode 100644 index 0000000000..ab1254f4c2 --- /dev/null +++ b/src/dev_tools/goMaker/types/types_sorts.go @@ -0,0 +1 @@ +package types diff --git a/tests b/tests index e7be4925c3..af9995f01c 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit e7be4925c30c1d3468794e52582be8262cdad740 +Subproject commit af9995f01c43aa472ef4eaf3df2e94df4b398625 From c6382fe49a3dbb3adff0d4dfffa9e2876165996b Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Tue, 27 Aug 2024 13:50:25 -0400 Subject: [PATCH 107/121] Adds sorting code generation to goMaker. Examples abis, funtions, chunkStats --- sdk/abis.go | 19 +- sdk/chunks.go | 18 ++ src/apps/chifra/pkg/types/types_abi_sort.go | 53 ++--- .../chifra/pkg/types/types_chunkstats_sort.go | 130 +++++++++++++ .../chifra/pkg/types/types_function_sort.go | 82 ++++++++ .../classDefinitions/fields/chunkstats.csv | 24 +-- .../classDefinitions/fields/function.csv | 22 +-- .../goMaker/templates/cmd-line-options.csv | 4 +- .../generators/routes/sdk_route.go.tmpl | 2 +- ...rc_apps_chifra_pkg_types_type+sort.go.tmpl | 42 ++++ src/dev_tools/goMaker/types/templates.go | 16 +- src/dev_tools/goMaker/types/types_command.go | 67 +------ src/dev_tools/goMaker/types/types_enums.go | 183 ++++++++++++++++++ src/dev_tools/goMaker/types/types_notes.go | 26 +++ src/dev_tools/goMaker/types/types_option.go | 136 +------------ src/dev_tools/goMaker/types/types_sorts.go | 130 +++++++++++++ .../goMaker/types/types_structure.go | 9 + src/dev_tools/goMaker/types/utils.go | 1 + .../goMaker/types/verifyValidators.go | 10 +- 19 files changed, 716 insertions(+), 258 deletions(-) create mode 100644 src/apps/chifra/pkg/types/types_chunkstats_sort.go create mode 100644 src/apps/chifra/pkg/types/types_function_sort.go create mode 100644 src/dev_tools/goMaker/templates/generators/types/src_apps_chifra_pkg_types_type+sort.go.tmpl diff --git a/sdk/abis.go b/sdk/abis.go index 1858bcfcfd..80d264a4b6 100644 --- a/sdk/abis.go +++ b/sdk/abis.go @@ -71,7 +71,6 @@ func (opts *AbisOptions) AbisEncode(val string) ([]types.Function, *types.MetaDa } // No enums -// EXISTING_CODE func SortAbis(abis []types.Abi, fields []string, dir []SortOrder) error { if len(fields) != len(dir) { return fmt.Errorf("fields and dir must have the same length") @@ -89,4 +88,22 @@ func SortAbis(abis []types.Abi, fields []string, dir []SortOrder) error { return nil } +func SortFunctions(functions []types.Function, fields []string, dir []SortOrder) error { + if len(fields) != len(dir) { + return fmt.Errorf("fields and dir must have the same length") + } + + sorts := make([]func(p1, p2 types.Function) bool, len(fields)) + for i, field := range fields { + if !types.IsValidFunctionField(field) { + return fmt.Errorf("%s is not an Function sort field", field) + } + sorts[i] = types.FunctionBy(types.FunctionField(field), types.SortOrder(dir[i])) + } + + sort.Slice(functions, types.FunctionCmp(functions, sorts...)) + return nil +} + +// EXISTING_CODE // EXISTING_CODE diff --git a/sdk/chunks.go b/sdk/chunks.go index 0eb323b8fa..7b10c1e985 100644 --- a/sdk/chunks.go +++ b/sdk/chunks.go @@ -12,6 +12,7 @@ import ( // EXISTING_CODE "encoding/json" "fmt" + "sort" "strings" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" @@ -192,5 +193,22 @@ func enumFromChunksMode(values []string) (ChunksMode, error) { return result, nil } +func SortChunkStats(chunkstats []types.ChunkStats, fields []string, dir []SortOrder) error { + if len(fields) != len(dir) { + return fmt.Errorf("fields and dir must have the same length") + } + + sorts := make([]func(p1, p2 types.ChunkStats) bool, len(fields)) + for i, field := range fields { + if !types.IsValidChunkStatsField(field) { + return fmt.Errorf("%s is not an ChunkStats sort field", field) + } + sorts[i] = types.ChunkStatsBy(types.ChunkStatsField(field), types.SortOrder(dir[i])) + } + + sort.Slice(chunkstats, types.ChunkStatsCmp(chunkstats, sorts...)) + return nil +} + // EXISTING_CODE // EXISTING_CODE diff --git a/src/apps/chifra/pkg/types/types_abi_sort.go b/src/apps/chifra/pkg/types/types_abi_sort.go index 95d35bea02..85e5faf997 100644 --- a/src/apps/chifra/pkg/types/types_abi_sort.go +++ b/src/apps/chifra/pkg/types/types_abi_sort.go @@ -11,15 +11,15 @@ const ( AbiIsEmpty AbiField = "isEmpty" AbiIsKnown AbiField = "isKnown" AbiLastModDate AbiField = "lastModDate" - AbiName AbiField = "name" AbiNEvents AbiField = "nEvents" AbiNFunctions AbiField = "nFunctions" + AbiName AbiField = "name" ) // IsValidAbiField returns true if the given field is a valid sortable Abi field. func IsValidAbiField(field string) bool { switch field { - case "address", "fileSize", "hasConstructor", "hasFallback", "isEmpty", "isKnown", "lastModDate", "name", "nEvents", "nFunctions": + case "address", "fileSize", "hasConstructor", "hasFallback", "isEmpty", "isKnown", "lastModDate", "nEvents", "nFunctions", "name": return true } return false @@ -29,7 +29,7 @@ func IsValidAbiField(field string) bool { // These comparison functions may be strung together by the CmdAbis function. func AbiBy(field AbiField, order SortOrder) func(p1, p2 Abi) bool { switch field { - case AbiAddress: + case AbiAddress: // address return func(p1, p2 Abi) bool { cmp := p1.Address.Cmp(p2.Address.Address) if order == Ascending { @@ -37,69 +37,70 @@ func AbiBy(field AbiField, order SortOrder) func(p1, p2 Abi) bool { } return cmp == 1 } - case AbiFileSize: + case AbiFileSize: // int64 return func(p1, p2 Abi) bool { if order == Ascending { return p1.FileSize < p2.FileSize } return p1.FileSize > p2.FileSize } - case AbiHasConstructor: + case AbiHasConstructor: // bool return func(p1, p2 Abi) bool { if order == Ascending { - return !p1.HasConstructor && p2.HasConstructor // False < True + return !p1.HasConstructor && p2.HasConstructor } - return p1.HasConstructor && !p2.HasConstructor // True < False + return p1.HasConstructor && !p2.HasConstructor } - case AbiHasFallback: + case AbiHasFallback: // bool return func(p1, p2 Abi) bool { if order == Ascending { - return !p1.HasFallback && p2.HasFallback // False < True + return !p1.HasFallback && p2.HasFallback } - return p1.HasFallback && !p2.HasFallback // True < False + return p1.HasFallback && !p2.HasFallback } - case AbiIsEmpty: + case AbiIsEmpty: // bool return func(p1, p2 Abi) bool { if order == Ascending { - return !p1.IsEmpty && p2.IsEmpty // False < True + return !p1.IsEmpty && p2.IsEmpty } - return p1.IsEmpty && !p2.IsEmpty // True < False + return p1.IsEmpty && !p2.IsEmpty } - case AbiIsKnown: + case AbiIsKnown: // bool return func(p1, p2 Abi) bool { if order == Ascending { - return !p1.IsKnown && p2.IsKnown // False < True + return !p1.IsKnown && p2.IsKnown } - return p1.IsKnown && !p2.IsKnown // True < False + return p1.IsKnown && !p2.IsKnown } - case AbiLastModDate: + case AbiLastModDate: // string return func(p1, p2 Abi) bool { if order == Ascending { return p1.LastModDate < p2.LastModDate } return p1.LastModDate > p2.LastModDate } - case AbiName: - return func(p1, p2 Abi) bool { - if order == Ascending { - return p1.Name < p2.Name - } - return p1.Name > p2.Name - } - case AbiNEvents: + case AbiNEvents: // int64 return func(p1, p2 Abi) bool { if order == Ascending { return p1.NEvents < p2.NEvents } return p1.NEvents > p2.NEvents } - case AbiNFunctions: + case AbiNFunctions: // int64 return func(p1, p2 Abi) bool { if order == Ascending { return p1.NFunctions < p2.NFunctions } return p1.NFunctions > p2.NFunctions } + case AbiName: // string + return func(p1, p2 Abi) bool { + if order == Ascending { + return p1.Name < p2.Name + } + return p1.Name > p2.Name + } + } panic("Should not happen in AbiBy") } diff --git a/src/apps/chifra/pkg/types/types_chunkstats_sort.go b/src/apps/chifra/pkg/types/types_chunkstats_sort.go new file mode 100644 index 0000000000..080a36a7b1 --- /dev/null +++ b/src/apps/chifra/pkg/types/types_chunkstats_sort.go @@ -0,0 +1,130 @@ +package types + +type ChunkStatsField string + +// Fields in the ChunkStats struct available for sorting. +const ( + ChunkStatsAddrsPerBlock ChunkStatsField = "addrsPerBlock" + ChunkStatsAppsPerAddr ChunkStatsField = "appsPerAddr" + ChunkStatsAppsPerBlock ChunkStatsField = "appsPerBlock" + ChunkStatsBloomSz ChunkStatsField = "bloomSz" + ChunkStatsChunkSz ChunkStatsField = "chunkSz" + ChunkStatsNAddrs ChunkStatsField = "nAddrs" + ChunkStatsNApps ChunkStatsField = "nApps" + ChunkStatsNBlocks ChunkStatsField = "nBlocks" + ChunkStatsNBlooms ChunkStatsField = "nBlooms" + ChunkStatsRange ChunkStatsField = "range" + ChunkStatsRatio ChunkStatsField = "ratio" +) + +// IsValidChunkStatsField returns true if the given field is a valid sortable ChunkStats field. +func IsValidChunkStatsField(field string) bool { + switch field { + case "addrsPerBlock", "appsPerAddr", "appsPerBlock", "bloomSz", "chunkSz", "nAddrs", "nApps", "nBlocks", "nBlooms", "range", "ratio": + return true + } + return false +} + +// ChunkStatsBy returns a comparison function for sorting ChunkStats instances by the given field. +// These comparison functions may be strung together by the CmdChunkStats function. +func ChunkStatsBy(field ChunkStatsField, order SortOrder) func(p1, p2 ChunkStats) bool { + switch field { + case ChunkStatsAddrsPerBlock: // float64 + return func(p1, p2 ChunkStats) bool { + if order == Ascending { + return p1.AddrsPerBlock < p2.AddrsPerBlock + } + return p1.AddrsPerBlock > p2.AddrsPerBlock + } + case ChunkStatsAppsPerAddr: // float64 + return func(p1, p2 ChunkStats) bool { + if order == Ascending { + return p1.AppsPerAddr < p2.AppsPerAddr + } + return p1.AppsPerAddr > p2.AppsPerAddr + } + case ChunkStatsAppsPerBlock: // float64 + return func(p1, p2 ChunkStats) bool { + if order == Ascending { + return p1.AppsPerBlock < p2.AppsPerBlock + } + return p1.AppsPerBlock > p2.AppsPerBlock + } + case ChunkStatsBloomSz: // uint64 + return func(p1, p2 ChunkStats) bool { + if order == Ascending { + return p1.BloomSz < p2.BloomSz + } + return p1.BloomSz > p2.BloomSz + } + case ChunkStatsChunkSz: // uint64 + return func(p1, p2 ChunkStats) bool { + if order == Ascending { + return p1.ChunkSz < p2.ChunkSz + } + return p1.ChunkSz > p2.ChunkSz + } + case ChunkStatsNAddrs: // uint64 + return func(p1, p2 ChunkStats) bool { + if order == Ascending { + return p1.NAddrs < p2.NAddrs + } + return p1.NAddrs > p2.NAddrs + } + case ChunkStatsNApps: // uint64 + return func(p1, p2 ChunkStats) bool { + if order == Ascending { + return p1.NApps < p2.NApps + } + return p1.NApps > p2.NApps + } + case ChunkStatsNBlocks: // uint64 + return func(p1, p2 ChunkStats) bool { + if order == Ascending { + return p1.NBlocks < p2.NBlocks + } + return p1.NBlocks > p2.NBlocks + } + case ChunkStatsNBlooms: // uint64 + return func(p1, p2 ChunkStats) bool { + if order == Ascending { + return p1.NBlooms < p2.NBlooms + } + return p1.NBlooms > p2.NBlooms + } + case ChunkStatsRange: // blkrange + return func(p1, p2 ChunkStats) bool { + if order == Ascending { + return p1.Range < p2.Range + } + return p1.Range > p2.Range + } + case ChunkStatsRatio: // float64 + return func(p1, p2 ChunkStats) bool { + if order == Ascending { + return p1.Ratio < p2.Ratio + } + return p1.Ratio > p2.Ratio + } + + } + panic("Should not happen in ChunkStatsBy") +} + +// ChunkStatsCmp accepts a slice and variadic comparison functions and returns a functions +// that can be used to sort the slice. +func ChunkStatsCmp(slice []ChunkStats, orders ...func(p1, p2 ChunkStats) bool) func(i, j int) bool { + return func(i, j int) bool { + p1, p2 := slice[i], slice[j] + for _, order := range orders { + if order(p1, p2) { + return true + } + if order(p2, p1) { + return false + } + } + return false + } +} diff --git a/src/apps/chifra/pkg/types/types_function_sort.go b/src/apps/chifra/pkg/types/types_function_sort.go new file mode 100644 index 0000000000..fdb15b1355 --- /dev/null +++ b/src/apps/chifra/pkg/types/types_function_sort.go @@ -0,0 +1,82 @@ +package types + +type FunctionField string + +// Fields in the Function struct available for sorting. +const ( + FunctionEncoding FunctionField = "encoding" + FunctionName FunctionField = "name" + FunctionSignature FunctionField = "signature" + FunctionStateMutability FunctionField = "stateMutability" + FunctionType FunctionField = "type" +) + +// IsValidFunctionField returns true if the given field is a valid sortable Function field. +func IsValidFunctionField(field string) bool { + switch field { + case "encoding", "name", "signature", "stateMutability", "type": + return true + } + return false +} + +// FunctionBy returns a comparison function for sorting Function instances by the given field. +// These comparison functions may be strung together by the CmdFunctions function. +func FunctionBy(field FunctionField, order SortOrder) func(p1, p2 Function) bool { + switch field { + case FunctionEncoding: // string + return func(p1, p2 Function) bool { + if order == Ascending { + return p1.Encoding < p2.Encoding + } + return p1.Encoding > p2.Encoding + } + case FunctionName: // string + return func(p1, p2 Function) bool { + if order == Ascending { + return p1.Name < p2.Name + } + return p1.Name > p2.Name + } + case FunctionSignature: // string + return func(p1, p2 Function) bool { + if order == Ascending { + return p1.Signature < p2.Signature + } + return p1.Signature > p2.Signature + } + case FunctionStateMutability: // string + return func(p1, p2 Function) bool { + if order == Ascending { + return p1.StateMutability < p2.StateMutability + } + return p1.StateMutability > p2.StateMutability + } + case FunctionType: // string + return func(p1, p2 Function) bool { + if order == Ascending { + return p1.FunctionType < p2.FunctionType + } + return p1.FunctionType > p2.FunctionType + } + + } + panic("Should not happen in FunctionBy") +} + +// FunctionCmp accepts a slice and variadic comparison functions and returns a functions +// that can be used to sort the slice. +func FunctionCmp(slice []Function, orders ...func(p1, p2 Function) bool) func(i, j int) bool { + return func(i, j int) bool { + p1, p2 := slice[i], slice[j] + for _, order := range orders { + if order(p1, p2) { + return true + } + if order(p2, p1) { + return false + } + } + return false + } +} diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv index a9d024a7b6..ef72d88793 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv @@ -1,14 +1,14 @@ name ,type ,strDefault ,attributes ,docOrder ,description -range ,blkrange , , , 1 ,the block range (inclusive) covered by this chunk -nAddrs ,uint64 , , , 2 ,the number of addresses in the chunk -nApps ,uint64 , , , 3 ,the number of appearances in the chunk -nBlocks ,uint64 , , , 4 ,the number of blocks in the chunk -nBlooms ,uint64 , , , 5 ,the number of bloom filters in the chunk's bloom +range ,blkrange , ,sorts , 1 ,the block range (inclusive) covered by this chunk +nAddrs ,uint64 , ,sorts , 2 ,the number of addresses in the chunk +nApps ,uint64 , ,sorts , 3 ,the number of appearances in the chunk +nBlocks ,uint64 , ,sorts , 4 ,the number of blocks in the chunk +nBlooms ,uint64 , ,sorts , 5 ,the number of bloom filters in the chunk's bloom recWid ,uint64 , , , 6 ,the record width of a single bloom filter -bloomSz ,uint64 , , , 7 ,the size of the bloom filters on disc in bytes -chunkSz ,uint64 , , , 8 ,the size of the chunks on disc in bytes -addrsPerBlock ,float64 , , , 9 ,the average number of addresses per block -appsPerBlock ,float64 , , , 10 ,the average number of appearances per block -appsPerAddr ,float64 , , , 11 ,the average number of appearances per address -ratio ,float64 , , , 12 ,the ratio of appearances to addresses -rangeDates ,RangeDates , , , 13 ,if verbose, the block and timestamp bounds of the chunk +bloomSz ,uint64 , ,sorts , 7 ,the size of the bloom filters on disc in bytes +chunkSz ,uint64 , ,sorts , 8 ,the size of the chunks on disc in bytes +addrsPerBlock ,float64 , ,sorts , 9 ,the average number of addresses per block +appsPerBlock ,float64 , ,sorts , 10 ,the average number of appearances per block +appsPerAddr ,float64 , ,sorts , 11 ,the average number of appearances per address +ratio ,float64 , ,sorts , 12 ,the ratio of appearances to addresses +rangeDates ,RangeDates , , , 13 ,if verbose, the block and timestamp bounds of the chunk diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/function.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/function.csv index 94b384636e..1bc392eb6b 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/function.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/function.csv @@ -1,11 +1,11 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -name ,string , , , 1 ,the name of the interface -type ,string , , , 2 ,the type of the interface, either 'event' or 'function' -anonymous ,bool , ,omitempty , , -constant ,bool , ,omitempty , , -stateMutability ,string , ,omitempty , , -signature ,string , ,omitempty , 3 ,the canonical signature of the interface -encoding ,string , , , 4 ,the signature encoded with keccak -message ,string , ,omitempty , , -inputs ,[]Parameter , , , 5 ,the input parameters to the function, if any -outputs ,[]Parameter , , , 6 ,the output parameters to the function, if any +name ,type ,strDefault ,attributes ,docOrder ,description +name ,string , ,sorts , 1 ,the name of the interface +type ,string , ,sorts , 2 ,the type of the interface, either 'event' or 'function' +anonymous ,bool , ,omitempty , , +constant ,bool , ,omitempty , , +stateMutability ,string , ,omitempty|sorts , , +signature ,string , ,omitempty|sorts , 3 ,the canonical signature of the interface +encoding ,string , ,sorts , 4 ,the signature encoded with keccak +message ,string , ,omitempty , , +inputs ,[]Parameter , , , 5 ,the input parameters to the function, if any +outputs ,[]Parameter , , , 6 ,the output parameters to the function, if any diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index f35042ef43..2386ba18f8 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -102,7 +102,7 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 15190,tools,Accounts,names,ethNames,n1,,,,,note,,,,,,The tool will accept up to three terms, each of which must match against any field in the database. 15200,tools,Accounts,names,ethNames,n2,,,,,note,,,,,,The `--match_case` option enables case sensitive matching. # -16000,tools,Accounts,abis,grabABI,,,,visible|docs,,command,,,Manage Abi files,[flags]
[address...],default|caching|names|,Fetches the ABI for a smart contract. +16000,tools,Accounts,abis,grabABI,,,,visible|docs|sorts=function:abi,,command,,,Manage Abi files,[flags]
[address...],default|caching|names|,Fetches the ABI for a smart contract. 16020,tools,Accounts,abis,grabABI,addrs,,,required|visible|docs,5,positional,list,function,,,,a list of one or more smart contracts whose ABIs to display 16030,tools,Accounts,abis,grabABI,known,k,,visible|docs,,switch,,,,,,load common 'known' ABIs from cache 16040,tools,Accounts,abis,grabABI,proxy_for,r,,visible|docs,,flag,
,,,,,redirects the query to this implementation @@ -278,7 +278,7 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 45150,apps,Admin,scrape,blockScrape,n2,,,,,note,,,,,,This command requires your RPC to provide trace data. See the README for more information. 45150,apps,Admin,scrape,blockScrape,n3,,,,,note,,,,,,The --notify option requires proper configuration. Additionally, IPFS must be running locally. See the README.md file. # -46000,apps,Admin,chunks,chunkMan,,,,visible|docs,,command,,,Manage chunks, [flags] [blocks...] [address...],default|,Manage, investigate, and display the Unchained Index. +46000,apps,Admin,chunks,chunkMan,,,,visible|docs|sorts=chunkStats,,command,,,Manage chunks, [flags] [blocks...] [address...],default|,Manage, investigate, and display the Unchained Index. 46020,apps,Admin,chunks,chunkMan,mode,,,required|visible|docs,9,positional,enum[manifest|index|blooms|pins|addresses|appearances|stats],mode,,,,the type of data to process 46030,apps,Admin,chunks,chunkMan,blocks,,,visible|docs,,positional,list,,,,,an optional list of blocks to intersect with chunk ranges 46040,apps,Admin,chunks,chunkMan,check,c,,visible|docs,1,switch,,,,,,check the manifest, index, or blooms for internal consistency diff --git a/src/dev_tools/goMaker/templates/generators/routes/sdk_route.go.tmpl b/src/dev_tools/goMaker/templates/generators/routes/sdk_route.go.tmpl index 8122b2c5d2..3a898fcb12 100644 --- a/src/dev_tools/goMaker/templates/generators/routes/sdk_route.go.tmpl +++ b/src/dev_tools/goMaker/templates/generators/routes/sdk_route.go.tmpl @@ -27,6 +27,6 @@ func (opts {{toProper .Route}}Options) String() string { {{if .HasSdkEndpoints}}{{.SdkEndpoints}}{{end}} -{{.Enums2}} +{{.Enums2}}{{if .HasSorts}}{{.Sorts2}}{{end}} // EXISTING_CODE // EXISTING_CODE diff --git a/src/dev_tools/goMaker/templates/generators/types/src_apps_chifra_pkg_types_type+sort.go.tmpl b/src/dev_tools/goMaker/templates/generators/types/src_apps_chifra_pkg_types_type+sort.go.tmpl new file mode 100644 index 0000000000..d97533a808 --- /dev/null +++ b/src/dev_tools/goMaker/templates/generators/types/src_apps_chifra_pkg_types_type+sort.go.tmpl @@ -0,0 +1,42 @@ +{{if .HasSorts}}package types + +type {{.Class}}Field string + +// Fields in the {{.Class}} struct available for sorting. +{{.SortFields}} + +// IsValid{{.Class}}Field returns true if the given field is a valid sortable {{.Class}} field. +func IsValid{{.Class}}Field(field string) bool { + switch field { + case {{.SortString}}: + return true + } + return false +} + +// {{.Class}}By returns a comparison function for sorting {{.Class}} instances by the given field. +// These comparison functions may be strung together by the Cmd{{toPlural .Class}} function. +func {{.Class}}By(field {{.Class}}Field, order SortOrder) func(p1, p2 {{.Class}}) bool { + switch field { +{{.SortSwitches}} + } + panic("Should not happen in {{.Class}}By") +} + +// {{.Class}}Cmp accepts a slice and variadic comparison functions and returns a functions +// that can be used to sort the slice. +func {{.Class}}Cmp(slice []{{.Class}}, orders ...func(p1, p2 {{.Class}}) bool) func(i, j int) bool { + return func(i, j int) bool { + p1, p2 := slice[i], slice[j] + for _, order := range orders { + if order(p1, p2) { + return true + } + if order(p2, p1) { + return false + } + } + return false + } +} +{{end}} diff --git a/src/dev_tools/goMaker/types/templates.go b/src/dev_tools/goMaker/types/templates.go index 9fcca79d2d..16583056f4 100644 --- a/src/dev_tools/goMaker/types/templates.go +++ b/src/dev_tools/goMaker/types/templates.go @@ -40,13 +40,15 @@ func getFuncMap() template.FuncMap { toLower := func(s string) string { return Lower(s) } firstLower := func(s string) string { return FirstLower(s) } firstUpper := func(s string) string { return FirstUpper(s) } + toLowerPlural := func(s string) string { return Lower(Plural(s)) } return template.FuncMap{ - "toSingular": toSingular, - "toProper": toProper, - "toCamel": toCamel, - "toPlural": toPlural, - "toLower": toLower, - "firstLower": firstLower, - "firstUpper": firstUpper, + "toSingular": toSingular, + "toProper": toProper, + "toCamel": toCamel, + "toPlural": toPlural, + "toLowerPlural": toLowerPlural, + "toLower": toLower, + "firstLower": firstLower, + "firstUpper": firstUpper, } } diff --git a/src/dev_tools/goMaker/types/types_command.go b/src/dev_tools/goMaker/types/types_command.go index ea62b739f7..865550327c 100644 --- a/src/dev_tools/goMaker/types/types_command.go +++ b/src/dev_tools/goMaker/types/types_command.go @@ -27,6 +27,7 @@ type Command struct { Usage string `json:"usage,omitempty"` Summary string `json:"summary,omitempty"` Notes []string `json:"notes,omitempty"` + Sorts []string `json:"sorts,omitempty"` Aliases []string `json:"aliases,omitempty"` Productions []*Structure `json:"productions,omitempty"` cbPtr *CodeBase `json:"-"` @@ -81,10 +82,6 @@ func (c *Command) HasPositionals() bool { return false } -func (c *Command) HasNotes() bool { - return len(c.Notes) > 0 -} - func (c *Command) HasExample() bool { examplePath := filepath.Join(GetTemplatePath(), "api/examples/"+c.Route+".json") return file.FileExists(examplePath) @@ -108,18 +105,10 @@ func (c *Command) HasAddrs() bool { return false } -func (c *Command) HasEnums() bool { - for _, op := range c.Options { - if op.IsEnum() { - return true - } - } - return false -} - func (c *Command) Clean() { cleaned := []Option{} c.Notes = []string{} + c.Sorts = []string{} c.Aliases = []string{} for _, op := range c.Options { op.GoName = op.toGoName() @@ -144,6 +133,7 @@ func (c *Command) Clean() { op.DataType = "enum" } } + if op.OptionType == "note" { if !strings.HasSuffix(op.Description, ".") { logger.Warn("Note does not end with a period: " + op.Description) @@ -153,6 +143,9 @@ func (c *Command) Clean() { c.Aliases = append(c.Aliases, op.Description) } else if op.OptionType == "command" { c.Description = op.Description + if c.HasSorts() { + c.Sorts = getSorts(op.Attributes) + } } else if op.OptionType == "group" { // c.Description = op.Description } else { @@ -269,40 +262,6 @@ func (c *Command) PyOptions() string { // Tags found in sdk_go_route.go -// Enums1 for tag {{.Enums1}} -func (c *Command) Enums1() string { - if !c.HasEnums() { - return "// No enums" - } - - ret := "" - for _, op := range c.Options { - ret += op.Enum1() - } - return ret -} - -// Enums2 for tag {{.Enums2}} -func (c *Command) Enums2() string { - if !c.HasEnums() { - return "// No enums" - } - - ret := "" - for _, op := range c.Options { - ret += op.Enum2() - } - return ret -} - -// Enums3 for tag {{.Enums3}} -func (c *Command) Enums3() string { - if !c.HasEnums() { - return "_" - } - return "opts" -} - // Pkg for tag {{.Pkg}} func (c *Command) Pkg() string { if c.Route == "init" { @@ -546,20 +505,6 @@ func (c *Command) HelpLinks() string { return c.executeTemplate(tmplName, tmpl) } -func (c *Command) HelpNotes() string { - readmePath := filepath.Join(GetTemplatePath(), "readme-intros", c.ReadmeName()) - readmePath = strings.Replace(readmePath, ".md", ".notes.md", -1) - if file.FileExists(readmePath) { - tmplName := "Notes" + c.ReadmeName() - tmpl := file.AsciiFileToString(readmePath) - if tmpl == "" { - logger.Fatal("Could not read template file: ", readmePath) - } - return "\n\n" + strings.Trim(c.executeTemplate(tmplName, tmpl), ws) - } - return "" -} - func (c *Command) ReadmeFooter() string { footerFile := filepath.Join(GetTemplatePath(), "readme-intros/README.footer.md") return strings.Trim(file.AsciiFileToString(footerFile), ws) diff --git a/src/dev_tools/goMaker/types/types_enums.go b/src/dev_tools/goMaker/types/types_enums.go index ab1254f4c2..4886343136 100644 --- a/src/dev_tools/goMaker/types/types_enums.go +++ b/src/dev_tools/goMaker/types/types_enums.go @@ -1 +1,184 @@ package types + +import ( + "strings" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" +) + +// For Commands + +func (c *Command) HasEnums() bool { + for _, op := range c.Options { + if op.IsEnum() { + return true + } + } + return false +} + +// Enums1 for tag {{.Enums1}} +func (c *Command) Enums1() string { + if !c.HasEnums() { + return "// No enums" + } + + ret := "" + for _, op := range c.Options { + ret += op.Enum1() + } + return ret +} + +// Enums2 for tag {{.Enums2}} +func (c *Command) Enums2() string { + if !c.HasEnums() { + return "// No enums" + } + + ret := "" + for _, op := range c.Options { + ret += op.Enum2() + } + return ret +} + +// Enums3 for tag {{.Enums3}} +func (c *Command) Enums3() string { + if !c.HasEnums() { + return "_" + } + return "opts" +} + +// For Options + +func (op *Option) EnumChoices() string { + ret := "One of " + if op.IsArray() { + ret = "One or more of " + } + return ret + "[ " + strings.Join(op.Enums, " | ") + " ]" +} + +func (op *Option) EnumName() string { + if len(op.Route) < 2 { + return "" + } + return strings.ToUpper(op.Route[0:1]) + op.Route[1:] + op.GoName +} + +func (op *Option) EnumTag(e string) string { + if len(op.Route) < 2 || len(op.GoSdkName) < 2 { + return "" + } + tag := strings.ToUpper(op.Route[0:1]) + op.GoSdkName[0:1] + if tag == "CM" && e == "none" { + tag = strings.ToUpper(op.Route[0:2]) + op.GoSdkName[0:1] + } else if tag == "SP" && (e == "none" || e == "all" || e == "some") { + tag = strings.ToUpper(op.Route[0:2]) + op.GoSdkName[0:1] + } + return tag +} + +func (op *Option) EnumNone() string { + if len(op.Route) < 3 || len(op.GoSdkName) < 2 { + return "" + } + tag := op.EnumTag("none") + return "No" + tag +} + +func (op *Option) EnumDef() string { + some := []string{} + all := []string{} + ret := []string{} + for i, e := range op.Enums { + tag := op.EnumTag(e) + token := tag + FirstUpper(e) + if e == "some" { + if op.Route == "state" { + some = []string{"SPBalance", "SPProxy", "SPDeployed", "SPAccttype"} + } + token += "=" + strings.Join(some, "|") + } else if e == "all" { + token += "=" + strings.Join(all, "|") + } else { + if len(ret) < 5 { + some = append(some, token) + } + all = append(all, token) + if i == 0 { + ret = append(ret, "\t"+op.EnumNone()+" "+op.EnumName()+" = 0") + token += " = 1 << iota" + } + } + ret = append(ret, "\t"+token) + } + return strings.Join(ret, "\n") +} + +func (op *Option) EnumMap() string { + ret := []string{} + for _, e := range op.Enums { + if e == "some" || e == "all" { + continue + } + v := "\t\t" + op.EnumTag(e) + FirstUpper(e) + ": \"" + e + "\"," + ret = append(ret, v) + } + return strings.Join(ret, "\n") +} + +func (op *Option) EnumList() string { + ret := []string{} + for _, e := range op.Enums { + if e == "some" || e == "all" { + continue + } + ret = append(ret, op.EnumTag(e)+FirstUpper(e)) + } + return op.EnumName() + "{" + strings.Join(ret, ", ") + "}" +} + +func (op *Option) HasEnumAll() bool { + for _, e := range op.Enums { + if e == "all" { + return true + } + } + return false +} + +func (op *Option) EnumTypes() []string { + ret := []string{} + for _, e := range op.Enums { + opp := *op + opp.GoName = e + ret = append(ret, opp.ModeType()) + } + return ret +} + +func (op *Option) EnumCases() string { + ret := []string{} + for _, e := range op.Enums { + if e == "some" || e == "all" { + continue + } + v := op.EnumTag(e) + FirstUpper(e) + ret = append(ret, "\t\tcase \""+e+"\":\n\t\t\tresult |= "+v) + } + v := "\t\tdefault:\n\t\t\treturn " + op.EnumNone() + ", fmt.Errorf(\"unknown " + op.LongName + ": %s\", val)" + ret = append(ret, v) + return strings.Join(ret, "\n") +} + +func ValidateEnums(path string, enums []string) (bool, string) { + if len(enums) == 0 { + return true, "" + } + contents := file.AsciiFileToString(path) + want := strings.Join(enums, "|") + return strings.Contains(contents, want), want +} diff --git a/src/dev_tools/goMaker/types/types_notes.go b/src/dev_tools/goMaker/types/types_notes.go index ab1254f4c2..d20531f84d 100644 --- a/src/dev_tools/goMaker/types/types_notes.go +++ b/src/dev_tools/goMaker/types/types_notes.go @@ -1 +1,27 @@ package types + +import ( + "path/filepath" + "strings" + + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" +) + +func (c *Command) HasNotes() bool { + return len(c.Notes) > 0 +} + +func (c *Command) HelpNotes() string { + readmePath := filepath.Join(GetTemplatePath(), "readme-intros", c.ReadmeName()) + readmePath = strings.Replace(readmePath, ".md", ".notes.md", -1) + if file.FileExists(readmePath) { + tmplName := "Notes" + c.ReadmeName() + tmpl := file.AsciiFileToString(readmePath) + if tmpl == "" { + logger.Fatal("Could not read template file: ", readmePath) + } + return "\n\n" + strings.Trim(c.executeTemplate(tmplName, tmpl), ws) + } + return "" +} diff --git a/src/dev_tools/goMaker/types/types_option.go b/src/dev_tools/goMaker/types/types_option.go index 52c05fdb3a..45d2ee1c53 100644 --- a/src/dev_tools/goMaker/types/types_option.go +++ b/src/dev_tools/goMaker/types/types_option.go @@ -27,7 +27,6 @@ type Option struct { Capabilities string `json:"capabilities,omitempty" csv:"capabilities"` Description string `json:"description,omitempty" csv:"description"` Enums []string `json:"enums,omitempty"` - EnumVal string `json:"enum_name,omitempty"` DefaultEnum string `json:"default_enum,omitempty"` GoName string `json:"go_name"` GoType string `json:"go_type"` @@ -74,14 +73,6 @@ func (op Option) String() string { return string(bytes) } -func (op *Option) EnumChoices() string { - ret := "One of " - if op.IsArray() { - ret = "One or more of " - } - return ret + "[ " + strings.Join(op.Enums, " | ") + " ]" -} - func (op Option) Validate() bool { return op.LongName != "--------" } @@ -276,99 +267,10 @@ func (op *Option) Default() string { return op.DefVal } -func (op *Option) EnumName() string { - if len(op.Route) < 2 { - return "" - } - return strings.ToUpper(op.Route[0:1]) + op.Route[1:] + op.GoName -} - -func (op *Option) EnumTag(e string) string { - if len(op.Route) < 2 || len(op.GoSdkName) < 2 { - return "" - } - tag := strings.ToUpper(op.Route[0:1]) + op.GoSdkName[0:1] - if tag == "CM" && e == "none" { - tag = strings.ToUpper(op.Route[0:2]) + op.GoSdkName[0:1] - } else if tag == "SP" && (e == "none" || e == "all" || e == "some") { - tag = strings.ToUpper(op.Route[0:2]) + op.GoSdkName[0:1] - } - return tag -} - -func (op *Option) EnumNone() string { - if len(op.Route) < 3 || len(op.GoSdkName) < 2 { - return "" - } - tag := op.EnumTag("none") - return "No" + tag -} - -func (op *Option) EnumDef() string { - some := []string{} - all := []string{} - ret := []string{} - for i, e := range op.Enums { - tag := op.EnumTag(e) - token := tag + FirstUpper(e) - if e == "some" { - if op.Route == "state" { - some = []string{"SPBalance", "SPProxy", "SPDeployed", "SPAccttype"} - } - token += "=" + strings.Join(some, "|") - } else if e == "all" { - token += "=" + strings.Join(all, "|") - } else { - if len(ret) < 5 { - some = append(some, token) - } - all = append(all, token) - if i == 0 { - ret = append(ret, "\t"+op.EnumNone()+" "+op.EnumName()+" = 0") - token += " = 1 << iota" - } - } - ret = append(ret, "\t"+token) - } - return strings.Join(ret, "\n") -} - -func (op *Option) EnumMap() string { - ret := []string{} - for _, e := range op.Enums { - if e == "some" || e == "all" { - continue - } - v := "\t\t" + op.EnumTag(e) + FirstUpper(e) + ": \"" + e + "\"," - ret = append(ret, v) - } - return strings.Join(ret, "\n") -} - func (op *Option) Lower() string { return strings.ToLower(op.LongName) } -func (op *Option) EnumList() string { - ret := []string{} - for _, e := range op.Enums { - if e == "some" || e == "all" { - continue - } - ret = append(ret, op.EnumTag(e)+FirstUpper(e)) - } - return op.EnumName() + "{" + strings.Join(ret, ", ") + "}" -} - -func (op *Option) HasEnumAll() bool { - for _, e := range op.Enums { - if e == "all" { - return true - } - } - return false -} - func (op *Option) PreSwitch() string { if !op.HasEnumAll() { return "" @@ -397,30 +299,6 @@ func (op *Option) SomeCases() string { return op.executeTemplate(tmplName, tmpl) } -func (op *Option) EnumTypes() []string { - ret := []string{} - for _, e := range op.Enums { - opp := *op - opp.GoName = e - ret = append(ret, opp.ModeType()) - } - return ret -} - -func (op *Option) EnumCases() string { - ret := []string{} - for _, e := range op.Enums { - if e == "some" || e == "all" { - continue - } - v := op.EnumTag(e) + FirstUpper(e) - ret = append(ret, "\t\tcase \""+e+"\":\n\t\t\tresult |= "+v) - } - v := "\t\tdefault:\n\t\t\treturn " + op.EnumNone() + ", fmt.Errorf(\"unknown " + op.LongName + ": %s\", val)" - ret = append(ret, v) - return strings.Join(ret, "\n") -} - func (op *Option) IsConfigurableAddr() bool { return op.GoName == "Publisher" } @@ -937,22 +815,22 @@ func (op *Option) SdkEndpoint() string { tmplName := "sdkEndpointRegular" tmpl := sdkEndpointRegular - opp := *op + copy := *op if op.IsMode() { - opp.OptionType = "" // no positional any longer + copy.OptionType = "" // not positional any longer ret := []string{} for _, enum := range op.Enums { - opp.GoName = FirstUpper(enum) - ret = append(ret, opp.executeTemplate(tmplName, tmpl)) + copy.GoName = FirstUpper(enum) + ret = append(ret, copy.executeTemplate(tmplName, tmpl)) } return strings.Join(ret, "\n") } - if opp.IsPositional() { - opp.GoName = "" + if copy.IsPositional() { + copy.GoName = "" } - return opp.executeTemplate(tmplName, tmpl) + return copy.executeTemplate(tmplName, tmpl) } func (op *Option) SdkCoreType() string { diff --git a/src/dev_tools/goMaker/types/types_sorts.go b/src/dev_tools/goMaker/types/types_sorts.go index ab1254f4c2..c8ee743d4a 100644 --- a/src/dev_tools/goMaker/types/types_sorts.go +++ b/src/dev_tools/goMaker/types/types_sorts.go @@ -1 +1,131 @@ package types + +import ( + "sort" + "strings" +) + +func (c *Command) HasSorts() bool { + return strings.Contains(c.Attributes, "sorts=") +} + +func getSorts(attributes string) []string { + parts := strings.Split(attributes, "=") + if len(parts) < 2 { + return []string{} + } + parts = strings.Split(parts[1], ":") + ret := []string{} + for _, part := range parts { + ret = append(ret, FirstUpper(part)) + } + sort.Strings(ret) + return ret +} + +type Sort struct { + Type string +} + +// Sorts2 for tag {{.Sorts2}} +func (c *Command) Sorts2() string { + ret := "" + for _, sort := range c.Sorts { + tmplName := "sortCode" + tmpl := ` +func Sort{{toPlural .Type}}({{toLowerPlural .Type}} []types.{{.Type}}, fields []string, dir []SortOrder) error { + if len(fields) != len(dir) { + return fmt.Errorf("fields and dir must have the same length") + } + + sorts := make([]func(p1, p2 types.{{.Type}}) bool, len(fields)) + for i, field := range fields { + if !types.IsValid{{.Type}}Field(field) { + return fmt.Errorf("%s is not an {{.Type}} sort field", field) + } + sorts[i] = types.{{.Type}}By(types.{{.Type}}Field(field), types.SortOrder(dir[i])) + } + + sort.Slice({{toLowerPlural .Type}}, types.{{.Type}}Cmp({{toLowerPlural .Type}}, sorts...)) + return nil +} +` + ss := Sort{Type: sort} + ret += executeTemplate(ss, "sort", tmplName, tmpl) + } + return ret +} + +func (m *Member) IsSortable() bool { + return strings.Contains(m.Attributes, "sort") +} + +func (s *Structure) SortString() string { + ret := "" + for _, member := range s.Members { + if member.IsSortable() { + ret += ("\"" + FirstLower(member.Name) + "\",") + } + } + return strings.Trim(ret, ",") +} + +func (s *Structure) SortFields() string { + fields := []string{} + for _, member := range s.Members { + if member.IsSortable() { + tmplName := "sortField" + s.Class + tmpl := s.Class + "{{firstUpper .Name}} {{.Container}}Field = \"{{firstLower .Name}}\"" + code := member.executeTemplate(tmplName, tmpl) + code = strings.ReplaceAll(code, s.Class+s.Class, s.Class) + fields = append(fields, code) + } + } + return "const (\n" + strings.Join(fields, "\n") + ")\n" +} + +func (s *Structure) SortSwitches() string { + fields := []string{} + for _, member := range s.Members { + if member.IsSortable() { + tmplName := "sortCase" + member.Type + s.Class + tmpl := getSortCode(member.Type) + fields = append(fields, member.executeTemplate(tmplName, tmpl)) + } + } + return strings.Join(fields, "") +} + +func getSortCode(typ string) string { + switch typ { + case "bool": + return ` case {{.Container}}{{firstUpper .Name}}: // {{.Type}} + return func(p1, p2 {{.Container}}) bool { + if order == Ascending { + return !p1.{{.GoName}} && p2.{{.GoName}} + } + return p1.{{.GoName}} && !p2.{{.GoName}} + } +` + case "address": + return ` case {{.Container}}{{firstUpper .Name}}: // {{.Type}} + return func(p1, p2 {{.Container}}) bool { + cmp := p1.{{.GoName}}.Cmp(p2.Address.{{.GoName}}) + if order == Ascending { + return cmp == -1 + } + return cmp == 1 + } +` + default: + return ` case {{.Container}}{{firstUpper .Name}}: // {{.Type}} + return func(p1, p2 {{.Container}}) bool { + if order == Ascending { + return p1.{{.GoName}} < p2.{{.GoName}} + } + return p1.{{.GoName}} > p2.{{.GoName}} + } +` + } + panic("getSortCode: unknown type " + typ) +} diff --git a/src/dev_tools/goMaker/types/types_structure.go b/src/dev_tools/goMaker/types/types_structure.go index 74a2cc8885..8cd8b8a34a 100644 --- a/src/dev_tools/goMaker/types/types_structure.go +++ b/src/dev_tools/goMaker/types/types_structure.go @@ -94,6 +94,15 @@ func (s *Structure) HasTimestamp() bool { return false } +func (s *Structure) HasSorts() bool { + for _, m := range s.Members { + if strings.Contains(m.Attributes, "sorts") { + return true + } + } + return false +} + func (s *Structure) NeedsAddress() bool { return strings.Contains(s.CacheBy, "address") } diff --git a/src/dev_tools/goMaker/types/utils.go b/src/dev_tools/goMaker/types/utils.go index a4e39ee39d..7f78737992 100644 --- a/src/dev_tools/goMaker/types/utils.go +++ b/src/dev_tools/goMaker/types/utils.go @@ -69,6 +69,7 @@ func convertToDestPath(source, routeTag, typeTag, groupTag, reason string) strin dest = strings.ReplaceAll(dest, "route.md", routeTag+".md") dest = strings.ReplaceAll(dest, "route.py", routeTag+".py") dest = strings.ReplaceAll(dest, "route.ts", routeTag+".ts") + dest = strings.ReplaceAll(dest, "type+sort", typeTag+"+sort") dest = strings.ReplaceAll(dest, "type.go", typeTag+".go") dest = strings.ReplaceAll(dest, "type.md", typeTag+".md") dest = strings.ReplaceAll(dest, "type.ts", typeTag+".ts") diff --git a/src/dev_tools/goMaker/types/verifyValidators.go b/src/dev_tools/goMaker/types/verifyValidators.go index 1b0403d9e5..399eee0444 100644 --- a/src/dev_tools/goMaker/types/verifyValidators.go +++ b/src/dev_tools/goMaker/types/verifyValidators.go @@ -4,9 +4,7 @@ import ( "fmt" "os" "path/filepath" - "strings" - "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/file" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" ) @@ -15,12 +13,8 @@ func (cb *CodeBase) verifyValidators() { for _, cmd := range cb.Commands { path := filepath.Join(cwd, "src/apps/chifra/internal/", cmd.Route, "validate.go") for _, opts := range cmd.Options { - if len(opts.Enums) > 0 { - contents := file.AsciiFileToString(path) - want := strings.Join(opts.Enums, "|") - if !strings.Contains(contents, want) { - logger.Fatal(fmt.Sprintf("Missing enum validator (%s) for %s", want, path)) - } + if ok, wanted := ValidateEnums(path, opts.Enums); !ok { + logger.Fatal(fmt.Sprintf("Missing enum validator (%s) for %s", wanted, path)) } } } From 9067ab11a1f31de5d188788025e58e7606cf418b Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Tue, 27 Aug 2024 14:54:31 -0400 Subject: [PATCH 108/121] Cleaning --- sdk/abis.go | 24 ++++++++++---------- sdk/chunks.go | 12 +++++----- sdk/sort.go | 5 ++++ src/apps/chifra/internal/explore/validate.go | 1 + src/dev_tools/goMaker/types/types_sorts.go | 13 +++++------ 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/sdk/abis.go b/sdk/abis.go index 80d264a4b6..6a2d435283 100644 --- a/sdk/abis.go +++ b/sdk/abis.go @@ -71,34 +71,34 @@ func (opts *AbisOptions) AbisEncode(val string) ([]types.Function, *types.MetaDa } // No enums -func SortAbis(abis []types.Abi, fields []string, dir []SortOrder) error { - if len(fields) != len(dir) { - return fmt.Errorf("fields and dir must have the same length") +func SortAbis(abis []types.Abi, sortSpec SortSpec) error { + if len(sortSpec.Fields) != len(sortSpec.Order) { + return fmt.Errorf("Fields and Order must have the same length") } - sorts := make([]func(p1, p2 types.Abi) bool, len(fields)) - for i, field := range fields { + sorts := make([]func(p1, p2 types.Abi) bool, len(sortSpec.Fields)) + for i, field := range sortSpec.Fields { if !types.IsValidAbiField(field) { return fmt.Errorf("%s is not an Abi sort field", field) } - sorts[i] = types.AbiBy(types.AbiField(field), types.SortOrder(dir[i])) + sorts[i] = types.AbiBy(types.AbiField(field), types.SortOrder(sortSpec.Order[i])) } sort.Slice(abis, types.AbiCmp(abis, sorts...)) return nil } -func SortFunctions(functions []types.Function, fields []string, dir []SortOrder) error { - if len(fields) != len(dir) { - return fmt.Errorf("fields and dir must have the same length") +func SortFunctions(functions []types.Function, sortSpec SortSpec) error { + if len(sortSpec.Fields) != len(sortSpec.Order) { + return fmt.Errorf("Fields and Order must have the same length") } - sorts := make([]func(p1, p2 types.Function) bool, len(fields)) - for i, field := range fields { + sorts := make([]func(p1, p2 types.Function) bool, len(sortSpec.Fields)) + for i, field := range sortSpec.Fields { if !types.IsValidFunctionField(field) { return fmt.Errorf("%s is not an Function sort field", field) } - sorts[i] = types.FunctionBy(types.FunctionField(field), types.SortOrder(dir[i])) + sorts[i] = types.FunctionBy(types.FunctionField(field), types.SortOrder(sortSpec.Order[i])) } sort.Slice(functions, types.FunctionCmp(functions, sorts...)) diff --git a/sdk/chunks.go b/sdk/chunks.go index 7b10c1e985..bbe3f4c81e 100644 --- a/sdk/chunks.go +++ b/sdk/chunks.go @@ -193,17 +193,17 @@ func enumFromChunksMode(values []string) (ChunksMode, error) { return result, nil } -func SortChunkStats(chunkstats []types.ChunkStats, fields []string, dir []SortOrder) error { - if len(fields) != len(dir) { - return fmt.Errorf("fields and dir must have the same length") +func SortChunkStats(chunkstats []types.ChunkStats, sortSpec SortSpec) error { + if len(sortSpec.Fields) != len(sortSpec.Order) { + return fmt.Errorf("Fields and Order must have the same length") } - sorts := make([]func(p1, p2 types.ChunkStats) bool, len(fields)) - for i, field := range fields { + sorts := make([]func(p1, p2 types.ChunkStats) bool, len(sortSpec.Fields)) + for i, field := range sortSpec.Fields { if !types.IsValidChunkStatsField(field) { return fmt.Errorf("%s is not an ChunkStats sort field", field) } - sorts[i] = types.ChunkStatsBy(types.ChunkStatsField(field), types.SortOrder(dir[i])) + sorts[i] = types.ChunkStatsBy(types.ChunkStatsField(field), types.SortOrder(sortSpec.Order[i])) } sort.Slice(chunkstats, types.ChunkStatsCmp(chunkstats, sorts...)) diff --git a/sdk/sort.go b/sdk/sort.go index 81a1a3f0ee..d839cdd135 100644 --- a/sdk/sort.go +++ b/sdk/sort.go @@ -8,3 +8,8 @@ const ( Asc SortOrder = types.Ascending Dec SortOrder = types.Descending ) + +type SortSpec struct { + Fields []string `json:"fields"` + Order []SortOrder `json:"orders"` +} diff --git a/src/apps/chifra/internal/explore/validate.go b/src/apps/chifra/internal/explore/validate.go index 9d2baa021f..bef438e2f1 100644 --- a/src/apps/chifra/internal/explore/validate.go +++ b/src/apps/chifra/internal/explore/validate.go @@ -143,6 +143,7 @@ func (t ExploreType) String() string { } func (opts *ExploreOptions) idToBlockHash(chain, arg string, isBlockHash func(arg string) bool) (base.Hash, error) { + _ = chain // delint if isBlockHash(arg) { return opts.Conn.GetBlockHashByHash(arg) } diff --git a/src/dev_tools/goMaker/types/types_sorts.go b/src/dev_tools/goMaker/types/types_sorts.go index c8ee743d4a..f925db306a 100644 --- a/src/dev_tools/goMaker/types/types_sorts.go +++ b/src/dev_tools/goMaker/types/types_sorts.go @@ -33,17 +33,17 @@ func (c *Command) Sorts2() string { for _, sort := range c.Sorts { tmplName := "sortCode" tmpl := ` -func Sort{{toPlural .Type}}({{toLowerPlural .Type}} []types.{{.Type}}, fields []string, dir []SortOrder) error { - if len(fields) != len(dir) { - return fmt.Errorf("fields and dir must have the same length") +func Sort{{toPlural .Type}}({{toLowerPlural .Type}} []types.{{.Type}}, sortSpec SortSpec) error { + if len(sortSpec.Fields) != len(sortSpec.Order) { + return fmt.Errorf("Fields and Order must have the same length") } - sorts := make([]func(p1, p2 types.{{.Type}}) bool, len(fields)) - for i, field := range fields { + sorts := make([]func(p1, p2 types.{{.Type}}) bool, len(sortSpec.Fields)) + for i, field := range sortSpec.Fields { if !types.IsValid{{.Type}}Field(field) { return fmt.Errorf("%s is not an {{.Type}} sort field", field) } - sorts[i] = types.{{.Type}}By(types.{{.Type}}Field(field), types.SortOrder(dir[i])) + sorts[i] = types.{{.Type}}By(types.{{.Type}}Field(field), types.SortOrder(sortSpec.Order[i])) } sort.Slice({{toLowerPlural .Type}}, types.{{.Type}}Cmp({{toLowerPlural .Type}}, sorts...)) @@ -127,5 +127,4 @@ func getSortCode(typ string) string { } ` } - panic("getSortCode: unknown type " + typ) } From a2e11fe7c419802109cb452c623100c911848162 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Tue, 27 Aug 2024 15:30:20 -0400 Subject: [PATCH 109/121] Adds rangeDates to sort. Plus adds chunkRecord and names to auto-gen sorting code --- sdk/chunks.go | 17 +++ sdk/names.go | 19 +++ .../pkg/types/types_chunkrecord_sort.go | 75 ++++++++++ .../chifra/pkg/types/types_chunkstats_sort.go | 11 +- src/apps/chifra/pkg/types/types_name_sort.go | 139 ++++++++++++++++++ src/apps/chifra/pkg/types/types_rangedates.go | 4 + .../classDefinitions/fields/chunkrecord.csv | 8 +- .../classDefinitions/fields/chunkstats.csv | 2 +- .../classDefinitions/fields/name.csv | 26 ++-- .../goMaker/templates/cmd-line-options.csv | 4 +- src/dev_tools/goMaker/types/types_sorts.go | 14 +- 11 files changed, 297 insertions(+), 22 deletions(-) create mode 100644 src/apps/chifra/pkg/types/types_chunkrecord_sort.go create mode 100644 src/apps/chifra/pkg/types/types_name_sort.go diff --git a/sdk/chunks.go b/sdk/chunks.go index bbe3f4c81e..a43d983fcc 100644 --- a/sdk/chunks.go +++ b/sdk/chunks.go @@ -193,6 +193,23 @@ func enumFromChunksMode(values []string) (ChunksMode, error) { return result, nil } +func SortChunkRecords(chunkrecords []types.ChunkRecord, sortSpec SortSpec) error { + if len(sortSpec.Fields) != len(sortSpec.Order) { + return fmt.Errorf("Fields and Order must have the same length") + } + + sorts := make([]func(p1, p2 types.ChunkRecord) bool, len(sortSpec.Fields)) + for i, field := range sortSpec.Fields { + if !types.IsValidChunkRecordField(field) { + return fmt.Errorf("%s is not an ChunkRecord sort field", field) + } + sorts[i] = types.ChunkRecordBy(types.ChunkRecordField(field), types.SortOrder(sortSpec.Order[i])) + } + + sort.Slice(chunkrecords, types.ChunkRecordCmp(chunkrecords, sorts...)) + return nil +} + func SortChunkStats(chunkstats []types.ChunkStats, sortSpec SortSpec) error { if len(sortSpec.Fields) != len(sortSpec.Order) { return fmt.Errorf("Fields and Order must have the same length") diff --git a/sdk/names.go b/sdk/names.go index 4a606cacaa..66e88fdad4 100644 --- a/sdk/names.go +++ b/sdk/names.go @@ -12,6 +12,8 @@ import ( // EXISTING_CODE "encoding/json" "errors" + "fmt" + "sort" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/crud" @@ -109,6 +111,23 @@ func (opts *NamesOptions) NamesRemove() ([]types.Name, *types.MetaData, error) { } // No enums +func SortNames(names []types.Name, sortSpec SortSpec) error { + if len(sortSpec.Fields) != len(sortSpec.Order) { + return fmt.Errorf("Fields and Order must have the same length") + } + + sorts := make([]func(p1, p2 types.Name) bool, len(sortSpec.Fields)) + for i, field := range sortSpec.Fields { + if !types.IsValidNameField(field) { + return fmt.Errorf("%s is not an Name sort field", field) + } + sorts[i] = types.NameBy(types.NameField(field), types.SortOrder(sortSpec.Order[i])) + } + + sort.Slice(names, types.NameCmp(names, sorts...)) + return nil +} + // EXISTING_CODE func (opts *NamesOptions) ModifyName(op crud.NameOperation, cd *crud.NameCrud) ([]types.Name, *types.MetaData, error) { defer func() { diff --git a/src/apps/chifra/pkg/types/types_chunkrecord_sort.go b/src/apps/chifra/pkg/types/types_chunkrecord_sort.go new file mode 100644 index 0000000000..a7db93d920 --- /dev/null +++ b/src/apps/chifra/pkg/types/types_chunkrecord_sort.go @@ -0,0 +1,75 @@ +package types + +type ChunkRecordField string + +// Fields in the ChunkRecord struct available for sorting. +const ( + ChunkRecordBloomSize ChunkRecordField = "bloomSize" + ChunkRecordIndexSize ChunkRecordField = "indexSize" + ChunkRecordRange ChunkRecordField = "range" + ChunkRecordRangeDates ChunkRecordField = "rangeDates" +) + +// IsValidChunkRecordField returns true if the given field is a valid sortable ChunkRecord field. +func IsValidChunkRecordField(field string) bool { + switch field { + case "bloomSize", "indexSize", "range", "rangeDates": + return true + } + return false +} + +// ChunkRecordBy returns a comparison function for sorting ChunkRecord instances by the given field. +// These comparison functions may be strung together by the CmdChunkRecords function. +func ChunkRecordBy(field ChunkRecordField, order SortOrder) func(p1, p2 ChunkRecord) bool { + switch field { + case ChunkRecordBloomSize: // int64 + return func(p1, p2 ChunkRecord) bool { + if order == Ascending { + return p1.BloomSize < p2.BloomSize + } + return p1.BloomSize > p2.BloomSize + } + case ChunkRecordIndexSize: // int64 + return func(p1, p2 ChunkRecord) bool { + if order == Ascending { + return p1.IndexSize < p2.IndexSize + } + return p1.IndexSize > p2.IndexSize + } + case ChunkRecordRange: // blkrange + return func(p1, p2 ChunkRecord) bool { + if order == Ascending { + return p1.Range < p2.Range + } + return p1.Range > p2.Range + } + case ChunkRecordRangeDates: // RangeDates + return func(p1, p2 ChunkRecord) bool { + cmp := p1.RangeDates.Cmp(p2.RangeDates) + if order == Ascending { + return cmp == -1 + } + return cmp == 1 + } + + } + panic("Should not happen in ChunkRecordBy") +} + +// ChunkRecordCmp accepts a slice and variadic comparison functions and returns a functions +// that can be used to sort the slice. +func ChunkRecordCmp(slice []ChunkRecord, orders ...func(p1, p2 ChunkRecord) bool) func(i, j int) bool { + return func(i, j int) bool { + p1, p2 := slice[i], slice[j] + for _, order := range orders { + if order(p1, p2) { + return true + } + if order(p2, p1) { + return false + } + } + return false + } +} diff --git a/src/apps/chifra/pkg/types/types_chunkstats_sort.go b/src/apps/chifra/pkg/types/types_chunkstats_sort.go index 080a36a7b1..7e815b6d53 100644 --- a/src/apps/chifra/pkg/types/types_chunkstats_sort.go +++ b/src/apps/chifra/pkg/types/types_chunkstats_sort.go @@ -14,13 +14,14 @@ const ( ChunkStatsNBlocks ChunkStatsField = "nBlocks" ChunkStatsNBlooms ChunkStatsField = "nBlooms" ChunkStatsRange ChunkStatsField = "range" + ChunkStatsRangeDates ChunkStatsField = "rangeDates" ChunkStatsRatio ChunkStatsField = "ratio" ) // IsValidChunkStatsField returns true if the given field is a valid sortable ChunkStats field. func IsValidChunkStatsField(field string) bool { switch field { - case "addrsPerBlock", "appsPerAddr", "appsPerBlock", "bloomSz", "chunkSz", "nAddrs", "nApps", "nBlocks", "nBlooms", "range", "ratio": + case "addrsPerBlock", "appsPerAddr", "appsPerBlock", "bloomSz", "chunkSz", "nAddrs", "nApps", "nBlocks", "nBlooms", "range", "rangeDates", "ratio": return true } return false @@ -100,6 +101,14 @@ func ChunkStatsBy(field ChunkStatsField, order SortOrder) func(p1, p2 ChunkStats } return p1.Range > p2.Range } + case ChunkStatsRangeDates: // RangeDates + return func(p1, p2 ChunkStats) bool { + cmp := p1.RangeDates.Cmp(p2.RangeDates) + if order == Ascending { + return cmp == -1 + } + return cmp == 1 + } case ChunkStatsRatio: // float64 return func(p1, p2 ChunkStats) bool { if order == Ascending { diff --git a/src/apps/chifra/pkg/types/types_name_sort.go b/src/apps/chifra/pkg/types/types_name_sort.go new file mode 100644 index 0000000000..7716dfcd9f --- /dev/null +++ b/src/apps/chifra/pkg/types/types_name_sort.go @@ -0,0 +1,139 @@ +package types + +type NameField string + +// Fields in the Name struct available for sorting. +const ( + NameAddress NameField = "address" + NameDecimals NameField = "decimals" + NameDeleted NameField = "deleted" + NameIsContract NameField = "isContract" + NameIsCustom NameField = "isCustom" + NameIsErc20 NameField = "isErc20" + NameIsErc721 NameField = "isErc721" + NameIsPrefund NameField = "isPrefund" + NameName NameField = "name" + NameSource NameField = "source" + NameSymbol NameField = "symbol" + NameTags NameField = "tags" +) + +// IsValidNameField returns true if the given field is a valid sortable Name field. +func IsValidNameField(field string) bool { + switch field { + case "address", "decimals", "deleted", "isContract", "isCustom", "isErc20", "isErc721", "isPrefund", "name", "source", "symbol", "tags": + return true + } + return false +} + +// NameBy returns a comparison function for sorting Name instances by the given field. +// These comparison functions may be strung together by the CmdNames function. +func NameBy(field NameField, order SortOrder) func(p1, p2 Name) bool { + switch field { + case NameAddress: // address + return func(p1, p2 Name) bool { + cmp := p1.Address.Cmp(p2.Address.Address) + if order == Ascending { + return cmp == -1 + } + return cmp == 1 + } + case NameDecimals: // uint64 + return func(p1, p2 Name) bool { + if order == Ascending { + return p1.Decimals < p2.Decimals + } + return p1.Decimals > p2.Decimals + } + case NameDeleted: // bool + return func(p1, p2 Name) bool { + if order == Ascending { + return !p1.Deleted && p2.Deleted + } + return p1.Deleted && !p2.Deleted + } + case NameIsContract: // bool + return func(p1, p2 Name) bool { + if order == Ascending { + return !p1.IsContract && p2.IsContract + } + return p1.IsContract && !p2.IsContract + } + case NameIsCustom: // bool + return func(p1, p2 Name) bool { + if order == Ascending { + return !p1.IsCustom && p2.IsCustom + } + return p1.IsCustom && !p2.IsCustom + } + case NameIsErc20: // bool + return func(p1, p2 Name) bool { + if order == Ascending { + return !p1.IsErc20 && p2.IsErc20 + } + return p1.IsErc20 && !p2.IsErc20 + } + case NameIsErc721: // bool + return func(p1, p2 Name) bool { + if order == Ascending { + return !p1.IsErc721 && p2.IsErc721 + } + return p1.IsErc721 && !p2.IsErc721 + } + case NameIsPrefund: // bool + return func(p1, p2 Name) bool { + if order == Ascending { + return !p1.IsPrefund && p2.IsPrefund + } + return p1.IsPrefund && !p2.IsPrefund + } + case NameName: // string + return func(p1, p2 Name) bool { + if order == Ascending { + return p1.Name < p2.Name + } + return p1.Name > p2.Name + } + case NameSource: // string + return func(p1, p2 Name) bool { + if order == Ascending { + return p1.Source < p2.Source + } + return p1.Source > p2.Source + } + case NameSymbol: // string + return func(p1, p2 Name) bool { + if order == Ascending { + return p1.Symbol < p2.Symbol + } + return p1.Symbol > p2.Symbol + } + case NameTags: // string + return func(p1, p2 Name) bool { + if order == Ascending { + return p1.Tags < p2.Tags + } + return p1.Tags > p2.Tags + } + + } + panic("Should not happen in NameBy") +} + +// NameCmp accepts a slice and variadic comparison functions and returns a functions +// that can be used to sort the slice. +func NameCmp(slice []Name, orders ...func(p1, p2 Name) bool) func(i, j int) bool { + return func(i, j int) bool { + p1, p2 := slice[i], slice[j] + for _, order := range orders { + if order(p1, p2) { + return true + } + if order(p2, p1) { + return false + } + } + return false + } +} diff --git a/src/apps/chifra/pkg/types/types_rangedates.go b/src/apps/chifra/pkg/types/types_rangedates.go index 7662d8e0ea..4645c35f9d 100644 --- a/src/apps/chifra/pkg/types/types_rangedates.go +++ b/src/apps/chifra/pkg/types/types_rangedates.go @@ -63,4 +63,8 @@ func (s *RangeDates) FinishUnmarshal() { } // EXISTING_CODE +func (p1 *RangeDates) Cmp(p2 RangeDates) int64 { + return p1.FirstTs.Int64() - p2.FirstTs.Int64() +} + // EXISTING_CODE diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkrecord.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkrecord.csv index 3252825796..3920f6b193 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkrecord.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkrecord.csv @@ -1,7 +1,7 @@ name ,type ,strDefault ,attributes ,docOrder ,description -range ,blkrange , , , 1 ,the block range (inclusive) covered by this chunk +range ,blkrange , ,sorts , 1 ,the block range (inclusive) covered by this chunk bloomHash ,ipfshash , , , 2 ,the IPFS hash of the bloom filter at that range indexHash ,ipfshash , , , 3 ,the IPFS hash of the index chunk at that range -bloomSize ,int64 , , , 4 ,the size of the bloom filter in bytes -indexSize ,int64 , , , 5 ,the size of the index portion in bytes -rangeDates ,RangeDates , , , 6 ,if verbose, the block and timestamp bounds of the chunk +bloomSize ,int64 , ,sorts , 4 ,the size of the bloom filter in bytes +indexSize ,int64 , ,sorts , 5 ,the size of the index portion in bytes +rangeDates ,RangeDates , ,sorts , 6 ,if verbose, the block and timestamp bounds of the chunk diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv index ef72d88793..47842bcdcc 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/chunkstats.csv @@ -11,4 +11,4 @@ addrsPerBlock ,float64 , ,sorts , 9 ,the average number appsPerBlock ,float64 , ,sorts , 10 ,the average number of appearances per block appsPerAddr ,float64 , ,sorts , 11 ,the average number of appearances per address ratio ,float64 , ,sorts , 12 ,the ratio of appearances to addresses -rangeDates ,RangeDates , , , 13 ,if verbose, the block and timestamp bounds of the chunk +rangeDates ,RangeDates , ,sorts , 13 ,if verbose, the block and timestamp bounds of the chunk diff --git a/src/dev_tools/goMaker/templates/classDefinitions/fields/name.csv b/src/dev_tools/goMaker/templates/classDefinitions/fields/name.csv index fbd3503d9b..4c6a179a7d 100644 --- a/src/dev_tools/goMaker/templates/classDefinitions/fields/name.csv +++ b/src/dev_tools/goMaker/templates/classDefinitions/fields/name.csv @@ -1,13 +1,13 @@ -name ,type ,strDefault ,attributes ,docOrder ,description -tags ,string , , , 1 ,colon separated list of tags -address ,address , , , 2 ,the address associated with this name -name ,string , , , 3 ,the name associated with this address (retrieved from on-chain data if available) -symbol ,string , , , 4 ,the symbol for this address (retrieved from on-chain data if available) -source ,string , , , 5 ,user supplied source of where this name was found (or on-chain if name is on-chain) -decimals ,uint64 , , , 6 ,number of decimals retrieved from an ERC20 smart contract, defaults to 18 -isCustom ,bool , ,omitempty , 8 ,`true` if the address is a custom address, `false` otherwise -isPrefund ,bool , ,omitempty , 9 ,`true` if the address was one of the prefund addresses, `false` otherwise -isContract ,bool , ,omitempty , 10 ,`true` if the address is a smart contract, `false` otherwise -isErc20 ,bool , ,omitempty , 11 ,`true` if the address is an ERC20, `false` otherwise -isErc721 ,bool , ,omitempty , 12 ,`true` if the address is an ERC720, `false` otherwise -deleted ,bool , ,omitempty , 7 ,`true` if deleted, `false` otherwise +name ,type ,strDefault ,attributes ,docOrder ,description +tags ,string , ,sorts , 1 ,colon separated list of tags +address ,address , ,sorts , 2 ,the address associated with this name +name ,string , ,sorts , 3 ,the name associated with this address (retrieved from on-chain data if available) +symbol ,string , ,sorts , 4 ,the symbol for this address (retrieved from on-chain data if available) +source ,string , ,sorts , 5 ,user supplied source of where this name was found (or on-chain if name is on-chain) +decimals ,uint64 , ,sorts , 6 ,number of decimals retrieved from an ERC20 smart contract, defaults to 18 +isCustom ,bool , ,omitempty|sorts , 8 ,`true` if the address is a custom address, `false` otherwise +isPrefund ,bool , ,omitempty|sorts , 9 ,`true` if the address was one of the prefund addresses, `false` otherwise +isContract ,bool , ,omitempty|sorts , 10 ,`true` if the address is a smart contract, `false` otherwise +isErc20 ,bool , ,omitempty|sorts , 11 ,`true` if the address is an ERC20, `false` otherwise +isErc721 ,bool , ,omitempty|sorts , 12 ,`true` if the address is an ERC720, `false` otherwise +deleted ,bool , ,omitempty|sorts , 7 ,`true` if deleted, `false` otherwise diff --git a/src/dev_tools/goMaker/templates/cmd-line-options.csv b/src/dev_tools/goMaker/templates/cmd-line-options.csv index 2386ba18f8..f55bfa65e3 100644 --- a/src/dev_tools/goMaker/templates/cmd-line-options.csv +++ b/src/dev_tools/goMaker/templates/cmd-line-options.csv @@ -81,7 +81,7 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 14170,apps,Accounts,monitors,acctExport,n4,,,,,note,,,,,,Addresses provided on the command line are ignored in `--watch` mode. 14180,apps,Accounts,monitors,acctExport,n5,,,,,note,,,,,,Providing the value `existing` to the `--watchlist` monitors all existing monitor files (see --list). # -15000,tools,Accounts,names,ethNames,,,,visible|docs,,command,,,Manage names,[flags] [term...],default|,Query addresses or names of well-known accounts. +15000,tools,Accounts,names,ethNames,,,,visible|docs|sorts=name,,command,,,Manage names,[flags] [term...],default|,Query addresses or names of well-known accounts. 15020,tools,Accounts,names,ethNames,terms,,,required|visible|docs,4,positional,list,name,,,,a space separated list of one or more search terms 15030,tools,Accounts,names,ethNames,expand,e,,visible|docs,,switch,,,,,,expand search to include all fields (search name, address, and symbol otherwise) 15040,tools,Accounts,names,ethNames,match_case,m,,visible|docs,,switch,,,,,,do case-sensitive search @@ -278,7 +278,7 @@ num,folder,group,route,tool,longName,hotKey,def_val,attributes,handler,option_ty 45150,apps,Admin,scrape,blockScrape,n2,,,,,note,,,,,,This command requires your RPC to provide trace data. See the README for more information. 45150,apps,Admin,scrape,blockScrape,n3,,,,,note,,,,,,The --notify option requires proper configuration. Additionally, IPFS must be running locally. See the README.md file. # -46000,apps,Admin,chunks,chunkMan,,,,visible|docs|sorts=chunkStats,,command,,,Manage chunks, [flags] [blocks...] [address...],default|,Manage, investigate, and display the Unchained Index. +46000,apps,Admin,chunks,chunkMan,,,,visible|docs|sorts=chunkStats:chunkRecord,,command,,,Manage chunks, [flags] [blocks...] [address...],default|,Manage, investigate, and display the Unchained Index. 46020,apps,Admin,chunks,chunkMan,mode,,,required|visible|docs,9,positional,enum[manifest|index|blooms|pins|addresses|appearances|stats],mode,,,,the type of data to process 46030,apps,Admin,chunks,chunkMan,blocks,,,visible|docs,,positional,list,,,,,an optional list of blocks to intersect with chunk ranges 46040,apps,Admin,chunks,chunkMan,check,c,,visible|docs,1,switch,,,,,,check the manifest, index, or blooms for internal consistency diff --git a/src/dev_tools/goMaker/types/types_sorts.go b/src/dev_tools/goMaker/types/types_sorts.go index f925db306a..7fa70a0d47 100644 --- a/src/dev_tools/goMaker/types/types_sorts.go +++ b/src/dev_tools/goMaker/types/types_sorts.go @@ -77,7 +77,9 @@ func (s *Structure) SortFields() string { tmplName := "sortField" + s.Class tmpl := s.Class + "{{firstUpper .Name}} {{.Container}}Field = \"{{firstLower .Name}}\"" code := member.executeTemplate(tmplName, tmpl) - code = strings.ReplaceAll(code, s.Class+s.Class, s.Class) + if member.Type == "type" { + code = strings.ReplaceAll(code, s.Class+s.Class, s.Class) + } fields = append(fields, code) } } @@ -116,6 +118,16 @@ func getSortCode(typ string) string { } return cmp == 1 } +` + case "RangeDates": + return ` case {{.Container}}{{firstUpper .Name}}: // {{.Type}} + return func(p1, p2 {{.Container}}) bool { + cmp := p1.{{.GoName}}.Cmp(p2.{{.GoName}}) + if order == Ascending { + return cmp == -1 + } + return cmp == 1 + } ` default: return ` case {{.Container}}{{firstUpper .Name}}: // {{.Type}} From 1dddf4e872f139afd69c4fb01ef9f8b5bf572e5a Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Tue, 27 Aug 2024 15:56:45 -0400 Subject: [PATCH 110/121] Updates go.mods --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index 1c1947760b..422d792391 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index 24123e6d71..9c98002a44 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index b00c61005b..cb047dcd62 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index 268f29b85e..cc07d1ce52 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 11b2ebf2af..0cce419a88 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index 268f29b85e..cc07d1ce52 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index c9da222bc6..933b0d2919 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index 268f29b85e..cc07d1ce52 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index bdfa976054..fcdb89939f 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index 268f29b85e..cc07d1ce52 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index efd542b38a..8e00bcfd9d 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index 2fed74c3de..a94bc61cee 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index 11ce5ebb12..b17f53b598 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index 5f532c3ade..aa27bdb531 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index 99db5a8918..c9a7615406 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index 4760ce0aeb..ce70dced02 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index 71f93e565a..7ae0414d44 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index 268f29b85e..cc07d1ce52 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index 237460dbc4..bc0e622345 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index 268f29b85e..cc07d1ce52 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247 h1:UCWvalfc1CdXaYx24CnUJ3tY8MxdQ1qEr1olC8OQ1zU= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826035102-9b106eea0247/go.mod h1:iGxdbOmLd2h9odX1YJkT+Okini+UymldieO645I0Gio= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247 h1:tPMgQrAVHb4ncfmrbnBa5AfJ3FI0fWRJ6sIf2ZbXLDI= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826035102-9b106eea0247/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From 542145d54102bbe723b6707f72bbe173be16187e Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Wed, 28 Aug 2024 07:37:39 -0400 Subject: [PATCH 111/121] Small update --- src/apps/chifra/internal/monitors/handle_clean.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/apps/chifra/internal/monitors/handle_clean.go b/src/apps/chifra/internal/monitors/handle_clean.go index b1cb0acf7a..8d796d6533 100644 --- a/src/apps/chifra/internal/monitors/handle_clean.go +++ b/src/apps/chifra/internal/monitors/handle_clean.go @@ -52,6 +52,10 @@ func (opts *MonitorsOptions) HandleClean(rCtx *output.RenderCtx) error { if s.SizeThen > 0 { modelChan <- &s + } else if s.SizeNow == 0 { + mon.Close() + _ = mon.Delete() + _, _ = mon.Remove() } } } From 0a0898ceab6b67d4c660f23234e665f020e2c501 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 29 Aug 2024 08:33:56 -0400 Subject: [PATCH 112/121] Cleans up name editing --- examples/nameManager/actions.go | 56 +++++++++++++++++--------------- examples/nameManager/main.go | 24 ++------------ sdk/names.go | 2 ++ src/apps/chifra/pkg/crud/crud.go | 40 +++++++++++++++++++++++ 4 files changed, 74 insertions(+), 48 deletions(-) diff --git a/examples/nameManager/actions.go b/examples/nameManager/actions.go index 331c11e93d..bc941b4247 100644 --- a/examples/nameManager/actions.go +++ b/examples/nameManager/actions.go @@ -5,55 +5,57 @@ import ( "github.com/TrueBlocks/trueblocks-core/sdk/v3" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/crud" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) func autoName(args []string) { opts := sdk.NamesOptions{} - names, _, err := opts.NamesAutoname(base.HexToAddress(args[2])) - if err != nil { + address := base.HexToAddress(args[2]) + if names, _, err := opts.NamesAutoname(address); err != nil { printError(err.Error()) - return - } - for _, name := range names { - fmt.Printf("Name auto updated: %v\n", name.String()) + } else { + for _, name := range names { + fmt.Printf("Name auto updated: %v\n", name.String()) + } } } func deleteName(args []string) { opts := sdk.NamesOptions{} - opts.Terms = args[2:] - names, _, err := opts.NamesDelete() - if err != nil { + address := base.HexToAddress(args[2]) + cd := crud.CrudFromName(types.Name{Address: address}) + if names, _, err := opts.ModifyName(crud.Delete, cd); err != nil { printError(err.Error()) - return - } - for _, name := range names { - fmt.Printf("Name deleted: %v\n", name.String()) + } else { + for _, name := range names { + fmt.Printf("Name deleted: %v\n", name.String()) + } } } func undeleteName(args []string) { opts := sdk.NamesOptions{} - opts.Terms = args[2:] - names, _, err := opts.NamesUndelete() - if err != nil { + address := base.HexToAddress(args[2]) + cd := crud.CrudFromName(types.Name{Address: address}) + if names, _, err := opts.ModifyName(crud.Undelete, cd); err != nil { printError(err.Error()) - return - } - for _, name := range names { - fmt.Printf("Name undeleted: %v\n", name.String()) + } else { + for _, name := range names { + fmt.Printf("Name deleted: %v\n", name.String()) + } } } func removeNode(args []string) { opts := sdk.NamesOptions{} - opts.Terms = args[2:] - names, _, err := opts.NamesRemove() - if err != nil { + address := base.HexToAddress(args[2]) + cd := crud.CrudFromName(types.Name{Address: address}) + if names, _, err := opts.ModifyName(crud.Remove, cd); err != nil { printError(err.Error()) - return - } - for _, name := range names { - fmt.Printf("Name removed: %v\n", name.String()) + } else { + for _, name := range names { + fmt.Printf("Name deleted: %v\n", name.String()) + } } } diff --git a/examples/nameManager/main.go b/examples/nameManager/main.go index 3101616608..1b4ac20a14 100644 --- a/examples/nameManager/main.go +++ b/examples/nameManager/main.go @@ -5,6 +5,7 @@ import ( "os" "github.com/TrueBlocks/trueblocks-core/sdk/v3" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/crud" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) @@ -37,28 +38,9 @@ func main() { _, name.Symbol, _ = getValue(5, "symbol", "") _, _, name.Decimals = getValue(6, "decimals", "") - fmt.Printf("Address: %s\n", name.Address) - os.Setenv("TB_NAME_ADDRESS", name.Address.Hex()) - - fmt.Printf("Name: %s\n", name.Name) - os.Setenv("TB_NAME_NAME", name.Name) - - fmt.Printf("TAGS: %s\n", name.Tags) - os.Setenv("TB_NAME_TAGS", name.Tags) - - fmt.Printf("SOURCE: %s\n", name.Source) - os.Setenv("TB_NAME_SOURCE", name.Source) - - fmt.Printf("DECIMALS: %d\n", name.Decimals) - os.Setenv("TB_NAME_SYMBOL", name.Symbol) - - fmt.Printf("SYMBOL: %s\n", name.Symbol) - os.Setenv("TB_NAME_DECIMALS", fmt.Sprintf("%d", name.Decimals)) - opts := sdk.NamesOptions{} - opts.Terms = []string{name.Address.Hex()} - opts.Custom = true - if names, _, err := opts.NamesCreate(); err != nil { + cd := crud.CrudFromName(name) + if names, _, err := opts.ModifyName(crud.Update, cd); err != nil { printError(err.Error()) } else { for _, name := range names { diff --git a/sdk/names.go b/sdk/names.go index 66e88fdad4..531d3179b4 100644 --- a/sdk/names.go +++ b/sdk/names.go @@ -134,7 +134,9 @@ func (opts *NamesOptions) ModifyName(op crud.NameOperation, cd *crud.NameCrud) ( cd.Unsetenv() }() + opts.Terms = []string{cd.Address.Value.Hex()} cd.SetEnv() + switch op { case crud.Create: case crud.Update: diff --git a/src/apps/chifra/pkg/crud/crud.go b/src/apps/chifra/pkg/crud/crud.go index 051c3d8e23..53ba47caf2 100644 --- a/src/apps/chifra/pkg/crud/crud.go +++ b/src/apps/chifra/pkg/crud/crud.go @@ -2,10 +2,12 @@ package crud import ( "errors" + "fmt" "net/http" "os" "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" + "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" ) type crudValue interface { @@ -124,6 +126,44 @@ func NewNameCrud(requireName bool, r *http.Request) (*NameCrud, error) { return cd, nil } +func CrudFromAddress(addr base.Address) *NameCrud { + cd := NameCrud{} + cd.Address = Field[base.Address]{ + Value: addr, + Updated: true, + } + return &cd +} + +func CrudFromName(name types.Name) *NameCrud { + cd := NameCrud{} + cd.Address = Field[base.Address]{ + Value: name.Address, + Updated: true, + } + cd.Name = Field[string]{ + Value: name.Name, + Updated: true, + } + cd.Tags = Field[string]{ + Value: name.Tags, + Updated: true, + } + cd.Source = Field[string]{ + Value: name.Source, + Updated: true, + } + cd.Symbol = Field[string]{ + Value: name.Symbol, + Updated: true, + } + cd.Decimals = Field[string]{ + Value: fmt.Sprintf("%d", name.Decimals), + Updated: true, + } + return &cd +} + func (cd *NameCrud) SetEnv() { os.Setenv("TB_NAME_ADDRESS", cd.Address.Value.String()) os.Setenv("TB_NAME_NAME", cd.Name.Value) From b9a248ff82f985c1abc311147043147b5d8086b6 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Thu, 29 Aug 2024 09:32:12 -0400 Subject: [PATCH 113/121] Updates go.mods --- examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 20 files changed, 54 insertions(+), 54 deletions(-) diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index 422d792391..ff55bc4db3 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index 9c98002a44..3f271a7a01 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index cb047dcd62..1b8aa3a2ea 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index cc07d1ce52..22c1836373 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 0cce419a88..66a4109af4 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index cc07d1ce52..22c1836373 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index 933b0d2919..7f981785b9 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index cc07d1ce52..22c1836373 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index fcdb89939f..0d56bd550e 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index cc07d1ce52..22c1836373 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index 8e00bcfd9d..80ca2cb95b 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index a94bc61cee..b93277bdfd 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index b17f53b598..7a10c804b3 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index aa27bdb531..a0252836d3 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index c9a7615406..db3ff79103 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index ce70dced02..38f9547d50 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index 7ae0414d44..df91a128d3 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index cc07d1ce52..22c1836373 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index bc0e622345..13b5ee1ac7 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index cc07d1ce52..22c1836373 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17 h1:eUN4TuVAnZADXRcfqlzWJKf6XXZfzbeP+8sO2UdSm+U= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240826114617-416b1f6dfe17/go.mod h1:0f96OgEdWH2ipIG1SVRmDSEL4tSXDgh/xKvIZ6Byy3Q= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17 h1:ew0Eqb0AltT3F12k9xoMA/+3NhnAraULFddISI6/DPo= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240826114617-416b1f6dfe17/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From f267acd6bf828ec80ecf94e67439189215c4a162 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Fri, 30 Aug 2024 12:11:59 -0400 Subject: [PATCH 114/121] Starts to improve chifra init --- examples/simple/main.go | 2 +- examples/withStreaming/main.go | 8 ++++---- examples/withStreaming/streamBlocks.go | 25 ++++++++++++++----------- sdk/init.go | 6 ++++++ 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/examples/simple/main.go b/examples/simple/main.go index d9d24f8550..fc5d272025 100644 --- a/examples/simple/main.go +++ b/examples/simple/main.go @@ -12,7 +12,7 @@ import ( // error occurs the program exits. func main() { opts := sdk.WhenOptions{ - BlockIds: []string{"0-19000000:monthly"}, + BlockIds: []string{"12-1000"}, Globals: sdk.Globals{ Cache: true, }, diff --git a/examples/withStreaming/main.go b/examples/withStreaming/main.go index f61bf004d6..1b72205810 100644 --- a/examples/withStreaming/main.go +++ b/examples/withStreaming/main.go @@ -9,16 +9,16 @@ import ( func main() { namesMap, _ = names.LoadNamesMap("mainnet", types.Custom|types.Prefund|types.Regular, nil) - TestStreamAbis() + // TestStreamAbis() TestStreamBlocks() // TestStreamChunks() // TestStreamConfig() - TestStreamExport() + // TestStreamExport() // TestStreamInit() // TestStreamList() // TestStreamLogs() // TestStreamMonitors() - TestStreamNames() + // TestStreamNames() // TestStreamReceipts() // TestStreamSlurp() // TestStreamState() @@ -27,7 +27,7 @@ func main() { // TestStreamTraces() // TestStreamTransactions() // TestStreamWhen() - TestStreamProgress() + // TestStreamProgress() } var namesMap = map[base.Address]types.Name{} diff --git a/examples/withStreaming/streamBlocks.go b/examples/withStreaming/streamBlocks.go index 16b1c9b54c..23dd0abb43 100644 --- a/examples/withStreaming/streamBlocks.go +++ b/examples/withStreaming/streamBlocks.go @@ -26,14 +26,17 @@ func TestBlocks[T BlockType](mode ...string) { select { case model := <-opts.RenderCtx.ModelChan: if item, ok := model.(T); ok { - fmt.Printf("%d item: %s\r", cnt, item) + // if cnt != 0 { + // fmt.Println(",") + // } + fmt.Printf("%s\n", item) // %d item: %s\r", cnt, item) + cnt++ } else { logger.Error("not the right type", reflect.TypeOf(model)) } case err := <-opts.RenderCtx.ErrorChan: logger.Error(err.Error()) } - cnt++ if opts.RenderCtx.WasCanceled() { fmt.Println() return @@ -48,10 +51,10 @@ func TestBlocks[T BlockType](mode ...string) { if _, _, err := opts.BlocksUncles(); err != nil { logger.Error(err.Error()) } - // } else { - // if _, _, err := opts.Blocks(); err != nil { - // logger.Error(err.Error()) - // } + } else { + if _, _, err := opts.Blocks(); err != nil { + logger.Error(err.Error()) + } } case *types.LightBlock: if _, _, err := opts.BlocksHashes(); err != nil { @@ -79,10 +82,10 @@ func TestBlocks[T BlockType](mode ...string) { func TestStreamBlocks() { TestBlocks[*types.Block]() - TestBlocks[*types.LightBlock]() - TestBlocks[*types.Log]() - TestBlocks[*types.Trace]() - TestBlocks[*types.Block]("uncles") + // TestBlocks[*types.LightBlock]() + // TestBlocks[*types.Log]() + // TestBlocks[*types.Trace]() + // TestBlocks[*types.Block]("uncles") // TestBlocks[*types.Appearance]() - TestBlocks[*types.Withdrawal]() + // TestBlocks[*types.Withdrawal]() } diff --git a/sdk/init.go b/sdk/init.go index fb1e9fad70..d4c9bd0365 100644 --- a/sdk/init.go +++ b/sdk/init.go @@ -55,4 +55,10 @@ func (opts *InitOptions) InitDryRun() ([]types.Message, *types.MetaData, error) // No enums // EXISTING_CODE +// Init implements the chifra init --all command. +func (opts *InitOptions) Init() ([]types.Message, *types.MetaData, error) { + in := opts.toInternal() + return queryInit[types.Message](in) +} + // EXISTING_CODE From d7f8d028f21486ef72a3b5e9a175c5d500b293fb Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Fri, 30 Aug 2024 21:53:33 -0400 Subject: [PATCH 115/121] Adds ScrapeOnce --- sdk/scrape.go | 3 +++ src/apps/chifra/internal/scrape/scrape_manager_utils.go | 1 + 2 files changed, 4 insertions(+) diff --git a/sdk/scrape.go b/sdk/scrape.go index c2c658bafe..843e39ba58 100644 --- a/sdk/scrape.go +++ b/sdk/scrape.go @@ -56,4 +56,7 @@ func (opts *ScrapeOptions) ScrapeDryRun() ([]types.Message, *types.MetaData, err // No enums // EXISTING_CODE +func (opts *ScrapeOptions) ScrapeRunOnce() ([]types.Message, *types.MetaData, error) { + return opts.ScrapeRunCount(1) +} // EXISTING_CODE diff --git a/src/apps/chifra/internal/scrape/scrape_manager_utils.go b/src/apps/chifra/internal/scrape/scrape_manager_utils.go index bfa17db80b..3ef032905b 100644 --- a/src/apps/chifra/internal/scrape/scrape_manager_utils.go +++ b/src/apps/chifra/internal/scrape/scrape_manager_utils.go @@ -13,6 +13,7 @@ import ( // Report prints out a report of the progress of the scraper. func (bm *BlazeManager) report(nBlocks, perChunk, nChunks, nAppsNow, nAppsFound, nAddrsFound int) { + _ = nBlocks // linter nNeeded := perChunk - base.Min(perChunk, nAppsNow) appsPerAddr := float64(nAppsFound) / float64(nAddrsFound) pctFull := float64(nAppsNow) / float64(perChunk) From df247f5f9e6fe80bcf088c31ce1e452da8c9acd6 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 31 Aug 2024 20:56:08 -0400 Subject: [PATCH 116/121] Updates go.mods --- examples/.gitignore | 1 - examples/balanceChart/go.mod | 4 ++-- examples/balanceChart/go.sum | 8 ++++---- examples/cancelContext/go.mod | 4 ++-- examples/cancelContext/go.sum | 8 ++++---- examples/findFirst/go.mod | 4 ++-- examples/findFirst/go.sum | 8 ++++---- examples/nameManager/actions.go | 4 ++-- examples/nameManager/go.mod | 4 ++-- examples/nameManager/go.sum | 8 ++++---- examples/simple/go.mod | 4 ++-- examples/simple/go.sum | 8 ++++---- examples/withStreaming/go.mod | 4 ++-- examples/withStreaming/go.sum | 8 ++++---- examples/withStreaming/streamBlocks.go | 3 --- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/scrape.go | 1 + src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 ++-- src/dev_tools/goMaker/main_test.go | 2 +- src/dev_tools/sdkFuzzer/go.mod | 4 ++-- src/dev_tools/sdkFuzzer/go.sum | 8 ++++---- src/dev_tools/testRunner/go.mod | 4 ++-- src/dev_tools/testRunner/go.sum | 8 ++++---- 25 files changed, 58 insertions(+), 61 deletions(-) delete mode 100644 examples/.gitignore diff --git a/examples/.gitignore b/examples/.gitignore deleted file mode 100644 index 6b77021d76..0000000000 --- a/examples/.gitignore +++ /dev/null @@ -1 +0,0 @@ -abiTesting diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index ff55bc4db3..18c8851f6b 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index 3f271a7a01..88b7bab064 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index 1b8aa3a2ea..5989a59810 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index 22c1836373..88b20e1947 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 66a4109af4..9e40861148 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index 22c1836373..88b20e1947 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/actions.go b/examples/nameManager/actions.go index bc941b4247..bcf6fcfada 100644 --- a/examples/nameManager/actions.go +++ b/examples/nameManager/actions.go @@ -42,7 +42,7 @@ func undeleteName(args []string) { printError(err.Error()) } else { for _, name := range names { - fmt.Printf("Name deleted: %v\n", name.String()) + fmt.Printf("Name undeleted: %v\n", name.String()) } } } @@ -55,7 +55,7 @@ func removeNode(args []string) { printError(err.Error()) } else { for _, name := range names { - fmt.Printf("Name deleted: %v\n", name.String()) + fmt.Printf("Name removed: %v\n", name.String()) } } } diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index 7f981785b9..8ca1097708 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index 22c1836373..88b20e1947 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index 0d56bd550e..cffa6967db 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index 22c1836373..88b20e1947 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index 80ca2cb95b..b3da1ee165 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index b93277bdfd..9a85e9f49b 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/streamBlocks.go b/examples/withStreaming/streamBlocks.go index 23dd0abb43..77a60c1dd0 100644 --- a/examples/withStreaming/streamBlocks.go +++ b/examples/withStreaming/streamBlocks.go @@ -26,9 +26,6 @@ func TestBlocks[T BlockType](mode ...string) { select { case model := <-opts.RenderCtx.ModelChan: if item, ok := model.(T); ok { - // if cnt != 0 { - // fmt.Println(",") - // } fmt.Printf("%s\n", item) // %d item: %s\r", cnt, item) cnt++ } else { diff --git a/sdk/go.mod b/sdk/go.mod index 7a10c804b3..31bb562803 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index a0252836d3..8df0bcf5b9 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/scrape.go b/sdk/scrape.go index 843e39ba58..e1e427f0c4 100644 --- a/sdk/scrape.go +++ b/sdk/scrape.go @@ -59,4 +59,5 @@ func (opts *ScrapeOptions) ScrapeDryRun() ([]types.Message, *types.MetaData, err func (opts *ScrapeOptions) ScrapeRunOnce() ([]types.Message, *types.MetaData, error) { return opts.ScrapeRunCount(1) } + // EXISTING_CODE diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index db3ff79103..33fe2eb334 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index 38f9547d50..92a3590c8a 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/goMaker/main_test.go b/src/dev_tools/goMaker/main_test.go index 7b727df9a7..830f36a2ee 100644 --- a/src/dev_tools/goMaker/main_test.go +++ b/src/dev_tools/goMaker/main_test.go @@ -6,6 +6,6 @@ import ( ) func TestMainFunction(t *testing.T) { - os.Chdir("/Users/jrush/Development/trueblocks-dalledress") + os.Chdir("/Users/jrush/Development/trueblocks-core") main() } diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index df91a128d3..e2df96996d 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index 22c1836373..88b20e1947 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index 13b5ee1ac7..1a400f6fb7 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index 22c1836373..88b20e1947 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102 h1:t+6K87Cah9DcTkSRgmr3pUP9mXR2lvKIYQ9weXzqioI= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240828113739-542145d54102/go.mod h1:LhzUL7jeywSDDtvoaTG6s+OKPOlSuq9fwvJPXxnchXY= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102 h1:gg6F+xZ6DFCS6IDjx3HvLM44sDNIOP7qYWtmn9XnI4s= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240828113739-542145d54102/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From 12c8928dea61ebf8a07ff0f37dcbde7aacd96661 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 31 Aug 2024 21:04:46 -0400 Subject: [PATCH 117/121] Final cleaning before release --- CHANGES.md | 35 +++++++++++++++++++ src/apps/chifra/internal/chunks/handle_pin.go | 1 + src/apps/chifra/internal/chunks/validate.go | 1 + src/apps/chifra/internal/explore/validate.go | 2 +- src/apps/chifra/pkg/file/lock_windows.go | 2 +- src/apps/chifra/pkg/names/regular.go | 2 +- src/dev_tools/sdkFuzzer/monitors.go | 2 +- 7 files changed, 41 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a775706c45..81a32bf51e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,41 @@ This file details changes made to TrueBlocks over time. All version prior to version 3.0.0 are now no longer supported. +## v4.0.0 - Kicking Ass (2024/09/01) + +- Bumped version to 4.0.0 +- Improved auto code generation to include sorting on appropriate types (x, y, z) +- Addition of Names capability to any routes that need to load names databases (most) +- Better ability to generate auto-generated code outside of core or the SDK (for example Browse) +- Better checking of certain validations such as Enums being found in validate code for a route +- Data models + - Removes TimestampCount type for more general Count type which is now used in other places + - Much easier to use caching code. Interface now requires an implementation of `CacheLocation` (no longer needs `CacheId` nor `CacheName`) +- Add ForEveryFileInFolder to walk package - super useful +- Adds Scrape endpoint to the SDK - enabling trueBlocks-node functionality +- Various updates to examples and tests +- Changes to better support builds on other operating sytems. Mostly path related. Not an endorsement of a Windows (or any other operating systems) versions. +- TimestampCount field removed from chifra when and replaced with more generic Count type which is now used elsehwere. +- Moved name type enums (Custom, Regular, etc) to types package removing it from names package. This was done to better support Browse. This is a breaking change. +- Types +- chifra scrape now returns Message type +- Monitor type now supports binary caching +- Removes simponly attribute from auto code gen field attributes +- Adds rangeDates field to ChunkAddress, ChunkStats, ChunkBloom, ChunkIndex, ChunkRecord +- Remove rangeEnd from ChunkStats (in favor of rangeDates) breaking +- Adds sorts option for auto-gen fields.csv file to create sorting code for a given type to names, functions, abis +- Adds name, path, fileSize, lastModDate, isKnown, nFunctions, nEvents, hasConstructor, hasFallback to Abi type +- Adds isStaged, isEmpty, and name to Monitor type +- Removes staged and removed from MonitorClean type - breaking +- Adds chifra monitors --count and chifra monitors --staged. Changes hotkey to 'd' from 'c' for chifra monitors --commands option. +- ADDS fileSize, hasConstructor, hasFallback, isEmpty, isKnown, lastModDate, nEvents, nFunctions, name, path to Abi type mostly for use in apps such as Browse +- Adds hidden option chifra explore --dalle <address> +- Adds chifra abis --list and chifra abis --count +- chifra daemon --api deprecated, no replacement, chifra daemon --scrape deprecated, use chifra scrape instead chifra daemon --monitor deprecated, use chifra monitors --watch instead. +- chifra chunks mode --count now properly returns a Count type (breaking) +- Implements sorts in the sdk for Abis, Names, Chunks, etc. +- monitorClean now has staged and removed fields + ## v3.1.2-release - Streaming SDK - Huntingdon (2024/07/18) **Summary** diff --git a/src/apps/chifra/internal/chunks/handle_pin.go b/src/apps/chifra/internal/chunks/handle_pin.go index bfb46d7fbe..7418209fc0 100644 --- a/src/apps/chifra/internal/chunks/handle_pin.go +++ b/src/apps/chifra/internal/chunks/handle_pin.go @@ -172,6 +172,7 @@ func matches(local, remote *types.ChunkRecord) (bool, bool) { } func (opts *ChunksOptions) matchReport(matches bool, localHash, remoteHash base.IpfsHash) { + _ = remoteHash // linter if !opts.Remote || !config.IpfsRunning() { return // if we're not pinning in two places, don't report on matches } diff --git a/src/apps/chifra/internal/chunks/validate.go b/src/apps/chifra/internal/chunks/validate.go index c7031b7bdb..a8194652c8 100644 --- a/src/apps/chifra/internal/chunks/validate.go +++ b/src/apps/chifra/internal/chunks/validate.go @@ -81,6 +81,7 @@ func (opts *ChunksOptions) validateChunks() error { } if opts.Count { + // TODO: Shouldn't this use validate.Enums? if !strings.Contains("manifest|index|blooms|pins|stats", opts.Mode) { return validate.Usage("The {0} option is only available in {1}.", "--count", "these modes: manifest|index|blooms|pins|stats") } diff --git a/src/apps/chifra/internal/explore/validate.go b/src/apps/chifra/internal/explore/validate.go index bef438e2f1..9f68961a4e 100644 --- a/src/apps/chifra/internal/explore/validate.go +++ b/src/apps/chifra/internal/explore/validate.go @@ -143,7 +143,7 @@ func (t ExploreType) String() string { } func (opts *ExploreOptions) idToBlockHash(chain, arg string, isBlockHash func(arg string) bool) (base.Hash, error) { - _ = chain // delint + _ = chain // linter if isBlockHash(arg) { return opts.Conn.GetBlockHashByHash(arg) } diff --git a/src/apps/chifra/pkg/file/lock_windows.go b/src/apps/chifra/pkg/file/lock_windows.go index 3a95a711c1..9edfefd844 100644 --- a/src/apps/chifra/pkg/file/lock_windows.go +++ b/src/apps/chifra/pkg/file/lock_windows.go @@ -14,6 +14,6 @@ func Lock(file *os.File) error { } func Unlock(file *os.File) error { - // TODO: DOn't we need this? + // TODO: Don't we need this? return nil } diff --git a/src/apps/chifra/pkg/names/regular.go b/src/apps/chifra/pkg/names/regular.go index 3d379ab0e8..27a13a5f43 100644 --- a/src/apps/chifra/pkg/names/regular.go +++ b/src/apps/chifra/pkg/names/regular.go @@ -68,7 +68,7 @@ func loadRegularMap(chain string, terms []string, parts types.Parts, ret *map[ba // loadKnownBadresses loads the known bad addresses from the cache func loadKnownBadresses(unused string, terms []string, parts types.Parts, ret *map[base.Address]types.Name) error { - _ = unused + _ = unused // linter knownBadAddresses := []types.Name{ { Address: base.PrefundSender, diff --git a/src/dev_tools/sdkFuzzer/monitors.go b/src/dev_tools/sdkFuzzer/monitors.go index 2803ee4ce3..06b719d84a 100644 --- a/src/dev_tools/sdkFuzzer/monitors.go +++ b/src/dev_tools/sdkFuzzer/monitors.go @@ -39,12 +39,12 @@ func DoMonitors() { // sleep is not fuzzed // Fuzz Loop // EXISTING_CODE + _ = staged _ = delete _ = undelete _ = remove _ = watch _ = globs - _ = staged opts = sdk.MonitorsOptions{ Addrs: []string{fuzzAddresses[0]}, } From f6b7c210394d68658733726603a6c22205960fa5 Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 31 Aug 2024 22:29:51 -0400 Subject: [PATCH 118/121] Updates to 3.2.0 --- CHANGES.md | 252 ++++++++++++++++++++++---- VERSION | 2 +- docs | 2 +- examples/balanceChart/go.mod | 4 +- examples/balanceChart/go.sum | 8 +- examples/cancelContext/go.mod | 4 +- examples/cancelContext/go.sum | 8 +- examples/findFirst/go.mod | 4 +- examples/findFirst/go.sum | 8 +- examples/nameManager/go.mod | 4 +- examples/nameManager/go.sum | 8 +- examples/simple/go.mod | 4 +- examples/simple/go.sum | 8 +- examples/withStreaming/go.mod | 4 +- examples/withStreaming/go.sum | 8 +- sdk/go.mod | 2 +- sdk/go.sum | 4 +- src/apps/chifra/pkg/version/string.go | 2 +- src/dev_tools/goMaker/go.mod | 2 +- src/dev_tools/goMaker/go.sum | 4 +- src/dev_tools/sdkFuzzer/go.mod | 4 +- src/dev_tools/sdkFuzzer/go.sum | 8 +- src/dev_tools/testRunner/go.mod | 4 +- src/dev_tools/testRunner/go.sum | 8 +- 24 files changed, 277 insertions(+), 89 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 81a32bf51e..a7eb6ba972 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,40 +2,228 @@ This file details changes made to TrueBlocks over time. All version prior to version 3.0.0 are now no longer supported. -## v4.0.0 - Kicking Ass (2024/09/01) +## v4.0.0 - Getting Serious - Indiana (2024/09/01) + +**Summary** - Bumped version to 4.0.0 -- Improved auto code generation to include sorting on appropriate types (x, y, z) -- Addition of Names capability to any routes that need to load names databases (most) -- Better ability to generate auto-generated code outside of core or the SDK (for example Browse) -- Better checking of certain validations such as Enums being found in validate code for a route -- Data models - - Removes TimestampCount type for more general Count type which is now used in other places - - Much easier to use caching code. Interface now requires an implementation of `CacheLocation` (no longer needs `CacheId` nor `CacheName`) -- Add ForEveryFileInFolder to walk package - super useful -- Adds Scrape endpoint to the SDK - enabling trueBlocks-node functionality -- Various updates to examples and tests -- Changes to better support builds on other operating sytems. Mostly path related. Not an endorsement of a Windows (or any other operating systems) versions. -- TimestampCount field removed from chifra when and replaced with more generic Count type which is now used elsehwere. -- Moved name type enums (Custom, Regular, etc) to types package removing it from names package. This was done to better support Browse. This is a breaking change. -- Types -- chifra scrape now returns Message type -- Monitor type now supports binary caching -- Removes simponly attribute from auto code gen field attributes -- Adds rangeDates field to ChunkAddress, ChunkStats, ChunkBloom, ChunkIndex, ChunkRecord -- Remove rangeEnd from ChunkStats (in favor of rangeDates) breaking -- Adds sorts option for auto-gen fields.csv file to create sorting code for a given type to names, functions, abis -- Adds name, path, fileSize, lastModDate, isKnown, nFunctions, nEvents, hasConstructor, hasFallback to Abi type -- Adds isStaged, isEmpty, and name to Monitor type -- Removes staged and removed from MonitorClean type - breaking -- Adds chifra monitors --count and chifra monitors --staged. Changes hotkey to 'd' from 'c' for chifra monitors --commands option. -- ADDS fileSize, hasConstructor, hasFallback, isEmpty, isKnown, lastModDate, nEvents, nFunctions, name, path to Abi type mostly for use in apps such as Browse -- Adds hidden option chifra explore --dalle <address> -- Adds chifra abis --list and chifra abis --count -- chifra daemon --api deprecated, no replacement, chifra daemon --scrape deprecated, use chifra scrape instead chifra daemon --monitor deprecated, use chifra monitors --watch instead. -- chifra chunks mode --count now properly returns a Count type (breaking) -- Implements sorts in the sdk for Abis, Names, Chunks, etc. -- monitorClean now has staged and removed fields +- Much better support for SDK +- First working version of Browse (separate repo) +- First semi-working version of TrueBlocks-Node (separate repo) +- Much better support for auto code generation: +- Various updates and corrections to the examples and tests + +## SDK + +- Adds `Scrape` endpoint to the SDK - enabling `trueBlocks-node` functionality +- Adds `ScrapeOnce` endpoint to the SDK - enabling `trueBlocks-node` and Browse functionality +- Adds `Init` endpoint to the SDK - enabling `trueBlocks-node` functionality +- Implements sorting interfaces for `Abis`, `Names`, `Chunks` types in the SDK + +## Changes to the Unchained Index Specification + +- No changes. + +## Breaking Changes + +- `Names` enum (`Custom`, `Regular`, `Prefund`, etc.) moved to `types` package from `names` package. Breaking change. Change `names.Custom` to `types.Custom` (etc.) to fix. +- `ChunksStats` data model no longer has `rangeEnd` field. Use `rangeDates` instead. + +## System Wide Changes + +- No changes. + +## Changes to Data Models + +### Modified data models + +| model | description | +| ------------ | ------------------------------------------------------------------------------------------------------------------------------- | +| Message | This type is now returned by `chifra scrape` for some routes and options | +| ChunkAddress | Adds `rangeDates` field | +| ChunkBloom | Adds `rangeDates` field | +| ChunkIndex | Adds `rangeDates` field | +| ChunkRecord | Adds `rangeDates` field | +| ChunkStats | Adds `rangeDates` field, removed `rangeEnd` | +| Name | Allows auto-generated sorting code | +| Function | Allows auto-generated sorting code | +| ChunkStats | Allows auto-generated sorting code | +| Monitor | Adds `isStaged`, `isEmpty`, and `name` to Monitor type | +| MonitorClean | Adds `staged` and `removed` fields from MonitorClean type | +| Abi | Adds `name`, `path`, `fileSize`, `lastModDate`, `isKnown`, `nFunctions`, `nEvents`, `hasConstructor`, `hasFallback` to Abi type | + +### New data models + +| model | description | +| ----- | ----------- | +| None | | + +### Removed data models + +| model | description | +| ----- | ----------- | +| None | | + +### Renamed data models + +| model | description | +| -------------- | --------------------------------------------------------------------- | +| TimestampCount | Type renamed to Count and used elsewhere in addition to `chifra when` | + +## Tool Specific Changes + +**chifra list** + +- No changes. + +**chifra export** + +- No changes. + +**chifra monitors** + +- Adds `chifra monitors --count` option used by Browse +- Adds `chifra monitors --staged` to include staged monitors in `chifra monitors --list` +- Changes hotkey for `chifra monitors --commands` to '`d`' from '`c`' + +**chifra names** + +- No changes. + +**chifra abis** + +- Adds `chifra abis --list` and `chifra abis --count` for use mostly with Browse + +**chifra blocks** + +- No changes. + +**chifra transactions** + +- No changes. + +**chifra receipts** + +- No changes. + +**chifra logs** + +- No changes. + +**chifra traces** + +- No changes. + +**chifra when** + +- No changes. + +**chifra state** + +- No changes. + +**chifra tokens** + +- No changes. + +**chifra config** + +- No changes. + +**chifra status** + +- No changes. + +**chifra daemon** + +- Deprecated `chifra daemon --api`, no replacement, +- Deprecated `chifra daemon --scrape`, use `chifra scrape` instead +- Deprecated `chifra daemon --monitor`, use `chifra monitors --watch` instead. + +**chifra scrape** + +- No changes. + +**chifra chunks** + +- `chifra chunks mode --count` now properly returns a `Count` type (mildly breaking) + +**chifra init** + +- No changes. + +**chifra explore** + +- Adds hidden option `chifra explore --dalle <address>`; + +**chifra slurp** + +- No changes. + +**makeClass** + +- Much better support for auto code generation including: + - Sorting for certain generated types for use in Browse + - Better (easier to use) caching code for types + - Easier to use the tools in other repos + - Better validity checking + +**testRunner** + +- Better testing including automatically finding a port for the API server if default is being used +- Updates and improvements to many tests + +## Pull Requests (23) + + + +- #3871 Starts to improve chifra init +- #3870 Cleans up name editing +- #3869 Extends goMaker to generate sorting code for various types +- #3866 Adds --staged to chifra monitors +- #3865 Adds --count to chifra monitors +- #3863 Adds hasConstructor and hasFallback to Abi type; fixes tests +- #3862 Feature/better sorting +- #3860 Feature/chifra abis count +- #3858 Feature/better chunk data +- #3857 Feature/easier name editing in sdk +- #3856 Fixes a bug related to turning off loggers +- #3853 Fix/better use of filepath +- #3851 Assigns part type to names +- #3850 Feature/chifra chunks counts +- #3848 Adds name to monitor type and makes marshable +- #3847 Moves Parts from names package to types package because we need it in… +- #3846 Feature/improve chifra abis list +- #3845 Adds chifra abis --list for use in miniDapp +- #3844 Cleans up some caching code including allowing for filename caches (such as miniDapp files) +- #3842 Fix/better auto gen 2 +- #3840 Small improvement to auto-code-gen +- #3839 chore: fix some comments +- #3838 Updates go-mods and adds some names + +## Issues Closed (0) + + + +- None + +## Issues Opened (8) + + + +- #3868 make generate ignores DefaultEnum -- remove it if it's not used, use it if it's useful +- #3867 React development environment -- or a better linter for react +- #3861 Document the sortable fields for each type +- #3859 code gen: use the handler field +- #3855 Strange behaviour with staged/unripe blocks. +- #3836 Copying the executable +- #3835 Coming changes for Pectra ## v3.1.2-release - Streaming SDK - Huntingdon (2024/07/18) diff --git a/VERSION b/VERSION index ff365e06b9..944880fa15 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.1.3 +3.2.0 diff --git a/docs b/docs index 56e2512408..76343a8fda 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 56e25124088b90168379d5e015f44c13c7464419 +Subproject commit 76343a8fda1f222b32ec4395f23d8740e9512009 diff --git a/examples/balanceChart/go.mod b/examples/balanceChart/go.mod index 18c8851f6b..e32141b4c1 100644 --- a/examples/balanceChart/go.mod +++ b/examples/balanceChart/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/balanceChart go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 github.com/bykof/gostradamus v1.0.4 gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b ) diff --git a/examples/balanceChart/go.sum b/examples/balanceChart/go.sum index 88b7bab064..e9c3b70413 100644 --- a/examples/balanceChart/go.sum +++ b/examples/balanceChart/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 h1:4N9oQvXOzrtmcBgJUY5ivvJ4QkM12S7qEla6Iv2OG7U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61/go.mod h1:9+/eYi6Wza74nzRMCWnvG/Ybln1HzL+24dEN50ZrPok= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 h1:6tE09BFp8S50cXKxVxG3MR7KURNEfgiwLKLFciYyNbw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/cancelContext/go.mod b/examples/cancelContext/go.mod index 5989a59810..b2a8ab649d 100644 --- a/examples/cancelContext/go.mod +++ b/examples/cancelContext/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/cancelContext go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 ) require ( diff --git a/examples/cancelContext/go.sum b/examples/cancelContext/go.sum index 88b20e1947..3ddf3f7c24 100644 --- a/examples/cancelContext/go.sum +++ b/examples/cancelContext/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 h1:4N9oQvXOzrtmcBgJUY5ivvJ4QkM12S7qEla6Iv2OG7U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61/go.mod h1:9+/eYi6Wza74nzRMCWnvG/Ybln1HzL+24dEN50ZrPok= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 h1:6tE09BFp8S50cXKxVxG3MR7KURNEfgiwLKLFciYyNbw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/findFirst/go.mod b/examples/findFirst/go.mod index 9e40861148..1ac2236395 100644 --- a/examples/findFirst/go.mod +++ b/examples/findFirst/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/findFirst go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 ) require ( diff --git a/examples/findFirst/go.sum b/examples/findFirst/go.sum index 88b20e1947..3ddf3f7c24 100644 --- a/examples/findFirst/go.sum +++ b/examples/findFirst/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 h1:4N9oQvXOzrtmcBgJUY5ivvJ4QkM12S7qEla6Iv2OG7U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61/go.mod h1:9+/eYi6Wza74nzRMCWnvG/Ybln1HzL+24dEN50ZrPok= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 h1:6tE09BFp8S50cXKxVxG3MR7KURNEfgiwLKLFciYyNbw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/nameManager/go.mod b/examples/nameManager/go.mod index 8ca1097708..c48bd0d65e 100644 --- a/examples/nameManager/go.mod +++ b/examples/nameManager/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/nameManager go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 ) require ( diff --git a/examples/nameManager/go.sum b/examples/nameManager/go.sum index 88b20e1947..3ddf3f7c24 100644 --- a/examples/nameManager/go.sum +++ b/examples/nameManager/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 h1:4N9oQvXOzrtmcBgJUY5ivvJ4QkM12S7qEla6Iv2OG7U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61/go.mod h1:9+/eYi6Wza74nzRMCWnvG/Ybln1HzL+24dEN50ZrPok= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 h1:6tE09BFp8S50cXKxVxG3MR7KURNEfgiwLKLFciYyNbw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/simple/go.mod b/examples/simple/go.mod index cffa6967db..8f8ef177ac 100644 --- a/examples/simple/go.mod +++ b/examples/simple/go.mod @@ -3,11 +3,11 @@ module github.com/TrueBlocks/trueblocks-core/examples/simple // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced +require github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 require ( github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced // indirect + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 // indirect github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect diff --git a/examples/simple/go.sum b/examples/simple/go.sum index 88b20e1947..3ddf3f7c24 100644 --- a/examples/simple/go.sum +++ b/examples/simple/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 h1:4N9oQvXOzrtmcBgJUY5ivvJ4QkM12S7qEla6Iv2OG7U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61/go.mod h1:9+/eYi6Wza74nzRMCWnvG/Ybln1HzL+24dEN50ZrPok= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 h1:6tE09BFp8S50cXKxVxG3MR7KURNEfgiwLKLFciYyNbw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/examples/withStreaming/go.mod b/examples/withStreaming/go.mod index b3da1ee165..b067a1081b 100644 --- a/examples/withStreaming/go.mod +++ b/examples/withStreaming/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/examples/withStreaming go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 github.com/schollz/progressbar/v3 v3.14.4 ) diff --git a/examples/withStreaming/go.sum b/examples/withStreaming/go.sum index 9a85e9f49b..017b5af152 100644 --- a/examples/withStreaming/go.sum +++ b/examples/withStreaming/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 h1:4N9oQvXOzrtmcBgJUY5ivvJ4QkM12S7qEla6Iv2OG7U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61/go.mod h1:9+/eYi6Wza74nzRMCWnvG/Ybln1HzL+24dEN50ZrPok= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 h1:6tE09BFp8S50cXKxVxG3MR7KURNEfgiwLKLFciYyNbw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/sdk/go.mod b/sdk/go.mod index 31bb562803..f0477156fd 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -3,7 +3,7 @@ module github.com/TrueBlocks/trueblocks-core/sdk/v3 // Go Version go 1.22 -require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced +require github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index 8df0bcf5b9..a59dc23642 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -40,8 +40,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 h1:6tE09BFp8S50cXKxVxG3MR7KURNEfgiwLKLFciYyNbw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/apps/chifra/pkg/version/string.go b/src/apps/chifra/pkg/version/string.go index 65b0531087..5607c8f3c4 100644 --- a/src/apps/chifra/pkg/version/string.go +++ b/src/apps/chifra/pkg/version/string.go @@ -7,4 +7,4 @@ package version -const LibraryVersion = "GHC-TrueBlocks//3.1.3-release" +const LibraryVersion = "GHC-TrueBlocks//3.2.0-release" diff --git a/src/dev_tools/goMaker/go.mod b/src/dev_tools/goMaker/go.mod index 33fe2eb334..60b006bb86 100644 --- a/src/dev_tools/goMaker/go.mod +++ b/src/dev_tools/goMaker/go.mod @@ -4,7 +4,7 @@ module github.com/TrueBlocks/trueblocks-core/goMaker go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 github.com/gocarina/gocsv v0.0.0-20230123225133-763e25b40669 golang.org/x/text v0.16.0 ) diff --git a/src/dev_tools/goMaker/go.sum b/src/dev_tools/goMaker/go.sum index 92a3590c8a..7fbc80371a 100644 --- a/src/dev_tools/goMaker/go.sum +++ b/src/dev_tools/goMaker/go.sum @@ -1,5 +1,5 @@ -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 h1:6tE09BFp8S50cXKxVxG3MR7KURNEfgiwLKLFciYyNbw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= diff --git a/src/dev_tools/sdkFuzzer/go.mod b/src/dev_tools/sdkFuzzer/go.mod index e2df96996d..a6101e04be 100644 --- a/src/dev_tools/sdkFuzzer/go.mod +++ b/src/dev_tools/sdkFuzzer/go.mod @@ -4,8 +4,8 @@ module github.com/TrueBlocks/trueblocks-core/sdkFuzzer go 1.22 require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 ) require ( diff --git a/src/dev_tools/sdkFuzzer/go.sum b/src/dev_tools/sdkFuzzer/go.sum index 88b20e1947..3ddf3f7c24 100644 --- a/src/dev_tools/sdkFuzzer/go.sum +++ b/src/dev_tools/sdkFuzzer/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 h1:4N9oQvXOzrtmcBgJUY5ivvJ4QkM12S7qEla6Iv2OG7U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61/go.mod h1:9+/eYi6Wza74nzRMCWnvG/Ybln1HzL+24dEN50ZrPok= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 h1:6tE09BFp8S50cXKxVxG3MR7KURNEfgiwLKLFciYyNbw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= diff --git a/src/dev_tools/testRunner/go.mod b/src/dev_tools/testRunner/go.mod index 1a400f6fb7..9d032b83ca 100644 --- a/src/dev_tools/testRunner/go.mod +++ b/src/dev_tools/testRunner/go.mod @@ -6,8 +6,8 @@ go 1.22 replace github.com/TrueBlocks/trueblocks-core/sdk => ../../../sdk require ( - github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced - github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced + github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 + github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 ) require ( diff --git a/src/dev_tools/testRunner/go.sum b/src/dev_tools/testRunner/go.sum index 88b20e1947..3ddf3f7c24 100644 --- a/src/dev_tools/testRunner/go.sum +++ b/src/dev_tools/testRunner/go.sum @@ -40,10 +40,10 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced h1:DkwPLMNF6c9TnU8ppAMDCdGFsy0izWPSNaU6wP4h2Ok= -github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240831030327-e4efe9a24ced/go.mod h1:IaaSx7uufRtiWTLnwNZxvDVuhEzP0NTpMjHvZ0ujyuU= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced h1:feVe71JiCzdTjo5IIE9WhlhNpRHe3ZsJOAMp/6aZOiQ= -github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240831030327-e4efe9a24ced/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61 h1:4N9oQvXOzrtmcBgJUY5ivvJ4QkM12S7qEla6Iv2OG7U= +github.com/TrueBlocks/trueblocks-core/sdk/v3 v3.0.0-20240901010446-12c8928dea61/go.mod h1:9+/eYi6Wza74nzRMCWnvG/Ybln1HzL+24dEN50ZrPok= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61 h1:6tE09BFp8S50cXKxVxG3MR7KURNEfgiwLKLFciYyNbw= +github.com/TrueBlocks/trueblocks-core/src/apps/chifra v0.0.0-20240901010446-12c8928dea61/go.mod h1:YKuaek8RSyh681TFMK6Ua8MsHtuY+c1VJWi78Y35+J8= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= From 8b955c519dab5506e5fb9159bca893b1f867728a Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 31 Aug 2024 23:03:25 -0400 Subject: [PATCH 119/121] Ready for release --- tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests b/tests index af9995f01c..0838aa762a 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit af9995f01c43aa472ef4eaf3df2e94df4b398625 +Subproject commit 0838aa762ab5aac73e0fd10e1ed0ad24496cfbb4 From 7669f6d4e4190d1ec109961ea13a9e327643805e Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 31 Aug 2024 23:19:39 -0400 Subject: [PATCH 120/121] Updates docs and tests --- tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests b/tests index 0838aa762a..18876f0ae4 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 0838aa762ab5aac73e0fd10e1ed0ad24496cfbb4 +Subproject commit 18876f0ae42e3b069e8f130517567dfcbcbbb11c From 6d522f8691e4600b5a317c47fb72290bf818c61c Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Sat, 31 Aug 2024 23:29:50 -0400 Subject: [PATCH 121/121] Updates to v3.3.0 --- VERSION | 2 +- docs | 2 +- src/apps/chifra/pkg/version/string.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 944880fa15..15a2799817 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.0 +3.3.0 diff --git a/docs b/docs index 76343a8fda..c60c4a6ef5 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 76343a8fda1f222b32ec4395f23d8740e9512009 +Subproject commit c60c4a6ef56ce2037552f2989633d3ebe13dba15 diff --git a/src/apps/chifra/pkg/version/string.go b/src/apps/chifra/pkg/version/string.go index 5607c8f3c4..873f5922fa 100644 --- a/src/apps/chifra/pkg/version/string.go +++ b/src/apps/chifra/pkg/version/string.go @@ -7,4 +7,4 @@ package version -const LibraryVersion = "GHC-TrueBlocks//3.2.0-release" +const LibraryVersion = "GHC-TrueBlocks//3.3.0-release"