Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
hamdiallam committed Sep 10, 2024
1 parent 3f2b4c9 commit 9987de3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/types/transaction_conditional.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type KnownAccounts map[common.Address]KnownAccount
// then the user prefers their transaction to only be included if the
// particular storage slot values from state match.
type KnownAccount struct {
StorageRoot *common.Hash `rlp:"nil"`
StorageRoot *common.Hash
StorageSlots map[common.Hash]common.Hash
}

Expand Down
12 changes: 9 additions & 3 deletions internal/sequencerapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (s *sendRawTxCond) SendRawTransactionConditional(ctx context.Context, txByt
}
}

header, err := s.b.HeaderByNumber(context.Background(), rpc.LatestBlockNumber)
state, header, err := s.b.StateAndHeaderByNumber(context.Background(), rpc.LatestBlockNumber)
if err != nil {
return common.Hash{}, err
}
Expand All @@ -62,6 +62,12 @@ func (s *sendRawTxCond) SendRawTransactionConditional(ctx context.Context, txByt
Code: params.TransactionConditionalRejectedErrCode,
}
}
if err := state.CheckTransactionConditional(&cond); err != nil {
return common.Hash{}, &rpc.JsonError{
Message: fmt.Sprintf("failed state check: %s", err),
Code: params.TransactionConditionalRejectedErrCode,
}
}

// State is checked against an older block to remove the MEV incentive for this endpoint compared with sendRawTransaction
parentBlock := rpc.BlockNumberOrHash{BlockHash: &header.ParentHash}
Expand Down Expand Up @@ -92,8 +98,8 @@ func (s *sendRawTxCond) SendRawTransactionConditional(ctx context.Context, txByt
tx.SetConditional(&cond)

// `SubmitTransaction` which forwards to `b.SendTx` also checks if its internal `seqRPC` client is
// set. Since both of these client are constructed if `RollupSequencerHTTP` is set, the above block
// ensures that we're only adding to the txpool in this block.
// set. Since both of these client are constructed when `RollupSequencerHTTP` is supplied, the above
// block ensures that we're only adding to the txpool for this node.
sendRawTxConditionalAcceptedCounter.Inc(1)
return ethapi.SubmitTransaction(ctx, s.b, tx)
}
Expand Down
1 change: 0 additions & 1 deletion miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ func (miner *Miner) commitTransaction(env *environment, tx *types.Transaction) e
now, cost := time.Now(), conditional.Cost()
res := miner.conditionalLimiter.ReserveN(now, cost)
if !res.OK() {
res.Cancel()
return fmt.Errorf("exceeded rate limiter burst: cost %d, burst %d: %w", cost, miner.conditionalLimiter.Burst(), errTxConditionalInvalid)
}
if res.Delay() > 0 {
Expand Down

0 comments on commit 9987de3

Please sign in to comment.