Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/pubkeyconverter_refactor #4716

Merged
merged 59 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
2ad1ee5
pubkeyConverter refactor
schimih Nov 9, 2022
c8213c2
pubkeyConverter refactor
schimih Nov 9, 2022
707c83d
pubkeyconverter refactor - process
schimih Nov 9, 2022
6f9b731
pubkeyConverter refactor - node package
schimih Nov 10, 2022
c0da058
pubkeyConverter refactor - update package
schimih Nov 11, 2022
da583fa
pubkeyconverter refactor - sharding, vm, outport
schimih Nov 14, 2022
3e02ebc
fix
schimih Nov 14, 2022
a9f7df6
Merge branch 'rc/v1.4.0' into EN-10782-Change_bech
schimih Nov 15, 2022
3646d0b
small fixes for tests
schimih Nov 15, 2022
aa40318
update interf, mocks & stubs after go-core change
schimih Nov 18, 2022
db39042
Merge branch 'feat/pubkeyconverter-refactor' into EN-10782-Change_bec…
schimih Nov 23, 2022
45487da
update
schimih Dec 7, 2022
525f72e
update with SilentEncode instead of QuietEncode
schimih Dec 7, 2022
8d64677
remove withMetaData
schimih Dec 7, 2022
b9e3ee4
Merge branch 'rc/v1.5.0' into EN-10782-Change_bech32_addresses_format
schimih Dec 7, 2022
3fc0a2f
lint fix
schimih Dec 8, 2022
cc27371
fix linter issues
schimih Dec 8, 2022
7600128
Merge pull request #4778 from ElrondNetwork/merge-rcv1.5.0-2022.12.08
iulianpascalau Dec 9, 2022
6e88690
Merge branch 'feat/pubkeyconverter-refactor' into EN-10782-Change_bec…
schimih Dec 9, 2022
d6a2d6b
fix after review
schimih Dec 9, 2022
e26c573
fix after self review
schimih Dec 12, 2022
748983a
Merge branch 'rc/v1.5.0' into EN-10782-Change
schimih Dec 12, 2022
41394e6
Merge branch 'feat/pubkeyconverter-refactor' into merge-rc/1.5.0-into…
schimih Dec 12, 2022
f7a1f25
Merge pull request #4793 from ElrondNetwork/merge-rc/1.5.0-into-feat/…
sstanculeanu Dec 12, 2022
2223ff7
Merge branch 'feat/pubkeyconverter-refactor' into EN-10782-Change_bec…
schimih Dec 13, 2022
b32ca0e
use SilentEncode to counter fatal risks
schimih Dec 13, 2022
dfe113c
Merge branch 'EN-10782-Change_bech32_addresses_format' of github.com:…
schimih Dec 13, 2022
c517568
fix
schimih Dec 13, 2022
5ba5dff
fix after self review
schimih Dec 13, 2022
026cf3c
fix after review
schimih Dec 18, 2022
fd6861e
fix after review
schimih Dec 19, 2022
8626410
Merge branch 'feat/pubkeyconverter-refactor' into merge-rc-v150-into-…
schimih Dec 19, 2022
f0d6042
Merge pull request #4812 from ElrondNetwork/merge-rc-v150-into-feat-p…
schimih Dec 19, 2022
acff72b
Merge branch 'feat/pubkeyco' into EN-10782-Change_
schimih Dec 19, 2022
8f710e7
Merge branch 'feat/pubkeyconverter-refactor' into EN-10782-Change_bec…
schimih Dec 19, 2022
0c19de0
fixes after review
schimih Dec 20, 2022
87d5816
fix after self review
schimih Dec 20, 2022
3c5cd44
fix after self review
schimih Dec 20, 2022
f713c6e
lint issue
schimih Dec 20, 2022
caa76e8
fix after review
schimih Dec 23, 2022
f6889d4
Merge pull request #4708 from ElrondNetwork/EN-10782-Change_bech32_ad…
schimih Dec 28, 2022
0a53e22
merge rc/v1.6.0 in pubkeyConverter
schimih Feb 23, 2023
543dc13
Merge pull request #5025 from multiversx/merge_rc/v1.6.0_in_pubkeycon…
schimih Feb 23, 2023
6eb4dfb
Merge branch 'rc/v1.6.0' into feat/pubkey_conv
schimih Mar 8, 2023
61ad141
fix lint issue
schimih Mar 8, 2023
ce1aa36
Merge pull request #5066 from multiversx/merge_rc1.6.0_in_pubkey
schimih Mar 8, 2023
a136f2d
Merge branch 'rc/v1.6.0' into merge-rc-v1.6.0-feat-pubkey-conv-2023.0…
iulianpascalau Mar 10, 2023
c19861f
- fixes after merge
iulianpascalau Mar 10, 2023
b559b2a
Merge pull request #5084 from multiversx/merge-rc-v1.6.0-feat-pubkey-…
iulianpascalau Mar 11, 2023
8bba982
fix after review
schimih Mar 13, 2023
85d4d15
fixes after review 2
schimih Mar 14, 2023
34f411f
fix after 2nd review and update indexer
schimih Mar 14, 2023
cdc7eee
Merge pull request #5098 from multiversx/fix_pubkeyconverter
schimih Mar 15, 2023
fc501eb
Merge branch 'rc/v1.6.0' into pubkey_15Mar
schimih Mar 15, 2023
efb5334
Merge pull request #5100 from multiversx/merge_rc/v1.6.0_in_pubkey_15Mar
schimih Mar 15, 2023
1c3ce42
Merge branch 'rc/v1.6.0' into merge-rc/v1.6.0-into-feat/pubkeyconv-mar15
bogdan-rosianu Mar 15, 2023
58c40b0
Merge pull request #5104 from multiversx/merge-rc/v1.6.0-into-feat/pu…
schimih Mar 15, 2023
27733cd
update core-go, vm-common-go, indexer-go versions
schimih Mar 20, 2023
3848ddb
Merge pull request #5109 from multiversx/update_go_mod
schimih Mar 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/keygenerator/converter/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ package converter

import "errors"

// ErrNotImplemented is returned when a method is not implemented
var errNotImplemented = errors.New("not implemented")
6 changes: 3 additions & 3 deletions cmd/keygenerator/converter/pidPubkeyConverter.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (converter *pidPubkeyConverter) Decode(_ string) ([]byte, error) {
}

// Encode encodes a byte array in its string representation
func (converter *pidPubkeyConverter) Encode(pkBytes []byte) string {
func (converter *pidPubkeyConverter) Encode(pkBytes []byte) (string, error) {
pidString, err := converter.encode(pkBytes)
if err != nil {
log.Warn("pidPubkeyConverter.Encode encode",
iulianpascalau marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -42,10 +42,10 @@ func (converter *pidPubkeyConverter) Encode(pkBytes []byte) string {
"stack trace", string(debug.Stack()),
)

return ""
return "", err
}

return pidString
return pidString, nil
}

func (converter *pidPubkeyConverter) encode(pkBytes []byte) (string, error) {
Expand Down
6 changes: 4 additions & 2 deletions cmd/keygenerator/converter/pidPubkeyConverter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ func TestPidPubkeyConverter_Encode(t *testing.T) {
}
}()

encoded := converter.Encode([]byte("not a valid PK"))
encoded, err := converter.Encode([]byte("not a valid PK"))
assert.Contains(t, err.Error(), "parameter is invalid")
assert.Empty(t, encoded)
})
t.Run("valid public key should work", func(t *testing.T) {
Expand All @@ -40,7 +41,8 @@ func TestPidPubkeyConverter_Encode(t *testing.T) {
pkBytes, err := hex.DecodeString(pkHex)
assert.Nil(t, err)

encoded := converter.Encode(pkBytes)
encoded, err := converter.Encode(pkBytes)
assert.Nil(t, err)
assert.Equal(t, "16Uiu2HAmSHgyTYyawhsZv9opxTHX77vKjoPeGkyCYS5fYVMssHjN", encoded)
})
}
Expand Down
10 changes: 7 additions & 3 deletions cmd/keygenerator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const minedWalletPrefixKeys = "mined-wallet"
const nopattern = "nopattern"
const desiredpattern = "[0-f]+"
const noshard = -1
const pubkeyHrp = "erd"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, this can be received as a command line parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...or a config defined in config.toml file


type key struct {
skBytes []byte
Expand All @@ -49,7 +50,7 @@ type key struct {

type pubKeyConverter interface {
Decode(humanReadable string) ([]byte, error)
Encode(pkBytes []byte) string
Encode(pkBytes []byte) (string, error)
IsInterfaceNil() bool
}

Expand Down Expand Up @@ -132,7 +133,7 @@ VERSION:

validatorPubKeyConverter, _ = pubkeyConverter.NewHexPubkeyConverter(blsPubkeyLen)
pidPubKeyConverter = converter.NewPidPubkeyConverter()
walletPubKeyConverter, _ = pubkeyConverter.NewBech32PubkeyConverter(txSignPubkeyLen, log)
walletPubKeyConverter, _ = pubkeyConverter.NewBech32PubkeyConverter(txSignPubkeyLen, pubkeyHrp)
)

func main() {
Expand Down Expand Up @@ -365,7 +366,10 @@ func writeKeyToStream(writer io.Writer, key key, converter pubKeyConverter) erro
return fmt.Errorf("nil writer")
}

pkString := converter.Encode(key.pkBytes)
pkString, err := converter.Encode(key.pkBytes)
if err != nil {
return err
}

blk := pem.Block{
Type: "PRIVATE KEY for " + pkString,
Expand Down
1 change: 1 addition & 0 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@
Length = 32
Type = "bech32"
SignatureLength = 64
Hrp = "erd"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this line, but: make sure to remove the binary file cmd/node/node, since it was committed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted


[ValidatorPubkeyConverter]
Length = 96
Expand Down
Binary file added cmd/node/node
Binary file not shown.
5 changes: 1 addition & 4 deletions common/factory/pubkeyConverterFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ import (
"github.com/multiversx/mx-chain-core-go/core/pubkeyConverter"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/state"
logger "github.com/multiversx/mx-chain-logger-go"
)

var log = logger.GetOrCreate("state/factory")

// HexFormat defines the hex format for the pubkey converter
const HexFormat = "hex"

Expand All @@ -24,7 +21,7 @@ func NewPubkeyConverter(config config.PubkeyConfig) (core.PubkeyConverter, error
case HexFormat:
return pubkeyConverter.NewHexPubkeyConverter(config.Length)
case Bech32Format:
return pubkeyConverter.NewBech32PubkeyConverter(config.Length, log)
return pubkeyConverter.NewBech32PubkeyConverter(config.Length, config.Hrp)
default:
return nil, fmt.Errorf("%w unrecognized type %s", state.ErrInvalidPubkeyConverterType, config.Type)
}
Expand Down
4 changes: 3 additions & 1 deletion common/factory/pubkeyConverterFactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ func TestNewPubkeyConverter_Bech32ShouldWork(t *testing.T) {
config.PubkeyConfig{
Length: 32,
Type: "bech32",
Hrp: "erd",
},
)

assert.Nil(t, err)
expected, _ := pubkeyConverter.NewBech32PubkeyConverter(32, log)
expected, err := pubkeyConverter.NewBech32PubkeyConverter(32, "erd")
assert.Nil(t, err)
assert.IsType(t, expected, pc)
}

Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type PubkeyConfig struct {
Length int
Type string
SignatureLength int
Hrp string
}

// TypeConfig will map the string type configuration
Expand Down
65 changes: 0 additions & 65 deletions config/tomlConfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,208 +493,143 @@ func TestEnableEpochConfig(t *testing.T) {
[EnableEpochs]
# SCDeployEnableEpoch represents the epoch when the deployment of smart contracts will be enabled
SCDeployEnableEpoch = 1

iulianpascalau marked this conversation as resolved.
Show resolved Hide resolved
# BuiltInFunctionsEnableEpoch represents the epoch when the built in functions will be enabled
BuiltInFunctionsEnableEpoch = 2

# RelayedTransactionsEnableEpoch represents the epoch when the relayed transactions will be enabled
RelayedTransactionsEnableEpoch = 3

# PenalizedTooMuchGasEnableEpoch represents the epoch when the penalization for using too much gas will be enabled
PenalizedTooMuchGasEnableEpoch = 4

# SwitchJailWaitingEnableEpoch represents the epoch when the system smart contract processing at end of epoch is enabled
SwitchJailWaitingEnableEpoch = 5

# BelowSignedThresholdEnableEpoch represents the epoch when the change for computing rating for validators below signed rating is enabled
BelowSignedThresholdEnableEpoch = 6

# SwitchHysteresisForMinNodesEnableEpoch represents the epoch when the system smart contract changes its config to consider
# also (minimum) hysteresis nodes for the minimum number of nodes
SwitchHysteresisForMinNodesEnableEpoch = 7

# TransactionSignedWithTxHashEnableEpoch represents the epoch when the node will also accept transactions that are
# signed with the hash of transaction
TransactionSignedWithTxHashEnableEpoch = 8

# MetaProtectionEnableEpoch represents the epoch when the transactions to the metachain are checked to have enough gas
MetaProtectionEnableEpoch = 9

# AheadOfTimeGasUsageEnableEpoch represents the epoch when the cost of smart contract prepare changes from compiler per byte to ahead of time prepare per byte
AheadOfTimeGasUsageEnableEpoch = 10

# GasPriceModifierEnableEpoch represents the epoch when the gas price modifier in fee computation is enabled
GasPriceModifierEnableEpoch = 11

# RepairCallbackEnableEpoch represents the epoch when the callback repair is activated for scrs
RepairCallbackEnableEpoch = 12

# BlockGasAndFeesReCheckEnableEpoch represents the epoch when gas and fees used in each created or processed block are re-checked
BlockGasAndFeesReCheckEnableEpoch = 13

# BalanceWaitingListsEnableEpoch represents the epoch when the shard waiting lists are balanced at the start of an epoch
BalanceWaitingListsEnableEpoch = 14

# ReturnDataToLastTransferEnableEpoch represents the epoch when returned data is added to last output transfer for callbacks
ReturnDataToLastTransferEnableEpoch = 15

# SenderInOutTransferEnableEpoch represents the epoch when the feature of having different senders in output transfer is enabled
SenderInOutTransferEnableEpoch = 16

# StakeEnableEpoch represents the epoch when staking is enabled
StakeEnableEpoch = 17

# StakingV2EnableEpoch represents the epoch when staking v2 is enabled
StakingV2EnableEpoch = 18

DoubleKeyProtectionEnableEpoch = 19

# ESDTEnableEpoch represents the epoch when ESDT is enabled
ESDTEnableEpoch = 20

# GovernanceEnableEpoch represents the epoch when governance is enabled
GovernanceEnableEpoch = 21

# DelegationManagerEnableEpoch represents the epoch when the delegation manager is enabled
# epoch should not be 0
DelegationManagerEnableEpoch = 22

# DelegationSmartContractEnableEpoch represents the epoch when delegation smart contract is enabled
# epoch should not be 0
DelegationSmartContractEnableEpoch = 23

# CorrectLastUnjailedEnableEpoch represents the epoch when the fix regaring the last unjailed node should apply
CorrectLastUnjailedEnableEpoch = 24

# RelayedTransactionsV2EnableEpoch represents the epoch when the relayed transactions V2 will be enabled
RelayedTransactionsV2EnableEpoch = 25

# UnbondTokensV2EnableEpoch represents the epoch when the new implementation of the unbond tokens function is available
UnbondTokensV2EnableEpoch = 26

# SaveJailedAlwaysEnableEpoch represents the epoch when saving jailed status at end of epoch will happen in all cases
SaveJailedAlwaysEnableEpoch = 27

# ReDelegateBelowMinCheckEnableEpoch represents the epoch when the check for the re-delegated value will be enabled
ReDelegateBelowMinCheckEnableEpoch = 28

# ValidatorToDelegationEnableEpoch represents the epoch when the validator-to-delegation feature will be enabled
ValidatorToDelegationEnableEpoch = 29

# WaitingListFixEnableEpoch represents the epoch when the 6 epoch waiting list fix is enabled
WaitingListFixEnableEpoch = 30

# IncrementSCRNonceInMultiTransferEnableEpoch represents the epoch when the fix for preventing the generation of the same SCRs
# is enabled. The fix is done by adding an extra increment.
IncrementSCRNonceInMultiTransferEnableEpoch = 31

# ESDTMultiTransferEnableEpoch represents the epoch when esdt multitransfer built in function is enabled
ESDTMultiTransferEnableEpoch = 32

# GlobalMintBurnDisableEpoch represents the epoch when the global mint and burn functions are disabled
GlobalMintBurnDisableEpoch = 33

# ESDTTransferRoleEnableEpoch represents the epoch when esdt transfer role set is enabled
ESDTTransferRoleEnableEpoch = 34

# BuiltInFunctionOnMetaEnableEpoch represents the epoch when built in function processing on metachain is enabled
BuiltInFunctionOnMetaEnableEpoch = 35

# ComputeRewardCheckpointEnableEpoch represents the epoch when compute rewards checkpoint epoch is enabled
ComputeRewardCheckpointEnableEpoch = 36

# SCRSizeInvariantCheckEnableEpoch represents the epoch when the scr size invariant check is enabled
SCRSizeInvariantCheckEnableEpoch = 37

# BackwardCompSaveKeyValueEnableEpoch represents the epoch when backward compatibility save key value is enabled
BackwardCompSaveKeyValueEnableEpoch = 38

# ESDTNFTCreateOnMultiShardEnableEpoch represents the epoch when esdt nft creation on multiple shards is enabled
ESDTNFTCreateOnMultiShardEnableEpoch = 39

# MetaESDTSetEnableEpoch represents the epoch when the backward compatibility for save key value error is enabled
MetaESDTSetEnableEpoch = 40

# AddTokensToDelegationEnableEpoch represents the epoch when adding tokens to delegation is enabled for whitelisted address
AddTokensToDelegationEnableEpoch = 41

# MultiESDTTransferFixOnCallBackOnEnableEpoch represents the epoch when multi esdt transfer on callback fix is enabled
MultiESDTTransferFixOnCallBackOnEnableEpoch = 42

# OptimizeGasUsedInCrossMiniBlocksEnableEpoch represents the epoch when gas used in cross shard mini blocks will be optimized
OptimizeGasUsedInCrossMiniBlocksEnableEpoch = 43

# FixOOGReturnCodeEnableEpoch represents the epoch when the backward compatibility returning out of gas error is enabled
FixOOGReturnCodeEnableEpoch = 44

# RemoveNonUpdatedStorageEnableEpoch represents the epoch when the backward compatibility for removing non updated storage is enabled
RemoveNonUpdatedStorageEnableEpoch = 45

# OptimizeNFTStoreEnableEpoch represents the epoch when optimizations on NFT metadata store and send are enabled
OptimizeNFTStoreEnableEpoch = 46

# CreateNFTThroughExecByCallerEnableEpoch represents the epoch when nft creation through execution on destination by caller is enabled
CreateNFTThroughExecByCallerEnableEpoch = 47

# IsPayableBySCEnableEpoch represents the epoch when a new flag isPayable by SC is enabled
IsPayableBySCEnableEpoch = 48

# CleanUpInformativeSCRsEnableEpoch represents the epoch when the scrs which contain only information are cleaned from miniblocks and logs are created from it
CleanUpInformativeSCRsEnableEpoch = 49

# StorageAPICostOptimizationEnableEpoch represents the epoch when new storage helper functions are enabled and cost is reduced in Wasm VM
StorageAPICostOptimizationEnableEpoch = 50

# TransformToMultiShardCreateEnableEpoch represents the epoch when the new function on esdt system sc is enabled to transfer create role into multishard
TransformToMultiShardCreateEnableEpoch = 51

# ESDTRegisterAndSetAllRolesEnableEpoch represents the epoch when new function to register tickerID and set all roles is enabled
ESDTRegisterAndSetAllRolesEnableEpoch = 52

# FailExecutionOnEveryAPIErrorEnableEpoch represent the epoch when new protection in VM is enabled to fail all wrong API calls
FailExecutionOnEveryAPIErrorEnableEpoch = 53

# ManagedCryptoAPIsEnableEpoch represents the epoch when the new managed crypto APIs are enabled
ManagedCryptoAPIsEnableEpoch = 54

# ESDTMetadataContinuousCleanupEnableEpoch represents the epoch when esdt metadata is automatically deleted according to inshard liquidity
ESDTMetadataContinuousCleanupEnableEpoch = 55

# FixAsyncCallBackArgsListEnableEpoch represents the epoch when the async callback arguments lists fix will be enabled
FixAsyncCallBackArgsListEnableEpoch = 56

# FixOldTokenLiquidityEnableEpoch represents the epoch when the fix for old token liquidity is enabled
FixOldTokenLiquidityEnableEpoch = 57

# SetSenderInEeiOutputTransferEnableEpoch represents the epoch when setting the sender in eei output transfers will be enabled
SetSenderInEeiOutputTransferEnableEpoch = 58

# MaxBlockchainHookCountersEnableEpoch represents the epoch when the max blockchainhook counters are enabled
MaxBlockchainHookCountersEnableEpoch = 59

# WipeSingleNFTLiquidityDecreaseEnableEpoch represents the epoch when the system account liquidity is decreased for wipeSingleNFT as well
WipeSingleNFTLiquidityDecreaseEnableEpoch = 60

# AlwaysSaveTokenMetaDataEnableEpoch represents the epoch when the token metadata is always saved
AlwaysSaveTokenMetaDataEnableEpoch = 61

# RuntimeCodeSizeFixEnableEpoch represents the epoch when the code size fix in the VM is enabled
RuntimeCodeSizeFixEnableEpoch = 62

# RuntimeMemStoreLimitEnableEpoch represents the epoch when the condition for Runtime MemStore is enabled
RuntimeMemStoreLimitEnableEpoch = 63

# MaxNodesChangeEnableEpoch holds configuration for changing the maximum number of nodes and the enabling epoch
MaxNodesChangeEnableEpoch = [
{ EpochEnable = 44, MaxNumNodes = 2169, NodesToShufflePerShard = 80 },
{ EpochEnable = 45, MaxNumNodes = 3200, NodesToShufflePerShard = 80 }
]

BLSMultiSignerEnableEpoch = [
{EnableEpoch = 0, Type = "no-KOSK"},
{EnableEpoch = 3, Type = "KOSK"}
]

[GasSchedule]
GasScheduleByEpochs = [
{ StartEpoch = 46, FileName = "gasScheduleV1.toml" },
Expand Down
4 changes: 2 additions & 2 deletions dataRetriever/factory/dataPoolFactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ func TestNewDataPoolFromConfig_BadConfigShouldErr(t *testing.T) {
require.Nil(t, holder)
fmt.Println(err)
require.NotNil(t, err)
require.True(t, strings.Contains(err.Error(), "Must provide a positive size while creating the cache for the miniblocks"))
require.True(t, strings.Contains(err.Error(), "must provide a positive size while creating the cache for the miniblocks"))

args = getGoodArgs()
args.Config.PeerBlockBodyDataPool.Capacity = 0
holder, err = NewDataPoolFromConfig(args)
require.Nil(t, holder)
fmt.Println(err)
require.NotNil(t, err)
require.True(t, strings.Contains(err.Error(), "Must provide a positive size while creating the cache for the peer mini block body"))
require.True(t, strings.Contains(err.Error(), "must provide a positive size while creating the cache for the peer mini block body"))

args = getGoodArgs()
args.Config.TrieSyncStorage.Capacity = 0
Expand Down
2 changes: 1 addition & 1 deletion epochStart/bootstrap/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func createComponentsForEpochStart() (*mock.CoreComponentsMock, *mock.CryptoComp
Hash: &hashingMocks.HasherMock{},
TxSignHasherField: &hashingMocks.HasherMock{},
UInt64ByteSliceConv: &mock.Uint64ByteSliceConverterMock{},
AddrPubKeyConv: &mock.PubkeyConverterMock{},
AddrPubKeyConv: &testscommon.PubkeyConverterMock{},
PathHdl: &testscommon.PathManagerStub{},
EpochNotifierField: &epochNotifier.EpochNotifierStub{},
TxVersionCheckField: versioning.NewTxVersionChecker(1),
Expand Down
2 changes: 1 addition & 1 deletion epochStart/bootstrap/syncEpochStartMeta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func getEpochStartSyncerArgs() ArgsNewEpochStartMetaSyncer {
Marsh: &mock.MarshalizerMock{},
Hash: &hashingMocks.HasherMock{},
UInt64ByteSliceConv: &mock.Uint64ByteSliceConverterMock{},
AddrPubKeyConv: mock.NewPubkeyConverterMock(32),
AddrPubKeyConv: testscommon.NewPubkeyConverterMock(32),
PathHdl: &testscommon.PathManagerStub{},
ChainIdCalled: func() string {
return "chain-ID"
Expand Down
2 changes: 1 addition & 1 deletion epochStart/metachain/baseRewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ func getBaseRewardsArguments() BaseRewardsCreatorArgs {

return BaseRewardsCreatorArgs{
ShardCoordinator: shardCoordinator,
PubkeyConverter: mock.NewPubkeyConverterMock(32),
PubkeyConverter: testscommon.NewPubkeyConverterMock(32),
RewardsStorage: mock.NewStorerMock(),
MiniBlockStorage: mock.NewStorerMock(),
Hasher: &hashingMocks.HasherMock{},
Expand Down
Loading