Skip to content

Implement read only flag in Mempool #1763

Implement read only flag in Mempool

Implement read only flag in Mempool #1763

GitHub Actions / golangci failed Oct 3, 2023 in 1s

reviewdog [golangci] report

reported by reviewdog 🐶

Findings (25)

pkg/protocol/engine/ledger/ledger/ledger.go|25 col 12| could not import github.com/iotaledger/iota-core/pkg/protocol/engine/mempool/v1 (-: # github.com/iotaledger/iota-core/pkg/protocol/engine/mempool/v1
pkg/protocol/engine/mempool/v1/mempool.go|136 col 67| stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)
pkg/protocol/engine/mempool/v1/mempool.go|232 col 72| stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)) (typecheck)
pkg/protocol/engine/ledger/ledger/ledger.go|726 col 20| cannot use loadedCommitment (variable of type *iotago.Commitment) as mempool.State value in argument to p.Resolve: *iotago.Commitment does not implement mempool.State (missing method ReadOnly) (typecheck)
pkg/protocol/engine/ledger/ledger/ledger.go|730 col 20| cannot use stateRef.(*iotago.BlockIssuanceCreditInput) (comma, ok expression of type *iotago.BlockIssuanceCreditInput) as mempool.State value in argument to p.Resolve: *iotago.BlockIssuanceCreditInput does not implement mempool.State (missing method ReadOnly) (typecheck)
pkg/protocol/engine/ledger/ledger/ledger.go|734 col 20| cannot use stateRef.(*iotago.RewardInput) (comma, ok expression of type *iotago.RewardInput) as mempool.State value in argument to p.Resolve: *iotago.RewardInput does not implement mempool.State (missing method ReadOnly) (typecheck)
pkg/protocol/engine/ledger/ledger/vm.go|53 col 8| impossible type switch case: *iotago.Commitment
pkg/protocol/engine/ledger/ledger/vm.go|55 col 8| impossible type switch case: *iotago.BlockIssuanceCreditInput
pkg/protocol/engine/ledger/ledger/vm.go|57 col 8| impossible type switch case: *iotago.RewardInput
pkg/blockfactory/blockissuer.go|334 col 19| cannot infer T (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/safemath/safe_math.go:36:1) (typecheck)
components/debugapi/node.go|18 col 26| cannot infer A (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:279:1) (typecheck)
components/inx/server_issuance.go|55 col 86| not enough arguments in call to lo.Return2
components/restapi/core/accounts.go|35 col 18| cannot infer T (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/safemath/safe_math.go:36:1) (typecheck)
components/restapi/core/accounts.go|92 col 43| cannot infer T (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:235:1) (typecheck)
pkg/protocol/engine/ledger/tests/output.go|1| : # github.com/iotaledger/iota-core/pkg/protocol/engine/ledger/tests
pkg/protocol/engine/ledger/tests/state_resolver.go|36 col 48| reference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)
pkg/protocol/engine/ledger/tests/state_resolver.go|38 col 99| reference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)
pkg/protocol/engine/ledger/tests/state_resolver.go|53 col 47| cannot use output (variable of type *iotago.Commitment) as mempool.State value in argument to promise.Newmempool.State.Resolve: *iotago.Commitment does not implement mempool.State (missing method ReadOnly) (typecheck)
pkg/testsuite/eviction.go|39 col 24| cannot infer A (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:279:1) (typecheck)
pkg/testsuite/eviction.go|40 col 99| cannot infer A (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:279:1) (typecheck)
pkg/testsuite/upgrades.go|43 col 198| not enough arguments in call to lo.PanicOnErr
pkg/testsuite/upgrades.go|57 col 99| not enough arguments in call to lo.PanicOnErr
pkg/testsuite/upgrades.go|58 col 246| not enough arguments in call to lo.PanicOnErr
pkg/protocol/engine/mempool/v1/mempool.go|136 col 67| stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID) (typecheck)
pkg/protocol/engine/mempool/v1/mempool.go|232 col 72| stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID) (typecheck)

Filtered Findings (0)

Annotations

Check failure on line 25 in pkg/protocol/engine/ledger/ledger/ledger.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/ledger/ledger/ledger.go#L25

