Skip to content

Commit

Permalink
Remove useBlobData parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kirugan authored and derrix060 committed Oct 21, 2024
1 parent 2614b70 commit 121965f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 22 deletions.
9 changes: 4 additions & 5 deletions node/throttled_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ func NewThrottledVM(res vm.VM, concurrenyBudget uint, maxQueueLen int32) *Thrott
}

func (tvm *ThrottledVM) Call(callInfo *vm.CallInfo, blockInfo *vm.BlockInfo, state core.StateReader,
network *utils.Network, maxSteps uint64, useBlobData bool,
network *utils.Network, maxSteps uint64,
) ([]*felt.Felt, error) {
var ret []*felt.Felt
return ret, tvm.Do(func(vm *vm.VM) error {
var err error
ret, err = (*vm).Call(callInfo, blockInfo, state, network, maxSteps, useBlobData)
ret, err = (*vm).Call(callInfo, blockInfo, state, network, maxSteps)
return err
})
}

func (tvm *ThrottledVM) Execute(txns []core.Transaction, declaredClasses []core.Class, paidFeesOnL1 []*felt.Felt,
blockInfo *vm.BlockInfo, state core.StateReader, network *utils.Network, skipChargeFee, skipValidate, errOnRevert,
useBlobData bool,
blockInfo *vm.BlockInfo, state core.StateReader, network *utils.Network, skipChargeFee, skipValidate, errOnRevert bool,
) ([]*felt.Felt, []core.GasConsumed, []vm.TransactionTrace, uint64, error) {
var ret []*felt.Felt
var traces []vm.TransactionTrace
Expand All @@ -41,7 +40,7 @@ func (tvm *ThrottledVM) Execute(txns []core.Transaction, declaredClasses []core.
return ret, daGas, traces, numSteps, tvm.Do(func(vm *vm.VM) error {
var err error
ret, daGas, traces, numSteps, err = (*vm).Execute(txns, declaredClasses, paidFeesOnL1, blockInfo, state, network,
skipChargeFee, skipValidate, errOnRevert, useBlobData)
skipChargeFee, skipValidate, errOnRevert)
return err
})
}
3 changes: 1 addition & 2 deletions rpc/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ func (h *Handler) simulateTransactions(id BlockID, transactions []BroadcastedTra
Header: header,
BlockHashToBeRevealed: blockHashToBeRevealed,
}
useBlobData := true
overallFees, daGas, traces, numSteps, err := h.vm.Execute(txns, classes, paidFeesOnL1, &blockInfo,
state, h.bcReader.Network(), skipFeeCharge, skipValidate, errOnRevert, useBlobData)
state, h.bcReader.Network(), skipFeeCharge, skipValidate, errOnRevert)

httpHeader.Set(ExecutionStepsHeader, strconv.FormatUint(numSteps, 10))

Expand Down
5 changes: 2 additions & 3 deletions rpc/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,8 @@ func (h *Handler) traceBlockTransactions(ctx context.Context, block *core.Block)
BlockHashToBeRevealed: blockHashToBeRevealed,
}

useBlobData := true
_, daGas, traces, numSteps, err := h.vm.Execute(block.Transactions, classes, paidFeesOnL1,
&blockInfo, state, network, false, false, false, useBlobData)
&blockInfo, state, network, false, false, false)

httpHeader.Set(ExecutionStepsHeader, strconv.FormatUint(numSteps, 10))

