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

Update indexer version #5580

Merged
merged 6 commits into from
Sep 15, 2023
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
21 changes: 15 additions & 6 deletions genesis/parsing/accountsParser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package parsing

import (
"bytes"
"encoding/hex"
"fmt"
"math/big"

Expand Down Expand Up @@ -392,6 +393,8 @@ func (ap *accountsParser) setScrsTxsPool(
) {
for _, id := range indexingData {
for txHash, tx := range id.ScrsTxs {
hexEncodedTxHash := hex.EncodeToString([]byte(txHash))
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


senderShardID := shardCoordinator.ComputeId(tx.GetSndAddr())
receiverShardID := shardCoordinator.ComputeId(tx.GetRcvAddr())

Expand All @@ -401,11 +404,11 @@ func (ap *accountsParser) setScrsTxsPool(
}
scrTx.GasLimit = uint64(0)

txsPoolPerShard[senderShardID].SmartContractResults[txHash] = &outportcore.SCRInfo{
txsPoolPerShard[senderShardID].SmartContractResults[hexEncodedTxHash] = &outportcore.SCRInfo{
SmartContractResult: scrTx,
FeeInfo: &outportcore.FeeInfo{Fee: big.NewInt(0)},
}
txsPoolPerShard[receiverShardID].SmartContractResults[txHash] = &outportcore.SCRInfo{
txsPoolPerShard[receiverShardID].SmartContractResults[hexEncodedTxHash] = &outportcore.SCRInfo{
SmartContractResult: scrTx,
FeeInfo: &outportcore.FeeInfo{Fee: big.NewInt(0)},
}
Expand Down Expand Up @@ -442,14 +445,20 @@ func (ap *accountsParser) setTxsPoolAndMiniBlocks(
tx.Signature = []byte(common.GenesisTxSignatureString)
tx.GasLimit = uint64(0)

txsPoolPerShard[senderShardID].Transactions[string(txHash)] = &outportcore.TxInfo{
txsPoolPerShard[senderShardID].Transactions[hex.EncodeToString(txHash)] = &outportcore.TxInfo{
Transaction: tx,
FeeInfo: &outportcore.FeeInfo{Fee: big.NewInt(0)},
FeeInfo: &outportcore.FeeInfo{
Fee: big.NewInt(0),
InitialPaidFee: big.NewInt(0),
},
}

txsPoolPerShard[receiverShardID].Transactions[string(txHash)] = &outportcore.TxInfo{
txsPoolPerShard[receiverShardID].Transactions[hex.EncodeToString(txHash)] = &outportcore.TxInfo{
Transaction: tx,
FeeInfo: &outportcore.FeeInfo{Fee: big.NewInt(0)},
FeeInfo: &outportcore.FeeInfo{
Fee: big.NewInt(0),
InitialPaidFee: big.NewInt(0),
},
}

for _, miniBlock := range miniBlocks {
Expand Down
7 changes: 3 additions & 4 deletions genesis/parsing/accountsParser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,8 @@ func TestAccountsParser_setScrsTxsPool(t *testing.T) {

ap.SetScrsTxsPool(sharder, indexingDataMap, txsPoolPerShard)
assert.Equal(t, 1, len(txsPoolPerShard))
assert.Equal(t, uint64(0), txsPoolPerShard[0].SmartContractResults["hash"].SmartContractResult.GetGasLimit())
assert.Equal(t, uint64(1), txsPoolPerShard[0].SmartContractResults["hash"].SmartContractResult.GetNonce())
assert.Equal(t, uint64(0), txsPoolPerShard[0].SmartContractResults[hex.EncodeToString([]byte("hash"))].SmartContractResult.GetGasLimit())
assert.Equal(t, uint64(1), txsPoolPerShard[0].SmartContractResults[hex.EncodeToString([]byte("hash"))].SmartContractResult.GetNonce())
}

func TestAccountsParser_GenerateInitialTransactionsTxsPool(t *testing.T) {
Expand Down Expand Up @@ -729,7 +729,6 @@ func TestAccountsParser_GenerateInitialTransactionsVerifyTxsHashes(t *testing.T)
Signature: []byte(common.GenesisTxSignatureString),
}
hashHex := "cef3536e36ae01d3c84c97b0e6fae577f34c12c0cfdb51a04a2668afd5f5efe7"
txHash, err := hex.DecodeString(hashHex)
require.Nil(t, err)

indexingDataMap := make(map[uint32]*genesis.IndexingData)
Expand All @@ -746,7 +745,7 @@ func TestAccountsParser_GenerateInitialTransactionsVerifyTxsHashes(t *testing.T)
assert.Equal(t, 1, len(txsPoolPerShard[0].Transactions))

for hashString, v := range txsPoolPerShard[0].Transactions {
assert.Equal(t, txHash, []byte(hashString))
assert.Equal(t, hashHex, hashString)
assert.Equal(t, tx, v.Transaction)
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/multiversx/mx-chain-communication-go v1.0.6
github.com/multiversx/mx-chain-core-go v1.2.16
github.com/multiversx/mx-chain-crypto-go v1.2.8
github.com/multiversx/mx-chain-es-indexer-go v1.4.11
github.com/multiversx/mx-chain-es-indexer-go v1.4.12
github.com/multiversx/mx-chain-logger-go v1.0.13
github.com/multiversx/mx-chain-scenario-go v1.2.1
github.com/multiversx/mx-chain-storage-go v1.0.13
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ github.com/multiversx/mx-chain-core-go v1.2.16 h1:m0hUNmZQjGJxKDLQOHoM9jSaeDfVTb
github.com/multiversx/mx-chain-core-go v1.2.16/go.mod h1:BILOGHUOIG5dNNX8cgkzCNfDaVtoYrJRYcPnpxRMH84=
github.com/multiversx/mx-chain-crypto-go v1.2.8 h1:wOgVlUaO5X4L8iEbFjcQcL8SZvv6WZ7LqH73BiRPhxU=
github.com/multiversx/mx-chain-crypto-go v1.2.8/go.mod h1:fkaWKp1rbQN9wPKya5jeoRyC+c/SyN/NfggreyeBw+8=
github.com/multiversx/mx-chain-es-indexer-go v1.4.11 h1:fL/PdXaUXMt7S12gRvTZKs2dhVOVFm24wUcNTiCYKvM=
github.com/multiversx/mx-chain-es-indexer-go v1.4.11/go.mod h1:4HIWP7q8+yee/W28s4CtpjgrIXPlPeojDTa5qUVDHO8=
github.com/multiversx/mx-chain-es-indexer-go v1.4.12 h1:KpKcflrXEFXRjWOSIjytNgvSsxl9J/YvyhvoDQR9Pto=
github.com/multiversx/mx-chain-es-indexer-go v1.4.12/go.mod h1:4HIWP7q8+yee/W28s4CtpjgrIXPlPeojDTa5qUVDHO8=
github.com/multiversx/mx-chain-logger-go v1.0.13 h1:eru/TETo0MkO4ZTnXsQDKf4PBRpAXmqjT02klNT/JnY=
github.com/multiversx/mx-chain-logger-go v1.0.13/go.mod h1:MZJhTAtZTJxT+yK2EHc4ZW3YOHUc1UdjCD0iahRNBZk=
github.com/multiversx/mx-chain-scenario-go v1.2.1 h1:9eC6VcOEAKRRKZ7EbSWPLzCdNIMWwuNBtAZlgR4cSMA=
Expand Down