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/index genesis transactions #3639

Merged
merged 62 commits into from
Dec 21, 2021
Merged

Conversation

AdoAdoAdo
Copy link
Contributor

@AdoAdoAdo AdoAdoAdo commented Dec 10, 2021

Index genesis transactions and miniblocks:

  • created mint transactions
  • collect delegation/stake transactions from genesis
  • collect scrs from genesis
  • index transaction pools (txs and scrs) and miniblocks

ssd04 and others added 30 commits November 7, 2021 19:47
@@ -16,6 +16,7 @@
{Year = 11, MaximumInflation = 0.0},
]
Denomination = 18 # represents the smallest eGLD subdivision (10^-X eGLD for a denomination of X)
GenesisMintingSenderAddress = "erd17rc0pu8s7rc0pu8s7rc0pu8s7rc0pu8s7rc0pu8s7rc0pu8s7rcqqkhty3"
Copy link
Contributor

Choose a reason for hiding this comment

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

== "f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0" in hex

we could have this in the /examples/address_test.go

Copy link
Contributor

Choose a reason for hiding this comment

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

done

txs := make([]coreData.TransactionHandler, 0, len(ap.initialAccounts))

var nonce uint64 = 0
for _, ia := range ap.initialAccounts {
Copy link
Contributor

Choose a reason for hiding this comment

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

for nonce, ia := range ap.initialAccounts {
    tx := ap.createMintTransaction(ia, uint64(nonce))
    txs = append(txs, tx)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

done

txsPoolPerShard[receiverShardID].Txs[string(txHash)] = tx

for _, miniBlock := range miniBlocks {
if (senderShardID == miniBlock.GetSenderShardID()) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

could have used a bool var. The parenthesis can be removed

Copy link
Contributor

Choose a reason for hiding this comment

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

done

var indexMiniBlocks = make([]*dataBlock.MiniBlock, 0)

for _, miniBlock := range miniBlocks {
if (miniBlock.GetSenderShardID() == shardId) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

could have used a bool var. Useless parenthesis

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

_, err := tep.txProcessor.ProcessTransaction(tx)
return err
}

// GetTransactions will return the cached transactions
func (tep *txExecutionProcessor) GetTransactions() []data.TransactionHandler {
Copy link
Contributor

Choose a reason for hiding this comment

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

could have been named: GetExecutedTransactions

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

DeployInitialScTxs: make([]data.TransactionHandler, 0),
}

return metaHdr, make([][]byte, 0), indexingData, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

so we do not index the resulted transactions after a hardfork

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not in this PR, as it is difficult to test at this moment.
There is some work to be done on the hardfork, but we could add a TODO

pubkeyConverter core.PubkeyConverter
keyGenerator crypto.KeyGenerator
hasher hashing.Hasher
marshalizer marshal.Marshalizer
}

// NewAccountsParser creates a new decoded accounts genesis structure from json config file
func NewAccountsParser(
genesisFilePath string,
Copy link
Contributor

Choose a reason for hiding this comment

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

could have switched to an argument DTO

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

bogdan-rosianu
bogdan-rosianu previously approved these changes Dec 16, 2021
iulianpascalau
iulianpascalau previously approved these changes Dec 17, 2021
Copy link
Contributor

@LucianMincu LucianMincu left a comment

Choose a reason for hiding this comment

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

System tests passed.

@ssd04 ssd04 merged commit 865afd1 into development Dec 21, 2021
@ssd04 ssd04 deleted the feat/index-genesis-transactions branch December 21, 2021 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants