Skip to content

Commit

Permalink
add string decoding/encoding for rawdb.Target
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Aug 12, 2024
1 parent 6976d72 commit c359493
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/rawdb/accessors_state_arbitrum.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package rawdb

import (
"errors"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
Expand All @@ -31,6 +33,20 @@ const (
TargetHost Target = "host"
)

func (t Target) ToString() string {
return string(t)
}

func TargetFromString(str string) (Target, error) {
target := Target(str)
switch target {
case TargetWavm, TargetArm64, TargetAmd64, TargetHost:
return target, nil
default:
return target, errors.New("unsupported target")
}
}

var Targets = []Target{TargetWavm, TargetArm64, TargetAmd64, TargetHost}

func WriteActivation(db ethdb.KeyValueWriter, moduleHash common.Hash, asmMap map[Target][]byte) {
Expand Down

0 comments on commit c359493

Please sign in to comment.