-
Notifications
You must be signed in to change notification settings - Fork 775
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
"Small" Ethereum Object Format (EIP-3540 + EIP-3670) #4644
Conversation
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Enable the "Merge" network targeting the "paris" fork. Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Add a flag to MainnetTransactionProcessor to add the miningBeneficiary to the list of pre-warmed addresses. Have shandong fork set this flag to true by default. Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
There was a change in error codes in Java DER decoding between Java 17 and Java 11. Tests depend on Java 11 error. Use JUnit5 facilities to ensure the test works proeprly on both with the same codebase. Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
# Conflicts: # ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetDifficultyCalculators.java # ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java
# Conflicts: # ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java
# Conflicts: # ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
evm/src/main/java/org/hyperledger/besu/evm/contractvalidation/ContractValidationRule.java
Fixed
Show resolved
Hide resolved
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
#
We're all good. Test that are legit work on my machine. |
The trick was an invalid contract being executed from a "return" initcode should not leave an account behind. Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
doc change notes -
|
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 really like this PR. I just added a few non blocking comments.
gasCalculator, | ||
evm, | ||
true, | ||
List.of(MaxCodeSizeRule.of(contractSizeLimit), CachedInvalidCodeRule.of()), |
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.
If the Code
of the frame is being created through the CodeFactory
, can the o.h.b.e.c.PrefixCodeRule
used in the londonDefinition be replaced by o.h.b.e.c.CachedInvalidCodeRule
too?
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.
No. London rejects all 0xEF code for all of London and Paris. The EOF rule relaxes it and accepts EOF formatted code that starts with 0xEF. It could be a configuration of the rule, but I read it cleaner to make it two rules.
|
||
public EVM( | ||
final OperationRegistry operations, | ||
final GasCalculator gasCalculator, | ||
final EvmConfiguration evmConfiguration) { | ||
final EvmConfiguration evmConfiguration, | ||
final EvmSpecVersion evmSpecVersion) { |
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.
What about passing a o.h.b.e.c.CodeFactory
instance here, created with the corresponding maxEofVersion for each protocol spec. This would keep the EVM runtime agnostic of the upgrade (there would be neccesary some refactor around PUSH0
to resolve it purely from the registry though)
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.
CodeFactory holds only pure functions at this point. So we are just moving where the max eof version would be held.
} | ||
|
||
@SuppressWarnings("AlreadyChecked") // false positive | ||
public void maybeWarnVersion() { |
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 plan to keep this method after shandong? I would prefer to not keep mutable state in an enum and we should explore if it's not possible to solve this filtering through the logging framework (e.g. DuplicateMessageFilter if we used Logback)
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.
The idea is that this is only used for transient forks. Perhaps if we had a static enum set and checked that? And we could pre-populate it with "final" forks so there will be no warnings?
evm/src/main/java/org/hyperledger/besu/evm/processor/AbstractMessageProcessor.java
Outdated
Show resolved
Hide resolved
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.
Looks great so far.
evm/src/main/java/org/hyperledger/besu/evm/contractvalidation/ContractValidationRule.java
Fixed
Show resolved
Hide resolved
case MESSAGE_CALL: | ||
mcp.process(messageFrame, tracer); | ||
break; | ||
if (messageFrame.getType() == MessageFrame.Type.CONTRACT_CREATION) { |
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.
Why the switch away from previous method?
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.
Sonar rule S1301 - "switch" statements should have at least 3 "case" clauses
Seemed reasonable with an auto-refactor.
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Implement "Small" EOF - EIP-3540 (container) and EIP-3670 (validation). Make code an interface so EOF specific features are compartmentalized, including an 'invalid' code type representing a code block that didn't pass validation, CodeV1 for EOF1, and CodeV0 which represents pre-EOF code. EVMs track a maximum supported EOF version (where 0 is pre-eof)and code is generated from a CodeFactory taking in context (is it a CREATE operation and max code size) for the validation. Includes spec versions for "Shanghai" and transient testnet "Shandong". "Small" EOF is only activated in Shandong. Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com> Signed-off-by: wcgcyx <wcgcyx@gmail.com>
Implement "Small" EOF - EIP-3540 (container) and EIP-3670 (validation). Make code an interface so EOF specific features are compartmentalized, including an 'invalid' code type representing a code block that didn't pass validation, CodeV1 for EOF1, and CodeV0 which represents pre-EOF code. EVMs track a maximum supported EOF version (where 0 is pre-eof)and code is generated from a CodeFactory taking in context (is it a CREATE operation and max code size) for the validation. Includes spec versions for "Shanghai" and transient testnet "Shandong". "Small" EOF is only activated in Shandong. Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com> Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Implement "Small" EOF - EIP-3540 (container) and EIP-3670 (validation). Make code an interface so EOF specific features are compartmentalized, including an 'invalid' code type representing a code block that didn't pass validation, CodeV1 for EOF1, and CodeV0 which represents pre-EOF code. EVMs track a maximum supported EOF version (where 0 is pre-eof)and code is generated from a CodeFactory taking in context (is it a CREATE operation and max code size) for the validation. Includes spec versions for "Shanghai" and transient testnet "Shandong". "Small" EOF is only activated in Shandong. Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
PR description
Implement "Small" EOF - EIP-3540 (container) and EIP-3670 (validation).
Make code an interface so EOF specific features are compartmentalized,
including an 'invalid' code type representing a code block that didn't
pass validation, CodeV1 for EOF1, and CodeV0 which represents pre-EOF
code. EVMs track a maximum supported EOF version (where 0 is pre-eof)and
code is generated from a CodeFactory taking in context (is it a CREATE
operation and max code size) for the validation.
Includes spec versions for "Shanghai" and transient testnet "Shandong".
Fixed Issue(s)
Documentation
doc-change-required
label to this PR ifupdates are required.
Changelog