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

Move validator component to INX plugin #443

Merged
merged 37 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ba18cc1
Remove validator component.
piotrm50 Oct 18, 2023
be17b7e
Merge remote-tracking branch 'origin/develop' into feat/move-validato…
piotrm50 Oct 20, 2023
5a46738
Add INX server endpoints to support inx-validator
piotrm50 Oct 20, 2023
30b26cf
Update .gitignore entry for go.work
piotrm50 Oct 20, 2023
9a991c4
Bump inx and inx-app version
piotrm50 Oct 20, 2023
a8fc93f
Run gendoc
piotrm50 Oct 20, 2023
e0b61d9
Add validators to docker-compose.yml
piotrm50 Oct 20, 2023
6b244c5
Merge remote-tracking branch 'origin/develop' into feat/move-validato…
piotrm50 Oct 24, 2023
80f6841
Update dependency versions.
piotrm50 Oct 24, 2023
970fea1
Update dependencies.
piotrm50 Oct 24, 2023
a7e8438
Merge branch 'develop' into feat/move-validator-plugin-to-inx
piotrm50 Oct 25, 2023
c37f0f3
Merge branch 'develop' into feat/move-validator-plugin-to-inx
piotrm50 Oct 25, 2023
5273205
Post merge fixes
piotrm50 Oct 25, 2023
2b5a4ca
Fix docker-compose after merge
piotrm50 Oct 26, 2023
8cb895a
Add ForceCommitUntil and ActiveRootBlocks methods
piotrm50 Oct 26, 2023
17ed514
Fix some bugs
piotrm50 Oct 26, 2023
fceadf3
Merge remote-tracking branch 'origin/develop' into feat/move-validato…
piotrm50 Oct 27, 2023
0a2142c
Update inx and inx-app
piotrm50 Oct 27, 2023
320a9a9
Trigger OnlineCommitteeSeatRemoved only when the seat was actually re…
piotrm50 Oct 27, 2023
aef1f33
Merge remote-tracking branch 'origin/develop' into feat/move-validato…
piotrm50 Oct 30, 2023
bfe211f
Update go.mod versions
piotrm50 Oct 30, 2023
15bdd0d
Update go.mod versions
piotrm50 Oct 30, 2023
d5481eb
Apply review suggestions.
piotrm50 Oct 30, 2023
5851ebd
Add inx-validator deployment to Ansible.
piotrm50 Oct 30, 2023
9c44669
Add validator account address
piotrm50 Oct 30, 2023
9efbf6c
Update inx and inx-app
piotrm50 Oct 30, 2023
a5adb00
Rename variables for feature deploy
karimodm Oct 30, 2023
5092fce
Fix start condition for inx-validator.
piotrm50 Oct 31, 2023
840f30d
Fix ports
piotrm50 Oct 31, 2023
7990328
run.sh fix
karimodm Oct 31, 2023
38b4c61
Merge branch 'feat/move-validator-plugin-to-inx' of github.com:iotale…
karimodm Oct 31, 2023
1e7ef7d
More syntax issues
karimodm Oct 31, 2023
754b4e7
More fixes
karimodm Oct 31, 2023
e371836
Fix deployment name.
piotrm50 Oct 31, 2023
1511372
Fix iota-core deployment template.
piotrm50 Oct 31, 2023
a42deda
Merge remote-tracking branch 'origin/develop' into feat/move-validato…
piotrm50 Oct 31, 2023
8ed294d
Update default snapshot for feature network
piotrm50 Oct 31, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/feature-network-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Ansible deploy
env:
CUSTOM_SNAPSHOT_URL: '${{ github.event.inputs.snapshotUrl }}'
DEFAULT_SNAPSHOT_URL: 'https://0x0.st/HJXh.bin'
DEFAULT_SNAPSHOT_URL: 'https://0x0.st/HywH.bin'
NETWORK_ENVIRONMENT: '${{ secrets.NETWORK_ENVIRONMENT }}'
IOTA_CORE_DOCKER_IMAGE_REPO: 'iotaledger/iota-core'
IOTA_CORE_DOCKER_IMAGE_TAG: 'feature'
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ iota-core
# IDE related files
.vscode/
.idea/
go.work
go.work.sum
go.work*

# dist packages
dist/
Expand Down
2 changes: 0 additions & 2 deletions components/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/iotaledger/iota-core/components/protocol"
"github.com/iotaledger/iota-core/components/restapi"
coreapi "github.com/iotaledger/iota-core/components/restapi/core"
"github.com/iotaledger/iota-core/components/validator"
"github.com/iotaledger/iota-core/pkg/toolset"
)

