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

fevm: address #9617 review comments (FEVM nv18 merge) #9984

Merged
merged 24 commits into from
Jan 12, 2023

Conversation

raulk
Copy link
Member

@raulk raulk commented Jan 10, 2023

Related Issues

#9617

Closes filecoin-project/ref-fvm#1173.

Proposed Changes

Check commit log for individual changes included here.

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

@raulk raulk mentioned this pull request Jan 11, 2023
@raulk raulk force-pushed the raulk/review-nv18-fevm branch from 2741c03 to 08b978c Compare January 11, 2023 12:16
raulk added 4 commits January 11, 2023 17:39
We now create the 0x0 Eth null address on genesis as an EthAccount,
so using the 0x0 Eth null address is guaranteed to work.
1. Move contract deployment and invocation commands to the "eth" command group.
2. Remove the hack to use EAM#Create2 for an external contract creation.
3. Remove code made stale as a result of these refactors.
@raulk raulk changed the title address #9617 review comments (FEVM nv18 merge) fevm: address #9617 review comments (FEVM nv18 merge) Jan 11, 2023
@raulk raulk marked this pull request as ready for review January 11, 2023 18:36
@raulk raulk requested a review from a team as a code owner January 11, 2023 18:36
@raulk raulk requested a review from arajasek January 11, 2023 18:42
}

if err := sigs.Verify(&msg.Signature, signer, digest); err != nil {
return xerrors.Errorf("secpk message %s has invalid signature: %w", msg.Cid(), err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessarily secp here

chain/gen/genesis/genesis.go Outdated Show resolved Hide resolved
func MakeEthNullAddressActor(av actorstypes.Version, addr address.Address) (*types.Actor, error) {
actcid, ok := actors.GetActorCodeID(av, manifest.EthAccountKey)
if !ok {
return nil, xerrors.Errorf("failed to get account actor code ID for actors version %d", av)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return nil, xerrors.Errorf("failed to get account actor code ID for actors version %d", av)
return nil, xerrors.Errorf("failed to get ethaccount actor code ID for actors version %d", av)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

return nil, xerrors.Errorf("failed to load init actor: %w", err)
}

initState, err := init_.Load(adt.WrapStore(ctx, st.Store), initAct)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of manipulating the init actor state directly, you could invoke the actual constructor method since you have a VM here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EthAccounts cannot be constructed via the Init actor.

They have no public interface: https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0055.md#actor-interface

They only have a private interface exposed to the system: https://github.com/filecoin-project/builtin-actors/blob/ad141a1d8998e3fb0d3122e677352dd9c7462184/actors/ethaccount/src/lib.rs#L28 (which I should probably document in the FIP).

@@ -26,7 +26,7 @@ type ActorV5 struct {
Head cid.Cid
Nonce uint64
Balance BigInt
// Predictable Address
// Deterministic Address: f1, f3, or f4 address.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can only be an f4 address (...for now)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We had discussed an alternative version of the world where we hoisted key addresses here, but we didn't go through with that.

cli/chain.go Outdated
@@ -68,8 +63,8 @@ var ChainCmd = &cli.Command{
ChainEncodeCmd,
ChainDisputeSetCmd,
ChainPruneCmd,
ChainExecEVMCmd,
ChainInvokeEVMCmd,
EthDeployCmd,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these can be removed, since they've moved to their new home?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, refactor.

cli/state.go Outdated
@@ -776,7 +776,7 @@ var StateGetActorCmd = &cli.Command{
fmt.Printf("Nonce:\t\t%d\n", a.Nonce)
fmt.Printf("Code:\t\t%s (%s)\n", a.Code, strtype)
fmt.Printf("Head:\t\t%s\n", a.Head)
fmt.Printf("Predictable address:\t\t%s\n", a.Address)
fmt.Printf("Deterministic address:\t\t%s\n", a.Address)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should stay as Predictable

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, we moved away from that term in favour of Delegated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used Deterministic because I wrongly thought this could also carry an f1 or f3 address, in addition to the f4.

@@ -114,7 +114,7 @@ func TestFEVMETH0(t *testing.T) {
av, err := actorstypes.VersionForNetwork(nv)
require.NoError(t, err)

evmCodeCid, ok := actors.GetActorCodeID(av, manifest.EvmKey)
evmCodeCid, ok := actors.GetActorCodeID(av, manifest.EthAccountKey)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename the variable (or better yet switch to using AssertActorType)

@raulk raulk requested a review from arajasek January 11, 2023 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants