Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kirugan committed Feb 28, 2024
1 parent 327e22b commit 0822cbf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion node/throttled_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ 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) ([]*felt.Felt, error) {
func (tvm *ThrottledVM) Call(callInfo *vm.CallInfo, blockInfo *vm.BlockInfo, state core.StateReader,
network *utils.Network, maxSteps uint64,
) ([]*felt.Felt, error) {
var ret []*felt.Felt
return ret, tvm.Do(func(vm *vm.VM) error {
var err error
Expand Down
16 changes: 9 additions & 7 deletions vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ type BlockInfo struct {
BlockHashToBeRevealed *felt.Felt
}

func copyFeltIntoCArray(felt *felt.Felt, cArrPtr *C.uchar) {
if felt == nil {
func copyFeltIntoCArray(f *felt.Felt, cArrPtr *C.uchar) {
if f == nil {
return
}

feltBytes := felt.Bytes()
feltBytes := f.Bytes()
cArr := unsafe.Slice(cArrPtr, len(feltBytes))
for index := range feltBytes {
cArr[index] = C.uchar(feltBytes[index])
Expand Down Expand Up @@ -191,7 +191,9 @@ func makeCBlockInfo(blockInfo *BlockInfo) C.BlockInfo {
return cBlockInfo
}

func (v *vm) Call(callInfo *CallInfo, blockInfo *BlockInfo, state core.StateReader, network *utils.Network, maxSteps uint64) ([]*felt.Felt, error) {
func (v *vm) Call(callInfo *CallInfo, blockInfo *BlockInfo, state core.StateReader,
network *utils.Network, maxSteps uint64,
) ([]*felt.Felt, error) {
context := &callContext{
state: state,
response: []*felt.Felt{},
Expand All @@ -208,7 +210,7 @@ func (v *vm) Call(callInfo *CallInfo, blockInfo *BlockInfo, state core.StateRead
&cBlockInfo,
C.uintptr_t(handle),
chainID,
C.ulonglong(maxSteps),
C.ulonglong(maxSteps), //nolint:gocritic
)
callInfoPinner.Unpin()
C.free(unsafe.Pointer(chainID))
Expand Down Expand Up @@ -276,7 +278,7 @@ func (v *vm) Execute(txns []core.Transaction, declaredClasses []core.Class, paid
C.uchar(skipChargeFeeByte),
C.uchar(skipValidateByte),
C.uchar(errOnRevertByte),
C.uchar(legacyTraceJSONByte),
C.uchar(legacyTraceJSONByte), //nolint:gocritic
)

C.free(unsafe.Pointer(classesJSONCStr))
Expand Down Expand Up @@ -305,7 +307,7 @@ func (v *vm) Execute(txns []core.Transaction, declaredClasses []core.Class, paid
return context.actualFees, traces, nil
}

func marshalTxnsAndDeclaredClasses(txns []core.Transaction, declaredClasses []core.Class) (json.RawMessage, json.RawMessage, error) {
func marshalTxnsAndDeclaredClasses(txns []core.Transaction, declaredClasses []core.Class) (json.RawMessage, json.RawMessage, error) { //nolint:lll
txnJSONs := []json.RawMessage{}
for _, txn := range txns {
txnJSON, err := marshalTxn(txn)
Expand Down

0 comments on commit 0822cbf

Please sign in to comment.