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

Send bitmap + epoch in outgoing operations #15

Open
wants to merge 3 commits into
base: feat/sovereign-cross-validators-changes
Choose a base branch
from

Conversation

mariusmihaic
Copy link
Contributor

@mariusmihaic mariusmihaic commented Jan 14, 2025

Append validators pub keys bitmap + epoch at the end of the register operation for cross chain txs from sov->main.
Epoch uint32 will be big endian converted to []byte

@mariusmihaic mariusmihaic self-assigned this Jan 14, 2025
@mariusmihaic mariusmihaic changed the base branch from main to feat/sovereign-cross-validators-changes January 17, 2025 14:30
@sasurobert sasurobert self-requested a review January 20, 2025 08:16
@@ -5,7 +5,9 @@ import (
"testing"

"github.com/multiversx/mx-chain-core-go/data/sovereign"

Copy link
Contributor

Choose a reason for hiding this comment

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

Wrong imports


return append(registerBridgeOpData, hashesHexEncodedArgs...)
bridgeDataArgs := []byte(
"@" + hex.EncodeToString(bridgeData.PubKeysBitmap) +
Copy link
Contributor

Choose a reason for hiding this comment

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

I would put PubKeysBitmap before or after AggregatedSignature, not at the end

return append(registerBridgeOpData, hashesHexEncodedArgs...)
bridgeDataArgs := []byte(
"@" + hex.EncodeToString(bridgeData.PubKeysBitmap) +
"@" + hex.EncodeToString(uint32ToBytes(bridgeData.Epoch)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need the Epoch?
Do we really need a to keep all the maps <epoch, validators> in the contract storage?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see now why we need to keep the history. Maybe there are unconfirmed operations sent in the epoch 1, but were signed by the validators in epoch 0

Choose a reason for hiding this comment

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

it is better to keep for at least 2-3 epochs.

return append(registerBridgeOpData, hashesHexEncodedArgs...)
bridgeDataArgs := []byte(
"@" + hex.EncodeToString(bridgeData.PubKeysBitmap) +
"@" + hex.EncodeToString(uint32ToBytes(bridgeData.Epoch)))

Choose a reason for hiding this comment

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

it is better to keep for at least 2-3 epochs.


return append(registerBridgeOpData, hashesHexEncodedArgs...)
bridgeDataArgs := []byte(
"@" + hex.EncodeToString(bridgeData.PubKeysBitmap) +
Copy link
Contributor

Choose a reason for hiding this comment

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

It's mandatory to have bitmap + epoch before hashesHexEncodedArgs so the contract can decode the arguments properly.

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.

3 participants