Expand Down Expand Up @@ -379,7 +378,7 @@ func (h *Handler) Call(funcCall FunctionCall, id BlockID) ([]*felt.Felt, *jsonrp
}, &vm.BlockInfo{
Header: header,
BlockHashToBeRevealed: blockHashToBeRevealed,
}, state, h.bcReader.Network(), h.callMaxSteps, true)
}, state, h.bcReader.Network(), h.callMaxSteps)
if err != nil {
if errors.Is(err, utils.ErrResourceBusy) {
return nil, ErrInternal.CloneWithData(throttledVMErr)
Expand Down
20 changes: 8 additions & 12 deletions vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ import (
//go:generate mockgen -destination=../mocks/mock_vm.go -package=mocks github.com/NethermindEth/juno/vm VM
type VM interface {
Call(callInfo *CallInfo, blockInfo *BlockInfo, state core.StateReader, network *utils.Network,
maxSteps uint64, useBlobData bool) ([]*felt.Felt, error)
maxSteps uint64) ([]*felt.Felt, error)
Execute(txns []core.Transaction, declaredClasses []core.Class, paidFeesOnL1 []*felt.Felt, blockInfo *BlockInfo,
state core.StateReader, network *utils.Network, skipChargeFee, skipValidate, errOnRevert, useBlobData bool,
state core.StateReader, network *utils.Network, skipChargeFee, skipValidate, errOnRevert bool,
) ([]*felt.Felt, []core.GasConsumed, []TransactionTrace, uint64, error)
}

Expand Down Expand Up @@ -200,7 +200,7 @@ func makeCCallInfo(callInfo *CallInfo) (C.CallInfo, runtime.Pinner) {
return cCallInfo, pinner
}

func makeCBlockInfo(blockInfo *BlockInfo, useBlobData bool) C.BlockInfo {
func makeCBlockInfo(blockInfo *BlockInfo) C.BlockInfo {
var cBlockInfo C.BlockInfo

cBlockInfo.block_number = C.ulonglong(blockInfo.Header.Number)
Expand All @@ -213,17 +213,13 @@ func makeCBlockInfo(blockInfo *BlockInfo, useBlobData bool) C.BlockInfo {
if blockInfo.Header.L1DAMode == core.Blob {
copyFeltIntoCArray(blockInfo.Header.L1DataGasPrice.PriceInWei, &cBlockInfo.data_gas_price_wei[0])
copyFeltIntoCArray(blockInfo.Header.L1DataGasPrice.PriceInFri, &cBlockInfo.data_gas_price_fri[0])
if useBlobData {
cBlockInfo.use_blob_data = 1
} else {
cBlockInfo.use_blob_data = 0
}
cBlockInfo.use_blob_data = 1
}
return cBlockInfo
}

func (v *vm) Call(callInfo *CallInfo, blockInfo *BlockInfo, state core.StateReader,
network *utils.Network, maxSteps uint64, useBlobData bool,
network *utils.Network, maxSteps uint64,
) ([]*felt.Felt, error) {
context := &callContext{
state: state,
Expand All @@ -240,7 +236,7 @@ func (v *vm) Call(callInfo *CallInfo, blockInfo *BlockInfo, state core.StateRead
C.setVersionedConstants(C.CString("my_json"))

cCallInfo, callInfoPinner := makeCCallInfo(callInfo)
cBlockInfo := makeCBlockInfo(blockInfo, useBlobData)
cBlockInfo := makeCBlockInfo(blockInfo)
chainID := C.CString(network.L2ChainID)
C.cairoVMCall(
&cCallInfo,
Expand All @@ -263,7 +259,7 @@ func (v *vm) Call(callInfo *CallInfo, blockInfo *BlockInfo, state core.StateRead
// Execute executes a given transaction set and returns the gas spent per transaction
func (v *vm) Execute(txns []core.Transaction, declaredClasses []core.Class, paidFeesOnL1 []*felt.Felt,
blockInfo *BlockInfo, state core.StateReader, network *utils.Network,
skipChargeFee, skipValidate, errOnRevert, useBlobData bool,
skipChargeFee, skipValidate, errOnRevert bool,
) ([]*felt.Felt, []core.GasConsumed, []TransactionTrace, uint64, error) {
context := &callContext{
state: state,
Expand Down Expand Up @@ -306,7 +302,7 @@ func (v *vm) Execute(txns []core.Transaction, declaredClasses []core.Class, paid
concurrencyModeByte = 1
}

cBlockInfo := makeCBlockInfo(blockInfo, useBlobData)
cBlockInfo := makeCBlockInfo(blockInfo)
chainID := C.CString(network.L2ChainID)
C.cairoVMExecute(txnsJSONCstr,
classesJSONCStr,
Expand Down

0 comments on commit 121965f

Please sign in to comment.