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/esdt prefix #6137

Open
wants to merge 149 commits into
base: rc/v1.7.next1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
422b11e
FEAT: Prefixed issued esdts
mariusmihaic Mar 22, 2024
b0db492
FEAT: Unit test prefixed issued esdts
mariusmihaic Mar 22, 2024
7cbb6dc
FEAT: Ugly working test for issue tokens with prefix
mariusmihaic Mar 22, 2024
ee2fada
FIX: Check token prefix
mariusmihaic Apr 16, 2024
e84b455
FIX: Token parser + cln issue token test
mariusmihaic Apr 16, 2024
226c2ca
FEAT: Move common esdt checks in common/tokens
mariusmihaic Apr 16, 2024
8625f16
CLN: Tests + esdt_test.go
mariusmihaic Apr 16, 2024
c24ae5c
FIX: Package
mariusmihaic Apr 16, 2024
4f0e551
Merge branch 'rc/v1.7.next1' into MX-15302-prefix-issue-esdt
mariusmihaic Apr 16, 2024
e577fd9
CLN: Test
mariusmihaic Apr 16, 2024
c42bfd3
FIX: Check minLengthESDTPrefix
mariusmihaic Apr 17, 2024
e6280f0
FIX: Linter
mariusmihaic Apr 17, 2024
7eed4e0
Merge branch 'rc/v1.7.next1' into MX-15302-prefix-issue-esdt
mariusmihaic Apr 22, 2024
5d78e8b
FIX: isUpperCase variable name
mariusmihaic Apr 22, 2024
f010ba4
Merge pull request #6059 from multiversx/MX-15302-prefix-issue-esdt
mariusmihaic Apr 23, 2024
733cceb
Merge branch 'rc/v1.7.next1' into merge-rc-1-7-next-into-feat-esdt-pr…
mariusmihaic May 15, 2024
fde5993
Merge pull request #6169 from multiversx/merge-rc-1-7-next-into-feat-…
mariusmihaic May 15, 2024
e32fb34
CLN: Move esdt utility to core + fix test
mariusmihaic May 15, 2024
25216ba
Merge branch 'feat/esdt-prefix' into MX-15387-token-prefix-common-core
mariusmihaic May 15, 2024
900beb7
Merge pull request #6170 from multiversx/MX-15387-token-prefix-common…
mariusmihaic May 17, 2024
0c118bb
FEAT: Integrate white listed cross chain mint addresses
mariusmihaic May 17, 2024
03c4534
Merge branch 'rc/v1.7.next1' into merge-rc-1-7-next-feat-esdt-prefix-…
mariusmihaic May 17, 2024
0b6436c
Merge branch 'merge-rc-1-7-next-feat-esdt-prefix-17-may-2024' into MX…
mariusmihaic May 17, 2024
9b3f50e
FIX: Go mod vm common
mariusmihaic May 17, 2024
f8d7b8a
Merge pull request #6178 from multiversx/merge-rc-1-7-next-feat-esdt-…
mariusmihaic May 17, 2024
45023f0
Merge branch 'feat/esdt-prefix' into MX-15445-integrate-local-mint-bu…
mariusmihaic May 17, 2024
df057f8
FIX: Unit tests
mariusmihaic May 17, 2024
b761656
FIX: Import cyclce
mariusmihaic May 17, 2024
72e7eaa
bridge test
axenteoctavian May 17, 2024
f1b23c5
FIX: Test
mariusmihaic May 17, 2024
e66af7e
update test with burn
axenteoctavian May 17, 2024
935d5bd
FEAT: New vm common version
mariusmihaic May 20, 2024
2ed6e2d
Merge branch 'MX-15445-integrate-local-mint-burn-vm-common' into esdt…
mariusmihaic May 20, 2024
66cfdcb
FIX: Use TransferAndExecuteByUser addresses
mariusmihaic May 28, 2024
cd7a6f0
CLN: Decode addresses inside factory
mariusmihaic May 28, 2024
b67602f
CLN: Factory + util func
mariusmihaic May 28, 2024
0606ebb
FIX: Unit tests
mariusmihaic May 28, 2024
6c02452
FIX: New vm common
mariusmihaic May 28, 2024
ea761a7
FIX: Renaming
mariusmihaic May 31, 2024
cce6bd5
Merge branch 'rc/v1.7.next1' into merge-rc-1-7-next-1-into-esdt-prefi…
mariusmihaic May 31, 2024
bc10807
Merge pull request #6177 from multiversx/MX-15445-integrate-local-min…
mariusmihaic May 31, 2024
cd0536e
Merge branch 'feat/esdt-prefix' into merge-rc-1-7-next-1-into-esdt-pr…
mariusmihaic May 31, 2024
df7604d
Merge pull request #6224 from multiversx/merge-rc-1-7-next-1-into-esd…
mariusmihaic May 31, 2024
1f11946
Merge branch 'feat/esdt-prefix' into esdt-prefix-bridge
mariusmihaic May 31, 2024
ea20d64
CLN: Refactor test
mariusmihaic Jun 3, 2024
e4c6ed1
CLN: Refactor test 2
mariusmihaic Jun 3, 2024
84692eb
CLN: Refactor test 3
mariusmihaic Jun 3, 2024
8daf819
CLN: Refactor test 4
mariusmihaic Jun 3, 2024
744941b
Merge branch 'rc/v1.7.next1' into merge-rc-1-7-next-1-into-feat-esdt-…
mariusmihaic Jun 4, 2024
8a2452b
Merge pull request #6234 from multiversx/merge-rc-1-7-next-1-into-fea…
mariusmihaic Jun 4, 2024
a990865
FIX: Destination shard id in chain simulator and tests with 3 shards
mariusmihaic Jun 4, 2024
76f5f71
ESDT prefix new tests for nft/sft
axenteoctavian Jun 4, 2024
02e5bd8
execute and burn funcs updates
axenteoctavian Jun 5, 2024
3649f62
execute and burn funcs updates
axenteoctavian Jun 5, 2024
d87ef52
FIX: Destination shard id in chain simulator for meta chain addresses 2
mariusmihaic Jun 5, 2024
6152378
FIX: Destination shard id in chain simulator for meta chain addresses 3
mariusmihaic Jun 5, 2024
6febde1
FIX: Destination shard id in chain simulator for meta chain addresses 3
mariusmihaic Jun 5, 2024
cd844f1
token id concat with nonce
axenteoctavian Jun 5, 2024
0a06f17
FIX: ExtractTokenIDAndNonceFromTokenStorageKey for prefixed tokens
mariusmihaic Jun 5, 2024
10b2917
tests updates
axenteoctavian Jun 5, 2024
280cb00
FIX: ExtractTokenIDAndNonceFromTokenStorageKey for prefixed tokens 2
mariusmihaic Jun 6, 2024
cd3ae59
FIX: adjustNftTokenIdentifier
mariusmihaic Jun 6, 2024
9e2125f
Merge branch 'feat/esdt-prefix' into esdt-prefix-bridge
mariusmihaic Jun 6, 2024
4074292
Merge branch 'esdt-prefix-bridge' into MX-15529-esdt-prefix-new-tests
axenteoctavian Jun 6, 2024
5875e51
Merge branch 'MX-13857-bugfix-extract-token-prefixed-nonce' into MX-1…
axenteoctavian Jun 6, 2024
28aa45d
fix after merge
axenteoctavian Jun 6, 2024
daad835
fix after testing
axenteoctavian Jun 6, 2024
d38c31b
little updates
axenteoctavian Jun 6, 2024
379c8db
Merge pull request #6183 from multiversx/esdt-prefix-bridge
mariusmihaic Jun 7, 2024
f29fd83
Merge branch 'feat/esdt-prefix' into MX-13857-bugfix-extract-token-pr…
mariusmihaic Jun 7, 2024
5b8e900
Merge branch 'feat/esdt-prefix' into MX-15529-esdt-prefix-new-tests
axenteoctavian Jun 10, 2024
46aadc8
Merge pull request #6241 from multiversx/MX-13857-bugfix-extract-toke…
mariusmihaic Jun 10, 2024
577501e
Merge branch 'feat/esdt-prefix' into MX-15529-esdt-prefix-new-tests
axenteoctavian Jun 10, 2024
bb8b894
fix imports
axenteoctavian Jun 10, 2024
92eddd3
Merge remote-tracking branch 'origin/MX-15529-esdt-prefix-new-tests' …
axenteoctavian Jun 10, 2024
4584388
fixes after review
axenteoctavian Jun 10, 2024
97ad7cc
fixes after review
axenteoctavian Jun 10, 2024
b7a5bc4
new vm common version, nonce updates
axenteoctavian Jun 10, 2024
d768a35
tests updates
axenteoctavian Jun 11, 2024
ebf8dca
nft mint with original creator
axenteoctavian Jun 13, 2024
2dbe4bc
Merge pull request #6243 from multiversx/MX-15529-esdt-prefix-new-tests
axenteoctavian Jun 13, 2024
45369ae
Merge branch 'rc/v1.7.next1' into merge-rc-1-7-next-into-feat-esdt-pr…
mariusmihaic Jul 5, 2024
a01794d
FIX: Go mod
mariusmihaic Jul 5, 2024
74b93b1
FIX: Tests after merge
mariusmihaic Jul 5, 2024
e387303
fix TokenData arg in execute and display correct log event error
axenteoctavian Jul 5, 2024
db0e8ad
Merge pull request #6295 from multiversx/merge-rc-1-7-next-into-feat-…
mariusmihaic Jul 8, 2024
77a6cd5
Testing and refactor for enshrine esdt-safe contract
axenteoctavian Jul 9, 2024
3058ef0
FIX: Linter unused var
mariusmihaic Jul 10, 2024
eb76f80
Merge pull request #6308 from multiversx/fix-linter-feat-esdt-prefix
mariusmihaic Jul 10, 2024
1b6a4b4
tests update and transfer and execute test
axenteoctavian Jul 16, 2024
c2d81a3
more esdt prefix scenarios and refactor
axenteoctavian Jul 17, 2024
64e5a3d
Merge branch 'feat/esdt-prefix' into MX-15634-enshrine-esdt-safe-tests
axenteoctavian Jul 17, 2024
2f384cd
Merge branch 'feat/esdt-prefix' into MX-15634-enshrine-esdt-safe-tests
axenteoctavian Jul 17, 2024
c74f279
more fixes
axenteoctavian Jul 17, 2024
df3d4e6
Merge remote-tracking branch 'origin/MX-15634-enshrine-esdt-safe-test…
axenteoctavian Jul 17, 2024
dd26214
fix linter
axenteoctavian Jul 17, 2024
7a38e1f
fix tests
axenteoctavian Jul 18, 2024
7f7afac
tests updates
axenteoctavian Jul 18, 2024
675db74
fixes after review
axenteoctavian Jul 18, 2024
51f02e9
litner fix
axenteoctavian Jul 18, 2024
d921a36
func rename
axenteoctavian Jul 29, 2024
1d0e7ac
Merge pull request #6304 from multiversx/MX-15634-enshrine-esdt-safe-…
axenteoctavian Jul 29, 2024
cf64dc8
Merge branch 'rc/v1.7.next1' into merge-rc-1-7-next-into-esdt-prefix-…
axenteoctavian Jul 30, 2024
3c3a301
update go.mod
axenteoctavian Jul 30, 2024
b300d80
Merge pull request #6352 from multiversx/merge-rc-1-7-next-into-esdt-…
axenteoctavian Jul 30, 2024
7bc58f5
tests with token type and metadata checks in accounts
axenteoctavian Jul 30, 2024
f9ce197
Merge branch 'feat/esdt-prefix' into MX-15692-nft-create-token-type
axenteoctavian Jul 30, 2024
973a061
update go.mod
axenteoctavian Jul 30, 2024
3bf2720
update epoch in test
axenteoctavian Jul 31, 2024
0542c90
update go.mod
axenteoctavian Jul 31, 2024
91354d0
update go.mod
axenteoctavian Jul 31, 2024
2d42f6b
Merge pull request #6355 from multiversx/MX-15692-nft-create-token-type
axenteoctavian Jul 31, 2024
fe0b43d
Merge branch 'rc/v1.7.next1' into merge-rc-1-7-next-into-esdt-prefix-…
axenteoctavian Aug 1, 2024
861a306
fixes after merge
axenteoctavian Aug 1, 2024
733578f
Merge pull request #6364 from multiversx/merge-rc-1-7-next-into-esdt-…
elvisboghiu Aug 1, 2024
37a7eae
Merge branch 'rc/v1.7.next1' into merge-rc-1-7-next-into-esdt-prefix-…
axenteoctavian Aug 12, 2024
fb00408
go.mod for esdt-prefix
axenteoctavian Aug 12, 2024
580dc2d
Merge pull request #6385 from multiversx/merge-rc-1-7-next-into-esdt-…
axenteoctavian Aug 13, 2024
a07265a
Merge branch 'rc/v1.7.next1' into merge-rc-1-7-next-into-esdt-prefix-…
axenteoctavian Sep 17, 2024
b3a612c
go.mod vm-common from esdt-prefix
axenteoctavian Sep 17, 2024
bf653bf
skil failing test, to be resolved in the next PR
axenteoctavian Sep 17, 2024
59358f5
new go.mod, cross chain token checker disabled component
axenteoctavian Sep 17, 2024
14f1f92
esdt-prefix tests refactored and improved
axenteoctavian Sep 17, 2024
e8907ad
Merge pull request #6464 from multiversx/merge-rc-1-7-next-into-esdt-…
axenteoctavian Sep 17, 2024
80fff60
added a TODO
axenteoctavian Sep 17, 2024
4bdaf79
Merge branch 'feat/esdt-prefix' into MX-15792-esdt-prefix-updates-and…
axenteoctavian Sep 17, 2024
b54e3f9
removed NonFungible from test because is not accepted anymore
axenteoctavian Sep 17, 2024
f027e62
Merge remote-tracking branch 'origin/MX-15792-esdt-prefix-updates-and…
axenteoctavian Sep 17, 2024
51d000a
more esdt prefix tests on another contract
axenteoctavian Sep 18, 2024
2e46704
fixes after review
axenteoctavian Sep 18, 2024
058d11d
new go.mod after fixes
axenteoctavian Sep 18, 2024
8d9d6ba
Merge branch 'MX-15792-esdt-prefix-updates-and-fixes' into MX-15792-e…
axenteoctavian Sep 18, 2024
daef97b
error messages fix
axenteoctavian Sep 19, 2024
1972b33
run chain simulator tests with long test only
axenteoctavian Sep 19, 2024
58440d1
fixes after review, using real cross chain token checker
axenteoctavian Sep 20, 2024
6a19389
Merge branch 'MX-15792-esdt-prefix-updates-and-fixes' into MX-15792-e…
axenteoctavian Sep 23, 2024
68a735c
unit test for coverage
axenteoctavian Sep 23, 2024
886b239
Merge branch 'MX-15792-esdt-prefix-updates-and-fixes' into MX-15792-e…
axenteoctavian Sep 23, 2024
fc318ae
fixes after review
axenteoctavian Sep 23, 2024
417b90c
removed parallel execution for chain simulator tests
axenteoctavian Sep 23, 2024
53e45ee
new go.mod for esdt-prefix
axenteoctavian Sep 24, 2024
b0f64f3
Merge branch 'MX-15792-esdt-prefix-updates-and-fixes' into MX-15792-e…
axenteoctavian Sep 24, 2024
a7ae7a9
Merge pull request #6466 from multiversx/MX-15792-esdt-prefix-updates…
axenteoctavian Sep 25, 2024
6f18a51
Merge branch 'feat/esdt-prefix' into MX-15792-esdt-prefix-more-tests
axenteoctavian Sep 25, 2024
fe60ad9
fix linter issue
axenteoctavian Sep 25, 2024
e6160f7
Merge pull request #6478 from multiversx/MX-15792-esdt-prefix-more-tests
axenteoctavian Sep 25, 2024
0ed9401
Merge remote-tracking branch 'origin/rc/v1.7.next1' into merge-1-7-ne…
axenteoctavian Sep 25, 2024
bf14142
go.mod for esdt-prefix
axenteoctavian Sep 25, 2024
6dc2dda
Merge pull request #6498 from multiversx/merge-1-7-next-into-esdt-pre…
axenteoctavian Sep 25, 2024
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
1 change: 1 addition & 0 deletions cmd/node/config/systemSmartContractsConfig.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
[ESDTSystemSCConfig]
BaseIssuingCost = "5000000000000000000" #5 eGLD
OwnerAddress = "erd1fpkcgel4gcmh8zqqdt043yfcn5tyx8373kg6q2qmkxzu4dqamc0swts65c"
ESDTPrefix = ""

