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

feat: integrate nv18 #5726

Merged
merged 182 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from 180 commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
d8fc21a
feat: integrate nv18 builtin actor
simlecode Dec 12, 2022
49a5e50
chore: update ffi
simlecode Dec 12, 2022
7e55e68
feat: add support for looking up past tipset CIDs
simlecode Dec 12, 2022
30bb2ad
chore: make gen & fix test
simlecode Dec 13, 2022
2b2643c
chore: fix test
simlecode Dec 13, 2022
1c894f3
chore: upgrade lotus
simlecode Dec 13, 2022
40f78d4
feat: implement a few ethereum JSON-RPC API methods
simlecode Dec 13, 2022
a0d7ddf
chore: fix lint
simlecode Dec 13, 2022
f6e9593
feat: ethrpc: implement EthBlock and EthTx structs
simlecode Dec 13, 2022
29666f9
chore: downgraded lotus & make compatible-all
simlecode Dec 14, 2022
972a487
feat: ethrpc: implement call, estimateGas, getTransactionCount
simlecode Dec 14, 2022
7d6fc08
chore: fix test
simlecode Dec 14, 2022
82a5feb
feat: ethrpc: implement eth_sendRawTransaction
simlecode Dec 14, 2022
5ea13f4
chore: fix test
simlecode Dec 15, 2022
630fd63
feat: implement eth_getCode and eth_getStorageAt
simlecode Dec 14, 2022
35813c0
fix: eth/id address conversion
simlecode Dec 14, 2022
baf3c9f
chore: Eth TX Encoding
simlecode Dec 15, 2022
17c33ae
feat: use f4 eth addresses wherever possible
simlecode Dec 15, 2022
d71b12a
chore: make compatible-api
simlecode Dec 15, 2022
f8791de
feat: allow sending from f4 addresses
simlecode Dec 15, 2022
c003a5a
feat: ethrpc: implement eth_feeHistory
simlecode Dec 15, 2022
6e473a2
fix: avoid returning an error when getting embryo state
simlecode Dec 15, 2022
c461334
fix: fix sendRawTransaction, transactionIndex, feeHistory
simlecode Dec 15, 2022
1bcf6d7
fix: fix eth rpc api and types
simlecode Dec 15, 2022
9a417d9
chore: unmarshal return value
simlecode Dec 16, 2022
ed05f57
feat: setup FEVM during genesis: create ETH0 actor
simlecode Dec 16, 2022
83727ec
chore: update deps
simlecode Dec 16, 2022
6d0c97f
chore: generate builtin actors
simlecode Dec 16, 2022
3e85c36
chore: Drop actor keys from chain/actors/manifest.go
simlecode Dec 16, 2022
11317f6
feat: deps: Update FVM3 and actors
simlecode Dec 16, 2022
225fa28
feat: Support creation and signing of Eth keys
simlecode Dec 16, 2022
d65ca13
feat: add evm cmds
simlecode Dec 19, 2022
9696cc3
chore: genarate builtin actors
simlecode Dec 19, 2022
0d92a34
chore: account abstraction
simlecode Dec 19, 2022
b118774
chore: fix test & fix lint
simlecode Dec 19, 2022
0e9c937
feat: integrate fevm events
simlecode Dec 20, 2022
a0452a8
chore: update message receipt cbor
simlecode Dec 21, 2022
d2b18e3
chore: thread epoch timestamp through vmopts
simlecode Dec 21, 2022
ef1a82f
chore: fvmOpt add actor debug param
simlecode Dec 21, 2022
bd0f9f7
chore: update ffi
simlecode Dec 21, 2022
93f470d
chore: generate builtin actors & api docs
simlecode Dec 21, 2022
52f7681
chore: reduce ResolveToKeyAddr implementation
simlecode Dec 21, 2022
2add438
fix: signature validation cache for messages with Delegated signatures
simlecode Dec 21, 2022
ad36d98
feat: Add cli to inspect Eth addresses and simulate calls
simlecode Dec 22, 2022
f2e6f24
chore: simple some functions
simlecode Dec 22, 2022
236ab8e
chore: add cli to generate eth address from code
simlecode Dec 22, 2022
d402c28
fix: only embryos with nonce 0 are valid senders
simlecode Dec 22, 2022
b3af23b
chore: fix EventFilterManager is nil
simlecode Dec 22, 2022
f56ea14
feat: implement nv18 migration
simlecode Dec 23, 2022
7ebe594
chore: make gen
simlecode Dec 23, 2022
4f81dd1
feat: add state replay rpc
simlecode Dec 29, 2022
5398338
feat: add state replay cli
simlecode Dec 29, 2022
71a39c2
feat: add chain get events rpc
simlecode Dec 30, 2022
d3c2948
fix: various Ethereum JSON-RPC API fixes
simlecode Dec 21, 2022
fd1c7d4
chore: recheck eth rpc
simlecode Dec 28, 2022
0e2b46d
chore: make api-gen
simlecode Jan 4, 2023
ab92b09
feat: add wallaby network
simlecode Dec 22, 2022
deac1fe
chore: add actor debugging to config
simlecode Jan 4, 2023
2c78b74
chore: Add new FEVM actors to the registry
simlecode Jan 9, 2023
96fc7ea
chore: rename EthHashFromHex to NewEthHashFromHex
simlecode Jan 9, 2023
9337186
fix: not return manifest cid in StateActorCodeCIDs
simlecode Jan 10, 2023
37d5821
fix: fix tipsetkey UnmarshalCBOR and MarshalCBOR
simlecode Jan 10, 2023
1efc2eb
chore: update cbor for HelloMessage
simlecode Jan 10, 2023
4dad61a
fix: No message found when allowReplaced is false
simlecode Jan 11, 2023
9470855
fix: fix eth rpc
simlecode Jan 11, 2023
50bbff5
chore: update builtin actors
simlecode Jan 11, 2023
d0f8175
feat: add hyperspacenet
simlecode Jan 11, 2023
88d18be
chore: update embryo to placehodler
simlecode Jan 11, 2023
f2820fc
chore: remove unused code from pkg/wallet
simlecode Jan 13, 2023
d66f975
refactor: move KeyInfo from pkg/crypto to pkg/wallet/key
simlecode Jan 13, 2023
031fb3e
chore: not use hard code
simlecode Jan 12, 2023
87a1b09
chore: print Predictable Address in get-actor cli
simlecode Jan 12, 2023
6b4c592
chore: don't export Extern::VerifyBlockSig
simlecode Jan 12, 2023
73b48d4
chore: remove unused message validato
simlecode Jan 13, 2023
7a62f66
chore: remove unused test
simlecode Jan 13, 2023
f910e38
chore: move two commands from chain cli to eth cli
simlecode Jan 13, 2023
a891bcb
chore: fix test
simlecode Jan 16, 2023
edcca00
chore: rename ethCmds to evmCmds
simlecode Jan 16, 2023
796c0d6
fix: use ToFilecoinAddress() to get f4 addr and validate v sig + clea…
simlecode Jan 16, 2023
8b926fb
fix: remove leftover hack
simlecode Jan 16, 2023
f947a60
chore: update ffi
simlecode Jan 16, 2023
cabade7
chore: update go-state-types
simlecode Jan 16, 2023
3e2844f
fix: update evm actor creation for eam refactor
simlecode Jan 16, 2023
1d20a29
fix: delegated signatures: check every field of txs and roundtrip eth…
simlecode Jan 16, 2023
a818c6b
chore: fix test
simlecode Jan 17, 2023
ea32288
chore: fix lint
simlecode Jan 17, 2023
f049353
chore: update wallaby and hyperspace asset
simlecode Jan 17, 2023
1bc21e9
feat: Store mapping of eth transaction hashes to message cids
simlecode Jan 30, 2023
cd8b311
refactor: move venus-shared/internal to venus-shared/actors/types
simlecode Jan 31, 2023
d9c0b94
chore: generate api & actors
simlecode Jan 31, 2023
8d69589
chore: fix lint
simlecode Jan 31, 2023
dda308f
feat: Store tipset key cids in chain store during snapshot import
simlecode Jan 30, 2023
578c351
fix: EthGetLogs filter combinations
simlecode Jan 30, 2023
95c43d6
fix:cli:make the evm invoke command work again
simlecode Jan 30, 2023
a51aab8
refactor: move pkg/messagepool/messagesigner.go to pkg/messagesigner/…
simlecode Jan 30, 2023
7b9deda
fix: msg signing with delegated keys and send cli changes
simlecode Jan 30, 2023
7bbc06e
chore: remove unused code
simlecode Jan 30, 2023
bfdaff6
feat: API for EthGetMessageCidByTransactionHash
simlecode Jan 30, 2023
b786b52
chore: config: Fevm.EnableEthPRC
simlecode Jan 31, 2023
873d0ff
feat: add eth api dummy
simlecode Jan 31, 2023
b6742f7
chore: add SigningBytes to the message
simlecode Jan 31, 2023
9ec1734
docs: add docs for actors/types
simlecode Jan 31, 2023
40cc043
feat: Events API enabled by default if EnableEthRPC is true
simlecode Jan 31, 2023
660e06d
fix: events: put the _signed_ message through the pipeline
simlecode Jan 31, 2023
d65f77c
fix: event filters use cbor encoding internally
simlecode Jan 31, 2023
8aeda3a
fix: EthAPI: Drop hack in GetStorageAt
simlecode Jan 31, 2023
083a84d
fix: EthAPI: Handle EthCall return correctly
simlecode Jan 31, 2023
ecbf42b
feat: minor improvements to Ethereum delegated siggys
simlecode Feb 1, 2023
3e4fbd9
feat: implement web3_clientVersion
simlecode Feb 1, 2023
1e2abbd
chore: fix eth typo
simlecode Feb 1, 2023
739277c
feat: vm: Assert empty object CID when dumping state
simlecode Feb 1, 2023
f2d0c53
chore: update venus-devtool deps & make compatible-all
simlecode Feb 1, 2023
6305da3
fix: Add nv18-actors to CircSupply
simlecode Feb 1, 2023
64fc876
chore: udpate builtin actors
simlecode Feb 1, 2023
f481b63
fix: fix evm cmds
simlecode Feb 1, 2023
8789646
chore: disable wallabynet and hypersapcenet
simlecode Feb 1, 2023
b99530f
chore: update 2k hygge epoch
simlecode Feb 1, 2023
271fa14
chore: update 2k hygge epoch
simlecode Feb 1, 2023
dab612b
fix: don't replace the method in EthSendRawTransaction
simlecode Feb 1, 2023
fd002e3
chore: fix test
simlecode Feb 1, 2023
79e811c
fix: eth: plug sqlite leak
simlecode Feb 2, 2023
a73a578
refactor: Unify EthTx to FilecoinMessage methods v2
simlecode Feb 2, 2023
3806512
feat: rpc: correct eth_subscribe implementation
simlecode Feb 2, 2023
37ccbe7
feat: add full node options
simlecode Feb 3, 2023
ce22dac
feat: ethrpc: Support filtering by address in subscribe
simlecode Feb 3, 2023
4aacc84
chore: update builtin actors
simlecode Feb 6, 2023
c5c007f
feat: evm: align events implementation with FIP-0049 and FIP-0054
simlecode Feb 7, 2023
aaae13a
refactor: rename ResolveToKeyAddress to ResolveToDeterministicAddress
simlecode Feb 7, 2023
50c43e0
feat: compute a better gas limit for recursive external contract calls
simlecode Feb 7, 2023
94cf458
chore: fix test
simlecode Feb 7, 2023
51f2b1c
fix: ethtypes: Correct 'no uncles' hash in NewEthBlock
simlecode Feb 7, 2023
3492d46
fix: fix eth_FeeHistory
simlecode Feb 7, 2023
08b5729
chore: make api-gen
simlecode Feb 8, 2023
481effc
chain: explicitly check that gasLimit is above zero
simlecode Feb 8, 2023
61f15f6
chore: update ffi & make bundle-gen
simlecode Feb 9, 2023
ab210e0
chore: update fvm
simlecode Feb 9, 2023
ca5ab01
chore: update butterfly genesis network version
simlecode Feb 9, 2023
caa3bef
fix: ethrpc: emit correct bloom filters
simlecode Feb 9, 2023
6120f61
chore: make cborgen
simlecode Feb 9, 2023
dcde761
chore: fix lint & test
simlecode Feb 10, 2023
15e7011
chore: generate types from venus-shared/actors/types
simlecode Feb 10, 2023
91115f9
fix: first close eth
simlecode Feb 10, 2023
4146a50
feat: actors: Add bytecode getter
simlecode Feb 10, 2023
9c7192c
chore: update go-jsonrpc
simlecode Feb 10, 2023
512bff5
fix: ethrpc: Don't send sub notifs in array
simlecode Feb 10, 2023
b22149a
chore: add environment variable VENUS_FEVM_ENABLEETHRPC
simlecode Feb 10, 2023
a887af8
feat: cli: allow value send from f4 to any address type
simlecode Feb 10, 2023
7aa454f
feat: eth: populate tx hash database on startup
simlecode Feb 10, 2023
db3ea81
fix: ethrpc: Add missing fields to EthTx
simlecode Feb 13, 2023
2cab066
feat: eth cli: Strip out empty spaces around contract bytes
simlecode Feb 13, 2023
5f54928
fix: chain: make sure the head is empty, not the code
simlecode Feb 13, 2023
0a8b875
chore: make bundle-gen
simlecode Feb 13, 2023
cc1ddc0
chore: udpate deps & make compatible-api
simlecode Feb 13, 2023
792089c
fix: FIP-0055: implement final version of transitory delegated signat…
simlecode Feb 13, 2023
87052a9
chore: fix lint
simlecode Feb 13, 2023
b3ffe1f
chore: update test-vectors
simlecode Feb 13, 2023
20627df
fix: null rounds: pass correct timestamp to the FVM
simlecode Feb 13, 2023
7b994e2
feat: eth: harden event processing
simlecode Feb 13, 2023
ca80374
fix: gas: correct the message inclusion cost in nv18
simlecode Feb 13, 2023
3bf78bd
chore: updates butterflynet reset artifacts
simlecode Feb 13, 2023
b2389c9
fix: eth: correctly handle ethGetCode ege-cases
simlecode Feb 14, 2023
60193f5
refactor: callGas & callWithGas
simlecode Feb 14, 2023
553f959
fix: eth: correctly convert filecoin message <-> eth txn
simlecode Feb 14, 2023
0a63505
feat: support passing uint64 in JSON-RPC arguments for EthUint64
simlecode Feb 14, 2023
c3e1bd0
fix: populate reward in eth_feeHistory
simlecode Feb 14, 2023
dc65ba3
fix: check message validity before invoking vm
simlecode Feb 14, 2023
8898dfa
chore: fix setup system actor
simlecode Feb 14, 2023
8987dfd
chore: update deps
simlecode Feb 14, 2023
9c9715b
chore: add comment
simlecode Feb 15, 2023
f68587c
chore: make bundle-gen
simlecode Feb 15, 2023
c2eed88
revert: check message validity before invoking vm
simlecode Feb 15, 2023
46d93f4
fix: copy the message before modifying it
simlecode Feb 15, 2023
6de92a9
feat: ethrpc: Support newPendingTransactions in eth_subscribe
simlecode Feb 15, 2023
159146b
chore: update go-state-types
simlecode Feb 15, 2023
b3aed9e
chore: remove unused code
simlecode Feb 15, 2023
ee1eb6d
chore: update butterfly asset
simlecode Feb 15, 2023
32796a0
chore: update calib hygge epoch
simlecode Feb 15, 2023
df86543
chore: fix test
simlecode Feb 15, 2023
1aa43d7
chore: update deps & make gen
simlecode Feb 15, 2023
c4233a1
chore: fix typ
simlecode Feb 15, 2023
310628e
chore: sqlite use in-memory databases
simlecode Feb 16, 2023
17da6d3
chore: add comment
simlecode Feb 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bundle-gen:
cd venus-devtool && go run ./bundle-gen/*.go --dst ./../venus-shared/actors/builtin_actors_gen.go

state-type-gen:
cd venus-devtool && go run ./state-type-gen/*.go --dst ./../venus-shared/types/state_types_gen.go
cd venus-devtool && go run ./state-type-gen/*.go --dst ./../venus-shared/types

api-gen:
find ./venus-shared/api/ -name 'client_gen.go' -delete
Expand Down
10 changes: 10 additions & 0 deletions app/node/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/filecoin-project/venus-auth/jwtclient"
"github.com/filecoin-project/venus/app/submodule/dagservice"
"github.com/filecoin-project/venus/app/submodule/eth"
"github.com/filecoin-project/venus/app/submodule/network"

logging "github.com/ipfs/go-log"
Expand Down Expand Up @@ -165,6 +166,14 @@ func (b *Builder) build(ctx context.Context) (*Node, error) {
blockDelay := b.repo.Config().NetworkParams.BlockDelay
nd.common = common.NewCommonModule(nd.chain, nd.network, blockDelay)

sqlitePath, err := b.repo.SqlitePath()
if err != nil {
return nil, err
}
if nd.eth, err = eth.NewEthSubModule(ctx, b.repo.Config(), nd.chain, nd.mpool, sqlitePath); err != nil {
return nil, err
}

apiBuilder := NewBuilder()
apiBuilder.NameSpace("Filecoin")

Expand All @@ -181,6 +190,7 @@ func (b *Builder) build(ctx context.Context) (*Node, error) {
nd.paychan,
nd.market,
nd.common,
nd.eth,
)

if err != nil {
Expand Down
1 change: 1 addition & 0 deletions app/node/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Env struct {
MarketAPI v1api.IMarket
PaychAPI v1api.IPaychan
CommonAPI v1api.ICommon
EthAPI v1api.IETH
}

var _ cmds.Environment = (*Env)(nil)
Expand Down
6 changes: 3 additions & 3 deletions app/node/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"context"

"github.com/filecoin-project/venus/pkg/repo/fskeystore"
"github.com/filecoin-project/venus/pkg/wallet/key"

cbor "github.com/ipfs/go-ipld-cbor"
acrypto "github.com/libp2p/go-libp2p/core/crypto"
"github.com/pkg/errors"

"github.com/filecoin-project/venus/pkg/crypto"
"github.com/filecoin-project/venus/pkg/genesis"
"github.com/filecoin-project/venus/pkg/repo"
)
Expand All @@ -18,14 +18,14 @@ const defaultPeerKeyBits = 2048

// initCfg contains configuration for initializing a node's repo.
type initCfg struct {
initImports []*crypto.KeyInfo
initImports []*key.KeyInfo
}

// InitOpt is an option for initialization of a node's repo.
type InitOpt func(*initCfg)

// ImportKeyOpt imports the provided key during initialization.
func ImportKeyOpt(ki *crypto.KeyInfo) InitOpt {
func ImportKeyOpt(ki *key.KeyInfo) InitOpt {
return func(opts *initCfg) {
opts.initImports = append(opts.initImports, ki)
}
Expand Down
19 changes: 17 additions & 2 deletions app/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/filecoin-project/venus/app/submodule/common"
configModule "github.com/filecoin-project/venus/app/submodule/config"
"github.com/filecoin-project/venus/app/submodule/dagservice"
"github.com/filecoin-project/venus/app/submodule/eth"
"github.com/filecoin-project/venus/app/submodule/market"
"github.com/filecoin-project/venus/app/submodule/mining"
"github.com/filecoin-project/venus/app/submodule/mpool"
Expand All @@ -30,8 +31,9 @@ import (
"github.com/filecoin-project/venus/pkg/chain"
"github.com/filecoin-project/venus/pkg/clock"
"github.com/filecoin-project/venus/pkg/config"
_ "github.com/filecoin-project/venus/pkg/crypto/bls" // enable bls signatures
_ "github.com/filecoin-project/venus/pkg/crypto/secp" // enable secp signatures
_ "github.com/filecoin-project/venus/pkg/crypto/bls" // enable bls signatures
_ "github.com/filecoin-project/venus/pkg/crypto/delegated" // enable delegated signatures
_ "github.com/filecoin-project/venus/pkg/crypto/secp" // enable secp signatures
"github.com/filecoin-project/venus/pkg/metrics"
"github.com/filecoin-project/venus/pkg/repo"
cmds "github.com/ipfs/go-ipfs-cmds"
Expand Down Expand Up @@ -95,6 +97,8 @@ type Node struct {

common *common.CommonModule

eth *eth.EthSubModule

//
// Jsonrpc
//
Expand Down Expand Up @@ -190,11 +194,21 @@ func (node *Node) Start(ctx context.Context) error {
return err
}

if err := node.eth.Start(ctx); err != nil {
return fmt.Errorf("failed to start eth module %v", err)
}

return nil
}

// Stop initiates the shutdown of the node.
func (node *Node) Stop(ctx context.Context) {
// stop eth submodule
log.Infof("closing eth ...")
if err := node.eth.Close(ctx); err != nil {
log.Warnf("error closing eth: %s", err)
}

// stop mpool submodule
log.Infof("shutting down mpool...")
node.mpool.Stop(ctx)
Expand Down Expand Up @@ -358,6 +372,7 @@ func (node *Node) createServerEnv(ctx context.Context) *Env {
MarketAPI: node.market.API(),
MultiSigAPI: &apiwrapper.WrapperV1IMultiSig{IMultiSig: node.multiSig.API(), IMessagePool: node.mpool.API()},
CommonAPI: node.common,
EthAPI: node.eth.API(),
}

return &env
Expand Down
87 changes: 77 additions & 10 deletions app/node/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"reflect"

"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/venus/app/submodule/eth"
v0api "github.com/filecoin-project/venus/venus-shared/api/chain/v0"
v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1"
"github.com/filecoin-project/venus/venus-shared/api/permission"
Expand Down Expand Up @@ -38,17 +39,29 @@ func (builder *RPCBuilder) AddServices(services ...RPCService) error {
return nil
}

func (builder *RPCBuilder) AddService(service RPCService) error {
methodName := "V0API"
var ethSubModuleTyp = reflect.TypeOf(&eth.EthSubModule{}).Elem()

func skipV0API(in interface{}) bool {
inT := reflect.TypeOf(in)
if inT.Kind() == reflect.Pointer {
inT = inT.Elem()
}

return inT.AssignableTo(ethSubModuleTyp)
}

func (builder *RPCBuilder) AddV0API(service RPCService) error {
methodName := "V0API"
serviceV := reflect.ValueOf(service)
apiMethod := serviceV.MethodByName(methodName)
if !apiMethod.IsValid() {
return errors.New("expect API function")
if skipV0API(service) {
return nil
}
return errors.New("expect V0API function")
}

apiImpls := apiMethod.Call([]reflect.Value{})

for _, apiImpl := range apiImpls {
rt := reflect.TypeOf(apiImpl)
rv := reflect.ValueOf(apiImpl)
Expand All @@ -65,15 +78,18 @@ func (builder *RPCBuilder) AddService(service RPCService) error {
}
}

methodName = "API"
serviceV = reflect.ValueOf(service)
apiMethod = serviceV.MethodByName(methodName)
return nil
}

func (builder *RPCBuilder) AddAPI(service RPCService) error {
methodName := "API"
serviceV := reflect.ValueOf(service)
apiMethod := serviceV.MethodByName(methodName)
if !apiMethod.IsValid() {
return errors.New("expect API function")
}

apiImpls = apiMethod.Call([]reflect.Value{})

apiImpls := apiMethod.Call([]reflect.Value{})
for _, apiImpl := range apiImpls {
rt := reflect.TypeOf(apiImpl)
rv := reflect.ValueOf(apiImpl)
Expand All @@ -92,13 +108,24 @@ func (builder *RPCBuilder) AddService(service RPCService) error {
return nil
}

func (builder *RPCBuilder) AddService(service RPCService) error {
err := builder.AddV0API(service)
if err != nil {
return err
}

return builder.AddAPI(service)
}

func (builder *RPCBuilder) Build(version string, limiter *ratelimit.RateLimiter) *jsonrpc.RPCServer {
var server *jsonrpc.RPCServer
serverOptions := make([]jsonrpc.ServerOption, 0)
serverOptions = append(serverOptions, jsonrpc.WithProxyBind(jsonrpc.PBMethod))

server := jsonrpc.NewServer(serverOptions...)
switch version {
case "v0":
server = jsonrpc.NewServer(serverOptions...)

var fullNodeV0 v0api.FullNodeStruct
for _, apiStruct := range builder.v0APIStruct {
permission.PermissionProxy(apiStruct, &fullNodeV0)
Expand All @@ -114,6 +141,9 @@ func (builder *RPCBuilder) Build(version string, limiter *ratelimit.RateLimiter)
server.Register(nameSpace, &fullNodeV0)
}
case "v1":
serverOptions = append(serverOptions, jsonrpc.WithReverseClient[v1api.EthSubscriberMethods](v1api.MethodNamespace))
server = jsonrpc.NewServer(serverOptions...)

var fullNode v1api.FullNodeStruct
for _, apiStruct := range builder.v1APIStruct {
permission.PermissionProxy(apiStruct, &fullNode)
Expand All @@ -131,6 +161,43 @@ func (builder *RPCBuilder) Build(version string, limiter *ratelimit.RateLimiter)
default:
panic("invalid version: " + version)
}
aliasETHAPI(server)

return server
}

func aliasETHAPI(rpcServer *jsonrpc.RPCServer) {
// TODO: use reflect to automatically register all the eth aliases
rpcServer.AliasMethod("eth_accounts", "Filecoin.EthAccounts")
rpcServer.AliasMethod("eth_blockNumber", "Filecoin.EthBlockNumber")
rpcServer.AliasMethod("eth_getBlockTransactionCountByNumber", "Filecoin.EthGetBlockTransactionCountByNumber")
rpcServer.AliasMethod("eth_getBlockTransactionCountByHash", "Filecoin.EthGetBlockTransactionCountByHash")

rpcServer.AliasMethod("eth_getBlockByHash", "Filecoin.EthGetBlockByHash")
rpcServer.AliasMethod("eth_getBlockByNumber", "Filecoin.EthGetBlockByNumber")
rpcServer.AliasMethod("eth_getTransactionByHash", "Filecoin.EthGetTransactionByHash")
rpcServer.AliasMethod("eth_getTransactionHashByCid", "Filecoin.EthGetTransactionHashByCid")
rpcServer.AliasMethod("eth_getMessageCidByTransactionHash", "Filecoin.EthGetMessageCidByTransactionHash")
rpcServer.AliasMethod("eth_getTransactionCount", "Filecoin.EthGetTransactionCount")
rpcServer.AliasMethod("eth_getTransactionReceipt", "Filecoin.EthGetTransactionReceipt")
rpcServer.AliasMethod("eth_getTransactionByBlockHashAndIndex", "Filecoin.EthGetTransactionByBlockHashAndIndex")
rpcServer.AliasMethod("eth_getTransactionByBlockNumberAndIndex", "Filecoin.EthGetTransactionByBlockNumberAndIndex")

rpcServer.AliasMethod("eth_getCode", "Filecoin.EthGetCode")
rpcServer.AliasMethod("eth_getStorageAt", "Filecoin.EthGetStorageAt")
rpcServer.AliasMethod("eth_getBalance", "Filecoin.EthGetBalance")
rpcServer.AliasMethod("eth_chainId", "Filecoin.EthChainId")
rpcServer.AliasMethod("eth_feeHistory", "Filecoin.EthFeeHistory")
rpcServer.AliasMethod("eth_protocolVersion", "Filecoin.EthProtocolVersion")
rpcServer.AliasMethod("eth_maxPriorityFeePerGas", "Filecoin.EthMaxPriorityFeePerGas")
rpcServer.AliasMethod("eth_gasPrice", "Filecoin.EthGasPrice")
rpcServer.AliasMethod("eth_sendRawTransaction", "Filecoin.EthSendRawTransaction")

rpcServer.AliasMethod("net_version", "Filecoin.NetVersion")
rpcServer.AliasMethod("net_listening", "Filecoin.NetListening")

rpcServer.AliasMethod("web3_clientVersion", "Filecoin.Web3ClientVersion")

rpcServer.AliasMethod("eth_estimateGas", "Filecoin.EthEstimateGas")
rpcServer.AliasMethod("eth_call", "Filecoin.EthCall")
}
4 changes: 1 addition & 3 deletions app/node/test/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"context"
"testing"

"github.com/filecoin-project/venus/pkg/wallet"

"github.com/stretchr/testify/require"

"github.com/filecoin-project/venus/app/node"
Expand Down Expand Up @@ -52,7 +50,7 @@ func NewNodeBuilder(tb testing.TB) *NodeBuilder {
}),
},
builderOpts: []node.BuilderOpt{
node.SetWalletPassword(wallet.TestPassword),
node.SetWalletPassword([]byte("test-password")),
},
tb: tb,
}
Expand Down
2 changes: 1 addition & 1 deletion app/submodule/chain/account_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ func (accountAPI *accountAPI) StateAccountKey(ctx context.Context, addr address.
if err != nil {
return address.Undef, fmt.Errorf("loading tipset %s: %w", tsk, err)
}
return accountAPI.chain.Stmgr.ResolveToKeyAddress(ctx, addr, ts)
return accountAPI.chain.Stmgr.ResolveToDeterministicAddress(ctx, addr, ts)
}
2 changes: 1 addition & 1 deletion app/submodule/chain/chain_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func NewChainSubmodule(ctx context.Context,
}
faultChecker := consensusfault.NewFaultChecker(chainStore, fork)
syscalls := vmsupport.NewSyscalls(faultChecker, config.Verifier())
processor := consensus.NewDefaultProcessor(syscalls, circulatiingSupplyCalculator)
processor := consensus.NewDefaultProcessor(syscalls, circulatiingSupplyCalculator, chainStore, config.Repo().Config().NetworkParams)

waiter := chain.NewWaiter(chainStore, messageStore, config.Repo().Datastore(), cbor.NewCborStore(config.Repo().Datastore()))

Expand Down
Loading