Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Lotus release handoff: FVM Topaz (r08) #15

Closed
raulk opened this issue Nov 16, 2022 · 4 comments
Closed

Lotus release handoff: FVM Topaz (r08) #15

raulk opened this issue Nov 16, 2022 · 4 comments

Comments

@raulk
Copy link
Member

raulk commented Nov 16, 2022

Instructions for node operators, explorers and RPC endpoint operators are below.

Request

Please deploy the Wallaby testnet with the following Lotus release.

Git reference

Branch: https://github.com/filecoin-project/lotus/tree/release/fevm-wallaby
Commit: filecoin-project/lotus@e7b78db
Commit: filecoin-project/lotus@8d0403d

New Features

Support for EVM logs

This release delivers full support for EVM logs, in the form of FIP-0049 Actor Events. Events produced by actors get included in the receipt, which is then committed to the chain via the receipt root. The EVM runtime now handles the LOG{0..4} opcodes by emitting actor events.

Feature completeness of Ethereum JSON-RPC API

With this release, the Ethereum JSON-RPC API becomes feature complete. This means that all Ethereum tools should be able to operate full against Filecoin (except for debugging purposes -- those tend to be client-specific APIs).

There are still some adjustments needed. If you notice any glitch or hiccup during your testing with Ethereum tools, libraries, frameworks like Hardhat, Truffle, Foundry, etc., please let us know. There may be implicit, undocumented assumptions that wallets, tools, etc. that we may not have been aware of.

This release adds support for the following Ethereum JSON-RPC methods:

  • eth_getLogs
  • Filter methods
    • eth_newFilter
    • eth_newBlockFilter
    • eth_newPendingTransactionFilter
    • eth_getFilterLogs
    • eth_getFilterChanges
    • eth_uninstallFilter
  • Subscription methods (only available over WebSockets)
    • eth_subscribe
    • eth_unsubscribe

Additionally, eth_getTransactionReceipt now returns the transaction logs too.

Events indexing

Lotus now indexes events in a sqlite database so it can serve historical queries. In the following days, we add database maintenance logic and will optimize this subsystem.

Memory limits and memory expansion gas

In preparation for user programmability, the system now enforces hard memory limits during actor execution (maximum 512MiB utilization across the entire call stack, value will be revisited). Code for charging for memory expansion gas has also landed, but is currently free.

New Filecoin-specific precompiles

See filecoin-project/ref-fvm#947 for more details. We will write up more in the next days.

Network Version 18 (Hygge)

Support for network version 18 has been added. FEVM now runs under nv18. Wallaby and devnet configurations bootstrap into nv18 at genesis.

New [ActorEvent] configuration section in config.toml

To activate support for events indexing, historical events, and filtering APIs, you will need to set these attributes in the config file:

  • ActorEvent.EnableRealTimeFilterAPI = true (default = false)
  • ActorEvent.EnableHistoricFilterAPI = true (default = false)
  • ActorEventDatabasePath = "<path to db file>" (will be autocreated) (default = empty)

Instructions for network operators

  1. Deploy the release as usual.
  2. Set the above configuration values in the config.toml file under $LOTUS_HOME. Make sure to restart your daemon after.
  3. Please create the 0x0 Ethereum account by sending it some FIL:
$ lotus send t410faaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaonc6iji 1

Instructions for node operators and explorers

  1. Deploy the release as usual.
  2. Set the above configuration values in the config.toml file under $LOTUS_HOME. Make sure to restart your daemon after.

Step (2) is necessary for users to be able to use the new log querying and streaming methods. Explorers wanting to process events in real-time will likely want to use the streaming APIs.

Instructions for RPC endpoint operators

You will need to whitelist these new methods.

For Ethereum clients:

  • eth_getLogs
  • eth_getFilterChanges
  • eth_getFilterLogs
  • eth_newFilter
  • eth_newBlockFilter
  • eth_newPendingTransactionFilter
  • eth_uninstallFilter
  • eth_subscribe
  • eth_unsubscribe

For Filecoin clients:

  • Filecoin.EthGetLogs
  • Filecoin.EthGetFilterChanges
  • Filecoin.EthGetFilterLogs
  • Filecoin.EthNewFilter
  • Filecoin.EthNewBlockFilter
  • Filecoin.EthNewPendingTransactionFilter
  • Filecoin.EthUninstallFilter
  • Filecoin.EthSubscribe
  • Filecoin.EthUnsubscribe

