mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
fix(rollup-fee): support set code tx in asUnsignedTx (#1123)
* fix asUnsignedTx * fix goimport * prevent panic
This commit is contained in:
parent
3d3032c0e1
commit
bcfdb48dd9
3 changed files with 29 additions and 2 deletions
|
|
@ -208,6 +208,8 @@ func (l *StructLogger) CaptureStart(env *EVM, from common.Address, to common.Add
|
||||||
// because contract creation is not allowed in set code transactions
|
// because contract creation is not allowed in set code transactions
|
||||||
for _, auth := range authorizationResults {
|
for _, auth := range authorizationResults {
|
||||||
if auth.Success {
|
if auth.Success {
|
||||||
|
// Does not record the createdAccount account yet, since it will change the return value of CreatedAccount,
|
||||||
|
// which is used in assigning the "to" field of transaction in scroll_getBlockTraceByNumberOrHash.
|
||||||
l.statesAffected[auth.Authority] = struct{}{}
|
l.statesAffected[auth.Authority] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 5 // Major version component of the current release
|
VersionMajor = 5 // Major version component of the current release
|
||||||
VersionMinor = 8 // Minor version component of the current release
|
VersionMinor = 8 // Minor version component of the current release
|
||||||
VersionPatch = 12 // Patch version component of the current release
|
VersionPatch = 13 // Patch version component of the current release
|
||||||
VersionMeta = "mainnet" // Version metadata to append to the version string
|
VersionMeta = "mainnet" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
|
"github.com/holiman/uint256"
|
||||||
|
|
||||||
"github.com/scroll-tech/go-ethereum/common"
|
"github.com/scroll-tech/go-ethereum/common"
|
||||||
"github.com/scroll-tech/go-ethereum/core/types"
|
"github.com/scroll-tech/go-ethereum/core/types"
|
||||||
"github.com/scroll-tech/go-ethereum/crypto"
|
"github.com/scroll-tech/go-ethereum/crypto"
|
||||||
|
|
@ -35,6 +37,7 @@ type Message interface {
|
||||||
Data() []byte
|
Data() []byte
|
||||||
AccessList() types.AccessList
|
AccessList() types.AccessList
|
||||||
IsL1MessageTx() bool
|
IsL1MessageTx() bool
|
||||||
|
SetCodeAuthorizations() []types.SetCodeAuthorization
|
||||||
}
|
}
|
||||||
|
|
||||||
// StateDB represents the StateDB interface
|
// StateDB represents the StateDB interface
|
||||||
|
|
@ -92,7 +95,11 @@ func asUnsignedTx(msg Message, baseFee, chainID *big.Int) *types.Transaction {
|
||||||
return asUnsignedAccessListTx(msg, chainID)
|
return asUnsignedAccessListTx(msg, chainID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return asUnsignedDynamicTx(msg, chainID)
|
if msg.SetCodeAuthorizations() == nil {
|
||||||
|
return asUnsignedDynamicTx(msg, chainID)
|
||||||
|
}
|
||||||
|
|
||||||
|
return asUnsignedSetCodeTx(msg, chainID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func asUnsignedLegacyTx(msg Message) *types.Transaction {
|
func asUnsignedLegacyTx(msg Message) *types.Transaction {
|
||||||
|
|
@ -133,6 +140,24 @@ func asUnsignedDynamicTx(msg Message, chainID *big.Int) *types.Transaction {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func asUnsignedSetCodeTx(msg Message, chainID *big.Int) *types.Transaction {
|
||||||
|
tx := types.SetCodeTx{
|
||||||
|
Nonce: msg.Nonce(),
|
||||||
|
Value: uint256.MustFromBig(msg.Value()),
|
||||||
|
Gas: msg.Gas(),
|
||||||
|
GasFeeCap: uint256.MustFromBig(msg.GasFeeCap()),
|
||||||
|
GasTipCap: uint256.MustFromBig(msg.GasTipCap()),
|
||||||
|
Data: msg.Data(),
|
||||||
|
AccessList: msg.AccessList(),
|
||||||
|
AuthList: msg.SetCodeAuthorizations(),
|
||||||
|
ChainID: uint256.MustFromBig(chainID),
|
||||||
|
}
|
||||||
|
if msg.To() != nil {
|
||||||
|
tx.To = *msg.To()
|
||||||
|
}
|
||||||
|
return types.NewTx(&tx)
|
||||||
|
}
|
||||||
|
|
||||||
func readGPOStorageSlots(addr common.Address, state StateDB) gpoState {
|
func readGPOStorageSlots(addr common.Address, state StateDB) gpoState {
|
||||||
var gpoState gpoState
|
var gpoState gpoState
|
||||||
gpoState.l1BaseFee = state.GetState(addr, rcfg.L1BaseFeeSlot).Big()
|
gpoState.l1BaseFee = state.GetState(addr, rcfg.L1BaseFeeSlot).Big()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue