Skip to content

Commit 410c54b

Browse files
authored
Merge branch 'develop' into feat-tx-pool-migrate-setcode-tx-upstream-changes
2 parents 282632f + 12ceada commit 410c54b

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

core/blockchain.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ var (
5353
headHeaderGauge = metrics.NewRegisteredGauge("chain/head/header", nil)
5454
headFastBlockGauge = metrics.NewRegisteredGauge("chain/head/receipt", nil)
5555
headTimeGapGauge = metrics.NewRegisteredGauge("chain/head/timegap", nil)
56+
headL1MessageGauge = metrics.NewRegisteredGauge("chain/head/l1msg", nil)
5657

5758
l2BaseFeeGauge = metrics.NewRegisteredGauge("chain/fees/l2basefee", nil)
5859

@@ -1253,6 +1254,17 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
12531254
l2BaseFeeGauge.Update(0)
12541255
}
12551256

1257+
// Note the latest relayed L1 message queue index (if any)
1258+
for _, tx := range block.Transactions() {
1259+
if msg := tx.AsL1MessageTx(); msg != nil {
1260+
// Queue index is guaranteed to fit into int64.
1261+
headL1MessageGauge.Update(int64(msg.QueueIndex))
1262+
} else {
1263+
// No more L1 messages in this block.
1264+
break
1265+
}
1266+
}
1267+
12561268
parent := bc.GetHeaderByHash(block.ParentHash())
12571269
// block.Time is guaranteed to be larger than parent.Time,
12581270
// and the time gap should fit into int64.

core/state_transition.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,21 @@ func (st *StateTransition) buyGas() error {
269269
}
270270

271271
func (st *StateTransition) preCheck() error {
272+
// Only check transactions that are not fake
273+
if !st.msg.IsFake() {
274+
// Make sure the sender is an EOA
275+
code := st.state.GetCode(st.msg.From())
276+
_, delegated := types.ParseDelegation(code)
277+
if len(code) > 0 && !delegated {
278+
// If the sender on L1 is a (delegated) EOA, then it must be a (delegated) EOA on L2, too.
279+
// If the sender on L1 is a contract, then we apply address aliasing.
280+
// The probability that the aliased address happens to be a smart contract on L2 is negligible.
281+
return fmt.Errorf("%w: address %v, len(code): %d", ErrSenderNoEOA, st.msg.From().Hex(), len(code))
282+
}
283+
}
284+
272285
if st.msg.IsL1MessageTx() {
273-
// No fee fields to check, no nonce to check, and no need to check if EOA (L1 already verified it for us)
286+
// No fee fields to check, no nonce to check
274287
// Gas is free, but no refunds!
275288
st.gas += st.msg.Gas()
276289
st.initialGas = st.msg.Gas()
@@ -291,12 +304,6 @@ func (st *StateTransition) preCheck() error {
291304
return fmt.Errorf("%w: address %v, nonce: %d", ErrNonceMax,
292305
st.msg.From().Hex(), stNonce)
293306
}
294-
// Make sure the sender is an EOA
295-
code := st.state.GetCode(st.msg.From())
296-
_, delegated := types.ParseDelegation(code)
297-
if len(code) > 0 && !delegated {
298-
return fmt.Errorf("%w: address %v, len(code): %d", ErrSenderNoEOA, st.msg.From().Hex(), len(code))
299-
}
300307
}
301308
// Make sure that transaction gasFeeCap is greater than the baseFee (post london)
302309
// Note: Logically, this should be `IsCurie`, but we keep `IsLondon` to ensure backward compatibility.

params/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 5 // Major version component of the current release
2626
VersionMinor = 8 // Minor version component of the current release
27-
VersionPatch = 26 // Patch version component of the current release
27+
VersionPatch = 28 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

0 commit comments

Comments
 (0)