-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6153 from multiversx/feat/refactor-runtype-compon…
…ents Feat/refactor runtype components
- Loading branch information
Showing
108 changed files
with
3,570 additions
and
1,830 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package disabled | ||
|
||
import ( | ||
"github.com/multiversx/mx-chain-core-go/data/sovereign" | ||
) | ||
|
||
type outGoingOperationsPool struct { | ||
} | ||
|
||
// NewDisabledOutGoingOperationPool - | ||
func NewDisabledOutGoingOperationPool() *outGoingOperationsPool { | ||
return &outGoingOperationsPool{} | ||
} | ||
|
||
// Add - | ||
func (op *outGoingOperationsPool) Add(_ *sovereign.BridgeOutGoingData) {} | ||
|
||
// Get - | ||
func (op *outGoingOperationsPool) Get(_ []byte) *sovereign.BridgeOutGoingData { | ||
return &sovereign.BridgeOutGoingData{} | ||
} | ||
|
||
// Delete - | ||
func (op *outGoingOperationsPool) Delete(_ []byte) {} | ||
|
||
// ConfirmOperation - | ||
func (op *outGoingOperationsPool) ConfirmOperation(_ []byte, _ []byte) error { | ||
return nil | ||
} | ||
|
||
// GetUnconfirmedOperations - | ||
func (op *outGoingOperationsPool) GetUnconfirmedOperations() []*sovereign.BridgeOutGoingData { | ||
return make([]*sovereign.BridgeOutGoingData, 0) | ||
} | ||
|
||
// IsInterfaceNil checks if the underlying pointer is nil | ||
func (op *outGoingOperationsPool) IsInterfaceNil() bool { | ||
return op == nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package runType | ||
|
||
import ( | ||
"github.com/multiversx/mx-chain-go/genesis" | ||
"github.com/multiversx/mx-chain-go/genesis/data" | ||
|
||
"github.com/multiversx/mx-chain-core-go/core" | ||
) | ||
|
||
// ReadInitialAccounts returns the genesis accounts from a file | ||
func ReadInitialAccounts(filePath string) ([]genesis.InitialAccountHandler, error) { | ||
initialAccounts := make([]*data.InitialAccount, 0) | ||
err := core.LoadJsonFile(&initialAccounts, filePath) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var accounts []genesis.InitialAccountHandler | ||
for _, ia := range initialAccounts { | ||
accounts = append(accounts, ia) | ||
} | ||
|
||
return accounts, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package runType | ||
|
||
import ( | ||
"math/big" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestReadInitialAccounts(t *testing.T) { | ||
t.Parallel() | ||
|
||
t.Run("empty path should error", func(t *testing.T) { | ||
accounts, err := ReadInitialAccounts("") | ||
require.Nil(t, accounts) | ||
require.Error(t, err) | ||
}) | ||
t.Run("should work", func(t *testing.T) { | ||
accounts, err := ReadInitialAccounts("../../genesis/process/testdata/genesisTest1.json") | ||
require.Nil(t, err) | ||
require.NotNil(t, accounts) | ||
require.True(t, len(accounts) > 0) | ||
require.Equal(t, "a00102030405060708090001020304050607080900010203040506070809000a", accounts[0].GetAddress()) | ||
require.Equal(t, "b00102030405060708090001020304050607080900010203040506070809000b", accounts[1].GetAddress()) | ||
require.Equal(t, "c00102030405060708090001020304050607080900010203040506070809000c", accounts[2].GetAddress()) | ||
require.Equal(t, big.NewInt(10000), accounts[2].GetSupply()) | ||
require.Equal(t, big.NewInt(0), accounts[2].GetBalanceValue()) | ||
require.Equal(t, big.NewInt(0), accounts[2].GetStakingValue()) | ||
require.Equal(t, "00000000000000000500f080f48551abf03e12e27e20d9f077abedffdccc0102", accounts[2].GetDelegationHandler().GetAddress()) | ||
require.Equal(t, big.NewInt(10000), accounts[2].GetDelegationHandler().GetValue()) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package sovereign | ||
|
||
import ( | ||
sovereignCore "github.com/multiversx/mx-chain-core-go/data/sovereign" | ||
) | ||
|
||
// OutGoingOperationsPool defines the behavior of a timed cache for outgoing operations | ||
type OutGoingOperationsPool interface { | ||
Add(data *sovereignCore.BridgeOutGoingData) | ||
Get(hash []byte) *sovereignCore.BridgeOutGoingData | ||
Delete(hash []byte) | ||
GetUnconfirmedOperations() []*sovereignCore.BridgeOutGoingData | ||
ConfirmOperation(hashOfHashes []byte, hash []byte) error | ||
IsInterfaceNil() bool | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.