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

Added copying for metablocks too #27

Open
wants to merge 3 commits into
base: feat/hyperblock
Choose a base branch
from
Open

Conversation

cristure
Copy link

Added whole copying mechanism similar to the one in shard blocks due to a serialization issue of hashes in proto.

@cristure cristure changed the base branch from main to feat/hyperblock December 20, 2024 14:14
ssd04
ssd04 previously approved these changes Dec 23, 2024
@ssd04 ssd04 dismissed their stale review December 23, 2024 13:19

mistake


// check if the header type is supported by this function.
if headerType != string(core.MetaHeader) {
return nil, fmt.Errorf("cannot convert to meta outport block. header type: %s not supported", outportBlock.BlockData.HeaderType)
Copy link

Choose a reason for hiding this comment

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

Suggested change
return nil, fmt.Errorf("cannot convert to meta outport block. header type: %s not supported", outportBlock.BlockData.HeaderType)
return nil, fmt.Errorf("cannot convert to meta outport block. header type: %s not supported", headerType)

use headerType here?

Comment on lines +360 to +363
return nil, nil
}
if len(outportTxPool.Transactions) == 0 {
return nil, nil
Copy link

Choose a reason for hiding this comment

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

i don't think it is fine to return here nil, nil

Copy link

Choose a reason for hiding this comment

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

maybe at least an empty TransactionPool

}, nil
}

func (o *outportBlockConverter) handleTransactionPoolV2(outportTxPool *outport.TransactionPool) (*hyperOutportBlocks.TransactionPoolV2, error) {
Copy link

Choose a reason for hiding this comment

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

same in this func

@@ -535,7 +674,71 @@ func (o *outportBlockConverter) HandleShardOutportBlock(outportBlock *outport.Ou
return shardOutportBlock, nil
}

func (o *outportBlockConverter) copyTransactions(sourceTxs map[string]*outport.TxInfo, transactionPool *hyperOutportBlocks.TransactionPoolV2) error {
func (o *outportBlockConverter) copyTransactions(sourceTxs map[string]*outport.TxInfo) (map[string]*hyperOutportBlocks.TxInfo, error) {
Copy link

Choose a reason for hiding this comment

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

for copyTransactions we return txs and for copyTransactionsV2 we pass the map and modify it, can we have the same approach?

return txInfo, nil
}

func (o *outportBlockConverter) copyTransactionsV2(sourceTxs map[string]*outport.TxInfo, transactionPool *hyperOutportBlocks.TransactionPoolV2) error {
Copy link

Choose a reason for hiding this comment

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

why do we still need copyTransactions v1 and v2?

Copy link

Choose a reason for hiding this comment

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

same for other copies

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.

2 participants