forked from hyperledger/besu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce ETC Spiral EVM configuration (hyperledger#6524)
Signed-off-by: Diego López León <dieguitoll@gmail.com> Co-authored-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
- Loading branch information
1 parent
7be3859
commit c31403d
Showing
3 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
evm/src/main/java/org/hyperledger/besu/evm/ClassicEVMs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright contributors to Hyperledger Besu | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.evm; | ||
|
||
import static org.hyperledger.besu.evm.MainnetEVMs.SHANGHAI_INIT_CODE_SIZE_LIMIT; | ||
import static org.hyperledger.besu.evm.MainnetEVMs.registerIstanbulOperations; | ||
|
||
import org.hyperledger.besu.evm.gascalculator.GasCalculator; | ||
import org.hyperledger.besu.evm.internal.EvmConfiguration; | ||
import org.hyperledger.besu.evm.operation.Create2Operation; | ||
import org.hyperledger.besu.evm.operation.CreateOperation; | ||
import org.hyperledger.besu.evm.operation.OperationRegistry; | ||
import org.hyperledger.besu.evm.operation.Push0Operation; | ||
|
||
import java.math.BigInteger; | ||
|
||
public class ClassicEVMs { | ||
|
||
/** | ||
* spiral evm. | ||
* | ||
* @param gasCalculator the gas calculator | ||
* @param chainId the chain id | ||
* @param evmConfiguration the evm configuration | ||
* @return the evm | ||
*/ | ||
public static EVM spiral( | ||
final GasCalculator gasCalculator, | ||
final BigInteger chainId, | ||
final EvmConfiguration evmConfiguration) { | ||
return new EVM( | ||
spiralOperations(gasCalculator, chainId), | ||
gasCalculator, | ||
evmConfiguration, | ||
EvmSpecVersion.SHANGHAI); | ||
} | ||
|
||
/** | ||
* spiral operations' registry. | ||
* | ||
* @param gasCalculator the gas calculator | ||
* @param chainId the chain id | ||
* @return the operation registry | ||
*/ | ||
public static OperationRegistry spiralOperations( | ||
final GasCalculator gasCalculator, final BigInteger chainId) { | ||
OperationRegistry registry = new OperationRegistry(); | ||
registerIstanbulOperations(registry, gasCalculator, chainId); | ||
registry.put(new Push0Operation(gasCalculator)); | ||
registry.put(new CreateOperation(gasCalculator, SHANGHAI_INIT_CODE_SIZE_LIMIT)); | ||
registry.put(new Create2Operation(gasCalculator, SHANGHAI_INIT_CODE_SIZE_LIMIT)); | ||
return registry; | ||
} | ||
} |