Skip to content

Commit

Permalink
Merge pull request #459 from iotaledger/chore/small-cleanups
Browse files Browse the repository at this point in the history
Small cleanups
  • Loading branch information
muXxer authored Oct 25, 2023
2 parents 0329a5e + 3531d08 commit 81f828b
Show file tree
Hide file tree
Showing 20 changed files with 389 additions and 246 deletions.
2 changes: 1 addition & 1 deletion components/metricstracker/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ var ParamsMetricsTracker = &ParametersMetricsTracker{}

var params = &app.ComponentParams{
Params: map[string]any{
"metricstracker": ParamsMetricsTracker,
"metricsTracker": ParamsMetricsTracker,
},
}
72 changes: 36 additions & 36 deletions components/protocol/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,139 +177,139 @@ func provide(c *dig.Container) error {

func configure() error {
deps.Protocol.Events.Error.Hook(func(err error) {
Component.LogErrorf("Error in Protocol: %s", err)
Component.LogErrorf("ProtocolError, error: %s", err)
})

deps.Protocol.Events.Network.Error.Hook(func(err error, id peer.ID) {
Component.LogErrorf("NetworkError: %s Source: %s", err.Error(), id)
Component.LogErrorf("NetworkError, error: %s, peerID: %s", err.Error(), id)
})

deps.Protocol.Events.Network.BlockReceived.Hook(func(block *model.Block, source peer.ID) {
Component.LogDebugf("BlockReceived: %s", block.ID())
Component.LogDebugf("BlockReceived, blockID: %s, peerID: %s", block.ID(), source)
})

deps.Protocol.Events.Engine.BlockProcessed.Hook(func(blockID iotago.BlockID) {
Component.LogDebugf("BlockProcessed: %s", blockID)
Component.LogDebugf("BlockProcessed, blockID: %s", blockID)
})

deps.Protocol.Events.Engine.AcceptedBlockProcessed.Hook(func(block *blocks.Block) {
Component.LogDebugf("AcceptedBlockProcessed: %s", block.ID())
Component.LogDebugf("AcceptedBlockProcessed, blockID: %s", block.ID())
})

deps.Protocol.Events.Engine.Filter.BlockPreFiltered.Hook(func(event *filter.BlockPreFilteredEvent) {
Component.LogDebugf("BlockPreFiltered: %s - %s", event.Block.ID(), event.Reason.Error())
Component.LogDebugf("BlockPreFiltered, blockID: %s, reason: %s", event.Block.ID(), event.Reason.Error())
})

deps.Protocol.Events.Engine.Filter.BlockPreAllowed.Hook(func(blk *model.Block) {
Component.LogDebugf("BlockPreAllowed: %s - %s", blk.ID())
deps.Protocol.Events.Engine.Filter.BlockPreAllowed.Hook(func(block *model.Block) {
Component.LogDebugf("BlockPreAllowed, blockID: %s", block.ID())
})

deps.Protocol.Events.Engine.CommitmentFilter.BlockAllowed.Hook(func(block *blocks.Block) {
Component.LogDebugf("CommitmentFilter.BlockAllowed: %s\n", block.ID())
Component.LogDebugf("CommitmentFilter.BlockAllowed, blockID: %s", block.ID())
})

deps.Protocol.Events.Engine.CommitmentFilter.BlockFiltered.Hook(func(event *commitmentfilter.BlockFilteredEvent) {
Component.LogWarnf("CommitmentFilter.BlockFiltered: %s - %s\n", event.Block.ID(), event.Reason.Error())
Component.LogWarnf("CommitmentFilter.BlockFiltered, blockID: %s, reason: %s", event.Block.ID(), event.Reason.Error())
})

deps.Protocol.Events.Engine.TipManager.BlockAdded.Hook(func(tip tipmanager.TipMetadata) {
Component.LogDebugf("BlockAdded to tip pool: %s; is strong: %v; is weak: %v", tip.ID(), tip.IsStrongTip(), tip.IsWeakTip())
Component.LogDebugf("TipManager.BlockAdded, blockID: %s, isStrong: %v, isWeak: %v", tip.ID(), tip.IsStrongTip(), tip.IsWeakTip())
})

deps.Protocol.Events.Engine.BlockDAG.BlockSolid.Hook(func(block *blocks.Block) {
Component.LogDebugf("BlockSolid: %s", block.ID())
Component.LogDebugf("BlockDAG.BlockSolid, blockID: %s", block.ID())
})

deps.Protocol.Events.Engine.BlockDAG.BlockInvalid.Hook(func(block *blocks.Block, err error) {
Component.LogDebugf("BlockInvalid in blockDAG: %s, error: %v", block.ID(), err.Error())
Component.LogDebugf("BlockDAG.BlockInvalid, blockID: %s, error: %v", block.ID(), err.Error())
})

deps.Protocol.Events.Engine.Booker.BlockBooked.Hook(func(block *blocks.Block) {
Component.LogDebugf("BlockBooked: %s", block.ID())
Component.LogDebugf("BlockBooked, blockID: %s", block.ID())
})

deps.Protocol.Events.Engine.Booker.BlockInvalid.Hook(func(block *blocks.Block, err error) {
Component.LogDebugf("BlockInvalid in booker: %s, error: %v", block.ID(), err.Error())
Component.LogDebugf("BlockInvalid in booker, blockID: %s, error: %v", block.ID(), err.Error())
})

deps.Protocol.Events.Engine.BlockGadget.BlockPreAccepted.Hook(func(block *blocks.Block) {
Component.LogDebugf("BlockPreAccepted: %s", block.ID())
Component.LogDebugf("BlockPreAccepted, blockID: %s", block.ID())
})

deps.Protocol.Events.Engine.BlockGadget.BlockAccepted.Hook(func(block *blocks.Block) {
Component.LogDebugf("BlockAccepted: %s", block.ID())
Component.LogDebugf("BlockAccepted, blockID: %s", block.ID())
})

deps.Protocol.Events.Engine.BlockGadget.BlockPreConfirmed.Hook(func(block *blocks.Block) {
Component.LogDebugf("BlockPreConfirmed: %s", block.ID())
Component.LogDebugf("BlockPreConfirmed, blockID: %s", block.ID())
})

deps.Protocol.Events.Engine.BlockGadget.BlockConfirmed.Hook(func(block *blocks.Block) {
Component.LogDebugf("BlockConfirmed: %s", block.ID())
Component.LogDebugf("BlockConfirmed, blockID: %s", block.ID())
})

deps.Protocol.Events.Engine.Clock.AcceptedTimeUpdated.Hook(func(time time.Time) {
Component.LogDebugf("AcceptedTimeUpdated: Slot %d @ %s", deps.Protocol.CommittedAPI().TimeProvider().SlotFromTime(time), time)
Component.LogDebugf("AcceptedTimeUpdated, slot: %d @ %s", deps.Protocol.CommittedAPI().TimeProvider().SlotFromTime(time), time)
})

deps.Protocol.Events.Engine.Clock.ConfirmedTimeUpdated.Hook(func(time time.Time) {
Component.LogDebugf("ConfirmedTimeUpdated: Slot %d @ %s", deps.Protocol.CommittedAPI().TimeProvider().SlotFromTime(time), time)
Component.LogDebugf("ConfirmedTimeUpdated, slot: %d @ %s", deps.Protocol.CommittedAPI().TimeProvider().SlotFromTime(time), time)
})

deps.Protocol.Events.Engine.Notarization.SlotCommitted.Hook(func(details *notarization.SlotCommittedDetails) {
Component.LogInfof("SlotCommitted: %s - %d", details.Commitment.ID(), details.Commitment.Slot())
Component.LogInfof("SlotCommitted, commitmentID: %s, slot: %d", details.Commitment.ID(), details.Commitment.Slot())
})

deps.Protocol.Events.Engine.SlotGadget.SlotFinalized.Hook(func(index iotago.SlotIndex) {
Component.LogInfof("SlotFinalized: %d", index)
deps.Protocol.Events.Engine.SlotGadget.SlotFinalized.Hook(func(slot iotago.SlotIndex) {
Component.LogInfof("SlotFinalized, slot: %d", slot)
})

deps.Protocol.Events.Engine.Scheduler.BlockScheduled.Hook(func(block *blocks.Block) {
Component.LogDebugf("BlockScheduled: %s", block.ID())
Component.LogDebugf("BlockScheduled, blockID: %s", block.ID())
})

deps.Protocol.Events.Engine.Scheduler.BlockDropped.Hook(func(block *blocks.Block, err error) {
Component.LogDebugf("BlockDropped: %s; reason: %s", block.ID(), err)
Component.LogDebugf("BlockDropped, blockID: %s, reason: %s", block.ID(), err)
})

deps.Protocol.Events.Engine.Scheduler.BlockSkipped.Hook(func(block *blocks.Block) {
Component.LogDebugf("BlockSkipped: %s", block.ID())
Component.LogDebugf("BlockSkipped, blockID: %s", block.ID())
})

deps.Protocol.Events.ChainManager.RequestCommitment.Hook(func(id iotago.CommitmentID) {
Component.LogDebugf("RequestCommitment: %s", id)
Component.LogDebugf("RequestCommitment, commitmentID: %s", id)
})

deps.Protocol.Events.Network.SlotCommitmentRequestReceived.Hook(func(commitmentID iotago.CommitmentID, id peer.ID) {
Component.LogDebugf("SlotCommitmentRequestReceived: %s", commitmentID)
Component.LogDebugf("SlotCommitmentRequestReceived, commitmentID: %s", commitmentID)
})

deps.Protocol.Events.Network.SlotCommitmentReceived.Hook(func(commitment *model.Commitment, id peer.ID) {
Component.LogDebugf("SlotCommitmentReceived: %s", commitment.ID())
Component.LogDebugf("SlotCommitmentReceived, commitmentID: %s", commitment.ID())
})

deps.Protocol.Events.Engine.SybilProtection.CommitteeSelected.Hook(func(committee *account.Accounts, epoch iotago.EpochIndex) {
Component.LogInfof("CommitteeSelected: Epoch %d - %s (reused: %t)", epoch, committee.IDs(), committee.IsReused())
Component.LogInfof("CommitteeSelected, epoch: %d, committeeIDs: %s, reused: %t", epoch, committee.IDs(), committee.IsReused())
})

deps.Protocol.Events.Engine.SybilProtection.RewardsCommitted.Hook(func(epoch iotago.EpochIndex) {
Component.LogInfof("RewardsCommitted: Epoch %d", epoch)
Component.LogInfof("RewardsCommitted, epoch: %d", epoch)
})

deps.Protocol.Events.Engine.Booker.BlockInvalid.Hook(func(block *blocks.Block, err error) {
Component.LogWarnf("Booker BlockInvalid: Block %s - %s", block.ID(), err.Error())
Component.LogWarnf("Booker BlockInvalid, blockID: %s, error: %s", block.ID(), err.Error())
})

deps.Protocol.Events.Engine.SeatManager.OnlineCommitteeSeatAdded.Hook(func(seatIndex account.SeatIndex, account iotago.AccountID) {
Component.LogWarnf("OnlineCommitteeSeatAdded: %s - %d", account.ToHex(), seatIndex)
Component.LogWarnf("OnlineCommitteeSeatAdded, accountID: %s, seatIndex: %d", account.ToHex(), seatIndex)
})

deps.Protocol.Events.Engine.SeatManager.OnlineCommitteeSeatRemoved.Hook(func(seatIndex account.SeatIndex) {
Component.LogWarnf("OnlineCommitteeSeatRemoved: seatIndex: %d", seatIndex)
Component.LogWarnf("OnlineCommitteeSeatRemoved, seatIndex: %d", seatIndex)
})

deps.Protocol.Events.Engine.Booker.TransactionInvalid.Hook(func(transaction mempool.TransactionMetadata, reason error) {
Component.LogWarnf("TransactionInvalid: transaction %s - %s", transaction.ID(), reason.Error())
Component.LogWarnf("TransactionInvalid, transactionID: %s, error: %s", transaction.ID(), reason.Error())
})

return nil
Expand Down
2 changes: 1 addition & 1 deletion config_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"pruningThreshold": 1,
"dbGranularity": 100
},
"metricstracker": {
"metricsTracker": {
"enabled": true
},
"database": {
Expand Down
22 changes: 10 additions & 12 deletions deploy/ansible/hosts/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,20 @@ cores:
hosts:
node-01.feature.shimmer.iota.cafe:
validatorAccount: "{{ NODE_01_ACCOUNTID }}"
validatorPrivKey: "{{ NODE_01_VALIDATOR_PRIVKEY }}"
p2pIdentityPrivateKey: "{{ NODE_01_P2PIDENTITYPRIVATEKEY }}"
validatorPrvKey: "{{ NODE_01_VALIDATOR_PRIVKEY }}"
p2pIdentityPrvKey: "{{ NODE_01_P2PIDENTITYPRIVATEKEY }}"
node-02.feature.shimmer.iota.cafe:
validatorAccount: "{{ NODE_02_ACCOUNTID }}"
validatorPrivKey: "{{ NODE_02_VALIDATOR_PRIVKEY }}"
p2pIdentityPrivateKey: "{{ NODE_02_P2PIDENTITYPRIVATEKEY }}"
validatorPrvKey: "{{ NODE_02_VALIDATOR_PRIVKEY }}"
p2pIdentityPrvKey: "{{ NODE_02_P2PIDENTITYPRIVATEKEY }}"
node-03.feature.shimmer.iota.cafe:
validatorAccount: "{{ NODE_03_ACCOUNTID }}"
validatorPrivKey: "{{ NODE_03_VALIDATOR_PRIVKEY }}"
p2pIdentityPrivateKey: "{{ NODE_03_P2PIDENTITYPRIVATEKEY }}"
validatorPrvKey: "{{ NODE_03_VALIDATOR_PRIVKEY }}"
p2pIdentityPrvKey: "{{ NODE_03_P2PIDENTITYPRIVATEKEY }}"
node-04.feature.shimmer.iota.cafe:
validatorAccount: "{{ NODE_04_ACCOUNTID }}"
validatorPrivKey: "{{ NODE_04_VALIDATOR_PRIVKEY }}"
p2pIdentityPrivateKey: "{{ NODE_04_P2PIDENTITYPRIVATEKEY }}"
p2pIdentityPrvKey: "{{ NODE_04_P2PIDENTITYPRIVATEKEY }}"
blockissuerPrvKey: "{{ NODE_04_BLOCKISSUER_PRV_KEY }}"
faucetPrvKey: "{{ NODE_04_FAUCET_PRV_KEY }}"
node-05.feature.shimmer.iota.cafe:
validatorAccount: "{{ NODE_05_ACCOUNTID }}"
validatorPrivKey: "{{ NODE_05_VALIDATOR_PRIVKEY }}"
p2pIdentityPrivateKey: "{{ NODE_05_P2PIDENTITYPRIVATEKEY }}"
p2pIdentityPrvKey: "{{ NODE_05_P2PIDENTITYPRIVATEKEY }}"
vars:
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,120 @@
version: '3.3'

services:

###################
# IOTA-CORE Nodes #
###################

iota_core:
image: {{iota_core_docker_image_repo}}:{{iota_core_docker_image_tag}}
container_name: iota-core
stop_grace_period: 1m
restart: unless-stopped
ulimits:
nofile:
soft: 16384
hard: 16384
ports:
- "14666:14666/tcp" # P2P
- "6061:6061/tcp" # pprof
- "8080:8080/tcp" # REST-API
- "8081:8081/tcp" # Dashboard
- "9311:9311/tcp" # Prometheus
- "9029:9029/tcp" # INX
volumes:
- ./snapshot.bin:/app/data/snapshot.bin:ro
- ./config.json:/app/config.json:ro
- ./data:/app/data/
- ./snapshot.bin:/app/data/snapshot.bin:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "0.0.0.0:14666:14666/tcp"
- "0.0.0.0:8080:8080/tcp"
- "0.0.0.0:8081:8081/tcp"
- "0.0.0.0:6061:6061/tcp"
# prometheus
- "0.0.0.0:9311:9311/tcp"
environment:
- WEBAPI_BINDADDRESS=0.0.0.0:8080
- DASHBOARD_BINDADDRESS=0.0.0.0:8081
- PROFILING_BINDADDRESS=0.0.0.0:6061
command: >
-c config.json
-c
config.json
--logger.level=debug
--logger.disableCaller=false
--logger.disableStacktrace=false
--logger.encoding=console
--logger.outputPaths=stdout
--database.path=/app/data/database
--p2p.peers=/dns/node-01.feature/tcp/14666/p2p/12D3KooWCrjmh4dUCWfGVQT6ivzArieJB9Z3eKdy2mdEEN95NDPS
--p2p.externalMultiAddresses={{ ips | join(',') }}
--p2p.identityPrivateKey={{p2pIdentityPrvKey}}
--p2p.db.path=/app/data/peerdb
--profiling.bindAddress=0.0.0.0:6061
--profiling.enabled=true
--profiling.bindAddress=0.0.0.0:6061
--restAPI.bindAddress=0.0.0.0:8080
--database.path=/app/data/database
--protocol.snapshot.path=/app/data/snapshot.bin
{% if 'node-01' in inventory_hostname or 'node-02' in inventory_hostname or 'node-03' in inventory_hostname %}
--validator.enabled=true
--validator.account={{validatorAccount}}
--validator.privateKey={{validatorPrivKey}}
{% endif %}
{% if 'node-01' in inventory_hostname %}
{% if 'node-01' in inventory_hostname %}
--validator.ignoreBootstrapped=true
{% endif %}
--validator.account={{validatorAccount}}
--validator.privateKey={{validatorPrvKey}}
{% endif %}
--p2p.peers=/dns/node-01.feature/tcp/14666/p2p/12D3KooWCrjmh4dUCWfGVQT6ivzArieJB9Z3eKdy2mdEEN95NDPS
--p2p.externalMultiAddresses={{ ips | join(',') }}
--p2p.identityPrivateKey={{p2pIdentityPrivateKey}}
--dashboard.bindAddress=0.0.0.0:8081
--metrics.bindAddress=iota-core:9311
--inx.enabled=true
--inx.bindAddress=iota-core:9029

##################
# INX Extensions #
##################

inx-indexer:
container_name: inx-indexer
image: iotaledger/inx-indexer:2.0-alpha
stop_grace_period: 5m
stop_grace_period: 1m
restart: unless-stopped
depends_on:
iota-core:
condition: service_started
ulimits:
nofile:
soft: 16384
hard: 16384
volumes:
- ./data:/app/database
command:
- "--inx.address=iota-core:9029"
- "--indexer.db.sqlite.path=database/indexer"
- "--restAPI.bindAddress=inx-indexer:9091"
command: >
--inx.address=iota-core:9029
--indexer.db.sqlite.path=database/indexer
--restAPI.bindAddress=inx-indexer:9091

{% if 'node-04' in inventory_hostname %}
inx-blockissuer:
container_name: inx-blockissuer
image: iotaledger/inx-blockissuer:1.0-alpha
stop_grace_period: 1m
restart: unless-stopped
depends_on:
iota-core:
condition: service_started
inx-indexer:
condition: service_started
environment:
- "BLOCKISSUER_PRV_KEY={{blockissuerPrvKey}}"
command: >
--inx.address=iota-core:9029
--restAPI.bindAddress=inx-blockissuer:9086
--blockIssuer.accountAddress=rms1pqas0clgfsf8du9e6dw0yx9nwclqe0dd4f728pvgmcshpscm8r5mkddrrfc
--blockIssuer.proofOfWork.targetTrailingZeros=5

inx-faucet:
container_name: inx-faucet
image: iotaledger/inx-faucet:2.0-alpha
stop_grace_period: 1m
restart: unless-stopped
depends_on:
iota-core:
condition: service_started
inx-indexer:
condition: service_started
inx-blockissuer:
condition: service_started
networks:
- iota-core
ports:
- "8091:8091/tcp" # Faucet Frontend
environment:
- "FAUCET_PRV_KEY={{faucetPrvKey}}"
command: >
--inx.address=iota-core:9029
--faucet.bindAddress=0.0.0.0:8091
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -1340,8 +1340,8 @@
{
"current": {
"selected": false,
"text": "validator-3:9311",
"value": "validator-3:9311"
"text": "node-3-validator:9311",
"value": "node-3-validator:9311"
},
"datasource": {
"type": "prometheus",
Expand Down
Loading

0 comments on commit 81f828b

Please sign in to comment.