Skip to content

Commit 785b2ec

Browse files
authored
Merge pull request #193 from multiversx/lastestd-commit-chain-sim-async-exec
Latest commit chain sim async exec
2 parents 43d56b1 + 780dffd commit 785b2ec

File tree

5 files changed

+41
-30
lines changed

5 files changed

+41
-30
lines changed

examples/contracts/issue-esdt-with-contract/issue-with-contract.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def main():
9393
if status.status != "pending":
9494
sys.exit(f"incorrect status of transaction: expected->pending, received->{status}")
9595

96-
provider.do_post_generic(f"{GENERATE_BLOCKS_URL}/3", {})
97-
status = status = provider.get_transaction_status(tx_hash)
96+
provider.do_post_generic(f"{GENERATE_BLOCKS_URL}/6", {})
97+
status = provider.get_transaction_status(tx_hash)
9898
if status.status != "fail":
9999
sys.exit(f"incorrect status of transaction: expected->fail, received->{status}")
100100

go.mod

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
module github.com/multiversx/mx-chain-simulator-go
22

3-
go 1.23
3+
go 1.23.0
44

55
require (
66
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792
77
github.com/gin-gonic/gin v1.10.0
8-
github.com/multiversx/mx-chain-core-go v1.4.2-0.20251022090220-a99e14e45706
9-
github.com/multiversx/mx-chain-go v1.10.9-0.20251202080801-f93cacaf0a4d
8+
github.com/multiversx/mx-chain-core-go v1.4.2-0.20251216155248-bcbea61e6f31
9+
github.com/multiversx/mx-chain-go v1.10.9-0.20251219154857-aebf301be8fb
1010
github.com/multiversx/mx-chain-logger-go v1.1.0
11-
github.com/multiversx/mx-chain-proxy-go v1.3.1
11+
github.com/multiversx/mx-chain-proxy-go v1.3.5-0.20251222095819-21763951cae2
12+
github.com/multiversx/mx-chain-storage-go v1.1.0
1213
github.com/pelletier/go-toml v1.9.3
1314
github.com/stretchr/testify v1.10.0
1415
github.com/urfave/cli v1.22.16
@@ -120,9 +121,8 @@ require (
120121
github.com/multiversx/concurrent-map v0.1.4 // indirect
121122
github.com/multiversx/mx-chain-communication-go v1.3.0 // indirect
122123
github.com/multiversx/mx-chain-crypto-go v1.3.0 // indirect
123-
github.com/multiversx/mx-chain-es-indexer-go v1.9.3-0.20251021150757-bd6aa66a0a90 // indirect
124+
github.com/multiversx/mx-chain-es-indexer-go v1.9.3-0.20251209110302-3b451942b7f9 // indirect
124125
github.com/multiversx/mx-chain-scenario-go v1.6.0 // indirect
125-
github.com/multiversx/mx-chain-storage-go v1.1.0 // indirect
126126
github.com/multiversx/mx-chain-vm-common-go v1.6.0 // indirect
127127
github.com/multiversx/mx-chain-vm-go v1.6.1-0.20250707105646-d7048a2657c2 // indirect
128128
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.69 // indirect
@@ -189,13 +189,13 @@ require (
189189
go.uber.org/multierr v1.11.0 // indirect
190190
go.uber.org/zap v1.27.0 // indirect
191191
golang.org/x/arch v0.8.0 // indirect
192-
golang.org/x/crypto v0.32.0 // indirect
192+
golang.org/x/crypto v0.35.0 // indirect
193193
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c // indirect
194194
golang.org/x/mod v0.22.0 // indirect
195195
golang.org/x/net v0.34.0 // indirect
196-
golang.org/x/sync v0.10.0 // indirect
196+
golang.org/x/sync v0.11.0 // indirect
197197
golang.org/x/sys v0.30.0 // indirect
198-
golang.org/x/text v0.21.0 // indirect
198+
golang.org/x/text v0.22.0 // indirect
199199
golang.org/x/tools v0.29.0 // indirect
200200
gonum.org/v1/gonum v0.15.1 // indirect
201201
google.golang.org/protobuf v1.36.4 // indirect

go.sum

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -410,18 +410,18 @@ github.com/multiversx/concurrent-map v0.1.4 h1:hdnbM8VE4b0KYJaGY5yJS2aNIW9TFFsUY
410410
github.com/multiversx/concurrent-map v0.1.4/go.mod h1:8cWFRJDOrWHOTNSqgYCUvwT7c7eFQ4U2vKMOp4A/9+o=
411411
github.com/multiversx/mx-chain-communication-go v1.3.0 h1:ziNM1dRuiR/7al2L/jGEA/a/hjurtJ/HEqgazHNt9P8=
412412
github.com/multiversx/mx-chain-communication-go v1.3.0/go.mod h1:gDVWn6zUW6aCN1YOm/FbbT5MUmhgn/L1Rmpl8EoH3Yg=
413-
github.com/multiversx/mx-chain-core-go v1.4.2-0.20251022090220-a99e14e45706 h1:rs0XNP+cxwRWL5EnbfMecRHbXd5NzukImJnk58UNsiA=
414-
github.com/multiversx/mx-chain-core-go v1.4.2-0.20251022090220-a99e14e45706/go.mod h1:IO+vspNan+gT0WOHnJ95uvWygiziHZvfXpff6KnxV7g=
413+
github.com/multiversx/mx-chain-core-go v1.4.2-0.20251216155248-bcbea61e6f31 h1:MiqdkQIW3S1z1woQ58UGtPHQUkO8DGMMfEaX+s3oRDA=
414+
github.com/multiversx/mx-chain-core-go v1.4.2-0.20251216155248-bcbea61e6f31/go.mod h1:IO+vspNan+gT0WOHnJ95uvWygiziHZvfXpff6KnxV7g=
415415
github.com/multiversx/mx-chain-crypto-go v1.3.0 h1:0eK2bkDOMi8VbSPrB1/vGJSYT81IBtfL4zw+C4sWe/k=
416416
github.com/multiversx/mx-chain-crypto-go v1.3.0/go.mod h1:nPIkxxzyTP8IquWKds+22Q2OJ9W7LtusC7cAosz7ojM=
417-
github.com/multiversx/mx-chain-es-indexer-go v1.9.3-0.20251021150757-bd6aa66a0a90 h1:Hf6AqpCSHccBo5ZV5Bfaxz3UdPYhtYCynU+3CF4jAa8=
418-
github.com/multiversx/mx-chain-es-indexer-go v1.9.3-0.20251021150757-bd6aa66a0a90/go.mod h1:t1rkD2vHXSI4EClig0h7+kRCSUCRrMF+emr4DHxFtfA=
419-
github.com/multiversx/mx-chain-go v1.10.9-0.20251202080801-f93cacaf0a4d h1:ZmZU29TjlggFo0rptuW4m82Ys37LIB1CFbyDiE2BQic=
420-
github.com/multiversx/mx-chain-go v1.10.9-0.20251202080801-f93cacaf0a4d/go.mod h1:G2LX81y+A75W5EqJod9p4fRAdnp22vpQrB+374pAveQ=
417+
github.com/multiversx/mx-chain-es-indexer-go v1.9.3-0.20251209110302-3b451942b7f9 h1:lywsKESTxcEC+RnmXzF/6T444DVyhl/ft52Rh4JMPyQ=
418+
github.com/multiversx/mx-chain-es-indexer-go v1.9.3-0.20251209110302-3b451942b7f9/go.mod h1:F/BpaYVPuHN7POJN6gwvJfZ22diYtvz2576a+PWiPvw=
419+
github.com/multiversx/mx-chain-go v1.10.9-0.20251219154857-aebf301be8fb h1:BnDm6DhGHLp8e31wZGbyYcCvgM3jrclcRm4wLpfN63M=
420+
github.com/multiversx/mx-chain-go v1.10.9-0.20251219154857-aebf301be8fb/go.mod h1:c/On/Uw6kMUd6009gvmUsL1gZ+ewl9g4sOvmQGP08a0=
421421
github.com/multiversx/mx-chain-logger-go v1.1.0 h1:97x84A6L4RfCa6YOx1HpAFxZp1cf/WI0Qh112whgZNM=
422422
github.com/multiversx/mx-chain-logger-go v1.1.0/go.mod h1:K9XgiohLwOsNACETMNL0LItJMREuEvTH6NsoXWXWg7g=
423-
github.com/multiversx/mx-chain-proxy-go v1.3.1 h1:tjbTm3FpR0bjDvWAMK0zwRxRbbjGszSWltng7jv6CIg=
424-
github.com/multiversx/mx-chain-proxy-go v1.3.1/go.mod h1:cHuW0HW8ygFhnXENyBYHiVSWmK17uheAUjglNNgTTpc=
423+
github.com/multiversx/mx-chain-proxy-go v1.3.5-0.20251222095819-21763951cae2 h1:ZX5197Lg7GeJ0iUP+1Nkgveor9XWG92XfWWN/ePZp6A=
424+
github.com/multiversx/mx-chain-proxy-go v1.3.5-0.20251222095819-21763951cae2/go.mod h1:XrDhWmTjJ3J7DGoaE06jdD+ZkMH7j68qk5pUJ6ZIYKI=
425425
github.com/multiversx/mx-chain-scenario-go v1.6.0 h1:cwDFuS1pSc4YXnfiKKDTEb+QDY4fulPQaiRgIebnKxI=
426426
github.com/multiversx/mx-chain-scenario-go v1.6.0/go.mod h1:GrSYu1SnMvsIm9djUz1X13224HcvdY6Nb5KHNT3xZPA=
427427
github.com/multiversx/mx-chain-storage-go v1.1.0 h1:M1Y9DqMrJ62s7Zw31+cyuqsnPIvlG4jLBJl5WzeZLe8=
@@ -709,8 +709,8 @@ golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE
709709
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
710710
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
711711
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
712-
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
713-
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
712+
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
713+
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
714714
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
715715
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c h1:KL/ZBHXgKGVmuZBZ01Lt57yE5ws8ZPSkkihmEyq7FXc=
716716
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
@@ -776,8 +776,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
776776
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
777777
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
778778
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
779-
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
780-
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
779+
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
780+
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
781781
golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
782782
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
783783
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -840,8 +840,8 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
840840
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
841841
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
842842
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
843-
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
844-
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
843+
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
844+
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
845845
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
846846
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
847847
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=

pkg/facade/simulatorFacade.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ import (
1717
)
1818

1919
const (
20-
errMsgTargetEpochLowerThanCurrentEpoch = "target epoch must be greater than current epoch"
21-
errMsgAccountNotFound = "account was not found")
20+
errMsgTargetEpochLowerThanCurrentEpoch = "target epoch must be greater than current epoch"
21+
errMsgAccountNotFound = "account was not found"
22+
numBlocksToGenerate = 2
23+
)
2224

2325
var log = logger.GetOrCreate("simulator/facade")
2426

@@ -73,7 +75,7 @@ func (sf *simulatorFacade) SetStateMultiple(stateSlice []*dtos.AddressState, noG
7375
return nil
7476
}
7577

76-
return sf.simulator.GenerateBlocks(1)
78+
return sf.simulator.GenerateBlocks(numBlocksToGenerate)
7779
}
7880

7981
// SetStateMultipleOverwrite will set the entire state for the provided address and cleanup the old state of the provided addresses
@@ -96,7 +98,7 @@ func (sf *simulatorFacade) SetStateMultipleOverwrite(stateSlice []*dtos.AddressS
9698
return nil
9799
}
98100

99-
return sf.simulator.GenerateBlocks(1)
101+
return sf.simulator.GenerateBlocks(numBlocksToGenerate)
100102
}
101103

