Skip to content

Commit

Permalink
Merge branch 'development' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
iulianpascalau committed Apr 9, 2020
2 parents 987d9ad + 683c4f3 commit 9f43a7c
Show file tree
Hide file tree
Showing 210 changed files with 5,231 additions and 2,362 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ arwen:
ifndef ARWEN_PATH
$(error ARWEN_PATH is undefined)
endif
# When referencing a non-release version, add the commit hash, like this:
#go get github.com/ElrondNetwork/arwen-wasm-vm/cmd/arwen@...
# When referencing a released version, use this instead:
go get github.com/ElrondNetwork/arwen-wasm-vm/cmd/arwen@$(shell cat go.mod | grep arwen-wasm-vm | sed 's/.* //')
# The following commented line may be useful when referencing a non-released version, but a specific commit instead.
# go build -o ${ARWEN_PATH} $(shell go env GOPATH)/pkg/mod/github.com/!elrond!network/arwen-wasm-vm@$(shell cat go.mod | grep arwen | sed 's/.*arwen-wasm-vm //')/cmd/arwen
go build -o ${ARWEN_PATH} github.com/ElrondNetwork/arwen-wasm-vm/cmd/arwen
stat ${ARWEN_PATH}
18 changes: 14 additions & 4 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# StartInEpochEnabled represents that the fast bootstrap mechanism from the network is enabled if data is not
# available in local disk
StartInEpochEnabled = false # TODO enable this after fixing syncing trie
StartInEpochEnabled = true

[StoragePruning]
# If the Enabled flag is set to false, then the storers won't divide epochs into separate dbs
Expand Down Expand Up @@ -186,6 +186,11 @@
MaxBatchSize = 40000
MaxOpenFiles = 10

[TrieStorageManagerConfig]
PruningBufferLen = 1000
SnapshotsBufferLen = 10
MaxSnapshots = 2

[PeerAccountsTrieStorage]
[PeerAccountsTrieStorage.Cache]
Size = 5000
Expand Down Expand Up @@ -225,7 +230,8 @@

[WhiteListPool]
Size = 100000
Type = "LRU"
Type = "FIFOSharded"
Shards = 10

[UnsignedTransactionDataPool]
Size = 75000
Expand Down Expand Up @@ -296,10 +302,12 @@
[Address]
Length = 32
Prefix = "0x"
SignatureLength = 0

[BLSPublicKey]
Length = 96
Prefix = "0x"
SignatureLength = 48

[Hasher]
Type = "blake2b"
Expand Down Expand Up @@ -328,6 +336,9 @@
[EpochStartConfig]
MinRoundsBetweenEpochs = 50
RoundsPerEpoch = 50
# ShuffledOutRestartThreshold represents the maximum duration of an epoch (in percentage) after a node which
# has been shuffled out has to restart its process in order to start in a new shard
ShuffledOutRestartThreshold = 0.25

# ResourceStats, if enabled, will output in a folder called "stats"
# resource statistics. For example: number of active go routines, memory allocation, number of GC sweeps, etc.
Expand Down Expand Up @@ -372,8 +383,7 @@
PeerStatePruningEnabled = true

[BlockSizeThrottleConfig]
#TODO fix MinSizeInBytes when executing large cross-shard miniblocks
MinSizeInBytes = 943718 # 943718 is 90% from 1MB or 104857 is 10% from 1MB
MinSizeInBytes = 104857 # 104857 is 10% from 1MB
MaxSizeInBytes = 943718 # 943718 is 90% from 1MB

[VirtualMachineConfig]
Expand Down
2 changes: 2 additions & 0 deletions cmd/node/config/gasSchedule.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[BuiltInCost]
ChangeOwnerAddress = 5000000
ClaimDeveloperRewards = 5000000
SaveUserName = 5000000
SaveKeyValue = 250000

