Skip to content

Commit 7c85f13

Browse files
authored
Merge branch 'dev' into e2e-address-allocation
2 parents 7f3c7a9 + 22f5b91 commit 7c85f13

33 files changed

+822
-392
lines changed

.github/workflows/debian/template/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ Section: misc
44
Priority: optional
55
Architecture: arm64
66
Depends:
7-
Maintainer: Fabio Barone <fabio@avalabs.org>
7+
Maintainer: Stephen Buttolph <stephen@avalabs.org>
88
Description: The Avalanche platform binaries

x/merkledb/maybe.go renamed to utils/maybe/maybe.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
package merkledb
4+
package maybe
55

66
// Maybe T = Some T | Nothing.
77
// A data wrapper that allows values to be something [Some T] or nothing [Nothing].
@@ -42,23 +42,23 @@ func (m Maybe[T]) Value() T {
4242
return m.value
4343
}
4444

45-
// MaybeBind returns Nothing, if [m] is Nothing.
45+
// Bind returns Nothing iff [m] is Nothing.
4646
// Otherwise applies [f] to the value of [m] and returns the result as a Some.
47-
func MaybeBind[T, U any](m Maybe[T], f func(T) U) Maybe[U] {
47+
func Bind[T, U any](m Maybe[T], f func(T) U) Maybe[U] {
4848
if m.IsNothing() {
4949
return Nothing[U]()
5050
}
5151
return Some(f(m.Value()))
5252
}
5353

54-
// MaybeEqual returns true if both m1 and m2 are nothing or have the same value according to the equality function
55-
func MaybeEqual[T any](m1 Maybe[T], m2 Maybe[T], equality func(T, T) bool) bool {
54+
// Equal returns true if both m1 and m2 are nothing or have the same value according to [equalFunc].
55+
func Equal[T any](m1 Maybe[T], m2 Maybe[T], equalFunc func(T, T) bool) bool {
5656
if m1.IsNothing() {
5757
return m2.IsNothing()
5858
}
5959

6060
if m2.IsNothing() {
6161
return false
6262
}
63-
return equality(m1.Value(), m2.Value())
63+
return equalFunc(m1.Value(), m2.Value())
6464
}

x/merkledb/maybe_test.go renamed to utils/maybe/maybe_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
package merkledb
4+
package maybe
55

66
import (
77
"testing"
@@ -18,7 +18,7 @@ func TestMaybeClone(t *testing.T) {
1818
val := []byte{1, 2, 3}
1919
originalVal := slices.Clone(val)
2020
m := Some(val)
21-
mClone := MaybeBind(m, slices.Clone[[]byte])
21+
mClone := Bind(m, slices.Clone[[]byte])
2222
m.value[0] = 0
2323
require.NotEqual(mClone.value, m.value)
2424
require.Equal(originalVal, mClone.value)
@@ -27,23 +27,23 @@ func TestMaybeClone(t *testing.T) {
2727
// Case: Value is nothing
2828
{
2929
m := Nothing[[]byte]()
30-
mClone := MaybeBind(m, slices.Clone[[]byte])
30+
mClone := Bind(m, slices.Clone[[]byte])
3131
require.True(mClone.IsNothing())
3232
}
3333
}
3434

3535
func TestMaybeEquality(t *testing.T) {
3636
require := require.New(t)
37-
require.True(MaybeEqual(Nothing[int](), Nothing[int](), func(i int, i2 int) bool {
37+
require.True(Equal(Nothing[int](), Nothing[int](), func(i int, i2 int) bool {
3838
return i == i2
3939
}))
40-
require.False(MaybeEqual(Nothing[int](), Some(1), func(i int, i2 int) bool {
40+
require.False(Equal(Nothing[int](), Some(1), func(i int, i2 int) bool {
4141
return i == i2
4242
}))
43-
require.False(MaybeEqual(Some(1), Nothing[int](), func(i int, i2 int) bool {
43+
require.False(Equal(Some(1), Nothing[int](), func(i int, i2 int) bool {
4444
return i == i2
4545
}))
46-
require.True(MaybeEqual(Some(1), Some(1), func(i int, i2 int) bool {
46+
require.True(Equal(Some(1), Some(1), func(i int, i2 int) bool {
4747
return i == i2
4848
}))
4949
}

vms/platformvm/config/execution_config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var DefaultExecutionConfig = ExecutionConfig{
1616
RewardUTXOsCacheSize: 2048,
1717
ChainCacheSize: 2048,
1818
ChainDBCacheSize: 2048,
19+
BlockIDCacheSize: 8192,
1920
ChecksumsEnabled: false,
2021
}
2122

@@ -27,6 +28,7 @@ type ExecutionConfig struct {
2728
RewardUTXOsCacheSize int `json:"reward-utxos-cache-size"`
2829
ChainCacheSize int `json:"chain-cache-size"`
2930
ChainDBCacheSize int `json:"chain-db-cache-size"`
31+
BlockIDCacheSize int `json:"block-id-cache-size"`
3032
ChecksumsEnabled bool `json:"checksums-enabled"`
3133
}
3234

vms/platformvm/config/execution_config_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func TestExecutionConfigUnmarshal(t *testing.T) {
4545
"reward-utxos-cache-size": 5,
4646
"chain-cache-size": 6,
4747
"chain-db-cache-size": 7,
48+
"block-id-cache-size": 8,
4849
"checksums-enabled": true
4950
}`)
5051
ec, err := GetExecutionConfig(b)
@@ -56,6 +57,7 @@ func TestExecutionConfigUnmarshal(t *testing.T) {
5657
RewardUTXOsCacheSize: 5,
5758
ChainCacheSize: 6,
5859
ChainDBCacheSize: 7,
60+
BlockIDCacheSize: 8,
5961
ChecksumsEnabled: true,
6062
}
6163
require.Equal(expected, ec)

vms/platformvm/state/mock_state.go

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)