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/sovereign #118

Draft
wants to merge 96 commits into
base: rc/spica-patch-relayedv3
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
960fa19
sovereign chain simulator
axenteoctavian Feb 3, 2025
73632b5
fixes after self review
axenteoctavian Feb 3, 2025
17529c2
proxy go mod update
axenteoctavian Feb 3, 2025
b79c2b5
test update
axenteoctavian Feb 3, 2025
bae789f
go mod update
axenteoctavian Feb 3, 2025
df7e11f
fixes after testing
axenteoctavian Feb 4, 2025
1deb2a7
proxy config fix
axenteoctavian Feb 4, 2025
bb7aa06
PR build action
axenteoctavian Feb 4, 2025
43d25b9
PR build action
axenteoctavian Feb 4, 2025
5e82eaf
PR build action
axenteoctavian Feb 4, 2025
e7bf3d0
PR build action
axenteoctavian Feb 4, 2025
f53a5f2
PR build action
axenteoctavian Feb 4, 2025
cc033ae
PR build action
axenteoctavian Feb 4, 2025
0639bda
PR build action
axenteoctavian Feb 4, 2025
47802a9
PR build action
axenteoctavian Feb 4, 2025
8def334
PR build action
axenteoctavian Feb 4, 2025
3ef8acf
PR tests action and unit tests fixes
axenteoctavian Feb 4, 2025
d52fd88
PR multiple instances action
axenteoctavian Feb 4, 2025
380b809
PR vm query action
axenteoctavian Feb 4, 2025
c697c2e
PR run examples action
axenteoctavian Feb 4, 2025
a4bce5e
PR actions
axenteoctavian Feb 4, 2025
3bdc68c
PR golangci-lint action
axenteoctavian Feb 4, 2025
c13c6ce
PR actions fixes
axenteoctavian Feb 4, 2025
8175104
PR run examples action
axenteoctavian Feb 4, 2025
da5285e
PR actions fixes
axenteoctavian Feb 4, 2025
5760362
PR linter action
axenteoctavian Feb 4, 2025
03ad1a9
PR run examples action
axenteoctavian Feb 4, 2025
7b6bb53
staking test update
axenteoctavian Feb 4, 2025
be3005c
new go.mod
axenteoctavian Feb 6, 2025
10ed888
fixes after self review
axenteoctavian Feb 6, 2025
b06eeae
sovereign cs docker
axenteoctavian Feb 7, 2025
8e004b4
readme update
axenteoctavian Feb 7, 2025
c9ca149
fix github action
axenteoctavian Feb 7, 2025
b785e96
fix github action
axenteoctavian Feb 7, 2025
4428109
github actions fixes
axenteoctavian Feb 7, 2025
8f0170c
readme update
axenteoctavian Feb 7, 2025
c21f882
GitHub actions update
axenteoctavian Feb 7, 2025
947ce15
GitHub actions update
axenteoctavian Feb 7, 2025
7d7b098
GitHub actions update
axenteoctavian Feb 7, 2025
bdbe634
GitHub actions update
axenteoctavian Feb 7, 2025
19fb062
GitHub actions update
axenteoctavian Feb 10, 2025
3d6463f
GitHub actions update
axenteoctavian Feb 10, 2025
5a11e9f
GitHub actions update
axenteoctavian Feb 10, 2025
4f14dff
flags update
axenteoctavian Feb 10, 2025
2c0cf2f
fixes for docker and github actions
axenteoctavian Feb 10, 2025
9afdf22
makefile fixes
axenteoctavian Feb 10, 2025
0acdbcb
fixes after self review
axenteoctavian Feb 11, 2025
97309b8
fix github action
axenteoctavian Feb 11, 2025
0178316
fix github actions
axenteoctavian Feb 11, 2025
a7e03fb
using temporary go.mod with updated chain simulator binary
axenteoctavian Feb 11, 2025
f84ef21
go.mod updated
axenteoctavian Feb 14, 2025
649f41e
fixes after review
axenteoctavian Feb 18, 2025
5acc994
rollback test
axenteoctavian Feb 19, 2025
f41c891
docker updates
axenteoctavian Feb 19, 2025
b1d3331
yaml file fixes
axenteoctavian Feb 19, 2025
2f37d26
latest chain-go-sdk tag
axenteoctavian Feb 20, 2025
7f25e0a
Merge branch 'feat/sovereign' into MX-16491-sovereign-chain-simulator
axenteoctavian Feb 24, 2025
0f84f56
test github action
axenteoctavian Feb 24, 2025
4a26f31
test github action
axenteoctavian Feb 24, 2025
a9675de
test github action
axenteoctavian Feb 24, 2025
587b46c
test github action
axenteoctavian Feb 24, 2025
51c55ee
github action test fix
axenteoctavian Feb 24, 2025
333130a
request timeout fix
axenteoctavian Feb 24, 2025
cad948d
fix action name
axenteoctavian Feb 24, 2025
3cefea4
uncomment scripts
axenteoctavian Feb 24, 2025
bbcd45b
Dockerfile update
axenteoctavian Feb 25, 2025
488515a
README.md update
axenteoctavian Feb 25, 2025
a67f358
Dockerfile update
axenteoctavian Feb 25, 2025
d41fde7
Dockerfile update
axenteoctavian Feb 25, 2025
36438a1
Docker update
axenteoctavian Feb 25, 2025
539e2e8
test update
axenteoctavian Feb 25, 2025
663169e
update timeout in test
axenteoctavian Feb 25, 2025
0f55617
fixes after self review
axenteoctavian Mar 3, 2025
8c6f43b
docker action fix
axenteoctavian Mar 4, 2025
320b777
added make command for sovereign build
axenteoctavian Mar 4, 2025
85ba939
Merge branch 'feat/sovereign' into MX-16491-sovereign-chain-simulator
axenteoctavian Mar 4, 2025
230feb1
fix after review
axenteoctavian Mar 5, 2025
8bafec2
Merge pull request #107 from multiversx/MX-16491-sovereign-chain-simu…
axenteoctavian Mar 5, 2025
a220236
sovereign fork
axenteoctavian Mar 17, 2025
ab87276
docker fix
axenteoctavian Mar 17, 2025
9196cf0
docker fix
axenteoctavian Mar 17, 2025
e061898
FIX: Go mod for sovereign fork
mariusmihaic Mar 18, 2025
1db193b
Merge pull request #122 from multiversx/sovereign-fork-with-one-go-mod
axenteoctavian Mar 18, 2025
34f4568
update fetch configs and github action
axenteoctavian Mar 19, 2025
19e4521
fix configs fetcher and unit tests
axenteoctavian Mar 19, 2025
c41f12f
update configs fetcher
axenteoctavian Mar 19, 2025
9c0f4cf
update configs fetcher and unit tests
axenteoctavian Mar 19, 2025
b6e13c6
update script
axenteoctavian Mar 19, 2025
694ab71
fixes after review
axenteoctavian Mar 19, 2025
e1e1f23
rollback config.toml to work with both normal and sovereign
axenteoctavian Mar 19, 2025
d3f3697
Merge pull request #120 from multiversx/sovereign-fork
axenteoctavian Mar 21, 2025
1c7d055
Sovereign node override file
axenteoctavian Mar 26, 2025
a5fc205
Sovereign node override file
axenteoctavian Mar 26, 2025
6fdd6b0
added func comment
axenteoctavian Mar 26, 2025
8e6e5d6
fix after review
axenteoctavian Mar 26, 2025
cfe13d4
Merge pull request #125 from multiversx/sovereign-node-override-file
axenteoctavian Mar 26, 2025
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
Prev Previous commit
Next Next commit
PR tests action and unit tests fixes
axenteoctavian committed Feb 4, 2025
commit 3ef8acfdd10f92149da6b932a2febdbe04ac0e80
17 changes: 14 additions & 3 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
@@ -13,13 +13,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.20.7
id: go

- name: Check out code
uses: actions/checkout@v2
- name: Checkout mx-chain-go
uses: actions/checkout@v4
with:
repository: 'multiversx/mx-chain-go'
ref: 'feat/chain-go-sdk'
path: 'mx-chain-go'

- name: Checkout mx-chain-simulator-go
uses: actions/checkout@v4
with:
path: 'mx-chain-simulator-go'

- name: Unit tests
run: |
cd mx-chain-simulator-go
go test ./...
46 changes: 24 additions & 22 deletions pkg/facade/simulatorFacade_test.go
Original file line number Diff line number Diff line change
@@ -6,16 +6,18 @@ import (
"strings"
"testing"

"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/data/transaction"
"github.com/multiversx/mx-chain-go/factory"
"github.com/multiversx/mx-chain-go/factory/mock"
"github.com/multiversx/mx-chain-go/node/chainSimulator/dtos"
"github.com/multiversx/mx-chain-go/node/chainSimulator/process"
"github.com/multiversx/mx-chain-proxy-go/data"
dtoc "github.com/multiversx/mx-chain-simulator-go/pkg/dtos"
"github.com/multiversx/mx-chain-simulator-go/testscommon"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

dtoc "github.com/multiversx/mx-chain-simulator-go/pkg/dtos"
"github.com/multiversx/mx-chain-simulator-go/testscommon"
)