Expand Down Expand Up @@ -48,7 +47,6 @@ Command line flags:
debugapi.Component,
metricstracker.Component,
protocol.Component,
validator.Component,
dashboardmetrics.Component,
dashboard.Component,
metrics.Component,
Expand Down
2 changes: 1 addition & 1 deletion components/dashboard/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func currentNodeStatus() *nodestatus {

status.TangleTime = tangleTime{
Synced: syncStatus.NodeSynced,
Bootstrapped: deps.Protocol.MainEngineInstance().SyncManager.IsBootstrapped(),
Bootstrapped: syncStatus.NodeBootstrapped,
AcceptedBlockSlot: int64(syncStatus.LastAcceptedBlockSlot),
ConfirmedBlockSlot: int64(syncStatus.LastConfirmedBlockSlot),
CommittedSlot: int64(syncStatus.LatestCommitment.Slot()),
Expand Down
53 changes: 53 additions & 0 deletions components/inx/server_accounts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package inx

import (
"context"

"github.com/iotaledger/hive.go/ierrors"
inx "github.com/iotaledger/inx/go"
iotago "github.com/iotaledger/iota.go/v4"
)

func (s *Server) ReadIsValidatorAccount(_ context.Context, accountInfoRequest *inx.AccountInfoRequest) (*inx.BoolResponse, error) {
slot := iotago.SlotIndex(accountInfoRequest.GetAccountSlot())
accountID, _, err := iotago.AccountIDFromBytes(accountInfoRequest.AccountId)
if err != nil {
return nil, ierrors.Wrap(err, "error when parsing account id")
}

account, exists, err := deps.Protocol.MainEngineInstance().Ledger.Account(accountID, slot)
if err != nil {
return nil, ierrors.Wrapf(err, "error when retrieving account data for %s", accountID)
}

return inx.WrapBoolResponse(exists && account.StakeEndEpoch <= deps.Protocol.APIForSlot(slot).TimeProvider().EpochFromSlot(slot)), nil
}

func (s *Server) ReadIsCommitteeMember(_ context.Context, accountInfoRequest *inx.AccountInfoRequest) (*inx.BoolResponse, error) {
slot := iotago.SlotIndex(accountInfoRequest.GetAccountSlot())
accountID, _, err := iotago.AccountIDFromBytes(accountInfoRequest.AccountId)
if err != nil {
return nil, ierrors.Wrap(err, "error when parsing account id")
}
committee, exists := deps.Protocol.MainEngineInstance().SybilProtection.SeatManager().CommitteeInSlot(slot)
if !exists {
return nil, ierrors.Errorf("committee does not exist for slot %d", slot)
}

return inx.WrapBoolResponse(committee.HasAccount(accountID)), nil
}

func (s *Server) ReadIsCandidate(_ context.Context, accountInfoRequest *inx.AccountInfoRequest) (*inx.BoolResponse, error) {
slot := iotago.SlotIndex(accountInfoRequest.GetAccountSlot())
accountID, _, err := iotago.AccountIDFromBytes(accountInfoRequest.AccountId)
if err != nil {
return nil, ierrors.Wrap(err, "error when parsing account id")
}

isCandidateActive, err := deps.Protocol.MainEngineInstance().SybilProtection.IsCandidateActive(accountID, deps.Protocol.APIForSlot(slot).TimeProvider().EpochFromSlot(slot))
if err != nil {
return nil, ierrors.Wrap(err, "error when checking if candidate is active")
}

return inx.WrapBoolResponse(isCandidateActive), nil
}
6 changes: 6 additions & 0 deletions components/inx/server_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ import (
iotago "github.com/iotaledger/iota.go/v4"
)

func (s *Server) ReadActiveRootBlocks(_ context.Context, _ *inx.NoParams) (*inx.RootBlocksResponse, error) {
activeRootBlocks := deps.Protocol.MainEngineInstance().EvictionState.ActiveRootBlocks()

return inx.WrapRootBlocks(activeRootBlocks), nil
}

func (s *Server) ReadBlock(_ context.Context, blockID *inx.BlockId) (*inx.RawBlock, error) {
blkID := blockID.Unwrap()
block, exists := deps.Protocol.MainEngineInstance().Block(blkID) // block +1
Expand Down
8 changes: 8 additions & 0 deletions components/inx/server_commitments.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ func inxCommitment(commitment *model.Commitment) *inx.Commitment {
}
}

func (s *Server) ForceCommitUntil(_ context.Context, slot *inx.SlotIndex) (*inx.NoParams, error) {
err := deps.Protocol.MainEngineInstance().Notarization.ForceCommitUntil(slot.Unwrap())
if err != nil {
return nil, ierrors.Wrapf(err, "error while performing force commit until %d", slot.Index)
}

return &inx.NoParams{}, nil
}
func (s *Server) ReadCommitment(_ context.Context, req *inx.CommitmentRequest) (*inx.Commitment, error) {
commitmentSlot := iotago.SlotIndex(req.GetCommitmentSlot())

Expand Down
1 change: 1 addition & 0 deletions components/inx/server_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func inxNodeStatus(status *syncmanager.SyncStatus) *inx.NodeStatus {

return &inx.NodeStatus{
IsHealthy: status.NodeSynced,
IsBootstrapped: status.NodeBootstrapped,
LastAcceptedBlockSlot: uint32(status.LastAcceptedBlockSlot),
LastConfirmedBlockSlot: uint32(status.LastConfirmedBlockSlot),
LatestCommitment: inxCommitment(status.LatestCommitment),
Expand Down
93 changes: 0 additions & 93 deletions components/validator/component.go

This file was deleted.

168 changes: 0 additions & 168 deletions components/validator/issuer.go

This file was deleted.

Loading
Loading