[GovernanceSystemSCConfig]
OwnerAddress = "erd1vxy22x0fj4zv6hktmydg8vpfh6euv02cz4yg0aaws6rrad5a5awqgqky80" #should use a multisign contract instead of a wallet address
Expand Down
48 changes: 35 additions & 13 deletions common/tokensParser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package common
import (
"math/big"
"strings"

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

const (
Expand All @@ -11,12 +13,6 @@ const (

// separatorChar represents the character that separated the token ticker by the random sequence
separatorChar = "-"

// minLengthForTickerName represents the minimum number of characters a token's ticker can have
minLengthForTickerName = 3

// maxLengthForTickerName represents the maximum number of characters a token's ticker can have
maxLengthForTickerName = 10
)

// TODO: move this to core
Expand All @@ -33,16 +29,13 @@ func ExtractTokenIDAndNonceFromTokenStorageKey(tokenKey []byte) ([]byte, uint64)
return tokenKey, 0
}

tokenTicker := token[:indexOfFirstHyphen]
randomSequencePlusNonce := token[indexOfFirstHyphen+1:]
indexOfTokenHyphen := getIndexOfTokenHyphen(token, indexOfFirstHyphen)
tokenTicker := token[:indexOfTokenHyphen]
randomSequencePlusNonce := token[indexOfTokenHyphen+1:]

tokenTickerLen := len(tokenTicker)

areTickerAndRandomSequenceInvalid := tokenTickerLen == 0 ||
tokenTickerLen < minLengthForTickerName ||
tokenTickerLen > maxLengthForTickerName ||
len(randomSequencePlusNonce) == 0

areTickerAndRandomSequenceInvalid := !esdt.IsTokenTickerLenCorrect(tokenTickerLen) || len(randomSequencePlusNonce) == 0
if areTickerAndRandomSequenceInvalid {
return tokenKey, 0
}
Expand All @@ -60,3 +53,32 @@ func ExtractTokenIDAndNonceFromTokenStorageKey(tokenKey []byte) ([]byte, uint64)

return []byte(tokenID), nonceBigInt.Uint64()
}