func TestNewSimulatorFacade(t *testing.T) {
@@ -24,14 +26,14 @@ func TestNewSimulatorFacade(t *testing.T) {
t.Run("nil simulator should error", func(t *testing.T) {
t.Parallel()

facade, err := NewSimulatorFacade(nil, &testscommon.TransactionHandlerMock{})
facade, err := NewSimulatorFacade(nil, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
require.Equal(t, errNilSimulatorHandler, err)
require.Nil(t, facade)
})
t.Run("should work", func(t *testing.T) {
t.Parallel()

facade, err := NewSimulatorFacade(&testscommon.SimulatorHandlerMock{}, &testscommon.TransactionHandlerMock{})
facade, err := NewSimulatorFacade(&testscommon.SimulatorHandlerMock{}, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
require.NoError(t, err)
require.NotNil(t, facade)
})
@@ -43,7 +45,7 @@ func TestSimulatorFacade_IsInterfaceNil(t *testing.T) {
var facade *simulatorFacade
require.True(t, facade.IsInterfaceNil())

facade, _ = NewSimulatorFacade(&testscommon.SimulatorHandlerMock{}, &testscommon.TransactionHandlerMock{})
facade, _ = NewSimulatorFacade(&testscommon.SimulatorHandlerMock{}, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
require.False(t, facade.IsInterfaceNil())
}

@@ -56,7 +58,7 @@ func TestSimulatorFacade_GenerateBlocks(t *testing.T) {
cnt++
return nil
},
}, &testscommon.TransactionHandlerMock{})
}, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
require.NoError(t, err)

err = facade.GenerateBlocks(0)
@@ -77,7 +79,7 @@ func TestSimulatorFacade_GetInitialWalletKeys(t *testing.T) {
wasCalled = true
return providedInitialWalletKeys
},
}, &testscommon.TransactionHandlerMock{})
}, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
require.NoError(t, err)

walletKeys := facade.GetInitialWalletKeys()
@@ -99,7 +101,7 @@ func TestSimulatorFacade_SetKeyValueForAddress(t *testing.T) {

return nil
},
}, &testscommon.TransactionHandlerMock{})
}, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
require.NoError(t, err)

err = facade.SetKeyValueForAddress(providedAddress, providedKeyValue)
@@ -119,7 +121,7 @@ func TestSimulatorFacade_SetStateMultiple(t *testing.T) {

return nil
},
}, &testscommon.TransactionHandlerMock{})
}, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
require.NoError(t, err)

err = facade.SetStateMultiple(providedStateSlice, true)
@@ -140,7 +142,7 @@ func TestSimulatorFacade_GenerateBlocksUntilEpochIsReached(t *testing.T) {
},
}

facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{})
facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
err := facade.GenerateBlocksUntilEpochIsReached(testEpoch)
assert.Nil(t, err)
assert.True(t, generateBlocksCalled)
@@ -163,7 +165,7 @@ func TestSimulatorFacade_AddValidatorKeys(t *testing.T) {

return nil
},
}, &testscommon.TransactionHandlerMock{})
}, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
require.NoError(t, err)

err = facade.AddValidatorKeys(providedValidators)
@@ -183,7 +185,7 @@ func TestSimulatorFacade_AddValidatorKeys(t *testing.T) {

return nil
},
}, &testscommon.TransactionHandlerMock{})
}, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
require.NoError(t, err)

err = facade.AddValidatorKeys(providedValidators)
@@ -212,7 +214,7 @@ func TestSimulatorFacade_AddValidatorKeys(t *testing.T) {

return nil
},
}, &testscommon.TransactionHandlerMock{})
}, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
require.NoError(t, err)

err = facade.AddValidatorKeys(providedValidators)
@@ -232,7 +234,7 @@ func TestSimulatorFacade_ForceUpdateValidatorStatistics(t *testing.T) {
},
}

facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{})
facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
err := facade.ForceUpdateValidatorStatistics()
assert.Nil(t, err)
assert.True(t, forceResetCalled)
@@ -250,7 +252,7 @@ func TestSimulatorFacade_GetObserversInfo(t *testing.T) {
},
}

facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{})
facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)
response, err := facade.GetObserversInfo()
require.NoError(t, err)
require.Equal(t, map[uint32]*dtoc.ObserverInfo{
@@ -270,7 +272,7 @@ func TestSimulatorFacade_GenerateBlocksUntilTransactionIsProcessed_CannotGetTxSt
GetProcessedTransactionStatusCalled: func(txHash string) (*data.ProcessStatusResponse, error) {
return nil, expectedErr
},
})
}, core.MetachainShardId)

err := facade.GenerateBlocksUntilTransactionIsProcessed("txHash", 20)
require.Equal(t, expectedErr, err)
@@ -294,7 +296,7 @@ func TestSimulatorFacade_GenerateBlocksUntilTransactionIsProcessed_CannotGenerat
Status: transaction.TxStatusPending.String(),
}, nil
},
})
}, core.MetachainShardId)

err := facade.GenerateBlocksUntilTransactionIsProcessed("txHash", 20)
require.Equal(t, expectedErr, err)
@@ -315,7 +317,7 @@ func TestSimulatorFacade_GenerateBlocksUntilTransactionIsProcessed_ErrPendingTra
Status: transaction.TxStatusPending.String(),
}, nil
},
})
}, core.MetachainShardId)

err := facade.GenerateBlocksUntilTransactionIsProcessed("txHash", 20)
require.Equal(t, errPendingTransaction, err)
@@ -343,7 +345,7 @@ func TestSimulatorFacade_GenerateBlocksUntilTransactionIsProcessed_ShouldWork(t
Status: transaction.TxStatusPending.String(),
}, nil
},
})
}, core.MetachainShardId)

err := facade.GenerateBlocksUntilTransactionIsProcessed("txHash", 20)
require.Nil(t, err)
@@ -359,7 +361,7 @@ func TestSimulatorFacade_ForceChangeOfEpoch_TargetEpochLowerThanCurrentEpoch(t *
},
}

facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{})
facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)

err := facade.ForceChangeOfEpoch(5)
require.NotNil(t, err)
@@ -379,7 +381,7 @@ func TestSimulatorFacade_ForceChangeOfEpochError(t *testing.T) {
},
}

facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{})
facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)

err := facade.ForceChangeOfEpoch(5)
require.Equal(t, expectedErr, err)
@@ -394,7 +396,7 @@ func TestSimulatorFacade_ForceChangeOfEpoch(t *testing.T) {
},
}

facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{})
facade, _ := NewSimulatorFacade(simulator, &testscommon.TransactionHandlerMock{}, core.MetachainShardId)

err := facade.ForceChangeOfEpoch(5)
require.Nil(t, err)
23 changes: 22 additions & 1 deletion testscommon/nodeHandlerStub.go
Original file line number Diff line number Diff line change
@@ -6,12 +6,15 @@ import (
"github.com/multiversx/mx-chain-go/consensus"
"github.com/multiversx/mx-chain-go/factory"
"github.com/multiversx/mx-chain-go/node/chainSimulator/dtos"
"github.com/multiversx/mx-chain-go/process"
"github.com/multiversx/mx-chain-go/sharding"
)

// NodeHandlerStub -
type NodeHandlerStub struct {
GetProcessComponentsCalled func() factory.ProcessComponentsHolder
GetProcessComponentsCalled func() factory.ProcessComponentsHolder
GetRunTypeComponentsCalled func() factory.RunTypeComponentsHolder
GetIncomingHeaderSubscriberCalled func() process.IncomingHeaderSubscriber
}

// GetProcessComponents -
@@ -88,6 +91,24 @@ func (n *NodeHandlerStub) ForceChangeOfEpoch() error {
return nil
}

// GetRunTypeComponents -
func (n *NodeHandlerStub) GetRunTypeComponents() factory.RunTypeComponentsHolder {
if n.GetRunTypeComponentsCalled != nil {
return n.GetRunTypeComponentsCalled()
}

return nil
}

// GetIncomingHeaderSubscriber -
func (n *NodeHandlerStub) GetIncomingHeaderSubscriber() process.IncomingHeaderSubscriber {
if n.GetIncomingHeaderSubscriberCalled != nil {
return n.GetIncomingHeaderSubscriberCalled()
}

return nil
}

// Close -
func (n *NodeHandlerStub) Close() error {
return nil