Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move config type to client #701

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.8

require (
github.com/VictoriaMetrics/fastcache v1.12.1
github.com/ava-labs/avalanchego v1.12.1-0.20241209214115-1dc4192013aa
github.com/ava-labs/avalanchego v1.12.1-0.20241211144846-f3ca1a0f8bb1
github.com/cespare/cp v0.1.0
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233
github.com/davecgh/go-spew v1.1.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/avalanchego v1.12.1-0.20241209214115-1dc4192013aa h1:8eSy+tegp9Kq2zft54wk0FyWU87utdrVwsj9EBIb/NA=
github.com/ava-labs/avalanchego v1.12.1-0.20241209214115-1dc4192013aa/go.mod h1:256D2s2FIKo07uUeY25uDXFuqBo6TeWIJqeEA+Xchwk=
github.com/ava-labs/avalanchego v1.12.1-0.20241211144846-f3ca1a0f8bb1 h1:3Zqc3TxHt6gsdSFD/diW2f2jT2oCx0rppN7yoXxviQg=
github.com/ava-labs/avalanchego v1.12.1-0.20241211144846-f3ca1a0f8bb1/go.mod h1:Wxl57pLTlR/8pkaNtou8HiynG+xdgiF4YnzFuJyqSDg=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand Down
15 changes: 4 additions & 11 deletions plugin/evm/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/ava-labs/avalanchego/api"
"github.com/ava-labs/avalanchego/utils/profiler"
"github.com/ava-labs/coreth/plugin/evm/client"
"github.com/ethereum/go-ethereum/log"
)

Expand Down Expand Up @@ -65,11 +66,7 @@ func (p *Admin) LockProfile(_ *http.Request, _ *struct{}, _ *api.EmptyReply) err
return p.profiler.LockProfile()
}

type SetLogLevelArgs struct {
Level string `json:"level"`
}

func (p *Admin) SetLogLevel(_ *http.Request, args *SetLogLevelArgs, reply *api.EmptyReply) error {
func (p *Admin) SetLogLevel(_ *http.Request, args *client.SetLogLevelArgs, reply *api.EmptyReply) error {
log.Info("EVM: SetLogLevel called", "logLevel", args.Level)

p.vm.ctx.Lock.Lock()
Expand All @@ -81,11 +78,7 @@ func (p *Admin) SetLogLevel(_ *http.Request, args *SetLogLevelArgs, reply *api.E
return nil
}

type ConfigReply struct {
Config *Config `json:"config"`
}

func (p *Admin) GetVMConfig(_ *http.Request, _ *struct{}, reply *ConfigReply) error {
reply.Config = &p.vm.config
func (p *Admin) GetVMConfig(_ *http.Request, _ *struct{}, reply *client.ConfigReply) error {
reply.Config = (*client.Config)(&p.vm.config)
return nil
}
15 changes: 11 additions & 4 deletions plugin/evm/codec.go → plugin/evm/atomic/codec.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// (c) 2019-2021, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package evm
package atomic

import (
"errors"
"fmt"

"github.com/ava-labs/avalanchego/codec"
Expand All @@ -12,8 +13,14 @@ import (
"github.com/ava-labs/avalanchego/vms/secp256k1fx"
)

// Codec does serialization and deserialization
var Codec codec.Manager
const CodecVersion = uint16(0)

var (
// Codec does serialization and deserialization
Codec codec.Manager

errMissingAtomicTxs = errors.New("cannot build a block with non-empty extra data and zero atomic transactions")
)

func init() {
Codec = codec.NewDefaultManager()
Expand All @@ -35,7 +42,7 @@ func init() {
lc.RegisterType(&secp256k1fx.Credential{}),
lc.RegisterType(&secp256k1fx.Input{}),
lc.RegisterType(&secp256k1fx.OutputOwners{}),
Codec.RegisterCodec(codecVersion, lc),
Codec.RegisterCodec(CodecVersion, lc),
)
if errs.Errored() {
panic(errs.Err)
Expand Down
Loading
Loading