Skip to content

Commit 736053e

Browse files
Merge branch 'rc/barnard' into mandos-promises-update
2 parents cd9d6af + c2734bd commit 736053e

File tree

5 files changed

+34
-51
lines changed

5 files changed

+34
-51
lines changed

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ require (
88
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
99
github.com/gogo/protobuf v1.3.2
1010
github.com/mitchellh/mapstructure v1.5.0
11-
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250520074139-18b645ad397a
12-
github.com/multiversx/mx-chain-crypto-go v1.2.13-0.20250520075055-8ab2a164945d
13-
github.com/multiversx/mx-chain-logger-go v1.0.16-0.20250520074859-b2faf3c90273
14-
github.com/multiversx/mx-chain-scenario-go v1.5.1-0.20250617131039-b09f258a9f6c
15-
github.com/multiversx/mx-chain-storage-go v1.0.20-0.20250520075958-65fd4c7bcaae
16-
github.com/multiversx/mx-chain-vm-common-go v1.5.17-0.20250604100541-1efc3d1b1314
17-
github.com/multiversx/mx-components-big-int v1.0.1-0.20250218162530-b4e4d7442408
11+
github.com/multiversx/mx-chain-core-go v1.4.0
12+
github.com/multiversx/mx-chain-crypto-go v1.3.0
13+
github.com/multiversx/mx-chain-logger-go v1.1.0
14+
github.com/multiversx/mx-chain-scenario-go v1.6.0
15+
github.com/multiversx/mx-chain-storage-go v1.1.0
16+
github.com/multiversx/mx-chain-vm-common-go v1.6.0
17+
github.com/multiversx/mx-components-big-int v1.1.0
1818
github.com/pelletier/go-toml v1.9.3
1919
github.com/stretchr/testify v1.8.1
2020
github.com/urfave/cli/v2 v2.27.1

go.sum

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,20 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
8383
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
8484
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
8585
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
86-
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250520074139-18b645ad397a h1:dhCobNEcBdvutX+0UYF/l86oLVO9iUiUeF3sLFa9qhE=
87-
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250520074139-18b645ad397a/go.mod h1:IO+vspNan+gT0WOHnJ95uvWygiziHZvfXpff6KnxV7g=
88-
github.com/multiversx/mx-chain-crypto-go v1.2.13-0.20250520075055-8ab2a164945d h1:NI5uKpkwP5XZu9gtDiWxmbbb07T9hXegPist17WAzY4=
89-
github.com/multiversx/mx-chain-crypto-go v1.2.13-0.20250520075055-8ab2a164945d/go.mod h1:yekQt4uB5LYXtimbhpdUbnFexjucWrQG/t+AX55bdM8=
90-
github.com/multiversx/mx-chain-logger-go v1.0.16-0.20250520074859-b2faf3c90273 h1:1I2CgGDAMINxrKI6yzSP/Y6Wow2YUmqegUXcltpGXQA=
91-
github.com/multiversx/mx-chain-logger-go v1.0.16-0.20250520074859-b2faf3c90273/go.mod h1:M/uRv1kpmkzxS5HsgofdRcOHzzvagD7nTmFqiPKt89U=
92-
github.com/multiversx/mx-chain-scenario-go v1.5.1-0.20250617131039-b09f258a9f6c h1:FiEuVVRJdFZZQ6YX+sx6GAU90LlscfZKKpxV2JVvt0w=
93-
github.com/multiversx/mx-chain-scenario-go v1.5.1-0.20250617131039-b09f258a9f6c/go.mod h1:MAnOkKa27CXLwDPLFcYOGpZv8JVGe/CDKHT0TTtXHXM=
94-
github.com/multiversx/mx-chain-storage-go v1.0.20-0.20250520075958-65fd4c7bcaae h1:wgiIjyoynLQPs8QkEOXjAU8AoZlLA5w4rWPykLS2BSo=
95-
github.com/multiversx/mx-chain-storage-go v1.0.20-0.20250520075958-65fd4c7bcaae/go.mod h1:uiXDLvpznajMubl+OBhODo6jmtwo8kyUF9iujEhOIgI=
96-
github.com/multiversx/mx-chain-vm-common-go v1.5.17-0.20250604100541-1efc3d1b1314 h1:C2nlGnUyAoP2dBOEXBYwt7KXAv96m5tl3l2H208NVoA=
97-
github.com/multiversx/mx-chain-vm-common-go v1.5.17-0.20250604100541-1efc3d1b1314/go.mod h1:HlpJgCTYVvHE1nrEJLIsR/AJx0gqzg3m+qdJwf7jOjU=
98-
github.com/multiversx/mx-components-big-int v1.0.1-0.20250218162530-b4e4d7442408 h1:FbpVQJg14ry25DiBBZIvBoKiSrTHWkUSlYMOOW/iQJQ=
99-
github.com/multiversx/mx-components-big-int v1.0.1-0.20250218162530-b4e4d7442408/go.mod h1:kcWw7hDe6cSz1wcBAqj/6sFH6ouSPsNeH9P7XlpZRcw=
86+
github.com/multiversx/mx-chain-core-go v1.4.0 h1:p6FbfCzvMXF54kpS0B5mrjNWYpq4SEQqo0UvrMF7YVY=
87+
github.com/multiversx/mx-chain-core-go v1.4.0/go.mod h1:IO+vspNan+gT0WOHnJ95uvWygiziHZvfXpff6KnxV7g=
88+
github.com/multiversx/mx-chain-crypto-go v1.3.0 h1:0eK2bkDOMi8VbSPrB1/vGJSYT81IBtfL4zw+C4sWe/k=
89+
github.com/multiversx/mx-chain-crypto-go v1.3.0/go.mod h1:nPIkxxzyTP8IquWKds+22Q2OJ9W7LtusC7cAosz7ojM=
90+
github.com/multiversx/mx-chain-logger-go v1.1.0 h1:97x84A6L4RfCa6YOx1HpAFxZp1cf/WI0Qh112whgZNM=
91+
github.com/multiversx/mx-chain-logger-go v1.1.0/go.mod h1:K9XgiohLwOsNACETMNL0LItJMREuEvTH6NsoXWXWg7g=
92+
github.com/multiversx/mx-chain-scenario-go v1.6.0 h1:cwDFuS1pSc4YXnfiKKDTEb+QDY4fulPQaiRgIebnKxI=
93+
github.com/multiversx/mx-chain-scenario-go v1.6.0/go.mod h1:GrSYu1SnMvsIm9djUz1X13224HcvdY6Nb5KHNT3xZPA=
94+
github.com/multiversx/mx-chain-storage-go v1.1.0 h1:M1Y9DqMrJ62s7Zw31+cyuqsnPIvlG4jLBJl5WzeZLe8=
95+
github.com/multiversx/mx-chain-storage-go v1.1.0/go.mod h1:o6Jm7cjfPmcc6XpyihYWrd6sx3sgqwurrunw3ZrfyxI=
96+
github.com/multiversx/mx-chain-vm-common-go v1.6.0 h1:M2zmf/ptEINciWxYCPLIkwOMTvvzWjELYYB+0MMQ5Gw=
97+
github.com/multiversx/mx-chain-vm-common-go v1.6.0/go.mod h1:Lc7r4VDPYRDS0CVIaWAoLtf3YQn6PZEYHv4QtaOE2Z0=
98+
github.com/multiversx/mx-components-big-int v1.1.0 h1:7aSJKago6vJQy9JeMOBRDYKHvsrj9OmrFWOucFUV+Kg=
99+
github.com/multiversx/mx-components-big-int v1.1.0/go.mod h1:kcWw7hDe6cSz1wcBAqj/6sFH6ouSPsNeH9P7XlpZRcw=
100100
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
101101
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
102102
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=

vmhost/contexts/managedType.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -786,13 +786,8 @@ func (context *managedTypesContext) ManagedMapGet(mMapHandle int32, keyHandle in
786786
return err
787787
}
788788

789-
err = context.ConsumeGasForBytes(value)
790-
if err != nil {
791-
return err
792-
}
793-
794789
context.SetBytes(outValueHandle, value)
795-
return nil
790+
return context.ConsumeGasForBytes(value)
796791
}
797792

