Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kirugan committed Jul 29, 2024
1 parent 6e20a05 commit 9d5c4e9
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 21 deletions.
3 changes: 2 additions & 1 deletion adapters/p2p2core/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func AdaptReceipt(r *spec.Receipt, txHash *felt.Felt) *core.TransactionReceipt {
TransactionHash: txHash,
Reverted: common.RevertReason != nil, // todo is it correct?
RevertReason: common.GetRevertReason(),
TotalGasConsumed: nil, // todo(kirill) set field after spec update
}
}

Expand All @@ -52,7 +53,7 @@ func adaptExecutionResources(er *spec.Receipt_ExecutionResources) *core.Executio
Keccak: uint64(er.GetBuiltins().GetKeccak()),
Poseidon: uint64(er.GetBuiltins().GetPoseidon()),
SegmentArena: 0, // todo(kirill) recheck
// todo(kirill) update spec for 0.13.2
// todo(kirill) set fields after spec update
AddMod: 0,
MulMod: 0,
RangeCheck96: 0,
Expand Down
4 changes: 0 additions & 4 deletions cmd/juno/juno.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const (
callMaxStepsF = "rpc-call-max-steps"
corsEnableF = "rpc-cors-enable"
versionedConstantsFileF = "versioned-constants-file"
vmConcurrencyModeF = "vm-concurrency-mode"

defaultConfig = ""
defaulHost = "localhost"
Expand Down Expand Up @@ -118,7 +117,6 @@ const (
defaultGwTimeout = 5 * time.Second
defaultCorsEnable = false
defaultVersionedConstantsFile = ""
defaultVMConcurrencyModeF = false

configFlagUsage = "The YAML configuration file."
logLevelFlagUsage = "Options: trace, debug, info, warn, error."
Expand Down Expand Up @@ -169,7 +167,6 @@ const (
"The upper limit is 4 million steps, and any higher value will still be capped at 4 million."
corsEnableUsage = "Enable CORS on RPC endpoints"
versionedConstantsFileUsage = "Use custom versioned constants from provided file"
vmConcurrencyModeUsage = "Use concurrent execution in VM"
)

var Version string
Expand Down Expand Up @@ -353,7 +350,6 @@ func NewCmd(config *node.Config, run func(*cobra.Command, []string) error) *cobr
junoCmd.Flags().Duration(gwTimeoutF, defaultGwTimeout, gwTimeoutUsage)
junoCmd.Flags().Bool(corsEnableF, defaultCorsEnable, corsEnableUsage)
junoCmd.Flags().String(versionedConstantsFileF, defaultVersionedConstantsFile, versionedConstantsFileUsage)
junoCmd.Flags().Bool(vmConcurrencyModeF, defaultVMConcurrencyModeF, vmConcurrencyModeUsage)
junoCmd.MarkFlagsMutuallyExclusive(p2pFeederNodeF, p2pPeersF)

junoCmd.AddCommand(GenP2PKeyPair())
Expand Down
7 changes: 1 addition & 6 deletions core/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ type TransactionReceipt struct {
func (r *TransactionReceipt) Hash() (*felt.Felt, error) {
revertReasonHash := &felt.Zero
if r.Reverted {
// todo remove error because it's unneccessary
var err error
revertReasonHash, err = crypto.StarknetKeccak([]byte(r.RevertReason))
if err != nil {
return nil, err
}
revertReasonHash = crypto.StarknetKeccak([]byte(r.RevertReason))
}

var totalGasConsumed GasConsumed
Expand Down
3 changes: 2 additions & 1 deletion core/receipt_pkg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package core

import (
"encoding/binary"
"testing"

"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/juno/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
)

func TestReceiptHash(t *testing.T) {
Expand Down
4 changes: 1 addition & 3 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ type Config struct {

GatewayAPIKey string `mapstructure:"gw-api-key"`
GatewayTimeout time.Duration `mapstructure:"gw-timeout"`

VMConcurrencyMode bool `mapstructure:"vm-concurrency-mode"`
}

type Node struct {
Expand Down Expand Up @@ -174,7 +172,7 @@ func New(cfg *Config, version string) (*Node, error) { //nolint:gocyclo,funlen
services = append(services, synchronizer)
}

throttledVM := NewThrottledVM(vm.New(cfg.VMConcurrencyMode, log), cfg.MaxVMs, int32(cfg.MaxVMQueue))
throttledVM := NewThrottledVM(vm.New(false, log), cfg.MaxVMs, int32(cfg.MaxVMQueue))

var syncReader sync.Reader = &sync.NoopSynchronizer{}
if synchronizer != nil {
Expand Down
6 changes: 0 additions & 6 deletions vm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (
)

func TestV0Call(t *testing.T) {
t.Skip("todo fix")

testDB := pebble.NewMemTest(t)
txn, err := testDB.NewTransaction(true)
require.NoError(t, err)
Expand Down Expand Up @@ -82,8 +80,6 @@ func TestV0Call(t *testing.T) {
}

func TestV1Call(t *testing.T) {
t.Skip("for now")

testDB := pebble.NewMemTest(t)
txn, err := testDB.NewTransaction(true)
require.NoError(t, err)
Expand Down Expand Up @@ -154,8 +150,6 @@ func TestV1Call(t *testing.T) {
}

func TestCall_MaxSteps(t *testing.T) {
t.Skip()

testDB := pebble.NewMemTest(t)
txn, err := testDB.NewTransaction(true)
require.NoError(t, err)
Expand Down

0 comments on commit 9d5c4e9

Please sign in to comment.