func getIndexOfTokenHyphen(token string, indexOfFirstHyphen int) int {
if !isValidPrefixedToken(token) {
return indexOfFirstHyphen
}

indexOfSecondHyphen := strings.Index(token[indexOfFirstHyphen+1:], separatorChar)
return indexOfSecondHyphen + indexOfFirstHyphen + 1
}

func isValidPrefixedToken(token string) bool {
tokenSplit := strings.Split(token, separatorChar)
if len(tokenSplit) < 3 {
return false
}

prefix := tokenSplit[0]
if !esdt.IsValidTokenPrefix(prefix) {
return false
}

tokenTicker := tokenSplit[1]
if !esdt.IsTickerValid(tokenTicker) {
return false
}

tokenRandSeq := tokenSplit[2]
return len(tokenRandSeq) >= esdtTickerNumRandChars
}
10 changes: 10 additions & 0 deletions common/tokensParser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ func TestExtractTokenIDAndNonceFromTokenStorageKey(t *testing.T) {
// "-" represents nonce 45 and should not be treated as a separator
checkTickerAndNonceExtraction(t, "EGLDMEXF-8aa8b6-", "EGLDMEXF-8aa8b6", 45)
})

t.Run("prefixed tokens", func(t *testing.T) {
t.Parallel()

checkTickerAndNonceExtraction(t, "pref-ALC-1q2w3e", "pref-ALC-1q2w3e", 0)
checkTickerAndNonceExtraction(t, "pf1-ALC-1q2w3e", "pf1-ALC-1q2w3e", 0)

checkTickerAndNonceExtraction(t, "sv1-TKN-1q2w3e4", "sv1-TKN-1q2w3e", 52)

Choose a reason for hiding this comment

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

We also need tests with min/max characters for prefix and min/max characters for ticker, and combination of these.

checkTickerAndNonceExtraction(t, "sv1-TKN-1q2w3e-", "sv1-TKN-1q2w3e", 45)
})
}