could not import github.com/iotaledger/iota-core/pkg/protocol/engine/mempool/v1 (-: # github.com/iotaledger/iota-core/pkg/protocol/engine/mempool/v1
Raw output
pkg/protocol/engine/ledger/ledger/ledger.go:25:12: could not import github.com/iotaledger/iota-core/pkg/protocol/engine/mempool/v1 (-: # github.com/iotaledger/iota-core/pkg/protocol/engine/mempool/v1

Check failure on line 136 in pkg/protocol/engine/mempool/v1/mempool.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/mempool/v1/mempool.go#L136

stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)
Raw output
pkg/protocol/engine/mempool/v1/mempool.go:136:67: stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)

Check failure on line 232 in pkg/protocol/engine/mempool/v1/mempool.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/mempool/v1/mempool.go#L232

stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)) (typecheck)
Raw output
pkg/protocol/engine/mempool/v1/mempool.go:232:72: stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)) (typecheck)
	mempoolv1 "github.com/iotaledger/iota-core/pkg/protocol/engine/mempool/v1"
	          ^

Check failure on line 726 in pkg/protocol/engine/ledger/ledger/ledger.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/ledger/ledger/ledger.go#L726

cannot use loadedCommitment (variable of type *iotago.Commitment) as mempool.State value in argument to p.Resolve: *iotago.Commitment does not implement mempool.State (missing method ReadOnly) (typecheck)
Raw output
pkg/protocol/engine/ledger/ledger/ledger.go:726:20: cannot use loadedCommitment (variable of type *iotago.Commitment) as mempool.State value in argument to p.Resolve: *iotago.Commitment does not implement mempool.State (missing method ReadOnly) (typecheck)
		return p.Resolve(loadedCommitment)
		                 ^

Check failure on line 730 in pkg/protocol/engine/ledger/ledger/ledger.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/ledger/ledger/ledger.go#L730

cannot use stateRef.(*iotago.BlockIssuanceCreditInput) (comma, ok expression of type *iotago.BlockIssuanceCreditInput) as mempool.State value in argument to p.Resolve: *iotago.BlockIssuanceCreditInput does not implement mempool.State (missing method ReadOnly) (typecheck)
Raw output
pkg/protocol/engine/ledger/ledger/ledger.go:730:20: cannot use stateRef.(*iotago.BlockIssuanceCreditInput) (comma, ok expression of type *iotago.BlockIssuanceCreditInput) as mempool.State value in argument to p.Resolve: *iotago.BlockIssuanceCreditInput does not implement mempool.State (missing method ReadOnly) (typecheck)
		return p.Resolve(stateRef.(*iotago.BlockIssuanceCreditInput))
		                 ^

Check failure on line 734 in pkg/protocol/engine/ledger/ledger/ledger.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/ledger/ledger/ledger.go#L734

cannot use stateRef.(*iotago.RewardInput) (comma, ok expression of type *iotago.RewardInput) as mempool.State value in argument to p.Resolve: *iotago.RewardInput does not implement mempool.State (missing method ReadOnly) (typecheck)
Raw output
pkg/protocol/engine/ledger/ledger/ledger.go:734:20: cannot use stateRef.(*iotago.RewardInput) (comma, ok expression of type *iotago.RewardInput) as mempool.State value in argument to p.Resolve: *iotago.RewardInput does not implement mempool.State (missing method ReadOnly) (typecheck)
		return p.Resolve(stateRef.(*iotago.RewardInput))
		                 ^

Check failure on line 53 in pkg/protocol/engine/ledger/ledger/vm.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/ledger/ledger/vm.go#L53

impossible type switch case: *iotago.Commitment
Raw output
pkg/protocol/engine/ledger/ledger/vm.go:53:8: impossible type switch case: *iotago.Commitment
	resolvedInput (variable of type mempool.State) cannot have dynamic type *iotago.Commitment (missing method ReadOnly) (typecheck)
		case *iotago.Commitment:
		     ^

Check failure on line 55 in pkg/protocol/engine/ledger/ledger/vm.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/ledger/ledger/vm.go#L55

impossible type switch case: *iotago.BlockIssuanceCreditInput
Raw output
pkg/protocol/engine/ledger/ledger/vm.go:55:8: impossible type switch case: *iotago.BlockIssuanceCreditInput
	resolvedInput (variable of type mempool.State) cannot have dynamic type *iotago.BlockIssuanceCreditInput (missing method ReadOnly) (typecheck)
		case *iotago.BlockIssuanceCreditInput:
		     ^

Check failure on line 57 in pkg/protocol/engine/ledger/ledger/vm.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/ledger/ledger/vm.go#L57

impossible type switch case: *iotago.RewardInput
Raw output
pkg/protocol/engine/ledger/ledger/vm.go:57:8: impossible type switch case: *iotago.RewardInput
	resolvedInput (variable of type mempool.State) cannot have dynamic type *iotago.RewardInput (missing method ReadOnly) (typecheck)
		case *iotago.RewardInput:
		     ^

Check failure on line 334 in pkg/blockfactory/blockissuer.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/blockfactory/blockissuer.go#L334

cannot infer T (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/safemath/safe_math.go:36:1) (typecheck)
Raw output
pkg/blockfactory/blockissuer.go:334:19: cannot infer T (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/safemath/safe_math.go:36:1) (typecheck)
		rmcSlot, err := safemath.SafeSub(apiForVesion.TimeProvider().SlotFromTime(iotaBlock.IssuingTime), apiForVesion.ProtocolParameters().MaxCommittableAge())
		                ^

Check failure on line 18 in components/debugapi/node.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] components/debugapi/node.go#L18

cannot infer A (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:279:1) (typecheck)
Raw output
components/debugapi/node.go:18:26: cannot infer A (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:279:1) (typecheck)
			SeatIndex:      uint8(lo.Return1(latestCommittee.GetSeat(id))),
			                      ^

Check failure on line 55 in components/inx/server_issuance.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] components/inx/server_issuance.go#L55

not enough arguments in call to lo.Return2
Raw output
components/inx/server_issuance.go:55:86: not enough arguments in call to lo.Return2
	have (unknown type)
	want (any, A, ...any) (typecheck)
			return lo.Return2(memPool.VM().Execute(executionContext, typedPayload.Transaction))
			                                                                                  ^

Check failure on line 35 in components/restapi/core/accounts.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] components/restapi/core/accounts.go#L35

cannot infer T (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/safemath/safe_math.go:36:1) (typecheck)
Raw output
components/restapi/core/accounts.go:35:18: cannot infer T (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/safemath/safe_math.go:36:1) (typecheck)
	rmcSlot, err := safemath.SafeSub(slot, deps.Protocol.APIForSlot(slot).ProtocolParameters().MaxCommittableAge())
	                ^

Check failure on line 92 in components/restapi/core/accounts.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] components/restapi/core/accounts.go#L92

cannot infer T (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:235:1) (typecheck)
Raw output
components/restapi/core/accounts.go:92:43: cannot infer T (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:235:1) (typecheck)
	page := registeredValidators[cursorIndex:lo.Min(cursorIndex+pageSize, uint32(len(registeredValidators)))]
	                                         ^

Check failure on line 1 in pkg/protocol/engine/ledger/tests/output.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/ledger/tests/output.go#L1

: # github.com/iotaledger/iota-core/pkg/protocol/engine/ledger/tests
Raw output
pkg/protocol/engine/ledger/tests/output.go:1: : # github.com/iotaledger/iota-core/pkg/protocol/engine/ledger/tests

Check failure on line 36 in pkg/protocol/engine/ledger/tests/state_resolver.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/ledger/tests/state_resolver.go#L36

reference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)
Raw output
pkg/protocol/engine/ledger/tests/state_resolver.go:36:48: reference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)

Check failure on line 38 in pkg/protocol/engine/ledger/tests/state_resolver.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/ledger/tests/state_resolver.go#L38

reference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)
Raw output
pkg/protocol/engine/ledger/tests/state_resolver.go:38:99: reference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID)

Check failure on line 53 in pkg/protocol/engine/ledger/tests/state_resolver.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/ledger/tests/state_resolver.go#L53

