Commit 4a65bb9e authored by Håvard Anda Estensen's avatar Håvard Anda Estensen Committed by GitHub

op-node: Mark functions test helpers (#4237)

parent ec266098
...@@ -197,6 +197,7 @@ func TestPollingClientClose(t *testing.T) { ...@@ -197,6 +197,7 @@ func TestPollingClientClose(t *testing.T) {
} }
func requireChansEqual(t *testing.T, chans []chan *types.Header, root common.Hash) { func requireChansEqual(t *testing.T, chans []chan *types.Header, root common.Hash) {
t.Helper()
for _, ch := range chans { for _, ch := range chans {
header := <-ch header := <-ch
require.Equal(t, root, header.Root) require.Equal(t, root, header.Root)
......
...@@ -29,6 +29,7 @@ type testTx struct { ...@@ -29,6 +29,7 @@ type testTx struct {
} }
func (tx *testTx) Create(t *testing.T, signer types.Signer, rng *rand.Rand) *types.Transaction { func (tx *testTx) Create(t *testing.T, signer types.Signer, rng *rand.Rand) *types.Transaction {
t.Helper()
out, err := types.SignNewTx(tx.author, signer, &types.DynamicFeeTx{ out, err := types.SignNewTx(tx.author, signer, &types.DynamicFeeTx{
ChainID: signer.ChainID(), ChainID: signer.ChainID(),
Nonce: 0, Nonce: 0,
......
...@@ -141,6 +141,7 @@ var ( ...@@ -141,6 +141,7 @@ var (
// EncodeDepositOpaqueDataV0 performs ABI encoding to create the opaque data field of the deposit event. // EncodeDepositOpaqueDataV0 performs ABI encoding to create the opaque data field of the deposit event.
func EncodeDepositOpaqueDataV0(t *testing.T, mint *big.Int, value *big.Int, gasLimit uint64, isCreation bool, data []byte) []byte { func EncodeDepositOpaqueDataV0(t *testing.T, mint *big.Int, value *big.Int, gasLimit uint64, isCreation bool, data []byte) []byte {
t.Helper()
// in OptimismPortal.sol: // in OptimismPortal.sol:
// bytes memory opaqueData = abi.encodePacked(msg.value, _value, _gasLimit, _isCreation, _data); // bytes memory opaqueData = abi.encodePacked(msg.value, _value, _gasLimit, _isCreation, _data);
// Geth does not support abi.encodePacked, so we emulate it here by slicing of the padding from the individual elements // Geth does not support abi.encodePacked, so we emulate it here by slicing of the padding from the individual elements
......
...@@ -22,6 +22,7 @@ var _ L2Chain = (*testutils.FakeChainSource)(nil) ...@@ -22,6 +22,7 @@ var _ L2Chain = (*testutils.FakeChainSource)(nil)
// - The actual L1 chain is the New L1 chain // - The actual L1 chain is the New L1 chain
// - Both heads are at the tip of their respective chains // - Both heads are at the tip of their respective chains
func (c *syncStartTestCase) generateFakeL2(t *testing.T) (*testutils.FakeChainSource, rollup.Genesis) { func (c *syncStartTestCase) generateFakeL2(t *testing.T) (*testutils.FakeChainSource, rollup.Genesis) {
t.Helper()
log := testlog.Logger(t, log.LvlError) log := testlog.Logger(t, log.LvlError)
chain := testutils.NewFakeChainSource([]string{c.L1, c.NewL1}, []string{c.L2}, int(c.GenesisL1Num), log) chain := testutils.NewFakeChainSource([]string{c.L1, c.NewL1}, []string{c.L2}, int(c.GenesisL1Num), log)
chain.SetL2Head(len(c.L2) - 1) chain.SetL2Head(len(c.L2) - 1)
......
...@@ -14,6 +14,7 @@ func BigEqual(a, b *big.Int) bool { ...@@ -14,6 +14,7 @@ func BigEqual(a, b *big.Int) bool {
} }
func RequireBigEqual(t *testing.T, exp, actual *big.Int) { func RequireBigEqual(t *testing.T, exp, actual *big.Int) {
t.Helper()
if !BigEqual(exp, actual) { if !BigEqual(exp, actual) {
t.Fatalf("expected %s to be equal to %s", exp.String(), actual.String()) t.Fatalf("expected %s to be equal to %s", exp.String(), actual.String())
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment