-
Notifications
You must be signed in to change notification settings - Fork 80
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
FIP-0054: Introduce the EVM actor's logic #1186
Conversation
0b90954
to
cc8ec2b
Compare
@@ -0,0 +1,165 @@ | |||
GNU LESSER GENERAL PUBLIC LICENSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't PL's standard license, so can we get a README in this directory explaining why LGPL and providing the attribution that's presumably missing? Are we importing this with a JSON file or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(summon @filecoin-project/fvm-core-devs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't understand why we're doing this. Given that you didn't add an attribution to someone else, is this our own decision to use this license? Why is that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add the attribution. These are coming from geth and are technically licensed under the LGPL. I doubt that was intentional and I see these same files copied into other EVM implementations, but I have no way of knowing that for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok if we're importing it, but then we're bound to add the attribution, and then things will make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a short readme to this directory to explain the situation.
@@ -63,12 +65,23 @@ pub trait Runtime: Primitives + Verifier + RuntimePolicy { | |||
/// The genesis block has epoch zero. | |||
fn curr_epoch(&self) -> ChainEpoch; | |||
|
|||
/// The ID for the EVM-based chain, as defined in https://github.com/ethereum-lists/chains. | |||
fn chain_id(&self) -> ChainID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grumble grumble here the FVM is privileging Ethereum with this information, rather than having a Filecoin ChainID and an EVM actor or some state somewhere that holds an Ethereum-relevant version, in the same way any externally-developed client VM would have to. This is very subtly mentioned in FIP-0054 as "New environmental data is required by the FVM".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly agree with the grumble here, and would like to see this changed. The current flow is that the client (eg. Lotus) knows what EVM chain ID is operational for the blockchain being processed, creates an FVM with this value ("the" chain ID), which then supplies this value through the Runtime to the FEVM's CHAINID
opcode.
I think it would be in favour of your proposal to add a Filecoin ChainID, and a mapping. The biggest issue is that it requires some "process" work (starting a FIP etc.)
Simpler solutions for now could be:
- Move this value to the Runtime's policy, configure it by actor bundle, and call it
evm_chain_id
(still privileged, but contained to the Runtime without spilling into FVM / clients) - Keep as is, but rename to
evm_chain_id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an Ethereum-specific chain but Ethereum chain IDs have been standardised in Chain Agnostic standards. This should probably read caip_eip155_chain_id
and it would be less of an offender that way. But the bottom line is that these chain IDs are actually standardised by some body that does have reasonable adoption.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed with @Stebalien in standup, he provided some background context. The intention is for these IDs to serve as Filecoin ChainIDs (that are conveniently in the Ethereum namespace). Since we don't have any ChainIDs this works pretty well, and honestly is probably what most other chains do anyway.
I agree with you that this has not been sufficiently publicized, though -- a footnote in an unrelated FIP is likely not sufficient for this. @jennijuju do you have suggestions here? I don't know if this needs its own FIP, but should be included in a table of networks and chains somewhere.
(...we can even eventually include these IDs in messages as replay protection one day...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the comment still accurate? Should it be something like "The ID for this chain. Note that Filecoin chain IDs are usually in the Ethereum namespace (i.e. scope "xyz") for [reasons]".
If the comment as it stands is accurate, I still think this should move into some state somewhere (EAM?) rather than be a syscall available to future native actors.
@@ -222,6 +222,7 @@ pub fn check_state_invariants<'a, BS: Blockstore + Debug>( | |||
} | |||
Some(Type::Placeholder) => {} | |||
Some(Type::EVM) => {} | |||
Some(Type::EAM) => {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite sad, is there nothing to check here? Please file an issue for implementing these checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_vm/src/lib.rs
Outdated
// EthAccount abstractions turns Placeholders into EthAccounts | ||
if a.code == *PLACEHOLDER_ACTOR_CODE_ID { | ||
a.code = *ETHACCOUNT_ACTOR_CODE_ID; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grumble VM magic voodoo privileging the EVM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right -- this is an FVM detail that we don't actually need in the test VM here. It slightly restricts our ability to write tests around this, but we can manipulate the state directly / those should be unit tests anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Dropping it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I infer that there's similar code in the FVM, so my grumble transitively applies there. Thanks for dropping it, but if this is how the FVM behaves then this is probably going to end up back here again, until the FVM itself doesn't have ethereum-specifics inside it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only really necessary for message validation. We do have similar magic on the FVM, but plan to drop it the second we get real account abstraction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after adding the attribution that explains the introduction of LGPL.
@@ -63,12 +65,23 @@ pub trait Runtime: Primitives + Verifier + RuntimePolicy { | |||
/// The genesis block has epoch zero. | |||
fn curr_epoch(&self) -> ChainEpoch; | |||
|
|||
/// The ID for the EVM-based chain, as defined in https://github.com/ethereum-lists/chains. | |||
fn chain_id(&self) -> ChainID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the comment still accurate? Should it be something like "The ID for this chain. Note that Filecoin chain IDs are usually in the Ethereum namespace (i.e. scope "xyz") for [reasons]".
If the comment as it stands is accurate, I still think this should move into some state somewhere (EAM?) rather than be a syscall available to future native actors.
@@ -0,0 +1,165 @@ | |||
GNU LESSER GENERAL PUBLIC LICENSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok if we're importing it, but then we're bound to add the attribution, and then things will make sense.
be9c8f2
to
bd6fe24
Compare
Co-authored-by: Steven Allen <[email protected]> Co-authored-by: vyzo <[email protected]> Co-authored-by: Melanie Riise <[email protected]> Co-authored-by: Raúl Kripalani <[email protected]>
That way, we: 1. Don't depend on a fork of an unmaintained library. 2. Use a much simpler blake2f implementation.
bd6fe24
to
30b4103
Compare
Co-authored-by: Steven Allen [email protected]
Co-authored-by: vyzo [email protected]
Co-authored-by: Melanie Riise [email protected]
Co-authored-by: Raúl Kripalani [email protected]
Extracted from
next
.