Skip to content

Commit 6f271cd

Browse files
authored
NeoGo 0.111.0 (#3474)
2 parents 29bc0ae + cf4d8fb commit 6f271cd

File tree

10 files changed

+44
-18
lines changed

10 files changed

+44
-18
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Changelog for NeoFS Node
66
### Added
77
- `Head` operation for FSTree (#3383)
88
- `GetStream` operation for FSTree (#3431)
9+
- `max_time_per_block` configuration for embedded IR CN (#3474)
910

1011
### Fixed
1112
- IR exponentially retries updating SN lists in the Container contract in error cases (#3344)
@@ -45,7 +46,7 @@ Changelog for NeoFS Node
4546

4647
### Updated
4748
- `github.com/nspcc-dev/neofs-sdk-go` dependency to `v1.0.0-rc.13.0.20250715070617-c7038b450691` (#3406, #3461)
48-
- NeoGo dependency to v0.110.1-0.20250709130255-4f05526f09f6 (#3456)
49+
- NeoGo dependency to v0.111.0 (#3456, #3474)
4950

5051
### Updating from v0.47.1
5152
Storage group objects are no longer supported (rejected by SN), you can

cmd/neofs-ir/validate_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ fschain:
4040
type: boltdb
4141
path: ./db/fschain.bolt
4242
time_per_block: 1s
43+
max_time_per_block: 20s
4344
max_traceable_blocks: 11520
4445
seed_nodes:
4546
- node2
@@ -200,6 +201,7 @@ func TestCheckForUnknownFieldsExample(t *testing.T) {
200201
Path: "./db/morph.bolt",
201202
},
202203
TimePerBlock: time.Second,
204+
MaxTimePerBlock: 20 * time.Second,
203205
MaxTraceableBlocks: 11520,
204206
MaxValidUntilBlockIncrement: 3600,
205207
SeedNodes: []string{"node2", "node3:20333"},

config/example/ir.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ fschain:
4141
path: ./db/morph.bolt # File system path to the storage. Ignored for 'inmemory' storage.
4242
time_per_block: 1s # Optional time period (approximate) between two adjacent blocks. Defaults to 15s.
4343
# Must not be negative
44+
max_time_per_block: 20s # Optional maximum time period (approximate) between two adjacent blocks, enabled dynamic block time. Not set by default (time_per_block only used).
45+
# Must not be negative, must be bigger than time_per_block.
4446
max_traceable_blocks: 11520 # Optional length of the chain accessible to smart contracts. Defaults to 17280.
4547
# Must not be greater than 4294967295
4648
max_valid_until_block_increment: 3600 # Optional transaction validity period relative to the current height. Defaults to 8640.

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/multiformats/go-multiaddr v0.12.2
2020
github.com/nspcc-dev/hrw/v2 v2.0.3
2121
github.com/nspcc-dev/locode-db v0.6.0
22-
github.com/nspcc-dev/neo-go v0.110.1-0.20250709130255-4f05526f09f6
22+
github.com/nspcc-dev/neo-go v0.111.0
2323
github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240827150555-5ce597aa14ea
2424
github.com/nspcc-dev/neofs-contract v0.23.0
2525
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.13.0.20250715070617-c7038b450691
@@ -73,7 +73,7 @@ require (
7373
github.com/multiformats/go-multihash v0.2.3 // indirect
7474
github.com/multiformats/go-varint v0.0.7 // indirect
7575
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
76-
github.com/nspcc-dev/dbft v0.3.3-0.20250321140139-7462b47e4d2d // indirect
76+
github.com/nspcc-dev/dbft v0.4.0 // indirect
7777
github.com/nspcc-dev/go-ordered-json v0.0.0-20250226190835-fb3f82b1f468 // indirect
7878
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20250423172732-0e55bd820115 // indirect
7979
github.com/nspcc-dev/rfc6979 v0.2.3 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,16 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
187187
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
188188
github.com/nspcc-dev/bbolt v0.0.0-20250612101626-5df2544a4a22 h1:M5Nmg1iCnbZngzIBDIlMr9vW+okFfcSMBvBlXG8r+14=
189189
github.com/nspcc-dev/bbolt v0.0.0-20250612101626-5df2544a4a22/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk=
190-
github.com/nspcc-dev/dbft v0.3.3-0.20250321140139-7462b47e4d2d h1:Mm0bp0YRAuGfoUDPbleQ9zByJc6HTCu3B4/UBoen9cQ=
191-
github.com/nspcc-dev/dbft v0.3.3-0.20250321140139-7462b47e4d2d/go.mod h1:msYlF5GIGwOZ9jUIHttBAAtiqJ29jzV8PPKKv1avXAI=
190+
github.com/nspcc-dev/dbft v0.4.0 h1:4/atD4GrrMEtrYBDiZPrPzdKZ6ws7PR/cg0M4DEdVeI=
191+
github.com/nspcc-dev/dbft v0.4.0/go.mod h1:msYlF5GIGwOZ9jUIHttBAAtiqJ29jzV8PPKKv1avXAI=
192192
github.com/nspcc-dev/go-ordered-json v0.0.0-20250226190835-fb3f82b1f468 h1:qOd9/UANpXOME/3RTSa/dJoSzdVwYOkD32XQah0xj1E=
193193
github.com/nspcc-dev/go-ordered-json v0.0.0-20250226190835-fb3f82b1f468/go.mod h1:d3cUseu4Asxfo9/QA/w4TtGjM0AbC9ynyab+PfH+Bso=
194194
github.com/nspcc-dev/hrw/v2 v2.0.3 h1:GUIitIiDpAaQat9SZccp7XVAuwtqaM40+uZ9D8Q4A84=
195195
github.com/nspcc-dev/hrw/v2 v2.0.3/go.mod h1:VWlFSGGPcHG1abuIDJb5u83tIF2EqOatC8Z7svZmgWQ=
196196
github.com/nspcc-dev/locode-db v0.6.0 h1:EdRUug+sL0EMLZgucLETD6bnegKjyEZh+D5x4r5VMvY=
197197
github.com/nspcc-dev/locode-db v0.6.0/go.mod h1:mJLXdzlcRucr3AFUvf5fJH+rFv1bJuU85e1jtDHDTz8=
198-
github.com/nspcc-dev/neo-go v0.110.1-0.20250709130255-4f05526f09f6 h1:2T/whI2JcweHqlCsH/PHhGTefP8nrtRFzmHZg/4TCVs=
199-
github.com/nspcc-dev/neo-go v0.110.1-0.20250709130255-4f05526f09f6/go.mod h1:PkLFBJPwuyEu+KSccDBMzdfjEr+Wml8mxZRliQWL8Ck=
198+
github.com/nspcc-dev/neo-go v0.111.0 h1:60gxcLIe7xbD+P8W5N/o3dLp/qvltuEEkkNVaQnTscU=
199+
github.com/nspcc-dev/neo-go v0.111.0/go.mod h1:VhxUMpQI/5iz7Q7kP1C274idruGTh61o5zq/IHSH2BI=
200200
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20250423172732-0e55bd820115 h1:VWIceT+fh7sB5H+J5hhOIN+pWCy9/PHcvpvjSXteIQg=
201201
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20250423172732-0e55bd820115/go.mod h1:3byneDNT60tiD8MSyGSyjpI1uVp9v+coySegJoQPF8c=
202202
github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240827150555-5ce597aa14ea h1:mK0EMGLvunXcFyq7fBURS/CsN4MH+4nlYiqn6pTwWAU=

pkg/innerring/config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package innerring
22

33
import (
4+
"errors"
45
"fmt"
56
"math"
67
"net"
@@ -70,6 +71,15 @@ func validateBlockchainConfig(cfg *config.Config) error {
7071
return err
7172
}
7273

74+
err = checkDurationPositive(cfgFSChainLocalConsensus.MaxTimePerBlock, cfgPathFSChainLocalConsensus+".max_time_per_block")
75+
if err != nil {
76+
return err
77+
}
78+
79+
if cfgFSChainLocalConsensus.MaxTimePerBlock != 0 && cfgFSChainLocalConsensus.MaxTimePerBlock < cfgFSChainLocalConsensus.TimePerBlock {
80+
return errors.New("consensus max_time_per_block set to lower value than time_per_block")
81+
}
82+
7383
cfgFSChainLocalConsensus.SeedNodes, err = parseConfigAddressesTCP(cfgFSChainLocalConsensus.SeedNodes,
7484
cfgPathFSChainLocalConsensus+".seed_nodes", p2pDefaultListenPort, false)
7585
if err != nil {

pkg/innerring/config/fschain.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,20 @@ type Consensus struct {
3333
// Required.
3434
Storage Storage `mapstructure:"storage"`
3535

36-
// Time period (approximate) between two adjacent blocks.
36+
// Time period (approximate) between two adjacent blocks. If used
37+
// with MaxTimePerBlock, specifies minimal time.
3738
//
3839
// Optional: defaults to 15s. Must not be negative.
3940
TimePerBlock time.Duration `mapstructure:"time_per_block"`
4041

42+
// Maximum time period (approximate) between two adjacent blocks,
43+
// if used enables dynamic block time (contrary to TimePerBlock
44+
// targeting for every block).
45+
//
46+
// Optional: not set by default. Must not be negative, must be
47+
// bigger than TimePerBlock.
48+
MaxTimePerBlock time.Duration `mapstructure:"max_time_per_block"`
49+
4150
// Length of the chain accessible to smart contracts.
4251
//
4352
// Optional: defaults to 17280.

pkg/innerring/config_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ fschain:
3838
// YAML sub-configuration of the IR consensus with all optional fields.
3939
const validBlockchainConfigOptions = `
4040
time_per_block: 1s
41+
max_time_per_block: 20s
4142
max_traceable_blocks: 200
4243
seed_nodes:
4344
- localhost:20000
@@ -178,9 +179,10 @@ func TestParseBlockchainConfig(t *testing.T) {
178179
require.Equal(t, &irconfig.Config{
179180
FSChain: irconfig.Chain{
180181
Consensus: irconfig.Consensus{
181-
Magic: 15405,
182-
Committee: validCommittee,
183-
TimePerBlock: time.Second,
182+
Magic: 15405,
183+
Committee: validCommittee,
184+
TimePerBlock: time.Second,
185+
MaxTimePerBlock: 20 * time.Second,
184186
RPC: irconfig.RPC{
185187
MaxWebSocketClients: 100,
186188
SessionPoolSize: 100,
@@ -357,6 +359,7 @@ fschain:
357359
{kvF("magic", math.MaxUint32+1)},
358360
{kvF("committee", []string{"not a key"})},
359361
{kvF("time_per_block", "not a duration")},
362+
{kvF("max_time_per_block", "not a duration")},
360363
{kvF("max_traceable_blocks", -1)},
361364
{kvF("max_traceable_blocks", math.MaxUint32+1)},
362365
{kvF("max_valid_until_block_increment", -1)},
@@ -398,6 +401,8 @@ fschain:
398401
{kvF("committee", []string{})},
399402
{kvF("storage.type", "random string")},
400403
{kvF("time_per_block", -time.Second)},
404+
{kvF("max_time_per_block", -time.Second)},
405+
{kvF("max_time_per_block", time.Millisecond)},
401406
{kvF("seed_nodes", []string{"a:1:2"})},
402407
{kvF("hardforks", map[string]any{"": 1})},
403408
{kvF("validators_history", map[string]any{"0": len(validCommittee) + 1})},

pkg/innerring/internal/blockchain/blockchain.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ func New(cfg *config.Consensus, wallet *config.Wallet, errChan chan<- error, log
5454
panic("uninitialized storage config")
5555
case cfg.TimePerBlock < 0:
5656
panic("negative block interval")
57+
case cfg.MaxTimePerBlock < 0:
58+
panic("negative max block interval")
5759
case wallet.Path == "":
5860
panic("missing wallet path")
5961
case errChan == nil:
@@ -155,6 +157,7 @@ func New(cfg *config.Consensus, wallet *config.Wallet, errChan chan<- error, log
155157
cfgBaseProto.StandbyCommittee = standByCommittee
156158

157159
cfgBaseProto.TimePerBlock = cfg.TimePerBlock
160+
cfgBaseProto.MaxTimePerBlock = cfg.MaxTimePerBlock
158161
cfgBaseProto.Genesis.TimePerBlock = cfg.TimePerBlock
159162
cfgBaseProto.SeedList = cfg.SeedNodes
160163
cfgBaseProto.VerifyTransactions = true

pkg/morph/client/client.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -525,13 +525,7 @@ func (c *Client) GetBlockHeader(ind uint32) (*block.Header, error) {
525525
return nil, ErrConnectionLost
526526
}
527527

528-
// there is no header by index in neo-go's client yet
529-
b, err := conn.client.GetBlockByIndex(ind)
530-
if err != nil {
531-
return nil, err
532-
}
533-
534-
return &b.Header, nil
528+
return conn.client.GetBlockHeaderByIndex(ind)
535529
}
536530

537531
// MsPerBlock returns MillisecondsPerBlock network parameter.

0 commit comments

Comments
 (0)