Skip to content

Commit

Permalink
Addressed remaining PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanIliev545 committed Jul 16, 2024
1 parent 922d31d commit aae3128
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 2 additions & 4 deletions go/enclave/rpc/TenStorageRead.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/ethereum/go-ethereum/core/state"
"github.com/ten-protocol/go-ten/go/common/gethencoding"
"github.com/ten-protocol/go-ten/go/common/log"
"github.com/ten-protocol/go-ten/go/common/privacy"
"github.com/ten-protocol/go-ten/go/common/syserr"
gethrpc "github.com/ten-protocol/go-ten/lib/gethfork/rpc"
)
Expand All @@ -20,7 +19,7 @@ type storageReadWithBlock struct {
block *gethrpc.BlockNumberOrHash
}

func TenStorageReadValidate(reqParams []any, builder *CallBuilder[storageReadWithBlock, string], _ *EncryptionManager) error {
func TenStorageReadValidate(reqParams []any, builder *CallBuilder[storageReadWithBlock, string], rpc *EncryptionManager) error {
if len(reqParams) < 2 || len(reqParams) > 3 {
builder.Err = fmt.Errorf("unexpected number of parameters")
return nil
Expand All @@ -39,8 +38,7 @@ func TenStorageReadValidate(reqParams []any, builder *CallBuilder[storageReadWit
}

//todo: @siliev - this whitelist creation every time is bugging me
whitelist := privacy.NewWhitelist()
if !whitelist.AllowedStorageSlots[slot] {
if !rpc.whitelist.AllowedStorageSlots[slot] {
builder.Err = fmt.Errorf("eth_getStorageAt is not supported on TEN")
return nil
}
Expand Down
3 changes: 3 additions & 0 deletions go/enclave/rpc/rpc_encryption_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package rpc
import (
"fmt"

"github.com/ten-protocol/go-ten/go/common/privacy"
"github.com/ten-protocol/go-ten/go/config"
"github.com/ten-protocol/go-ten/go/enclave/gas"

Expand All @@ -29,6 +30,7 @@ type EncryptionManager struct {
l1BlockProcessor components.L1BlockProcessor
config *config.EnclaveConfig
logger gethlog.Logger
whitelist *privacy.Whitelist
}

func NewEncryptionManager(enclavePrivateKeyECIES *ecies.PrivateKey, storage storage.Storage, registry components.BatchRegistry, processors *crosschain.Processors, service nodetype.NodeType, config *config.EnclaveConfig, oracle gas.Oracle, blockResolver storage.BlockResolver, l1BlockProcessor components.L1BlockProcessor, chain l2chain.ObscuroChain, logger gethlog.Logger) *EncryptionManager {
Expand All @@ -44,6 +46,7 @@ func NewEncryptionManager(enclavePrivateKeyECIES *ecies.PrivateKey, storage stor
gasOracle: oracle,
logger: logger,
enclavePrivateKeyECIES: enclavePrivateKeyECIES,
whitelist: privacy.NewWhitelist(),
}
}

Expand Down

0 comments on commit aae3128

Please sign in to comment.