Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 014fb64

Browse files
authored
Merge pull request #958 from iotaledger/fix/account-diffs
Fixed account diffs
2 parents 35f346b + ab8fc6e commit 014fb64

File tree

31 files changed

+1130
-970
lines changed

31 files changed

+1130
-970
lines changed

Diff for: components/inx/server_accounts.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func (s *Server) ReadIsValidatorAccount(_ context.Context, accountInfoRequest *i
2020
return nil, ierrors.Wrapf(err, "error when retrieving account data for %s", accountID)
2121
}
2222

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

2626
func (s *Server) ReadIsCommitteeMember(_ context.Context, accountInfoRequest *inx.AccountInfoRequest) (*inx.BoolResponse, error) {

Diff for: components/prometheus/metrics_accounts.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var AccountMetrics = collector.NewCollection(accountNamespace,
2525
deps.Protocol.Events.Engine.BlockGadget.BlockAccepted.Hook(func(block *blocks.Block) {
2626
accountData, exists, _ := deps.Protocol.Engines.Main.Get().Ledger.Account(block.IssuerID(), deps.Protocol.Engines.Main.Get().SyncManager.LatestCommitment().Slot())
2727
if exists {
28-
deps.Collector.Update(accountNamespace, credits, float64(accountData.Credits.Value), accountData.ID.String())
28+
deps.Collector.Update(accountNamespace, credits, float64(accountData.Credits().Value()), accountData.ID().String())
2929
}
3030
}, event.WithWorkerPool(Component.WorkerPool))
3131
}),

Diff for: pkg/model/account_diff.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package model
22

33
import (
44
"io"
5+
"strconv"
56

67
"github.com/iotaledger/hive.go/ierrors"
78
"github.com/iotaledger/hive.go/lo"
@@ -83,8 +84,8 @@ func (d *AccountDiff) String() string {
8384
builder.AddField(stringify.NewStructField("PreviousExpirySlot", uint32(d.PreviousExpirySlot)))
8485
builder.AddField(stringify.NewStructField("NewOutputID", d.NewOutputID))
8586
builder.AddField(stringify.NewStructField("PreviousOutputID", d.PreviousOutputID))
86-
builder.AddField(stringify.NewStructField("BlockIssuerKeysAdded", d.BlockIssuerKeysAdded))
87-
builder.AddField(stringify.NewStructField("BlockIssuerKeysRemoved", d.BlockIssuerKeysRemoved))
87+
builder.AddField(stringify.NewStructField("BlockIssuerKeysAdded", func() string { return strconv.Itoa(d.BlockIssuerKeysAdded.Size()) }()))
88+
builder.AddField(stringify.NewStructField("BlockIssuerKeysRemoved", func() string { return strconv.Itoa(d.BlockIssuerKeysRemoved.Size()) }()))
8889
builder.AddField(stringify.NewStructField("ValidatorStakeChange", d.ValidatorStakeChange))
8990
builder.AddField(stringify.NewStructField("DelegationStakeChange", d.DelegationStakeChange))
9091
builder.AddField(stringify.NewStructField("FixedCostChange", d.FixedCostChange))

Diff for: pkg/protocol/commitment.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func newCommitment(commitments *Commitments, model *model.Commitment) *Commitmen
103103
WarpSyncBlocks: reactive.NewVariable[bool](),
104104
BlocksToWarpSync: reactive.NewVariable[ds.Set[iotago.BlockID]](),
105105
Weight: reactive.NewVariable[uint64](),
106-
AttestedWeight: reactive.NewVariable[uint64](func(currentValue uint64, newValue uint64) uint64 { return max(currentValue, newValue) }), //nolint:gocritic // easier to read
106+
AttestedWeight: reactive.NewVariable[uint64](func(currentValue uint64, newValue uint64) uint64 { return max(currentValue, newValue) }),
107107
CumulativeWeight: reactive.NewVariable[uint64](),
108108
CumulativeAttestedWeight: reactive.NewVariable[uint64](),
109109
CumulativeVerifiedWeight: reactive.NewVariable[uint64](),

Diff for: pkg/protocol/commitment_verifier.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (c *CommitmentVerifier) verifyAttestations(attestations []*iotago.Attestati
160160
switch signature := att.Signature.(type) {
161161
case *iotago.Ed25519Signature:
162162
// We found the accountData, but we don't know the public key used to sign this block/attestation. Ignore.
163-
if !accountData.BlockIssuerKeys.Has(iotago.Ed25519PublicKeyHashBlockIssuerKeyFromPublicKey(signature.PublicKey)) {
163+
if !accountData.BlockIssuerKeys().Has(iotago.Ed25519PublicKeyHashBlockIssuerKeyFromPublicKey(signature.PublicKey)) {
164164
continue
165165
}
166166

0 commit comments

Comments
 (0)