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

Merge master in rc/v1.7.0 23nov #798

Merged
merged 29 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cc9dde7
update vm common
miiu96 Oct 25, 2023
1268105
proper tag
miiu96 Oct 27, 2023
e8e5903
Merge pull request #790 from multiversx/update-vm-common
miiu96 Oct 27, 2023
ba36c97
back transfers API change
andrei-marinica Oct 30, 2023
5541292
back transfer test
andrei-marinica Oct 30, 2023
86b732f
managedType: Refactor imports
CostinCarabas Nov 1, 2023
e237f43
back transfer test update
andrei-marinica Nov 1, 2023
151f4cf
Merge pull request #791 from multiversx/back-transfer-test
andrei-marinica Nov 3, 2023
307805b
upgrade from contract test
andrei-marinica Nov 3, 2023
8149d9c
Replace call to init with call to upgrade during indirect upgrade
camilbancioiu Nov 6, 2023
52ce940
upgrade from contract test
andrei-marinica Nov 6, 2023
62c88eb
Fix failing tests
camilbancioiu Nov 6, 2023
be18d2d
Merge branch 'upgrade-from-contract' of https://github.com/multiversx…
camilbancioiu Nov 6, 2023
b6b08bf
- refactored invariant check
iulianpascalau Nov 6, 2023
e19b3c6
Merge pull request #794 from multiversx/refactored-invariant-check
iulianpascalau Nov 6, 2023
dd85051
upgrade from contract test
andrei-marinica Nov 6, 2023
f183238
upgrade from contract test fixes
andrei-marinica Nov 6, 2023
d1bb152
Merge branch 'master' into upgrade-from-contract
andrei-marinica Nov 6, 2023
2cc31dd
Merge pull request #793 from multiversx/upgrade-from-contract
andrei-marinica Nov 7, 2023
4eed363
- new vm-common version
iulianpascalau Nov 15, 2023
f74e538
- proper release
iulianpascalau Nov 17, 2023
8a17c0d
Merge pull request #795 from multiversx/new-vm-common-2023.11.15
iulianpascalau Nov 17, 2023
8bb4351
mandos test update
andrei-marinica Nov 21, 2023
30d67fd
test fix
andrei-marinica Nov 21, 2023
4ebd87b
mandos test update
andrei-marinica Nov 21, 2023
502906c
merged composability scenario-promises into scenarios
andrei-marinica Nov 23, 2023
9c8d94d
Merge pull request #796 from multiversx/mandos-56
andrei-marinica Nov 23, 2023
38e1218
Merge remote-tracking branch 'origin/master' into merge-master-in-rc/…
BeniaminDrasovean Nov 23, 2023
c172a6e
update go mod
BeniaminDrasovean Nov 23, 2023
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
4 changes: 3 additions & 1 deletion executor/executorMemory.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ func MemLoadFromMemory(memory Memory, memPtr MemPtr, length MemLength) ([]byte,
return nil, fmt.Errorf("mem load: %w", ErrMemoryNegativeLength)
}

