Skip to content

Commit

Permalink
Merge branch 'feat/liquid-staking' into EN-12196-implement-soft-auction
Browse files Browse the repository at this point in the history
# Conflicts:
#	cmd/node/config/config.toml
#	config/config.go
#	testscommon/generalConfig.go
  • Loading branch information
mariusmihaic committed May 27, 2022
2 parents a05cdd3 + 47ee099 commit 2623fb7
Show file tree
Hide file tree
Showing 442 changed files with 25,562 additions and 4,624 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- main
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
build:
strategy:
Expand Down
8 changes: 4 additions & 4 deletions api/logs/logSender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func createMockLogSender() (*logs.LogSender, *mock.WsConnStub, io.Writer) {
return lsender, conn, ls.Writer()
}

//------- NewLogSender
// ------- NewLogSender

func TestNewLogSender_NilMarshalizerShouldErr(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -82,7 +82,7 @@ func TestNewLogSender_ShouldWork(t *testing.T) {
removeWriterFromLogSubsystem(ls.Writer())
}

//------- StartSendingBlocking
// ------- StartSendingBlocking

func TestLogSender_StartSendingBlockingConnReadMessageErrShouldCloseConn(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -144,7 +144,7 @@ func TestLogSender_StartSendingBlockingSendsMessage(t *testing.T) {
})

go func() {
//watchdog function
// watchdog function
time.Sleep(time.Millisecond * 10)

_ = ls.Writer().Close()
Expand All @@ -169,7 +169,7 @@ func TestLogSender_StartSendingBlockingSendsMessageAndStopsWhenReadClose(t *test
})

go func() {
//watchdog function
// watchdog function
time.Sleep(time.Millisecond * 10)

conn.SetReadMessageHandler(func() (messageType int, p []byte, err error) {
Expand Down
55 changes: 28 additions & 27 deletions api/mock/loggerStub.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,64 @@ import logger "github.com/ElrondNetwork/elrond-go-logger"

// LoggerStub -
type LoggerStub struct {
LogLineCalled func(level string, message string, args ...interface{})
LogCalled func(level logger.LogLevel, message string, args ...interface{})
LogLineCalled func(line *logger.LogLine)
SetLevelCalled func(logLevel logger.LogLevel)
}

// Log -
func (l *LoggerStub) Log(logLevel logger.LogLevel, message string, args ...interface{}) {
if l.LogCalled != nil {
l.LogCalled(logLevel, message, args...)
}
}

// LogLine -
func (l *LoggerStub) LogLine(line *logger.LogLine) {
if l.LogLineCalled != nil {
l.LogLineCalled(line)
}
}

// Trace -
func (l *LoggerStub) Trace(message string, args ...interface{}) {
if l.LogLineCalled != nil {
l.LogLineCalled("TRACE", message, args...)
if l.LogCalled != nil {
l.LogCalled(logger.LogTrace, message, args...)
}
}

// Debug -
func (l *LoggerStub) Debug(message string, args ...interface{}) {
if l.LogLineCalled != nil {
l.LogLineCalled("DEBUG", message, args...)
if l.LogCalled != nil {
l.LogCalled(logger.LogDebug, message, args...)
}
}

// Info -
func (l *LoggerStub) Info(message string, args ...interface{}) {
if l.LogLineCalled != nil {
l.LogLineCalled("INFO", message, args...)
if l.LogCalled != nil {
l.LogCalled(logger.LogInfo, message, args...)
}
}

// Warn -
func (l *LoggerStub) Warn(message string, args ...interface{}) {
if l.LogLineCalled != nil {
l.LogLineCalled("WARN", message, args...)
if l.LogCalled != nil {
l.LogCalled(logger.LogWarning, message, args...)
}
}

// Error -
func (l *LoggerStub) Error(message string, args ...interface{}) {
if l.LogLineCalled != nil {
l.LogLineCalled("ERROR", message, args...)
if l.LogCalled != nil {
l.LogCalled(logger.LogError, message, args...)
}
}

// LogIfError -
func (l *LoggerStub) LogIfError(err error, args ...interface{}) {
if l.LogLineCalled != nil && err != nil {
l.LogLineCalled("ERROR", err.Error(), args...)
}
}

// LogLine -
func (l *LoggerStub) LogLine(line *logger.LogLine) {
if l.LogLineCalled != nil {
l.LogLineCalled("Log", "line", line)
}
}

// Log -
func (l *LoggerStub) Log(logLevel logger.LogLevel, message string, args ...interface{}) {
if l.LogLineCalled != nil {
l.LogLineCalled(string(logLevel), message, args...)
if l.LogCalled != nil && err != nil {
l.LogCalled(logger.LogError, err.Error(), args...)
}
}

Expand Down
43 changes: 41 additions & 2 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
# available in local disk
StartInEpochEnabled = true

# ChainID identifies the blockChain
# ChainID represents the chain identifier
# The currently supported constants are:
# "1" for Mainnet
# "D" for Devnet
# "T" for Testnet
ChainID = "undefined"

# MinTransactionVersion represents the minimum transaction version accepted
Expand Down Expand Up @@ -474,6 +478,10 @@
Capacity = 10000
Type = "LRU"

[PeersRatingConfig]
TopRatedCacheCapacity = 5000
BadRatedCacheCapacity = 5000

[TrieSyncStorage]
Capacity = 300000
SizeInBytes = 104857600 #100MB
Expand Down Expand Up @@ -694,6 +702,11 @@
{ StartEpoch = 1, Version = "v1.4" },
]

[VirtualMachine.GasConfig]
# MaxGasPerVmQuery defines the maximum amount of gas to be allocated for VM Queries coming from API
# If set to 0, then MaxUInt64 will be used
MaxGasPerVmQuery = 1500000000 #1.5b

[Hardfork]
EnableTrigger = true
EnableTriggerFromP2P = true
Expand Down Expand Up @@ -885,9 +898,35 @@

[Resolvers]
NumCrossShardPeers = 2
NumIntraShardPeers = 1
NumTotalPeers = 3 # NumCrossShardPeers + num intra shard
NumFullHistoryPeers = 3

[HeartbeatV2]
PeerAuthenticationTimeBetweenSendsInSec = 7200 # 2h
PeerAuthenticationTimeBetweenSendsWhenErrorInSec = 60 # 1min
PeerAuthenticationThresholdBetweenSends = 0.1 # 10%
HeartbeatTimeBetweenSendsInSec = 60 # 1min
HeartbeatTimeBetweenSendsWhenErrorInSec = 60 # 1min
HeartbeatThresholdBetweenSends = 0.1 # 10%
MaxNumOfPeerAuthenticationInResponse = 10
HeartbeatExpiryTimespanInSec = 3600 # 1h
MinPeersThreshold = 0.8 # 80%
DelayBetweenRequestsInSec = 10 # 10sec
MaxTimeoutInSec = 7200 # 2h
DelayBetweenConnectionNotificationsInSec = 60 # 1min
MaxMissingKeysInRequest = 1000
MaxDurationPeerUnresponsiveInSec = 900 # 15min
HideInactiveValidatorIntervalInSec = 3600 # 1h
HardforkTimeBetweenSendsInSec = 10 # 10sec
[HeartbeatV2.PeerAuthenticationPool]
DefaultSpanInSec = 3600 # 1h
CacheExpiryInSec = 3600 # 1h
[HeartbeatV2.HeartbeatPool]
Name = "HeartbeatPool"
Capacity = 1000
Type = "SizeLRU"
SizeInBytes = 314572800 #300MB

# Changing this config is not backwards compatible
[SoftAuctionConfig]
TopUpStep = "10000000000000000000" # 10 EGLD
Expand Down
13 changes: 12 additions & 1 deletion cmd/node/config/enableEpochs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
# StakingV2EnableEpoch represents the epoch when staking v2 is enabled
StakingV2EnableEpoch = 1

# DoubleKeyProtectionEnableEpoch represents the epoch when the double key protection will be enabled
DoubleKeyProtectionEnableEpoch = 1

# ESDTEnableEpoch represents the epoch when ESDT is enabled
Expand Down Expand Up @@ -135,7 +136,7 @@
# CorrectFirstQueuedEpoch represents the epoch when the backward compatibility for setting the first queued node is enabled
CorrectFirstQueuedEpoch = 1

# DeleteDelegatorAfterClaimRewardsEnableEpoch represents the epoch when the delegators data is deleted for delegators that have to claim rewards after they widrawal all funds
# DeleteDelegatorAfterClaimRewardsEnableEpoch represents the epoch when the delegators data is deleted for delegators that have to claim rewards after they withdraw all funds
DeleteDelegatorAfterClaimRewardsEnableEpoch = 1

# FixOOGReturnCodeEnableEpoch represents the epoch when the backward compatibility returning out of gas error is enabled
Expand Down Expand Up @@ -187,6 +188,9 @@
# SCRSizeInvariantOnBuiltInResultEnableEpoch represents the epoch when scr size invariant on built in result is enabled
SCRSizeInvariantOnBuiltInResultEnableEpoch = 1

# CheckCorrectTokenIDForTransferRoleEnableEpoch represents the epoch when the correct token ID check is applied for transfer role verification
CheckCorrectTokenIDForTransferRoleEnableEpoch = 2

# FailExecutionOnEveryAPIErrorEnableEpoch represent the epoch when new protection in VM is enabled to fail all wrong API calls
FailExecutionOnEveryAPIErrorEnableEpoch = 3

Expand Down Expand Up @@ -214,7 +218,14 @@
{ EpochEnable = 6, MaxNumNodes = 48, NodesToShufflePerShard = 2 },
]

# HeartbeatDisableEpoch represents the epoch when heartbeat v1 messages stop being sent and processed
HeartbeatDisableEpoch = 2

# MiniBlockPartialExecutionEnableEpoch represents the epoch when mini block partial execution will be enabled
MiniBlockPartialExecutionEnableEpoch = 3

[GasSchedule]
# GasScheduleByEpochs holds the configuration for the gas schedule that will be applied from specific epochs
GasScheduleByEpochs = [
{ StartEpoch = 0, FileName = "gasScheduleV1.toml" },
{ StartEpoch = 1, FileName = "gasScheduleV6.toml" },
Expand Down
6 changes: 3 additions & 3 deletions cmd/node/config/external.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#Strongly suggested to activate this on a regular observer node.
Enabled = false
IndexerCacheSize = 0
BulkRequestMaxSizeInBytes = 4194304 # 4MB
URL = "http://localhost:9200"
UseKibana = false
Username = ""
Password = ""
# EnabledIndexes represents a slice of indexes that will be enabled for indexing. Full list is:
# ["tps", "rating", "transactions", "blocks", "validators", "miniblocks", "rounds", "accounts", "accountshistory", "receipts", "scresults", "accountsesdt", "accountsesdthistory", "epochinfo", "scdeploys", "tokens", "tags", "logs", "delegators"]
EnabledIndexes = ["tps", "rating", "transactions", "blocks", "validators", "miniblocks", "rounds", "accounts", "accountshistory", "receipts", "scresults", "accountsesdt", "accountsesdthistory", "epochinfo", "scdeploys", "tokens", "tags", "logs", "delegators"]

# ["rating", "transactions", "blocks", "validators", "miniblocks", "rounds", "accounts", "accountshistory", "receipts", "scresults", "accountsesdt", "accountsesdthistory", "epochinfo", "scdeploys", "tokens", "tags", "logs", "delegators", "operations"]
EnabledIndexes = ["rating", "transactions", "blocks", "validators", "miniblocks", "rounds", "accounts", "accountshistory", "receipts", "scresults", "accountsesdt", "accountsesdthistory", "epochinfo", "scdeploys", "tokens", "tags", "logs", "delegators", "operations"]
# EventNotifierConnector defines settings needed to configure and launch the event notifier component
[EventNotifierConnector]
# Enabled will turn on or off the event notifier connector
Expand Down
6 changes: 3 additions & 3 deletions cmd/node/config/prefs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
# It is highly recommended to enable this flag on an observer (not on a validator node)
FullArchive = false

# PreferredConnections holds an array containing the public keys of the nodes to connect with (in top of other connections)
# PreferredConnections holds an array containing valid ips or peer ids from nodes to connect with (in top of other connections)
# Example:
# PreferredConnections = [
# "eb2a13ec773924df2c7d1e92ff1c08d1c3b14218dc6a780b269ef12b9c098971f71851c212103720d40f92380c306a0c1a5e606f043f034188c3fcb95170112158730e2c53cd6c79331ce73df921675d71488f6287aa1ddca297756a98239584",
# "eb2a13ec773924df2c7d1e92ff1c08d1c3b14218dc6a780b269ef12b9c098971f71851c212103720d40f92380c306a0c1a5e606f043f034188c3fcb95170112158730e2c53cd6c79331ce73df921675d71488f6287aa1ddca297756a98239584"
# "127.0.0.10",
# "16Uiu2HAm6yvbp1oZ6zjnWsn9FdRqBSaQkbhELyaThuq48ybdorrr"
# ]

PreferredConnections = []
1 change: 1 addition & 0 deletions cmd/seednode/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ func createNode(p2pConfig config.P2PConfig, marshalizer marshal.Marshalizer) (p2
SyncTimer: &libp2p.LocalSyncTimer{},
PreferredPeersHolder: disabled.NewPreferredPeersHolder(),
NodeOperationMode: p2p.NormalOperation,
PeersRatingHandler: disabled.NewDisabledPeersRatingHandler(),
}

return libp2p.NewNetworkMessenger(arg)
Expand Down
12 changes: 6 additions & 6 deletions cmd/termui/view/termuic/termuiRenders/widgetsRender.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type WidgetsRender struct {
presenter view.Presenter
}

//NewWidgetsRender method will create new WidgetsRender that display termui console
// NewWidgetsRender method will create new WidgetsRender that display termui console
func NewWidgetsRender(presenter view.Presenter, grid *DrawableContainer) (*WidgetsRender, error) {
if presenter == nil || presenter.IsInterfaceNil() {
return nil, view.ErrNilPresenterInterface
Expand Down Expand Up @@ -106,7 +106,7 @@ func (wr *WidgetsRender) setGrid() {
wr.container.SetBottom(gridBottom)
}

//RefreshData method is used to prepare data that are displayed on container
// RefreshData method is used to prepare data that are displayed on container
func (wr *WidgetsRender) RefreshData(numMillisecondsRefreshTime int) {
wr.prepareInstanceInfo()
wr.prepareChainInfo(numMillisecondsRefreshTime)
Expand All @@ -116,7 +116,7 @@ func (wr *WidgetsRender) RefreshData(numMillisecondsRefreshTime int) {
}

func (wr *WidgetsRender) prepareInstanceInfo() {
//8 rows and one column
// 8 rows and one column
numRows := 8
rows := make([][]string, numRows)

Expand All @@ -138,7 +138,7 @@ func (wr *WidgetsRender) prepareInstanceInfo() {
fmt.Sprintf("Node name: %s (Shard %s - %s)",
nodeName,
shardIdStr,
strings.Title(nodeTypeAndListDisplay),
nodeTypeAndListDisplay,
),
}

Expand Down Expand Up @@ -174,7 +174,7 @@ func (wr *WidgetsRender) prepareInstanceInfo() {
}

func (wr *WidgetsRender) prepareChainInfo(numMillisecondsRefreshTime int) {
//10 rows and one column
// 10 rows and one column
numRows := 10
rows := make([][]string, numRows)

Expand Down Expand Up @@ -266,7 +266,7 @@ func computeRedundancyStr(redundancyLevel int64, redundancyIsMainActive string)
}

func (wr *WidgetsRender) prepareBlockInfo() {
//7 rows and one column
// 7 rows and one column
numRows := 8
rows := make([][]string, numRows)

Expand Down
15 changes: 15 additions & 0 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ const GenesisTxSignatureString = "GENESISGENESISGENESISGENESISGENESISGENESISGENE
// HeartbeatTopic is the topic used for heartbeat signaling
const HeartbeatTopic = "heartbeat"

// HeartbeatV2Topic is the topic used for heartbeatV2 signaling
const HeartbeatV2Topic = "heartbeatV2"

// PeerAuthenticationTopic is the topic used for peer authentication signaling
const PeerAuthenticationTopic = "peerAuthentication"

// ConnectionTopic represents the topic used when sending the new connection message data
const ConnectionTopic = "connection"

// PathShardPlaceholder represents the placeholder for the shard ID in paths
const PathShardPlaceholder = "[S]"

Expand Down Expand Up @@ -493,6 +502,9 @@ const (
// MetricWaitingListFixEnableEpoch represents the epoch when the waiting list fix is enabled
MetricWaitingListFixEnableEpoch = "erd_waiting_list_fix_enable_epoch"

// MetricHeartbeatDisableEpoch represents the epoch when heartbeat v1 messages stop being sent and processed
MetricHeartbeatDisableEpoch = "erd_heartbeat_disable_epoch"

// MetricMaxNodesChangeEnableEpoch holds configuration for changing the maximum number of nodes and the enabling epoch
MetricMaxNodesChangeEnableEpoch = "erd_max_nodes_change_enable_epoch"

Expand Down Expand Up @@ -827,3 +839,6 @@ const (
// ApiOutputFormatProto outport format returns the bytes of the proto object
ApiOutputFormatProto ApiOutputFormat = 1
)

// MaxIndexOfTxInMiniBlock defines the maximum index of a tx inside one mini block
const MaxIndexOfTxInMiniBlock = int32(29999)

0 comments on commit 2623fb7

Please sign in to comment.