forked from ethereum-optimism/op-geth
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for Celo2 Signer compatibility with both Celo1 and Celo2 tr…
…ansactions (#308) * Fix typo * Add unit tests for forks * Add unit tests for Celo signer * Format code * Simplify Test_forks_activeForks and Test_forks_findTxFuncs * Remove Test_forks_findTxFuncs
- Loading branch information
1 parent
5df6a68
commit 461d643
Showing
3 changed files
with
486 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package types | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/ethereum/go-ethereum/params" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// Test_forks_activeForks tests that the correct forks are returned for a given block time and chain config | ||
func Test_forks_activeForks(t *testing.T) { | ||
t.Parallel() | ||
|
||
cel2Time := uint64(1000) | ||
|
||
t.Run("Non-Celo", func(t *testing.T) { | ||
config := ¶ms.ChainConfig{ | ||
Cel2Time: nil, | ||
} | ||
assert.Equal(t, []fork(nil), celoForks.activeForks(1000, config)) | ||
}) | ||
|
||
t.Run("Celo1", func(t *testing.T) { | ||
config := ¶ms.ChainConfig{ | ||
Cel2Time: &cel2Time, | ||
} | ||
assert.Equal(t, []fork{&celoLegacy{}}, celoForks.activeForks(500, config)) | ||
}) | ||
|
||
t.Run("Celo2", func(t *testing.T) { | ||
config := ¶ms.ChainConfig{ | ||
Cel2Time: &cel2Time, | ||
} | ||
assert.Equal(t, []fork{&cel2{}, &celoLegacy{}}, celoForks.activeForks(1000, config)) | ||
}) | ||
} |
Oops, something went wrong.