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

Gpu difficulty #2369

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,061 changes: 311 additions & 750 deletions consensus/progpow/algorithm.go

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions consensus/progpow/algorithm_progpow.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package progpow

import (
"encoding/binary"
"math"
"math/bits"

goLRU "github.com/hashicorp/golang-lru/v2"
Expand All @@ -33,7 +32,7 @@ const (
progpowDagLoads = 4 // Number of uint32 loads from the DAG per lane
progpowCntCache = 11
progpowCntMath = 18
progpowPeriodLength = math.MaxUint64
progpowPeriodLength = 2
progpowCntDag = 64
progpowMixBytes = 256
)
Expand Down
6 changes: 3 additions & 3 deletions consensus/progpow/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,9 @@ func (progpow *Progpow) ComputePowLight(header *types.WorkObjectHeader) (mixHash
}
return progpowLight(size, cache, hash.Bytes(), nonce, blockNumber, ethashCache.cDag, progpow.lookupCache)
}
cache := progpow.cache(header.PrimeTerminusNumber().Uint64())
size := datasetSize(header.PrimeTerminusNumber().Uint64())
digest, result := powLight(size, cache.cache, header.SealHash(), header.NonceU64(), header.PrimeTerminusNumber().Uint64())
cache := progpow.cache(header.NumberU64())
size := datasetSize(header.NumberU64())
digest, result := powLight(size, cache.cache, header.SealHash(), header.NonceU64(), header.NumberU64())
mixHash = common.BytesToHash(digest)
powHash = common.BytesToHash(result)
header.PowDigest.Store(mixHash)
Expand Down
6 changes: 3 additions & 3 deletions consensus/progpow/sealer.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ search:
}
return progpowLight(size, cache, hash, nonce, blockNumber, ethashCache.cDag, progpow.lookupCache)
}
cache := progpow.cache(workObject.PrimeTerminusNumber().Uint64())
size := datasetSize(workObject.PrimeTerminusNumber().Uint64())
cache := progpow.cache(workObject.NumberU64(common.ZONE_CTX))
size := datasetSize(workObject.NumberU64(common.ZONE_CTX))
// Compute the PoW value of this nonce
digest, result := powLight(size, cache.cache, workObject.SealHash().Bytes(), nonce, workObject.PrimeTerminusNumber().Uint64())
digest, result := powLight(size, cache.cache, workObject.SealHash().Bytes(), nonce, workObject.NumberU64(common.ZONE_CTX))
if new(big.Int).SetBytes(result).Cmp(target) <= 0 {
// Correct nonce found, create a new header with it
workObject = types.CopyWorkObject(workObject)
Expand Down
4 changes: 2 additions & 2 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func DefaultOrchardGenesisBlock(consensusEngine string, genesisNonce uint64) *Ge
Nonce: genesisNonce,
ExtraData: hexutil.MustDecode("0x3535353535353535353535353535353535353535353535353535353535353536"),
GasLimit: 5000000,
Difficulty: big.NewInt(30000000000),
Difficulty: big.NewInt(300000000),
}
}

Expand Down Expand Up @@ -451,7 +451,7 @@ func DefaultLocalGenesisBlock(consensusEngine string, genesisNonce uint64) *Gene
Nonce: 0,
ExtraData: hexutil.MustDecode("0x3535353535353535353535353535353535353535353535353535353535353535"),
GasLimit: 5000000,
Difficulty: big.NewInt(1000),
Difficulty: big.NewInt(3000000000),
}
}

Expand Down
4 changes: 2 additions & 2 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ var (
// Progpow GenesisHashes
ProgpowColosseumGenesisHash = common.HexToHash("0xba33a6807db85d5de6f51ff95c4805feaa9b81951a57e43254117d489031e96f")
ProgpowGardenGenesisHash = common.HexToHash("0xb610af2eef9d854d01510785b0171247cb221912124c74fcef888bbed42448bb")
ProgpowOrchardGenesisHash = common.HexToHash("0x863406b0b535b316d4ae5a4d97336c0a015a36c0e5c055aa2e4461e9048b62c9")
ProgpowOrchardGenesisHash = common.HexToHash("0x7bef576d9d04108137d14e2ea644f580634b35c37682b555bfb50dfb154501d2")
ProgpowLighthouseGenesisHash = common.HexToHash("0xf60de17f1ae6cbae820d14599eb95581f5c18799f84904520c264be9cfff64c4")
ProgpowLocalGenesisHash = common.HexToHash("0x175e643b5fe6158daca4742959f33ac2a8e9e6fe06cfd7233582827558f934f9")
ProgpowLocalGenesisHash = common.HexToHash("0xaaeed94a74dccb80302c309329de4d2b90c71cda004c7ee45d9a8f692dbf4762")

// Blake3GenesisHashes
Blake3PowColosseumGenesisHash = common.HexToHash("0xee89c5f775980556c2bf8dc988e477f16005da57f84f2a1000dbe4693ad5f53d")
Expand Down
Loading