result := make([]byte, length)
var result []byte
if isRequestedEndTooLarge {
result = make([]byte, memoryLength-uint32(memPtr))
copy(result, memoryView[memPtr:])
} else {
result = make([]byte, requestedEnd-memPtr)
copy(result, memoryView[memPtr:requestedEnd])
}

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ require (
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
github.com/gogo/protobuf v1.3.2
github.com/mitchellh/mapstructure v1.5.0
github.com/multiversx/mx-chain-core-go v1.2.17
github.com/multiversx/mx-chain-core-go v1.2.19-0.20231123115253-158315dc4238
github.com/multiversx/mx-chain-crypto-go v1.2.8
github.com/multiversx/mx-chain-logger-go v1.0.13
github.com/multiversx/mx-chain-scenario-go v1.2.1
github.com/multiversx/mx-chain-vm-common-go v1.5.6
github.com/multiversx/mx-chain-vm-common-go v1.5.9-0.20231123115741-c8a4816c447a
github.com/multiversx/mx-components-big-int v1.0.0
github.com/pelletier/go-toml v1.9.3
github.com/stretchr/testify v1.8.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/multiversx/mx-chain-core-go v1.2.17 h1:/7YEuowxnpOtZLAJbuibNWE/8rDcG+WMhNVvrnljPg0=
github.com/multiversx/mx-chain-core-go v1.2.17/go.mod h1:BILOGHUOIG5dNNX8cgkzCNfDaVtoYrJRYcPnpxRMH84=
github.com/multiversx/mx-chain-core-go v1.2.19-0.20231123115253-158315dc4238 h1:nlDelmQou2635GW2YACZMAHTc+cRxBvtHE0dRQuVC0U=
github.com/multiversx/mx-chain-core-go v1.2.19-0.20231123115253-158315dc4238/go.mod h1:BILOGHUOIG5dNNX8cgkzCNfDaVtoYrJRYcPnpxRMH84=
github.com/multiversx/mx-chain-crypto-go v1.2.8 h1:wOgVlUaO5X4L8iEbFjcQcL8SZvv6WZ7LqH73BiRPhxU=
github.com/multiversx/mx-chain-crypto-go v1.2.8/go.mod h1:fkaWKp1rbQN9wPKya5jeoRyC+c/SyN/NfggreyeBw+8=
github.com/multiversx/mx-chain-logger-go v1.0.13 h1:eru/TETo0MkO4ZTnXsQDKf4PBRpAXmqjT02klNT/JnY=
github.com/multiversx/mx-chain-logger-go v1.0.13/go.mod h1:MZJhTAtZTJxT+yK2EHc4ZW3YOHUc1UdjCD0iahRNBZk=
github.com/multiversx/mx-chain-scenario-go v1.2.1 h1:9eC6VcOEAKRRKZ7EbSWPLzCdNIMWwuNBtAZlgR4cSMA=
github.com/multiversx/mx-chain-scenario-go v1.2.1/go.mod h1:EuZY7DpNFHVNSxJR8dKE1z2I8gBYfEFFPSwNUOXptqE=
github.com/multiversx/mx-chain-vm-common-go v1.5.6 h1:hAWCIkFc5vcweBzpataVsJf0PCPc7tfQBGW/q8nzQ8A=
github.com/multiversx/mx-chain-vm-common-go v1.5.6/go.mod h1:S8bbBlbOVKgl8YBnlmmHakYiSXjKPcSd6WW+Nku/Xys=
github.com/multiversx/mx-chain-vm-common-go v1.5.9-0.20231123115741-c8a4816c447a h1:LYEKM1wKOiT3SKqYIJEUDVZEV7VM5ISVjXkg1Jbxsk0=
github.com/multiversx/mx-chain-vm-common-go v1.5.9-0.20231123115741-c8a4816c447a/go.mod h1:Uu29N9DDx6iWDrDVPRUiLosrzlbNsYgpNfyhOQztEfE=
github.com/multiversx/mx-components-big-int v1.0.0 h1:Wkr8lSzK2nDqixOrrBa47VNuqdhV1m/aJhaP1EMaiS8=
github.com/multiversx/mx-components-big-int v1.0.0/go.mod h1:maIEMgHlNE2u78JaDD0oLzri+ShgU4okHfzP3LWGdQM=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
Expand Down
24 changes: 12 additions & 12 deletions integrationTests/json/scenariosAdderLog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
)

