diff --git a/cmd/hivechain/generate.go b/cmd/hivechain/generate.go index 6d68680b91..cd0ebf49bd 100644 --- a/cmd/hivechain/generate.go +++ b/cmd/hivechain/generate.go @@ -152,7 +152,7 @@ func (g *generator) importChain(engine consensus.Engine, chain []*types.Block) ( cacheconfig := core.DefaultCacheConfigWithScheme("hash") cacheconfig.Preimages = true vmconfig := vm.Config{EnablePreimageRecording: true} - blockchain, err := core.NewBlockChain(db, cacheconfig, g.genesis, nil, engine, vmconfig, nil, nil) + blockchain, err := core.NewBlockChain(db, cacheconfig, g.genesis, nil, engine, vmconfig, nil) if err != nil { return nil, fmt.Errorf("can't create blockchain: %v", err) } diff --git a/cmd/hivechain/mod.go b/cmd/hivechain/mod.go index d39df135b2..b0e3883614 100644 --- a/cmd/hivechain/mod.go +++ b/cmd/hivechain/mod.go @@ -73,7 +73,7 @@ func (ctx *genBlockContext) TxCreateIntrinsicGas(data []byte) uint64 { isHomestead := genesis.Config.IsHomestead(ctx.block.Number()) isEIP2028 := genesis.Config.IsIstanbul(ctx.block.Number()) isEIP3860 := genesis.Config.IsShanghai(ctx.block.Number(), ctx.block.Timestamp()) - igas, err := core.IntrinsicGas(data, nil, true, isHomestead, isEIP2028, isEIP3860) + igas, err := core.IntrinsicGas(data, nil, nil, true, isHomestead, isEIP2028, isEIP3860) if err != nil { panic(err) } diff --git a/cmd/hivechain/mod_txinvoke.go b/cmd/hivechain/mod_txinvoke.go index fa6c879908..eb0bb8a297 100644 --- a/cmd/hivechain/mod_txinvoke.go +++ b/cmd/hivechain/mod_txinvoke.go @@ -39,6 +39,13 @@ func init() { gasLimit: 100000, } }) + + register("tx-emit-eip7702", func() blockModifier { + return &modInvokeEmit{ + txType: types.SetCodeTxType, + gasLimit: 100000, + } + }) } // modInvokeEmit creates transactions that invoke the 'emit' contract. @@ -152,6 +159,47 @@ func (m *modInvokeEmit) apply(ctx *genBlockContext) bool { Sidecar: sidecar, } + case types.SetCodeTxType: + if !ctx.ChainConfig().IsPrague(ctx.Number(), ctx.Timestamp()) { + return false + } + + auth := &types.Authorization{ + ChainID: big.NewInt(1), + Address: recipient, + Nonce: uint64(1), + V: big.NewInt(1), + R: big.NewInt(1), + S: big.NewInt(1), + } + + signedAuth, err := types.SignAuth(auth, sender.key) + if err != nil { + return false + } + + authList := types.AuthorizationList{signedAuth} + + txdata = &types.SetCodeTx{ + Nonce: ctx.AccountNonce(sender.addr), + GasTipCap: uint256.NewInt(1), + GasFeeCap: uint256.MustFromBig(ctx.TxGasFeeCap()), + Gas: m.gasLimit, + To: recipient, + Value: uint256.NewInt(3), + Data: calldata, + AccessList: types.AccessList{ + { + Address: recipient, + StorageKeys: []common.Hash{{}, datahash}, + }, + }, + AuthList: authList, + V: uint256.NewInt(1), + R: uint256.NewInt(1), + S: uint256.NewInt(1), + } + default: panic(fmt.Errorf("unhandled tx type %d", m.txType)) }