From f233906c1433127901038723429d9114d216976d Mon Sep 17 00:00:00 2001 From: Laurentiu Ciobanu Date: Tue, 16 Jul 2024 12:58:37 +0000 Subject: [PATCH 1/2] update vmcommon and use LegacyBlockchainHook interface --- go.mod | 2 +- go.sum | 4 ++-- mock/context/blockChainHookStub.go | 4 ++-- testcommon/testInitializer_inputs.go | 4 ++-- vmhost/contexts/blockchain.go | 4 ++-- vmhost/contexts/storage.go | 4 ++-- vmhost/hostCore/host.go | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 56fbe3e4..d644968d 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( 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.20240716084819-890cf285a584 github.com/multiversx/mx-components-big-int v1.0.0 github.com/pelletier/go-toml v1.9.3 github.com/stretchr/testify v1.8.3 diff --git a/go.sum b/go.sum index 22939b96..a3433714 100644 --- a/go.sum +++ b/go.sum @@ -120,8 +120,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.20240716084819-890cf285a584 h1:f4ybUYrES2XzumD9KsLzXfy/QdR9LiX1nJ4Nz2eBID4= +github.com/multiversx/mx-chain-vm-common-go v1.5.13-0.20240716084819-890cf285a584/go.mod h1:RgGmPei0suQcFTHfO4cS5dxJSiokp2SM5lmNgp1icMo= 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= diff --git a/mock/context/blockChainHookStub.go b/mock/context/blockChainHookStub.go index aa66e4a8..330771d4 100644 --- a/mock/context/blockChainHookStub.go +++ b/mock/context/blockChainHookStub.go @@ -5,10 +5,10 @@ import ( "math/big" "github.com/multiversx/mx-chain-core-go/data/esdt" - "github.com/multiversx/mx-chain-vm-common-go" + vmcommon "github.com/multiversx/mx-chain-vm-common-go" ) -var _ vmcommon.BlockchainHook = (*BlockchainHookStub)(nil) +var _ vmcommon.LegacyBlockchainHook = (*BlockchainHookStub)(nil) // BlockchainHookStub is used in tests to check that interface methods were called type BlockchainHookStub struct { diff --git a/testcommon/testInitializer_inputs.go b/testcommon/testInitializer_inputs.go index 5121bdee..08315cd6 100644 --- a/testcommon/testInitializer_inputs.go +++ b/testcommon/testInitializer_inputs.go @@ -344,7 +344,7 @@ func DefaultTestVMWithWorldMockWithGasSchedule(tb testing.TB, customGasSchedule } // DefaultTestVM creates a host configured with a blockchain hook -func DefaultTestVM(tb testing.TB, blockchain vmcommon.BlockchainHook) vmhost.VMHost { +func DefaultTestVM(tb testing.TB, blockchain vmcommon.LegacyBlockchainHook) vmhost.VMHost { customGasSchedule := config.GasScheduleMap(nil) return DefaultTestVMWithGasSchedule(tb, blockchain, customGasSchedule, false) } @@ -352,7 +352,7 @@ func DefaultTestVM(tb testing.TB, blockchain vmcommon.BlockchainHook) vmhost.VMH // DefaultTestVMWithGasSchedule creates a host with the provided blockchain hook and gas schedule func DefaultTestVMWithGasSchedule( tb testing.TB, - blockchain vmcommon.BlockchainHook, + blockchain vmcommon.LegacyBlockchainHook, customGasSchedule config.GasScheduleMap, wasmerSIGSEGVPassthrough bool, ) vmhost.VMHost { diff --git a/vmhost/contexts/blockchain.go b/vmhost/contexts/blockchain.go index ce663b5e..0467908f 100644 --- a/vmhost/contexts/blockchain.go +++ b/vmhost/contexts/blockchain.go @@ -13,14 +13,14 @@ var log = logger.GetOrCreate("vm/blockchainContext") type blockchainContext struct { host vmhost.VMHost - blockChainHook vmcommon.BlockchainHook + blockChainHook vmcommon.LegacyBlockchainHook stateStack []int } // NewBlockchainContext creates a new blockchainContext func NewBlockchainContext( host vmhost.VMHost, - blockChainHook vmcommon.BlockchainHook, + blockChainHook vmcommon.LegacyBlockchainHook, ) (*blockchainContext, error) { context := &blockchainContext{ diff --git a/vmhost/contexts/storage.go b/vmhost/contexts/storage.go index 774ae569..b450e6b1 100644 --- a/vmhost/contexts/storage.go +++ b/vmhost/contexts/storage.go @@ -14,7 +14,7 @@ var logStorage = logger.GetOrCreate("vm/storage") type storageContext struct { host vmhost.VMHost - blockChainHook vmcommon.BlockchainHook + blockChainHook vmcommon.LegacyBlockchainHook address []byte stateStack [][]byte protectedKeyPrefix []byte @@ -24,7 +24,7 @@ type storageContext struct { // NewStorageContext creates a new storageContext func NewStorageContext( host vmhost.VMHost, - blockChainHook vmcommon.BlockchainHook, + blockChainHook vmcommon.LegacyBlockchainHook, protectedKeyPrefix []byte, ) (*storageContext, error) { if len(protectedKeyPrefix) == 0 { diff --git a/vmhost/hostCore/host.go b/vmhost/hostCore/host.go index e9de5a30..e10fce84 100644 --- a/vmhost/hostCore/host.go +++ b/vmhost/hostCore/host.go @@ -72,7 +72,7 @@ type vmHost struct { // NewVMHost creates a new VM vmHost func NewVMHost( - blockChainHook vmcommon.BlockchainHook, + blockChainHook vmcommon.LegacyBlockchainHook, hostParameters *vmhost.VMHostParameters, ) (vmhost.VMHost, error) { From 9655bc0017ec5f7ce24aa3315e41be95685fc3a5 Mon Sep 17 00:00:00 2001 From: Laurentiu Ciobanu Date: Tue, 16 Jul 2024 13:15:10 +0000 Subject: [PATCH 2/2] update scenario-go --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d644968d..9b79f7ab 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/multiversx/mx-chain-core-go v1.2.21-0.20240508071047-fefea5737840 github.com/multiversx/mx-chain-crypto-go v1.2.12-0.20240508074452-cc21c1b505df 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-scenario-go v1.4.4-0.20240716122141-cb25f6e7cef0 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.20240716084819-890cf285a584 github.com/multiversx/mx-components-big-int v1.0.0 diff --git a/go.sum b/go.sum index a3433714..8bcc3286 100644 --- a/go.sum +++ b/go.sum @@ -116,8 +116,8 @@ github.com/multiversx/mx-chain-crypto-go v1.2.12-0.20240508074452-cc21c1b505df h github.com/multiversx/mx-chain-crypto-go v1.2.12-0.20240508074452-cc21c1b505df/go.mod h1:gtJYB4rR21KBSqJlazn+2z6f9gFSqQP3KvAgL7Qgxw4= github.com/multiversx/mx-chain-logger-go v1.0.15-0.20240508072523-3f00a726af57 h1:g9t410dqjcb7UUptbVd/H6Ua12sEzWU4v7VplyNvRZ0= github.com/multiversx/mx-chain-logger-go v1.0.15-0.20240508072523-3f00a726af57/go.mod h1:cY6CIXpndW5g5PTPn4WzPwka/UBEf+mgw+PSY5pHGAU= -github.com/multiversx/mx-chain-scenario-go v1.4.4-0.20240509103754-9e8129721f00 h1:hFEcbGBtXu8UyB9BMhmAIH2R8BtV/NOq/rsxespLCN8= -github.com/multiversx/mx-chain-scenario-go v1.4.4-0.20240509103754-9e8129721f00/go.mod h1:pnIIfWopbDMQ1EW5Ddc6KDMqv8Qtx+hxbH9rorHpCyo= +github.com/multiversx/mx-chain-scenario-go v1.4.4-0.20240716122141-cb25f6e7cef0 h1:kyf4meBS6n8Km9ds2OQIn/V1u67AzVv0cALct1l4z9s= +github.com/multiversx/mx-chain-scenario-go v1.4.4-0.20240716122141-cb25f6e7cef0/go.mod h1:IelKhXNV/5Q2SlgMYsf+Dh+WCtIJcss0evvX22s5stw= 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.20240716084819-890cf285a584 h1:f4ybUYrES2XzumD9KsLzXfy/QdR9LiX1nJ4Nz2eBID4=