diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 7d85e13cbe6..06fefb95837 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -172,6 +172,14 @@ steps: plugins: <<: *docker_plugin + - label: Test fuzz builds + branches: master kostko/fix/build-fuzz + command: + - . .buildkite/scripts/skip_if_only_docs_changes.sh + - make -C go build-fuzz + plugins: + <<: *docker_plugin + # Wait for all jobs defined before this point # to finish running in parallel before continuing. - wait diff --git a/.changelog/2695.internal.md b/.changelog/2695.internal.md new file mode 100644 index 00000000000..517ae0889d7 --- /dev/null +++ b/.changelog/2695.internal.md @@ -0,0 +1 @@ +Make build-fuzz work again, test it on CI diff --git a/go/consensus/tendermint/abci/mux_mock.go b/go/consensus/tendermint/abci/mux_mock.go index 542d0c1dc7d..5d5a0886f7b 100644 --- a/go/consensus/tendermint/abci/mux_mock.go +++ b/go/consensus/tendermint/abci/mux_mock.go @@ -4,6 +4,8 @@ package abci import ( "context" + + upgrade "github.com/oasislabs/oasis-core/go/upgrade/api" ) // MockABCIMux exports some of the muxer's internal methods for testing use. @@ -22,8 +24,8 @@ func (mux *MockABCIMux) MockClose() { } // NewMockMux creates a new ABCI mux suitable for testing. -func NewMockMux(ctx context.Context, cfg *ApplicationConfig) (*MockABCIMux, error) { - mux, err := newABCIMux(ctx, cfg) +func NewMockMux(ctx context.Context, upgrader upgrade.Backend, cfg *ApplicationConfig) (*MockABCIMux, error) { + mux, err := newABCIMux(ctx, upgrader, cfg) if err != nil { return nil, err } diff --git a/go/consensus/tendermint/apps/staking/proposing_rewards.go b/go/consensus/tendermint/apps/staking/proposing_rewards.go index 4f3f20a46f9..ba44e8a0c26 100644 --- a/go/consensus/tendermint/apps/staking/proposing_rewards.go +++ b/go/consensus/tendermint/apps/staking/proposing_rewards.go @@ -41,7 +41,8 @@ func (app *stakingApplication) rewardBlockProposing(ctx *abci.Context, stakeStat if err != nil { return fmt.Errorf("app state getting current epoch: %w", err) } - if epoch == epochtime.EpochInvalid { + invalidEpoch := epochtime.EpochInvalid // Workaround for incorrect go-fuzz instrumentation. + if epoch == invalidEpoch { ctx.Logger().Info("rewardBlockProposing: this block does not belong to an epoch. no block proposing reward") return nil } diff --git a/go/consensus/tendermint/fuzz/fuzz.go b/go/consensus/tendermint/fuzz/fuzz.go index 2a0e1de6da4..189660bba09 100644 --- a/go/consensus/tendermint/fuzz/fuzz.go +++ b/go/consensus/tendermint/fuzz/fuzz.go @@ -16,6 +16,7 @@ import ( "github.com/oasislabs/oasis-core/go/consensus/tendermint/apps/epochtime_mock" registryApp "github.com/oasislabs/oasis-core/go/consensus/tendermint/apps/registry" stakingApp "github.com/oasislabs/oasis-core/go/consensus/tendermint/apps/staking" + "github.com/oasislabs/oasis-core/go/upgrade" ) var ( @@ -53,7 +54,7 @@ func Fuzz(data []byte) int { } // The muxer will start with the previous state, if it exists (the state database isn't cleared). - muxer, _ := abci.NewMockMux(ctx, appConfig) + muxer, _ := abci.NewMockMux(ctx, upgrade.NewDummyUpgradeManager(), appConfig) defer muxer.MockClose() for _, app := range FuzzableApps { diff --git a/go/storage/fuzz/fuzz.go b/go/storage/fuzz/fuzz.go index ec3c3380865..5c59d436ea7 100644 --- a/go/storage/fuzz/fuzz.go +++ b/go/storage/fuzz/fuzz.go @@ -6,6 +6,7 @@ import ( "context" "io/ioutil" + "github.com/oasislabs/oasis-core/go/common" "github.com/oasislabs/oasis-core/go/common/crypto/signature" "github.com/oasislabs/oasis-core/go/common/crypto/signature/signers/file" commonFuzz "github.com/oasislabs/oasis-core/go/common/fuzz" @@ -40,7 +41,7 @@ func init() { } // Create the storage backend service. - storageBackend, err = storage.New(context.Background(), localDB, identity, nil, nil) + storageBackend, err = storage.New(context.Background(), localDB, common.Namespace{}, identity, nil, nil) if err != nil { panic(err) } diff --git a/go/storage/fuzz/gencorpus/main.go b/go/storage/fuzz/gencorpus/main.go index 6eff196e563..dccd7513370 100644 --- a/go/storage/fuzz/gencorpus/main.go +++ b/go/storage/fuzz/gencorpus/main.go @@ -9,6 +9,7 @@ import ( "fmt" "io/ioutil" + "github.com/oasislabs/oasis-core/go/common" commonFuzz "github.com/oasislabs/oasis-core/go/common/fuzz" "github.com/oasislabs/oasis-core/go/common/identity" "github.com/oasislabs/oasis-core/go/storage" @@ -19,7 +20,7 @@ const ( ) func main() { - storage, err := storage.New(context.Background(), "/tmp/oasis-node-fuzz-storage", &identity.Identity{}, nil, nil) + storage, err := storage.New(context.Background(), "/tmp/oasis-node-fuzz-storage", common.Namespace{}, &identity.Identity{}, nil, nil) if err != nil { panic(err) }