Skip to content

Commit

Permalink
Merge branch 'master' into antithesis-fix-assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
marun committed Jun 13, 2024
2 parents 4043d2a + d3a3739 commit 1566390
Show file tree
Hide file tree
Showing 23 changed files with 622 additions and 237 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/publish_antithesis_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Publish Antithesis Images

on:
workflow_dispatch:
inputs:
image_tag:
description: 'The tag to apply to published images'
default: latest
required: true
type: string
push:
branches:
- master
Expand Down Expand Up @@ -29,12 +35,12 @@ jobs:
run: bash -x ./scripts/build_antithesis_images.sh
env:
IMAGE_PREFIX: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}
TAG: latest
TAG: ${{ github.events.inputs.image_tag || latest }}
TEST_SETUP: avalanchego

- name: Build and push images for xsvm test setup
run: bash -x ./scripts/build_antithesis_images.sh
env:
IMAGE_PREFIX: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}
TAG: latest
TAG: ${{ github.events.inputs.image_tag || latest }}
TEST_SETUP: xsvm
53 changes: 53 additions & 0 deletions .github/workflows/trigger-antithesis-runs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Trigger Antithesis Test Runs

on:
# TODO(marun) Add a schedule to execute regularly
workflow_dispatch:
inputs:
duration:
description: 'The duration to run the test for'
default: '0.5'
required: true
type: string
recipients:
description: 'Email recipients to send the test report to'
default: ${{ secrets.ANTITHESIS_RECIPIENTS }}
required: true
type: string
image_tag:
description: 'The image tag to target'
default: latest
required: true
type: string

jobs:
Run Antithesis Avalanchego Test Setup:
runs-on: ubuntu-latest
steps:
- uses: antithesishq/antithesis-trigger-action@v0.5
with:
notebook_name: avalanche
tenant: avalanche
username: ${{ secrets.ANTITHESIS_USERNAME }}
password: ${{ secrets.ANTITHESIS_PASSWORD }}
github_token: ${{ secrets.ANTITHESIS_GH_PAT }}
config_image: antithesis-avalanchego-config@${{ github.events.inputs.image_tag }}
images: antithesis-avalanchego-workload@${{ github.events.inputs.image_tag }};antithesis-avalanchego-node@${{ github.events.inputs.image_tag }}
email_recipients: ${{ github.events.inputs.recipients }}
additional_parameters: |-
custom.duration=${{ github.events.inputs.duration }}
Run Antithesis XSVM Test Setup:
runs-on: ubuntu-latest
steps:
- uses: antithesishq/antithesis-trigger-action@v0.5
with:
notebook_name: avalanche
tenant: avalanche
username: ${{ secrets.ANTITHESIS_USERNAME }}
password: ${{ secrets.ANTITHESIS_PASSWORD }}
github_token: ${{ secrets.ANTITHESIS_GH_PAT }}
config_image: antithesis-xsvm-config@${{ github.events.inputs.image_tag }}
images: antithesis-xsvm-workload@${{ github.events.inputs.image_tag }};antithesis-xsvm-node@${{ github.events.inputs.image_tag }}
email_recipients: ${{ github.events.inputs.recipients }}
additional_parameters: |-
custom.duration=${{ github.events.inputs.duration }}
27 changes: 27 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Release Notes

## [v1.11.8](https://github.com/ava-labs/avalanchego/releases/tag/v1.11.8)

