generated from flashbots/flashbots-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server: move mock relay into mock package (#642)
* server: move mock relay into mock package * server/mock: fix comment * server/mock: overrideGetHeader properly * server/mock: disallowUnknownFields * happy lint, happy life
- Loading branch information
1 parent
5994642
commit b17921a
Showing
15 changed files
with
216 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package mock | ||
|
||
import ( | ||
"github.com/attestantio/go-eth2-client/spec/bellatrix" | ||
"github.com/attestantio/go-eth2-client/spec/phase0" | ||
"github.com/ethereum/go-ethereum/common/hexutil" | ||
"github.com/flashbots/go-boost-utils/utils" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
// TestLog is used to log information in the test methods | ||
var TestLog = logrus.NewEntry(logrus.New()) | ||
|
||
// HexToBytes converts a hexadecimal string to a byte array | ||
func HexToBytes(hex string) []byte { | ||
res, err := hexutil.Decode(hex) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return res | ||
} | ||
|
||
// HexToHash converts a hexadecimal string to an Ethereum hash | ||
func HexToHash(s string) (ret phase0.Hash32) { | ||
ret, err := utils.HexToHash(s) | ||
if err != nil { | ||
TestLog.Error(err, " _HexToHash: ", s) | ||
panic(err) | ||
} | ||
return ret | ||
} | ||
|
||
// HexToAddress converts a hexadecimal string to an Ethereum address | ||
func HexToAddress(s string) (ret bellatrix.ExecutionAddress) { | ||
ret, err := utils.HexToAddress(s) | ||
if err != nil { | ||
TestLog.Error(err, " _HexToAddress: ", s) | ||
panic(err) | ||
} | ||
return ret | ||
} | ||
|
||
// HexToPubkey converts a hexadecimal string to a BLS Public Key | ||
func HexToPubkey(s string) (ret phase0.BLSPubKey) { | ||
ret, err := utils.HexToPubkey(s) | ||
if err != nil { | ||
TestLog.Error(err, " _HexToPubkey: ", s) | ||
panic(err) | ||
} | ||
return | ||
} | ||
|
||
// HexToSignature converts a hexadecimal string to a BLS Signature | ||
func HexToSignature(s string) (ret phase0.BLSSignature) { | ||
ret, err := utils.HexToSignature(s) | ||
if err != nil { | ||
TestLog.Error(err, " _HexToSignature: ", s) | ||
panic(err) | ||
} | ||
return | ||
} |
Oops, something went wrong.