Skip to content

Commit

Permalink
Merge pull request #55 from ethereum-optimism/jg/sync_fork
Browse files Browse the repository at this point in the history
Pull in upstream changes
  • Loading branch information
mslipper authored Oct 7, 2022
2 parents 3a80ce8 + 7a2778c commit 72a0888
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions clients/prysm-bn/prysm_bn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ echo Starting Prysm Beacon Node
--jwt-secret=/jwtsecret \
--min-sync-peers=1 \
--subscribe-all-subnets=true \
--enable-debug-rpc-endpoints=true \
$metrics_option \
--deposit-contract="${HIVE_ETH2_CONFIG_DEPOSIT_CONTRACT_ADDRESS:-0x1111111111111111111111111111111111111111}" \
--contract-deployment-block="${HIVE_ETH2_DEPOSIT_DEPLOY_BLOCK_NUMBER:-0}" \
Expand Down
10 changes: 10 additions & 0 deletions simulators/ethereum/engine/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package helper

import (
"context"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -371,6 +372,13 @@ func MakeTransaction(nonce uint64, recipient *common.Address, gasLimit uint64, a
return signedTx, nil
}

// Determines if the error we got from sending the raw tx is because the client
// already knew the tx (might happen if we produced a re-org where the tx was
// unwind back into the txpool)
func SentTxAlreadyKnown(err error) bool {
return strings.Contains(err.Error(), "already known")
}

func SendNextTransaction(testCtx context.Context, node client.EngineClient, recipient common.Address, amount *big.Int, payload []byte, txType TestTransactionType) (*types.Transaction, error) {
nonce, err := node.GetNextAccountNonce(testCtx, globals.VaultAccountAddress)
if err != nil {
Expand All @@ -383,6 +391,8 @@ func SendNextTransaction(testCtx context.Context, node client.EngineClient, reci
err := node.SendTransaction(ctx, tx)
if err == nil {
return tx, nil
} else if SentTxAlreadyKnown(err) {
return tx, nil
}
select {
case <-time.After(time.Second):
Expand Down
6 changes: 6 additions & 0 deletions simulators/ethereum/engine/suites/transition/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ type MergeTestSpec struct {
// Chain file to initialize the main client.
MainChainFile string

// Transaction type to use throughout the test
TestTransactionType helper.TestTransactionType

// Introduce PREVRANDAO transactions on the PoS blocks, including transition,
// which could overwrite an existing transaction in the PoW chain (if re-org
// occurred to a lower-height chain)
Expand Down Expand Up @@ -213,6 +216,8 @@ var mergeTestSpecs = []MergeTestSpec{
MainChainFile: "blocks_2_td_393120.rlp",
KeepCheckingUntilTimeout: true,
PrevRandaoTransactions: true,
// Tx included in the proof-of-work chain is legacy
TestTransactionType: helper.LegacyTxOnly,
SecondaryClientSpecs: []SecondaryClientSpec{
{
ClientStarter: hive_rpc.HiveRPCEngineStarter{
Expand Down Expand Up @@ -1152,6 +1157,7 @@ func GenerateMergeTestSpec(mergeTestSpec MergeTestSpec) test.Spec {
GenesisFile: mergeTestSpec.GenesisFile,
DisableMining: mergeTestSpec.DisableMining,
ChainFile: mergeTestSpec.MainChainFile,
TestTransactionType: mergeTestSpec.TestTransactionType,
SafeSlotsToImportOptimistically: mergeTestSpec.SafeSlotsToImportOptimistically,
}
}

0 comments on commit 72a0888

Please sign in to comment.