[MetaChainSystemSCsCost]
Stake = 5000000
Expand Down
100 changes: 64 additions & 36 deletions cmd/node/factory/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import (
"github.com/ElrondNetwork/elrond-go/process/rewardTransaction"
"github.com/ElrondNetwork/elrond-go/process/scToProtocol"
"github.com/ElrondNetwork/elrond-go/process/smartContract"
"github.com/ElrondNetwork/elrond-go/process/smartContract/builtInFunctions"
"github.com/ElrondNetwork/elrond-go/process/smartContract/hooks"
processSync "github.com/ElrondNetwork/elrond-go/process/sync"
"github.com/ElrondNetwork/elrond-go/process/throttle"
Expand Down Expand Up @@ -247,12 +248,13 @@ func createTries(

trieContainer := state.NewDataTriesHolder()
trieFactoryArgs := factory.TrieFactoryArgs{
EvictionWaitingListCfg: args.config.EvictionWaitingList,
SnapshotDbCfg: args.config.TrieSnapshotDB,
Marshalizer: marshalizer,
Hasher: hasher,
PathManager: args.pathManager,
ShardId: args.shardId,
EvictionWaitingListCfg: args.config.EvictionWaitingList,
SnapshotDbCfg: args.config.TrieSnapshotDB,
Marshalizer: marshalizer,
Hasher: hasher,
PathManager: args.pathManager,
ShardId: args.shardId,
TrieStorageManagerConfig: args.config.TrieStorageManagerConfig,
}
trieFactory, err := factory.NewTrieFactory(trieFactoryArgs)
if err != nil {
Expand Down Expand Up @@ -1654,6 +1656,15 @@ func newShardBlockProcessor(
) (process.BlockProcessor, error) {
argsParser := vmcommon.NewAtArgumentParser()

argsBuiltIn := builtInFunctions.ArgsCreateBuiltInFunctionContainer{
GasMap: gasSchedule,
MapDNSAddresses: make(map[string]struct{}),
}
builtInFuncs, err := builtInFunctions.CreateBuiltInFunctionContainer(argsBuiltIn)
if err != nil {
return nil, err
}

argsHook := hooks.ArgBlockChainHook{
Accounts: stateComponents.AccountsAdapter,
AddrConv: stateComponents.AddressConverter,
Expand All @@ -1662,6 +1673,7 @@ func newShardBlockProcessor(
ShardCoordinator: shardCoordinator,
Marshalizer: core.InternalMarshalizer,
Uint64Converter: core.Uint64ByteSliceConverter,
BuiltInFunctions: builtInFuncs,
}
vmFactory, err := shard.NewVMContainerFactory(config.VirtualMachineConfig, economics.MaxGasLimitPerBlock(), gasSchedule, argsHook)
if err != nil {
Expand Down Expand Up @@ -1716,26 +1728,32 @@ func newShardBlockProcessor(
return nil, err
}

txTypeHandler, err := coordinator.NewTxTypeHandler(stateComponents.AddressConverter, shardCoordinator, stateComponents.AccountsAdapter)
argsTxTypeHandler := coordinator.ArgNewTxTypeHandler{
AddressConverter: stateComponents.AddressConverter,
ShardCoordinator: shardCoordinator,
BuiltInFuncNames: builtInFuncs.Keys(),
ArgumentParser: vmcommon.NewAtArgumentParser(),
}
txTypeHandler, err := coordinator.NewTxTypeHandler(argsTxTypeHandler)
if err != nil {
return nil, err
}

argsNewScProcessor := smartContract.ArgsNewSmartContractProcessor{
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: core.Hasher,
Marshalizer: core.InternalMarshalizer,
AccountsDB: stateComponents.AccountsAdapter,
TempAccounts: vmFactory.BlockChainHookImpl(),
AdrConv: stateComponents.AddressConverter,
Coordinator: shardCoordinator,
ScrForwarder: scForwarder,
TxFeeHandler: txFeeHandler,
EconomicsFee: economics,
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
GasMap: gasSchedule,
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: core.Hasher,
Marshalizer: core.InternalMarshalizer,
AccountsDB: stateComponents.AccountsAdapter,
TempAccounts: vmFactory.BlockChainHookImpl(),
AdrConv: stateComponents.AddressConverter,
Coordinator: shardCoordinator,
ScrForwarder: scForwarder,
TxFeeHandler: txFeeHandler,
EconomicsFee: economics,
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
BuiltInFunctions: vmFactory.BlockChainHookImpl().GetBuiltInFunctions(),
}
scProcessor, err := smartContract.NewSmartContractProcessor(argsNewScProcessor)
if err != nil {
Expand Down Expand Up @@ -1816,6 +1834,7 @@ func newShardBlockProcessor(
interimProcContainer,
gasHandler,
txFeeHandler,
blockSizeComputationHandler,
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -1901,6 +1920,7 @@ func newMetaBlockProcessor(
maxSizeInBytes uint32,
) (process.BlockProcessor, error) {

builtInFuncs := builtInFunctions.NewBuiltInFunctionContainer()
argsHook := hooks.ArgBlockChainHook{
Accounts: stateComponents.AccountsAdapter,
AddrConv: stateComponents.AddressConverter,
Expand All @@ -1909,6 +1929,7 @@ func newMetaBlockProcessor(
ShardCoordinator: shardCoordinator,
Marshalizer: core.InternalMarshalizer,
Uint64Converter: core.Uint64ByteSliceConverter,
BuiltInFunctions: builtInFuncs, // no built-in functions for meta.
}
vmFactory, err := metachain.NewVMContainerFactory(argsHook, economicsData, messageSignVerifier, gasSchedule)
if err != nil {
Expand Down Expand Up @@ -1954,26 +1975,32 @@ func newMetaBlockProcessor(
return nil, err
}

txTypeHandler, err := coordinator.NewTxTypeHandler(stateComponents.AddressConverter, shardCoordinator, stateComponents.AccountsAdapter)
argsTxTypeHandler := coordinator.ArgNewTxTypeHandler{
AddressConverter: stateComponents.AddressConverter,
ShardCoordinator: shardCoordinator,
BuiltInFuncNames: builtInFuncs.Keys(),
ArgumentParser: vmcommon.NewAtArgumentParser(),
}
txTypeHandler, err := coordinator.NewTxTypeHandler(argsTxTypeHandler)
if err != nil {
return nil, err
}

argsNewScProcessor := smartContract.ArgsNewSmartContractProcessor{
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: core.Hasher,
Marshalizer: core.InternalMarshalizer,
AccountsDB: stateComponents.AccountsAdapter,
TempAccounts: vmFactory.BlockChainHookImpl(),
AdrConv: stateComponents.AddressConverter,
Coordinator: shardCoordinator,
ScrForwarder: scForwarder,
TxFeeHandler: txFeeHandler,
EconomicsFee: economicsData,
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
GasMap: gasSchedule,
VmContainer: vmContainer,
ArgsParser: argsParser,
Hasher: core.Hasher,
Marshalizer: core.InternalMarshalizer,
AccountsDB: stateComponents.AccountsAdapter,
TempAccounts: vmFactory.BlockChainHookImpl(),
AdrConv: stateComponents.AddressConverter,
Coordinator: shardCoordinator,
ScrForwarder: scForwarder,
TxFeeHandler: txFeeHandler,
EconomicsFee: economicsData,
TxTypeHandler: txTypeHandler,
GasHandler: gasHandler,
BuiltInFunctions: vmFactory.BlockChainHookImpl().GetBuiltInFunctions(),
}
scProcessor, err := smartContract.NewSmartContractProcessor(argsNewScProcessor)
if err != nil {
Expand Down Expand Up @@ -2040,6 +2067,7 @@ func newMetaBlockProcessor(
interimProcContainer,
gasHandler,
txFeeHandler,
blockSizeComputationHandler,
)
if err != nil {
return nil, err
Expand Down
Loading

0 comments on commit 9f43a7c

Please sign in to comment.