798793
// ManagedMapRemove removes the bytes stored as the key handle and returns it in an output value handle

vmhost/vmhooks/manBufOps.go

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ func (context *VMHooksImpl) MBufferFromBigIntSigned(mBufferHandle int32, bigIntH
567567
func (context *VMHooksImpl) MBufferToSmallIntUnsigned(mBufferHandle int32) int64 {
568568
managedType := context.GetManagedTypesContext()
569569
metering := context.GetMeteringContext()
570-
enableEpochsHandler := context.GetEnableEpochsHandler()
571570

572571
gasToUse := metering.GasSchedule().ManagedBufferAPICost.MBufferToSmallIntUnsigned
573572
err := metering.UseGasBoundedAndAddTracedGas(mBufferToSmallIntUnsignedName, gasToUse)
@@ -582,13 +581,11 @@ func (context *VMHooksImpl) MBufferToSmallIntUnsigned(mBufferHandle int32) int64
582581
return 1
583582
}
584583

585-
if enableEpochsHandler.IsFlagEnabled(vmhost.BarnardOpcodesFlag) {
586-
gasToUse = math.MulUint64(metering.GasSchedule().BaseOperationCost.DataCopyPerByte, uint64(len(data)))
587-
err = metering.UseGasBounded(gasToUse)
588-
if err != nil {
589-
context.FailExecution(err)
590-
return 1
591-
}
584+
gasToUse = math.MulUint64(metering.GasSchedule().BaseOperationCost.DataCopyPerByte, uint64(len(data)))
585+
err = metering.UseGasBounded(gasToUse)
586+
if err != nil {
587+
context.FailExecution(err)
588+
return 1
592589
}
593590

594591
bigInt := big.NewInt(0).SetBytes(data)
@@ -604,7 +601,6 @@ func (context *VMHooksImpl) MBufferToSmallIntUnsigned(mBufferHandle int32) int64
604601
func (context *VMHooksImpl) MBufferToSmallIntSigned(mBufferHandle int32) int64 {
605602
managedType := context.GetManagedTypesContext()
606603
metering := context.GetMeteringContext()
607-
enableEpochsHandler := context.GetEnableEpochsHandler()
608604

609605
gasToUse := metering.GasSchedule().ManagedBufferAPICost.MBufferToSmallIntSigned
610606
err := metering.UseGasBoundedAndAddTracedGas(mBufferToSmallIntSignedName, gasToUse)
@@ -619,13 +615,11 @@ func (context *VMHooksImpl) MBufferToSmallIntSigned(mBufferHandle int32) int64 {
619615
return 1
620616
}
621617

622-
if enableEpochsHandler.IsFlagEnabled(vmhost.BarnardOpcodesFlag) {
623-
gasToUse = math.MulUint64(metering.GasSchedule().BaseOperationCost.DataCopyPerByte, uint64(len(data)))
624-
err = metering.UseGasBounded(gasToUse)
625-
if err != nil {
626-
context.FailExecution(err)
627-
return 1
628-
}
618+
gasToUse = math.MulUint64(metering.GasSchedule().BaseOperationCost.DataCopyPerByte, uint64(len(data)))
619+
err = metering.UseGasBounded(gasToUse)
620+
if err != nil {
621+
context.FailExecution(err)
622+
return 1
629623
}
630624

631625
bigInt := twos.SetBytes(big.NewInt(0), data)

vmhost/vmhookstest/manBuffers_test.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,6 @@ func TestManBuffers_Ints_WithNoBarnardOpcodesFlag(t *testing.T) {
365365
assert.Nil(t, err)
366366
assert.True(t, bigIntResult.Cmp(big.NewInt(0x00_ff_00_ff_00_ff_00_ff)) == 0)
367367

368-
smallInt := hooks.MBufferToSmallIntSigned(sourceBuffer)
369-
assert.True(t, smallInt == 0x00_ff_00_ff_00_ff_00_ff)
370-
371-
smallInt = hooks.MBufferToSmallIntUnsigned(sourceBuffer)
372-
assert.True(t, smallInt == 0x00_ff_00_ff_00_ff_00_ff)
373-
374368
return instance
375369
})
376370
})).
@@ -387,8 +381,8 @@ func TestManBuffers_Ints_WithNoBarnardOpcodesFlag(t *testing.T) {
387381
}).
388382
AndAssertResults(func(world *worldmock.MockWorld, verify *test.VMOutputVerifier) {
389383
verify.Ok().
390-
GasRemaining(gasProvided-37).
391-
GasUsed(test.ParentAddress, 37)
384+
GasRemaining(gasProvided-35).
385+
GasUsed(test.ParentAddress, 35)
392386
})
393387
assert.Nil(t, err)
394388
}

0 commit comments

Comments
 (0)