Skip to content

Commit

Permalink
tests for engine primitives package (berachain#1410)
Browse files Browse the repository at this point in the history
* tests for engine primitives package

Signed-off-by: nidhi-singh02 <[email protected]>

* os name changed

Signed-off-by: nidhi-singh02 <[email protected]>

* slither image update

Signed-off-by: nidhi-singh02 <[email protected]>

* new runner

Signed-off-by: nidhi-singh02 <[email protected]>

* using ubuntu os

Signed-off-by: nidhi-singh02 <[email protected]>

* ci

* update runner

---------

Signed-off-by: nidhi-singh02 <[email protected]>
Co-authored-by: Devon Bear <[email protected]>
  • Loading branch information
nidhi-singh02 and Devon Bear authored Jun 10, 2024
1 parent f2cc029 commit 638490f
Show file tree
Hide file tree
Showing 12 changed files with 1,000 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- "test-forge-cover"
- "test-forge-fuzz"
os:
- ubuntu-latest-large
- ubuntu-24.04-beacon-kit
name: ${{ matrix.args }}
runs-on:
labels: ${{ matrix.os }}
Expand Down
5 changes: 5 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ packages:
recursive: False
with-expecter: true
all: True
github.com/berachain/beacon-kit/mod/engine-primitives/pkg/engine-primitives:
config:
recursive: False
with-expecter: true
all: True
2 changes: 1 addition & 1 deletion contracts/lib/forge-std
Submodule forge-std updated 2 files
+3 −0 src/Vm.sol
+1 −1 test/Vm.t.sol
63 changes: 63 additions & 0 deletions mod/engine-primitives/pkg/engine-primitives/attributes_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// SPDX-License-Identifier: BUSL-1.1
//
// Copyright (C) 2024, Berachain Foundation. All rights reserved.
// Use of this software is govered by the Business Source License included
// in the LICENSE file of this repository and at www.mariadb.com/bsl11.
//
// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY
// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER
// VERSIONS OF THE LICENSED WORK.
//
// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF
// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF
// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE).
//
// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
// TITLE.

package engineprimitives_test

import (
"testing"

engineprimitives "github.com/berachain/beacon-kit/mod/engine-primitives/pkg/engine-primitives"
"github.com/berachain/beacon-kit/mod/primitives"
"github.com/berachain/beacon-kit/mod/primitives/pkg/common"
"github.com/stretchr/testify/require"
)

type Withdrawal struct{}

func TestPayloadAttributes(t *testing.T) {
forkVersion := uint32(1)
timestamp := uint64(123456789)
prevRandao := primitives.Bytes32{1, 2, 3}
suggestedFeeRecipient := common.ExecutionAddress{}
withdrawals := []Withdrawal{}
parentBeaconBlockRoot := primitives.Root{}

payloadAttributes, err := engineprimitives.NewPayloadAttributes[Withdrawal](
forkVersion,
timestamp,
prevRandao,
suggestedFeeRecipient,
withdrawals,
parentBeaconBlockRoot,
)
require.NoError(t, err)
require.NotNil(t, payloadAttributes)

require.False(t, payloadAttributes.IsNil())

require.Equal(
t,
suggestedFeeRecipient,
payloadAttributes.GetSuggestedFeeRecipient(),
)
require.Equal(t, forkVersion, payloadAttributes.Version())

require.NoError(t, payloadAttributes.Validate())
}
178 changes: 178 additions & 0 deletions mod/engine-primitives/pkg/engine-primitives/mocks/blobs_bundle.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 638490f

Please sign in to comment.