Verification Tests

All past tests should work (e.g. #12). In addition, run the following event-specific tests.

Deploy a simple contract with events

  1. Copy this hex into a file:
63000000678063000000116000396000f360003560e01c80600014601f578060011460365780600214604157600080fd5b67112233445566778860005260086018a060006000f35b60006000a060006000f35b67112233445566778860005263000044446200333361222261111160086018a460006000f3
  1. Turn it into binary: xxd -r -p events_contract.hex events_contract.bin
  2. Deploy the contract:
$ lotus chain create-evm-actor events_contract.bin
...
ID Address: t01001
... 
  1. Invoke the contract on the resulting ID address, with function selector 00000002:
$ lotus chain invoke-evm-actor t01001 00000002
sending message...
waiting for message to execute...
Gas used:  1494493
OK
Events emitted:
821903f385830266746f7069633143421111830266746f7069633243422222830266746f7069633343423333830266746f70696334434244448302646461746149481122334455667788
        Emitter ID: 1011
                Key: topic1, Value: 0x1111, Flags: b10
                Key: topic2, Value: 0x2222, Flags: b10
                Key: topic3, Value: 0x3333, Flags: b10
                Key: topic4, Value: 0x4444, Flags: b10
                Key: data, Value: 0x1122334455667788, Flags: b10
  1. Get logs from since genesis. Your endpoint will vary and you may need a token. You should see the event here too:
$ ⟩ curl --location --request POST 'localhost:1234/rpc/v1' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "jsonrpc":"2.0",
  "method":"eth_getLogs",
  "params":[ { "fromBlock": "0x00" } ],
  "id":1
  }'

Deploy the OpenZeppelin ERC20 contract using Remix IDE and MetaMask

No modifications are necessary any longer to drop events.

  1. Create a new project and select the OpenZeppelin ERC20, Mintable version as a template.
  2. Compile MyToken.sol.
  3. Make sure your MetaMask is pointing to the new network you have just set up.
  4. Send yourself some faucet funds first.
  5. Deploy the contract to the new network setting the provider to MetaMask.
  6. On deployment, you should see these two events appear in the terminal:

image

jimpick added a commit to jimpick/lotus-fvm-localnet that referenced this issue Nov 17, 2022
@raulk
Copy link
Member Author

raulk commented Nov 17, 2022

@jimpick -- commit has been updated.

@f8-ptrk f8-ptrk added FVM testnet release live-ntwk label issues that have a live network labels Nov 17, 2022
@f8-ptrk
Copy link
Contributor

f8-ptrk commented Nov 17, 2022

lotus send t410faaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaonc6iji 1
bafy2bzacecoh6tcbaluwhcgtxiqmrjqdooldvnbfom6njga6cukejxptxg3i2

@f8-ptrk
Copy link
Contributor

f8-ptrk commented Nov 17, 2022

lotus chain create-evm-actor topaz-test.bin 
sending message...
waiting for message to execute...
Actor ID: 1021
ID Address: t01021
Robust Address: t2nin7gp3n7mop3zb4ut5pjatudoqumyhpvg7bemq
Eth Address: 0x8efad49366a450c39878105e68cde5cd3a588da7
f4 Address: t410fr35nje3gurimhgdycbpgrtpfzu5frdnheisyqla
Return: gxkD/VUCahvzP237HP3kPKT69IJ0G6FGYO9UjvrUk2akUMOYeBBeaM3lzTpYjac=

lotus chain invoke-evm-actor t01021 00000002
sending message...
waiting for message to execute...
Gas used:  1553377
OK
Events emitted:
821903fd85830266746f7069633143421111830266746f7069633243422222830266746f7069633343423333830266746f70696334434244448302646461746149481122334455667788
        Emitter ID: 1021
                Key: topic1, Value: 0x1111, Flags: b10
                Key: topic2, Value: 0x2222, Flags: b10
                Key: topic3, Value: 0x3333, Flags: b10
                Key: topic4, Value: 0x4444, Flags: b10
                Key: data, Value: 0x1122334455667788, Flags: b10

@f8-ptrk f8-ptrk removed the live-ntwk label issues that have a live network label Nov 30, 2022
@f8-ptrk
Copy link
Contributor

f8-ptrk commented Nov 30, 2022

retired

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants