Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goldenage #2375

Merged
merged 666 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
666 commits
Select commit Hold shift + click to select a range
ad5bb1b
Added UTXO set rollback logic for re-org
jdowning100 Aug 20, 2024
922792f
Added Spent UTXO and Created UTXO pruning at 1000 depth
jdowning100 Aug 20, 2024
b2d3a26
Changed qiPool to LRU and made some small memory optimizations
jdowning100 Aug 22, 2024
222542f
lock the utxo set during worker
kiltsonfire Sep 11, 2024
f54d80c
Convert Qi fee to Quai for sorting in worker
jdowning100 Sep 10, 2024
0e752db
Bugfix: Better FindMinDenominations, misc bugfixes
jdowning100 Sep 11, 2024
808b111
Remove runtime package
jdowning100 Sep 17, 2024
922a8d8
Fix Orchard bootnode keys
Djadih Sep 17, 2024
a1f751c
increased size of chainEvent channel size in hierarchicalCoordinator
kiltsonfire Sep 10, 2024
4c3c6dd
changed diff to 500k in garden
kiltsonfire Sep 10, 2024
86da4e0
Adjusted initialization of headerCache and numberCache
kiltsonfire Sep 11, 2024
e0cf74f
removed bifurcation of body and block caches in core for processingState
kiltsonfire Sep 11, 2024
3cd3b59
changed the initialization fo pendingEtxs in headerchain.go
kiltsonfire Sep 11, 2024
dcd1881
changed initialization of receiptsCache and txLookupCache in state_pr…
kiltsonfire Sep 11, 2024
fd50d1f
increased the size of the maxNonceCache, should be roughly equal to q…
kiltsonfire Sep 11, 2024
c259bdb
Added buffers to the txpool channels
kiltsonfire Sep 11, 2024
9fce34d
changed initialization of lru caches in tx_pool
kiltsonfire Sep 11, 2024
6eb80e8
changed initialization of worker.uncles and increase uncle cache to 100
kiltsonfire Sep 11, 2024
06b149c
updated initialization of processingCache
kiltsonfire Sep 11, 2024
f9cbeee
changed the chain indexer pruneDepth to 10000
kiltsonfire Sep 11, 2024
086fa1d
fixed headerchain start bug
kiltsonfire Sep 11, 2024
899f7b8
lock the utxo set during worker
kiltsonfire Sep 11, 2024
022a991
Convert Qi fee to Quai for sorting in worker
jdowning100 Sep 10, 2024
36280bd
Bugfix: Only do pcrc search 10 times
jdowning100 Sep 12, 2024
442b629
Hotfix: Use the header expansion number in POEM
gameofpointers Sep 12, 2024
b9ba572
Changed the return to continue in p2p handler
gameofpointers Sep 13, 2024
cffc72d
Copying the header before computing the interlink hashes
gameofpointers Sep 13, 2024
b9d452b
Updated the channel size in hierarchical coordinator to 1000
gameofpointers Sep 13, 2024
7ef1792
bugfix: Fixed the validator func issue in gossipsub
gameofpointers Sep 13, 2024
7782960
bugfix: Writing best pending header to disk on every update
gameofpointers Sep 13, 2024
692e3e3
bugfix: dont check topic location
gameofpointers Sep 13, 2024
e8e4972
lowered orchard diff to 200k for single slice test
kiltsonfire Sep 13, 2024
d0d3537
changed durationlimit for orchard to 5 seconds
kiltsonfire Sep 13, 2024
cb4bde4
bugfix: the weight of the unlces was not being computed correctly
kiltsonfire Sep 13, 2024
8f45c18
increased ancestorCheckDist in hierarchical coordinator
kiltsonfire Sep 13, 2024
8e2720e
bugfix: Fixed the key to look up the pending block body
gameofpointers Sep 13, 2024
f45a7d2
tightened the lock in hierarchical_coordinator
kiltsonfire Sep 13, 2024
4fa3db9
Added caching to the calcOrder and powHash in headerchain
gameofpointers Sep 14, 2024
f016e0e
bugfix: using the intrinsic value instead of the powHash for entropy …
gameofpointers Sep 14, 2024
392a537
Added a proper cache to the progpow engine to cache powHashes
kiltsonfire Sep 15, 2024
38b0285
lowered the chainIndexer ch and increased the prunedepth and added pr…
gameofpointers Sep 15, 2024
b3f55f3
Removed the phcachemu from slice.go
gameofpointers Sep 16, 2024
801fbc0
Added go debug trace to all go routines
gameofpointers Sep 16, 2024
27ef3bc
Increased the chain indexder ch size back to 10K
gameofpointers Sep 16, 2024
0c6e404
Changed the bestPh into atomic value
gameofpointers Sep 16, 2024
e485049
Added a 5 second timeout on the build pending headers
gameofpointers Sep 16, 2024
700c433
Added the lock in sealer to prevent crash in MineToThreshold
gameofpointers Sep 16, 2024
35fe177
Revert "Chaged the GossipSub max message size to 3MB"
gameofpointers Sep 17, 2024
ccc6abd
bugfix: Need to lock recentblocks in ChainEventLoop to prevent panic
gameofpointers Sep 18, 2024
e90135a
Fix PeerDB topics
Djadih Sep 17, 2024
f616de4
stream manager tests - kill sm goroutine after test to avoid error af…
didaunesp Sep 10, 2024
24a0a84
Reorganized the pubsub subscribe to take in custom validator funcs
gameofpointers Sep 20, 2024
9af9e05
Progpow miner bugfix
Djadih Sep 19, 2024
aaa728b
Workshare calculation fixes
Djadih Sep 19, 2024
7289c34
No longer request hashes or numbers
Djadih Sep 23, 2024
567b953
bugfix: Genallocs file name incorrect for Progpow
Djadih Sep 23, 2024
de93824
Fixed quai_createAccessList API and added ethclient functionality
jdowning100 Sep 18, 2024
90edbe0
Added access list enforcement and added creation address to access list
jdowning100 Sep 18, 2024
0b4a9c0
Don't initialize txWorker unless mining is enabled
Djadih Sep 24, 2024
aee860e
Remove unused methods from quaiapi
gameofpointers Sep 4, 2024
a872b41
Updated the rpc marshal of workobject and headers
gameofpointers Sep 4, 2024
bc7942f
Replaced primeTerminus with primeTerminusHash
gameofpointers Sep 4, 2024
e66bead
Renaming S (entropy) with Entropy to avoid confusion in naming
gameofpointers Sep 4, 2024
17c68ec
Renamed ext to etxs throught the codebase
gameofpointers Sep 5, 2024
c34a589
Changed the unclehash to be proto encoding blake3 hash similar to the…
gameofpointers Sep 5, 2024
0f08735
Updated the Header RPCs to only return header fields
gameofpointers Sep 5, 2024
d576112
Renamed Etxs and EtxHash to OutboundEtxs and OutboundEtxHash
gameofpointers Sep 24, 2024
af90db3
Prevent worker from unintentionally double-spending UTXOs
jdowning100 Sep 25, 2024
08f51c7
Prevent worker from unintentionally double-spending UTXOs
jdowning100 Sep 25, 2024
d87d5fe
Remove unsupported broadcast data types
Djadih Sep 24, 2024
f5b9229
Verify send/receive by hash, fix emptyWo method
Djadih Sep 27, 2024
75cbb3f
added error print on stream open
kiltsonfire Sep 18, 2024
8a2de72
bugfix: Updated the garden vm1 bootnode key
gameofpointers Sep 19, 2024
b551a54
Replacing the dual dht with ipfsdht
gameofpointers Sep 19, 2024
04579d9
Made the stream creation non blocking and also added a timeout
gameofpointers Sep 20, 2024
4738e7b
added a circular shift to leaders, moved lock in hc to after pcrc
kiltsonfire Sep 20, 2024
1a3f7b5
New pendingHeader logic based on cache of nodeSets
kiltsonfire Sep 21, 2024
ef9b9c7
pubsub tests - fix sync for large n
didaunesp Sep 10, 2024
51291f7
add a mutex to broadcast to avoid overloading libp2p subscriber channel
didaunesp Sep 18, 2024
293287b
Extend epoch and period for GoldenAge
Djadih Sep 27, 2024
93133dd
GPU Difficulty
Djadih Aug 12, 2024
85b7a9c
Added lockups for Qi and Quai coinbase
jdowning100 Sep 13, 2024
b993b3f
First Qi transaction in a block can aggregate denominations
jdowning100 Sep 24, 2024
aae9eab
Remove expired Qi txs from the pool on a regular interval
jdowning100 Sep 24, 2024
76b4de6
Return MixedcaseAddress with proper checksum for RPC requests
jdowning100 Sep 25, 2024
61a5a23
Fix wo_test.go
jdowning100 Sep 27, 2024
0804e2b
Remove unused bootnode bool flag
Djadih Sep 30, 2024
f15dc37
Fix rates to work with metrics gauges
Djadih Oct 1, 2024
270cfa3
Added primary and secondary coinbase into the header and verifying it
gameofpointers Sep 12, 2024
6f15d93
Deleted the GasPriceOracle and Feehistory logic
gameofpointers Sep 10, 2024
10e9d2c
Removing the protocol defined baseFee and determining baseFee from th…
gameofpointers Sep 10, 2024
c08e3ef
Update the genesis hash
gameofpointers Sep 24, 2024
d506620
Using a uniform priced auction to reorder the transaction set to
gameofpointers Sep 25, 2024
b34ca99
Added EtxType and removed the IsCoinbase field from the transaction
gameofpointers Sep 27, 2024
2c00565
Made changes to the Transaction and Receipt RPC responses
gameofpointers Sep 27, 2024
22a7672
Removed the unnecessary start function from miner
gameofpointers Sep 27, 2024
0ffb400
Removed interrupt and unused method from worker
gameofpointers Sep 30, 2024
ff7dd14
bugfix: Fixed the from and contract mixed address marshalling for Get…
gameofpointers Sep 30, 2024
c2d332b
Added a MinerTip api that returns the min gas price of the pool for t…
gameofpointers Sep 30, 2024
33c4789
bugfix: Graceful shutdown of the node
gameofpointers Oct 1, 2024
e04794d
Added exchageRate, quaiToQi and qiToQuai in header
kiltsonfire Sep 16, 2024
83d8598
getTransactionByHash should return null if not found
wizeguyy Oct 1, 2024
51a80da
bugfix: have to look at the env.txs to check instead of the work object
gameofpointers Oct 1, 2024
5a938b7
Add new fields to wo and header hashes
Djadih Oct 1, 2024
3624f0f
bugfix: Fixed the rpc tx and receipt marshal of type and to address
gameofpointers Oct 2, 2024
9013442
bugfix: Nodes can run without setting the primary and secondary coinbase
gameofpointers Oct 2, 2024
cb989eb
bugfix: Fix the pendingheaders order array ballooning in size without…
gameofpointers Oct 3, 2024
dbfda8d
Fix MultipleRequests race condition
Djadih Oct 2, 2024
79f8f60
Add cancel context synchronizations for protocol handler and closing …
Djadih Oct 2, 2024
a958d33
bugfix: Fix the EstimateGas to mimic the old behaviour
gameofpointers Oct 3, 2024
ee7cab3
Remove obsolete getHeaderHashByNumber
wizeguyy Oct 3, 2024
21a48f4
Fix response for BlockByNumber not found
wizeguyy Oct 3, 2024
4520d17
Fix response for getBlockOrCandidateByHash
wizeguyy Oct 3, 2024
e06864d
Added conversion related fields to stats
kiltsonfire Oct 4, 2024
400e568
Added prime block sync depth to be more resilient towards disconnecte…
gameofpointers Oct 3, 2024
61be750
bugfix: Only send to order transactions channel in zone
gameofpointers Oct 4, 2024
1065d61
Fix the node stop issue
gameofpointers Oct 4, 2024
f7b1eba
Lowered the proc time to 10 secs for prime downloading
gameofpointers Oct 4, 2024
365b69a
Reapply "Chaged the GossipSub max message size to 3MB"
gameofpointers Oct 4, 2024
3880468
bugfix: return the pool gas price by default on the node
gameofpointers Oct 4, 2024
547fd54
bugfix: remove the gasprice and minertip legacy checks from estimateGas
gameofpointers Oct 4, 2024
9139080
bugfix: reorder the wg.Done and panic catch on defer in handler
gameofpointers Oct 4, 2024
956f474
Bound the number of transactions included for sorting
gameofpointers Oct 7, 2024
09508f5
Configurable subscription limit
wizeguyy Oct 7, 2024
2b95653
Return MixedCaseAddresses in RPC AccessLists
Djadih Oct 7, 2024
1df3a05
Fix tx receipt crash for contracts
Djadih Oct 7, 2024
de111c3
Added InternalAddress test for validation
gameofpointers Oct 7, 2024
1963d2b
Adding error into the prints after catching it
gameofpointers Oct 7, 2024
50b4dee
bugfix: fixed the case where ordered txs is not fully commited into t…
gameofpointers Oct 7, 2024
a606c84
bugfix: Fixed transaction unmarshalling in ethclient
gameofpointers Oct 7, 2024
3d973e0
Added stats for gas and state pricing and use
kiltsonfire Oct 8, 2024
904f17e
Computing Expansion Number retro actively to have it deterministic on
gameofpointers Oct 3, 2024
6aba503
bugfix: Fix the crash on GetTransactionByHash for contract transaction
gameofpointers Oct 8, 2024
a615e8c
bugfix: Fixed the debug print in worker
gameofpointers Oct 8, 2024
98962d9
bugfix: Fixed the json encoding of the rpc transactions
gameofpointers Oct 8, 2024
8e9689d
bugfix: prevent zero fee txs from getting included in the worker and …
gameofpointers Oct 9, 2024
9eb9ccd
Do not require config file
wizeguyy Oct 9, 2024
58667d3
Implement the config command
wizeguyy Oct 9, 2024
6c6b945
Add schnorr tests
alanorwick Feb 22, 2024
b8f8a38
Added musig2 vector tests
jdowning100 Sep 24, 2024
84979ec
Update VERSION to v0.33.0
Djadih Oct 2, 2024
527a6c2
Enable genesis nonce checking on init
Djadih Oct 9, 2024
fae5d6c
Fix all genesis hashes
Djadih Oct 9, 2024
35814a6
implement pubkey comp/decompress in TxIn proto enc/decoding
alejoacosta74 Oct 1, 2024
c486917
update test data
alejoacosta74 Oct 1, 2024
c991d2d
Fix default cases
Djadih Oct 10, 2024
429b316
bugfix: return the block hash and block number on the newRPCTransacti…
gameofpointers Oct 9, 2024
fffdb85
Using Entropy for append queue filter
gameofpointers Oct 7, 2024
6174664
Increase the prune depth to 10M blocks to neuter pruning in the indexer
gameofpointers Oct 10, 2024
701b159
bugfix: Fixed asking the blocks that have already been downloaded
gameofpointers Oct 10, 2024
a200141
bugfix: If bestPh is nil, do not set the best on startup
gameofpointers Oct 11, 2024
2caa1dc
Bound the time diff between blocks to max of 100 secs
gameofpointers Oct 11, 2024
e35cf4c
Bugfix: Use types.UTXOHash in genesis alloc Muhash
jdowning100 Oct 11, 2024
d5ec2de
make colosseum private keys
robertlincecum Oct 14, 2024
4a82220
Trimming: Remove UTXOs at depth to keep set below maximum size
jdowning100 Aug 28, 2024
845113a
Trim denominations based on trim depths and adjust trim depths based …
jdowning100 Aug 29, 2024
90536b0
Added key sorting and concurrent trimming to reduce overhead
jdowning100 Sep 3, 2024
6ce4307
Qi tx gas cost increases relative to log of set size
jdowning100 Sep 19, 2024
97f8d0d
bugfix: if we reach genesis, return the genesis as common
gameofpointers Oct 9, 2024
4000c05
Set minimum trim depth to MaxInt blocks and set soft max UTXO set siz…
jdowning100 Oct 12, 2024
86b6a57
Fix division by zero error in CalcOrderCache
Djadih Oct 14, 2024
775f9f3
bugfix: CurrentHeader() could change in ApplyPoWFilter
Djadih Oct 14, 2024
d43a183
Exchange Rate controller
kiltsonfire Oct 11, 2024
e097795
bugfix: Added rate mutex in ProcRequestRate
gameofpointers Oct 11, 2021
6efa70f
Use a number check before TimeToStartEtx and use gas check after
gameofpointers Oct 11, 2021
71ebcdc
updated parameters and deleted an uneeded use of float
kiltsonfire Oct 13, 2024
2a7b069
parameters are set to test colosseum, and base fee print
kiltsonfire Oct 14, 2024
b55fcac
Safeguard efficiency score calculation
Djadih Oct 14, 2024
86e7afe
Require go 1.23.1 and move http serve out of defer func
jdowning100 Oct 15, 2024
3962ff2
Updated the colosseum nonce/hash for node wrangler release
gameofpointers Oct 15, 2024
0efe089
Allows automatic switching between Quai and Qi with MinerPreference flag
Djadih Oct 15, 2024
0a97c51
Refuse connections to peers running incompatible protocol
wizeguyy Oct 15, 2024
f0f9124
Added a min and max base fee
gameofpointers Oct 14, 2024
5afabd5
Redeem locked Quai (coinbase and conversion) on block intervals
alanorwick Oct 13, 2024
3bfcaf5
Fix coinbases to comply with QIP10
jdowning100 Oct 13, 2024
63b3b6d
Updated gen allocs with proper location in bytes 0 and 2 and proper l…
jdowning100 Oct 13, 2024
e3caa8b
bugfix: Added a multiplier to the average base fee to allow enough ro…
gameofpointers Oct 16, 2024
556e443
Remove nonce from local
Djadih Oct 16, 2024
4a14ce4
Re-enable multi slice coinbases
Djadih Oct 15, 2024
d758b36
bugfix: Missed totalEtxGas addition in the state processor
gameofpointers Oct 17, 2024
e70094e
Added a way for stop and start to work when the network is not produc…
gameofpointers Oct 16, 2024
c144d81
Cleaned up the logs and added some new prints
gameofpointers Oct 17, 2024
0ccb819
Add GetLatestUTXOSetSize API method for Qi transactor
jdowning100 Oct 16, 2024
ca10684
Removed 2 denominations and new genallocs
jdowning100 Oct 17, 2024
9e77c53
Bugfix: Check inputs/outputs correctly and add etx gas to conversion
jdowning100 Oct 17, 2024
86dd208
GasPrice API returns smallest units, EstimateGas returns higher estim…
jdowning100 Oct 17, 2024
7201fc7
Allow duplicate addresses to be used in Qi tx inputs
jdowning100 Oct 18, 2024
bd5f132
NONCE change for goldenage launch
gameofpointers Oct 18, 2024
bbc1bac
updated genallocs for GoldenAge
kiltsonfire Oct 18, 2024
59f53f4
Bugfix: QiRateAtBlock and QuaiRateAtBlock should allow for latest blo…
jdowning100 Oct 18, 2024
d4e9c1c
Chainindexer indexes Qi coinbases and conversions
jdowning100 Oct 18, 2024
bc9341b
GasPrice and MinerTip should only be called in Zone and fixed ethclient
jdowning100 Oct 18, 2024
e9ee381
Fix peer timeout penalty
wizeguyy Oct 21, 2024
178ed39
bugfix: Fix Quai/Qi coinbases print
Djadih Oct 22, 2024
2dd3f20
Generate access event on unlock
wizeguyy Oct 23, 2024
af02843
Add default cases to filter event emitters
wizeguyy Oct 23, 2024
c9b04c7
Include colosseum genesis nonce
Djadih Oct 24, 2024
9fc3d98
bugfix: Fix the accesses to use the chain head event and also fix in
gameofpointers Oct 17, 2024
be4893c
Added a way to share transactions between selected clients
gameofpointers Oct 22, 2024
f3202d2
Improved the syncing by increasing proc time and getting two sets of …
gameofpointers Oct 22, 2024
1ef2047
bugfix: HasHeader should not use the number and header cache to deter…
gameofpointers Oct 24, 2024
7b938f3
Added coinbase-lockup flag and API to set the lockup byte
jdowning100 Oct 22, 2024
1a802ac
Updated QuaiRateAtBlock and QiRateAtBlock to use hexutil.Big
jdowning100 Oct 22, 2024
89ef57f
Added SetMinerPreference private miner API
jdowning100 Oct 23, 2024
f9a2078
Update SoftMaxUTXOSetSize to max int
jdowning100 Oct 24, 2024
b56607e
Fixed UTXO indexer and organized index by address and block height
jdowning100 Oct 21, 2024
3cf25a0
Added quai_getUTXO API
jdowning100 Oct 25, 2024
d7cb789
Bugfix: Return in txListenerLoop if node is shutting down
jdowning100 Oct 25, 2024
a960b53
bugfix: Create an installed channel for unlocks
gameofpointers Oct 25, 2024
198b880
bugfix: making the error channel on unlock subscription
gameofpointers Oct 25, 2024
3be7932
First goldenage fork, increasing min gas limit for contract deployment
gameofpointers Oct 25, 2024
832c53a
bugfix: Removed the fatal on panic in access subscription
gameofpointers Oct 28, 2024
5e83975
Reject block responses if the block is not on the new fork
gameofpointers Oct 29, 2024
cd5ed4c
bugfix: for sycing when there is noise
gameofpointers Oct 29, 2024
3f3081c
Neuter workshare broadcast and listening on gossipsub
gameofpointers Oct 30, 2024
2e269ec
Revert "Neuter workshare broadcast and listening on gossipsub"
gameofpointers Oct 30, 2024
e6450e0
Added a pow and number filter on the workshare propagation
gameofpointers Oct 30, 2024
bf31249
Changing the workshare topic to add the functionality back
gameofpointers Oct 30, 2024
024fcff
Updated the prints for stream
gameofpointers Oct 30, 2024
bd94284
bugfix: Have to use current block to calculate the generate pending h…
gameofpointers Nov 1, 2024
bdda2bd
Do not run the check bad hash and recover, and do not ask for bad blo…
gameofpointers Oct 30, 2024
62b0d43
[HAL-13] Remove confusing comment
wizeguyy Oct 29, 2024
eff3bc4
[HAL-06] Remove cruft
wizeguyy Oct 29, 2024
ce5e0de
[HAL-03] Fix deadlock in Bloombits matcher
wizeguyy Oct 29, 2024
a93c8cf
[HAL-07] Add missing fields to toCallArg()
wizeguyy Oct 30, 2024
5599586
[HAL-08] Error instead of Fatal when recovering from panic in verifier
wizeguyy Nov 4, 2024
6a154b1
bugfix: Fixed the reorg loop in the set current header to compute the…
gameofpointers Nov 1, 2024
c12e4b1
Use the max peer quality among the peers in the db to categorize the …
gameofpointers Nov 1, 2024
a96d658
bugfix: In the case of unclean shutdown and the block is appended in …
gameofpointers Nov 4, 2024
19ed1a4
Test the nil raw data on the tx proto decode and ensure it doesnt crash
gameofpointers Nov 4, 2024
273488d
bugfix: evm root is not unique anymore, so this check is wrong
gameofpointers Nov 4, 2024
9ea9c14
Move multiset into /crypto
wizeguyy Nov 6, 2024
080c7d5
Add multiset tests
wizeguyy Nov 6, 2024
a341e53
Increased the account queue/slots to 200 from 10 in tx pool
gameofpointers Nov 14, 2024
e207a57
Storing the best node set on stop and retrieving on launch
gameofpointers Nov 11, 2024
ca64903
Added a second goldenage fork number
gameofpointers Nov 5, 2024
eb0e6f7
Trimming based on fixed depth
gameofpointers Nov 4, 2024
52ece82
Disallow UTXO locks and don't immediately remove aggregation Qi tx fr…
jdowning100 Nov 4, 2024
e06e2cf
Fix Qi-Quai conversions by checking the total Qit amount out instead …
jdowning100 Nov 4, 2024
159f1d6
Added a 30% juice on coinbase reward for few hours after the fork
gameofpointers Nov 6, 2024
0c4571d
[HAL-18] Performing multiplication before the division to keep more p…
gameofpointers Nov 8, 2024
dbc77de
Updating the new workshares threshold diff to 4 after the second gold…
gameofpointers Nov 8, 2024
cfb60bb
Paying the miner the conversion fee after the fork
gameofpointers Nov 15, 2024
cde9978
Increased the min gas limit after the second fork in goldenage
gameofpointers Nov 15, 2024
c218ced
Updated the goldenage fork number
gameofpointers Nov 15, 2024
6f9fa95
Revert "Storing the best node set on stop and retrieving on launch"
gameofpointers Nov 15, 2024
d238ec5
Reusing streams for efficient requests
gameofpointers Nov 19, 2024
755dcbd
Enable default genesis block
wizeguyy Nov 11, 2024
a8086bf
bugfix: Shouldn't panic when querying rank of unknown peer
wizeguyy Nov 11, 2024
82e490f
bugfix: Handle nil DB on get peers
wizeguyy Nov 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodelogs
.git
.gitignore
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ build/bin/
nodelogs/
traces/
/data/
*/config.toml
*config.toml
*/private.key
.vscode/
.idea*
*.env
*.sh
**/testdata/
*.cov
48 changes: 48 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# First stage: build the Go binary
FROM golang:1.23-alpine AS builder