func checkTickerAndNonceExtraction(t *testing.T, input string, expectedTicker string, expectedNonce uint64) {
Expand Down
1 change: 1 addition & 0 deletions config/systemSmartContractsConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type StakingSystemSCConfig struct {
type ESDTSystemSCConfig struct {
BaseIssuingCost string
OwnerAddress string
ESDTPrefix string
}

// GovernanceSystemSCConfigV1 holds the initial set of values that were used to initialise the
Expand Down
3 changes: 3 additions & 0 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,3 +598,6 @@ var ErrNilSentSignatureTracker = errors.New("nil sent signature tracker")

// ErrNilEpochSystemSCProcessor defines the error for setting a nil EpochSystemSCProcessor
var ErrNilEpochSystemSCProcessor = errors.New("nil epoch system SC processor")

// ErrInvalidTokenPrefix signals that an invalid token prefix has been provided
var ErrInvalidTokenPrefix = errors.New("invalid token prefix, should have max 4 (lowercase/alphanumeric) characters")
60 changes: 28 additions & 32 deletions factory/api/apiResolverFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,6 @@ func CreateApiResolver(args *ApiResolverArgs) (facade.ApiResolver, error) {
return nil, errDecode
}

dnsV2AddressesStrings := args.Configs.GeneralConfig.BuiltInFunctions.DNSV2Addresses
convertedDNSV2Addresses, errDecode := factory.DecodeAddresses(pkConverter, dnsV2AddressesStrings)
if errDecode != nil {
return nil, errDecode
}

builtInFuncFactory, err := createBuiltinFuncs(
args.GasScheduleNotifier,
args.CoreComponents.InternalMarshalizer(),
Expand All @@ -161,7 +155,10 @@ func CreateApiResolver(args *ApiResolverArgs) (facade.ApiResolver, error) {
args.BootstrapComponents.GuardedAccountHandler(),
convertedAddresses,
args.Configs.GeneralConfig.BuiltInFunctions.MaxNumAddressesInTransferRole,
convertedDNSV2Addresses,
args.Configs.GeneralConfig.BuiltInFunctions.DNSV2Addresses,
args.Configs.GeneralConfig.VirtualMachine.Querying.TransferAndExecuteByUserAddresses,
[]byte(args.Configs.SystemSCConfig.ESDTSystemSCConfig.ESDTPrefix),
pkConverter,
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -350,12 +347,6 @@ func createScQueryElement(
return nil, nil, errDecode
}

dnsV2AddressesStrings := args.generalConfig.BuiltInFunctions.DNSV2Addresses
convertedDNSV2Addresses, errDecode := factory.DecodeAddresses(pkConverter, dnsV2AddressesStrings)
if errDecode != nil {
return nil, nil, errDecode
}

apiBlockchain, err := createBlockchainForScQuery(selfShardID)
if err != nil {
return nil, nil, err
Expand All @@ -376,7 +367,10 @@ func createScQueryElement(
args.guardedAccountHandler,
convertedAddresses,
args.generalConfig.BuiltInFunctions.MaxNumAddressesInTransferRole,
convertedDNSV2Addresses,
args.generalConfig.BuiltInFunctions.DNSV2Addresses,
args.generalConfig.VirtualMachine.Querying.TransferAndExecuteByUserAddresses,
[]byte(args.systemSCConfig.ESDTSystemSCConfig.ESDTPrefix),
pkConverter,
)
if err != nil {
return nil, nil, err
Expand Down Expand Up @@ -640,32 +634,34 @@ func newStoragePruningManager(args scQueryElementArgs) (state.StoragePruningMana
func createBuiltinFuncs(
gasScheduleNotifier core.GasScheduleNotifier,
marshalizer marshal.Marshalizer,
accnts state.AccountsAdapter,
accounts state.AccountsAdapter,
shardCoordinator sharding.Coordinator,
epochNotifier vmcommon.EpochNotifier,
enableEpochsHandler vmcommon.EnableEpochsHandler,
guardedAccountHandler vmcommon.GuardedAccountHandler,
automaticCrawlerAddresses [][]byte,
maxNumAddressesInTransferRole uint32,
dnsV2Addresses [][]byte,
dnsV2Addresses []string,
whiteListedCrossChainAddresses []string,
selfESDTPrefix []byte,
pubKeyConverter core.PubkeyConverter,
) (vmcommon.BuiltInFunctionFactory, error) {
mapDNSV2Addresses := make(map[string]struct{})
for _, address := range dnsV2Addresses {
mapDNSV2Addresses[string(address)] = struct{}{}
}

argsBuiltIn := builtInFunctions.ArgsCreateBuiltInFunctionContainer{
GasSchedule: gasScheduleNotifier,
MapDNSAddresses: make(map[string]struct{}),
MapDNSV2Addresses: mapDNSV2Addresses,
Marshalizer: marshalizer,
Accounts: accnts,
ShardCoordinator: shardCoordinator,
EpochNotifier: epochNotifier,
EnableEpochsHandler: enableEpochsHandler,
GuardedAccountHandler: guardedAccountHandler,
AutomaticCrawlerAddresses: automaticCrawlerAddresses,
MaxNumNodesInTransferRole: maxNumAddressesInTransferRole,
GasSchedule: gasScheduleNotifier,
MapDNSAddresses: make(map[string]struct{}),
DNSV2Addresses: dnsV2Addresses,
WhiteListedCrossChainAddresses: whiteListedCrossChainAddresses,
EnableUserNameChange: false,
Marshalizer: marshalizer,
Accounts: accounts,
ShardCoordinator: shardCoordinator,
EpochNotifier: epochNotifier,
EnableEpochsHandler: enableEpochsHandler,
GuardedAccountHandler: guardedAccountHandler,
AutomaticCrawlerAddresses: automaticCrawlerAddresses,
MaxNumAddressesInTransferRole: maxNumAddressesInTransferRole,
SelfESDTPrefix: selfESDTPrefix,
PubKeyConverter: pubKeyConverter,
}
return builtInFunctions.CreateBuiltInFunctionsFactory(argsBuiltIn)
}
Expand Down
8 changes: 6 additions & 2 deletions factory/api/apiResolverFactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func createMockArgs(t *testing.T) *api.ApiResolverArgs {
GeneralConfig: &cfg,
EpochConfig: &config.EpochConfig{},
EconomicsConfig: &economicsConfig,
SystemSCConfig: &config.SystemSmartContractsConfig{},
},
CoreComponents: coreComponents,
DataComponents: dataComponents,
Expand Down Expand Up @@ -292,6 +293,7 @@ func createMockSCQueryElementArgs() api.SCQueryElementArgs {
BuiltInFunctions: config.BuiltInFunctionsConfig{
MaxNumAddressesInTransferRole: 1,
AutomaticCrawlerAddresses: []string{"addr1"},
DNSV2Addresses: []string{"erd1qqqqqqqqqqqqqpgqr46jrxr6r2unaqh75ugd308dwx5vgnhwh47qtvepe3"},
},
SmartContractDataPool: config.CacheConfig{
Type: "LRU",
Expand Down Expand Up @@ -365,8 +367,10 @@ func createMockSCQueryElementArgs() api.SCQueryElementArgs {
return gasSchedule
},
},
MessageSigVerifier: &testscommon.MessageSignVerifierMock{},
SystemSCConfig: &config.SystemSmartContractsConfig{},
MessageSigVerifier: &testscommon.MessageSignVerifierMock{},
SystemSCConfig: &config.SystemSmartContractsConfig{
ESDTSystemSCConfig: config.ESDTSystemSCConfig{},
},
Bootstrapper: testsMocks.NewTestBootstrapperMock(),
AllowVMQueriesChan: make(chan struct{}, 1),
WorkingDir: "",
Expand Down
38 changes: 14 additions & 24 deletions factory/processing/blockProcessorCreator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1162,31 +1162,21 @@ func (pcf *processComponentsFactory) createBuiltInFunctionContainer(
return nil, err
}

convertedDNSV2Addresses, err := mainFactory.DecodeAddresses(
pcf.coreData.AddressPubKeyConverter(),
pcf.config.BuiltInFunctions.DNSV2Addresses,
)
if err != nil {
return nil, err
}

mapDNSV2Addresses := make(map[string]struct{})
for _, address := range convertedDNSV2Addresses {
mapDNSV2Addresses[string(address)] = struct{}{}
}

argsBuiltIn := builtInFunctions.ArgsCreateBuiltInFunctionContainer{
GasSchedule: pcf.gasSchedule,
MapDNSAddresses: mapDNSAddresses,
MapDNSV2Addresses: mapDNSV2Addresses,
Marshalizer: pcf.coreData.InternalMarshalizer(),
Accounts: accounts,
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
EpochNotifier: pcf.coreData.EpochNotifier(),
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
GuardedAccountHandler: pcf.bootstrapComponents.GuardedAccountHandler(),
AutomaticCrawlerAddresses: convertedAddresses,
MaxNumNodesInTransferRole: pcf.config.BuiltInFunctions.MaxNumAddressesInTransferRole,
GasSchedule: pcf.gasSchedule,
MapDNSAddresses: mapDNSAddresses,
DNSV2Addresses: pcf.config.BuiltInFunctions.DNSV2Addresses,
WhiteListedCrossChainAddresses: pcf.config.VirtualMachine.Execution.TransferAndExecuteByUserAddresses,
Marshalizer: pcf.coreData.InternalMarshalizer(),
Accounts: accounts,
ShardCoordinator: pcf.bootstrapComponents.ShardCoordinator(),
EpochNotifier: pcf.coreData.EpochNotifier(),
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
GuardedAccountHandler: pcf.bootstrapComponents.GuardedAccountHandler(),
AutomaticCrawlerAddresses: convertedAddresses,
MaxNumAddressesInTransferRole: pcf.config.BuiltInFunctions.MaxNumAddressesInTransferRole,
SelfESDTPrefix: []byte(pcf.systemSCConfig.ESDTSystemSCConfig.ESDTPrefix),
PubKeyConverter: pcf.coreData.AddressPubKeyConverter(),
}

return builtInFunctions.CreateBuiltInFunctionsFactory(argsBuiltIn)
Expand Down
27 changes: 15 additions & 12 deletions genesis/process/shardGenesisBlockCreator.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,18 +362,21 @@ func createProcessorsForShardGenesisBlock(arg ArgsGenesisBlockCreator, enableEpo
}

argsBuiltIn := builtInFunctions.ArgsCreateBuiltInFunctionContainer{
GasSchedule: arg.GasSchedule,
MapDNSAddresses: make(map[string]struct{}),
MapDNSV2Addresses: make(map[string]struct{}),
EnableUserNameChange: false,
Marshalizer: arg.Core.InternalMarshalizer(),
Accounts: arg.Accounts,
ShardCoordinator: arg.ShardCoordinator,
EpochNotifier: epochNotifier,
EnableEpochsHandler: enableEpochsHandler,
AutomaticCrawlerAddresses: [][]byte{make([]byte, 32)},
MaxNumNodesInTransferRole: math.MaxUint32,
GuardedAccountHandler: disabledGuardian.NewDisabledGuardedAccountHandler(),
GasSchedule: arg.GasSchedule,
MapDNSAddresses: make(map[string]struct{}),
DNSV2Addresses: []string{},
WhiteListedCrossChainAddresses: arg.VirtualMachineConfig.TransferAndExecuteByUserAddresses,
EnableUserNameChange: false,
Marshalizer: arg.Core.InternalMarshalizer(),
Accounts: arg.Accounts,
ShardCoordinator: arg.ShardCoordinator,
EpochNotifier: epochNotifier,
EnableEpochsHandler: enableEpochsHandler,
AutomaticCrawlerAddresses: [][]byte{make([]byte, 32)},
MaxNumAddressesInTransferRole: math.MaxUint32,
GuardedAccountHandler: disabledGuardian.NewDisabledGuardedAccountHandler(),
SelfESDTPrefix: []byte(arg.SystemSCConfig.ESDTSystemSCConfig.ESDTPrefix),
PubKeyConverter: arg.Core.AddressPubKeyConverter(),
}
builtInFuncFactory, err := builtInFunctions.CreateBuiltInFunctionsFactory(argsBuiltIn)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ require (
github.com/klauspost/cpuid/v2 v2.2.5
github.com/mitchellh/mapstructure v1.5.0
github.com/multiversx/mx-chain-communication-go v1.0.15-0.20240508074652-e128a1c05c8e
github.com/multiversx/mx-chain-core-go v1.2.21-0.20240508071047-fefea5737840
github.com/multiversx/mx-chain-core-go v1.2.21-0.20240517102534-7befa5957b5d
github.com/multiversx/mx-chain-crypto-go v1.2.12-0.20240508074452-cc21c1b505df
github.com/multiversx/mx-chain-es-indexer-go v1.7.2-0.20240514103357-929ece92ef86
github.com/multiversx/mx-chain-logger-go v1.0.15-0.20240508072523-3f00a726af57
github.com/multiversx/mx-chain-scenario-go v1.4.4-0.20240509103754-9e8129721f00
github.com/multiversx/mx-chain-storage-go v1.0.16-0.20240508073549-dcb8e6e0370f
github.com/multiversx/mx-chain-vm-common-go v1.5.13-0.20240509103544-247ce5639c7a
github.com/multiversx/mx-chain-vm-common-go v1.5.13-0.20240528155322-7fceea304c01
github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240509104139-8b0eaa8a85d1
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.68-0.20240509103859-89de3c5da36b
github.com/multiversx/mx-chain-vm-v1_3-go v1.3.69-0.20240509104009-598a37ff36b9
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ github.com/multiversx/concurrent-map v0.1.4 h1:hdnbM8VE4b0KYJaGY5yJS2aNIW9TFFsUY
github.com/multiversx/concurrent-map v0.1.4/go.mod h1:8cWFRJDOrWHOTNSqgYCUvwT7c7eFQ4U2vKMOp4A/9+o=
github.com/multiversx/mx-chain-communication-go v1.0.15-0.20240508074652-e128a1c05c8e h1:Tsmwhu+UleE+l3buPuqXSKTqfu5FbPmzQ4MjMoUvCWA=
github.com/multiversx/mx-chain-communication-go v1.0.15-0.20240508074652-e128a1c05c8e/go.mod h1:2yXl18wUbuV3cRZr7VHxM1xo73kTaC1WUcu2kx8R034=
github.com/multiversx/mx-chain-core-go v1.2.21-0.20240508071047-fefea5737840 h1:2mCrTUmbbA+Xv4UifZY9xptrGjcJBcJ2wavSb4FwejU=
github.com/multiversx/mx-chain-core-go v1.2.21-0.20240508071047-fefea5737840/go.mod h1:B5zU4MFyJezmEzCsAHE9YNULmGCm2zbPHvl9hazNxmE=
github.com/multiversx/mx-chain-core-go v1.2.21-0.20240517102534-7befa5957b5d h1:Eu4VgqwCyqttR1L8u1SrqWdjec9FRwQ1ZDKC7br9a44=
github.com/multiversx/mx-chain-core-go v1.2.21-0.20240517102534-7befa5957b5d/go.mod h1:B5zU4MFyJezmEzCsAHE9YNULmGCm2zbPHvl9hazNxmE=
github.com/multiversx/mx-chain-crypto-go v1.2.12-0.20240508074452-cc21c1b505df h1:clihfi78bMEOWk/qw6WA4uQbCM2e2NGliqswLAvw19k=
github.com/multiversx/mx-chain-crypto-go v1.2.12-0.20240508074452-cc21c1b505df/go.mod h1:gtJYB4rR21KBSqJlazn+2z6f9gFSqQP3KvAgL7Qgxw4=
github.com/multiversx/mx-chain-es-indexer-go v1.7.2-0.20240514103357-929ece92ef86 h1:rw+u7qv0HO+7lRddCzfciqDcAWL9/fl2LQqU8AmVtdU=
Expand All @@ -399,8 +399,8 @@ github.com/multiversx/mx-chain-scenario-go v1.4.4-0.20240509103754-9e8129721f00
github.com/multiversx/mx-chain-scenario-go v1.4.4-0.20240509103754-9e8129721f00/go.mod h1:pnIIfWopbDMQ1EW5Ddc6KDMqv8Qtx+hxbH9rorHpCyo=
github.com/multiversx/mx-chain-storage-go v1.0.16-0.20240508073549-dcb8e6e0370f h1:yd/G8iPBGOEAwbaS8zndJpO6bQk7Tk72ZhmlqRasThI=
github.com/multiversx/mx-chain-storage-go v1.0.16-0.20240508073549-dcb8e6e0370f/go.mod h1:E6nfj9EQzGxWDGM3Dn6eZWRC3qFy1G8IqOsYsBOcgWw=
github.com/multiversx/mx-chain-vm-common-go v1.5.13-0.20240509103544-247ce5639c7a h1:7M+jXVlnl43zd2NuimL1KnAVAdpUr/QoHqG0TUKoyaM=
github.com/multiversx/mx-chain-vm-common-go v1.5.13-0.20240509103544-247ce5639c7a/go.mod h1:RgGmPei0suQcFTHfO4cS5dxJSiokp2SM5lmNgp1icMo=
github.com/multiversx/mx-chain-vm-common-go v1.5.13-0.20240528155322-7fceea304c01 h1:XRuuoYfKBo/7KpBL+tS1dO8n74Z3zeLWMGhSs8TOVo8=
github.com/multiversx/mx-chain-vm-common-go v1.5.13-0.20240528155322-7fceea304c01/go.mod h1:SLOTnC9jwUQnJaDaLCpR5EfyLV+YizkzA6lGsba+Q1s=
github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240509104139-8b0eaa8a85d1 h1:5/h1i7Xd/JH9CiO3ZqvzAjdze+mAbar5sWkh2UqfLgI=
github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240509104139-8b0eaa8a85d1/go.mod h1:N3Oa8QeeHlSip4nbESQpVSLgi/WxtgIwvqfXIZm6gDs=
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.68-0.20240509103859-89de3c5da36b h1:puYO0lUyPGA5kZqsiDjGa+daDGQwj9xFs0S5urhZjU8=
Expand Down
Loading
Loading