Skip to content

Commit e8d192b

Browse files
authored
Merge pull request #2334 from iotaledger/develop
2 parents f028843 + da8bf43 commit e8d192b

File tree

425 files changed

+21018
-17317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

425 files changed

+21018
-17317
lines changed

CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# v0.9.2 - 2022-07-14
2+
3+
> This release introduces the epoch commitments feature which allows creating proofs-of-inclusion of a block in the tangle. This feature is also the first step to the development of pruning, local snapshots and will allow more efficient way of syncing a node. This release also improves the parameters of rate-setter that should improve user-experience of issuing new blocks. It also contains various bugfixes and improvements, change of terminology e.g. message -> block etc. as well as replacement of grades of finality with confirmation state.
4+
5+
The snapshot has been changed and thus the ledger state is fully reset.
6+
7+
- Update wiki cli (#2327)
8+
- Trigger all async tasks in a separate goroutine. (#2332)
9+
- Add bootstrap manager. (#2326)
10+
- Keep epoch contents in permanent storage in epochstorage plugin (#2328)
11+
- Terminology renaming (#2320)
12+
- Fix entrynode config (#2321)
13+
- Epoch commitment metrics (#2293)
14+
- Minor fixes (#2319)
15+
- Build(deps): bump moment in /plugins/dagsvisualizer/frontend (#2317)
16+
- Build(deps): bump moment in /plugins/dashboard/frontend (#2316)
17+
- Replace GoF with confirmation state (#2313)
18+
- Improve rate-setter UX (#2315)
19+
- Epoch Commitments (#2212)
20+
- Fix faucet (#2306)
21+
122
# v0.9.1 - 2022-06-22
223

324
> This release introduces the rate setter which allows nodes to estimate their fair rate of block creation and makes removing proof-of-work possible. Congestion is completely handled by the rate-setter and congestion control algorithms (capped at 30 BPS). Access mana is not decaying and is pledged to the node until it's re-pledged to another node. The release also includes new time concepts which make the network more resilient against mana going offline which in the past caused confirmations to stop permanently.

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ COPY go.mod .
4040
COPY go.sum .
4141

4242
ENV GO111MODULE=on
43+
ENV GOWORK=off
4344
RUN go mod download
4445
RUN go mod verify
4546

client/data.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const (
1010
routeData = "data"
1111
)
1212

13-
// Data sends the given data (payload) by creating a message in the backend.
13+
// Data sends the given data (payload) by creating a block in the backend.
1414
func (api *GoShimmerAPI) Data(data []byte) (string, error) {
1515
res := &jsonmodels.DataResponse{}
1616
if err := api.do(http.MethodPost, routeData,

client/evilspammer/errors.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
var (
1212
ErrFailPostTransaction = errors.New("failed to post transaction")
13-
ErrFailSendDataMessage = errors.New("failed to send a data message")
13+
ErrFailSendDataBlock = errors.New("failed to send a data block")
1414

1515
ErrTransactionIsNil = errors.New("provided transaction is nil")
1616
ErrFailToPrepareBatch = errors.New("custom conflict batch could not be prepared")
@@ -54,9 +54,9 @@ func (e *ErrorCounter) GetErrorsSummary() string {
5454
if len(e.errorsMap) == 0 {
5555
return "No errors encountered"
5656
}
57-
msg := "Errors encountered during spam:\n"
57+
blk := "Errors encountered during spam:\n"
5858
for key, value := range e.errorsMap {
59-
msg += fmt.Sprintf("%s: %d\n", key.Error(), value.Load())
59+
blk += fmt.Sprintf("%s: %d\n", key.Error(), value.Load())
6060
}
61-
return msg
61+
return blk
6262
}

client/evilspammer/options.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func WithEvilWallet(initWallets *evilwallet.EvilWallet) Options {
6363
}
6464
}
6565

66-
// WithEvilScenario provides initWallet of spammer, if omitted spammer will prepare funds based on maxMsgSent parameter
66+
// WithEvilScenario provides initWallet of spammer, if omitted spammer will prepare funds based on maxBlkSent parameter
6767
func WithEvilScenario(scenario *evilwallet.EvilScenario) Options {
6868
return func(s *Spammer) {
6969
s.EvilScenario = scenario

client/evilspammer/spammer.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func NewSpammer(options ...Options) *Spammer {
8383
return s
8484
}
8585

86-
func (s *Spammer) MessagesSent() uint64 {
86+
func (s *Spammer) BlocksSent() uint64 {
8787
return uint64(s.State.txSent.Load())
8888
}
8989

@@ -115,11 +115,11 @@ func (s *Spammer) setupSpamDetails() {
115115
if s.SpamDetails.TimeUnit == 0 {
116116
s.SpamDetails.TimeUnit = time.Second
117117
}
118-
// provided only maxMsgSent, calculating the default max for maxDuration
118+
// provided only maxBlkSent, calculating the default max for maxDuration
119119
if s.SpamDetails.MaxDuration == 0 && s.SpamDetails.MaxBatchesSent > 0 {
120120
s.SpamDetails.MaxDuration = time.Hour * 100
121121
}
122-
// provided only maxDuration, calculating the default max for maxMsgSent
122+
// provided only maxDuration, calculating the default max for maxBlkSent
123123
if s.SpamDetails.MaxBatchesSent == 0 && s.SpamDetails.MaxDuration > 0 {
124124
s.SpamDetails.MaxBatchesSent = int(s.SpamDetails.MaxDuration.Seconds()/s.SpamDetails.TimeUnit.Seconds()*float64(s.SpamDetails.Rate)) + 1
125125
}
@@ -141,7 +141,7 @@ func (s *Spammer) initLogTicker() *time.Ticker {
141141
return time.NewTicker(s.State.logTickTime)
142142
}
143143

144-
// Spam runs the spammer. Function will stop after maxDuration time will pass or when maxMsgSent will be exceeded
144+
// Spam runs the spammer. Function will stop after maxDuration time will pass or when maxBlkSent will be exceeded
145145
func (s *Spammer) Spam() {
146146
s.log.Infof("Start spamming transactions with %d rate", s.SpamDetails.Rate)
147147

@@ -153,7 +153,7 @@ func (s *Spammer) Spam() {
153153
for {
154154
select {
155155
case <-s.State.logTicker.C:
156-
s.log.Infof("Messages issued so far: %d, errors encountered: %d", s.State.txSent.Load(), s.ErrCounter.GetTotalErrorCount())
156+
s.log.Infof("Blocks issued so far: %d, errors encountered: %d", s.State.txSent.Load(), s.ErrCounter.GetTotalErrorCount())
157157
case <-timeExceeded:
158158
s.log.Infof("Maximum spam duration exceeded, stopping spammer....")
159159
s.StopSpamming()
@@ -180,7 +180,7 @@ func (s *Spammer) Spam() {
180180

181181
func (s *Spammer) CheckIfAllSent() {
182182
if s.State.batchPrepared.Load() >= int64(s.SpamDetails.MaxBatchesSent) {
183-
s.log.Infof("Maximum number of messages sent, stopping spammer...")
183+
s.log.Infof("Maximum number of blocks sent, stopping spammer...")
184184
s.done <- true
185185
}
186186
}

client/evilspammer/spamming_functions.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ import (
1414

1515
func DataSpammingFunction(s *Spammer) {
1616
clt := s.Clients.GetClient()
17-
// sleep randomly to avoid issuing messages in different goroutines at once
17+
// sleep randomly to avoid issuing blocks in different goroutines at once
1818
time.Sleep(time.Duration(rand.Float64()*20) * time.Millisecond)
1919
if err := evilwallet.RateSetterSleep(clt, s.UseRateSetter); err != nil {
2020
s.ErrCounter.CountError(err)
2121
}
22-
msgID, err := clt.PostData([]byte(fmt.Sprintf("SPAM")))
22+
blkID, err := clt.PostData([]byte(fmt.Sprintf("SPAM")))
2323
if err != nil {
24-
s.ErrCounter.CountError(ErrFailSendDataMessage)
24+
s.ErrCounter.CountError(ErrFailSendDataBlock)
2525
}
2626

2727
count := s.State.txSent.Add(1)
2828
if count%int64(s.SpamDetails.Rate*2) == 0 {
29-
s.log.Debugf("Last sent message, ID: %s; msgCount: %d", msgID, count)
29+
s.log.Debugf("Last sent block, ID: %s; blkCount: %d", blkID, count)
3030
}
3131
s.State.batchPrepared.Add(1)
3232
s.CheckIfAllSent()
@@ -53,7 +53,7 @@ func CustomConflictSpammingFunc(s *Spammer) {
5353
go func(clt evilwallet.Client, tx *devnetvm.Transaction) {
5454
defer wg.Done()
5555

56-
// sleep randomly to avoid issuing messages in different goroutines at once
56+
// sleep randomly to avoid issuing blocks in different goroutines at once
5757
time.Sleep(time.Duration(rand.Float64()*100) * time.Millisecond)
5858
if err = evilwallet.RateSetterSleep(clt, s.UseRateSetter); err != nil {
5959
s.ErrCounter.CountError(err)

client/evilspammer/utils.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package evilspammer
22

33
import (
4-
"github.com/iotaledger/goshimmer/client/evilwallet"
54
"time"
5+
6+
"github.com/iotaledger/goshimmer/client/evilwallet"
67
)
78

89
// BigWalletsNeeded calculates how many big wallets needs to be prepared for a spam based on provided spam details.

client/evilwallet/connector.go

+19-19
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"time"
66

77
"github.com/iotaledger/hive.go/identity"
8+
"github.com/iotaledger/hive.go/types/confirmation"
89

910
"github.com/iotaledger/goshimmer/client"
1011
"github.com/iotaledger/goshimmer/client/wallet"
11-
"github.com/iotaledger/goshimmer/packages/consensus/gof"
1212
"github.com/iotaledger/goshimmer/packages/jsonmodels"
1313
"github.com/iotaledger/goshimmer/packages/ledger/utxo"
1414
"github.com/iotaledger/goshimmer/packages/ledger/vm/devnetvm"
@@ -173,19 +173,19 @@ type Client interface {
173173
SleepRateSetterEstimate() (err error)
174174
// PostTransaction sends a transaction to the Tangle via a given client.
175175
PostTransaction(tx *devnetvm.Transaction) (utxo.TransactionID, error)
176-
// PostData sends the given data (payload) by creating a message in the backend.
177-
PostData(data []byte) (msgID string, err error)
176+
// PostData sends the given data (payload) by creating a block in the backend.
177+
PostData(data []byte) (blkID string, err error)
178178
// GetUnspentOutputForAddress gets the first unspent outputs of a given address.
179179
GetUnspentOutputForAddress(addr devnetvm.Address) *jsonmodels.WalletOutput
180180
// GetAddressUnspentOutputs gets the unspent outputs of an address.
181181
GetAddressUnspentOutputs(address string) (outputIDs []utxo.OutputID, err error)
182-
// GetTransactionGoF returns the GoF of a given transaction ID.
183-
GetTransactionGoF(txID string) gof.GradeOfFinality
182+
// GetTransactionConfirmationState returns the ConfirmationState of a given transaction ID.
183+
GetTransactionConfirmationState(txID string) confirmation.State
184184
// GetOutput gets the output of a given outputID.
185185
GetOutput(outputID utxo.OutputID) devnetvm.Output
186-
// GetOutputGoF gets the first unspent outputs of a given address.
187-
GetOutputGoF(outputID utxo.OutputID) gof.GradeOfFinality
188-
// BroadcastFaucetRequest requests funds from the faucet and returns the faucet request message ID.
186+
// GetOutputConfirmationState gets the first unspent outputs of a given address.
187+
GetOutputConfirmationState(outputID utxo.OutputID) confirmation.State
188+
// BroadcastFaucetRequest requests funds from the faucet and returns the faucet request block ID.
189189
BroadcastFaucetRequest(address string) error
190190
// GetTransactionOutputs returns the outputs the transaction created.
191191
GetTransactionOutputs(txID string) (outputs devnetvm.Outputs, err error)
@@ -232,7 +232,7 @@ func (c *WebClient) SleepRateSetterEstimate() (err error) {
232232
return nil
233233
}
234234

235-
// BroadcastFaucetRequest requests funds from the faucet and returns the faucet request message ID.
235+
// BroadcastFaucetRequest requests funds from the faucet and returns the faucet request block ID.
236236
func (c *WebClient) BroadcastFaucetRequest(address string) (err error) {
237237
_, err = c.api.BroadcastFaucetRequest(address, -1)
238238
return
@@ -256,8 +256,8 @@ func (c *WebClient) PostTransaction(tx *devnetvm.Transaction) (txID utxo.Transac
256256
return
257257
}
258258

259-
// PostData sends the given data (payload) by creating a message in the backend.
260-
func (c *WebClient) PostData(data []byte) (msgID string, err error) {
259+
// PostData sends the given data (payload) by creating a block in the backend.
260+
func (c *WebClient) PostData(data []byte) (blkID string, err error) {
261261
resp, err := c.api.Data(data)
262262
if err != nil {
263263
return
@@ -288,14 +288,14 @@ func (c *WebClient) GetUnspentOutputForAddress(addr devnetvm.Address) *jsonmodel
288288
return nil
289289
}
290290

291-
// GetOutputGoF gets the first unspent outputs of a given address.
292-
func (c *WebClient) GetOutputGoF(outputID utxo.OutputID) gof.GradeOfFinality {
291+
// GetOutputConfirmationState gets the first unspent outputs of a given address.
292+
func (c *WebClient) GetOutputConfirmationState(outputID utxo.OutputID) confirmation.State {
293293
res, err := c.api.GetOutputMetadata(outputID.Base58())
294294
if err != nil {
295-
return gof.None
295+
return confirmation.Pending
296296
}
297297

298-
return res.GradeOfFinality
298+
return res.ConfirmationState
299299
}
300300

301301
// GetOutput gets the output of a given outputID.
@@ -308,13 +308,13 @@ func (c *WebClient) GetOutput(outputID utxo.OutputID) devnetvm.Output {
308308
return output
309309
}
310310

311-
// GetTransactionGoF returns the GoF of a given transaction ID.
312-
func (c *WebClient) GetTransactionGoF(txID string) gof.GradeOfFinality {
311+
// GetTransactionConfirmationState returns the ConfirmationState of a given transaction ID.
312+
func (c *WebClient) GetTransactionConfirmationState(txID string) confirmation.State {
313313
resp, err := c.api.GetTransactionMetadata(txID)
314314
if err != nil {
315-
return gof.None
315+
return confirmation.Pending
316316
}
317-
return resp.GradeOfFinality
317+
return resp.ConfirmationState
318318
}
319319

320320
// GetTransactionOutputs returns the outputs the transaction created.

client/evilwallet/customscenarios.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ func NSpendBatch(nSpent int) EvilBatch {
7575
scenarioAlias = append(scenarioAlias,
7676
ScenarioAlias{
7777
Inputs: []string{strconv.Itoa(inputStartNum)},
78-
Outputs: []string{strconv.Itoa(i)}},
78+
Outputs: []string{strconv.Itoa(i)},
79+
},
7980
)
8081
}
8182
conflictSlice = append(conflictSlice, scenarioAlias)
@@ -136,7 +137,7 @@ func Scenario3() EvilBatch {
136137
}
137138
}
138139

139-
// Scenario4 is a reflection of ledgerstate unit test for branch confirmation - packages/ledgerstate/ledgerstate_test_SetBranchConfirmed.png
140+
// Scenario4 is a reflection of ledgerstate unit test for conflict confirmation - packages/ledgerstate/ledgerstate_test_SetConflictConfirmed.png
140141
func Scenario4() EvilBatch {
141142
return EvilBatch{
142143
[]ScenarioAlias{

client/evilwallet/evilwallet.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import (
1515
)
1616

1717
const (
18-
// GoFConfirmed defines the grade of finality that is considered confirmed.
19-
GoFConfirmed = 3
2018
// FaucetRequestSplitNumber defines the number of outputs to split from a faucet request.
2119
FaucetRequestSplitNumber = 100
2220
faucetTokensPerRequest = 1000000
@@ -32,10 +30,12 @@ const (
3230
maxGoroutines = 5
3331
)
3432

35-
var defaultClientsURLs = []string{"http://localhost:8080", "http://localhost:8090"}
36-
var faucetBalance = devnetvm.NewColoredBalances(map[devnetvm.Color]uint64{
37-
devnetvm.ColorIOTA: uint64(faucetTokensPerRequest),
38-
})
33+
var (
34+
defaultClientsURLs = []string{"http://localhost:8080", "http://localhost:8090"}
35+
faucetBalance = devnetvm.NewColoredBalances(map[devnetvm.Color]uint64{
36+
devnetvm.ColorIOTA: uint64(faucetTokensPerRequest),
37+
})
38+
)
3939

4040
// region EvilWallet ///////////////////////////////////////////////////////////////////////////////////////////////////////
4141

@@ -465,7 +465,8 @@ func (e *EvilWallet) prepareInputs(buildOptions *Options) (inputs []devnetvm.Inp
465465

466466
// prepareOutputs creates outputs for different scenarios, if no aliases were provided, new empty outputs are created from buildOptions.outputs balances.
467467
func (e *EvilWallet) prepareOutputs(buildOptions *Options, tempWallet *Wallet) (outputs []devnetvm.Output,
468-
addrAliasMap map[devnetvm.Address]string, tempAddresses map[devnetvm.Address]types.Empty, err error) {
468+
addrAliasMap map[devnetvm.Address]string, tempAddresses map[devnetvm.Address]types.Empty, err error,
469+
) {
469470
if buildOptions.areOutputsProvidedWithoutAliases() {
470471
for _, balance := range buildOptions.outputs {
471472
output := devnetvm.NewSigLockedColoredOutput(balance, buildOptions.outputWallet.Address().Address())
@@ -528,7 +529,8 @@ func (e *EvilWallet) useFreshIfInputWalletNotProvided(buildOptions *Options) (*W
528529
// that indicates which outputs should be saved to the outputWallet.All other outputs are created with temporary wallet,
529530
// and their addresses are stored in tempAddresses.
530531
func (e *EvilWallet) matchOutputsWithAliases(buildOptions *Options, tempWallet *Wallet) (outputs []devnetvm.Output,
531-
addrAliasMap map[devnetvm.Address]string, tempAddresses map[devnetvm.Address]types.Empty, err error) {
532+
addrAliasMap map[devnetvm.Address]string, tempAddresses map[devnetvm.Address]types.Empty, err error,
533+
) {
532534
err = e.updateOutputBalances(buildOptions)
533535
if err != nil {
534536
return nil, nil, nil, err
@@ -641,7 +643,6 @@ func (e *EvilWallet) updateOutputBalances(buildOptions *Options) (err error) {
641643
return true
642644
})
643645
}
644-
645646
}
646647
balances := SplitBalanceEqually(len(buildOptions.outputs)+len(buildOptions.aliasOutputs), totalBalance)
647648
i := 0

0 commit comments

Comments
 (0)