Update ethash Godep (again)
This commit is contained in:
		
							parent
							
								
									a9d6846f92
								
							
						
					
					
						commit
						be303ba186
					
				
							
								
								
									
										4
									
								
								Godeps/Godeps.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								Godeps/Godeps.json
									
									
									
										generated
									
									
									
								
							| @ -21,8 +21,8 @@ | |||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			"ImportPath": "github.com/ethereum/ethash", | 			"ImportPath": "github.com/ethereum/ethash", | ||||||
| 			"Comment": "v23.1-222-g5cfdcba", | 			"Comment": "v23.1-222-g173b8ff", | ||||||
| 			"Rev": "5cfdcba92e634db228d1ddb140e3b7a3c4b38177" | 			"Rev": "173b8ff953610c13710061e83b95b50c73d7ea50" | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			"ImportPath": "github.com/howeyc/fsnotify", | 			"ImportPath": "github.com/howeyc/fsnotify", | ||||||
|  | |||||||
							
								
								
									
										3
									
								
								Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -8,7 +8,6 @@ int ethashGoCallback_cgo(unsigned); | |||||||
| import "C" | import "C" | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"bytes" |  | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
| @ -122,7 +121,7 @@ func (l *Light) Verify(block pow.Block) bool { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// avoid mixdigest malleability as it's not included in a block's "hashNononce"
 | 	// avoid mixdigest malleability as it's not included in a block's "hashNononce"
 | ||||||
| 	if !bytes.Equal(block.MixDigest().Bytes(), C.GoBytes(unsafe.Pointer(&ret.mix_hash), C.int(32))) { | 	if block.MixDigest() != h256ToHash(ret.mix_hash) { | ||||||
| 		return false | 		return false | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										28
									
								
								Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -39,6 +39,7 @@ var validBlocks = []*testBlock{ | |||||||
| 		hashNoNonce: common.HexToHash("372eca2454ead349c3df0ab5d00b0b706b23e49d469387db91811cee0358fc6d"), | 		hashNoNonce: common.HexToHash("372eca2454ead349c3df0ab5d00b0b706b23e49d469387db91811cee0358fc6d"), | ||||||
| 		difficulty:  big.NewInt(132416), | 		difficulty:  big.NewInt(132416), | ||||||
| 		nonce:       0x495732e0ed7a801c, | 		nonce:       0x495732e0ed7a801c, | ||||||
|  | 		mixDigest:   common.HexToHash("2f74cdeb198af0b9abe65d22d372e22fb2d474371774a9583c1cc427a07939f5"), | ||||||
| 	}, | 	}, | ||||||
| 	// from proof of concept nine testnet, epoch 1
 | 	// from proof of concept nine testnet, epoch 1
 | ||||||
| 	{ | 	{ | ||||||
| @ -46,6 +47,7 @@ var validBlocks = []*testBlock{ | |||||||
| 		hashNoNonce: common.HexToHash("7e44356ee3441623bc72a683fd3708fdf75e971bbe294f33e539eedad4b92b34"), | 		hashNoNonce: common.HexToHash("7e44356ee3441623bc72a683fd3708fdf75e971bbe294f33e539eedad4b92b34"), | ||||||
| 		difficulty:  big.NewInt(1532671), | 		difficulty:  big.NewInt(1532671), | ||||||
| 		nonce:       0x318df1c8adef7e5e, | 		nonce:       0x318df1c8adef7e5e, | ||||||
|  | 		mixDigest:   common.HexToHash("144b180aad09ae3c81fb07be92c8e6351b5646dda80e6844ae1b697e55ddde84"), | ||||||
| 	}, | 	}, | ||||||
| 	// from proof of concept nine testnet, epoch 2
 | 	// from proof of concept nine testnet, epoch 2
 | ||||||
| 	{ | 	{ | ||||||
| @ -53,6 +55,7 @@ var validBlocks = []*testBlock{ | |||||||
| 		hashNoNonce: common.HexToHash("5fc898f16035bf5ac9c6d9077ae1e3d5fc1ecc3c9fd5bee8bb00e810fdacbaa0"), | 		hashNoNonce: common.HexToHash("5fc898f16035bf5ac9c6d9077ae1e3d5fc1ecc3c9fd5bee8bb00e810fdacbaa0"), | ||||||
| 		difficulty:  big.NewInt(2467358), | 		difficulty:  big.NewInt(2467358), | ||||||
| 		nonce:       0x50377003e5d830ca, | 		nonce:       0x50377003e5d830ca, | ||||||
|  | 		mixDigest:   common.HexToHash("ab546a5b73c452ae86dadd36f0ed83a6745226717d3798832d1b20b489e82063"), | ||||||
| 	}, | 	}, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -73,8 +76,9 @@ func TestEthashConcurrentVerify(t *testing.T) { | |||||||
| 	defer os.RemoveAll(eth.Full.Dir) | 	defer os.RemoveAll(eth.Full.Dir) | ||||||
| 
 | 
 | ||||||
| 	block := &testBlock{difficulty: big.NewInt(10)} | 	block := &testBlock{difficulty: big.NewInt(10)} | ||||||
| 	nonce, _ := eth.Search(block, nil) | 	nonce, md := eth.Search(block, nil) | ||||||
| 	block.nonce = nonce | 	block.nonce = nonce | ||||||
|  | 	block.mixDigest = common.BytesToHash(md) | ||||||
| 
 | 
 | ||||||
| 	// Verify the block concurrently to check for data races.
 | 	// Verify the block concurrently to check for data races.
 | ||||||
| 	var wg sync.WaitGroup | 	var wg sync.WaitGroup | ||||||
| @ -98,21 +102,26 @@ func TestEthashConcurrentSearch(t *testing.T) { | |||||||
| 	eth.Turbo(true) | 	eth.Turbo(true) | ||||||
| 	defer os.RemoveAll(eth.Full.Dir) | 	defer os.RemoveAll(eth.Full.Dir) | ||||||
| 
 | 
 | ||||||
| 	// launch n searches concurrently.
 | 	type searchRes struct { | ||||||
|  | 		n  uint64 | ||||||
|  | 		md []byte | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	var ( | 	var ( | ||||||
| 		block   = &testBlock{difficulty: big.NewInt(35000)} | 		block   = &testBlock{difficulty: big.NewInt(35000)} | ||||||
| 		nsearch = 10 | 		nsearch = 10 | ||||||
| 		wg      = new(sync.WaitGroup) | 		wg      = new(sync.WaitGroup) | ||||||
| 		found   = make(chan uint64) | 		found   = make(chan searchRes) | ||||||
| 		stop    = make(chan struct{}) | 		stop    = make(chan struct{}) | ||||||
| 	) | 	) | ||||||
| 	rand.Read(block.hashNoNonce[:]) | 	rand.Read(block.hashNoNonce[:]) | ||||||
| 	wg.Add(nsearch) | 	wg.Add(nsearch) | ||||||
|  | 	// launch n searches concurrently.
 | ||||||
| 	for i := 0; i < nsearch; i++ { | 	for i := 0; i < nsearch; i++ { | ||||||
| 		go func() { | 		go func() { | ||||||
| 			nonce, _ := eth.Search(block, stop) | 			nonce, md := eth.Search(block, stop) | ||||||
| 			select { | 			select { | ||||||
| 			case found <- nonce: | 			case found <- searchRes{n: nonce, md: md}: | ||||||
| 			case <-stop: | 			case <-stop: | ||||||
| 			} | 			} | ||||||
| 			wg.Done() | 			wg.Done() | ||||||
| @ -120,12 +129,14 @@ func TestEthashConcurrentSearch(t *testing.T) { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// wait for one of them to find the nonce
 | 	// wait for one of them to find the nonce
 | ||||||
| 	nonce := <-found | 	res := <-found | ||||||
| 	// stop the others
 | 	// stop the others
 | ||||||
| 	close(stop) | 	close(stop) | ||||||
| 	wg.Wait() | 	wg.Wait() | ||||||
| 
 | 
 | ||||||
| 	if block.nonce = nonce; !eth.Verify(block) { | 	block.nonce = res.n | ||||||
|  | 	block.mixDigest = common.BytesToHash(res.md) | ||||||
|  | 	if !eth.Verify(block) { | ||||||
| 		t.Error("Block could not be verified") | 		t.Error("Block could not be verified") | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @ -140,8 +151,9 @@ func TestEthashSearchAcrossEpoch(t *testing.T) { | |||||||
| 	for i := epochLength - 40; i < epochLength+40; i++ { | 	for i := epochLength - 40; i < epochLength+40; i++ { | ||||||
| 		block := &testBlock{number: i, difficulty: big.NewInt(90)} | 		block := &testBlock{number: i, difficulty: big.NewInt(90)} | ||||||
| 		rand.Read(block.hashNoNonce[:]) | 		rand.Read(block.hashNoNonce[:]) | ||||||
| 		nonce, _ := eth.Search(block, nil) | 		nonce, md := eth.Search(block, nil) | ||||||
| 		block.nonce = nonce | 		block.nonce = nonce | ||||||
|  | 		block.mixDigest = common.BytesToHash(md) | ||||||
| 		if !eth.Verify(block) { | 		if !eth.Verify(block) { | ||||||
| 			t.Fatalf("Block could not be verified") | 			t.Fatalf("Block could not be verified") | ||||||
| 		} | 		} | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user