This version is backwards compatible to [v1.11.0](https://github.com/ava-labs/avalanchego/releases/tag/v1.11.0). It is optional, but encouraged.

The plugin version is unchanged at `35` and is compatible with versions `v1.11.3-v1.11.7`.

### APIs

- Redesigned metrics to use labels rather than custom namespaces.

### What's Changed

- Remove avalanche metrics registerer from consensus context by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/3087
- Remove rejection from `consensus.Add` by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/3084
- [vms/platformvm] Rename `txstest.Builder` to `txstest.WalletFactory` by @dhrubabasu in https://github.com/ava-labs/avalanchego/pull/2890
- Small metrics cleanup by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/3088
- Fix race in test by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/3089
- Implement error driven snowflake hardcoded to support a single beta by @aaronbuchwald in https://github.com/ava-labs/avalanchego/pull/2978
- Replace all chain namespaces with labels by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/3053
- add a metrics gauge for built block slot by @tsachiherman in https://github.com/ava-labs/avalanchego/pull/3048
- [ci] Switch to gh workers for arm64 by @marun in https://github.com/ava-labs/avalanchego/pull/3090
- [ci] Ensure focal arm64 builds all have their required dependencies by @marun in https://github.com/ava-labs/avalanchego/pull/3091
- X-chain - consolidate tx creation in unit tests by @abi87 in https://github.com/ava-labs/avalanchego/pull/2736
- Use netip.AddrPort rather than ips.IPPort by @StephenButtolph in https://github.com/ava-labs/avalanchego/pull/3094

**Full Changelog**: https://github.com/ava-labs/avalanchego/compare/v1.11.7...v1.11.8

## [v1.11.7](https://github.com/ava-labs/avalanchego/releases/tag/v1.11.7)

This version is backwards compatible to [v1.11.0](https://github.com/ava-labs/avalanchego/releases/tag/v1.11.0). It is optional, but encouraged.
Expand Down
4 changes: 2 additions & 2 deletions snow/consensus/snowball/binary_snowball.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import "fmt"

var _ Binary = (*binarySnowball)(nil)

func newBinarySnowball(alphaPreference int, alphaConfidence int, beta int, choice int) binarySnowball {
func newBinarySnowball(alphaPreference int, terminationConditions []terminationCondition, choice int) binarySnowball {
return binarySnowball{
binarySnowflake: newBinarySnowflake(alphaPreference, alphaConfidence, beta, choice),
binarySnowflake: newBinarySnowflake(alphaPreference, terminationConditions, choice),
preference: choice,
}
}
Expand Down
23 changes: 14 additions & 9 deletions snow/consensus/snowball/binary_snowball_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ func TestBinarySnowball(t *testing.T) {

alphaPreference, alphaConfidence := 2, 3
beta := 2
terminationConditions := newSingleTerminationCondition(alphaConfidence, beta)

sb := newBinarySnowball(alphaPreference, alphaConfidence, beta, red)
sb := newBinarySnowball(alphaPreference, terminationConditions, red)
require.Equal(red, sb.Preference())
require.False(sb.Finalized())

Expand Down Expand Up @@ -47,8 +48,9 @@ func TestBinarySnowballRecordPollPreference(t *testing.T) {

alphaPreference, alphaConfidence := 1, 2
beta := 2
terminationConditions := newSingleTerminationCondition(alphaConfidence, beta)

sb := newBinarySnowball(alphaPreference, alphaConfidence, beta, red)
sb := newBinarySnowball(alphaPreference, terminationConditions, red)
require.Equal(red, sb.Preference())
require.False(sb.Finalized())

Expand All @@ -72,7 +74,7 @@ func TestBinarySnowballRecordPollPreference(t *testing.T) {
require.Equal(red, sb.Preference())
require.True(sb.Finalized())

expected := "SB(Preference = 0, PreferenceStrength[0] = 4, PreferenceStrength[1] = 1, SF(Confidence = 2, Finalized = true, SL(Preference = 0)))"
expected := "SB(Preference = 0, PreferenceStrength[0] = 4, PreferenceStrength[1] = 1, SF(Confidence = [2], Finalized = true, SL(Preference = 0)))"
require.Equal(expected, sb.String())
}

Expand All @@ -84,8 +86,9 @@ func TestBinarySnowballRecordUnsuccessfulPoll(t *testing.T) {

alphaPreference, alphaConfidence := 1, 2
beta := 2
terminationConditions := newSingleTerminationCondition(alphaConfidence, beta)

sb := newBinarySnowball(alphaPreference, alphaConfidence, beta, red)
sb := newBinarySnowball(alphaPreference, terminationConditions, red)
require.Equal(red, sb.Preference())
require.False(sb.Finalized())

Expand All @@ -103,7 +106,7 @@ func TestBinarySnowballRecordUnsuccessfulPoll(t *testing.T) {
require.Equal(blue, sb.Preference())
require.True(sb.Finalized())

expected := "SB(Preference = 1, PreferenceStrength[0] = 0, PreferenceStrength[1] = 3, SF(Confidence = 2, Finalized = true, SL(Preference = 1)))"
expected := "SB(Preference = 1, PreferenceStrength[0] = 0, PreferenceStrength[1] = 3, SF(Confidence = [2], Finalized = true, SL(Preference = 1)))"
require.Equal(expected, sb.String())
}

Expand All @@ -115,8 +118,9 @@ func TestBinarySnowballAcceptWeirdColor(t *testing.T) {

alphaPreference, alphaConfidence := 1, 2
beta := 2
terminationConditions := newSingleTerminationCondition(alphaConfidence, beta)

sb := newBinarySnowball(alphaPreference, alphaConfidence, beta, red)
sb := newBinarySnowball(alphaPreference, terminationConditions, red)

require.Equal(red, sb.Preference())
require.False(sb.Finalized())
Expand Down Expand Up @@ -144,7 +148,7 @@ func TestBinarySnowballAcceptWeirdColor(t *testing.T) {
require.Equal(blue, sb.Preference())
require.True(sb.Finalized())

expected := "SB(Preference = 1, PreferenceStrength[0] = 2, PreferenceStrength[1] = 2, SF(Confidence = 2, Finalized = true, SL(Preference = 0)))"
expected := "SB(Preference = 1, PreferenceStrength[0] = 2, PreferenceStrength[1] = 2, SF(Confidence = [2], Finalized = true, SL(Preference = 0)))"
require.Equal(expected, sb.String())
}

Expand All @@ -156,8 +160,9 @@ func TestBinarySnowballLockColor(t *testing.T) {

alphaPreference, alphaConfidence := 1, 2
beta := 1
terminationConditions := newSingleTerminationCondition(alphaConfidence, beta)

sb := newBinarySnowball(alphaPreference, alphaConfidence, beta, red)
sb := newBinarySnowball(alphaPreference, terminationConditions, red)

sb.RecordPoll(alphaConfidence, red)

Expand All @@ -175,6 +180,6 @@ func TestBinarySnowballLockColor(t *testing.T) {
require.Equal(red, sb.Preference())
require.True(sb.Finalized())

expected := "SB(Preference = 1, PreferenceStrength[0] = 1, PreferenceStrength[1] = 3, SF(Confidence = 1, Finalized = true, SL(Preference = 0)))"
expected := "SB(Preference = 1, PreferenceStrength[0] = 1, PreferenceStrength[1] = 3, SF(Confidence = [1], Finalized = true, SL(Preference = 0)))"
require.Equal(expected, sb.String())
}
19 changes: 7 additions & 12 deletions snow/consensus/snowball/binary_snowflake.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ import "fmt"

var _ Binary = (*binarySnowflake)(nil)

func newBinarySnowflake(alphaPreference, alphaConfidence, beta, choice int) binarySnowflake {
func newBinarySnowflake(alphaPreference int, terminationConditions []terminationCondition, choice int) binarySnowflake {
return binarySnowflake{
binarySlush: newBinarySlush(choice),
alphaPreference: alphaPreference,
terminationConditions: []terminationCondition{
{
alphaConfidence: alphaConfidence,
beta: beta,
},
},
confidence: make([]int, 1),
binarySlush: newBinarySlush(choice),
alphaPreference: alphaPreference,
terminationConditions: terminationConditions,
confidence: make([]int, len(terminationConditions)),
}
}

Expand Down Expand Up @@ -94,8 +89,8 @@ func (sf *binarySnowflake) Finalized() bool {
}

func (sf *binarySnowflake) String() string {
return fmt.Sprintf("SF(Confidence = %d, Finalized = %v, %s)",
sf.confidence[0],
return fmt.Sprintf("SF(Confidence = %v, Finalized = %v, %s)",
sf.confidence,
sf.finalized,
&sf.binarySlush)
}
44 changes: 43 additions & 1 deletion snow/consensus/snowball/binary_snowflake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ func TestBinarySnowflake(t *testing.T) {

alphaPreference, alphaConfidence := 1, 2
beta := 2
terminationConditions := newSingleTerminationCondition(alphaConfidence, beta)

sf := newBinarySnowflake(alphaPreference, alphaConfidence, beta, red)
sf := newBinarySnowflake(alphaPreference, terminationConditions, red)

require.Equal(red, sf.Preference())
require.False(sf.Finalized())
Expand Down Expand Up @@ -50,3 +51,44 @@ func TestBinarySnowflake(t *testing.T) {
require.Equal(blue, sf.Preference())
require.True(sf.Finalized())
}

type binarySnowflakeTest struct {
require *require.Assertions

binarySnowflake
}

func newBinarySnowflakeTest(t *testing.T, alphaPreference int, terminationConditions []terminationCondition) snowflakeTest[int] {
require := require.New(t)

return &binarySnowflakeTest{
require: require,
binarySnowflake: newBinarySnowflake(alphaPreference, terminationConditions, 0),
}
}

func (sf *binarySnowflakeTest) RecordPoll(count int, choice int) {
sf.binarySnowflake.RecordPoll(count, choice)
}

func (sf *binarySnowflakeTest) AssertEqual(expectedConfidences []int, expectedFinalized bool, expectedPreference int) {
sf.require.Equal(expectedPreference, sf.Preference())
sf.require.Equal(expectedConfidences, sf.binarySnowflake.confidence)
sf.require.Equal(expectedFinalized, sf.Finalized())
}

func TestBinarySnowflakeErrorDrivenSingleChoice(t *testing.T) {
for _, test := range getErrorDrivenSnowflakeSingleChoiceSuite[int]() {
t.Run(test.name, func(t *testing.T) {
test.f(t, newBinarySnowflakeTest, 0)
})
}
}

func TestBinarySnowflakeErrorDrivenMultiChoice(t *testing.T) {
for _, test := range getErrorDrivenSnowflakeMultiChoiceSuite[int]() {
t.Run(test.name, func(t *testing.T) {
test.f(t, newBinarySnowflakeTest, 0, 1)
})
}
}
8 changes: 4 additions & 4 deletions snow/consensus/snowball/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ var (
type snowballFactory struct{}

func (snowballFactory) NewNnary(params Parameters, choice ids.ID) Nnary {
sb := newNnarySnowball(params.AlphaPreference, params.AlphaConfidence, params.Beta, choice)
sb := newNnarySnowball(params.AlphaPreference, newSingleTerminationCondition(params.AlphaConfidence, params.Beta), choice)
return &sb
}

func (snowballFactory) NewUnary(params Parameters) Unary {
sb := newUnarySnowball(params.AlphaPreference, params.AlphaConfidence, params.Beta)
sb := newUnarySnowball(params.AlphaPreference, newSingleTerminationCondition(params.AlphaConfidence, params.Beta))
return &sb
}

type snowflakeFactory struct{}

func (snowflakeFactory) NewNnary(params Parameters, choice ids.ID) Nnary {
sf := newNnarySnowflake(params.AlphaPreference, params.AlphaConfidence, params.Beta, choice)
sf := newNnarySnowflake(params.AlphaPreference, newSingleTerminationCondition(params.AlphaConfidence, params.Beta), choice)
return &sf
}

func (snowflakeFactory) NewUnary(params Parameters) Unary {
sf := newUnarySnowflake(params.AlphaPreference, params.AlphaConfidence, params.Beta)
sf := newUnarySnowflake(params.AlphaPreference, newSingleTerminationCondition(params.AlphaConfidence, params.Beta))
return &sf
}
2 changes: 1 addition & 1 deletion snow/consensus/snowball/flat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ func TestFlat(t *testing.T) {
require.Equal(Green, f.Preference())
require.True(f.Finalized())

expected := "SB(Preference = 2mcwQKiD8VEspmMJpL1dc7okQQ5dDVAWeCBZ7FWBFAbxpv3t7w, PreferenceStrength = 4, SF(Confidence = 2, Finalized = true, SL(Preference = 2mcwQKiD8VEspmMJpL1dc7okQQ5dDVAWeCBZ7FWBFAbxpv3t7w)))"
expected := "SB(Preference = 2mcwQKiD8VEspmMJpL1dc7okQQ5dDVAWeCBZ7FWBFAbxpv3t7w, PreferenceStrength = 4, SF(Confidence = [2], Finalized = true, SL(Preference = 2mcwQKiD8VEspmMJpL1dc7okQQ5dDVAWeCBZ7FWBFAbxpv3t7w)))"
require.Equal(expected, f.String())
}
4 changes: 2 additions & 2 deletions snow/consensus/snowball/nnary_snowball.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (

var _ Nnary = (*nnarySnowball)(nil)

func newNnarySnowball(alphaPreference, alphaConfidence, beta int, choice ids.ID) nnarySnowball {
func newNnarySnowball(alphaPreference int, terminationConditions []terminationCondition, choice ids.ID) nnarySnowball {
return nnarySnowball{
nnarySnowflake: newNnarySnowflake(alphaPreference, alphaConfidence, beta, choice),
nnarySnowflake: newNnarySnowflake(alphaPreference, terminationConditions, choice),
preference: choice,
preferenceStrength: make(map[ids.ID]int),
}
Expand Down
Loading

0 comments on commit 1566390

Please sign in to comment.