Skip to content

Commit

Permalink
progpow: implement v0.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
EtherCoreAdmin authored and holiman committed Oct 5, 2020
1 parent 74bcf0b commit 523f284
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 43 deletions.
6 changes: 3 additions & 3 deletions consensus/ethash/progpow.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ const (
progpowLanes = 16 // The number of parallel lanes that coordinate to calculate a single hash instance.
progpowRegs = 32 // The register file usage size
progpowDagLoads = 4 // Number of uint32 loads from the DAG per lane
progpowCntCache = 12
progpowCntMath = 20
progpowPeriodLength = 50 // Blocks per progpow epoch (N)
progpowCntCache = 11
progpowCntMath = 18
progpowPeriodLength = 10 // Blocks per progpow epoch (N)
progpowCntDag = loopAccesses // Number of DAG accesses, same as ethash (64)
progpowMixBytes = 2 * mixBytes
)
Expand Down
8 changes: 4 additions & 4 deletions consensus/ethash/progpow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ func TestProgpowChanges(t *testing.T) {
mixHash, finalHash, _ := hashForBlock(blocknum, nonce, headerHash)
fmt.Printf("mixHash %x\n", mixHash)
fmt.Printf("finalHash %x\n", finalHash)
expMix := common.FromHex("11f19805c58ab46610ff9c719dcf0a5f18fa2f1605798eef770c47219274767d")
expHash := common.FromHex("5b7ccd472dbefdd95b895cac8ece67ff0deb5a6bd2ecc6e162383d00c3728ece")
expMix := common.FromHex("6018c151b0f9895ebe44a4ca6ce2829e5ba6ae1a68a4ccd05a67ac01219655c1")
expHash := common.FromHex("34d8436444aa5c61761ce0bcce0f11401df2eace77f5c14ba7039b86b5800c08")
if !bytes.Equal(expMix, mixHash) {
t.Errorf("mixhash err, expected %x, got %x", expMix, mixHash)
}
Expand Down Expand Up @@ -220,8 +220,8 @@ func speedyHashForBlock(ctx *periodContext, blocknum uint64, nonce uint64, heade

func TestProgpowHash(t *testing.T) {
mixHash, finalHash, _ := hashForBlock(0, 0, common.Hash{})
expHash := common.FromHex("63155f732f2bf556967f906155b510c917e48e99685ead76ea83f4eca03ab12b")
expMix := common.FromHex("faeb1be51075b03a4ff44b335067951ead07a3b078539ace76fd56fc410557a3")
expHash := common.FromHex("b3bad9ca6f7c566cf0377d1f8cce29d6516a96562c122d924626281ec948ef02")
expMix := common.FromHex("f4ac202715ded4136e72887c39e63a4738331c57fd9eb79f6ec421c281aa8743")
if !bytes.Equal(mixHash, expMix) {
t.Errorf("mixhash err, got %x expected %x", mixHash, expMix)
}
Expand Down
72 changes: 36 additions & 36 deletions consensus/ethash/testdata/progpow_testvectors.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
[
[0, "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000",
"faeb1be51075b03a4ff44b335067951ead07a3b078539ace76fd56fc410557a3",
"63155f732f2bf556967f906155b510c917e48e99685ead76ea83f4eca03ab12b"],
[49, "63155f732f2bf556967f906155b510c917e48e99685ead76ea83f4eca03ab12b", "0000000006ff2c47",
"c789c1180f890ec555ff42042913465481e8e6bc512cb981e1c1108dc3f2227d",
"9e7248f20914913a73d80a70174c331b1d34f260535ac3631d770e656b5dd922"],
[50, "9e7248f20914913a73d80a70174c331b1d34f260535ac3631d770e656b5dd922", "00000000076e482e",
"c7340542c2a06b3a7dc7222635f7cd402abf8b528ae971ddac6bbe2b0c7cb518",
"de37e1824c86d35d154cf65a88de6d9286aec4f7f10c3fc9f0fa1bcc2687188d"],
[99, "de37e1824c86d35d154cf65a88de6d9286aec4f7f10c3fc9f0fa1bcc2687188d", "000000003917afab",
"f5e60b2c5bfddd136167a30cbc3c8dbdbd15a512257dee7964e0bc6daa9f8ba7",
"ac7b55e801511b77e11d52e9599206101550144525b5679f2dab19386f23dcce"],
[29950, "ac7b55e801511b77e11d52e9599206101550144525b5679f2dab19386f23dcce", "005d409dbc23a62a",
"07393d15805eb08ee6fc6cb3ad4ad1010533bd0ff92d6006850246829f18fd6e",
"e43d7e0bdc8a4a3f6e291a5ed790b9fa1a0948a2b9e33c844888690847de19f5"],
[29999, "e43d7e0bdc8a4a3f6e291a5ed790b9fa1a0948a2b9e33c844888690847de19f5", "005db5fa4c2a3d03",
"7551bddf977491da2f6cfc1679299544b23483e8f8ee0931c4c16a796558a0b8",
"d34519f72c97cae8892c277776259db3320820cb5279a299d0ef1e155e5c6454"],
[30000, "d34519f72c97cae8892c277776259db3320820cb5279a299d0ef1e155e5c6454", "005db8607994ff30",
"f1c2c7c32266af9635462e6ce1c98ebe4e7e3ecab7a38aaabfbf2e731e0fbff4",
"8b6ce5da0b06d18db7bd8492d9e5717f8b53e7e098d9fef7886d58a6e913ef64"],
[30049, "8b6ce5da0b06d18db7bd8492d9e5717f8b53e7e098d9fef7886d58a6e913ef64", "005e2e215a8ca2e7",
"57fe6a9fbf920b4e91deeb66cb0efa971e08229d1a160330e08da54af0689add",
"c2c46173481b9ced61123d2e293b42ede5a1b323210eb2a684df0874ffe09047"],
[30050, "c2c46173481b9ced61123d2e293b42ede5a1b323210eb2a684df0874ffe09047", "005e30899481055e",
"ba30c61cc5a2c74a5ecaf505965140a08f24a296d687e78720f0b48baf712f2d",
"ea42197eb2ba79c63cb5e655b8b1f612c5f08aae1a49ff236795a3516d87bc71"],
[30099, "ea42197eb2ba79c63cb5e655b8b1f612c5f08aae1a49ff236795a3516d87bc71", "005ea6aef136f88b",
"cfd5e46048cd133d40f261fe8704e51d3f497fc14203ac6a9ef6a0841780b1cd",
"49e15ba4bf501ce8fe8876101c808e24c69a859be15de554bf85dbc095491bd6"],
[59950, "49e15ba4bf501ce8fe8876101c808e24c69a859be15de554bf85dbc095491bd6", "02ebe0503bd7b1da",
"21511fbaa31fb9f5fc4998a754e97b3083a866f4de86fa7500a633346f56d773",
"f5c50ba5c0d6210ddb16250ec3efda178de857b2b1703d8d5403bd0f848e19cf"],
[59999, "f5c50ba5c0d6210ddb16250ec3efda178de857b2b1703d8d5403bd0f848e19cf", "02edb6275bd221e3",
"653eda37d337e39d311d22be9bbd3458d3abee4e643bee4a7280a6d08106ef98",
"341562d10d4afb706ec2c8d5537cb0c810de02b4ebb0a0eea5ae335af6fb2e88"]
]
"f4ac202715ded4136e72887c39e63a4738331c57fd9eb79f6ec421c281aa8743",
"b3bad9ca6f7c566cf0377d1f8cce29d6516a96562c122d924626281ec948ef02"],
[49, "b3bad9ca6f7c566cf0377d1f8cce29d6516a96562c122d924626281ec948ef02", "0000000006ff2c47",
"7730596f128f675ef9a6bb7281f268e4077d302f2b9078da1ece4349248561dd",
"0b9ed0c11157f1365143e329a6e1cea4248d9d6cb44b9c6daf492c7a076654a4"],
[50, "0b9ed0c11157f1365143e329a6e1cea4248d9d6cb44b9c6daf492c7a076654a4", "00000000076e482e",
"829136d4a704eb8d06da773f1a90466e7b5ed12119c44526f045bbff4475d891",
"e2e881c5b893c2f1ef06b96a10cfcbcf7255b307f0818e7d30eb12b2edfc237b"],
[99, "e2e881c5b893c2f1ef06b96a10cfcbcf7255b307f0818e7d30eb12b2edfc237b", "000000003917afab",
"deb3d8b45bdc596c56aa37a5eba456f478c82e60e5c028ce95f2e654e4bb7b57",
"9bdc2ad2286eaa051d6ca1f5196d2dd1c9a039f1d7ce3e1c856b793deed01778"],
[29950, "9bdc2ad2286eaa051d6ca1f5196d2dd1c9a039f1d7ce3e1c856b793deed01778", "005d409dbc23a62a",
"c01e6d339cc687c77f653b81c74cb9de8b595554f2c5db671a7dde3846d2fa01",
"de0d693e597cf2fd70a4cfaa73f6baafc29e1eee695a81295b278c1116580b72"],
[29999, "de0d693e597cf2fd70a4cfaa73f6baafc29e1eee695a81295b278c1116580b72", "005db5fa4c2a3d03",
"8b664cdbf396a7a185446c93dddd6611f5a736b11097381ae6bea45e802cec16",
"21ec5d1984a4fd4394b042aa96365085225d964727a45def245ceab326e28128"],
[30000, "21ec5d1984a4fd4394b042aa96365085225d964727a45def245ceab326e28128", "005db8607994ff30",
"276951d89c1ed262bcac00df4fb9bf7af36991532744a2e287b0b758a56e15aa",
"dc070b76cc311cd82267f98936acbbbd3ec1c1ab25b55e2c885af6474e1e6841"],
[30049, "dc070b76cc311cd82267f98936acbbbd3ec1c1ab25b55e2c885af6474e1e6841", "005e2e215a8ca2e7",
"6248ba0157d0f0592dacfe2963337948fffb37f67e7451a6862c1321d894cebe",
"6fdecf719e2547f585a6ee807d8237db8e9489f63d3f259ab5236451eaded433"],
[30050, "6fdecf719e2547f585a6ee807d8237db8e9489f63d3f259ab5236451eaded433", "005e30899481055e",
"512d8f2bb0441fcfa1764c67e8dbed2afcbe9141de4bbebc5b51e0661dede550",
"cb1587a1c372642cbd9ce4c1ba2f433985d44c571a676a032bc1e8c1ad066e24"],
[30099, "cb1587a1c372642cbd9ce4c1ba2f433985d44c571a676a032bc1e8c1ad066e24", "005ea6aef136f88b",
"be0e7d6afa6edd483ccc304afa9bf0abaca5e0f037a4f05bf5550b9309d1d12c",
"78be18f20569a834d839dad48e0e51d6df6b6537575f0ad29898c7cf357f12cb"],
[59950, "78be18f20569a834d839dad48e0e51d6df6b6537575f0ad29898c7cf357f12cb", "02ebe0503bd7b1da",
"b85be51fce670aa437f28c02ea4fd7995fa8b6ac224e959b8dbfb5bdbc6f77ce",
"a68a620ba17e0cf2817bc4397cf4b85f5770983aa7b7931319a7f61bd6f905b1"],
[59999, "a68a620ba17e0cf2817bc4397cf4b85f5770983aa7b7931319a7f61bd6f905b1", "02edb6275bd221e3",
"ffe745a932c21c0704291bb416fe8bffec76621cd3434861885beab42cec1734",
"9e6667a151ac6f5186a05cb20877a2b3df02317046256a762cb8ec2d96aa34f0"]
]

0 comments on commit 523f284

Please sign in to comment.