Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
829d03c
fix last computation in window
patrick-ogrady May 11, 2023
b79d8f2
add genesis block to cache
patrick-ogrady May 11, 2023
946a5e0
nit
patrick-ogrady May 11, 2023
03ab6a9
init seen data structures earlier
patrick-ogrady May 11, 2023
fdee7a2
log proposer monitor refresh time
patrick-ogrady May 11, 2023
63e413f
track mempool size
patrick-ogrady May 11, 2023
da5991a
size-based gossip
patrick-ogrady May 11, 2023
5234572
make NetworkSizeLimit a const
patrick-ogrady May 11, 2023
b4b4d31
add mode single
patrick-ogrady May 11, 2023
665503b
nits
patrick-ogrady May 11, 2023
e9642ac
port 159
patrick-ogrady May 11, 2023
c155cb1
update DEVNET instructions
patrick-ogrady May 11, 2023
b686044
add prometheus cmd
patrick-ogrady May 11, 2023
7fd434f
update watch TPS
patrick-ogrady May 11, 2023
4b85b50
overhaul spam script
patrick-ogrady May 11, 2023
645a270
don't add potential block to check
patrick-ogrady May 11, 2023
e854980
check if should build more frequently
patrick-ogrady May 11, 2023
286068e
lint
patrick-ogrady May 11, 2023
9f95666
add lll exemption
patrick-ogrady May 11, 2023
fa70a63
add helpful comment to window calc
patrick-ogrady May 11, 2023
9018f5e
fix spam cmd
patrick-ogrady May 11, 2023
bcf728f
lint
patrick-ogrady May 11, 2023
b74fe4e
add more gossip controls
patrick-ogrady May 11, 2023
7509052
add gossip settings to scripts run
patrick-ogrady May 11, 2023
229ea11
fix cluster shutdown
patrick-ogrady May 11, 2023
89b1c1d
ensure client does not write concurrently to ws conn
patrick-ogrady May 11, 2023
2a9db57
fix flaky startup
patrick-ogrady May 11, 2023
64560b8
avoid submitting duplicate txs
patrick-ogrady May 11, 2023
3ac9d51
update with new HYPERSDK_VERSION
patrick-ogrady May 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions builder/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import (
"time"

"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/hypersdk/consts"
"github.com/ava-labs/hypersdk/window"
"go.uber.org/zap"
)

const buildCheck = 200 * time.Millisecond
const buildCheck = 50 * time.Millisecond

var _ Builder = (*Time)(nil)

Expand Down Expand Up @@ -67,11 +66,8 @@ func (b *Time) shouldBuild(ctx context.Context) (bool, error) {
if err != nil {
return false, err
}
if since < window.WindowSize {
slot := window.WindowSize - 1 - since
start := slot * consts.Uint64Len
window.Update(&newRollupWindow, start, 1)
}
// [preferredBlk.BlockWindow] already includes the preferred block, so we
// don't need to add 1 before determining if we should build another block.
return window.Last(&newRollupWindow) < b.cfg.PreferredBlocksPerSecond, nil
}

Expand Down
16 changes: 3 additions & 13 deletions chain/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"go.uber.org/zap"

"github.com/ava-labs/hypersdk/codec"
"github.com/ava-labs/hypersdk/consts"
"github.com/ava-labs/hypersdk/utils"
"github.com/ava-labs/hypersdk/window"
"github.com/ava-labs/hypersdk/workers"
Expand All @@ -33,17 +34,6 @@ var (
_ block.StateSummary = &SyncableBlock{}
)

const (
// AvalancheGo imposes a limit of 2 MiB on the network, so we limit at
// 2 MiB - ProposerVM header - Protobuf encoding overhead (we assume this is
// no more than 50 KiB of overhead but is likely much less)
NetworkSizeLimit = 2_044_723 // 1.95 MiB

// MaxWarpMessages is the maximum number of warp messages allows in a single
// block.
MaxWarpMessages = 64
)

type StatefulBlock struct {
Prnt ids.ID `json:"parent"`
Tmstmp int64 `json:"timestamp"`
Expand Down Expand Up @@ -816,7 +806,7 @@ func (b *StatefulBlock) Marshal(
actionRegistry ActionRegistry,
authRegistry AuthRegistry,
) ([]byte, error) {
p := codec.NewWriter(NetworkSizeLimit)
p := codec.NewWriter(consts.NetworkSizeLimit)

p.PackID(b.Prnt)
p.PackInt64(b.Tmstmp)
Expand Down Expand Up @@ -844,7 +834,7 @@ func (b *StatefulBlock) Marshal(

func UnmarshalBlock(raw []byte, parser Parser) (*StatefulBlock, error) {
var (
p = codec.NewReader(raw, NetworkSizeLimit)
p = codec.NewReader(raw, consts.NetworkSizeLimit)
b StatefulBlock
)

Expand Down
3 changes: 3 additions & 0 deletions chain/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ import (
const (
FutureBound = 10 * time.Second
MaxWarpMessageSize = 256 * units.KiB
// MaxWarpMessages is the maximum number of warp messages allows in a single
// block.
MaxWarpMessages = 64
)
11 changes: 7 additions & 4 deletions chain/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (t *Transaction) Digest(
if !ok {
return nil, fmt.Errorf("unknown action type %T", t.Action)
}
p := codec.NewWriter(NetworkSizeLimit)
p := codec.NewWriter(consts.NetworkSizeLimit)
t.Base.Marshal(p)
var warpBytes []byte
if t.WarpMessage != nil {
Expand Down Expand Up @@ -98,7 +98,7 @@ func (t *Transaction) Sign(

// Ensure transaction is fully initialized and correct by reloading it from
// bytes
p := codec.NewWriter(NetworkSizeLimit)
p := codec.NewWriter(consts.NetworkSizeLimit)
if err := t.Marshal(p, actionRegistry, authRegistry); err != nil {
return nil, err
}
Expand Down Expand Up @@ -367,7 +367,10 @@ func MarshalTxs(
actionRegistry ActionRegistry,
authRegistry AuthRegistry,
) ([]byte, error) {
p := codec.NewWriter(NetworkSizeLimit)
if len(txs) == 0 {
return nil, ErrNoTxs
}
p := codec.NewWriter(consts.NetworkSizeLimit)
p.PackInt(len(txs))
for _, tx := range txs {
if err := tx.Marshal(p, actionRegistry, authRegistry); err != nil {
Expand All @@ -383,7 +386,7 @@ func UnmarshalTxs(
actionRegistry ActionRegistry,
authRegistry AuthRegistry,
) ([]*Transaction, error) {
p := codec.NewReader(raw, NetworkSizeLimit)
p := codec.NewReader(raw, consts.NetworkSizeLimit)
txCount := p.UnpackInt(true)
if txCount > maxCount {
return nil, ErrTooManyTxs
Expand Down
5 changes: 5 additions & 0 deletions consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ const (
Uint64Len = 8
MaxUint64Offset = 63
MaxUint64 = ^uint64(0)

// AvalancheGo imposes a limit of 2 MiB on the network, so we limit at
// 2 MiB - ProposerVM header - Protobuf encoding overhead (we assume this is
// no more than 50 KiB of overhead but is likely much less)
NetworkSizeLimit = 2_044_723 // 1.95 MiB
)
Loading