const expectedAdderLog = `starting log:
GetFunctionNames: [add callBack getSum init]
GetFunctionNames: [add callBack getSum init upgrade]
ValidateFunctionArities: true
GetFunctionNames: [add callBack getSum init]
GetFunctionNames: [add callBack getSum init]
GetFunctionNames: [add callBack getSum init upgrade]
GetFunctionNames: [add callBack getSum init upgrade]
HasFunction(init): true
CallFunction(init):
VM hook begin: CheckNoPayment()
Expand All @@ -23,12 +23,12 @@ VM hook begin: BigIntGetUnsignedArgument(0, -101)
GetPointsUsed: 249
SetPointsUsed: 1249
VM hook end: BigIntGetUnsignedArgument(0, -101)
VM hook begin: MBufferSetBytes(-102, 1048601, 3)
VM hook begin: MBufferSetBytes(-102, 131097, 3)
GetPointsUsed: 1289
SetPointsUsed: 3289
GetPointsUsed: 3289
SetPointsUsed: 6289
VM hook end: MBufferSetBytes(-102, 1048601, 3)
VM hook end: MBufferSetBytes(-102, 131097, 3)
VM hook begin: MBufferFromBigIntUnsigned(-103, -101)
GetPointsUsed: 6333
SetPointsUsed: 10333
Expand All @@ -52,7 +52,7 @@ GetPointsUsed: 135352
GetPointsUsed: 135352
Reset: true
SetPointsUsed: 0
SetGasLimit: 9223372036853567307
SetGasLimit: 9223372036853566707
SetBreakpointValue: 0
HasFunction(getSum): true
CallFunction(getSum):
Expand All @@ -64,12 +64,12 @@ VM hook begin: GetNumArguments()
GetPointsUsed: 110
SetPointsUsed: 210
VM hook end: GetNumArguments()
VM hook begin: MBufferSetBytes(-101, 1048601, 3)
VM hook begin: MBufferSetBytes(-101, 131097, 3)
GetPointsUsed: 250
SetPointsUsed: 2250
GetPointsUsed: 2250
SetPointsUsed: 5250
VM hook end: MBufferSetBytes(-101, 1048601, 3)
VM hook end: MBufferSetBytes(-101, 131097, 3)
VM hook begin: MBufferStorageLoad(-101, -102)
GetPointsUsed: 5291
SetPointsUsed: 6291
Expand Down Expand Up @@ -97,7 +97,7 @@ GetPointsUsed: 71337
GetPointsUsed: 71337
Reset: true
SetPointsUsed: 0
SetGasLimit: 3791500
SetGasLimit: 3790900
SetBreakpointValue: 0
HasFunction(add): true
CallFunction(add):
Expand All @@ -113,12 +113,12 @@ VM hook begin: BigIntGetUnsignedArgument(0, -101)
GetPointsUsed: 249
SetPointsUsed: 1249
VM hook end: BigIntGetUnsignedArgument(0, -101)
VM hook begin: MBufferSetBytes(-102, 1048601, 3)
VM hook begin: MBufferSetBytes(-102, 131097, 3)
GetPointsUsed: 1289
SetPointsUsed: 3289
GetPointsUsed: 3289
SetPointsUsed: 6289
VM hook end: MBufferSetBytes(-102, 1048601, 3)
VM hook end: MBufferSetBytes(-102, 131097, 3)
VM hook begin: MBufferStorageLoad(-102, -103)
GetPointsUsed: 6333
SetPointsUsed: 7333
Expand Down Expand Up @@ -161,7 +161,7 @@ Clean: true

func TestRustAdderLog(t *testing.T) {
ScenariosTest(t).
Folder("adder/scenarios").
Folder("adder/scenarios/adder.scen.json").
WithExecutorLogs().
Run().
CheckNoError().
Expand Down
3 changes: 2 additions & 1 deletion integrationTests/json/scenariosContracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestESDTMultiTransferOnCallback(t *testing.T) {

func TestCreateAsyncCall(t *testing.T) {
ScenariosTest(t).
Folder("features/composability/scenarios-promises").
Folder("features/composability/scenarios").
File("promises_single_transfer.scen.json").
Run().
CheckNoError()
Expand All @@ -60,6 +60,7 @@ func TestCreateAsyncCall(t *testing.T) {
func TestMultisig(t *testing.T) {
ScenariosTest(t).
Folder("multisig/scenarios").
Exclude("multisig/scenarios/interactor*").
Run().
CheckNoError()
}
Expand Down
6 changes: 4 additions & 2 deletions integrationTests/json/scenariosExecutorLogs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func TestCreateAsyncCallLog(t *testing.T) {
}

expected := ScenariosTest(t).
Folder("features/composability/scenarios-promises").
Folder("features/composability/scenarios").
File("promises_single_transfer.scen.json").
WithExecutorFactory(wasmer.ExecutorFactory()).
WithExecutorLogs().
Expand All @@ -158,7 +158,7 @@ func TestCreateAsyncCallLog(t *testing.T) {
ExtractLog()

ScenariosTest(t).
Folder("features/composability/scenarios-promises").
Folder("features/composability/scenarios").
File("promises_single_transfer.scen.json").
WithExecutorFactory(wasmer2.ExecutorFactory()).
WithExecutorLogs().
Expand Down Expand Up @@ -198,6 +198,7 @@ func TestMultisigLog(t *testing.T) {

expected := ScenariosTest(t).
Folder("multisig/scenarios").
Exclude("multisig/scenarios/interactor*").
WithExecutorFactory(wasmer.ExecutorFactory()).
WithExecutorLogs().
Run().
Expand All @@ -206,6 +207,7 @@ func TestMultisigLog(t *testing.T) {

ScenariosTest(t).
Folder("multisig/scenarios").
Exclude("multisig/scenarios/interactor*").
WithExecutorFactory(wasmer2.ExecutorFactory()).
WithExecutorLogs().
Run().
Expand Down
16 changes: 1 addition & 15 deletions integrationTests/json/scenariosFeatures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestRustBasicFeaturesLatest(t *testing.T) {
ScenariosTest(t).
Folder("features/basic-features/scenarios").
Exclude("features/basic-features/scenarios/storage_mapper_fungible_token.scen.json").
Exclude("features/basic-features/scenarios/get_shard_of_address.scen.json").
Run().
CheckNoError()
}
Expand Down Expand Up @@ -90,21 +91,6 @@ func TestRustComposability(t *testing.T) {
CheckNoError()
}

func TestRustPromisesFeatures(t *testing.T) {
ScenariosTest(t).
Folder("features/composability/scenarios-promises").
Run().
CheckNoError()
}

// TODO: debug, then delete
func TestRustPromisesFeaturesDebug(t *testing.T) {
ScenariosTest(t).
Folder("features/composability/scenarios-promises/promises_call_async_retrieve_egld.scen.json").
Run().
CheckNoError()
}

func TestRustFormattedMessageFeatures(t *testing.T) {
ScenariosTest(t).
Folder("features/formatted-message-features/scenarios").
Expand Down
6 changes: 6 additions & 0 deletions mock/contracts/deployerSimpleSC.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ func InitMockMethod(instanceMock *mock.InstanceMock, config interface{}) {
instanceMock.AddMockMethod("init", testcommon.SimpleWasteGasMockMethod(instanceMock, testConfig.GasUsedByInit))
}

// UpgradeMockMethod -
func UpgradeMockMethod(instanceMock *mock.InstanceMock, config interface{}) {
testConfig := config.(*testcommon.TestConfig)
instanceMock.AddMockMethod("upgrade", testcommon.SimpleWasteGasMockMethod(instanceMock, testConfig.GasUsedByInit))
}

// CallbackTestConfig -
type CallbackTestConfig interface {
CallbackFails() bool
Expand Down
Binary file modified test/adder/output/adder.wasm
Binary file not shown.
80 changes: 80 additions & 0 deletions test/adder/scenarios/interactor_trace.scen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"steps": [
{
"step": "setState",
"accounts": {
"0xe32afedc904fe1939746ad973beb383563cf63642ba669b3040f9b9428a5ed60": {
"nonce": "481",
"balance": "106274669842530000003",
"esdt": {
"str:CAN-14dc0a": "1000",
"str:CAN-2abf4b": "1000",
"str:CAN-6d39e6": "1000",
"str:CAN-ac1592": "1000"
},
"username": ""
}
}
},
{
"step": "setState",
"newAddresses": [
{
"creatorAddress": "0xe32afedc904fe1939746ad973beb383563cf63642ba669b3040f9b9428a5ed60",
"creatorNonce": "481",
"newAddress": "0x0000000000000000050028600ceb73ac22ec0b6f257aff7bed74dffa3ebfed60"
}
]
},
{
"step": "scDeploy",
"id": "",
"tx": {
"from": "0xe32afedc904fe1939746ad973beb383563cf63642ba669b3040f9b9428a5ed60",
"contractCode": "file:../output/adder.wasm",
"arguments": [
"0x00"
],
"gasLimit": "70,000,000",
"gasPrice": ""
},
"expect": {
"status": "0"
}
},
{
"step": "scCall",
"id": "",
"tx": {
"from": "0xe32afedc904fe1939746ad973beb383563cf63642ba669b3040f9b9428a5ed60",
"to": "0x0000000000000000050028600ceb73ac22ec0b6f257aff7bed74dffa3ebfed60",
"function": "add",
"arguments": [
"0x07"
],
"gasLimit": "70,000,000",
"gasPrice": ""
},
"expect": {
"status": "0"
}
},
{
"step": "scCall",
"id": "",
"tx": {
"from": "0xe32afedc904fe1939746ad973beb383563cf63642ba669b3040f9b9428a5ed60",
"to": "0x0000000000000000050028600ceb73ac22ec0b6f257aff7bed74dffa3ebfed60",
"function": "add",
"arguments": [
"0x05"
],
"gasLimit": "70,000,000",
"gasPrice": ""
},
"expect": {
"status": "0"
}
}
]
}
4 changes: 4 additions & 0 deletions test/contracts/init-correct/init-correct.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ void init() {
}
}
}

void upgrade() {
init();
}
1 change: 1 addition & 0 deletions test/contracts/init-correct/init-correct.export
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
init
upgrade
Binary file modified test/contracts/init-correct/output/init-correct.wasm
Binary file not shown.
Binary file modified test/crowdfunding-esdt/output/crowdfunding-esdt.wasm
Binary file not shown.
Loading
Loading