-
Notifications
You must be signed in to change notification settings - Fork 198
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
Mx 15792 esdt prefix updates and fixes #6466
base: feat/esdt-prefix
Are you sure you want to change the base?
Mx 15792 esdt prefix updates and fixes #6466
Conversation
…-fixes' into MX-15792-esdt-prefix-updates-and-fixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not merge commented untested code
type crossChainTokenChecker struct { | ||
} | ||
|
||
func NewCrossChainTokenChecker() *crossChainTokenChecker { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing comm
return &crossChainTokenChecker{} | ||
} | ||
|
||
// IsCrossChainOperation does nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// IsCrossChainOperation does nothing | |
// IsCrossChainOperation returns false |
return false | ||
} | ||
|
||
// IsCrossChainOperationAllowed does nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// IsCrossChainOperationAllowed does nothing | |
// IsCrossChainOperationAllowed returns false nothing |
} | ||
|
||
// IsCrossChainOperation does nothing | ||
func (ctc *crossChainTokenChecker) IsCrossChainOperation(tokenID []byte) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (ctc *crossChainTokenChecker) IsCrossChainOperation(tokenID []byte) bool { | |
func (ctc *crossChainTokenChecker) IsCrossChainOperation(_ []byte) bool { |
} | ||
|
||
// IsCrossChainOperationAllowed does nothing | ||
func (ctc *crossChainTokenChecker) IsCrossChainOperationAllowed(address []byte, tokenID []byte) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (ctc *crossChainTokenChecker) IsCrossChainOperationAllowed(address []byte, tokenID []byte) bool { | |
func (ctc *crossChainTokenChecker) IsCrossChainOperationAllowed(_ []byte, _ []byte) bool { |
nftV2 := sovChainPrefix + "-NFTV2-a1b2c3" | ||
nftV2Nonce := uint64(10) | ||
token := sovChainPrefix + "-TKN-1q2w3e" | ||
|
||
bridgedInTokens := make([]chainSim.ArgsDepositToken, 0) | ||
bridgedInTokens = append(bridgedInTokens, chainSim.ArgsDepositToken{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were these removed from these tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NonFungible
type is not accepted anymore
@@ -38,7 +39,7 @@ func TestChainSimulator_ExecuteMintBurnBridgeOpForESDTTokensWithPrefixAndTransfe | |||
BypassTxSignatureCheck: true, | |||
TempDir: t.TempDir(), | |||
PathToInitialConfig: defaultPathToInitialConfig, | |||
NumOfShards: 1, | |||
NumOfShards: 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Amount: big.NewInt(1), | ||
Type: core.NonFungibleV2, | ||
}) | ||
//bridgedInTokens = append(bridgedInTokens, chainSim.ArgsDepositToken{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not ok.
We should not merge commented untested code !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the TODO says, the contract uses structs from the rust framework and we need to wait for rust framework to be updated to accept all new esdt types. I will create another PR with tests for create/burn for all esdt types but on different contract that is not using framework structs.
checkTokenDataInAccount(t, cs, token, esdtSafeEncoded, big.NewInt(0)) | ||
receiverToken.Amount = remainingTokenAmount | ||
|
||
if remainingTokenAmount.Cmp(big.NewInt(0)) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why make this "same shard" transfer based on remaining amount?
You seem to always send tokens above to receiver
, then in "same shard" you also send from receiver
, so you should always have tokens in receiver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The
wallet
in shard 0 sends tokens toreceiver
in shard 2 - The
receiver
will deposit (burn) in the bridge contract in shard 1 - The
receiver
in shard 2 sends tokens toreceiver2
in same shard
This check is to skip the NFT tokens because after deposit quantity is 0
chainSim.TransferESDT(t, cs, sender.Bytes, receiver.Bytes, senderNonce, token.Identifier, amountToSend) | ||
} else { | ||
chainSim.TransferESDTNFT(t, cs, sender.Bytes, receiver.Bytes, senderNonce, token.Identifier, token.Nonce, amountToSend) | ||
err := cs.GenerateBlocks(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why generate extra blocks here?
Because cross shard txs? And why it works for TransferESDT
without generated blocks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For NFT transfer, sender == receiver in arguments and actual receiver is in input data in tx. So the chain simulator verifies the status on the same shard and is successful in 1 block. Then I need to wait 3 more blocks so the actual receiver will receive the tokens because is in different shard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just what Marius said
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?