# Install make and other build dependencies
RUN apk --no-cache add make gcc musl-dev
# Set the Current Working Directory inside the container
WORKDIR /app

# Copy go mod and sum files
COPY go.mod go.sum ./

# Download all dependencies
RUN go mod download

# Copy the source code
COPY . .

# Build the Go app using the Makefile
RUN make go-quai

# Second stage: create a smaller runtime image
FROM alpine:latest

# Install any dependencies required to run the application
RUN apk update && apk add --no-cache \
coreutils \
findutils \
procps \
util-linux \
curl \
ca-certificates

# Set the Current Working Directory inside the container
WORKDIR /root/

# Copy the binary from the builder stage
COPY --from=builder /app/build/bin/go-quai ./build/bin/go-quai
COPY --from=builder /app/VERSION ./VERSION


# Ensure the binary has execute permissions
RUN chmod +x ./build/bin/go-quai

# Expose the necessary ports
EXPOSE 8001 8002 8003 8004 8200 8201 8202 8220 8221 8222 8240 8241 8242 9001 9002 9003 9004 9200 9201 9202 9220 9221 9222 9240 9241 9242

# Command to run the executable
CMD ["./build/bin/go-quai", "start"]
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mocks:
## generate protobuf files
protogen:
@echo "Generating protobuf files"
@find . -name '*.proto' -exec protoc --go_out=. --go_opt=paths=source_relative {} \;
@find . -name '*.proto' -exec protoc --go_out=. --go_opt=paths=source_relative --experimental_allow_proto3_optional {} \;

