forked from berachain/beacon-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests for engine primitives package (berachain#1410)
* 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
1 parent
f2cc029
commit 638490f
Showing
12 changed files
with
1,000 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule solady
updated
19 files
+654 −639 | .gas-snapshot | |
+27 −0 | .github/workflows/ci-invariant-intense.yml | |
+4 −0 | foundry.toml | |
+1 −1 | package.json | |
+56 −43 | src/accounts/ERC6551.sol | |
+6 −6 | src/tokens/ERC4626.sol | |
+1 −1 | src/utils/DynamicBufferLib.sol | |
+60 −25 | src/utils/FixedPointMathLib.sol | |
+1 −1 | src/utils/LibBit.sol | |
+149 −56 | src/utils/LibPRNG.sol | |
+7 −7 | src/utils/RedBlackTreeLib.sol | |
+121 −0 | src/utils/SignatureCheckerLib.sol | |
+10 −0 | test/ERC6551.t.sol | |
+65 −2 | test/FixedPointMathLib.t.sol | |
+179 −37 | test/LibPRNG.t.sol | |
+6 −27 | test/SafeTransferLib.t.sol | |
+212 −0 | test/SignatureCheckerLib.t.sol | |
+28 −0 | test/utils/TestPlus.sol | |
+5 −1 | test/utils/mocks/MockERC1271Wallet.sol |
63 changes: 63 additions & 0 deletions
63
mod/engine-primitives/pkg/engine-primitives/attributes_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
178
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.
Oops, something went wrong.
Oops, something went wrong.