Skip to content

Commit

Permalink
Fix geth merge PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-Wilson committed Nov 14, 2023
1 parent f41c60c commit c4c67d4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion arbos/arbosState/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func InitializeArbosInDatabase(db ethdb.Database, initData statetransfer.InitDat
}

commit := func() (common.Hash, error) {
root, err := statedb.Commit(0, true)
root, err := statedb.Commit(chainConfig.ArbitrumChainParams.GenesisBlockNum, true)
if err != nil {
return common.Hash{}, err
}
Expand Down
1 change: 1 addition & 0 deletions arbos/parse_l2.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ func parseL2Message(rd io.Reader, poster common.Address, timestamp uint64, reque
}
if newTx.Type() >= types.ArbitrumDepositTxType || newTx.Type() == types.BlobTxType {
// Should be unreachable for Arbitrum types due to UnmarshalBinary not accepting Arbitrum internal txs
// and we want to disallow BlobTxType since Arbitrum doesn't support EIP-4844 txs yet.
return nil, types.ErrTxTypeNotSupported
}
return types.Transactions{newTx}, nil
Expand Down
1 change: 1 addition & 0 deletions execution/gethexec/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ func (s *Sequencer) PublishTransaction(parentCtx context.Context, tx *types.Tran
}
if tx.Type() >= types.ArbitrumDepositTxType || tx.Type() == types.BlobTxType {
// Should be unreachable for Arbitrum types due to UnmarshalBinary not accepting Arbitrum internal txs
// and we want to disallow BlobTxType since Arbitrum doesn't support EIP-4844 txs yet.
return types.ErrTxTypeNotSupported
}

Expand Down
8 changes: 4 additions & 4 deletions system_tests/conditionaltx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func TestSendRawTransactionConditionalBasic(t *testing.T) {
Require(t, err)
blockNumber := block.NumberU64()

l2BlockTime := func() uint64 {
currentL2BlockTime := func() uint64 {
l2Block, err := builder.L2.Client.BlockByNumber(ctx, nil)
Require(t, err)
return l2Block.Time()
Expand All @@ -249,7 +249,7 @@ func TestSendRawTransactionConditionalBasic(t *testing.T) {
optionsB := getOptions(contractAddress2, currentRootHash2, currentSlotValueMap2)
optionsAB := optionsProduct(optionsA, optionsB)
options1 := dedupOptions(t, append(append(optionsAB, optionsA...), optionsB...))
options1 = optionsDedupProduct(t, options1, getFulfillableBlockTimeLimits(t, blockNumber, l2BlockTime()))
options1 = optionsDedupProduct(t, options1, getFulfillableBlockTimeLimits(t, blockNumber, currentL2BlockTime()))
for i, options := range options1 {
testConditionalTxThatShouldSucceed(t, ctx, i, builder.L2Info, rpcClient, options)
}
Expand Down Expand Up @@ -285,7 +285,7 @@ func TestSendRawTransactionConditionalBasic(t *testing.T) {
optionsD := getOptions(contractAddress2, currentRootHash2, currentSlotValueMap2)
optionsCD := optionsProduct(optionsC, optionsD)
options2 := dedupOptions(t, append(append(optionsCD, optionsC...), optionsD...))
options2 = optionsDedupProduct(t, options2, getFulfillableBlockTimeLimits(t, blockNumber, l2BlockTime()))
options2 = optionsDedupProduct(t, options2, getFulfillableBlockTimeLimits(t, blockNumber, currentL2BlockTime()))
for i, options := range options2 {
testConditionalTxThatShouldSucceed(t, ctx, i, builder.L2Info, rpcClient, options)
}
Expand All @@ -295,7 +295,7 @@ func TestSendRawTransactionConditionalBasic(t *testing.T) {
block, err = builder.L1.Client.BlockByNumber(ctx, nil)
Require(t, err)
blockNumber = block.NumberU64()
options3 := optionsDedupProduct(t, options2, getUnfulfillableBlockTimeLimits(t, blockNumber, l2BlockTime()))
options3 := optionsDedupProduct(t, options2, getUnfulfillableBlockTimeLimits(t, blockNumber, currentL2BlockTime()))
for i, options := range options3 {
testConditionalTxThatShouldFail(t, ctx, i, builder.L2Info, rpcClient, options, -32003)
}
Expand Down
13 changes: 5 additions & 8 deletions system_tests/delayedinboxlong_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func TestDelayInboxLong(t *testing.T) {
var lastDelayedMessage *types.Transaction

for i := 0; i < addLocalLoops; i++ {
l1Txs := make([]*types.Transaction, 0, messagesPerAddLocal)
for len(l1Txs) < messagesPerAddLocal {
wrappedL1Txs := make([]*txpool.Transaction, 0, messagesPerAddLocal)
for len(wrappedL1Txs) < messagesPerAddLocal {
randNum := rand.Int() % messagesPerDelayed
var l1tx *types.Transaction
if randNum == 0 {
Expand All @@ -50,20 +50,17 @@ func TestDelayInboxLong(t *testing.T) {
} else {
l1tx = builder.L1Info.PrepareTx("Faucet", "User", 30000, big.NewInt(1e12), nil)
}
l1Txs = append(l1Txs, l1tx)
}
wrappedL1Txs := make([]*txpool.Transaction, 0, messagesPerAddLocal)
for _, tx := range l1Txs {
wrappedL1Txs = append(wrappedL1Txs, &txpool.Transaction{Tx: tx})
wrappedL1Txs = append(wrappedL1Txs, &txpool.Transaction{Tx: l1tx})
}

// adding multiple messages in the same Add with local=true to get them in the same L1 block
errs := builder.L1.L1Backend.TxPool().Add(wrappedL1Txs, true, false)
for _, err := range errs {
Require(t, err)
}
// Checking every tx is expensive, so we just check the last, assuming that the others succeeded too
confirmLatestBlock(ctx, t, builder.L1Info, builder.L1.Client)
_, err := builder.L1.EnsureTxSucceeded(l1Txs[len(l1Txs)-1])
_, err := builder.L1.EnsureTxSucceeded(wrappedL1Txs[len(wrappedL1Txs)-1].Tx)
Require(t, err)
}

Expand Down
15 changes: 6 additions & 9 deletions system_tests/twonodeslong_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ func testTwoNodesLong(t *testing.T, dasModeStr string) {
}
for i := 0; i < largeLoops; i++ {
l1TxsThisTime := rand.Int() % (avgTotalL1MessagesPerLoop * 2)
l1Txs := make([]*types.Transaction, 0, l1TxsThisTime)
for len(l1Txs) < l1TxsThisTime {
wrappedL1Txs := make([]*txpool.Transaction, 0, l1TxsThisTime)
for len(wrappedL1Txs) < l1TxsThisTime {
randNum := rand.Int() % avgTotalL1MessagesPerLoop
var l1tx *types.Transaction
if randNum < avgDelayedMessagesPerLoop {
Expand All @@ -97,12 +97,9 @@ func testTwoNodesLong(t *testing.T, dasModeStr string) {
} else {
l1tx = builder.L1Info.PrepareTx("Faucet", "User", 30000, big.NewInt(1e12), nil)
}
l1Txs = append(l1Txs, l1tx)
}
wrappedL1Txs := make([]*txpool.Transaction, 0, l1TxsThisTime)
for _, tx := range l1Txs {
wrappedL1Txs = append(wrappedL1Txs, &txpool.Transaction{Tx: tx})
wrappedL1Txs = append(wrappedL1Txs, &txpool.Transaction{Tx: l1tx})
}

// adding multiple messages in the same Add with local=true to get them in the same L1 block
errs := builder.L1.L1Backend.TxPool().Add(wrappedL1Txs, true, false)
for _, err := range errs {
Expand All @@ -117,8 +114,8 @@ func testTwoNodesLong(t *testing.T, dasModeStr string) {
}
builder.L2.SendWaitTestTransactions(t, l2Txs)
directTransfers += int64(l2TxsThisTime)
if len(l1Txs) > 0 {
_, err := builder.L1.EnsureTxSucceeded(l1Txs[len(l1Txs)-1])
if len(wrappedL1Txs) > 0 {
_, err := builder.L1.EnsureTxSucceeded(wrappedL1Txs[len(wrappedL1Txs)-1].Tx)
if err != nil {
Fatal(t, err)
}
Expand Down

0 comments on commit c4c67d4

Please sign in to comment.