debug:
go build -gcflags=all="-N -l" -v -o build/bin/go-quai ./cmd/go-quai
Expand All @@ -40,3 +40,9 @@ go-quai:
$(GORUN) build/ci.go build ./cmd/go-quai
@echo "Done building."
@echo "Run \"$(GOBIN)/go-quai\" to launch go-quai."

## build the go-quai binary
go-quai-race:
$(GORUN) build/ci.go build -race ./cmd/go-quai
@echo "Done building."
@echo "Run \"$(GOBIN)/go-quai\" to launch go-quai."
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,22 @@ cd go-quai
make go-quai
```

After a successful build, the binary will be located at `build/bin/go-quai`.

### Running a node
To run a node with default options, simply execute:
To run a go-quai node, simply execute the `go-quai start` command. Be sure to specify the parameters you wish to use, such as your coinbase address (if you plan on mining), and which slices you wish to participate in.

For example, here is the run command for miner (0x00a3e45aa16163F2663015b6695894D918866d19) in cyprus-1 (zone-0-0) on the "garden" test network:
```shell
make run
./build/bin/go-quai start --node.slices "[0 0]" --node.coinbases "0x00a3e45aa16163F2663015b6695894D918866d19" --node.environment "garden"
```

There are several options and subcommands available when running the go-quai client. See the help menu for a complete list:
For the full list of available options and their default values, consult the help menu:
```shell
./build/go-quai --help
```

Any options may be provided as command-line arguments or specified in the config file at `config.yaml`.
All configuration options may be supplied in a config file too, located in the directory specified by `--global.config-dir`. Note specified on the command-line will override options specified in the config file.

### Running tests
To run the included unit tests, run the following command:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.19.0-pre
v0.34.0-pre
9 changes: 8 additions & 1 deletion build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Usage: go run build/ci.go <command> <command flags/arguments>

Available commands are:

- build [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables
- build [ -arch architecture ] [ -cc compiler ] [ -race ] [ packages... ] -- builds packages and executables
- test [ -coverage ] [ packages... ] -- runs the tests
- lint -- runs certain pre-selected linters

Expand Down Expand Up @@ -119,6 +119,7 @@ func doBuild(cmdline []string) {
dlgo = flag.Bool("dlgo", false, "Download Go and build with it")
arch = flag.String("arch", "", "Architecture to cross build for")
cc = flag.String("cc", "", "C compiler to cross build with")
race = flag.Bool("race", false, "Enable race detector")
)
flag.CommandLine.Parse(cmdline)

Expand Down Expand Up @@ -146,6 +147,11 @@ func doBuild(cmdline []string) {
// Show packages during build.
gobuild.Args = append(gobuild.Args, "-v")

// Add race flag if specified.
if *race {
gobuild.Args = append(gobuild.Args, "-race")
}

// Now we choose what we're even building.
// Default: collect all 'main' packages in cmd/ and build those.
packages := flag.Args()
Expand Down Expand Up @@ -254,3 +260,4 @@ func downloadLinter(cachedir string) string {
}
return filepath.Join(cachedir, base, "golangci-lint")
}

78 changes: 78 additions & 0 deletions cmd/go-quai/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package main

import (
"os"
"path/filepath"

"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/dominant-strategies/go-quai/cmd/utils"
"github.com/dominant-strategies/go-quai/common/constants"
"github.com/dominant-strategies/go-quai/log"
"github.com/dominant-strategies/go-quai/params"
)

var configCmd = &cobra.Command{
Use: "config",
Short: "creates the default config file",
Long: `creates the default config file in the location specified by the --config-dir flag.
The default config file will contain all the default values for the flags.
Any flags passed in the command line here will also overwrite the default values in the config file.`,
RunE: runConfig,
SilenceUsage: true,
SuggestionsMinimumDistance: 2,
Example: `go-quai start -log-level=debug`,
PreRunE: startCmdPreRun,
}

func init() {
rootCmd.AddCommand(configCmd)

for _, flagGroup := range utils.Flags {
for _, flag := range flagGroup {
utils.CreateAndBindFlag(flag, configCmd)
}
}
}

func configCmdPreRun(cmd *cobra.Command, args []string) error {
// set keyfile path
if viper.GetString(utils.KeyFileFlag.Name) == "" {
configDir := cmd.Flag(utils.ConfigDirFlag.Name).Value.String()
viper.Set(utils.KeyFileFlag.Name, filepath.Join(configDir, "private.key"))
}
// Initialize the version info
params.InitVersion()
return nil
}

func runConfig(cmd *cobra.Command, args []string) error {
// set config path to read config file
configDir := cmd.Flag(utils.ConfigDirFlag.Name).Value.String()

// Make sure configDir is a valid directory using path/filepath
// filepath.Clean returns the shortest path name equivalent to path by purely lexical processing
configDir = filepath.Clean(configDir)

_, err := os.Stat(configDir)
if err != nil && os.IsNotExist(err) {
// If the directory does not exist, create it
if err := os.MkdirAll(configDir, 0755); err != nil {
log.Global.Fatalf("Failed to create config directory: %s, Error: %v", configDir, err)
}
log.Global.Debugf("Config directory created: %s", configDir)
} else if err != nil {
log.Global.Fatalf("Error accessing config directory: %s, Error: %v", configDir, err)
}
if _, err := os.Stat(filepath.Join(configDir, constants.CONFIG_FILE_NAME)); os.IsNotExist(err) {
err := utils.WriteDefaultConfigFile(configDir, constants.CONFIG_FILE_NAME, constants.CONFIG_FILE_TYPE)
if err != nil {
return err
}
log.Global.WithField("path", filepath.Join(configDir, constants.CONFIG_FILE_NAME)).Info("Initialized new config file.")
} else {
log.Global.WithField("path", filepath.Join(configDir, constants.CONFIG_FILE_NAME)).Fatal("Cannot init config file. File already exists. Either remove this option to run with the existing config file, or delete the existing config file to re-initialize a new one.")
}
return nil
}
31 changes: 23 additions & 8 deletions cmd/go-quai/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime/debug"

"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand All @@ -18,6 +19,14 @@ var rootCmd = &cobra.Command{
}

func Execute() error {
defer func() {
if r := recover(); r != nil {
log.Global.WithFields(log.Fields{
"error": r,
"stacktrace": string(debug.Stack()),
}).Fatal("Go-Quai Panicked")
}
}()
err := rootCmd.Execute()
if err != nil {
return err
Expand All @@ -26,8 +35,10 @@ func Execute() error {
}

func init() {
for _, flag := range utils.GlobalFlags {
utils.CreateAndBindFlag(flag, rootCmd)
for _, flagGroup := range utils.Flags {
for _, flag := range flagGroup {
utils.CreateAndBindFlag(flag, rootCmd)
}
}
}

Expand All @@ -45,7 +56,7 @@ func rootCmdPreRun(cmd *cobra.Command, args []string) error {
if err := os.MkdirAll(configDir, 0755); err != nil {
log.Global.Fatalf("Failed to create config directory: %s, Error: %v", configDir, err)
}
log.Global.Debug("Config directory created: %s", configDir)
log.Global.Debugf("Config directory created: %s", configDir)
} else if err != nil {
log.Global.Fatalf("Error accessing config directory: %s, Error: %v", configDir, err)
}
Expand All @@ -54,12 +65,16 @@ func rootCmdPreRun(cmd *cobra.Command, args []string) error {
viper.SetConfigType(constants.CONFIG_FILE_TYPE)

// Write default config file if it does not exist
if _, err := os.Stat(filepath.Join(configDir, constants.CONFIG_FILE_NAME)); os.IsNotExist(err) {
err := utils.WriteDefaultConfigFile(configDir, constants.CONFIG_FILE_NAME, constants.CONFIG_FILE_TYPE)
if err != nil {
return err
if viper.GetBool(utils.InitConfigFlag.Name) {
if _, err := os.Stat(filepath.Join(configDir, constants.CONFIG_FILE_NAME)); os.IsNotExist(err) {
err := utils.WriteDefaultConfigFile(configDir, constants.CONFIG_FILE_NAME, constants.CONFIG_FILE_TYPE)
if err != nil {
return err
}
log.Global.WithField("path", filepath.Join(configDir, constants.CONFIG_FILE_NAME)).Info("Initialized new config file.")
} else {
log.Global.WithField("path", filepath.Join(configDir, constants.CONFIG_FILE_NAME)).Fatal("Cannot init config file. File already exists. Either remove this option to run with the existing config file, or delete the existing config file to re-initialize a new one.")
}
log.Global.WithField("path", filepath.Join(configDir, constants.CONFIG_FILE_NAME)).Info("Default config file created")
}

// load config from file and environment variables
Expand Down
Loading
Loading