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

Add marshaller to data trie tracker #4640

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions epochStart/metachain/baseRewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -826,15 +826,15 @@ func TestBaseRewardsCreator_isSystemDelegationSC(t *testing.T) {
require.False(t, isDelegationSCAddress)

// peer account
peerAccount, err := state.NewPeerAccount([]byte("addressPeer"), &hashingMocks.HasherMock{})
peerAccount, err := state.NewPeerAccount([]byte("addressPeer"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
require.Nil(t, err)
err = rwd.userAccountsDB.SaveAccount(peerAccount)
require.Nil(t, err)
isDelegationSCAddress = rwd.isSystemDelegationSC(peerAccount.AddressBytes())
require.False(t, isDelegationSCAddress)

// existing user account
userAccount, err := state.NewUserAccount([]byte("userAddress"), &hashingMocks.HasherMock{})
userAccount, err := state.NewUserAccount([]byte("userAddress"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
require.Nil(t, err)

userAccount.SetDataTrie(&trieMock.TrieStub{
Expand Down
2 changes: 1 addition & 1 deletion factory/processing/processComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ func (pcf *processComponentsFactory) indexGenesisAccounts() error {
}

func (pcf *processComponentsFactory) unmarshalUserAccount(address []byte, userAccountsBytes []byte) (state.UserAccountHandler, error) {
userAccount, err := state.NewUserAccount(address, pcf.coreData.Hasher())
userAccount, err := state.NewUserAccount(address, pcf.coreData.Hasher(), pcf.coreData.InternalMarshalizer())
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion integrationTests/testInitializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ func GenerateAddressJournalAccountAccountsDB() ([]byte, state.UserAccountHandler
adr := CreateRandomAddress()
trieStorage, _ := CreateTrieStorageManager(CreateMemUnit())
adb, _ := CreateAccountsDB(UserAccount, trieStorage)
account, _ := state.NewUserAccount(adr, TestHasher)
account, _ := state.NewUserAccount(adr, TestHasher, TestMarshaller)

return adr, account, adb
}
Expand Down
2 changes: 1 addition & 1 deletion integrationTests/vm/systemVM/stakingSC_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func manualSetToInactiveStateStakedPeers(t *testing.T, nodes []*integrationTests

for index := range nodes {
pubKey, _ := hex.DecodeString(generateUniqueKey(index))
peerAccount, _ := state.NewPeerAccount(pubKey, integrationTests.TestHasher)
peerAccount, _ := state.NewPeerAccount(pubKey, integrationTests.TestHasher, integrationTests.TestMarshaller)
peerAccount.List = string(common.InactiveList)
peerAccount.BLSPublicKey = pubKey
err := node.PeerState.SaveAccount(peerAccount)
Expand Down
4 changes: 2 additions & 2 deletions integrationTests/vm/testInitializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ type accountFactory struct {
}

// CreateAccount -
func (af *accountFactory) CreateAccount(address []byte, hasher hashing.Hasher) (vmcommon.AccountHandler, error) {
return state.NewUserAccount(address, hasher)
func (af *accountFactory) CreateAccount(address []byte, hasher hashing.Hasher, marshaller marshal.Marshalizer) (vmcommon.AccountHandler, error) {
return state.NewUserAccount(address, hasher, marshaller)
}

// IsInterfaceNil returns true if there is no value under the interface
Expand Down
2 changes: 1 addition & 1 deletion node/nodeLoadAccounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
func TestNode_GetAccountWithOptionsShouldWork(t *testing.T) {
t.Parallel()

alice, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{})
alice, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
alice.Balance = big.NewInt(100)

accountsRepostitory := &mockState.AccountsRepositoryStub{}
Expand Down
46 changes: 23 additions & 23 deletions node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func createMockPubkeyConverter() *mock.PubkeyConverterMock {
func getAccAdapter(balance *big.Int) *stateMock.AccountsStub {
accDB := &stateMock.AccountsStub{}
accDB.GetExistingAccountCalled = func(address []byte) (handler vmcommon.AccountHandler, e error) {
acc, _ := state.NewUserAccount(address, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(address, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
_ = acc.AddToBalance(balance)
acc.IncreaseNonce(1)

Expand Down Expand Up @@ -195,7 +195,7 @@ func TestGetBalance_AccountNotFoundShouldReturnZeroBalance(t *testing.T) {
func TestGetBalance(t *testing.T) {
t.Parallel()

testAccount, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{})
testAccount, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
testAccount.Balance = big.NewInt(100)

accountsRepository := &stateMock.AccountsRepositoryStub{
Expand Down Expand Up @@ -228,7 +228,7 @@ func TestGetUsername(t *testing.T) {

expectedUsername := []byte("elrond")

testAccount, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{})
testAccount, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
testAccount.UserName = expectedUsername
accountsRepository := &stateMock.AccountsRepositoryStub{
GetAccountWithBlockInfoCalled: func(address []byte, options api.AccountQueryOptions) (vmcommon.AccountHandler, common.BlockInfo, error) {
Expand Down Expand Up @@ -261,7 +261,7 @@ func TestGetCodeHash(t *testing.T) {

expectedCodeHash := []byte("hash")

testAccount, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{})
testAccount, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
testAccount.CodeHash = expectedCodeHash
accountsRepository := &stateMock.AccountsRepositoryStub{
GetAccountWithBlockInfoCalled: func(address []byte, options api.AccountQueryOptions) (vmcommon.AccountHandler, common.BlockInfo, error) {
Expand Down Expand Up @@ -292,7 +292,7 @@ func TestGetCodeHash(t *testing.T) {
func TestNode_GetKeyValuePairs(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})

k1, v1 := []byte("key1"), []byte("value1")
k2, v2 := []byte("key2"), []byte("value2")
Expand Down Expand Up @@ -360,7 +360,7 @@ func TestNode_GetKeyValuePairs(t *testing.T) {
func TestNode_GetKeyValuePairs_GetAllLeavesShouldFail(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})

accDB := &stateMock.AccountsStub{}

Expand Down Expand Up @@ -415,7 +415,7 @@ func TestNode_GetKeyValuePairs_GetAllLeavesShouldFail(t *testing.T) {
func TestNode_GetKeyValuePairsContextShouldTimeout(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})

accDB := &stateMock.AccountsStub{}
acc.SetDataTrie(
Expand Down Expand Up @@ -472,7 +472,7 @@ func TestNode_GetKeyValuePairsContextShouldTimeout(t *testing.T) {
func TestNode_GetValueForKey(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})

k1, v1 := []byte("key1"), []byte("value1")
_ = acc.SaveKeyValue(k1, v1)
Expand Down Expand Up @@ -514,7 +514,7 @@ func TestNode_GetValueForKey(t *testing.T) {
func TestNode_GetESDTData(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
esdtToken := "newToken"

esdtData := &esdt.ESDigitalToken{Value: big.NewInt(10)}
Expand Down Expand Up @@ -563,7 +563,7 @@ func TestNode_GetESDTData(t *testing.T) {
func TestNode_GetESDTDataForNFT(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
esdtToken := "newToken"
nonce := int64(100)

Expand Down Expand Up @@ -608,7 +608,7 @@ func TestNode_GetESDTDataForNFT(t *testing.T) {
func TestNode_GetAllESDTTokens(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
esdtToken := "newToken"
esdtKey := []byte(core.ElrondProtectedKeyPrefix + core.ESDTKeyIdentifier + esdtToken)

Expand Down Expand Up @@ -676,7 +676,7 @@ func TestNode_GetAllESDTTokens(t *testing.T) {
func TestNode_GetAllESDTTokens_GetAllLeavesShouldFail(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})

expectedErr := errors.New("expected error")
acc.SetDataTrie(
Expand Down Expand Up @@ -732,7 +732,7 @@ func TestNode_GetAllESDTTokens_GetAllLeavesShouldFail(t *testing.T) {
func TestNode_GetAllESDTTokensContextShouldTimeout(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})

acc.SetDataTrie(
&trieMock.TrieStub{
Expand Down Expand Up @@ -790,7 +790,7 @@ func TestNode_GetAllESDTTokensContextShouldTimeout(t *testing.T) {
func TestNode_GetAllESDTTokensShouldReturnEsdtAndFormattedNft(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(testscommon.TestPubKeyAlice, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})

esdtToken := "TKKR-7q8w9e"
esdtKey := []byte(core.ElrondProtectedKeyPrefix + core.ESDTKeyIdentifier + esdtToken)
Expand Down Expand Up @@ -886,7 +886,7 @@ func TestNode_GetAllESDTTokensShouldReturnEsdtAndFormattedNft(t *testing.T) {
func TestNode_GetAllIssuedESDTs(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
esdtToken := []byte("TCK-RANDOM")
sftToken := []byte("SFT-RANDOM")
nftToken := []byte("NFT-RANDOM")
Expand Down Expand Up @@ -983,7 +983,7 @@ func TestNode_GetESDTsWithRole(t *testing.T) {
t.Parallel()

addrBytes := testscommon.TestPubKeyAlice
acc, _ := state.NewUserAccount(addrBytes, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(addrBytes, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
esdtToken := []byte("TCK-RANDOM")

specialRoles := []*systemSmartContracts.ESDTRoles{
Expand Down Expand Up @@ -1063,7 +1063,7 @@ func TestNode_GetESDTsRoles(t *testing.T) {
t.Parallel()

addrBytes := testscommon.TestPubKeyAlice
acc, _ := state.NewUserAccount(addrBytes, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(addrBytes, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
esdtToken := []byte("TCK-RANDOM")

specialRoles := []*systemSmartContracts.ESDTRoles{
Expand Down Expand Up @@ -1135,7 +1135,7 @@ func TestNode_GetNFTTokenIDsRegisteredByAddress(t *testing.T) {
t.Parallel()

addrBytes := testscommon.TestPubKeyAlice
acc, _ := state.NewUserAccount(addrBytes, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(addrBytes, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
esdtToken := []byte("TCK-RANDOM")

esdtData := &systemSmartContracts.ESDTDataV2{TokenName: []byte("fungible"), TokenType: []byte(core.SemiFungibleESDT), OwnerAddress: addrBytes}
Expand Down Expand Up @@ -1200,7 +1200,7 @@ func TestNode_GetNFTTokenIDsRegisteredByAddressContextShouldTimeout(t *testing.T
t.Parallel()

addrBytes := testscommon.TestPubKeyAlice
acc, _ := state.NewUserAccount(addrBytes, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(addrBytes, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})

acc.SetDataTrie(
&trieMock.TrieStub{
Expand Down Expand Up @@ -1371,7 +1371,7 @@ func TestGenerateTransaction_GetAccountReturnsNilShouldWork(t *testing.T) {

accAdapter := &stateMock.AccountsStub{
GetExistingAccountCalled: func(address []byte) (vmcommon.AccountHandler, error) {
return state.NewUserAccount(address, &hashingMocks.HasherMock{})
return state.NewUserAccount(address, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
},
}
privateKey := getPrivateKey()
Expand Down Expand Up @@ -1518,7 +1518,7 @@ func TestGenerateTransaction_ShouldSetCorrectNonce(t *testing.T) {
nonce := uint64(7)
accAdapter := &stateMock.AccountsStub{
GetExistingAccountCalled: func(address []byte) (vmcommon.AccountHandler, error) {
acc, _ := state.NewUserAccount(address, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(address, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
_ = acc.AddToBalance(big.NewInt(0))
acc.IncreaseNonce(nonce)

Expand Down Expand Up @@ -2347,7 +2347,7 @@ func TestCreateTransaction_OkValsShouldWork(t *testing.T) {
stateComponents := getDefaultStateComponents()
stateComponents.AccountsAPI = &stateMock.AccountsStub{
GetExistingAccountCalled: func(addressContainer []byte) (vmcommon.AccountHandler, error) {
return state.NewUserAccount([]byte("address"), &hashingMocks.HasherMock{})
return state.NewUserAccount([]byte("address"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
},
}

Expand Down Expand Up @@ -2944,7 +2944,7 @@ func TestNode_GetAccountAccountsRepositoryFailsShouldErr(t *testing.T) {
func TestNode_GetAccountAccountExistsShouldReturn(t *testing.T) {
t.Parallel()

accnt, _ := state.NewUserAccount(testscommon.TestPubKeyBob, &hashingMocks.HasherMock{})
accnt, _ := state.NewUserAccount(testscommon.TestPubKeyBob, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
_ = accnt.AddToBalance(big.NewInt(1))
accnt.IncreaseNonce(2)
accnt.SetRootHash([]byte("root hash"))
Expand Down
3 changes: 2 additions & 1 deletion node/trieIterators/delegatedListProcessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/ElrondNetwork/elrond-go/node/mock"
"github.com/ElrondNetwork/elrond-go/process"
"github.com/ElrondNetwork/elrond-go/state"
"github.com/ElrondNetwork/elrond-go/testscommon"
"github.com/ElrondNetwork/elrond-go/testscommon/hashingMocks"
stateMock "github.com/ElrondNetwork/elrond-go/testscommon/state"
trieMock "github.com/ElrondNetwork/elrond-go/testscommon/trie"
Expand Down Expand Up @@ -219,7 +220,7 @@ func TestDelegatedListProc_GetDelegatorsListShouldWork(t *testing.T) {
}

func createDelegationScAccount(address []byte, leaves [][]byte, rootHash []byte, timeSleep time.Duration) state.UserAccountHandler {
acc, _ := state.NewUserAccount(address, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(address, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
acc.SetDataTrie(&trieMock.TrieStub{
RootCalled: func() ([]byte, error) {
return rootHash, nil
Expand Down
3 changes: 2 additions & 1 deletion node/trieIterators/directStakedListProcessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/ElrondNetwork/elrond-go/node/mock"
"github.com/ElrondNetwork/elrond-go/process"
"github.com/ElrondNetwork/elrond-go/state"
"github.com/ElrondNetwork/elrond-go/testscommon"
"github.com/ElrondNetwork/elrond-go/testscommon/hashingMocks"
stateMock "github.com/ElrondNetwork/elrond-go/testscommon/state"
trieMock "github.com/ElrondNetwork/elrond-go/testscommon/trie"
Expand Down Expand Up @@ -149,7 +150,7 @@ func TestDirectStakedListProc_GetDelegatorsListShouldWork(t *testing.T) {
}

func createValidatorScAccount(address []byte, leaves [][]byte, rootHash []byte, timeSleep time.Duration) state.UserAccountHandler {
acc, _ := state.NewUserAccount(address, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(address, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
acc.SetDataTrie(&trieMock.TrieStub{
RootCalled: func() ([]byte, error) {
return rootHash, nil
Expand Down
9 changes: 5 additions & 4 deletions node/trieIterators/stakeValuesProcessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/ElrondNetwork/elrond-go/node/mock"
"github.com/ElrondNetwork/elrond-go/process"
"github.com/ElrondNetwork/elrond-go/state"
"github.com/ElrondNetwork/elrond-go/testscommon"
"github.com/ElrondNetwork/elrond-go/testscommon/hashingMocks"
stateMock "github.com/ElrondNetwork/elrond-go/testscommon/state"
trieMock "github.com/ElrondNetwork/elrond-go/testscommon/trie"
Expand Down Expand Up @@ -165,7 +166,7 @@ func TestTotalStakedValueProcessor_GetTotalStakedValue_CannotGetRootHash(t *test
t.Parallel()

expectedErr := errors.New("expected error")
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
acc.SetDataTrie(&trieMock.TrieStub{
RootCalled: func() ([]byte, error) {
return nil, expectedErr
Expand All @@ -191,7 +192,7 @@ func TestTotalStakedValueProcessor_GetTotalStakedValue_CannotGetRootHash(t *test
func TestTotalStakedValueProcessor_GetTotalStakedValue_ContextShouldTimeout(t *testing.T) {
t.Parallel()

acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
acc.SetDataTrie(&trieMock.TrieStub{
GetAllLeavesOnChannelCalled: func(leavesChannels *common.TrieIteratorChannels, _ context.Context, _ []byte, _ common.KeyBuilder) error {
time.Sleep(time.Second)
Expand Down Expand Up @@ -227,7 +228,7 @@ func TestTotalStakedValueProcessor_GetTotalStakedValue_CannotGetAllLeaves(t *tes
t.Parallel()

expectedErr := errors.New("expected error")
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
acc.SetDataTrie(&trieMock.TrieStub{
GetAllLeavesOnChannelCalled: func(_ *common.TrieIteratorChannels, _ context.Context, _ []byte, _ common.KeyBuilder) error {
return expectedErr
Expand Down Expand Up @@ -272,7 +273,7 @@ func TestTotalStakedValueProcessor_GetTotalStakedValue(t *testing.T) {
leafKey4 := "0123456783"
leafKey5 := "0123456780"
leafKey6 := "0123456788"
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount([]byte("newaddress"), &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
acc.SetDataTrie(&trieMock.TrieStub{
RootCalled: func() ([]byte, error) {
return rootHash, nil
Expand Down
2 changes: 1 addition & 1 deletion process/block/baseProcess.go
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,7 @@ func unmarshalUserAccount(
marshalizer marshal.Marshalizer,
hasher hashing.Hasher,
) (state.UserAccountHandler, error) {
userAccount, err := state.NewUserAccount(address, hasher)
userAccount, err := state.NewUserAccount(address, hasher, marshalizer)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions process/dataValidators/txValidator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
func getAccAdapter(nonce uint64, balance *big.Int) *stateMock.AccountsStub {
accDB := &stateMock.AccountsStub{}
accDB.GetExistingAccountCalled = func(address []byte) (handler vmcommon.AccountHandler, e error) {
acc, _ := state.NewUserAccount(address, &hashingMocks.HasherMock{})
acc, _ := state.NewUserAccount(address, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
acc.Nonce = nonce
acc.Balance = balance

Expand Down Expand Up @@ -331,7 +331,7 @@ func TestTxValidator_CheckTxValidityWrongAccountTypeShouldReturnFalse(t *testing

accDB := &stateMock.AccountsStub{}
accDB.GetExistingAccountCalled = func(address []byte) (handler vmcommon.AccountHandler, e error) {
return state.NewPeerAccount(address, &hashingMocks.HasherMock{})
return state.NewPeerAccount(address, &hashingMocks.HasherMock{}, &testscommon.MarshalizerMock{})
}
shardCoordinator := createMockCoordinator("_", 0)
maxNonceDeltaAllowed := 100
Expand Down
Loading