@@ -9,8 +9,9 @@ import org.scalatest.flatspec.AnyFlatSpec
9
9
import org .scalatest .matchers .should .Matchers
10
10
11
11
import scala .annotation .tailrec
12
+ import io .iohk .ethereum .SuperSlow
12
13
13
- class EthashUtilsSpec extends AnyFlatSpec with Matchers with ScalaCheckPropertyChecks {
14
+ class EthashUtilsSpec extends AnyFlatSpec with Matchers with ScalaCheckPropertyChecks with SuperSlow {
14
15
15
16
import io .iohk .ethereum .consensus .ethash .EthashUtils ._
16
17
@@ -61,77 +62,79 @@ class EthashUtilsSpec extends AnyFlatSpec with Matchers with ScalaCheckPropertyC
61
62
proofOfWork.mixHash shouldBe ByteString (mixHash)
62
63
proofOfWork.difficultyBoundary shouldBe ByteString (boundary)
63
64
64
- val table = Table (
65
- (" blockNumber" , " hashWithoutNonce" , " nonce" , " mixHash" ),
66
- (
67
- 3521 ,
68
- " 269d13f7ca546dced28ee26071dcb61085b7c54dfc5f93808b94885e136cd616" ,
69
- " 534ab630b9aa1f68" ,
70
- " c6913517d1dc7544febde9f17e65d6ae4fa380d4a2a2d31305b0043caf95e717"
71
- ),
72
- (
73
- 5021 ,
74
- " 7bd6c3c49a0627712c51f1abf0a7828bb25ebb8679d2584385a191db955667da" ,
75
- " 413dc4ec1a0df7c4" ,
76
- " 35890608f8867402052b2ce55a694b86a44ce87e7fb5412a77a025b184f25883"
77
- ),
78
- (
79
- 5091 ,
80
- " 5b27820bfa3a059274ce17db0beea90ba0b6fbe6b49d2a23cbf972e8cde79319" ,
81
- " 59225875d18ad606" ,
82
- " 46f72f8b269461078e9d1cf4edf1b608f9d101e0f335ea59568c3436f291d01b"
83
- ),
84
- (
85
- 3091 ,
86
- " c37d980124cf83a4de4d9600f5bb6d3883797b84b7ec472feff6ca855c01d245" ,
87
- " 745609efa9c4eef3" ,
88
- " c647fec06481b9f3f74cd771968d6d630aa11bf75ebd9e3c55ccfbae0fbad4da"
89
- ),
90
- (
91
- 1091 ,
92
- " c1c1efb8fdd4241a55db39e092fedae3df6d4abc13133778810027ade6557bc6" ,
93
- " 4d9ddadaea6c20b2" ,
94
- " 53624a7faac2ec82208348f7a11e3b38c880a2fec76dd8b47e434fe641eeacde"
95
- ),
96
- (
97
- 109 ,
98
- " aa234d4bcee14e93d127275dcc83504b6e730a14e9110bd09b68e1964f0daad3" ,
99
- " 388e6b37c22147b7" ,
100
- " df14701b1ad6d3d5639956e463250960de3189a726cb38d71a6f6042f45dea72"
101
- ),
102
- (
103
- 1009 ,
104
- " 3259779f9d2c477d29e18ead0ccc829bf2146723563c3e81e5e4886673d93bfb" ,
105
- " 5faa044b70ccdf6b" ,
106
- " a1f1af0c2ca3e1d8e69da59fefbfeb4d0d172ec96bdbdac71b2cde49ddb3a828"
107
- ),
108
- (
109
- 1001 ,
110
- " 028cc9a70d6db52c2a2606f04392e9a323d0370291d6c6d78bc8ce54acf1d761" ,
111
- " a54b5b31ce3de766" ,
112
- " 819c26573f1a9cd6c4b9a399b72fbfb0084a104b25b62083533e114ee98a4831"
113
- ),
114
- (
115
- 1000 ,
116
- " 15c5729eb017a703c13d00752338f6b55e2d2551b380706f0486f2ccca57ae1e" ,
117
- " eb610e766452a801" ,
118
- " a369e2fd5c4e357cf9f60ba063ae0baf32075b0d7ed80cd78134bc401db8f1bf"
119
- ),
120
- (
121
- 100 ,
122
- " 41944a94a42695180b1ca231720a87825f17d36475112b659c23dea1542e0977" ,
123
- " 37129c7f29a9364b" ,
124
- " 5bb43c0772e58084b221c8e0c859a45950c103c712c5b8f11d9566ee078a4501"
65
+ superSlow { // skip extra test cases on CI as it is super slow there
66
+ val table = Table (
67
+ (" blockNumber" , " hashWithoutNonce" , " nonce" , " mixHash" ),
68
+ (
69
+ 3521 ,
70
+ " 269d13f7ca546dced28ee26071dcb61085b7c54dfc5f93808b94885e136cd616" ,
71
+ " 534ab630b9aa1f68" ,
72
+ " c6913517d1dc7544febde9f17e65d6ae4fa380d4a2a2d31305b0043caf95e717"
73
+ ),
74
+ (
75
+ 5021 ,
76
+ " 7bd6c3c49a0627712c51f1abf0a7828bb25ebb8679d2584385a191db955667da" ,
77
+ " 413dc4ec1a0df7c4" ,
78
+ " 35890608f8867402052b2ce55a694b86a44ce87e7fb5412a77a025b184f25883"
79
+ ),
80
+ (
81
+ 5091 ,
82
+ " 5b27820bfa3a059274ce17db0beea90ba0b6fbe6b49d2a23cbf972e8cde79319" ,
83
+ " 59225875d18ad606" ,
84
+ " 46f72f8b269461078e9d1cf4edf1b608f9d101e0f335ea59568c3436f291d01b"
85
+ ),
86
+ (
87
+ 3091 ,
88
+ " c37d980124cf83a4de4d9600f5bb6d3883797b84b7ec472feff6ca855c01d245" ,
89
+ " 745609efa9c4eef3" ,
90
+ " c647fec06481b9f3f74cd771968d6d630aa11bf75ebd9e3c55ccfbae0fbad4da"
91
+ ),
92
+ (
93
+ 1091 ,
94
+ " c1c1efb8fdd4241a55db39e092fedae3df6d4abc13133778810027ade6557bc6" ,
95
+ " 4d9ddadaea6c20b2" ,
96
+ " 53624a7faac2ec82208348f7a11e3b38c880a2fec76dd8b47e434fe641eeacde"
97
+ ),
98
+ (
99
+ 109 ,
100
+ " aa234d4bcee14e93d127275dcc83504b6e730a14e9110bd09b68e1964f0daad3" ,
101
+ " 388e6b37c22147b7" ,
102
+ " df14701b1ad6d3d5639956e463250960de3189a726cb38d71a6f6042f45dea72"
103
+ ),
104
+ (
105
+ 1009 ,
106
+ " 3259779f9d2c477d29e18ead0ccc829bf2146723563c3e81e5e4886673d93bfb" ,
107
+ " 5faa044b70ccdf6b" ,
108
+ " a1f1af0c2ca3e1d8e69da59fefbfeb4d0d172ec96bdbdac71b2cde49ddb3a828"
109
+ ),
110
+ (
111
+ 1001 ,
112
+ " 028cc9a70d6db52c2a2606f04392e9a323d0370291d6c6d78bc8ce54acf1d761" ,
113
+ " a54b5b31ce3de766" ,
114
+ " 819c26573f1a9cd6c4b9a399b72fbfb0084a104b25b62083533e114ee98a4831"
115
+ ),
116
+ (
117
+ 1000 ,
118
+ " 15c5729eb017a703c13d00752338f6b55e2d2551b380706f0486f2ccca57ae1e" ,
119
+ " eb610e766452a801" ,
120
+ " a369e2fd5c4e357cf9f60ba063ae0baf32075b0d7ed80cd78134bc401db8f1bf"
121
+ ),
122
+ (
123
+ 100 ,
124
+ " 41944a94a42695180b1ca231720a87825f17d36475112b659c23dea1542e0977" ,
125
+ " 37129c7f29a9364b" ,
126
+ " 5bb43c0772e58084b221c8e0c859a45950c103c712c5b8f11d9566ee078a4501"
127
+ )
125
128
)
126
- )
127
129
128
- forAll(table) { (blockNumber, hashWithoutNonce, nonce, mixHash) =>
129
- val _epoch = epoch(blockNumber, ecip1099forkBlockNumber)
130
- val _seed = seed(blockNumber)
131
- val cache = makeCache(_epoch, _seed)
132
- val proofOfWork =
133
- hashimotoLight(Hex .decode(hashWithoutNonce), Hex .decode(nonce), dagSize(_epoch), cache)
134
- proofOfWork.mixHash shouldBe ByteString (Hex .decode(mixHash))
130
+ forAll(table) { (blockNumber, hashWithoutNonce, nonce, mixHash) =>
131
+ val _epoch = epoch(blockNumber, ecip1099forkBlockNumber)
132
+ val _seed = seed(blockNumber)
133
+ val cache = makeCache(_epoch, _seed)
134
+ val proofOfWork =
135
+ hashimotoLight(Hex .decode(hashWithoutNonce), Hex .decode(nonce), dagSize(_epoch), cache)
136
+ proofOfWork.mixHash shouldBe ByteString (Hex .decode(mixHash))
137
+ }
135
138
}
136
139
}
137
140
0 commit comments