-
Notifications
You must be signed in to change notification settings - Fork 136
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
Refactor operations to eliminate duplicate code between EVM versions #7000
Conversation
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
…oxyWorldUpdater Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
* Need to clean up and refactor {@link com.hedera.node.app.service.mono.contracts.gascalculator.GasCalculatorHederaV22} | ||
* to get its price and exchange rate from the transaction's {@link com.hedera.node.app.spi.meta.bni.Scope}. | ||
*/ | ||
public class CustomGasCalculator extends LondonGasCalculator {} |
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.
Should we be extending London or Shandong.? I believe that the ShandongGasCalculator had the update for EIP-3860 limit the size of the initcode. hyperledger/besu#4726
|
||
@Override | ||
public OperationResult execute(@NonNull final MessageFrame frame, @NonNull final EVM evm) { | ||
if (!isEnabled(frame)) { |
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.
Did this get copied and modified from AbstractEvmRecordingCreateOperation
or from AbstractCreateOperation
in besu? The implementations seems very similar but slightly different. I'm not sure if the differences are meaningful.
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
* A {@link VerificationStrategy} that verifies signatures from a single active contract. This is the | ||
* verification strategy used within the EVM to check receiver signature requirements. | ||
*/ | ||
public class ActiveContractVerificationStrategy implements VerificationStrategy { |
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 think hedera-app-spi
is not the right place for these classes as it is only relevant for the smart contract service.
@@ -28,6 +28,10 @@ dependencies { | |||
} | |||
} | |||
|
|||
val generatedSources = file("build/generated/sources/annotationProcessor/java/main") |
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 is the change in this file used for?
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 !
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
public interface FeatureFlags { | ||
/** | ||
* Whether the {@code CREATE2} operation should be enabled for the given {@code frame}. | ||
* | ||
* @param frame the {@link MessageFrame} to check | ||
* @return whether {@code CREATE2} should be enabled | ||
*/ | ||
boolean isCreate2Enabled(@NonNull MessageFrame frame); | ||
|
||
/** | ||
* Whether "implicit creation" of accounts via sending value or targeting a {@code CREATE2} to an EIP-1014 address | ||
* should be enabled for the given {@code frame}. | ||
* | ||
* @param frame the {@link MessageFrame} to check | ||
* @return whether implicit creation should be enabled | ||
*/ | ||
boolean isImplicitCreationEnabled(@NonNull MessageFrame frame); | ||
} |
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.
Do we need an interface for this or can we get from config ?
import org.hyperledger.besu.evm.frame.ExceptionalHaltReason; | ||
|
||
/** | ||
* Some {@link ExceptionalHaltReason}s that are not part of the Besu core. |
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.
Don't we use HandleException
here with appropriate response codes ?
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #7000 +/- ##
==============================================
+ Coverage 68.46% 90.24% +21.78%
+ Complexity 24022 19079 -4943
==============================================
Files 2211 1513 -698
Lines 142881 55611 -87270
Branches 8413 5791 -2622
==============================================
- Hits 97817 50185 -47632
+ Misses 43323 4230 -39093
+ Partials 1741 1196 -545
☔ View full report in Codecov by Sentry. |
Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
SonarCloud Quality Gate failed. 0 Bugs 93.5% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
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
…7000) Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Description:
Operation
s to vary based on injectedAddressChecks
andFeatureFlags
(which together will encapsulate the varying behavior of the EVM version for release).HederaBalanceOperationV038
#6950HederaEvmChainIdOperation
#6954HederaBalanceOperation
to useHederaAddresses
#6928HederaEvmCreate2Operation
#6903HederaEvmCreateOperation
#6902CustomCallCodeOperation
,CustomSelfDestructOperation
,CustomSLoadOperation
,CustomLogOperation
.Notes to reviewer:
The main constraints relative to
mono-service
are:ContractService
can no longer directly mutate any account, token, or token association property (nonce
,deleted
,balance
,supply
, etc.) and must use a "dispatch" facility provided by something called theHandleContext
.ContractService
can no longer directly create or manage records.The main goals relative to
mono-service
are:TransactionProcessor
pattern much more closely, where given aProtocolSpec
, a transaction can be handled in a single call with a bit of context (e.g. currentgasPrice
,BlockValues
) and a choice of EVM version.FeatureFlags
,AccountChecks
) instead of having differentOperation
implementations for each versions.