Skip to content

Commit

Permalink
Merge pull request filecoin-project#10308 from filecoin-project/asr/m…
Browse files Browse the repository at this point in the history
…erge-release-into-master

chore: merge release/v1.20.0 into master
  • Loading branch information
magik6k committed Feb 20, 2023
2 parents e51f3e9 + 984b4c7 commit 3841e54
Show file tree
Hide file tree
Showing 51 changed files with 609 additions and 155 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,12 @@ workflows:
- build
suite: itest-eth_account_abstraction
target: "./itests/eth_account_abstraction_test.go"
- test:
name: test-itest-eth_api
requires:
- build
suite: itest-eth_api
target: "./itests/eth_api_test.go"
- test:
name: test-itest-eth_balance
requires:
Expand Down
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
# Lotus changelog

# 1.20.0-rc1 / 2023-02-14

This is the first release candidate for the upcoming MANDATORY 1.20.0 release of Lotus. This release will deliver the Hygge network upgrade, introducing Filecoin network version 18. The centerpiece of the upgrade is the introduction of the [Filecoin Virtual Machine (FVM)’s Milestone 2.1](https://fvm.filecoin.io/), which will allow for EVM-compatible contracts to be deployed on the Filecoin network. This upgrade delivers user-programmablity to the Filecoin network for the first time!

Note that this release candidate does NOT set the epoch at which mainnet will upgrade; that detail will be finalized in the 1.20.0 release.

The Hygge upgrade introduces the following Filecoin Improvement Proposals (FIPs), delivered in FVM3 (see FVM [v3.0.0-rc.1](https://github.com/filecoin-project/ref-fvm/pull/1664)) and builtin-actors v10 (see actors [v1.10.0-rc.1](https://github.com/filecoin-project/builtin-actors/releases/tag/v10.0.0-rc.1)):

- [FIP-0048](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0048.md): f4 Address Class
- [FIP-0049](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0049.md): Actor events
- [FIP-0050](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0050.md): API between user-programmed actors and built-in actors
- [FIP-0054](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0054.md): Filecoin EVM runtime (FEVM)
- [FIP-0055](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0055.md): Supporting Ethereum Accounts, Addresses, and Transactions
- [FIP-0057](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0057.md): Update gas charging schedule and system limits for FEVM

## Filecoin Ethereum Virtual Machine (FEVM)

The Filecoin Ethereum Virtual Machine (FEVM) is built on top of the WASM-based execution environment introduced in the Skyr v16 upgrade. The chief feature introduced is the ability for anyone participating in the Filecoin network to deploy their own EVM-compatible contracts onto the blockchain, and invoke them as appropriate.

## New Built-in Actors

The FEVM is principally delivered through the introduction of **the new [EVM actor](https://github.com/filecoin-project/builtin-actors/tree/master/actors/evm)**. This actor “represents” smart contracts on the Filecoin network, and includes an interpreter that implements all EVM opcodes as their Filecoin equivalents, and translates state I/O operations to be compatible with Filecoin’s IPLD-based data model. For more on the EVM actors, please see [FIP-0054](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0054.md).

The creation of EVM actors is managed by **the new** [Ethereum Address Manager actor (EAM)](https://github.com/filecoin-project/builtin-actors/tree/master/actors/eam), a singleton that is invoked in order to deploy EVM actors. In order to make usage of the FEVM as seamless as possible for users familiar with the Ethereum ecosystem, this upgrades also introduces **a dedicated actor to serve as “[Ethereum Accounts](https://github.com/filecoin-project/builtin-actors/tree/master/actors/ethaccount)**. This actor exists to allow for secp keys to be used in the Ethereum addressing scheme. **The last new built-in actor introduced is [the Placeholder actor](https://github.com/filecoin-project/builtin-actors/tree/master/actors/placeholder)**, a thin “shell” of an actor that can transform into either EVM or EthAccount actors. For more on the EAM, EthAccount, and Placeholder actors, please see [FIP-0055](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0055.md).

## Calibration nv18 Hygge Upgrade

This release candidate sets the calibration-net nv18 Hygge upgrade at epoch 322354, 22023-02-21T16:30:00Z. The bundle the network will be using is [v10.0.0 actors](https://github.com/filecoin-project/builtin-actors/releases/tag/v10.0.0-rc.1)
(located at `build/actors/v10.tar.zst`) upon/post migration, manifest CID `bafy2bzaced25ta3j6ygs34roprilbtb3f6mxifyfnm7z7ndquaruxzdq3y7lo`.

## Node Operators

FVM has been running in lotus since v1.16.0 and up, and the new FEVM does not increase any node hardware spec requirement.

With FEVM on Filecoin, we aim to provide full compatibility with the existing EVM ecosystem and its tooling out of box and thus, lotus now provides a full set of [Ethereum-styled APIs](https://github.com/filecoin-project/lotus/blob/release/v1.20.0/node/impl/full/eth.go) for developers and token holders to interact with the Filecoin network as well.

**Enable Ethereum JSON RPC API**

Note that Ethereum APIs are only supported in the lotus v1 API, meaning that any node operator who wants to enable Eth API services must be using the v1 API, instead of the v0 API. To enable Eth RPC, simply set `EnableEthRPC` to `true` in your node config.toml file; or set env var `LOTUS_FEVM_ENABLEETHRPC` to `1` before starting your lotus node.

**Eth tx hash and Filecoin message CID**

Most of the Eth APIs take Eth accounts and tx has as an input, and they start with `0x` , and that is what Ethereum tooling support. However, in Filecoin, we have Filecoin account formats where things start with `f` (`f410` specifically for eth accounts on Filecoin) and the messages are in the format of CIDs. To enable a smooth developer experience, Lotus internally converts between Ethereum address and Filecoin account address as needed. In addition, lotus also keeps a Eth tx hash <> Filecoin message CID map and stores them in a SQLite database as node sees a FEVM messages. The database is initiated and the maps are populated automatically in `~/<lotus_repo>/sqlite/txhash.db` for any node that as Eth RPC enabled. Node operators can configure how many historical mappings they wanna store by configuring `EthTxHashMappingLifetimeDays` .

**Events***

[FIP-0049 introduces actor events](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0049.md) that can be emitted and externally observable during message execution. An `events.db` is created automatically under `~/<lotus_repo>/sqlite` to store these events if the node has Eth RPC enabled. Node operators can configure the events support base on their needs by configuration `Events` configurations.

Note: All three features are new and we welcome user feedbacks, create an issue if you have any enhancements that you’d like to see!

# 1.19.0 / 2022-12-07

This is an optional feature release of Lotus. This feature release includes the SplitStore beta, the experimental Lotus node cluster feature, as well as numerous enhancments and bugfixes.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ actors-gen: actors-code-gen fiximports
.PHONY: actors-gen

bundle-gen:
$(GOCC) run ./gen/bundle $(RELEASE)
$(GOCC) run ./gen/bundle $(VERSION) $(RELEASE) $(RELEASE_OVERRIDES)
$(GOCC) fmt ./build/...
.PHONY: bundle-gen

Expand Down
2 changes: 2 additions & 0 deletions api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,8 @@ type FullNode interface {
//
// EthAccounts will always return [] since we don't expect Lotus to manage private keys
EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error) //perm:read
// EthAddressToFilecoinAddress converts an EthAddress into an f410 Filecoin Address
EthAddressToFilecoinAddress(ctx context.Context, ethAddress ethtypes.EthAddress) (address.Address, error) //perm:read
// EthBlockNumber returns the height of the latest (heaviest) TipSet
EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error) //perm:read
// EthGetBlockTransactionCountByNumber returns the number of messages in the TipSet
Expand Down
15 changes: 15 additions & 0 deletions api/mocks/mock_full.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions api/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/actors/pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ popd

echo "Generating metadata..."

make -C ../../ RELEASE="$RELEASE" bundle-gen
make -C ../../ VERSION="$VERSION" RELEASE="$RELEASE" RELEASE_OVERRIDES="${RELEASE_OVERRIDES[*]}" bundle-gen
Binary file modified build/openrpc/full.json.gz
Binary file not shown.
Binary file modified build/openrpc/gateway.json.gz
Binary file not shown.
Binary file modified build/openrpc/miner.json.gz
Binary file not shown.
Binary file modified build/openrpc/worker.json.gz
Binary file not shown.
1 change: 1 addition & 0 deletions chain/actors/builtin/evm/actor.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type State interface {
cbor.Marshaler

Nonce() (uint64, error)
IsAlive() (bool, error)
GetState() interface{}

GetBytecode() ([]byte, error)
Expand Down
1 change: 1 addition & 0 deletions chain/actors/builtin/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type State interface {
cbor.Marshaler

Nonce() (uint64, error)
IsAlive() (bool, error)
GetState() interface{}

GetBytecode() ([]byte, error)
Expand Down
6 changes: 6 additions & 0 deletions chain/actors/builtin/evm/state.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"github.com/ipfs/go-cid"

"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/go-state-types/abi"

evm{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}evm"
)
Expand Down Expand Up @@ -40,6 +42,10 @@ func (s *state{{.v}}) Nonce() (uint64, error) {
return s.State.Nonce, nil
}

func (s *state{{.v}}) IsAlive() (bool, error) {
return s.State.Tombstone == nil, nil
}

func (s *state{{.v}}) GetState() interface{} {
return &s.State
}
Expand Down
4 changes: 4 additions & 0 deletions chain/actors/builtin/evm/v10.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 26 additions & 7 deletions chain/types/ethtypes/eth_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ func EthUint64FromHex(s string) (EthUint64, error) {
return EthUint64(parsedInt), nil
}

// Parse a uint64 from big-endian encoded bytes.
func EthUint64FromBytes(b []byte) (EthUint64, error) {
if len(b) != 32 {
return 0, xerrors.Errorf("eth int must be 32 bytes long")
}
var zeros [32 - 8]byte
if !bytes.Equal(b[:len(zeros)], zeros[:]) {
return 0, xerrors.Errorf("eth int overflows 64 bits")
}
return EthUint64(binary.BigEndian.Uint64(b[len(zeros):])), nil
}

func (e EthUint64) Hex() string {
if e == 0 {
return "0x0"
Expand All @@ -78,11 +90,15 @@ type EthBigInt big.Int

var EthBigIntZero = EthBigInt{Int: big.Zero().Int}

func (e EthBigInt) MarshalJSON() ([]byte, error) {
func (e EthBigInt) String() string {
if e.Int == nil || e.Int.BitLen() == 0 {
return json.Marshal("0x0")
return "0x0"
}
return json.Marshal(fmt.Sprintf("0x%x", e.Int))
return fmt.Sprintf("0x%x", e.Int)
}

func (e EthBigInt) MarshalJSON() ([]byte, error) {
return json.Marshal(e.String())
}

func (e *EthBigInt) UnmarshalJSON(b []byte) error {
Expand All @@ -106,12 +122,15 @@ func (e *EthBigInt) UnmarshalJSON(b []byte) error {
// EthBytes represent arbitrary bytes. A nil or empty slice serializes to "0x".
type EthBytes []byte

func (e EthBytes) MarshalJSON() ([]byte, error) {
func (e EthBytes) String() string {
if len(e) == 0 {
return json.Marshal("0x")
return "0x"
}
s := hex.EncodeToString(e)
return json.Marshal("0x" + s)
return "0x" + hex.EncodeToString(e)
}

func (e EthBytes) MarshalJSON() ([]byte, error) {
return json.Marshal(e.String())
}

func (e *EthBytes) UnmarshalJSON(b []byte) error {
Expand Down
16 changes: 11 additions & 5 deletions cli/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/filecoin-project/lotus/api/v0api"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/types/ethtypes"
)
Expand Down Expand Up @@ -75,13 +76,18 @@ var EvmGetInfoCmd = &cli.Command{
}

actor, err := api.StateGetActor(ctx, faddr, types.EmptyTSK)
if err != nil {
return err
}

fmt.Println("Filecoin address: ", faddr)
fmt.Println("Eth address: ", eaddr)
fmt.Println("Code cid: ", actor.Code.String())
if err != nil {
fmt.Printf("Actor lookup failed for faddr %s with error: %s\n", faddr, err)
} else {
idAddr, err := api.StateLookupID(ctx, faddr, types.EmptyTSK)
if err == nil {
fmt.Println("ID address: ", idAddr)
fmt.Println("Code cid: ", actor.Code.String())
fmt.Println("Actor Type: ", builtin.ActorNameByCode(actor.Code))
}
}

return nil
},
Expand Down
10 changes: 4 additions & 6 deletions cmd/lotus-shed/balances.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,8 @@ var chainBalanceStateCmd = &cli.Command{
Description: "Produces a csv file of all account balances from a given stateroot",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
&cli.BoolFlag{
Name: "miner-info",
Expand Down Expand Up @@ -679,9 +678,8 @@ var chainPledgeCmd = &cli.Command{
Description: "Calculate sector pledge numbers",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
ArgsUsage: "[stateroot epoch]",
Expand Down
12 changes: 1 addition & 11 deletions cmd/lotus-shed/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ var datastoreListCmd = &cli.Command{
Name: "list",
Description: "list datastore keys",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "repo-type",
Usage: "node type (FullNode, StorageMiner, Worker, Wallet)",
Expand Down Expand Up @@ -115,11 +110,6 @@ var datastoreGetCmd = &cli.Command{
Name: "get",
Description: "list datastore keys",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "repo-type",
Usage: "node type (FullNode, StorageMiner, Worker, Wallet)",
Expand All @@ -133,7 +123,7 @@ var datastoreGetCmd = &cli.Command{
},
ArgsUsage: "[namespace key]",
Action: func(cctx *cli.Context) error {
_ = logging.SetLogLevel("badger", "ERROR")
logging.SetLogLevel("badger", "ERROR") // nolint:errcheck

r, err := repo.NewFS(cctx.String("repo"))
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions cmd/lotus-shed/deal-label.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ var dealLabelCmd = &cli.Command{
Usage: "Scrape state to report on how many deals have non UTF-8 labels",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
Action: func(cctx *cli.Context) error {
Expand Down
5 changes: 2 additions & 3 deletions cmd/lotus-shed/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ var diffMinerStates = &cli.Command{
ArgsUsage: "<stateCidA> <stateCidB>",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
Action: func(cctx *cli.Context) error {
Expand Down
5 changes: 2 additions & 3 deletions cmd/lotus-shed/export-car.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ var exportCarCmd = &cli.Command{
Description: "Export a car from repo",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
ArgsUsage: "[outfile] [root cid]",
Expand Down
10 changes: 4 additions & 6 deletions cmd/lotus-shed/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ var exportChainCmd = &cli.Command{
Description: "Export chain from repo (requires node to be offline)",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
&cli.StringFlag{
Name: "tipset",
Expand Down Expand Up @@ -147,9 +146,8 @@ var exportRawCmd = &cli.Command{
Description: "Export raw blocks from repo (requires node to be offline)",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
&cli.StringFlag{
Name: "car-size",
Expand Down
Loading

0 comments on commit 3841e54

Please sign in to comment.