102104
// AddValidatorKeys will add the validator keys in the multi key handler

pkg/proxy/creator/creator.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
processFactory "github.com/multiversx/mx-chain-proxy-go/process/factory"
2222
versionsFactory "github.com/multiversx/mx-chain-proxy-go/versions/factory"
2323
proxy2 "github.com/multiversx/mx-chain-simulator-go/pkg/proxy"
24+
"github.com/multiversx/mx-chain-storage-go/timecache"
2425
)
2526

2627
var log = logger.GetOrCreate("proxy")
@@ -138,7 +139,15 @@ func CreateProxy(args ArgsProxy) (*ArgsOutputProxy, error) {
138139
valStatsProc.StartCacheUpdate()
139140
nodeStatusProc.StartCacheUpdate()
140141

141-
blockProc, err := processProxy.NewBlockProcessor(bp)
142+
blockCacher, err := timecache.NewTimeCacher(timecache.ArgTimeCacher{
143+
DefaultSpan: time.Second,
144+
CacheExpiry: time.Duration(args.Config.GeneralSettings.BlockCacheDurationSec) * time.Second,
145+
})
146+
if err != nil {
147+
return nil, err
148+
}
149+
150+
blockProc, err := processProxy.NewBlockProcessor(bp, blockCacher)
142151
if err != nil {
143152
return nil, err
144153
}

0 commit comments

Comments
 (0)