Skip to content

Commit ae88550

Browse files
authored
Merge pull request #118 from renproject/update/blake2b
[wip] update blake2b package
2 parents ef41f44 + 3577372 commit ae88550

File tree

4 files changed

+169
-23
lines changed

4 files changed

+169
-23
lines changed

chain/ethereum/gas.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var (
2222
// PriorityFeeEstimationTrigger specifies which base fee to trigger priority fee estimation at
2323
PriorityFeeEstimationTrigger = big.NewInt(100000000000) // WEI
2424
// DefaultPriorityFee is returned if above trigger is not met
25-
DefaultPriorityFee = big.NewInt(3000000000)
25+
DefaultPriorityFee = big.NewInt(3000000000)
2626
// PriorityFeeIncreaseBoundary signifies a big bump in fee history priority reward, due to which we choose
2727
// not to consider values under it while calculating the median priority fee.
2828
PriorityFeeIncreaseBoundary = big.NewInt(200)
@@ -55,10 +55,10 @@ type GasEstimator struct {
5555
// price for an ethereum transaction to be included in a block
5656
// with minimal delay.
5757
func NewGasEstimator(client *Client, opts GasOptions) *GasEstimator {
58-
return &GasEstimator{
59-
client: client,
60-
options: &opts,
61-
}
58+
return &GasEstimator{
59+
client: client,
60+
options: &opts,
61+
}
6262
}
6363

6464
// NewDefaultGasEstimator returns a simple gas estimator with default gas options

chain/zcash/utxo.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import (
88
"math"
99
"math/big"
1010

11+
blake2 "github.com/dchest/blake2b"
12+
1113
"github.com/btcsuite/btcd/btcec"
1214
"github.com/btcsuite/btcd/chaincfg/chainhash"
1315
"github.com/btcsuite/btcd/txscript"
1416
"github.com/btcsuite/btcd/wire"
15-
"github.com/codahale/blake2"
1617
"github.com/renproject/multichain/api/utxo"
1718
"github.com/renproject/multichain/chain/bitcoin"
1819
"github.com/renproject/pack"
@@ -483,16 +484,15 @@ func calculateSighash(
483484
}
484485

485486
func blake2b(data, key []byte) (h chainhash.Hash, err error) {
486-
bHash := blake2.New(&blake2.Config{
487-
Size: 32,
488-
Personal: key,
489-
})
490-
491-
if _, err = bHash.Write(data); err != nil {
487+
hash, err := blake2.New(&blake2.Config{Person: key, Size: 32})
488+
if err != nil {
489+
return h, err
490+
}
491+
if _, err = hash.Write(data); err != nil {
492492
return h, err
493493
}
494494

495-
err = (&h).SetBytes(bHash.Sum(nil))
495+
err = (&h).SetBytes(hash.Sum(nil))
496496
return h, err
497497
}
498498

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ go 1.14
55
require (
66
github.com/btcsuite/btcd v0.21.0-beta
77
github.com/btcsuite/btcutil v1.0.2
8-
github.com/codahale/blake2 v0.0.0-20150924215134-8d10d0420cbf
98
github.com/cosmos/cosmos-sdk v0.39.1
9+
github.com/dchest/blake2b v1.0.0
1010
github.com/ethereum/go-ethereum v1.10.6
1111
github.com/filecoin-project/go-address v0.0.5
1212
github.com/filecoin-project/go-jsonrpc v0.1.4-0.20210217175800-45ea43ac2bec

0 commit comments

Comments
 (0)