@@ -113,18 +113,12 @@ func NewSimulatedBackendWithConfig(alloc types.GenesisAlloc, config *chain.Confi
113113func NewSimulatedBackend (t * testing.T , alloc types.GenesisAlloc , gasLimit uint64 ) * SimulatedBackend {
114114 b := NewSimulatedBackendWithConfig (alloc , params .TestChainConfig , gasLimit )
115115 t .Cleanup (b .Close )
116- //if b.m.HistoryV3 {
117- // t.Skip("TODO: Fixme")
118- //}
119116 return b
120117}
121118
122119func NewTestSimulatedBackendWithConfig (t * testing.T , alloc types.GenesisAlloc , config * chain.Config , gasLimit uint64 ) * SimulatedBackend {
123120 b := NewSimulatedBackendWithConfig (alloc , config , gasLimit )
124121 t .Cleanup (b .Close )
125- //if b.m.HistoryV3 {
126- // t.Skip("TODO: Fixme")
127- //}
128122 return b
129123}
130124func (b * SimulatedBackend ) DB () kv.RwDB { return b .m .DB }
@@ -179,20 +173,6 @@ func (b *SimulatedBackend) emptyPendingBlock() {
179173 b .pendingReceipts = chain .Receipts [0 ]
180174 b .pendingHeader = chain .Headers [0 ]
181175 b .gasPool = new (core.GasPool ).AddGas (b .pendingHeader .GasLimit )
182- if ethconfig .EnableHistoryV4InTest {
183- panic ("implement domain state reader" )
184- /*
185- agg := db.(*temporal.DB).GetAgg()
186- agg.SetTx(tx)
187-
188- rs := state.NewStateV3("", agg.BufferedDomains())
189- stateWriter = state.NewStateWriterV3(rs)
190- r := state.NewStateReaderV3(rs)
191- r.SetTx(tx)
192- stateReader = r
193- defer agg.StartUnbufferedWrites().FinishWrites()
194- */
195- }
196176 if b .pendingReaderTx != nil {
197177 b .pendingReaderTx .Rollback ()
198178 }
@@ -201,18 +181,21 @@ func (b *SimulatedBackend) emptyPendingBlock() {
201181 panic (err )
202182 }
203183 b .pendingReaderTx = tx
204- b .pendingReader = state .NewPlainStateReader (b .pendingReaderTx )
184+ if ethconfig .EnableHistoryV4InTest {
185+ panic ("implement me" )
186+ //b.pendingReader = state.NewReaderV4(b.pendingReaderTx.(kv.TemporalTx))
187+ } else {
188+ b .pendingReader = state .NewPlainStateReader (b .pendingReaderTx )
189+ }
205190 b .pendingState = state .New (b .pendingReader )
206191}
207192
208193// stateByBlockNumber retrieves a state by a given blocknumber.
209194func (b * SimulatedBackend ) stateByBlockNumber (db kv.Tx , blockNumber * big.Int ) * state.IntraBlockState {
210195 if blockNumber == nil || blockNumber .Cmp (b .pendingBlock .Number ()) == 0 {
211- return state .New (state .NewPlainState (db , b .pendingBlock .NumberU64 ()+ 1 , nil ))
212- //return state.New(b.m.NewHistoryStateReader(b.pendingBlock.NumberU64()+1, db))
196+ return state .New (b .m .NewHistoryStateReader (b .pendingBlock .NumberU64 ()+ 1 , db ))
213197 }
214- return state .New (state .NewPlainState (db , blockNumber .Uint64 ()+ 1 , nil ))
215- //return state.New(b.m.NewHistoryStateReader(blockNumber.Uint64()+1, db))
198+ return state .New (b .m .NewHistoryStateReader (blockNumber .Uint64 ()+ 1 , db ))
216199}
217200
218201// CodeAt returns the code associated with a certain account in the blockchain.
@@ -705,7 +688,8 @@ func (b *SimulatedBackend) callContract(_ context.Context, call ethereum.CallMsg
705688
706689 txContext := core .NewEVMTxContext (msg )
707690 header := block .Header ()
708- evmContext := core .NewEVMBlockContext (header , core .GetHashFn (header , b .getHeader ), b .m .Engine , nil , nil /*excessDataGas*/ )
691+ excessDataGas := header .ParentExcessDataGas (b .getHeader )
692+ evmContext := core .NewEVMBlockContext (header , core .GetHashFn (header , b .getHeader ), b .m .Engine , nil , excessDataGas )
709693 // Create a new environment which holds all relevant information
710694 // about the transaction and calling mechanisms.
711695 vmEnv := vm .NewEVM (evmContext , txContext , statedb , b .m .ChainConfig , vm.Config {})
@@ -738,7 +722,8 @@ func (b *SimulatedBackend) SendTransaction(ctx context.Context, tx types.Transac
738722 & b .pendingHeader .Coinbase , b .gasPool ,
739723 b .pendingState , state .NewNoopWriter (),
740724 b .pendingHeader , tx ,
741- & b .pendingHeader .GasUsed , vm.Config {}); err != nil {
725+ & b .pendingHeader .GasUsed , vm.Config {},
726+ b .pendingHeader .ParentExcessDataGas (b .getHeader )); err != nil {
742727 return err
743728 }
744729 //fmt.Printf("==== Start producing block %d\n", (b.prependBlock.NumberU64() + 1))
@@ -820,6 +805,10 @@ func (m callMsg) Data() []byte { return m.CallMsg.Data }
820805func (m callMsg ) AccessList () types2.AccessList { return m .CallMsg .AccessList }
821806func (m callMsg ) IsFree () bool { return false }
822807
808+ func (m callMsg ) DataGas () uint64 { return params .DataGasPerBlob * uint64 (len (m .CallMsg .DataHashes )) }
809+ func (m callMsg ) MaxFeePerDataGas () * uint256.Int { return m .CallMsg .MaxFeePerDataGas }
810+ func (m callMsg ) DataHashes () []libcommon.Hash { return m .CallMsg .DataHashes }
811+
823812/*
824813// filterBackend implements filters.Backend to support filtering for logs without
825814// taking bloom-bits acceleration structures into account.
0 commit comments