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

Commit 6d2f501

Browse files
committed
Merge branch 'develop' into feat/api-cache
2 parents 0994a7d + 39c9f43 commit 6d2f501

File tree

15 files changed

+88
-44
lines changed

15 files changed

+88
-44
lines changed

components/restapi/params.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var ParamsRestAPI = &ParametersRestAPI{
4545
"/api/core/v3/accounts*",
4646
"/api/core/v3/validators*",
4747
"/api/core/v3/rewards*",
48-
"/api/core/v3/committee",
48+
"/api/core/v3/committee*",
4949
"/api/debug/v2/*",
5050
"/api/indexer/v2/*",
5151
"/api/mqtt/v2",

config_defaults.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"/api/core/v3/accounts*",
5454
"/api/core/v3/validators*",
5555
"/api/core/v3/rewards*",
56-
"/api/core/v3/committee",
56+
"/api/core/v3/committee*",
5757
"/api/debug/v2/*",
5858
"/api/indexer/v2/*",
5959
"/api/mqtt/v2",

documentation/configuration.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,17 @@ Example:
166166

167167
## <a id="restapi"></a> 5. RestAPI
168168

169-
| Name | Description | Type | Default value |
170-
| ------------------------------ | ---------------------------------------------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
171-
| bindAddress | The bind address on which the REST API listens on | string | "0.0.0.0:14265" |
172-
| publicRoutes | The HTTP REST routes which can be called without authorization. Wildcards using \* are allowed | array | /health<br/>/api/routes<br/>/api/core/v3/info<br/>/api/core/v3/network\*<br/>/api/core/v3/blocks\*<br/>/api/core/v3/transactions\*<br/>/api/core/v3/commitments\*<br/>/api/core/v3/outputs\*<br/>/api/core/v3/accounts\*<br/>/api/core/v3/validators\*<br/>/api/core/v3/rewards\*<br/>/api/core/v3/committee<br/>/api/debug/v2/\*<br/>/api/indexer/v2/\*<br/>/api/mqtt/v2<br/>/api/blockissuer/v1/\* |
173-
| protectedRoutes | The HTTP REST routes which need to be called with authorization. Wildcards using \* are allowed | array | /api/\* |
174-
| debugRequestLoggerEnabled | Whether the debug logging for requests should be enabled | boolean | false |
175-
| maxPageSize | The maximum number of results per page | uint | 100 |
176-
| requestsMemoryCacheGranularity | Defines per how many slots a cache is created for big API requests | uint | 10 |
177-
| maxRequestedSlotAge | The maximum age of a request that will be processed | uint | 10 |
178-
| [jwtAuth](#restapi_jwtauth) | Configuration for jwtAuth | object | |
179-
| [limits](#restapi_limits) | Configuration for limits | object | |
169+
| Name | Description | Type | Default value |
170+
| ------------------------------ | ---------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
171+
| bindAddress | The bind address on which the REST API listens on | string | "0.0.0.0:14265" |
172+
| publicRoutes | The HTTP REST routes which can be called without authorization. Wildcards using \* are allowed | array | /health<br/>/api/routes<br/>/api/core/v3/info<br/>/api/core/v3/network\*<br/>/api/core/v3/blocks\*<br/>/api/core/v3/transactions\*<br/>/api/core/v3/commitments\*<br/>/api/core/v3/outputs\*<br/>/api/core/v3/accounts\*<br/>/api/core/v3/validators\*<br/>/api/core/v3/rewards\*<br/>/api/core/v3/committee\*<br/>/api/debug/v2/\*<br/>/api/indexer/v2/\*<br/>/api/mqtt/v2<br/>/api/blockissuer/v1/\* |
173+
| protectedRoutes | The HTTP REST routes which need to be called with authorization. Wildcards using \* are allowed | array | /api/\* |
174+
| debugRequestLoggerEnabled | Whether the debug logging for requests should be enabled | boolean | false |
175+
| maxPageSize | The maximum number of results per page | uint | 100 |
176+
| requestsMemoryCacheGranularity | Defines per how many slots a cache is created for big API requests | uint | 10 |
177+
| maxRequestedSlotAge | The maximum age of a request that will be processed | uint | 10 |
178+
| [jwtAuth](#restapi_jwtauth) | Configuration for jwtAuth | object | |
179+
| [limits](#restapi_limits) | Configuration for limits | object | |
180180

181181
### <a id="restapi_jwtauth"></a> JwtAuth
182182

@@ -209,7 +209,7 @@ Example:
209209
"/api/core/v3/accounts*",
210210
"/api/core/v3/validators*",
211211
"/api/core/v3/rewards*",
212-
"/api/core/v3/committee",
212+
"/api/core/v3/committee*",
213213
"/api/debug/v2/*",
214214
"/api/indexer/v2/*",
215215
"/api/mqtt/v2",

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ require (
2929
github.com/iotaledger/hive.go/stringify v0.0.0-20240307102857-7e23a3c59bd2
3030
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240307101848-db58eb9353ec
3131
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240307100839-48553e1d2022
32-
github.com/iotaledger/iota.go/v4 v4.0.0-20240307175623-0904c71fcb38
32+
github.com/iotaledger/iota.go/v4 v4.0.0-20240313065735-74f8cf10c361
3333
github.com/labstack/echo/v4 v4.11.4
3434
github.com/labstack/gommon v0.4.2
3535
github.com/libp2p/go-libp2p v0.33.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240307100839-48553e1d2022 h1:I178Sa
325325
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240307100839-48553e1d2022/go.mod h1:jTFxIWiMUdAwO263jlJCSWcNLqEkgYEVOFXfjp5aNJM=
326326
github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7 h1:t6k4MqiUov0FrBb2o2JhKlOVSdlPbIQWM8ivYHL0G0g=
327327
github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7/go.mod h1:do+N3LpeDEi9qselEC4XcjqGoRc7cWGiqBtIeBOKEMs=
328-
github.com/iotaledger/iota.go/v4 v4.0.0-20240307175623-0904c71fcb38 h1:NizJ3CALLCcJowtAtkNuDlpE4gd4qjaWZkp/kTZfeYk=
329-
github.com/iotaledger/iota.go/v4 v4.0.0-20240307175623-0904c71fcb38/go.mod h1:8UQOTI7CC5R/3TurawUFuBZbkb37RzW8m4q8Hp7ct30=
328+
github.com/iotaledger/iota.go/v4 v4.0.0-20240313065735-74f8cf10c361 h1:fKvfJZ4byivRRKkqF6JPj8I4pDSN0y+bgF4I4HI11Lo=
329+
github.com/iotaledger/iota.go/v4 v4.0.0-20240313065735-74f8cf10c361/go.mod h1:8UQOTI7CC5R/3TurawUFuBZbkb37RzW8m4q8Hp7ct30=
330330
github.com/ipfs/boxo v0.18.0 h1:MOL9/AgoV3e7jlVMInicaSdbgralfqSsbkc31dZ9tmw=
331331
github.com/ipfs/boxo v0.18.0/go.mod h1:pIZgTWdm3k3pLF9Uq6MB8JEcW07UDwNJjlXW1HELW80=
332332
github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=

pkg/network/protocols/core/protocol.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (p *Protocol) onBlock(blockData []byte, id peer.ID) {
216216

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

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

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

242242
return
243243
}
@@ -257,7 +257,7 @@ func (p *Protocol) onAttestations(commitmentBytes []byte, attestationsBytes []by
257257

258258
attestationsCount, err := stream.PeekSize(reader, serializer.SeriLengthPrefixTypeAsUint32)
259259
if err != nil {
260-
p.Events.Error.Trigger(ierrors.Errorf("failed peek attestations count"), id)
260+
p.Events.Error.Trigger(ierrors.New("failed peek attestations count"), id)
261261

262262
return
263263
}
@@ -294,7 +294,7 @@ func (p *Protocol) onAttestations(commitmentBytes []byte, attestationsBytes []by
294294

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

299299
return
300300
}

pkg/protocol/engine/ledger/ledger/ledger.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -612,19 +612,15 @@ func (l *Ledger) processStateDiffTransactions(stateDiff mempool.StateDiff) (spen
612612
return false
613613
}
614614

615-
inputRefs, errInput := tx.Inputs()
616-
if errInput != nil {
617-
err = ierrors.Errorf("failed to retrieve inputs of %s: %w", txID, errInput)
618-
return false
619-
}
615+
inputRefs := tx.Inputs()
620616

621617
// process outputs
622618
{
623619
// input side
624620
for _, inputRef := range lo.Map(inputRefs, mempool.UTXOInputStateRefFromInput) {
625621
stateWithMetadata, stateError := l.memPool.StateMetadata(inputRef)
626622
if stateError != nil {
627-
err = ierrors.Errorf("failed to retrieve outputs of %s: %w", txID, errInput)
623+
err = ierrors.Wrapf(stateError, "failed to retrieve outputs of %s", txID)
628624
return false
629625
}
630626
spent := utxoledger.NewSpent(l.outputFromState(stateWithMetadata.State()), txWithMeta.ID(), stateDiff.Slot())

pkg/protocol/engine/ledger/ledger/vm.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,7 @@ func (v *VM) ValidateSignatures(signedTransaction mempool.SignedTransaction, res
6565
return nil, iotago.ErrTxTypeInvalid
6666
}
6767

68-
contextInputs, err := iotagoSignedTransaction.Transaction.ContextInputs()
69-
if err != nil {
70-
return nil, ierrors.Wrapf(err, "unable to retrieve context inputs from transaction")
71-
}
72-
68+
contextInputs := iotagoSignedTransaction.Transaction.ContextInputs()
7369
utxoInputSet := iotagovm.InputSet{}
7470
commitmentInput := (*iotago.Commitment)(nil)
7571
bicInputs := make([]*iotago.BlockIssuanceCreditInput, 0)

pkg/protocol/sybilprotection/sybilprotectionv1/performance/rewards.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,17 @@ func (t *Tracker) DelegatorReward(validatorID iotago.AccountID, delegatedAmount
182182

183183
result, err := safemath.SafeMul(profitMarginComplement, uint64(poolReward))
184184
if err != nil {
185-
return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate unDecayedEpochRewards due to overflow for epoch %d and validator accountID %s", epoch, validatorID)
185+
return 0, 0, 0, ierrors.Wrapf(err, "failed to multiply profitMarginComplement and poolReward for unDecayedEpochRewards due to overflow for epoch %d and validator accountID %s", epoch, validatorID)
186186
}
187187

188-
result, err = safemath.SafeMul(result>>profitMarginExponent, uint64(delegatedAmount))
188+
result, err = safemath.SafeDiv(result>>profitMarginExponent, uint64(rewardsForAccountInEpoch.PoolStake))
189189
if err != nil {
190-
return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate unDecayedEpochRewards due to overflow for epoch %d and validator accountID %s", epoch, validatorID)
190+
return 0, 0, 0, ierrors.Wrapf(err, "failed to divide by PoolStake for unDecayedEpochRewards due to overflow for epoch %d and validator accountID %s", epoch, validatorID)
191191
}
192192

193-
undecayedEpochRewards, err := safemath.SafeDiv(result, uint64(rewardsForAccountInEpoch.PoolStake))
193+
undecayedEpochRewards, err := safemath.SafeMul(result, uint64(delegatedAmount))
194194
if err != nil {
195-
return 0, 0, 0, ierrors.Wrapf(err, "failed to calculate unDecayedEpochRewards due to overflow for epoch %d and validator accountID %s", epoch, validatorID)
195+
return 0, 0, 0, ierrors.Wrapf(err, "failed to multiply by delegatedAmmount for unDecayedEpochRewards due to overflow for epoch %d and validator accountID %s", epoch, validatorID)
196196
}
197197

198198
decayProvider := t.apiProvider.APIForEpoch(epoch).ManaDecayProvider()

0 commit comments

Comments
 (0)