From 9210ef4f0b58d25b3b874b00d0b59590e54d0848 Mon Sep 17 00:00:00 2001 From: Hussam Date: Wed, 4 Dec 2024 12:24:15 -0600 Subject: [PATCH] Tm --- consensus/progpow/algorithm.go | 828 +++++++++++++++++++----------- consensus/progpow/progpow.go | 2 +- consensus/progpow/progpow_test.go | 43 ++ 3 files changed, 567 insertions(+), 306 deletions(-) create mode 100644 consensus/progpow/progpow_test.go diff --git a/consensus/progpow/algorithm.go b/consensus/progpow/algorithm.go index 4ac2d78c9f..384fce6569 100644 --- a/consensus/progpow/algorithm.go +++ b/consensus/progpow/algorithm.go @@ -39,9 +39,9 @@ import ( const ( datasetInitBytes = 1 << 32 // Bytes in dataset at genesis - datasetGrowthBytes = 1 << 25 // Dataset growth per epoch + datasetGrowthBytes = 1 << 26 // Dataset growth per epoch cacheInitBytes = 1 << 24 // Bytes in cache at genesis - cacheGrowthBytes = 1 << 20 // Cache growth per epoch + cacheGrowthBytes = 1 << 21 // Cache growth per epoch mixBytes = 128 // Width of mix hashBytes = 64 // Hash length in bytes hashWords = 16 // Number of 32 bit ints in a hash @@ -58,7 +58,7 @@ var ( // block number. func cacheSize(block uint64) uint64 { epoch := int(block / C_epochLength) - if epoch < maxEpoch { + if epoch < maxCachedEpoch { return cacheSizes[epoch] } return calcCacheSize(epoch) @@ -79,7 +79,7 @@ func calcCacheSize(epoch int) uint64 { // block number. func datasetSize(block uint64) uint64 { epoch := int(block / C_epochLength) - if epoch < maxEpoch { + if epoch < maxCachedEpoch { return datasetSizes[epoch] } return calcDatasetSize(epoch) @@ -462,308 +462,526 @@ func hashimotoFull(dataset []uint32, hash []byte, nonce uint64) ([]byte, []byte) return hashimoto(hash, nonce, uint64(len(dataset))*4, lookup) } -const maxEpoch = 1024 - -// datasetSizes is a lookup table for the ethash dataset size for the first 2048 -// epochs (i.e. 61440000 blocks). -var datasetSizes = [maxEpoch]uint64{ - 4294962304, 4328521088, 4362073472, 4395630208, 4429182848, 4462738048, 4496289664, - 4529846144, 4563402112, 4596957056, 4630511488, 4664065664, 4697620352, 4731173248, - 4764727936, 4798283648, 4831835776, 4865391488, 4898946944, 4932499328, 4966054784, - 4999607168, 5033164672, 5066717056, 5100273536, 5133827456, 5167382144, 5200936064, - 5234490496, 5268040832, 5301598592, 5335151488, 5368706944, 5402263424, 5435816576, - 5469367936, 5502925952, 5536481152, 5570032768, 5603585408, 5637143936, 5670694784, - 5704251008, 5737806208, 5771358592, 5804911232, 5838468992, 5872024448, 5905576832, - 5939132288, 5972688256, 6006241408, 6039796096, 6073351808, 6106906496, 6140459648, - 6174009728, 6207569792, 6241124224, 6274676864, 6308232064, 6341784704, 6375337856, - 6408895616, 6442444672, 6476004224, 6509555072, 6543112832, 6576662912, 6610219648, - 6643777408, 6677330048, 6710882176, 6744437632, 6777993856, 6811549312, 6845101696, - 6878655104, 6912212864, 6945764992, 6979317376, 7012875392, 7046427776, 7079980928, - 7113536896, 7147092352, 7180648064, 7214196608, 7247755904, 7281308032, 7314864512, - 7348419712, 7381973888, 7415528576, 7449080192, 7482635648, 7516192384, 7549745792, - 7583300992, 7616854912, 7650410368, 7683961984, 7717519232, 7751069056, 7784626816, - 7818179968, 7851732352, 7885287808, 7918844288, 7952400256, 7985953408, 8019508096, - 8053062272, 8086616704, 8120171392, 8153726848, 8187280768, 8220834176, 8254389376, - 8287944064, 8321497984, 8355052928, 8388606592, 8422161536, 8455715456, 8489270656, - 8522823808, 8556378752, 8589933952, 8623487872, 8657040256, 8690592128, 8724151424, - 8757704576, 8791260032, 8824812928, 8858366336, 8891923328, 8925478784, 8959032704, - 8992584064, 9026141312, 9059694208, 9093250688, 9126803584, 9160356224, 9193910144, - 9227465344, 9261021824, 9294574208, 9328131968, 9361685888, 9395239808, 9428795008, - 9462346624, 9495903616, 9529456256, 9563011456, 9596567168, 9630121856, 9663675776, - 9697230464, 9730772608, 9764338816, 9797892992, 9831439232, 9865000576, 9898556288, - 9932108672, 9965666176, 9999219584, 10032774016, 10066329472, 10099878784, 10133437312, - 10166991232, 10200545408, 10234099328, 10267656064, 10301209472, 10334763392, 10368318592, - 10401867136, 10435425664, 10468982144, 10502533504, 10536091264, 10569642368, 10603200128, - 10636754048, 10670307968, 10703863168, 10737414784, 10770971264, 10804525184, 10838078336, - 10871631488, 10905188992, 10938742912, 10972298368, 11005851776, 11039403904, 11072960896, - 11106514816, 11140065152, 11173624192, 11207179136, 11240734592, 11274285952, 11307842432, - 11341395584, 11374950016, 11408504192, 11442061184, 11475611776, 11509169024, 11542724224, - 11576277376, 11609830016, 11643387776, 11676940928, 11710496128, 11744050048, 11777604736, - 11811157888, 11844713344, 11878268032, 11911822976, 11945375872, 11978928512, 12012486272, - 12046039168, 12079594624, 12113147264, 12146703232, 12180255872, 12213811328, 12247365248, - 12280920448, 12314475392, 12348029312, 12381580928, 12415138432, 12448692352, 12482245504, - 12515801728, 12549354368, 12582911872, 12616463488, 12650019968, 12683574656, 12717128576, - 12750680192, 12784236928, 12817789312, 12851345792, 12884901248, 12918455168, 12952009856, - 12985563776, 13019115392, 13052673152, 13086227072, 13119782528, 13153329536, 13186884736, - 13220445824, 13254000512, 13287553408, 13321108096, 13354663808, 13388210816, 13421771392, - 13455326848, 13488875648, 13522435712, 13555989376, 13589544832, 13623097472, 13656652928, - 13690207616, 13723762048, 13757316224, 13790869376, 13824425344, 13857978752, 13891533184, - 13925085056, 13958643584, 13992197504, 14025752192, 14059301504, 14092852352, 14126407552, - 14159968384, 14193521024, 14227067264, 14260630144, 14294187904, 14327738752, 14361296512, - 14394848128, 14428402304, 14461959808, 14495511424, 14529064832, 14562618496, 14596172672, - 14629724288, 14663284864, 14696835968, 14730392192, 14763947648, 14797499776, 14831056256, - 14864612992, 14898165376, 14931721856, 14965276544, 14998830976, 15032385152, 15065939072, - 15099493504, 15133042304, 15166602368, 15200154496, 15233708416, 15267265408, 15300819584, - 15334374784, 15367929728, 15401481856, 15435037568, 15468589184, 15502146944, 15535699072, - 15569254528, 15602809472, 15636364928, 15669918848, 15703474048, 15737027456, 15770582656, - 15804132224, 15837691264, 15871244672, 15904799104, 15938354816, 15971907968, 16005460864, - 16039012736, 16072571264, 16106125184, 16139678848, 16173236096, 16206790528, 16240344704, - 16273898624, 16307449216, 16341006464, 16374561664, 16408116352, 16441668224, 16475224448, - 16508779648, 16542330752, 16575888512, 16609442944, 16642996096, 16676552576, 16710095488, - 16743661184, 16777214336, 16810768768, 16844323712, 16877876864, 16911431296, 16944987776, - 16978540928, 17012096896, 17045649536, 17079205504, 17112759424, 17146314368, 17179864192, - 17213423488, 17246976896, 17280530048, 17314085504, 17347640192, 17381190016, 17414748544, - 17448303232, 17481857408, 17515409024, 17548966016, 17582519168, 17616076672, 17649630848, - 17683178368, 17716739968, 17750293888, 17783848832, 17817402752, 17850955648, 17884511872, - 17918058112, 17951609216, 17985175424, 18018728576, 18052283264, 18085837184, 18119388544, - 18152947328, 18186498944, 18220048768, 18253610624, 18287163008, 18320717696, 18354269056, - 18387828352, 18421379456, 18454937216, 18488488576, 18522045056, 18555600512, 18589154432, - 18622708352, 18656262784, 18689814656, 18723370112, 18756927104, 18790481536, 18824034688, - 18857585792, 18891145088, 18924697216, 18958250368, 18991807616, 19025360768, 19058916992, - 19092468608, 19126026112, 19159578752, 19193133952, 19226688896, 19260243584, 19293797504, - 19327352192, 19360906624, 19394460544, 19428008576, 19461568384, 19495124864, 19528678784, - 19562226304, 19595787136, 19629339776, 19662895744, 19696450688, 19730003584, 19763557504, - 19797113216, 19830666368, 19864222592, 19897776512, 19931329408, 19964885888, 19998441088, - 20031993472, 20065547648, 20099103872, 20132657024, 20166212992, 20199764096, 20233319552, - 20266874752, 20300427904, 20333985664, 20367539072, 20401083776, 20434646912, 20468202112, - 20501757824, 20535312256, 20568861056, 20602420864, 20635966592, 20669528192, 20703082112, - 20736635776, 20770191488, 20803746944, 20837301376, 20870854016, 20904409984, 20937962624, - 20971515776, 21005074304, 21038626688, 21072181888, 21105736832, 21139292032, 21172845952, - 21206397568, 21239954816, 21273509248, 21307063168, 21340616576, 21374169728, 21407727232, - 21441281152, 21474829696, 21508386176, 21541944448, 21575499392, 21609052288, 21642607744, - 21676160384, 21709716352, 21743271808, 21776820608, 21810378112, 21843922816, 21877489024, - 21911040128, 21944597632, 21978150016, 22011704192, 22045260928, 22078815872, 22112365952, - 22145924224, 22179476864, 22213031552, 22246584704, 22280142208, 22313696128, 22347250048, - 22380804736, 22414359424, 22447913344, 22481468288, 22515023744, 22548574592, 22582132096, - 22615686272, 22649236096, 22682793856, 22716350336, 22749904768, 22783457408, 22817013376, - 22850564992, 22884118144, 22917670016, 22951228288, 22984783232, 23018338688, 23051892608, - 23085448832, 23119002496, 23152557184, 23186110592, 23219662208, 23253220736, 23286773632, - 23320330112, 23353881472, 23387437952, 23420992384, 23454541696, 23488101248, 23521647488, - 23555207296, 23588763776, 23622319744, 23655873664, 23689422464, 23722981504, 23756533376, - 23790088064, 23823644288, 23857201024, 23890754176, 23924309888, 23957861504, 23991416704, - 24024969856, 24058526848, 24092081792, 24125635712, 24159190912, 24192745088, 24226299008, - 24259847296, 24293406848, 24326961536, 24360517504, 24394070912, 24427624576, 24461180288, - 24494734976, 24528288896, 24561839488, 24595396736, 24628951936, 24662507392, 24696055424, - 24729612928, 24763170688, 24796724608, 24830273408, 24863829632, 24897387904, 24930942592, - 24964496512, 24998048384, 25031604608, 25065159296, 25098714752, 25132264576, 25165822592, - 25199377792, 25232930176, 25266486656, 25300034944, 25333596032, 25367149952, 25400699264, - 25434259072, 25467813248, 25501365632, 25534914688, 25568472448, 25602030208, 25635585152, - 25669140352, 25702692992, 25736249216, 25769799296, 25803356032, 25836910976, 25870464128, - 25904019584, 25937575808, 25971129728, 26004684416, 26038237312, 26071793536, 26105347456, - 26138900864, 26172456064, 26206009472, 26239565696, 26273118848, 26306672768, 26340227456, - 26373782912, 26407336832, 26440892288, 26474442112, 26508000128, 26541552256, 26575107968, - 26608660096, 26642217344, 26675771776, 26709327488, 26742882176, 26776432768, 26809990016, - 26843545472, 26877099904, 26910651776, 26944207232, 26977761152, 27011317376, 27044871296, - 27078424448, 27111978368, 27145534336, 27179086976, 27212642176, 27246196864, 27279749248, - 27313307264, 27346859648, 27380416384, 27413969536, 27447524224, 27481077376, 27514628224, - 27548181376, 27581742976, 27615297152, 27648844672, 27682406272, 27715959424, 27749510528, - 27783069568, 27816622976, 27850178432, 27883729024, 27917286272, 27950837632, 27984394624, - 28017947264, 28051501696, 28085057408, 28118612864, 28152163712, 28185721216, 28219274624, - 28252831616, 28286385536, 28319938432, 28353494144, 28387044736, 28420601984, 28454155904, - 28487709568, 28521263744, 28554821248, 28588364416, 28621927808, 28655484544, 28689036416, - 28722592384, 28756143232, 28789702016, 28823255936, 28856811136, 28890365824, 28923916928, - 28957473152, 28991026304, 29024583296, 29058137728, 29091689344, 29125245824, 29158800256, - 29192350592, 29225903744, 29259463808, 29293014656, 29326573184, 29360124544, 29393681024, - 29427236224, 29460790144, 29494344832, 29527897216, 29561454464, 29595008896, 29628563072, - 29662116992, 29695672192, 29729222272, 29762780288, 29796335488, 29829887872, 29863443328, - 29896998016, 29930551936, 29964105088, 29997660544, 30031210624, 30064769408, 30098324864, - 30131879552, 30165433472, 30198986624, 30232542848, 30266096768, 30299650688, 30333205888, - 30366760064, 30400314496, 30433864064, 30467419264, 30500978048, 30534532736, 30568079744, - 30601641856, 30635195264, 30668749952, 30702303872, 30735859328, 30769412224, 30802963328, - 30836521088, 30870077312, 30903630976, 30937184896, 30970735232, 31004294528, 31037847424, - 31071400576, 31104958336, 31138512256, 31172061056, 31205620352, 31239174784, 31272727936, - 31306283648, 31339838848, 31373393024, 31406947456, 31440502144, 31474050688, 31507610752, - 31541163392, 31574720384, 31608274304, 31641828992, 31675383424, 31708934528, 31742490496, - 31776046208, 31809600896, 31843154048, 31876701056, 31910263936, 31943818624, 31977372032, - 32010927232, 32044481408, 32078036608, 32111591296, 32145145216, 32178698624, 32212253056, - 32245806464, 32279362432, 32312908928, 32346472064, 32380022912, 32413577344, 32447134336, - 32480690048, 32514238336, 32547798656, 32581353344, 32614906496, 32648458624, 32682015616, - 32715569792, 32749121408, 32782673024, 32816233088, 32849788544, 32883336064, 32916894592, - 32950451584, 32984005504, 33017560448, 33051114368, 33084669824, 33118216832, 33151776128, - 33185329792, 33218886784, 33252437888, 33285996416, 33319550848, 33353105024, 33386655616, - 33420212864, 33453768064, 33487316608, 33520875904, 33554429056, 33587982976, 33621538432, - 33655094912, 33688648064, 33722203264, 33755758208, 33789312896, 33822866816, 33856421504, - 33889965952, 33923523968, 33957081472, 33990633856, 34024191616, 34057746304, 34091302016, - 34124853376, 34158403712, 34191965824, 34225510784, 34259073664, 34292624512, 34326181504, - 34359731072, 34393291904, 34426845568, 34460395136, 34493953664, 34527508864, 34561063808, - 34594616192, 34628170112, 34661727616, 34695281024, 34728835712, 34762385792, 34795942528, - 34829497984, 34863053696, 34896609152, 34930163584, 34963716992, 34997272192, 35030824832, - 35064377984, 35097934208, 35131489408, 35165043328, 35198598784, 35232151424, 35265701248, - 35299259264, 35332813696, 35366362496, 35399925632, 35433476224, 35467032704, 35500588672, - 35534141312, 35567694464, 35601250688, 35634802048, 35668356736, 35701915264, 35735469184, - 35769023872, 35802577024, 35836133248, 35869681024, 35903239552, 35936796032, 35970337664, - 36003905408, 36037457536, 36071014016, 36104567936, 36138123136, 36171675776, 36205228672, - 36238786432, 36272340352, 36305893504, 36339448448, 36373003904, 36406558336, 36440110976, - 36473666176, 36507220352, 36540775552, 36574328704, 36607882112, 36641437568, 36674991488, - 36708546944, 36742102912, 36775654016, 36809209984, 36842763904, 36876320128, 36909872768, - 36943428992, 36976980608, 37010536064, 37044089728, 37077645952, 37111198336, 37144750208, - 37178308736, 37211857792, 37245418624, 37278972032, 37312528256, 37346080384, 37379634304, - 37413187712, 37446745472, 37480298368, 37513849216, 37547408512, 37580961664, 37614517888, - 37648066432, 37681626496, 37715179648, 37748735872, 37782290048, 37815843712, 37849391488, - 37882950016, 37916499584, 37950061696, 37983614848, 38017171072, 38050725248, 38084279936, - 38117829248, 38151387776, 38184938368, 38218497664, 38252051072, 38285604736, 38319160448, - 38352715136, 38386269056, 38419824512, 38453378176, 38486926208, 38520486272, 38554041728, - 38587596416, 38621146496, +const maxCachedEpoch = 1024 + +// datasetSizes is a lookup table for the ethash dataset size for the +// first maxCachedEpoch epochs +var datasetSizes = [maxCachedEpoch]uint64{ + 4294962304, 4362073472, 4429182848, 4496289664, + 4563402112, 4630511488, 4697620352, 4764727936, + 4831835776, 4898946944, 4966054784, 5033164672, + 5100273536, 5167382144, 5234490496, 5301598592, + 5368706944, 5435816576, 5502925952, 5570032768, + 5637143936, 5704251008, 5771358592, 5838468992, + 5905576832, 5972688256, 6039796096, 6106906496, + 6174009728, 6241124224, 6308232064, 6375337856, + 6442444672, 6509555072, 6576662912, 6643777408, + 6710882176, 6777993856, 6845101696, 6912212864, + 6979317376, 7046427776, 7113536896, 7180648064, + 7247755904, 7314864512, 7381973888, 7449080192, + 7516192384, 7583300992, 7650410368, 7717519232, + 7784626816, 7851732352, 7918844288, 7985953408, + 8053062272, 8120171392, 8187280768, 8254389376, + 8321497984, 8388606592, 8455715456, 8522823808, + 8589933952, 8657040256, 8724151424, 8791260032, + 8858366336, 8925478784, 8992584064, 9059694208, + 9126803584, 9193910144, 9261021824, 9328131968, + 9395239808, 9462346624, 9529456256, 9596567168, + 9663675776, 9730772608, 9797892992, 9865000576, + 9932108672, 9999219584, 10066329472, 10133437312, + 10200545408, 10267656064, 10334763392, 10401867136, + 10468982144, 10536091264, 10603200128, 10670307968, + 10737414784, 10804525184, 10871631488, 10938742912, + 11005851776, 11072960896, 11140065152, 11207179136, + 11274285952, 11341395584, 11408504192, 11475611776, + 11542724224, 11609830016, 11676940928, 11744050048, + 11811157888, 11878268032, 11945375872, 12012486272, + 12079594624, 12146703232, 12213811328, 12280920448, + 12348029312, 12415138432, 12482245504, 12549354368, + 12616463488, 12683574656, 12750680192, 12817789312, + 12884901248, 12952009856, 13019115392, 13086227072, + 13153329536, 13220445824, 13287553408, 13354663808, + 13421771392, 13488875648, 13555989376, 13623097472, + 13690207616, 13757316224, 13824425344, 13891533184, + 13958643584, 14025752192, 14092852352, 14159968384, + 14227067264, 14294187904, 14361296512, 14428402304, + 14495511424, 14562618496, 14629724288, 14696835968, + 14763947648, 14831056256, 14898165376, 14965276544, + 15032385152, 15099493504, 15166602368, 15233708416, + 15300819584, 15367929728, 15435037568, 15502146944, + 15569254528, 15636364928, 15703474048, 15770582656, + 15837691264, 15904799104, 15971907968, 16039012736, + 16106125184, 16173236096, 16240344704, 16307449216, + 16374561664, 16441668224, 16508779648, 16575888512, + 16642996096, 16710095488, 16777214336, 16844323712, + 16911431296, 16978540928, 17045649536, 17112759424, + 17179864192, 17246976896, 17314085504, 17381190016, + 17448303232, 17515409024, 17582519168, 17649630848, + 17716739968, 17783848832, 17850955648, 17918058112, + 17985175424, 18052283264, 18119388544, 18186498944, + 18253610624, 18320717696, 18387828352, 18454937216, + 18522045056, 18589154432, 18656262784, 18723370112, + 18790481536, 18857585792, 18924697216, 18991807616, + 19058916992, 19126026112, 19193133952, 19260243584, + 19327352192, 19394460544, 19461568384, 19528678784, + 19595787136, 19662895744, 19730003584, 19797113216, + 19864222592, 19931329408, 19998441088, 20065547648, + 20132657024, 20199764096, 20266874752, 20333985664, + 20401083776, 20468202112, 20535312256, 20602420864, + 20669528192, 20736635776, 20803746944, 20870854016, + 20937962624, 21005074304, 21072181888, 21139292032, + 21206397568, 21273509248, 21340616576, 21407727232, + 21474829696, 21541944448, 21609052288, 21676160384, + 21743271808, 21810378112, 21877489024, 21944597632, + 22011704192, 22078815872, 22145924224, 22213031552, + 22280142208, 22347250048, 22414359424, 22481468288, + 22548574592, 22615686272, 22682793856, 22749904768, + 22817013376, 22884118144, 22951228288, 23018338688, + 23085448832, 23152557184, 23219662208, 23286773632, + 23353881472, 23420992384, 23488101248, 23555207296, + 23622319744, 23689422464, 23756533376, 23823644288, + 23890754176, 23957861504, 24024969856, 24092081792, + 24159190912, 24226299008, 24293406848, 24360517504, + 24427624576, 24494734976, 24561839488, 24628951936, + 24696055424, 24763170688, 24830273408, 24897387904, + 24964496512, 25031604608, 25098714752, 25165822592, + 25232930176, 25300034944, 25367149952, 25434259072, + 25501365632, 25568472448, 25635585152, 25702692992, + 25769799296, 25836910976, 25904019584, 25971129728, + 26038237312, 26105347456, 26172456064, 26239565696, + 26306672768, 26373782912, 26440892288, 26508000128, + 26575107968, 26642217344, 26709327488, 26776432768, + 26843545472, 26910651776, 26977761152, 27044871296, + 27111978368, 27179086976, 27246196864, 27313307264, + 27380416384, 27447524224, 27514628224, 27581742976, + 27648844672, 27715959424, 27783069568, 27850178432, + 27917286272, 27984394624, 28051501696, 28118612864, + 28185721216, 28252831616, 28319938432, 28387044736, + 28454155904, 28521263744, 28588364416, 28655484544, + 28722592384, 28789702016, 28856811136, 28923916928, + 28991026304, 29058137728, 29125245824, 29192350592, + 29259463808, 29326573184, 29393681024, 29460790144, + 29527897216, 29595008896, 29662116992, 29729222272, + 29796335488, 29863443328, 29930551936, 29997660544, + 30064769408, 30131879552, 30198986624, 30266096768, + 30333205888, 30400314496, 30467419264, 30534532736, + 30601641856, 30668749952, 30735859328, 30802963328, + 30870077312, 30937184896, 31004294528, 31071400576, + 31138512256, 31205620352, 31272727936, 31339838848, + 31406947456, 31474050688, 31541163392, 31608274304, + 31675383424, 31742490496, 31809600896, 31876701056, + 31943818624, 32010927232, 32078036608, 32145145216, + 32212253056, 32279362432, 32346472064, 32413577344, + 32480690048, 32547798656, 32614906496, 32682015616, + 32749121408, 32816233088, 32883336064, 32950451584, + 33017560448, 33084669824, 33151776128, 33218886784, + 33285996416, 33353105024, 33420212864, 33487316608, + 33554429056, 33621538432, 33688648064, 33755758208, + 33822866816, 33889965952, 33957081472, 34024191616, + 34091302016, 34158403712, 34225510784, 34292624512, + 34359731072, 34426845568, 34493953664, 34561063808, + 34628170112, 34695281024, 34762385792, 34829497984, + 34896609152, 34963716992, 35030824832, 35097934208, + 35165043328, 35232151424, 35299259264, 35366362496, + 35433476224, 35500588672, 35567694464, 35634802048, + 35701915264, 35769023872, 35836133248, 35903239552, + 35970337664, 36037457536, 36104567936, 36171675776, + 36238786432, 36305893504, 36373003904, 36440110976, + 36507220352, 36574328704, 36641437568, 36708546944, + 36775654016, 36842763904, 36909872768, 36976980608, + 37044089728, 37111198336, 37178308736, 37245418624, + 37312528256, 37379634304, 37446745472, 37513849216, + 37580961664, 37648066432, 37715179648, 37782290048, + 37849391488, 37916499584, 37983614848, 38050725248, + 38117829248, 38184938368, 38252051072, 38319160448, + 38386269056, 38453378176, 38520486272, 38587596416, + 38654704768, 38721804416, 38788922752, 38856032128, + 38923139456, 38990248832, 39057356672, 39124465024, + 39191576192, 39258680704, 39325791104, 39392900224, + 39460010368, 39527118976, 39594226816, 39661337984, + 39728447104, 39795553664, 39862663552, 39929770624, + 39996882304, 40063990144, 40131098752, 40198200704, + 40265318272, 40332427136, 40399531904, 40466644864, + 40533753472, 40600860544, 40667970944, 40735078016, + 40802187904, 40869298048, 40936403072, 41003513984, + 41070624128, 41137733248, 41204839552, 41271948416, + 41339059072, 41406168704, 41473277056, 41540384384, + 41607495296, 41674596736, 41741711744, 41808819328, + 41875928704, 41943039616, 42010145152, 42077257088, + 42144364928, 42211472768, 42278582656, 42345691264, + 42412798592, 42479910272, 42547019392, 42614125952, + 42681235328, 42748343936, 42815453312, 42882561664, + 42949670528, 43016779648, 43083889792, 43150999168, + 43218104192, 43285216384, 43352319104, 43419432064, + 43486542976, 43553651584, 43620757888, 43687869824, + 43754978944, 43822086272, 43889196928, 43956301952, + 44023414144, 44090521472, 44157630848, 44224736384, + 44291848576, 44358956672, 44426062976, 44493176704, + 44560285568, 44627394176, 44694499712, 44761611392, + 44828716672, 44895829376, 44962936192, 45030045056, + 45097155968, 45164265088, 45231371392, 45298481024, + 45365588864, 45432697984, 45499806848, 45566916224, + 45634024064, 45701132416, 45768244352, 45835352704, + 45902461312, 45969571712, 46036679552, 46103788672, + 46170897536, 46238006912, 46305108352, 46372221824, + 46439333504, 46506439808, 46573549952, 46640653952, + 46707769216, 46774877056, 46841985664, 46909090432, + 46976204672, 47043312256, 47110420096, 47177529472, + 47244634496, 47311748992, 47378856832, 47445964928, + 47513073536, 47580182912, 47647291264, 47714394752, + 47781510272, 47848614784, 47915727232, 47982836864, + 48049942912, 48117053056, 48184161152, 48251269504, + 48318379904, 48385488512, 48452599168, 48519704704, + 48586815616, 48653924992, 48721035136, 48788142976, + 48855252608, 48922361216, 48989470592, 49056577664, + 49123687552, 49190797184, 49257905792, 49325014912, + 49392118912, 49459232128, 49526340224, 49593450112, + 49660555904, 49727666816, 49794775424, 49861885312, + 49928994176, 49996103552, 50063211136, 50130318976, + 50197430144, 50264538496, 50331646592, 50398754176, + 50465864576, 50532972928, 50600083328, 50667191936, + 50734297984, 50801402752, 50868515968, 50935627648, + 51002733952, 51069844096, 51136951168, 51204061312, + 51271171712, 51338273408, 51405388928, 51472498048, + 51539605888, 51606713728, 51673819264, 51740931712, + 51808041856, 51875149952, 51942255488, 52009367936, + 52076477312, 52143584384, 52210696064, 52277800576, + 52344912512, 52412019584, 52479129728, 52546239104, + 52613346176, 52680451456, 52747566464, 52814675072, + 52881784192, 52948885888, 53015996288, 53083104128, + 53150218624, 53217329024, 53284436096, 53351545472, + 53418651008, 53485759616, 53552872064, 53619979136, + 53687089024, 53754199936, 53821308544, 53888417152, + 53955526528, 54022632064, 54089739136, 54156850816, + 54223958144, 54291068288, 54358178944, 54425288576, + 54492395648, 54559505536, 54626604416, 54693716864, + 54760832128, 54827938432, 54895050368, 54962156416, + 55029263488, 55096376704, 55163483264, 55230594688, + 55297701248, 55364811904, 55431918208, 55499028352, + 55566139264, 55633247104, 55700355712, 55767463552, + 55834574464, 55901679488, 55968788608, 56035897472, + 56103009152, 56170118272, 56237224832, 56304336512, + 56371441792, 56438552704, 56505659776, 56572769152, + 56639877248, 56706988928, 56774090624, 56841204608, + 56908314752, 56975423872, 57042534272, 57109642624, + 57176751488, 57243860864, 57310969472, 57378077824, + 57445186432, 57512295296, 57579401344, 57646511744, + 57713620352, 57780730496, 57847840384, 57914948992, + 57982057856, 58049166976, 58116274816, 58183384192, + 58250493824, 58317598336, 58384710016, 58451819648, + 58518928768, 58586035328, 58653145984, 58720254848, + 58787362432, 58854466432, 58921581184, 58988689024, + 59055799168, 59122908032, 59190017408, 59257126784, + 59324233856, 59391344512, 59458452608, 59525561728, + 59592671104, 59659777664, 59726888576, 59793996928, + 59861106304, 59928214912, 59995324288, 60062432384, + 60129541504, 60196641152, 60263758976, 60330868352, + 60397975168, 60465084032, 60532189568, 60599302528, + 60666411392, 60733519744, 60800630144, 60867736192, + 60934846592, 61001954432, 61069066112, 61136171648, + 61203282304, 61270392448, 61337497472, 61404609152, + 61471717504, 61538827648, 61605932672, 61673045888, + 61740154496, 61807259264, 61874371712, 61941479296, + 62008590208, 62075695232, 62142805376, 62209907072, + 62277024896, 62344134016, 62411239808, 62478350464, + 62545456768, 62612569216, 62679676288, 62746786688, + 62813896576, 62881005184, 62948114048, 63015219328, + 63082327936, 63149439616, 63216547712, 63283651712, + 63350765696, 63417871744, 63484983424, 63552090752, + 63619202176, 63686307968, 63753417856, 63820528768, + 63887636864, 63954747008, 64021855616, 64088964736, + 64156069504, 64223181184, 64290291584, 64357400192, + 64424508032, 64491614848, 64558724224, 64625835392, + 64692942976, 64760052608, 64827160448, 64894269824, + 64961372032, 65028487808, 65095597184, 65162701696, + 65229812864, 65296924544, 65364032128, 65431139968, + 65498248832, 65565354368, 65632468864, 65699576192, + 65766685312, 65833794688, 65900899712, 65968011136, + 66035120512, 66102226304, 66169338496, 66236448128, + 66303554432, 66370666112, 66437774464, 66504875648, + 66571989376, 66639100288, 66706207616, 66773319296, + 66840427904, 66907534976, 66974645632, 67041747328, + 67108863616, 67175972224, 67243080832, 67310188672, + 67377282176, 67444405376, 67511516032, 67578622336, + 67645729664, 67712835712, 67779948416, 67847059328, + 67914168704, 67981278592, 68048381312, 68115496576, + 68182603904, 68249714048, 68316821632, 68383927424, + 68451036032, 68518150016, 68585253248, 68652365696, + 68719476352, 68786585216, 68853688448, 68920801408, + 68987909504, 69055019648, 69122129792, 69189236608, + 69256345472, 69323453824, 69390564736, 69457665664, + 69524781184, 69591891328, 69658999936, 69726109568, + 69793215104, 69860323712, 69927435904, 69994544512, + 70061653888, 70128762752, 70195870336, 70262979968, + 70330086784, 70397197952, 70464305536, 70531414144, + 70598524544, 70665633152, 70732741504, 70799847296, + 70866957184, 70934067328, 71001177472, 71068286336, + 71135395712, 71202501248, 71269612928, 71336719232, + 71403826304, 71470937984, 71538047872, 71605155968, + 71672262784, 71739374464, 71806476416, 71873592704, + 71940696704, 72007810432, 72074919296, 72142027136, + 72209133952, 72276244864, 72343355008, 72410463872, + 72477570688, 72544678784, 72611790208, 72678899584, + 72746008448, 72813112192, 72880224128, 72947333248, } // cacheSizes is a lookup table for the ethash verification cache size for the -// first 2048 epochs (i.e. 61440000 blocks). -var cacheSizes = [maxEpoch]uint64{ - 16776896, 17824192, 18874304, 19922752, 20971072, 22019392, 23068096, - 24116672, 25165376, 26214208, 27262528, 28311488, 29359808, 30406976, - 31456192, 32505664, 33554368, 34600256, 35650624, 36699968, 37747904, - 38795584, 39844928, 40894144, 41942848, 42991552, 44039104, 45088448, - 46136768, 47185856, 48234176, 49283008, 50331584, 51379904, 52427968, - 53475776, 54525248, 55574336, 56621888, 57671104, 58720192, 59768512, - 60817216, 61865792, 62910784, 63960896, 65009216, 66060224, 67108672, - 68157248, 69205568, 70253888, 71303104, 72350144, 73400128, 74448832, - 75497024, 76545856, 77593664, 78642496, 79690816, 80740288, 81786304, - 82835776, 83886016, 84934336, 85982656, 87031744, 88079168, 89128384, - 90177088, 91223744, 92273344, 93322816, 94371776, 95420224, 96468544, - 97517248, 98565568, 99614272, 100662592, 101711296, 102760384, 103808576, - 104854592, 105903296, 106954304, 108003136, 109049792, 110099648, 111148864, - 112196416, 113244224, 114294592, 115343296, 116391488, 117440192, 118489024, - 119537344, 120584512, 121634752, 122682944, 123731264, 124778048, 125829056, - 126876608, 127925696, 128973632, 130023104, 131071552, 132120256, 133168832, - 134217152, 135265472, 136313792, 137363392, 138411584, 139460032, 140508352, - 141556544, 142606144, 143653696, 144701888, 145751488, 146800448, 147848768, - 148897088, 149943616, 150993088, 152042944, 153091648, 154139968, 155188928, - 156237376, 157284416, 158334656, 159381568, 160430656, 161480512, 162529216, - 163577408, 164625856, 165674944, 166722496, 167771584, 168819136, 169866304, - 170917696, 171966272, 173014208, 174063424, 175109696, 176159936, 177209152, - 178257472, 179305024, 180354752, 181402688, 182451904, 183494848, 184548928, - 185596352, 186645952, 187693504, 188743616, 189791936, 190840768, 191888192, - 192937792, 193985984, 195035072, 196083392, 197130688, 198180544, 199228352, - 200276672, 201326144, 202374464, 203423296, 204472256, 205517632, 206569024, - 207616832, 208666048, 209715136, 210763712, 211812032, 212860352, 213909184, - 214956992, 216005312, 217054528, 218102848, 219151936, 220200128, 221249216, - 222297536, 223345984, 224394944, 225443776, 226491712, 227539904, 228588736, - 229636928, 230684864, 231733952, 232782272, 233830592, 234880832, 235928768, - 236976448, 238026688, 239075008, 240122816, 241171904, 242220224, 243268672, - 244316608, 245365312, 246415168, 247463872, 248512064, 249560512, 250608704, - 251657792, 252706624, 253754432, 254803264, 255851072, 256900544, 257949632, - 258996544, 260045888, 261092672, 262143424, 263191744, 264241088, 265287488, - 266337728, 267386432, 268435264, 269482688, 270531904, 271580992, 272629568, - 273677632, 274726208, 275775296, 276822976, 277868608, 278921152, 279969728, - 281018176, 282066496, 283115072, 284163136, 285211712, 286260928, 287308352, - 288358208, 289406528, 290453312, 291504064, 292550848, 293600192, 294649664, - 295698112, 296746816, 297794624, 298843456, 299891776, 300941248, 301989056, - 303036736, 304086976, 305131072, 306182848, 307231168, 308280512, 309329344, - 310377664, 311427008, 312475456, 313524032, 314570944, 315619904, 316669376, - 317717824, 318766528, 319815616, 320862656, 321909568, 322960576, 324009536, - 325058368, 326105792, 327154624, 328201792, 329252416, 330301376, 331349696, - 332398016, 333446336, 334495424, 335544128, 336592832, 337640896, 338689984, - 339736256, 340786496, 341835328, 342883648, 343931584, 344980928, 346030016, - 347076544, 348126656, 349175488, 350223296, 351270848, 352321472, 353369152, - 354418496, 355466816, 356514112, 357564352, 358610624, 359661376, 360708928, - 361758016, 362805056, 363855424, 364904128, 365950528, 366998848, 368047808, - 369096256, 370147264, 371195584, 372243392, 373291456, 374341568, 375389888, - 376437184, 377485376, 378534976, 379581632, 380633024, 381681472, 382729664, - 383778496, 384825536, 385875136, 386923456, 387971392, 389020864, 390067648, - 391118656, 392166976, 393215936, 394264384, 395311808, 396360512, 397409728, - 398458688, 399504832, 400555328, 401603392, 402652736, 403701184, 404750272, - 405798208, 406846912, 407895232, 408943936, 409991872, 411041216, 412090304, - 413136832, 414187328, 415233472, 416282816, 417333184, 418381504, 419428928, - 420478144, 421526848, 422575168, 423623104, 424672832, 425718848, 426769472, - 427818176, 428866496, 429915712, 430964672, 432012992, 433061312, 434110016, - 435157952, 436207424, 437254592, 438304576, 439352384, 440401216, 441450176, - 442497344, 443547584, 444596032, 445644736, 446693056, 447741248, 448789568, - 449838016, 450887104, 451936064, 452984512, 454032064, 455081408, 456130496, - 457178944, 458227136, 459275584, 460324672, 461372864, 462420928, 463470272, - 464518976, 465567296, 466615232, 467663296, 468713408, 469760576, 470810176, - 471856192, 472907584, 473955008, 475003072, 476053184, 477100864, 478150336, - 479196992, 480247616, 481294144, 482344768, 483393088, 484440896, 485490496, - 486537664, 487587136, 488635712, 489682496, 490733504, 491781824, 492830656, - 493878208, 494926912, 495975104, 497024576, 498072128, 499122112, 500170432, - 501217088, 502267328, 503315264, 504364352, 505412032, 506461888, 507509312, - 508558912, 509606848, 510654784, 511705024, 512752832, 513801664, 514849856, - 515897024, 516945344, 517996096, 519042752, 520092992, 521141696, 522190016, - 523236928, 524287424, 525336512, 526384832, 527433152, 528481984, 529529536, - 530579008, 531627968, 532676416, 533724992, 534772928, 535822016, 536869952, - 537918016, 538960064, 540014912, 541065152, 542112448, 543161792, 544210496, - 545257408, 546306752, 547356352, 548404672, 549453376, 550501568, 551548736, - 552598976, 553646528, 554695744, 555745088, 556793152, 557842112, 558889792, - 559939136, 560987968, 562035008, 563084864, 564132928, 565181504, 566230976, - 567276992, 568326848, 569376448, 570424768, 571472192, 572522432, 573570496, - 574616384, 575665984, 576715712, 577763776, 578813888, 579862336, 580910912, - 581958976, 583006912, 584056768, 585102656, 586153664, 587202368, 588251072, - 589298368, 590348224, 591393472, 592445248, 593492672, 594538432, 595590208, - 596639552, 597687232, 598735936, 599784256, 600833984, 601881536, 602930752, - 603979456, 605027776, 606076096, 607125184, 608172608, 609220672, 610270016, - 611317568, 612366016, 613416896, 614464832, 615511744, 616562368, 617610944, - 618659264, 619706816, 620756672, 621805376, 622853824, 623902016, 624951232, - 625999168, 627046592, 628095808, 629145152, 630193856, 631241536, 632289344, - 633336896, 634388032, 635436352, 636484928, 637533632, 638581696, 639630272, - 640677952, 641726656, 642774464, 643824704, 644874176, 645922496, 646971328, - 648019648, 649066688, 650117056, 651165248, 652212928, 653262656, 654309952, - 655359296, 656407616, 657457088, 658505024, 659553344, 660602816, 661650368, - 662698688, 663747776, 664795328, 665845696, 666893888, 667942592, 668990272, - 670039232, 671088064, 672137152, 673185728, 674233792, 675280832, 676331456, - 677379904, 678428096, 679477184, 680524352, 681573952, 682622912, 683669696, - 684718784, 685768256, 686816576, 687865792, 688909504, 689962304, 691011392, - 692059072, 693107264, 694156352, 695205824, 696253504, 697302976, 698350784, - 699398464, 700448704, 701496896, 702544576, 703592768, 704642368, 705691072, - 706740032, 707787968, 708836672, 709885376, 710934208, 711982784, 713031232, - 714079936, 715127872, 716177216, 717225536, 718273984, 719322944, 720370624, - 721419584, 722468288, 723517376, 724565056, 725614528, 726662336, 727708736, - 728760128, 729807808, 730856512, 731905472, 732953792, 734003008, 735050048, - 736099648, 737148736, 738197056, 739246016, 740294336, 741341632, 742391488, - 743440064, 744488768, 745537472, 746585792, 747633856, 748682944, 749730496, - 750779584, 751828288, 752877248, 753925184, 754974016, 756022336, 757070528, - 758119616, 759168832, 760216768, 761265088, 762312128, 763363264, 764411456, - 765459776, 766508992, 767557312, 768606016, 769652672, 770700608, 771751744, - 772800064, 773848384, 774896576, 775946048, 776994752, 778041536, 779091392, - 780139328, 781187648, 782237504, 783285952, 784334528, 785383232, 786431936, - 787479872, 788528192, 789576512, 790626112, 791674816, 792723136, 793771456, - 794820032, 795867584, 796915648, 797962688, 799014592, 800063296, 801109696, - 802160192, 803207872, 804256576, 805305152, 806350784, 807401792, 808451648, - 809500096, 810549056, 811597376, 812645056, 813693376, 814743232, 815791168, - 816840512, 817886912, 818936128, 819983552, 821034304, 822082112, 823131328, - 824179648, 825228608, 826277824, 827325248, 828372928, 829419328, 830471744, - 831520064, 832568512, 833617088, 834666304, 835713856, 836763328, 837810752, - 838860608, 839908928, 840956608, 842005568, 843054656, 844101824, 845150528, - 846200384, 847248832, 848297536, 849346496, 850393408, 851443136, 852492224, - 853540544, 854589376, 855637312, 856684736, 857734336, 858782656, 859830592, - 860880448, 861929408, 862977088, 864023872, 865074368, 866122304, 867171776, - 868217408, 869267008, 870318016, 871366336, 872414528, 873463616, 874512064, - 875560768, 876609472, 877657408, 878706112, 879754432, 880803136, 881851456, - 882899648, 883947968, 884997952, 886046144, 887094976, 888142912, 889191232, - 890240192, 891289024, 892338112, 893386432, 894434624, 895483712, 896531648, - 897578944, 898629568, 899677888, 900726592, 901775296, 902823616, 903872192, - 904919104, 905968832, 907016384, 908065856, 909115072, 910163776, 911211584, - 912260672, 913309504, 914355776, 915406144, 916454464, 917501632, 918551488, - 919600832, 920648896, 921697856, 922744384, 923795008, 924842816, 925889344, - 926939968, 927989696, 929038016, 930086336, 931134656, 932183488, 933232448, - 934280128, 935328448, 936378176, 937425472, 938474176, 939524032, 940572608, - 941619904, 942669248, 943715776, 944765504, 945815488, 946862656, 947912512, - 948960704, 950009792, 951058112, 952106048, 953155136, 954203456, 955252544, - 956300608, 957348416, 958395584, 959446336, 960494272, 961544128, 962591296, - 963639616, 964689728, 965737664, 966786752, 967834432, 968882752, 969930688, - 970978496, 972028352, 973078336, 974124992, 975175232, 976224064, 977271616, - 978321088, 979369408, 980418368, 981466048, 982515008, 983564096, 984612544, - 985660864, 986709952, 987758528, 988806848, 989853632, 990903104, 991950016, - 993000256, 994046528, 995096384, 996147136, 997195712, 998243776, 999292864, - 1000340032, 1001388224, 1002437312, 1003486912, 1004534848, 1005584192, 1006631104, - 1007680832, 1008730048, 1009778368, 1010826944, 1011875008, 1012923712, 1013971136, - 1015019968, 1016068288, 1017116992, 1018165952, 1019215424, 1020263488, 1021312832, - 1022360128, 1023409984, 1024457792, 1025507008, 1026554944, 1027604288, 1028652224, - 1029700928, 1030749376, 1031798336, 1032846784, 1033894976, 1034944448, 1035990976, - 1037041472, 1038089152, 1039138624, 1040186816, 1041235904, 1042282816, 1043332672, - 1044381376, 1045429696, 1046477888, 1047526336, 1048574528, 1049624512, 1050672704, - 1051721408, 1052769856, 1053817792, 1054865984, 1055915072, 1056964288, 1058012992, - 1059061568, 1060108352, 1061157568, 1062206272, 1063254208, 1064302528, 1065350336, - 1066401088, 1067449664, 1068497728, 1069546304, 1070594752, 1071644608, 1072691392, - 1073741632, 1074789952, 1075838656, 1076886592, 1077936064, 1078983232, 1080032192, - 1081080256, 1082128832, 1083177152, 1084227392, 1085276096, 1086321088, 1087371328, - 1088418368, 1089469504, +// first maxCachedEpoch epochs +var cacheSizes = [maxCachedEpoch]uint64{ + 16776896, 18874304, 20971072, 23068096, + 25165376, 27262528, 29359808, 31456192, + 33554368, 35650624, 37747904, 39844928, + 41942848, 44039104, 46136768, 48234176, + 50331584, 52427968, 54525248, 56621888, + 58720192, 60817216, 62910784, 65009216, + 67108672, 69205568, 71303104, 73400128, + 75497024, 77593664, 79690816, 81786304, + 83886016, 85982656, 88079168, 90177088, + 92273344, 94371776, 96468544, 98565568, + 100662592, 102760384, 104854592, 106954304, + 109049792, 111148864, 113244224, 115343296, + 117440192, 119537344, 121634752, 123731264, + 125829056, 127925696, 130023104, 132120256, + 134217152, 136313792, 138411584, 140508352, + 142606144, 144701888, 146800448, 148897088, + 150993088, 153091648, 155188928, 157284416, + 159381568, 161480512, 163577408, 165674944, + 167771584, 169866304, 171966272, 174063424, + 176159936, 178257472, 180354752, 182451904, + 184548928, 186645952, 188743616, 190840768, + 192937792, 195035072, 197130688, 199228352, + 201326144, 203423296, 205517632, 207616832, + 209715136, 211812032, 213909184, 216005312, + 218102848, 220200128, 222297536, 224394944, + 226491712, 228588736, 230684864, 232782272, + 234880832, 236976448, 239075008, 241171904, + 243268672, 245365312, 247463872, 249560512, + 251657792, 253754432, 255851072, 257949632, + 260045888, 262143424, 264241088, 266337728, + 268435264, 270531904, 272629568, 274726208, + 276822976, 278921152, 281018176, 283115072, + 285211712, 287308352, 289406528, 291504064, + 293600192, 295698112, 297794624, 299891776, + 301989056, 304086976, 306182848, 308280512, + 310377664, 312475456, 314570944, 316669376, + 318766528, 320862656, 322960576, 325058368, + 327154624, 329252416, 331349696, 333446336, + 335544128, 337640896, 339736256, 341835328, + 343931584, 346030016, 348126656, 350223296, + 352321472, 354418496, 356514112, 358610624, + 360708928, 362805056, 364904128, 366998848, + 369096256, 371195584, 373291456, 375389888, + 377485376, 379581632, 381681472, 383778496, + 385875136, 387971392, 390067648, 392166976, + 394264384, 396360512, 398458688, 400555328, + 402652736, 404750272, 406846912, 408943936, + 411041216, 413136832, 415233472, 417333184, + 419428928, 421526848, 423623104, 425718848, + 427818176, 429915712, 432012992, 434110016, + 436207424, 438304576, 440401216, 442497344, + 444596032, 446693056, 448789568, 450887104, + 452984512, 455081408, 457178944, 459275584, + 461372864, 463470272, 465567296, 467663296, + 469760576, 471856192, 473955008, 476053184, + 478150336, 480247616, 482344768, 484440896, + 486537664, 488635712, 490733504, 492830656, + 494926912, 497024576, 499122112, 501217088, + 503315264, 505412032, 507509312, 509606848, + 511705024, 513801664, 515897024, 517996096, + 520092992, 522190016, 524287424, 526384832, + 528481984, 530579008, 532676416, 534772928, + 536869952, 538960064, 541065152, 543161792, + 545257408, 547356352, 549453376, 551548736, + 553646528, 555745088, 557842112, 559939136, + 562035008, 564132928, 566230976, 568326848, + 570424768, 572522432, 574616384, 576715712, + 578813888, 580910912, 583006912, 585102656, + 587202368, 589298368, 591393472, 593492672, + 595590208, 597687232, 599784256, 601881536, + 603979456, 606076096, 608172608, 610270016, + 612366016, 614464832, 616562368, 618659264, + 620756672, 622853824, 624951232, 627046592, + 629145152, 631241536, 633336896, 635436352, + 637533632, 639630272, 641726656, 643824704, + 645922496, 648019648, 650117056, 652212928, + 654309952, 656407616, 658505024, 660602816, + 662698688, 664795328, 666893888, 668990272, + 671088064, 673185728, 675280832, 677379904, + 679477184, 681573952, 683669696, 685768256, + 687865792, 689962304, 692059072, 694156352, + 696253504, 698350784, 700448704, 702544576, + 704642368, 706740032, 708836672, 710934208, + 713031232, 715127872, 717225536, 719322944, + 721419584, 723517376, 725614528, 727708736, + 729807808, 731905472, 734003008, 736099648, + 738197056, 740294336, 742391488, 744488768, + 746585792, 748682944, 750779584, 752877248, + 754974016, 757070528, 759168832, 761265088, + 763363264, 765459776, 767557312, 769652672, + 771751744, 773848384, 775946048, 778041536, + 780139328, 782237504, 784334528, 786431936, + 788528192, 790626112, 792723136, 794820032, + 796915648, 799014592, 801109696, 803207872, + 805305152, 807401792, 809500096, 811597376, + 813693376, 815791168, 817886912, 819983552, + 822082112, 824179648, 826277824, 828372928, + 830471744, 832568512, 834666304, 836763328, + 838860608, 840956608, 843054656, 845150528, + 847248832, 849346496, 851443136, 853540544, + 855637312, 857734336, 859830592, 861929408, + 864023872, 866122304, 868217408, 870318016, + 872414528, 874512064, 876609472, 878706112, + 880803136, 882899648, 884997952, 887094976, + 889191232, 891289024, 893386432, 895483712, + 897578944, 899677888, 901775296, 903872192, + 905968832, 908065856, 910163776, 912260672, + 914355776, 916454464, 918551488, 920648896, + 922744384, 924842816, 926939968, 929038016, + 931134656, 933232448, 935328448, 937425472, + 939524032, 941619904, 943715776, 945815488, + 947912512, 950009792, 952106048, 954203456, + 956300608, 958395584, 960494272, 962591296, + 964689728, 966786752, 968882752, 970978496, + 973078336, 975175232, 977271616, 979369408, + 981466048, 983564096, 985660864, 987758528, + 989853632, 991950016, 994046528, 996147136, + 998243776, 1000340032, 1002437312, 1004534848, + 1006631104, 1008730048, 1010826944, 1012923712, + 1015019968, 1017116992, 1019215424, 1021312832, + 1023409984, 1025507008, 1027604288, 1029700928, + 1031798336, 1033894976, 1035990976, 1038089152, + 1040186816, 1042282816, 1044381376, 1046477888, + 1048574528, 1050672704, 1052769856, 1054865984, + 1056964288, 1059061568, 1061157568, 1063254208, + 1065350336, 1067449664, 1069546304, 1071644608, + 1073741632, 1075838656, 1077936064, 1080032192, + 1082128832, 1084227392, 1086321088, 1088418368, + 1090517696, 1092615872, 1094713024, 1096810432, + 1098907456, 1101000256, 1103101504, 1105197248, + 1107293632, 1109390272, 1111489856, 1113587648, + 1115683904, 1117781696, 1119879104, 1121976256, + 1124072512, 1126170176, 1128263872, 1130364608, + 1132461376, 1134558272, 1136656064, 1138753472, + 1140850624, 1142947136, 1145043136, 1147141312, + 1149238336, 1151336128, 1153433536, 1155530176, + 1157625536, 1159724096, 1161819584, 1163916736, + 1166016064, 1168113472, 1170210112, 1172307776, + 1174404032, 1176501952, 1178598208, 1180695104, + 1182790208, 1184890688, 1186983488, 1189084352, + 1191181504, 1193279168, 1195374272, 1197473344, + 1199569984, 1201666112, 1203765184, 1205859136, + 1207959488, 1210056256, 1212153664, 1214250304, + 1216347712, 1218444736, 1220542144, 1222637632, + 1224736192, 1226833472, 1228930624, 1231027904, + 1233123904, 1235221952, 1237318592, 1239416768, + 1241513408, 1243610432, 1245707072, 1247805376, + 1249901888, 1251998912, 1254095936, 1256193856, + 1258291136, 1260387904, 1262485184, 1264582208, + 1266679616, 1268776384, 1270871744, 1272970304, + 1275067072, 1277165504, 1279262528, 1281358912, + 1283456704, 1285553344, 1287650752, 1289748032, + 1291843264, 1293941696, 1296036928, 1298137024, + 1300233664, 1302330944, 1304428096, 1306524224, + 1308620224, 1310719936, 1312815808, 1314913984, + 1317011008, 1319107648, 1321203776, 1323301696, + 1325398208, 1327494976, 1329594176, 1331688256, + 1333787456, 1335885248, 1337982656, 1340080064, + 1342176448, 1344273472, 1346369344, 1348466624, + 1350565312, 1352662336, 1354759232, 1356855488, + 1358953664, 1361050304, 1363146688, 1365245632, + 1367342528, 1369440064, 1371536576, 1373633984, + 1375731008, 1377827392, 1379925824, 1382022848, + 1384116416, 1386217024, 1388312768, 1390411712, + 1392508864, 1394605504, 1396700992, 1398800192, + 1400897216, 1402993472, 1405091008, 1407187136, + 1409285824, 1411381696, 1413479744, 1415577536, + 1417674688, 1419768512, 1421867072, 1423965632, + 1426060736, 1428160192, 1430257216, 1432353344, + 1434450496, 1436549056, 1438643392, 1440742976, + 1442838464, 1444937152, 1447034816, 1449131968, + 1451225792, 1453326272, 1455421504, 1457519552, + 1459617344, 1461712832, 1463811392, 1465907648, + 1468005824, 1470102464, 1472200384, 1474293952, + 1476394688, 1478492096, 1480588864, 1482684352, + 1484782784, 1486879936, 1488975808, 1491074752, + 1493169472, 1495269184, 1497365696, 1499463488, + 1501560128, 1503657664, 1505754176, 1507852096, + 1509947968, 1512044992, 1514143552, 1516240448, + 1518337984, 1520434624, 1522531904, 1524628288, + 1526726464, 1528822336, 1530918848, 1533016768, + 1535114176, 1537211968, 1539307712, 1541406656, + 1543501888, 1545600064, 1547697472, 1549794368, + 1551891136, 1553988544, 1556086592, 1558182848, + 1560281024, 1562377664, 1564472384, 1566570688, + 1568669632, 1570766656, 1572862528, 1574959808, + 1577054656, 1579153216, 1581252544, 1583347648, + 1585446592, 1587543872, 1589640128, 1591735232, + 1593834688, 1595931328, 1598028352, 1600126784, + 1602222784, 1604320064, 1606418368, 1608515264, + 1610612032, 1612709312, 1614806464, 1616903872, + 1619001152, 1621098176, 1623195584, 1625291456, + 1627389248, 1629486784, 1631582912, 1633681216, + 1635778112, 1637875136, 1639972288, 1642069696, + 1644166208, 1646264128, 1648359616, 1650457408, + 1652555456, 1654652096, 1656750016, 1658846912, + 1660943552, 1663041472, 1665136576, 1667235008, + 1669329472, 1671429184, 1673526592, 1675623616, + 1677720256, 1679817536, 1681913536, 1684011584, + 1686110144, 1688204864, 1690304192, 1692400448, + 1694498752, 1696594112, 1698692288, 1700787008, + 1702887104, 1704984256, 1707081536, 1709178176, + 1711275968, 1713372736, 1715468992, 1717566784, + 1719664192, 1721761472, 1723857088, 1725954112, + 1728052288, 1730149952, 1732246976, 1734344384, + 1736441792, 1738535488, 1740634432, 1742732864, + 1744827584, 1746927296, 1749024448, 1751121728, + 1753217216, 1755315776, 1757413184, 1759510208, + 1761606976, 1763704256, 1765801792, 1767894592, + 1769993536, 1772092864, 1774190144, 1776286784, + 1778381632, 1780481344, 1782578624, 1784676032, + 1786772672, 1788870592, 1790967232, 1793064512, + 1795162048, 1797258304, 1799356352, 1801453504, + 1803549376, 1805646016, 1807744192, 1809841984, + 1811938624, 1814036416, 1816132928, 1818229312, + 1820323264, 1822424512, 1824521792, 1826618944, + 1828715072, 1830813632, 1832910784, 1835007296, + 1837103936, 1839201856, 1841298752, 1843395776, + 1845492416, 1847590592, 1849683904, 1851784768, + 1853882176, 1855978688, 1858076224, 1860170944, + 1862270528, 1864366528, 1866462784, 1868560832, + 1870659008, 1872755648, 1874853184, 1876950848, + 1879045568, 1881144896, 1883240768, 1885338304, + 1887436352, 1889533504, 1891630016, 1893727936, + 1895825216, 1897918912, 1900018112, 1902113216, + 1904213824, 1906309952, 1908407744, 1910502208, + 1912602304, 1914698944, 1916796352, 1918891328, + 1920990784, 1923088064, 1925185216, 1927279168, + 1929377984, 1931476928, 1933573952, 1935671104, + 1937768128, 1939865024, 1941960256, 1944059456, + 1946156864, 1948253248, 1950351296, 1952445632, + 1954543936, 1956639424, 1958739392, 1960836928, + 1962934208, 1965027776, 1967128256, 1969224896, + 1971322688, 1973418176, 1975516096, 1977612352, + 1979711168, 1981807936, 1983904576, 1986001088, + 1988100032, 1990196288, 1992294208, 1994391104, + 1996487488, 1998585536, 2000681792, 2002780096, + 2004875584, 2006971712, 2009070656, 2011166656, + 2013265216, 2015361472, 2017455808, 2019556544, + 2021654464, 2023750208, 2025847744, 2027945792, + 2030042176, 2032140224, 2034236224, 2036334016, + 2038431424, 2040527296, 2042624704, 2044722112, + 2046820288, 2048917184, 2051014208, 2053110848, + 2055206848, 2057305792, 2059402816, 2061500096, + 2063597248, 2065693888, 2067791552, 2069888192, + 2071985984, 2074083136, 2076180416, 2078276672, + 2080373056, 2082471616, 2084567872, 2086664768, + 2088762944, 2090858944, 2092956352, 2095052992, + 2097151808, 2099247424, 2101345984, 2103443392, + 2105538368, 2107636288, 2109731776, 2111830976, + 2113927744, 2116025792, 2118123328, 2120219072, + 2122316864, 2124414784, 2126511424, 2128609088, + 2130706112, 2132801728, 2134899904, 2136996416, + 2139092416, 2141191232, 2143289024, 2145385408, + 2147481152, 2149579072, 2151674816, 2153774528, + 2155871552, 2157968704, 2160065216, 2162161472, } diff --git a/consensus/progpow/progpow.go b/consensus/progpow/progpow.go index d85ef0977b..2c989ed7f5 100644 --- a/consensus/progpow/progpow.go +++ b/consensus/progpow/progpow.go @@ -340,7 +340,7 @@ func (lru *lru) get(epoch uint64) (item, future interface{}) { lru.cache.Add(epoch, item) } // Update the 'future item' if epoch is larger than previously seen. - if epoch < maxEpoch-1 && lru.future < epoch+1 { + if epoch < maxCachedEpoch-1 && lru.future < epoch+1 { lru.logger.WithField("epoch", epoch+1).Trace("Requiring new future ethash " + lru.what) future = lru.new(epoch + 1) lru.future = epoch + 1 diff --git a/consensus/progpow/progpow_test.go b/consensus/progpow/progpow_test.go new file mode 100644 index 0000000000..8c01ebe99e --- /dev/null +++ b/consensus/progpow/progpow_test.go @@ -0,0 +1,43 @@ +package progpow + +import ( + "fmt" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestProgpowDatasetSizes(t *testing.T) { + for epoch := 0; epoch < maxCachedEpoch; epoch++ { + require.Equal(t, calcDatasetSize(epoch), datasetSizes[epoch], "failed epoch %d", epoch) + } +} + +func TestProgpowCacheSizes(t *testing.T) { + for epoch := 0; epoch < maxCachedEpoch; epoch++ { + require.Equal(t, calcCacheSize(epoch), cacheSizes[epoch]) + } +} + +func printSizes0(calcFunc func(epoch int) uint64, maxEpoch int, groupSize int, varName string) { + var results []string + + for epoch := 0; epoch < maxEpoch; epoch++ { + numberToBePrinted := calcFunc(epoch) + results = append(results, fmt.Sprintf("%d", numberToBePrinted)) + } + + // Print the formatted output + fmt.Printf("var %s = [%d]uint64{\n", varName, maxEpoch) + + for i := 0; i < len(results); i += groupSize { // Group by `groupSize` + end := i + groupSize + if end > len(results) { + end = len(results) + } + fmt.Printf("\t%s,\n", strings.Join(results[i:end], ", ")) + } + + fmt.Println("}") +}