cannot use output (variable of type *iotago.Commitment) as mempool.State value in argument to promise.New[mempool.State]().Resolve: *iotago.Commitment does not implement mempool.State (missing method ReadOnly) (typecheck)
Raw output
pkg/protocol/engine/ledger/tests/state_resolver.go:53:47: cannot use output (variable of type *iotago.Commitment) as mempool.State value in argument to promise.New[mempool.State]().Resolve: *iotago.Commitment does not implement mempool.State (missing method ReadOnly) (typecheck)
package ledgertests

Check failure on line 39 in pkg/testsuite/eviction.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/eviction.go#L39

cannot infer A (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:279:1) (typecheck)
Raw output
pkg/testsuite/eviction.go:39:24: cannot infer A (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:279:1) (typecheck)
			if expectedIndex != lo.Return1(node.Protocol.MainEngineInstance().EvictionState.LastEvictedSlot()) {
			                    ^

Check failure on line 40 in pkg/testsuite/eviction.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/eviction.go#L40

cannot infer A (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:279:1) (typecheck)
Raw output
pkg/testsuite/eviction.go:40:99: cannot infer A (/home/runner/go/pkg/mod/github.com/iotaledger/hive.go/[email protected]/lo.go:279:1) (typecheck)
				return ierrors.Errorf("AssertEvictedSlot: %s: expected %d, got %d", node.Name, expectedIndex, lo.Return1(node.Protocol.MainEngineInstance().EvictionState.LastEvictedSlot()))
				                                                                                              ^

Check failure on line 43 in pkg/testsuite/upgrades.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/upgrades.go#L43

not enough arguments in call to lo.PanicOnErr
Raw output
pkg/testsuite/upgrades.go:43:198: not enough arguments in call to lo.PanicOnErr
	have (unknown type)
	want (T, error) (typecheck)
						return ierrors.Errorf("AssertVersionAndProtocolParameters: %s: for version %d protocol parameters not equal. expected nil, got %s", node.Name, version, lo.PanicOnErr(protocolParameters.Hash()))
						                                                                                                                                                                                               ^

Check failure on line 57 in pkg/testsuite/upgrades.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/upgrades.go#L57

not enough arguments in call to lo.PanicOnErr
Raw output
pkg/testsuite/upgrades.go:57:99: not enough arguments in call to lo.PanicOnErr
	have (unknown type)
	want (T, error) (typecheck)
				if lo.PanicOnErr(expectedProtocolParameters.Hash()) != lo.PanicOnErr(protocolParameters.Hash()) {
				                                                                                              ^

Check failure on line 58 in pkg/testsuite/upgrades.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/upgrades.go#L58

not enough arguments in call to lo.PanicOnErr
Raw output
pkg/testsuite/upgrades.go:58:246: not enough arguments in call to lo.PanicOnErr
	have (unknown type)
	want (T, error) (typecheck)
					return ierrors.Errorf("AssertVersionAndProtocolParameters: %s: for version %d protocol parameters not equal. expected %s, got %s", node.Name, version, lo.PanicOnErr(expectedProtocolParameters.Hash()), lo.PanicOnErr(protocolParameters.Hash()))
					                                                                                                                                                                                                                                                ^

Check failure on line 136 in pkg/protocol/engine/mempool/v1/mempool.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/mempool/v1/mempool.go#L136

stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID) (typecheck)
Raw output
pkg/protocol/engine/mempool/v1/mempool.go:136:67: stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID) (typecheck)
	stateRequest, exists := m.cachedStateRequests.Get(stateReference.ReferencedStateID())
	                                                                 ^

Check failure on line 232 in pkg/protocol/engine/mempool/v1/mempool.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/protocol/engine/mempool/v1/mempool.go#L232

stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID) (typecheck)
Raw output
pkg/protocol/engine/mempool/v1/mempool.go:232:72: stateReference.ReferencedStateID undefined (type iotago.Input has no field or method ReferencedStateID) (typecheck)
		request, created := m.cachedStateRequests.GetOrCreate(stateReference.ReferencedStateID(), func() *promise.Promise[*StateMetadata] {
		                                                                     ^