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

Commit

Permalink
Fix changes from iota.go updates
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGackstatter committed Mar 12, 2024
1 parent aa10bce commit 6e391c7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
6 changes: 3 additions & 3 deletions pkg/network/protocols/core/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func (p *Protocol) onBlock(blockData []byte, id peer.ID) {

func (p *Protocol) onBlockRequest(idBytes []byte, id peer.ID) {
if len(idBytes) != iotago.BlockIDLength {
p.Events.Error.Trigger(ierrors.Wrap(iotago.ErrInvalidIdentifierLength, "failed to deserialize block request"), id)
p.Events.Error.Trigger(ierrors.Errorf("failed to deserialize block request: invalid block id length"), id)

return
}
Expand All @@ -237,7 +237,7 @@ func (p *Protocol) onSlotCommitment(commitmentBytes []byte, id peer.ID) {

func (p *Protocol) onSlotCommitmentRequest(idBytes []byte, id peer.ID) {
if len(idBytes) != iotago.CommitmentIDLength {
p.Events.Error.Trigger(ierrors.Wrap(iotago.ErrInvalidIdentifierLength, "failed to deserialize slot commitment request"), id)
p.Events.Error.Trigger(ierrors.Errorf("failed to deserialize slot commitment request: invalid commitment id length"), id)

return
}
Expand Down Expand Up @@ -294,7 +294,7 @@ func (p *Protocol) onAttestations(commitmentBytes []byte, attestationsBytes []by

func (p *Protocol) onAttestationsRequest(commitmentIDBytes []byte, id peer.ID) {
if len(commitmentIDBytes) != iotago.CommitmentIDLength {
p.Events.Error.Trigger(ierrors.Wrap(iotago.ErrInvalidIdentifierLength, "failed to deserialize commitmentID in attestations request"), id)
p.Events.Error.Trigger(ierrors.Errorf("failed to deserialize commitmentID in attestations request: invalid commitment id length"), id)

return
}
Expand Down
8 changes: 2 additions & 6 deletions pkg/protocol/engine/ledger/ledger/ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,19 +612,15 @@ func (l *Ledger) processStateDiffTransactions(stateDiff mempool.StateDiff) (spen
return false
}

inputRefs, errInput := tx.Inputs()
if errInput != nil {
err = ierrors.Errorf("failed to retrieve inputs of %s: %w", txID, errInput)
return false
}
inputRefs := tx.Inputs()

// process outputs
{
// input side
for _, inputRef := range lo.Map(inputRefs, mempool.UTXOInputStateRefFromInput) {
stateWithMetadata, stateError := l.memPool.StateMetadata(inputRef)
if stateError != nil {
err = ierrors.Errorf("failed to retrieve outputs of %s: %w", txID, errInput)
err = ierrors.Wrapf(stateError, "failed to retrieve outputs of %s", txID)
return false
}
spent := utxoledger.NewSpent(l.outputFromState(stateWithMetadata.State()), txWithMeta.ID(), stateDiff.Slot())
Expand Down
6 changes: 1 addition & 5 deletions pkg/protocol/engine/ledger/ledger/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ func (v *VM) ValidateSignatures(signedTransaction mempool.SignedTransaction, res
return nil, iotago.ErrTxTypeInvalid
}

contextInputs, err := iotagoSignedTransaction.Transaction.ContextInputs()
if err != nil {
return nil, ierrors.Wrapf(err, "unable to retrieve context inputs from transaction")
}

contextInputs := iotagoSignedTransaction.Transaction.ContextInputs()
utxoInputSet := iotagovm.InputSet{}
commitmentInput := (*iotago.Commitment)(nil)
bicInputs := make([]*iotago.BlockIssuanceCreditInput, 0)
Expand Down

0 comments on commit 6e391c7

Please sign in to comment.