Update import path

This commit is contained in:
2024-01-03 09:50:41 +01:00
parent 309bce563c
commit 65408996d7
108 changed files with 490 additions and 247 deletions
+2
View File
@@ -51,3 +51,5 @@ cmd/simulator/simulator
# goreleaser
dist/
*.orig
+15 -11
View File
@@ -1,4 +1,4 @@
# Subnet EVM
# EVM
[![Build + Test + Release](https://github.com/luxdefi/evm/actions/workflows/lint-tests-release.yml/badge.svg)](https://github.com/luxdefi/evm/actions/workflows/lint-tests-release.yml)
[![CodeQL](https://github.com/luxdefi/evm/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/luxdefi/evm/actions/workflows/codeql-analysis.yml)
@@ -7,13 +7,17 @@
Each blockchain is an instance of a Virtual Machine (VM), much like an object in an object-oriented language is an instance of a class.
That is, the VM defines the behavior of the blockchain.
<<<<<<< HEAD
Subnet EVM is the [Virtual Machine (VM)](https://docs.lux.network/learn/lux/virtual-machines) that defines Subnet Contract Chains. Subnet EVM is a simplified version of [Coreth VM (C-Chain)](https://github.com/luxdefi/coreth).
=======
EVM is the [Virtual Machine (VM)](https://docs.lux.network/learn/lux/virtual-machines) that defines the Subnet Contract Chains. EVM is a simplified version of [Coreth VM (C-Chain)](https://github.com/luxdefi/coreth).
>>>>>>> fd08c47 (Update import path)
This chain implements the Ethereum Virtual Machine and supports Solidity smart contracts as well as most other Ethereum client functionality.
## Building
The Subnet EVM runs in a separate process from the main Luxd process and communicates with it over a local gRPC connection.
The EVM runs in a separate process from the main Luxd process and communicates with it over a local gRPC connection.
<<<<<<< HEAD
### Lux Node Compatibility
@@ -102,7 +106,7 @@ The Subnet EVM runs in a separate process from the main Luxd process and communi
## API
The Subnet EVM supports the following API namespaces:
The EVM supports the following API namespaces:
- `eth`
- `personal`
@@ -110,23 +114,23 @@ The Subnet EVM supports the following API namespaces:
- `debug`
Only the `eth` namespace is enabled by default.
Subnet EVM is a simplified version of [Coreth VM (C-Chain)](https://github.com/luxdefi/coreth).
EVM is a simplified version of [Coreth VM (C-Chain)](https://github.com/luxdefi/coreth).
Full documentation for the C-Chain's API can be found [here](https://docs.lux.network/apis/node/apis/c-chain).
## Compatibility
The Subnet EVM is compatible with almost all Ethereum tooling, including [Remix](https://docs.lux.network/build/dapp/smart-contracts/remix-deploy), [Metamask](https://docs.lux.network/build/dapp/chain-settings), and [Foundry](https://docs.lux.network/build/dapp/smart-contracts/toolchains/foundry).
The EVM is compatible with almost all Ethereum tooling, including [Remix](https://docs.lux.network/build/dapp/smart-contracts/remix-deploy), [Metamask](https://docs.lux.network/build/dapp/chain-settings), and [Foundry](https://docs.lux.network/build/dapp/smart-contracts/toolchains/foundry).
## Differences Between Subnet EVM and Coreth
## Differences Between EVM and Coreth
- Added configurable fees and gas limits in genesis
- Merged Lux hardforks into the single "Subnet EVM" hardfork
- Merged Lux hardforks into the single "EVM" hardfork
- Removed Atomic Txs and Shared Memory
- Removed Multicoin Contract and State
## Block Format
To support these changes, there have been a number of changes to the SubnetEVM block format compared to what exists on the C-Chain and Ethereum. Here we list the changes to the block format as compared to Ethereum.
To support these changes, there have been a number of changes to the EVM block format compared to what exists on the C-Chain and Ethereum. Here we list the changes to the block format as compared to Ethereum.
### Block Header
@@ -157,9 +161,9 @@ This will clone and checkout to `master` branch.
### Run Local Network
To run a local network, it is recommended to use the [lux-cli](https://github.com/luxdefi/lux-cli#lux-cli) to set up an instance of Subnet-EVM on an local Lux Network.
To run a local network, it is recommended to use the [lux-cli](https://github.com/luxdefi/lux-cli#lux-cli) to set up an instance of EVM on an local Lux Network.
There are two options when using the Lux-CLI:
1. Use an official Subnet-EVM release: https://docs.lux.network/subnets/build-first-subnet
2. Build and deploy a locally built (and optionally modified) version of Subnet-EVM: https://docs.lux.network/subnets/create-custom-subnet
1. Use an official EVM release: https://docs.lux.network/subnets/build-first-subnet
2. Build and deploy a locally built (and optionally modified) version of EVM: https://docs.lux.network/subnets/create-custom-subnet
+1 -1
View File
@@ -650,7 +650,7 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call interfaces.Cal
return nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
}
head := b.blockchain.CurrentHeader()
if !b.blockchain.Config().IsSubnetEVM(head.Time) {
if !b.blockchain.Config().IsEVM(head.Time) {
// If there's no basefee, then it must be a non-1559 execution
if call.GasPrice == nil {
call.GasPrice = new(big.Int)
+4
View File
@@ -39,6 +39,10 @@ import (
"text/template"
"unicode"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/accounts/abi"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/log"
"github.com/luxdefi/evm/accounts/abi"
)
@@ -35,6 +35,10 @@ import (
"strings"
"testing"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/accounts/abi/bind"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/luxdefi/evm/accounts/abi/bind"
"github.com/stretchr/testify/require"
@@ -452,7 +456,11 @@ var bindTests = []struct {
`"github.com/stretchr/testify/require"
"math/big"
"github.com/ethereum/go-ethereum/common"
<<<<<<< HEAD
"github.com/luxdefijevm/core/state"
=======
"github.com/luxdefi/evm/core/state"
>>>>>>> fd08c47 (Update import path)
"github.com/luxdefi/evm/precompile/allowlist"
`,
`
+4
View File
@@ -37,6 +37,10 @@ import (
"sync"
"time"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/accounts"
>>>>>>> fd08c47 (Update import path)
mapset "github.com/deckarep/golang-set/v2"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
+4
View File
@@ -32,6 +32,10 @@ import (
"os"
"github.com/luxdefi/evm/cmd/evm/internal/compiler"
<<<<<<< HEAD
=======
>>>>>>> fd08c47 (Update import path)
"github.com/urfave/cli/v2"
)
+4
View File
@@ -34,6 +34,10 @@ import (
"math/big"
"os"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/core/types"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/math"
+2 -2
View File
@@ -256,8 +256,8 @@ func Transition(ctx *cli.Context) error {
return NewError(ErrorJson, fmt.Errorf("failed signing transactions: %v", err))
}
// Sanity check, to not `panic` in state_transition
// NOTE: IsLondon replaced with IsSubnetEVM here
if chainConfig.IsSubnetEVM(prestate.Env.Timestamp) {
// NOTE: IsLondon replaced with IsEVM here
if chainConfig.IsEVM(prestate.Env.Timestamp) {
if prestate.Env.BaseFee != nil {
// Already set, base fee has precedent over parent base fee.
} else if prestate.Env.ParentBaseFee != nil && prestate.Env.Number != 0 {
+1 -1
View File
@@ -248,7 +248,7 @@ func runCmd(ctx *cli.Context) error {
if chainConfig != nil {
runtimeConfig.ChainConfig = chainConfig
} else {
runtimeConfig.ChainConfig = params.SubnetEVMDefaultChainConfig // NOTE: Replaced AllEthashProtocolChanges with SubnetEVMDefaultChainConfig here
runtimeConfig.ChainConfig = params.EVMDefaultChainConfig // NOTE: Replaced AllEthashProtocolChanges with EVMDefaultChainConfig here
}
var hexInput []byte
+1 -1
View File
@@ -256,7 +256,7 @@ func TestT8n(t *testing.T) {
// expExitCode: 3,
// },
// NOTE: this test was modified to test a non-trivial calculation
// of dynamic Subnet-EVM fees (instead of the original EIP-1559
// of dynamic EVM fees (instead of the original EIP-1559
// [misc.CalcBaseFee] calculation).
{ // Test base fee calculation
base: "./testdata/25",
+1 -1
View File
@@ -1,4 +1,4 @@
State root differs because of SubnetEVM's fee calculations.
State root differs because of EVM's fee calculations.
--- a/cmd/evm/testdata/13/exp2.json 2023-08-25 07:34:20
+++ b/cmd/evm/testdata/13/exp2.json 2023-08-24 14:17:32
+1 -1
View File
@@ -1,4 +1,4 @@
State root and balance differ because of SubnetEVM's fee calculations.
State root and balance differ because of EVM's fee calculations.
CurrentDifficulty is 0 instead of null because the test overrides the
difficulty if currentRandom is provided in the environment.
+1 -1
View File
@@ -1,4 +1,4 @@
State root and balance differ because of SubnetEVM's fee calculations.
State root and balance differ because of EVM's fee calculations.
CurrentDifficulty is 0xdeadc0de instead of null because the test overrides the
difficulty if currentRandom is provided in the environment.
+1 -1
View File
@@ -28,7 +28,7 @@ This should give the following output:
v0.1.0
```
To run the load simulator, you must first start an EVM based network. The load simulator works on both the C-Chain and Subnet-EVM, so we will start a single node network and run the load simulator on the C-Chain.
To run the load simulator, you must first start an EVM based network. The load simulator works on both the C-Chain and EVM, so we will start a single node network and run the load simulator on the C-Chain.
To start a single node network, follow the instructions from the Luxd [README](https://github.com/luxdefi/node#building-node) to build from source.
+5 -5
View File
@@ -4,7 +4,7 @@ Disclaimer: the consensus package in evm is a complete misnomer.
The consensus package in go-ethereum handles block validation and specifically handles validating the PoW portion of consensus - thus the name.
Since Luxd handles consensus for Subnet-EVM, Subnet-EVM is just the VM, but we keep the consensus package in place to handle part of the block verification process.
Since Luxd handles consensus for EVM, EVM is just the VM, but we keep the consensus package in place to handle part of the block verification process.
## Block Verification
@@ -12,17 +12,17 @@ The dummy consensus engine is responsible for performing verification on the hea
## Dynamic Fees
Subnet-EVM includes a dynamic fee algorithm based off of (EIP-1559)[https://eips.ethereum.org/EIPS/eip-1559]. This introduces a field to the block type called `BaseFee`. The Base Fee sets a minimum gas price for any transaction to be included in the block. For example, a transaction with a gas price of 49 gwei, will be invalid to include in a block with a base fee of 50 gwei.
EVM includes a dynamic fee algorithm based off of (EIP-1559)[https://eips.ethereum.org/EIPS/eip-1559]. This introduces a field to the block type called `BaseFee`. The Base Fee sets a minimum gas price for any transaction to be included in the block. For example, a transaction with a gas price of 49 gwei, will be invalid to include in a block with a base fee of 50 gwei.
The dynamic fee algorithm aims to adjust the base fee to handle network congestion. Subnet-EVM sets a target utilization on the network, and the dynamic fee algorithm adjusts the base fee accordingly. If the network operates above the target utilization, the dynamic fee algorithm will increase the base fee to make utilizing he network more expensive and bring overall utilization down. If the network operates below the target utilization, the dynamic fee algorithm will decrease the base fee to make it cheaper to use the network.
The dynamic fee algorithm aims to adjust the base fee to handle network congestion. EVM sets a target utilization on the network, and the dynamic fee algorithm adjusts the base fee accordingly. If the network operates above the target utilization, the dynamic fee algorithm will increase the base fee to make utilizing he network more expensive and bring overall utilization down. If the network operates below the target utilization, the dynamic fee algorithm will decrease the base fee to make it cheaper to use the network.
- EIP-1559 is intended for Ethereum where a block is produced roughly every 10s
- The dynamic fee algorithm needs to handle the case that the network quiesces and there are no blocks for a long period of time
- Since Subnet-EVM produces blocks at a different cadence, it adapts EIP-1559 to sum the amount of gas consumed within a 10 second interval instead of using only the amount of gas consumed in the parent block
- Since EVM produces blocks at a different cadence, it adapts EIP-1559 to sum the amount of gas consumed within a 10 second interval instead of using only the amount of gas consumed in the parent block
## Consensus Engine Callbacks
The consensus engine is called while blocks are being both built and processed and Subnet-EVM adds callback functions into the dummy consensus engine to insert its own logic into these stages.
The consensus engine is called while blocks are being both built and processed and EVM adds callback functions into the dummy consensus engine to insert its own logic into these stages.
### FinalizeAndAssemble
+8 -8
View File
@@ -124,7 +124,7 @@ func (self *DummyEngine) verifyHeaderGasFields(config *params.ChainConfig, heade
if err != nil {
return err
}
if config.IsSubnetEVM(header.Time) {
if config.IsEVM(header.Time) {
expectedGasLimit := feeConfig.GasLimit.Uint64()
if header.GasLimit != expectedGasLimit {
return fmt.Errorf("expected gas limit to be %d, but found %d", expectedGasLimit, header.GasLimit)
@@ -140,7 +140,7 @@ func (self *DummyEngine) verifyHeaderGasFields(config *params.ChainConfig, heade
if uint64(diff) >= limit || header.GasLimit < params.MinGasLimit {
return fmt.Errorf("invalid gas limit: have %d, want %d += %d", header.GasLimit, parent.GasLimit, limit)
}
// Verify BaseFee is not present before Subnet EVM
// Verify BaseFee is not present before EVM
if header.BaseFee != nil {
return fmt.Errorf("invalid baseFee before fork: have %d, want <nil>", header.BaseFee)
}
@@ -151,7 +151,7 @@ func (self *DummyEngine) verifyHeaderGasFields(config *params.ChainConfig, heade
}
// Verify baseFee and rollupWindow encoding as part of header verification
// starting in Subnet EVM
// starting in EVM
expectedRollupWindowBytes, expectedBaseFee, err := CalcBaseFee(config, feeConfig, parent, header.Time)
if err != nil {
return fmt.Errorf("failed to calculate base fee: %w", err)
@@ -202,7 +202,7 @@ func (self *DummyEngine) verifyHeader(chain consensus.ChainHeaderReader, header
if len(header.Extra) < params.DynamicFeeExtraDataSize {
return fmt.Errorf("expected extra-data field length >= %d, found %d", params.DynamicFeeExtraDataSize, len(header.Extra))
}
case config.IsSubnetEVM(header.Time):
case config.IsEVM(header.Time):
if len(header.Extra) != params.DynamicFeeExtraDataSize {
return fmt.Errorf("expected extra-data field to be: %d, but found %d", params.DynamicFeeExtraDataSize, len(header.Extra))
}
@@ -288,10 +288,10 @@ func (self *DummyEngine) verifyBlockFee(
return nil
}
if baseFee == nil || baseFee.Sign() <= 0 {
return fmt.Errorf("invalid base fee (%d) in SubnetEVM", baseFee)
return fmt.Errorf("invalid base fee (%d) in EVM", baseFee)
}
if requiredBlockGasCost == nil || !requiredBlockGasCost.IsUint64() {
return fmt.Errorf("invalid block gas cost (%d) in SubnetEVM", requiredBlockGasCost)
return fmt.Errorf("invalid block gas cost (%d) in EVM", requiredBlockGasCost)
}
var (
@@ -338,7 +338,7 @@ func (self *DummyEngine) verifyBlockFee(
}
func (self *DummyEngine) Finalize(chain consensus.ChainHeaderReader, block *types.Block, parent *types.Header, state *state.StateDB, receipts []*types.Receipt) error {
if chain.Config().IsSubnetEVM(block.Time()) {
if chain.Config().IsEVM(block.Time()) {
// we use the parent to determine the fee config
// since the current block has not been finalized yet.
feeConfig, _, err := chain.GetFeeConfigAt(parent)
@@ -377,7 +377,7 @@ func (self *DummyEngine) Finalize(chain consensus.ChainHeaderReader, block *type
func (self *DummyEngine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, parent *types.Header, state *state.StateDB, txs []*types.Transaction,
uncles []*types.Header, receipts []*types.Receipt,
) (*types.Block, error) {
if chain.Config().IsSubnetEVM(header.Time) {
if chain.Config().IsEVM(header.Time) {
// we use the parent to determine the fee config
// since the current block has not been finalized yet.
feeConfig, _, err := chain.GetFeeConfigAt(parent)
+5 -5
View File
@@ -22,10 +22,10 @@ import (
func CalcBaseFee(config *params.ChainConfig, feeConfig commontype.FeeConfig, parent *types.Header, timestamp uint64) ([]byte, *big.Int, error) {
// If the current block is the first EIP-1559 block, or it is the genesis block
// return the initial slice and initial base fee.
isSubnetEVM := config.IsSubnetEVM(parent.Time)
isEVM := config.IsEVM(parent.Time)
extraDataSize := params.DynamicFeeExtraDataSize
if !isSubnetEVM || parent.Number.Cmp(common.Big0) == 0 {
if !isEVM || parent.Number.Cmp(common.Big0) == 0 {
initialSlice := make([]byte, extraDataSize)
return initialSlice, feeConfig.MinBaseFee, nil
}
@@ -213,7 +213,7 @@ func calcBlockGasCost(
parentBlockGasCost *big.Int,
parentTime, currentTime uint64,
) *big.Int {
// Handle Subnet EVM boundary by returning the minimum value as the boundary.
// Handle EVM boundary by returning the minimum value as the boundary.
if parentBlockGasCost == nil {
return new(big.Int).Set(minBlockGasCost)
}
@@ -248,9 +248,9 @@ func calcBlockGasCost(
// correctness check performed is that the sum of all tips is >= the
// required block fee.
//
// This function will return nil for all return values prior to Subnet EVM.
// This function will return nil for all return values prior to EVM.
func MinRequiredTip(config *params.ChainConfig, header *types.Header) (*big.Int, error) {
if !config.IsSubnetEVM(header.Time) {
if !config.IsEVM(header.Time) {
return nil, nil
}
if header.BaseFee == nil {
+14 -7
View File
@@ -1,4 +1,4 @@
# Subnet EVM Contracts
# EVM Contracts
CONTRACTS HERE ARE [ALPHA SOFTWARE](https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha) AND ARE NOT AUDITED. USE AT YOUR OWN RISK!
@@ -6,9 +6,9 @@ CONTRACTS HERE ARE [ALPHA SOFTWARE](https://en.wikipedia.org/wiki/Software_relea
Lux is an open-source platform for launching decentralized applications and enterprise blockchain deployments in one interoperable, highly scalable ecosystem. Lux gives you complete control on both the network and application layers&mdash;helping you build anything you can imagine.
The Lux Network is composed of many subnets and chains. Chains in subnets run with customizable virtual machines. One of these virtual machines is Subnet EVM. The Subnet EVM's API is almost identical to an Ethereum node's API. Subnet EVM brings its own features like minting native tokens via contracts, restrincting contract deployer etc. These features are presented with `Stateful Precompile Contracts`. These contracts are precompiled and deployed when they're activated.
The Lux Network is composed of many subnets and chains. Chains in subnets run with customizable virtual machines. One of these virtual machines is EVM. The EVM's API is almost identical to an Ethereum node's API. EVM brings its own features like minting native tokens via contracts, restrincting contract deployer etc. These features are presented with `Stateful Precompile Contracts`. These contracts are precompiled and deployed when they're activated.
The goal of this guide is to lay out best practices regarding writing, testing and deployment of smart contracts to Lux's Subnet EVM. We'll be building smart contracts with development environment [Hardhat](https://hardhat.org).
The goal of this guide is to lay out best practices regarding writing, testing and deployment of smart contracts to Lux's EVM. We'll be building smart contracts with development environment [Hardhat](https://hardhat.org).
## Prerequisites
@@ -26,10 +26,13 @@ Clone the repo and install the necessary packages via `yarn`.
```bash
git clone https://github.com/luxdefi/evm.git
<<<<<<< HEAD
cd contracts
npm install
```bash
git clone https://github.com/luxdefi/evm.git
=======
>>>>>>> fd08c47 (Update import path)
cd contracts
npm install
```
@@ -38,7 +41,7 @@ npm install
`AllowList.sol` is the base contract which provided AllowList precompile capabilities to inheriting contracts.
`ERC20NativeMinter.sol` is based on [Open Zeppelin](https://openzeppelin.com) [ERC20](https://eips.ethereum.org/EIPS/eip-20) contract powered by native minting capabilities of Subnet EVM. ERC20 is a popular smart contract interface. It uses `INativeMinter` interface to interact with `NativeMinter` precompile.
`ERC20NativeMinter.sol` is based on [Open Zeppelin](https://openzeppelin.com) [ERC20](https://eips.ethereum.org/EIPS/eip-20) contract powered by native minting capabilities of EVM. ERC20 is a popular smart contract interface. It uses `INativeMinter` interface to interact with `NativeMinter` precompile.
`ExampleDeployerList` shows how `ContractDeployerAllowList` precompile can be used in a smart contract. It uses `IAllowList` to interact with `ContractDeployerAllowList` precompile. When the precompile is activated only those allowed can deploy contracts.
@@ -52,7 +55,11 @@ For more information about precompiles see [evm precompiles](https://github.com/
Hardhat uses `hardhat.config.js` as the configuration file. You can define tasks, networks, compilers and more in that file. For more information see [here](https://hardhat.org/config/).
<<<<<<< HEAD
In Subnet-EVM, we provide a pre-configured file [hardhat.config.ts](https://github.com/luxdefi/lux-smart-contract-quickstart/blob/main/hardhat.config.ts).
=======
In EVM, we provide a pre-configured file [hardhat.config.ts](https://github.com/luxdefi/evm/blob/master/contracts/hardhat.config.ts).
>>>>>>> fd08c47 (Update import path)
The HardHat config file includes a single network configuration: `local`. `local` defaults to using the following values for the RPC URL and the Chain ID:
@@ -61,7 +68,7 @@ var local_rpc_uri = process.env.RPC_URI || "http://127.0.0.1:9650/ext/bc/C/rpc";
var local_chain_id = process.env.CHAIN_ID || 99999;
```
You can use this network configuration by providing the environment variables and specifying the `--network` flag, as Subnet-EVM does in its testing suite:
You can use this network configuration by providing the environment variables and specifying the `--network` flag, as EVM does in its testing suite:
```bash
RPC_URI=http://127.0.0.1:9650/ext/bc/28N1Tv5CZziQ3FKCaXmo8xtxoFtuoVA6NvZykAT5MtGjF4JkGs/rpc CHAIN_ID=77777 npx hardhat test --network local
@@ -105,11 +112,11 @@ You can define custom hardhat tasks in [tasks.ts](https://github.com/luxdefi/lux
## Tests
Tests are written for a local network which runs a Subnet-EVM Blockchain.
Tests are written for a local network which runs a EVM Blockchain.
E.g `RPC_URI=http://127.0.0.1:9650/ext/bc/28N1Tv5CZziQ3FKCaXmo8xtxoFtuoVA6NvZykAT5MtGjF4JkGs/rpc CHAIN_ID=77777 npx hardhat test --network local`.
Subnet-EVM must activate any precompiles used in the test in the genesis:
EVM must activate any precompiles used in the test in the genesis:
```json
{
+2 -2
View File
@@ -1,11 +1,11 @@
{
"name": "@luxdefi/subnet-evm-contracts",
"name": "@luxdefi/evm-contracts",
"version": "1.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@luxdefi/subnet-evm-contracts",
"name": "@luxdefi/evm-contracts",
"version": "1.1.0",
"license": "BSD-3-Clause",
"dependencies": {
+4
View File
@@ -1,5 +1,9 @@
{
<<<<<<< HEAD
"name": "@luxdefi/evm-contracts",
=======
"name": "@avalabs/evm-contracts",
>>>>>>> fd08c47 (Update import path)
"devDependencies": {
"@types/chai": "^4.3.5",
"@types/mocha": "^9.0.0",
+1 -1
View File
@@ -10,7 +10,7 @@ When the consensus engine verifies blocks as they are ready to be issued into co
InsertBlockManual verifies the block, inserts it into the state manager to track the merkle trie for the block, and adds it to the canonical chain if it extends the currently preferred chain.
Subnet-EVM adds functions for Accept and Reject, which take care of marking a block as finalized and performing garbage collection where possible.
EVM adds functions for Accept and Reject, which take care of marking a block as finalized and performing garbage collection where possible.
The consensus engine can also call `SetPreference` on a VM to tell the VM that a specific block is preferred by the consensus engine to be accepted. This triggers a call to `reorg` the blockchain and set the newly preferred block as the preferred chain.
+1 -1
View File
@@ -384,7 +384,7 @@ func (bc *BlockChain) GetFeeConfigAt(parent *types.Header) (commontype.FeeConfig
// If fee recipients are allowed, returns true in the second return value.
func (bc *BlockChain) GetCoinbaseAt(parent *types.Header) (common.Address, bool, error) {
config := bc.Config()
if !config.IsSubnetEVM(parent.Time) {
if !config.IsEVM(parent.Time) {
return constants.BlackholeAddr, false, nil
}
+1 -1
View File
@@ -880,7 +880,7 @@ func TestTxLookupBlockChain(t *testing.T) {
func TestCreateThenDeletePreByzantium(t *testing.T) {
// We want to use pre-byzantium rules where we have intermediate state roots
// between transactions.
config := *params.TestPreSubnetEVMConfig
config := *params.TestPreEVMConfig
config.ByzantiumBlock = nil
config.ConstantinopleBlock = nil
config.PetersburgBlock = nil
+1 -1
View File
@@ -336,7 +336,7 @@ func makeHeader(chain consensus.ChainReader, config *params.ChainConfig, parent
Time: time,
}
if chain.Config().IsSubnetEVM(time) {
if chain.Config().IsEVM(time) {
feeConfig, _, err := chain.GetFeeConfigAt(parent.Header())
if err != nil {
panic(err)
+1 -1
View File
@@ -326,7 +326,7 @@ func (g *Genesis) toBlock(db ethdb.Database, triedb *trie.Database) *types.Block
if g.Difficulty == nil {
head.Difficulty = params.GenesisDifficulty
}
if g.Config != nil && g.Config.IsSubnetEVM(0) {
if g.Config != nil && g.Config.IsEVM(0) {
if g.BaseFee != nil {
head.BaseFee = g.BaseFee
} else {
+6 -6
View File
@@ -62,8 +62,8 @@ func TestGenesisBlockForTesting(t *testing.T) {
}
func TestSetupGenesis(t *testing.T) {
preSubnetConfig := *params.TestPreSubnetEVMConfig
preSubnetConfig.SubnetEVMTimestamp = utils.NewUint64(100)
preSubnetConfig := *params.TestPreEVMConfig
preSubnetConfig.EVMTimestamp = utils.NewUint64(100)
var (
customghash = common.HexToHash("0x4a12fe7bf8d40d152d7e9de22337b115186a4662aa3a97217b36146202bbfc66")
customg = Genesis{
@@ -77,7 +77,7 @@ func TestSetupGenesis(t *testing.T) {
)
rollbackpreSubnetConfig := preSubnetConfig
rollbackpreSubnetConfig.SubnetEVMTimestamp = utils.NewUint64(90)
rollbackpreSubnetConfig.EVMTimestamp = utils.NewUint64(90)
oldcustomg.Config = &rollbackpreSubnetConfig
tests := []struct {
name string
@@ -123,8 +123,8 @@ func TestSetupGenesis(t *testing.T) {
{
name: "incompatible config for lux fork in DB",
fn: func(db ethdb.Database) (*params.ChainConfig, common.Hash, error) {
// Commit the 'old' genesis block with SubnetEVM transition at 90.
// Advance to block #4, past the SubnetEVM transition block of customg.
// Commit the 'old' genesis block with EVM transition at 90.
// Advance to block #4, past the EVM transition block of customg.
genesis := oldcustomg.MustCommit(db)
bc, _ := NewBlockChain(db, DefaultCacheConfig, &oldcustomg, dummy.NewFullFaker(), vm.Config{}, genesis.Hash(), false)
@@ -145,7 +145,7 @@ func TestSetupGenesis(t *testing.T) {
wantHash: customghash,
wantConfig: customg.Config,
wantErr: &params.ConfigCompatError{
What: "SubnetEVM fork block timestamp",
What: "EVM fork block timestamp",
StoredTime: u64(90),
NewTime: u64(100),
RewindToTime: 89,
+4
View File
@@ -30,6 +30,10 @@ import (
"fmt"
"sync"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/ethdb"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
+4
View File
@@ -29,6 +29,10 @@ package state
import (
"testing"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/core/rawdb"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/luxdefi/evm/core/rawdb"
+1 -1
View File
@@ -435,7 +435,7 @@ const warningLog = `
WARNING!
The clean trie cache is not found. Please delete it by yourself after the
pruning. Remember don't start the Subnet-EVM without deleting the clean trie cache
pruning. Remember don't start the EVM without deleting the clean trie cache
otherwise the entire database may be damaged!
Check the configuration option "offline-pruning-enabled" for more details.
+1 -1
View File
@@ -1172,7 +1172,7 @@ func (s *StateDB) commit(deleteEmptyObjects bool, snaps *snapshot.Tree, blockHas
// - Add coinbase to access list (EIP-3651/DUpgrade)
// - Reset transient storage (EIP-1153)
func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, dst *common.Address, precompiles []common.Address, list types.AccessList) {
if rules.IsSubnetEVM {
if rules.IsEVM {
// Clear out any leftover from previous executions
al := newAccessList()
s.accessList = al
+3 -3
View File
@@ -319,7 +319,7 @@ func TestStateProcessorErrors(t *testing.T) {
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
MandatoryNetworkUpgrades: params.MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
EVMTimestamp: utils.NewUint64(0),
DUpgradeTimestamp: utils.NewUint64(0),
},
FeeConfig: params.DefaultFeeConfig,
@@ -387,7 +387,7 @@ func TestBadTxAllowListBlock(t *testing.T) {
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
MandatoryNetworkUpgrades: params.MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
EVMTimestamp: utils.NewUint64(0),
},
GenesisPrecompiles: params.Precompiles{
txallowlist.ConfigKey: txallowlist.NewConfig(utils.NewUint64(0), nil, nil, nil),
@@ -465,7 +465,7 @@ func GenerateBadBlock(parent *types.Block, engine consensus.Engine, txs types.Tr
UncleHash: types.EmptyUncleHash,
}
if config.IsSubnetEVM(header.Time) {
if config.IsEVM(header.Time) {
header.Extra, header.BaseFee, _ = dummy.CalcBaseFee(config, config.FeeConfig, parent.Header(), header.Time)
header.BlockGasCost = big.NewInt(0)
}
+2 -2
View File
@@ -343,7 +343,7 @@ func (st *StateTransition) preCheck() error {
}
// Make sure that transaction gasFeeCap is greater than the baseFee (post london)
if st.evm.ChainConfig().IsSubnetEVM(st.evm.Context.Time) {
if st.evm.ChainConfig().IsEVM(st.evm.Context.Time) {
// Skip the checks if gas fields are zero and baseFee was explicitly disabled (eth_call)
if !st.evm.Config.NoBaseFee || msg.GasFeeCap.BitLen() > 0 || msg.GasTipCap.BitLen() > 0 {
if l := msg.GasFeeCap.BitLen(); l > 256 {
@@ -445,7 +445,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
st.state.SetNonce(msg.From, st.state.GetNonce(sender.Address())+1)
ret, st.gasRemaining, vmerr = st.evm.Call(sender, st.to(), msg.Data, st.gasRemaining, msg.Value)
}
st.refundGas(rules.IsSubnetEVM)
st.refundGas(rules.IsEVM)
st.state.AddBalance(st.evm.Context.Coinbase, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), msg.GasPrice))
return &ExecutionResult{
+11 -8
View File
@@ -43,7 +43,10 @@ import (
"github.com/luxdefi/evm/core/types"
"github.com/luxdefi/evm/metrics"
"github.com/luxdefi/evm/params"
<<<<<<< HEAD
"github.com/luxdefi/evm/precompile"
=======
>>>>>>> fd08c47 (Update import path)
"github.com/luxdefi/evm/precompile/contracts/feemanager"
"github.com/luxdefi/evm/precompile/contracts/txallowlist"
"github.com/luxdefi/evm/utils"
@@ -119,7 +122,7 @@ var (
var (
evictionInterval = time.Minute // Time interval to check for evictable transactions
statsReportInterval = 8 * time.Second // Time interval to report transaction pool stats
baseFeeUpdateInterval = 10 * time.Second // Time interval at which to schedule a base fee update for the tx pool after SubnetEVM is enabled
baseFeeUpdateInterval = 10 * time.Second // Time interval at which to schedule a base fee update for the tx pool after EVM is enabled
)
var (
@@ -1433,7 +1436,7 @@ func (pool *TxPool) runReorg(done chan struct{}, reset *txpoolResetRequest, dirt
// because of another transaction (e.g. higher gas price).
if reset != nil {
pool.demoteUnexecutables()
if reset.newHead != nil && pool.chainconfig.IsSubnetEVM(reset.newHead.Time) {
if reset.newHead != nil && pool.chainconfig.IsEVM(reset.newHead.Time) {
if err := pool.updateBaseFeeAt(reset.newHead); err != nil {
log.Error("error at updating base fee in tx pool", "error", err)
}
@@ -1579,8 +1582,8 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
rules := pool.chainconfig.LuxRules(next, newHead.Time)
pool.rules.Store(&rules)
pool.eip2718.Store(rules.IsSubnetEVM)
pool.eip1559.Store(rules.IsSubnetEVM)
pool.eip2718.Store(rules.IsEVM)
pool.eip1559.Store(rules.IsEVM)
pool.eip3860.Store(rules.IsDUpgrade)
}
@@ -1847,13 +1850,13 @@ func (pool *TxPool) demoteUnexecutables() {
}
func (pool *TxPool) startPeriodicFeeUpdate() {
if pool.chainconfig.SubnetEVMTimestamp == nil {
if pool.chainconfig.EVMTimestamp == nil {
return
}
// Call updateBaseFee here to ensure that there is not a [baseFeeUpdateInterval] delay
// when starting up in Subnet EVM before the base fee is updated.
if time.Now().After(utils.Uint64ToTime(pool.chainconfig.SubnetEVMTimestamp)) {
// when starting up in EVM before the base fee is updated.
if time.Now().After(utils.Uint64ToTime(pool.chainconfig.EVMTimestamp)) {
pool.updateBaseFee()
}
@@ -1866,7 +1869,7 @@ func (pool *TxPool) periodicBaseFeeUpdate() {
// Sleep until its time to start the periodic base fee update or the tx pool is shutting down
select {
case <-time.After(time.Until(utils.Uint64ToTime(pool.chainconfig.SubnetEVMTimestamp))):
case <-time.After(time.Until(utils.Uint64ToTime(pool.chainconfig.EVMTimestamp))):
case <-pool.generalShutdownChan:
return // Return early if shutting down
}
+6
View File
@@ -30,6 +30,12 @@ import (
"math/big"
"testing"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/core/rawdb"
"github.com/luxdefi/evm/core/state"
"github.com/luxdefi/evm/core/types"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/event"
+4 -1
View File
@@ -48,7 +48,10 @@ import (
"github.com/luxdefi/evm/params"
"github.com/luxdefi/evm/trie"
"github.com/luxdefi/evm/utils"
<<<<<<< HEAD
=======
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/event"
@@ -82,7 +85,7 @@ func init() {
cpy := *params.TestChainConfig
eip1559Config = &cpy
eip1559Config.SubnetEVMTimestamp = utils.NewUint64(0)
eip1559Config.EVMTimestamp = utils.NewUint64(0)
}
type testBlockChain struct {
+1 -1
View File
@@ -90,7 +90,7 @@ type Header struct {
// BaseFee was added by EIP-1559 and is ignored in legacy headers.
BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"`
// BlockGasCost was added by SubnetEVM and is ignored in legacy
// BlockGasCost was added by EVM and is ignored in legacy
// headers.
BlockGasCost *big.Int `json:"blockGasCost" rlp:"optional"`
+1 -1
View File
@@ -304,7 +304,7 @@ func makeBenchBlock() *Block {
return NewBlock(header, txs, uncles, receipts, newHasher())
}
func TestSubnetEVMBlockEncoding(t *testing.T) {
func TestEVMBlockEncoding(t *testing.T) {
blockEnc := common.FromHex("f9030ff90202a083cafc574e1f51ba9dc0568fc617a08ea2429fb384059c972f13b19fa1c8dd55a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017a05fe50b260da6308036625b850b5d6ced6d0a9f814c0688bc91ffb7b7a3a54b67a0bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd8825208845506eb0780a0bd4472abb6659ebe3ee06ee4d7b72a00a9f4d001caca51342001075469aff49888a13a5a8c8f2bb1c4843b9aca00830186a0f90106f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba09bea4c4daac7c7c52e093e6a4c35dbbcf8856f1af7b059ba20253e70848d094fa08a8fae537ce25ed8cb5af9adac3f141af69bd515bd2ba031522df09b97dd72b1b8a302f8a0018080843b9aca008301e24194095e7baea6a6c7c4c2dfeb977efac326af552d878080f838f7940000000000000000000000000000000000000001e1a0000000000000000000000000000000000000000000000000000000000000000080a0fe38ca4e44a30002ac54af7cf922a6ac2ba11b7d22f548e8ecb3f51f41cb31b0a06de6a5cbae13c0c856e33acf021b51819636cfc009d39eafb9f606d546e305a8c0")
var block Block
+2 -2
View File
@@ -51,7 +51,7 @@ func MakeSigner(config *params.ChainConfig, blockNumber *big.Int, blockTime uint
switch {
case config.IsCancun(blockTime):
return NewCancunSigner(config.ChainID)
case config.IsSubnetEVM(blockTime):
case config.IsEVM(blockTime):
return NewLondonSigner(config.ChainID)
case config.IsEIP155(blockNumber):
return NewEIP155Signer(config.ChainID)
@@ -74,7 +74,7 @@ func LatestSigner(config *params.ChainConfig) Signer {
if config.CancunTime != nil {
return NewCancunSigner(config.ChainID)
}
if config.SubnetEVMTimestamp != nil {
if config.EVMTimestamp != nil {
return NewLondonSigner(config.ChainID)
}
if config.EIP155Block != nil {
+4 -1
View File
@@ -37,7 +37,10 @@ import (
"github.com/luxdefi/evm/precompile/contract"
"github.com/luxdefi/evm/precompile/modules"
"github.com/luxdefi/evm/vmerrs"
<<<<<<< HEAD
=======
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/crypto"
@@ -170,7 +173,7 @@ func init() {
// ActivePrecompiles returns the precompiles enabled with the current configuration.
func ActivePrecompiles(rules params.Rules) []common.Address {
switch {
case rules.IsSubnetEVM:
case rules.IsEVM:
return PrecompiledAddressesBerlin
case rules.IsIstanbul:
return PrecompiledAddressesIstanbul
+3 -3
View File
@@ -77,7 +77,7 @@ type (
func (evm *EVM) precompile(addr common.Address) (contract.StatefulPrecompiledContract, bool) {
var precompiles map[common.Address]contract.StatefulPrecompiledContract
switch {
case evm.chainRules.IsSubnetEVM:
case evm.chainRules.IsEVM:
precompiles = PrecompiledContractsBerlin
case evm.chainRules.IsIstanbul:
precompiles = PrecompiledContractsIstanbul
@@ -521,7 +521,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
evm.StateDB.SetNonce(caller.Address(), nonce+1)
// We add this to the access list _before_ taking a snapshot. Even if the creation fails,
// the access-list change should not be rolled back
if evm.chainRules.IsSubnetEVM {
if evm.chainRules.IsEVM {
evm.StateDB.AddAddressToAccessList(address)
}
// Ensure there's no existing contract already at the designated address
@@ -566,7 +566,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
}
// Reject code starting with 0xEF if EIP-3541 is enabled.
if err == nil && len(ret) >= 1 && ret[0] == 0xEF && evm.chainRules.IsSubnetEVM {
if err == nil && len(ret) >= 1 && ret[0] == 0xEF && evm.chainRules.IsEVM {
err = vmerrs.ErrInvalidCode
}
+10 -2
View File
@@ -33,6 +33,14 @@ import (
"sort"
"testing"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/core/rawdb"
"github.com/luxdefi/evm/core/state"
"github.com/luxdefi/evm/core/types"
"github.com/luxdefi/evm/params"
"github.com/luxdefi/evm/vmerrs"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/luxdefi/evm/core/rawdb"
@@ -161,9 +169,9 @@ func TestCreateGas(t *testing.T) {
config.ExtraEips = []int{3860}
}
// Note: we use TestSubnetEVMConfig instead of AllEthashProtocolChanges (upstream)
// Note: we use TestEVMConfig instead of AllEthashProtocolChanges (upstream)
// because it is the last fork before the activation of EIP-3860
vmenv := NewEVM(vmctx, TxContext{}, statedb, params.TestSubnetEVMConfig, config)
vmenv := NewEVM(vmctx, TxContext{}, statedb, params.TestEVMConfig, config)
var startGas = uint64(testGas)
ret, gas, err := vmenv.Call(AccountRef(common.Address{}), address, nil, startGas, new(big.Int))
if err != nil {
+1 -1
View File
@@ -72,7 +72,7 @@ func NewEVMInterpreter(evm *EVM) *EVMInterpreter {
switch {
case evm.chainRules.IsDUpgrade:
table = &dUpgradeInstructionSet
case evm.chainRules.IsSubnetEVM:
case evm.chainRules.IsEVM:
table = &subnetEVMInstructionSet
case evm.chainRules.IsIstanbul:
table = &istanbulInstructionSet
+8 -2
View File
@@ -62,7 +62,7 @@ var (
byzantiumInstructionSet = newByzantiumInstructionSet()
constantinopleInstructionSet = newConstantinopleInstructionSet()
istanbulInstructionSet = newIstanbulInstructionSet()
subnetEVMInstructionSet = newSubnetEVMInstructionSet()
subnetEVMInstructionSet = newEVMInstructionSet()
dUpgradeInstructionSet = newDUpgradeInstructionSet()
)
@@ -90,15 +90,21 @@ func validate(jt JumpTable) JumpTable {
// newDUpgradeInstructionSet returns the frontier, homestead, byzantium,
// constantinople, istanbul, petersburg, evm, d-upgrade instructions.
func newDUpgradeInstructionSet() JumpTable {
instructionSet := newSubnetEVMInstructionSet()
instructionSet := newEVMInstructionSet()
enable3855(&instructionSet) // PUSH0 instruction
enable3860(&instructionSet) // Limit and meter initcode
return validate(instructionSet)
}
<<<<<<< HEAD
// newSubnetEVMInstructionSet returns the frontier, homestead, byzantium,
// constantinople, istanbul, petersburg, evm instructions.
func newSubnetEVMInstructionSet() JumpTable {
=======
// newEVMInstructionSet returns the frontier, homestead, byzantium,
// constantinople, istanbul, petersburg, evm instructions.
func newEVMInstructionSet() JumpTable {
>>>>>>> fd08c47 (Update import path)
instructionSet := newIstanbulInstructionSet()
enable2929(&instructionSet)
enable3198(&instructionSet) // Base fee opcode https://eips.ethereum.org/EIPS/eip-3198
+2 -2
View File
@@ -26,8 +26,8 @@ func LookupInstructionSet(rules params.Rules) (JumpTable, error) {
switch {
case rules.IsDUpgrade:
return newDUpgradeInstructionSet(), nil
case rules.IsSubnetEVM:
return newSubnetEVMInstructionSet(), nil
case rules.IsEVM:
return newEVMInstructionSet(), nil
case rules.IsIstanbul:
return newIstanbulInstructionSet(), nil
case rules.IsConstantinople:
+1 -1
View File
@@ -74,7 +74,7 @@ func setDefaults(cfg *Config) {
IstanbulBlock: new(big.Int),
MuirGlacierBlock: new(big.Int),
MandatoryNetworkUpgrades: params.MandatoryNetworkUpgrades{
SubnetEVMTimestamp: new(uint64),
EVMTimestamp: new(uint64),
},
}
}
+13
View File
@@ -33,6 +33,19 @@ import (
"strings"
"testing"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/accounts/abi"
"github.com/luxdefi/evm/consensus"
"github.com/luxdefi/evm/core"
"github.com/luxdefi/evm/core/rawdb"
"github.com/luxdefi/evm/core/state"
"github.com/luxdefi/evm/core/types"
"github.com/luxdefi/evm/core/vm"
"github.com/luxdefi/evm/eth/tracers"
"github.com/luxdefi/evm/eth/tracers/logger"
"github.com/luxdefi/evm/params"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/asm"
"github.com/luxdefi/evm/accounts/abi"
+1 -1
View File
@@ -172,7 +172,7 @@ func New(
if !config.SkipBcVersionCheck {
if bcVersion != nil && *bcVersion > core.BlockChainVersion {
return nil, fmt.Errorf("database version is v%d, Subnet-EVM %s only supports v%d", *bcVersion, params.VersionWithMeta, core.BlockChainVersion)
return nil, fmt.Errorf("database version is v%d, EVM %s only supports v%d", *bcVersion, params.VersionWithMeta, core.BlockChainVersion)
} else if bcVersion == nil || *bcVersion < core.BlockChainVersion {
log.Warn("Upgrade blockchain database version", "from", dbVer, "to", core.BlockChainVersion)
rawdb.WriteDatabaseVersion(chainDb, core.BlockChainVersion)
+1 -1
View File
@@ -220,7 +220,7 @@ func NewOracle(backend OracleBackend, config Config) (*Oracle, error) {
}
// EstimateBaseFee returns an estimate of what the base fee will be on a block
// produced at the current time. If SubnetEVM has not been activated, it may
// produced at the current time. If EVM has not been activated, it may
// return a nil value and a nil error.
func (oracle *Oracle) EstimateBaseFee(ctx context.Context) (*big.Int, error) {
_, baseFee, err := oracle.suggestDynamicFees(ctx)
+2 -2
View File
@@ -328,10 +328,10 @@ func TestSuggestTipCapMinGas(t *testing.T) {
}, defaultOracleConfig())
}
// Regression test to ensure that SuggestPrice does not panic with activation of Subnet EVM
// Regression test to ensure that SuggestPrice does not panic with activation of EVM
// Note: support for gas estimation without activated hard forks has been deprecated, but we still
// ensure that the call does not panic.
func TestSuggestGasPriceSubnetEVM(t *testing.T) {
func TestSuggestGasPriceEVM(t *testing.T) {
config := Config{
Blocks: 20,
Percentile: 60,
+2 -2
View File
@@ -1048,8 +1048,8 @@ func overrideConfig(original *params.ChainConfig, override *params.ChainConfig)
*copy = *original
canon := true
if timestamp := override.SubnetEVMTimestamp; timestamp != nil {
copy.SubnetEVMTimestamp = timestamp
if timestamp := override.EVMTimestamp; timestamp != nil {
copy.EVMTimestamp = timestamp
canon = false
}
if timestamp := override.DUpgradeTimestamp; timestamp != nil {
+2 -2
View File
@@ -226,7 +226,7 @@ func TestTraceCall(t *testing.T) {
// Initialize test accounts
accounts := newAccounts(3)
genesis := &core.Genesis{
Config: params.TestSubnetEVMConfig, // TODO: go-ethereum has not enabled Shanghai yet, so we use SubnetEVM here so tests pass.
Config: params.TestEVMConfig, // TODO: go-ethereum has not enabled Shanghai yet, so we use EVM here so tests pass.
Alloc: core.GenesisAlloc{
accounts[0].addr: {Balance: big.NewInt(params.Ether)},
accounts[1].addr: {Balance: big.NewInt(params.Ether)},
@@ -493,7 +493,7 @@ func TestTracingWithOverrides(t *testing.T) {
accounts := newAccounts(3)
storageAccount := common.Address{0x13, 37}
genesis := &core.Genesis{
Config: params.TestSubnetEVMConfig, // TODO: go-ethereum has not enabled Shanghai yet, so we use SubnetEVM here so tests pass.
Config: params.TestEVMConfig, // TODO: go-ethereum has not enabled Shanghai yet, so we use EVM here so tests pass.
Alloc: core.GenesisAlloc{
accounts[0].addr: {Balance: big.NewInt(params.Ether)},
accounts[1].addr: {Balance: big.NewInt(params.Ether)},
@@ -364,7 +364,7 @@ func TestInternals(t *testing.T) {
Balance: big.NewInt(500000000000000),
},
}, false)
evm := vm.NewEVM(context, txContext, statedb, params.TestPreSubnetEVMConfig, vm.Config{Tracer: tc.tracer})
evm := vm.NewEVM(context, txContext, statedb, params.TestPreEVMConfig, vm.Config{Tracer: tc.tracer})
msg := &core.Message{
To: &to,
From: origin,
+1 -2
View File
@@ -18,7 +18,7 @@ require (
github.com/deckarep/golang-set/v2 v2.5.0
github.com/docker/docker v1.6.2
github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d
github.com/ethereum/go-ethereum v1.13.5
github.com/ethereum/go-ethereum v1.10.26
github.com/fjl/memsize v0.0.2
github.com/fsnotify/fsnotify v1.7.0
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08
@@ -34,7 +34,6 @@ require (
github.com/kylelemons/godebug v1.1.0
github.com/luxdefi/netrunner v1.7.7
github.com/luxdefi/node v1.10.21
github.com/luxdefi/subnet-evm/cmd/simulator v0.0.0-20231213204502-b36c20f67043
github.com/mattn/go-colorable v0.1.13
github.com/mattn/go-isatty v0.0.20
github.com/olekukonko/tablewriter v0.0.5
+4 -2
View File
@@ -111,6 +111,8 @@ github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA
github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM=
github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY=
github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-ethereum v1.10.26 h1:i/7d9RBBwiXCEuyduBQzJw/mKmnvzsN14jqBmytw72s=
github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg=
github.com/ethereum/go-ethereum v1.13.5 h1:U6TCRciCqZRe4FPXmy1sMGxTfuk8P7u2UoinF3VbaFk=
github.com/ethereum/go-ethereum v1.13.5/go.mod h1:yMTu38GSuyxaYzQMViqNmQ1s3cE84abZexQmTgenWk0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
@@ -253,12 +255,12 @@ github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/luxdefi/coreth v0.12.17 h1:mp4AYusy1xOYNUKZf/zWI6MOChTN0XVt0KY2uS3ZvYc=
github.com/luxdefi/coreth v0.12.17/go.mod h1:gv8FGIdyt/rlG76L69tAE09TIE7i2Di10VHV1mHXNfM=
github.com/luxdefi/evm/cmd/simulator v0.0.0-20231213204502-b36c20f67043 h1:mgd4lnXKgBDLS1ZprA03wy2+Iqrr2zElvqbu/D0gVOI=
github.com/luxdefi/evm/cmd/simulator v0.0.0-20231213204502-b36c20f67043/go.mod h1:HLEJMXRlxFxdlTSUVh4Os7r7Bu+AvCvPQKFLduTc+tQ=
github.com/luxdefi/netrunner v1.7.7 h1:jlOb8s2FD77ITSRDZUspLDfjTHoX3HhnxE947jZiJv4=
github.com/luxdefi/netrunner v1.7.7/go.mod h1:oTKVuaE251VRjhgjC1b995f26CQhDiQ7VebIYYCZklo=
github.com/luxdefi/node v1.10.21 h1:ghv9Rm54RikLXplQoOeerreiq/6srYSBxi7QkffOr28=
github.com/luxdefi/node v1.10.21/go.mod h1:8we3V7J7ZiXtgljc6UD911fatRnIT5ukkk3jA4d9IWg=
github.com/luxdefi/subnet-evm/cmd/simulator v0.0.0-20231213204502-b36c20f67043 h1:LYbXbN3sbVcYna0Dczkw3rKkX3Z2vENh5zLiAH1dd7Y=
github.com/luxdefi/subnet-evm/cmd/simulator v0.0.0-20231213204502-b36c20f67043/go.mod h1:HLEJMXRlxFxdlTSUVh4Os7r7Bu+AvCvPQKFLduTc+tQ=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
+4
View File
@@ -32,6 +32,10 @@ import (
"errors"
"math/big"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/core/types"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/luxdefi/evm/core/types"
)
+4
View File
@@ -35,6 +35,10 @@ import (
"path/filepath"
"runtime"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/internal/flags"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/log"
"github.com/fjl/memsize/memsizeui"
"github.com/luxdefi/evm/internal/flags"
+2 -2
View File
@@ -1377,7 +1377,7 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *param
// a `BlockchainAPI`.
func (s *BlockChainAPI) rpcMarshalHeader(ctx context.Context, header *types.Header) map[string]interface{} {
fields := RPCMarshalHeader(header)
// Note: Subnet-EVM enforces that the difficulty of a block is always 1, such that the total difficulty of a block
// Note: EVM enforces that the difficulty of a block is always 1, such that the total difficulty of a block
// will be equivalent to its height.
fields["totalDifficulty"] = (*hexutil.Big)(header.Number)
return fields
@@ -1391,7 +1391,7 @@ func (s *BlockChainAPI) rpcMarshalBlock(ctx context.Context, b *types.Block, inc
return nil, err
}
if inclTx {
// Note: Subnet-EVM enforces that the difficulty of a block is always 1, such that the total difficulty of a block
// Note: EVM enforces that the difficulty of a block is always 1, such that the total difficulty of a block
// will be equivalent to its height.
fields["totalDifficulty"] = (*hexutil.Big)(b.Number())
}
+3
View File
@@ -52,7 +52,10 @@ import (
"github.com/luxdefi/evm/ethdb"
"github.com/luxdefi/evm/params"
"github.com/luxdefi/evm/rpc"
<<<<<<< HEAD
=======
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
+4 -4
View File
@@ -168,9 +168,9 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b feeBackend) e
}
// Now attempt to fill in default value depending on whether London is active or not.
head := b.CurrentHeader()
if b.ChainConfig().IsSubnetEVM(head.Time) {
if b.ChainConfig().IsEVM(head.Time) {
// London is active, set maxPriorityFeePerGas and maxFeePerGas.
if err := args.setSubnetEVMFeeDefault(ctx, head, b); err != nil {
if err := args.setEVMFeeDefault(ctx, head, b); err != nil {
return err
}
} else {
@@ -188,8 +188,8 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b feeBackend) e
return nil
}
// setSubnetEVMFeeDefault fills in reasonable default fee values for unspecified fields.
func (args *TransactionArgs) setSubnetEVMFeeDefault(ctx context.Context, head *types.Header, b feeBackend) error {
// setEVMFeeDefault fills in reasonable default fee values for unspecified fields.
func (args *TransactionArgs) setEVMFeeDefault(ctx context.Context, head *types.Header, b feeBackend) error {
// Set maxPriorityFeePerGas if it is missing.
if args.MaxPriorityFeePerGas == nil {
tip, err := b.SuggestGasTipCap(ctx)
+1 -1
View File
@@ -227,7 +227,7 @@ func newBackendMock() *backendMock {
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
MandatoryNetworkUpgrades: params.MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(1000),
EVMTimestamp: utils.NewUint64(1000),
},
}
return &backendMock{
+1 -1
View File
@@ -2,7 +2,7 @@
The miner is a package inherited from go-ethereum with a large amount of functionality stripped out since it is not needed in evm.
In go-ethereum, the miner needs to perform PoW in order to try and produce the next block. Since Lux does not rely on PoW in any way, the miner within Subnet-EVM is only used to produce blocks on demand.
In go-ethereum, the miner needs to perform PoW in order to try and produce the next block. Since Lux does not rely on PoW in any way, the miner within EVM is only used to produce blocks on demand.
All of the async functionality has been stripped out in favor of a much lighter weight miner implementation which takes a backend that supplies the blockchain and transaction pool and exposes the functionality to produce a new block with the contents of the transaction pool.
+3 -3
View File
@@ -146,10 +146,10 @@ func (w *worker) commitNewWork(predicateContext *precompileconfig.PredicateConte
return nil, err
}
configuredGasLimit := feeConfig.GasLimit.Uint64()
if w.chainConfig.IsSubnetEVM(timestamp) {
if w.chainConfig.IsEVM(timestamp) {
gasLimit = configuredGasLimit
} else {
// The gas limit is set in SubnetEVMGasLimit because the ceiling and floor were set to the same value
// The gas limit is set in EVMGasLimit because the ceiling and floor were set to the same value
// such that the gas limit converged to it. Since this is hardbaked now, we remove the ability to configure it.
gasLimit = core.CalcGasLimit(parent.GasUsed, parent.GasLimit, configuredGasLimit, configuredGasLimit)
}
@@ -161,7 +161,7 @@ func (w *worker) commitNewWork(predicateContext *precompileconfig.PredicateConte
Time: timestamp,
}
if w.chainConfig.IsSubnetEVM(timestamp) {
if w.chainConfig.IsEVM(timestamp) {
var err error
header.Extra, header.BaseFee, err = dummy.CalcBaseFee(w.chainConfig, feeConfig, parent, timestamp)
if err != nil {
+1 -1
View File
@@ -56,7 +56,7 @@ type web3API struct {
// ClientVersion returns the node name
func (s *web3API) ClientVersion() string {
return s.stack.config.SubnetEVMVersion
return s.stack.config.EVMVersion
}
// Sha3 applies the ethereum sha3 implementation on the input.
+7 -1
View File
@@ -31,6 +31,12 @@ import (
"os"
"path/filepath"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/accounts"
"github.com/luxdefi/evm/accounts/external"
"github.com/luxdefi/evm/accounts/keystore"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/log"
"github.com/luxdefi/evm/accounts"
"github.com/luxdefi/evm/accounts/external"
@@ -60,7 +66,7 @@ type Config struct {
// InsecureUnlockAllowed allows user to unlock accounts in unsafe http environment.
InsecureUnlockAllowed bool `toml:",omitempty"`
SubnetEVMVersion string
EVMVersion string
}
// ExtRPCEnabled returns the indicator whether node enables the external
+32 -14
View File
@@ -32,6 +32,14 @@ import (
"fmt"
"math/big"
<<<<<<< HEAD
=======
"github.com/luxdefi/node/snow"
"github.com/luxdefi/evm/commontype"
"github.com/luxdefi/evm/precompile/modules"
"github.com/luxdefi/evm/precompile/precompileconfig"
"github.com/luxdefi/evm/utils"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/luxdefi/node/snow"
"github.com/luxdefi/evm/commontype"
@@ -45,7 +53,7 @@ const maxJSONLen = 64 * 1024 * 1024 // 64MB
var (
errNonGenesisForkByHeight = errors.New("evm only supports forking by height at the genesis block")
SubnetEVMChainID = big.NewInt(43214)
EVMChainID = big.NewInt(43214)
// For legacy tests
MinGasPrice int64 = 225_000_000_000
@@ -70,10 +78,10 @@ var (
)
var (
// SubnetEVMDefaultConfig is the default configuration
// EVMDefaultConfig is the default configuration
// without any network upgrades.
SubnetEVMDefaultChainConfig = &ChainConfig{
ChainID: SubnetEVMChainID,
EVMDefaultChainConfig = &ChainConfig{
ChainID: EVMChainID,
FeeConfig: DefaultFeeConfig,
AllowFeeRecipients: false,
@@ -105,15 +113,20 @@ var (
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
MandatoryNetworkUpgrades: MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
EVMTimestamp: utils.NewUint64(0),
DUpgradeTimestamp: utils.NewUint64(0),
},
GenesisPrecompiles: Precompiles{},
UpgradeConfig: UpgradeConfig{},
}
<<<<<<< HEAD
TestSubnetEVMConfig = &ChainConfig{
LuxContext: LuxContext{utils.TestSnowContext()},
=======
TestEVMConfig = &ChainConfig{
LuxContext: LuxContext{snow.DefaultContextTest()},
>>>>>>> fd08c47 (Update import path)
ChainID: big.NewInt(1),
FeeConfig: DefaultFeeConfig,
AllowFeeRecipients: false,
@@ -127,14 +140,19 @@ var (
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
MandatoryNetworkUpgrades: MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
EVMTimestamp: utils.NewUint64(0),
},
GenesisPrecompiles: Precompiles{},
UpgradeConfig: UpgradeConfig{},
}
<<<<<<< HEAD
TestPreSubnetEVMConfig = &ChainConfig{
LuxContext: LuxContext{utils.TestSnowContext()},
=======
TestPreEVMConfig = &ChainConfig{
LuxContext: LuxContext{snow.DefaultContextTest()},
>>>>>>> fd08c47 (Update import path)
ChainID: big.NewInt(1),
FeeConfig: DefaultFeeConfig,
AllowFeeRecipients: false,
@@ -278,12 +296,12 @@ func (c *ChainConfig) Description() string {
banner += fmt.Sprintf(" - Muir Glacier: #%-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/muir-glacier.md)\n", c.MuirGlacierBlock)
}
banner += "Mandatory Upgrades:\n"
banner += fmt.Sprintf(" - SubnetEVM Timestamp: @%-10v (https://github.com/luxdefi/node/releases/tag/v1.10.0)\n", ptrToString(c.SubnetEVMTimestamp))
banner += fmt.Sprintf(" - EVM Timestamp: @%-10v (https://github.com/luxdefi/node/releases/tag/v1.10.0)\n", ptrToString(c.EVMTimestamp))
banner += fmt.Sprintf(" - DUpgrade Timestamp: @%-10v (https://github.com/luxdefi/node/releases/tag/v1.11.0)\n", ptrToString(c.DUpgradeTimestamp))
banner += fmt.Sprintf(" - Cancun Timestamp: @%-10v (https://github.com/luxdefi/node/releases/tag/v1.11.0)\n", ptrToString(c.CancunTime))
banner += "\n"
// Add Subnet-EVM custom fields
// Add EVM custom fields
optionalNetworkUpgradeBytes, err := json.Marshal(c.OptionalNetworkUpgrades)
if err != nil {
optionalNetworkUpgradeBytes = []byte("cannot marshal OptionalNetworkUpgrades")
@@ -364,10 +382,10 @@ func (c *ChainConfig) IsIstanbul(num *big.Int) bool {
return utils.IsBlockForked(c.IstanbulBlock, num)
}
// IsSubnetEVM returns whether [time] represents a block
// with a timestamp after the SubnetEVM upgrade time.
func (c *ChainConfig) IsSubnetEVM(time uint64) bool {
return utils.IsTimestampForked(c.SubnetEVMTimestamp, time)
// IsEVM returns whether [time] represents a block
// with a timestamp after the EVM upgrade time.
func (c *ChainConfig) IsEVM(time uint64) bool {
return utils.IsTimestampForked(c.EVMTimestamp, time)
}
// IsDUpgrade returns whether [time] represents a block
@@ -721,7 +739,7 @@ type Rules struct {
IsCancun bool
// Rules for Lux releases
IsSubnetEVM bool
IsEVM bool
IsDUpgrade bool
// ActivePrecompiles maps addresses to stateful precompiled contracts that are enabled
@@ -768,7 +786,7 @@ func (c *ChainConfig) rules(num *big.Int, timestamp uint64) Rules {
func (c *ChainConfig) LuxRules(blockNum *big.Int, timestamp uint64) Rules {
rules := c.rules(blockNum, timestamp)
rules.IsSubnetEVM = c.IsSubnetEVM(timestamp)
rules.IsEVM = c.IsEVM(timestamp)
rules.IsDUpgrade = c.IsDUpgrade(timestamp)
// Initialize the stateful precompiles that should be enabled at [blockTimestamp].
+25 -6
View File
@@ -34,6 +34,13 @@ import (
"testing"
"time"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/precompile/contracts/nativeminter"
"github.com/luxdefi/evm/precompile/contracts/rewardmanager"
"github.com/luxdefi/evm/precompile/contracts/txallowlist"
"github.com/luxdefi/evm/utils"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/luxdefi/evm/precompile/contracts/nativeminter"
"github.com/luxdefi/evm/precompile/contracts/rewardmanager"
@@ -117,11 +124,11 @@ func TestCheckCompatible(t *testing.T) {
},
{
stored: TestChainConfig,
new: TestPreSubnetEVMConfig,
new: TestPreEVMConfig,
headBlock: 0,
headTimestamp: 0,
wantErr: &ConfigCompatError{
What: "SubnetEVM fork block timestamp",
What: "EVM fork block timestamp",
StoredTime: utils.NewUint64(0),
NewTime: nil,
RewindToTime: 0,
@@ -129,11 +136,11 @@ func TestCheckCompatible(t *testing.T) {
},
{
stored: TestChainConfig,
new: TestPreSubnetEVMConfig,
new: TestPreEVMConfig,
headBlock: 10,
headTimestamp: 100,
wantErr: &ConfigCompatError{
What: "SubnetEVM fork block timestamp",
What: "EVM fork block timestamp",
StoredTime: utils.NewUint64(0),
NewTime: nil,
RewindToTime: 0,
@@ -152,11 +159,12 @@ func TestCheckCompatible(t *testing.T) {
func TestConfigRules(t *testing.T) {
c := &ChainConfig{
MandatoryNetworkUpgrades: MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(500),
EVMTimestamp: utils.NewUint64(500),
},
}
var stamp uint64
<<<<<<< HEAD
if r := c.LuxRules(big.NewInt(0), stamp); r.IsSubnetEVM {
t.Errorf("expected %v to not be evm", stamp)
}
@@ -166,6 +174,17 @@ func TestConfigRules(t *testing.T) {
}
stamp = math.MaxInt64
if r := c.LuxRules(big.NewInt(0), stamp); !r.IsSubnetEVM {
=======
if r := c.LuxRules(big.NewInt(0), stamp); r.IsEVM {
t.Errorf("expected %v to not be evm", stamp)
}
stamp = 500
if r := c.LuxRules(big.NewInt(0), stamp); !r.IsEVM {
t.Errorf("expected %v to be evm", stamp)
}
stamp = math.MaxInt64
if r := c.LuxRules(big.NewInt(0), stamp); !r.IsEVM {
>>>>>>> fd08c47 (Update import path)
t.Errorf("expected %v to be evm", stamp)
}
}
@@ -273,7 +292,7 @@ func TestChainConfigMarshalWithUpgrades(t *testing.T) {
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
MandatoryNetworkUpgrades: MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
EVMTimestamp: utils.NewUint64(0),
DUpgradeTimestamp: utils.NewUint64(0),
},
GenesisPrecompiles: Precompiles{},
+10 -10
View File
@@ -9,22 +9,22 @@ import (
var (
LocalNetworkUpgrades = MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
EVMTimestamp: utils.NewUint64(0),
DUpgradeTimestamp: utils.NewUint64(0),
}
FujiNetworkUpgrades = MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
EVMTimestamp: utils.NewUint64(0),
// DUpgradeTimestamp: utils.NewUint64(0), // TODO: Uncomment and set this to the correct value
}
MainnetNetworkUpgrades = MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
EVMTimestamp: utils.NewUint64(0),
// DUpgradeTimestamp: utils.NewUint64(0), // TODO: Uncomment and set this to the correct value
}
UnitTestNetworkUpgrades = MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
EVMTimestamp: utils.NewUint64(0),
DUpgradeTimestamp: utils.NewUint64(0),
}
)
@@ -34,8 +34,8 @@ var (
// specified timestamp, it will be unable to participate in consensus.
// Lux specific network upgrades are also included here.
type MandatoryNetworkUpgrades struct {
// SubnetEVMTimestamp is a placeholder that activates Lux Upgrades prior to ApricotPhase6 (nil = no fork, 0 = already activated)
SubnetEVMTimestamp *uint64 `json:"subnetEVMTimestamp,omitempty"`
// EVMTimestamp is a placeholder that activates Lux Upgrades prior to ApricotPhase6 (nil = no fork, 0 = already activated)
EVMTimestamp *uint64 `json:"subnetEVMTimestamp,omitempty"`
// DUpgrade activates the Shanghai Execution Spec Upgrade from Ethereum (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md#included-eips)
// and Lux Warp Messaging. (nil = no fork, 0 = already activated)
// Note: EIP-4895 is excluded since withdrawals are not relevant to the Lux C-Chain or Subnets running the EVM.
@@ -45,8 +45,8 @@ type MandatoryNetworkUpgrades struct {
}
func (m *MandatoryNetworkUpgrades) CheckMandatoryCompatible(newcfg *MandatoryNetworkUpgrades, time uint64) *ConfigCompatError {
if isForkTimestampIncompatible(m.SubnetEVMTimestamp, newcfg.SubnetEVMTimestamp, time) {
return newTimestampCompatError("SubnetEVM fork block timestamp", m.SubnetEVMTimestamp, newcfg.SubnetEVMTimestamp)
if isForkTimestampIncompatible(m.EVMTimestamp, newcfg.EVMTimestamp, time) {
return newTimestampCompatError("EVM fork block timestamp", m.EVMTimestamp, newcfg.EVMTimestamp)
}
if isForkTimestampIncompatible(m.DUpgradeTimestamp, newcfg.DUpgradeTimestamp, time) {
return newTimestampCompatError("DUpgrade fork block timestamp", m.DUpgradeTimestamp, newcfg.DUpgradeTimestamp)
@@ -59,12 +59,12 @@ func (m *MandatoryNetworkUpgrades) CheckMandatoryCompatible(newcfg *MandatoryNet
func (m *MandatoryNetworkUpgrades) mandatoryForkOrder() []fork {
return []fork{
{name: "subnetEVMTimestamp", timestamp: m.SubnetEVMTimestamp},
{name: "subnetEVMTimestamp", timestamp: m.EVMTimestamp},
{name: "dUpgradeTimestamp", timestamp: m.DUpgradeTimestamp},
}
}
// OptionalNetworkUpgrades includes overridable and optional Subnet-EVM network upgrades.
// OptionalNetworkUpgrades includes overridable and optional EVM network upgrades.
// These can be specified in genesis and upgrade configs.
// Timestamps can be different for each subnet network.
// TODO: once we add the first optional upgrade here, we should uncomment TestVMUpgradeBytesOptionalNetworkUpgrades
+1 -1
View File
@@ -8,7 +8,7 @@ The VM creates the Ethereum backend and provides basic block building, parsing,
## APIs
The VM creates APIs for the node through the function `CreateHandlers()`. CreateHandlers returns the `Service` struct to serve Subnet-EVM specific APIs. Additionally, the Ethereum backend APIs are also returned at the `/rpc` extension.
The VM creates APIs for the node through the function `CreateHandlers()`. CreateHandlers returns the `Service` struct to serve EVM specific APIs. Additionally, the Ethereum backend APIs are also returned at the `/rpc` extension.
## Block Handling
+6 -1
View File
@@ -10,6 +10,11 @@ import (
"github.com/luxdefi/evm/params"
"github.com/luxdefi/evm/utils"
<<<<<<< HEAD
=======
"github.com/luxdefi/node/snow"
>>>>>>> fd08c47 (Update import path)
)
func attemptAwait(t *testing.T, wg *sync.WaitGroup, delay time.Duration) {
@@ -35,7 +40,7 @@ func TestBlockBuilderShutsDown(t *testing.T) {
wg := &sync.WaitGroup{}
config := *params.TestChainConfig
config.SubnetEVMTimestamp = utils.TimeToNewUint64(time.Now().Add(time.Hour))
config.EVMTimestamp = utils.TimeToNewUint64(time.Now().Add(time.Hour))
builder := &blockBuilder{
ctx: utils.TestSnowContext(),
+6 -6
View File
@@ -66,7 +66,7 @@ func (v blockValidator) SyntacticVerify(b *Block, rules params.Rules) error {
params.DynamicFeeExtraDataSize, len(ethHeader.Extra),
)
}
case rules.IsSubnetEVM:
case rules.IsEVM:
if len(ethHeader.Extra) != params.DynamicFeeExtraDataSize {
return fmt.Errorf(
"expected header ExtraData to be len %d but got %d",
@@ -82,9 +82,9 @@ func (v blockValidator) SyntacticVerify(b *Block, rules params.Rules) error {
}
}
if rules.IsSubnetEVM {
if rules.IsEVM {
if ethHeader.BaseFee == nil {
return errNilBaseFeeSubnetEVM
return errNilBaseFeeEVM
}
if bfLen := ethHeader.BaseFee.BitLen(); bfLen > 256 {
return fmt.Errorf("too large base fee: bitlen %d", bfLen)
@@ -112,7 +112,7 @@ func (v blockValidator) SyntacticVerify(b *Block, rules params.Rules) error {
return errEmptyBlock
}
if !rules.IsSubnetEVM {
if !rules.IsEVM {
// Make sure that all the txs have the correct fee set.
for _, tx := range txs {
if tx.GasPrice().Cmp(legacyMinGasPrice) < 0 {
@@ -127,12 +127,12 @@ func (v blockValidator) SyntacticVerify(b *Block, rules params.Rules) error {
return fmt.Errorf("block timestamp is too far in the future: %d > allowed %d", blockTimestamp, maxBlockTime)
}
if rules.IsSubnetEVM {
if rules.IsEVM {
switch {
// Make sure BlockGasCost is not nil
// NOTE: ethHeader.BlockGasCost correctness is checked in header verification
case ethHeader.BlockGasCost == nil:
return errNilBlockGasCostSubnetEVM
return errNilBlockGasCostEVM
case !ethHeader.BlockGasCost.IsUint64():
return fmt.Errorf("too large blockGasCost: %d", ethHeader.BlockGasCost)
}
+1 -1
View File
@@ -39,7 +39,7 @@ func NewClient(uri, chain string) Client {
// NewCChainClient returns a Client for interacting with the C Chain
func NewCChainClient(uri string) Client {
// TODO: Update for Subnet-EVM compatibility
// TODO: Update for EVM compatibility
return NewClient(uri, "C")
}
+1 -1
View File
@@ -86,7 +86,7 @@ type Config struct {
// Airdrop
AirdropFile string `json:"airdrop"`
// Subnet EVM APIs
// EVM APIs
SnowmanAPIEnabled bool `json:"snowman-api-enabled"`
WarpAPIEnabled bool `json:"warp-api-enabled"`
AdminAPIEnabled bool `json:"admin-api-enabled"`
+1 -1
View File
@@ -74,7 +74,7 @@ type pushGossiper struct {
}
// createGossiper constructs and returns a pushGossiper or noopGossiper
// based on whether vm.chainConfig.SubnetEVMTimestamp is set
// based on whether vm.chainConfig.EVMTimestamp is set
func (vm *VM) createGossiper(stats GossipStats) Gossiper {
net := &pushGossiper{
ctx: vm.ctx,
+9 -9
View File
@@ -18,30 +18,30 @@ const (
timeFormat = "2006-01-02T15:04:05-0700"
)
type SubnetEVMLogger struct {
type EVMLogger struct {
log.Handler
}
// InitLogger initializes logger with alias and sets the log level and format with the original [os.StdErr] interface
// along with the context logger.
func InitLogger(alias string, level string, jsonFormat bool, writer io.Writer) (SubnetEVMLogger, error) {
logFormat := SubnetEVMTermFormat(alias)
func InitLogger(alias string, level string, jsonFormat bool, writer io.Writer) (EVMLogger, error) {
logFormat := EVMTermFormat(alias)
if jsonFormat {
logFormat = SubnetEVMJSONFormat(alias)
logFormat = EVMJSONFormat(alias)
}
// Create handler
logHandler := log.StreamHandler(writer, logFormat)
c := SubnetEVMLogger{Handler: logHandler}
c := EVMLogger{Handler: logHandler}
if err := c.SetLogLevel(level); err != nil {
return SubnetEVMLogger{}, err
return EVMLogger{}, err
}
return c, nil
}
// SetLogLevel sets the log level of initialized log handler.
func (c *SubnetEVMLogger) SetLogLevel(level string) error {
func (c *EVMLogger) SetLogLevel(level string) error {
// Set log level
logLevel, err := log.LvlFromString(level)
if err != nil {
@@ -51,7 +51,7 @@ func (c *SubnetEVMLogger) SetLogLevel(level string) error {
return nil
}
func SubnetEVMTermFormat(alias string) log.Format {
func EVMTermFormat(alias string) log.Format {
prefix := fmt.Sprintf("<%s Chain>", alias)
return log.FormatFunc(func(r *log.Record) []byte {
location := fmt.Sprintf("%+v", r.Call)
@@ -61,7 +61,7 @@ func SubnetEVMTermFormat(alias string) log.Format {
})
}
func SubnetEVMJSONFormat(alias string) log.Format {
func EVMJSONFormat(alias string) log.Format {
prefix := fmt.Sprintf("%s Chain", alias)
return log.FormatFunc(func(r *log.Record) []byte {
props := make(map[string]interface{}, 5+len(r.Ctx)/2)
+1 -1
View File
@@ -10,7 +10,7 @@ import (
var (
// GitCommit is set by the build script
GitCommit string
// Version is the version of Subnet EVM
// Version is the version of EVM
Version string = "v0.5.10"
)
+7 -7
View File
@@ -147,8 +147,8 @@ var (
errInvalidBlock = errors.New("invalid block")
errInvalidNonce = errors.New("invalid nonce")
errUnclesUnsupported = errors.New("uncles unsupported")
errNilBaseFeeSubnetEVM = errors.New("nil base fee is invalid after subnetEVM")
errNilBlockGasCostSubnetEVM = errors.New("nil blockGasCost is invalid after subnetEVM")
errNilBaseFeeEVM = errors.New("nil base fee is invalid after subnetEVM")
errNilBlockGasCostEVM = errors.New("nil blockGasCost is invalid after subnetEVM")
errInvalidHeaderPredicateResults = errors.New("invalid header predicate results")
)
@@ -238,7 +238,7 @@ type VM struct {
bootstrapped bool
logger SubnetEVMLogger
logger EVMLogger
// State sync server and client
StateSyncServer
StateSyncClient
@@ -284,7 +284,7 @@ func (vm *VM) Initialize(
}
vm.logger = subnetEVMLogger
log.Info("Initializing Subnet EVM VM", "Version", Version, "Config", vm.config)
log.Info("Initializing EVM VM", "Version", Version, "Config", vm.config)
if len(fxs) > 0 {
return errUnsupportedFXs
@@ -321,7 +321,7 @@ func (vm *VM) Initialize(
}
if g.Config == nil {
g.Config = params.SubnetEVMDefaultChainConfig
g.Config = params.EVMDefaultChainConfig
}
mandatoryNetworkUpgrades, enforce := getMandatoryNetworkUpgrades(chainCtx.NetworkID)
@@ -512,7 +512,7 @@ func (vm *VM) initializeMetrics() error {
func (vm *VM) initializeChain(lastAcceptedHash common.Hash, ethConfig ethconfig.Config) error {
nodecfg := &node.Config{
SubnetEVMVersion: Version,
EVMVersion: Version,
KeyStoreDir: vm.config.KeystoreDirectory,
ExternalSigner: vm.config.KeystoreExternalSigner,
InsecureUnlockAllowed: vm.config.KeystoreInsecureUnlockAllowed,
@@ -761,7 +761,7 @@ func (vm *VM) Shutdown(context.Context) error {
vm.eth.Stop()
log.Info("Ethereum backend stop completed")
vm.shutdownWg.Wait()
log.Info("Subnet-EVM Shutdown completed")
log.Info("EVM Shutdown completed")
return nil
}
+39 -39
View File
@@ -80,9 +80,9 @@ var (
password = "CjasdjhiPeirbSenfeI13" // #nosec G101
// Use chainId: 43111, so that it does not overlap with any Lux ChainIDs, which may have their
// config overridden in vm.Initialize.
genesisJSONSubnetEVM = "{\"config\":{\"chainId\":43111,\"homesteadBlock\":0,\"eip150Block\":0,\"eip155Block\":0,\"eip158Block\":0,\"byzantiumBlock\":0,\"constantinopleBlock\":0,\"petersburgBlock\":0,\"istanbulBlock\":0,\"muirGlacierBlock\":0,\"subnetEVMTimestamp\":0},\"nonce\":\"0x0\",\"timestamp\":\"0x0\",\"extraData\":\"0x00\",\"gasLimit\":\"0x7A1200\",\"difficulty\":\"0x0\",\"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"coinbase\":\"0x0000000000000000000000000000000000000000\",\"alloc\":{\"0x71562b71999873DB5b286dF957af199Ec94617F7\": {\"balance\":\"0x4192927743b88000\"}, \"0x703c4b2bD70c169f5717101CaeE543299Fc946C7\": {\"balance\":\"0x4192927743b88000\"}},\"number\":\"0x0\",\"gasUsed\":\"0x0\",\"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}"
genesisJSONEVM = "{\"config\":{\"chainId\":43111,\"homesteadBlock\":0,\"eip150Block\":0,\"eip155Block\":0,\"eip158Block\":0,\"byzantiumBlock\":0,\"constantinopleBlock\":0,\"petersburgBlock\":0,\"istanbulBlock\":0,\"muirGlacierBlock\":0,\"subnetEVMTimestamp\":0},\"nonce\":\"0x0\",\"timestamp\":\"0x0\",\"extraData\":\"0x00\",\"gasLimit\":\"0x7A1200\",\"difficulty\":\"0x0\",\"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"coinbase\":\"0x0000000000000000000000000000000000000000\",\"alloc\":{\"0x71562b71999873DB5b286dF957af199Ec94617F7\": {\"balance\":\"0x4192927743b88000\"}, \"0x703c4b2bD70c169f5717101CaeE543299Fc946C7\": {\"balance\":\"0x4192927743b88000\"}},\"number\":\"0x0\",\"gasUsed\":\"0x0\",\"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}"
genesisJSONDUpgrade = "{\"config\":{\"chainId\":43111,\"homesteadBlock\":0,\"eip150Block\":0,\"eip155Block\":0,\"eip158Block\":0,\"byzantiumBlock\":0,\"constantinopleBlock\":0,\"petersburgBlock\":0,\"istanbulBlock\":0,\"muirGlacierBlock\":0,\"subnetEVMTimestamp\":0,\"dUpgradeTimestamp\":0},\"nonce\":\"0x0\",\"timestamp\":\"0x0\",\"extraData\":\"0x00\",\"gasLimit\":\"0x7A1200\",\"difficulty\":\"0x0\",\"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"coinbase\":\"0x0000000000000000000000000000000000000000\",\"alloc\":{\"0x71562b71999873DB5b286dF957af199Ec94617F7\": {\"balance\":\"0x4192927743b88000\"}, \"0x703c4b2bD70c169f5717101CaeE543299Fc946C7\": {\"balance\":\"0x4192927743b88000\"}},\"number\":\"0x0\",\"gasUsed\":\"0x0\",\"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}"
genesisJSONPreSubnetEVM = "{\"config\":{\"chainId\":43111,\"homesteadBlock\":0,\"eip150Block\":0,\"eip155Block\":0,\"eip158Block\":0,\"byzantiumBlock\":0,\"constantinopleBlock\":0,\"petersburgBlock\":0,\"istanbulBlock\":0,\"muirGlacierBlock\":0},\"nonce\":\"0x0\",\"timestamp\":\"0x0\",\"extraData\":\"0x00\",\"gasLimit\":\"0x7A1200\",\"difficulty\":\"0x0\",\"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"coinbase\":\"0x0000000000000000000000000000000000000000\",\"alloc\":{\"0x71562b71999873DB5b286dF957af199Ec94617F7\": {\"balance\":\"0x4192927743b88000\"}, \"0x703c4b2bD70c169f5717101CaeE543299Fc946C7\": {\"balance\":\"0x4192927743b88000\"}},\"number\":\"0x0\",\"gasUsed\":\"0x0\",\"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}"
genesisJSONPreEVM = "{\"config\":{\"chainId\":43111,\"homesteadBlock\":0,\"eip150Block\":0,\"eip155Block\":0,\"eip158Block\":0,\"byzantiumBlock\":0,\"constantinopleBlock\":0,\"petersburgBlock\":0,\"istanbulBlock\":0,\"muirGlacierBlock\":0},\"nonce\":\"0x0\",\"timestamp\":\"0x0\",\"extraData\":\"0x00\",\"gasLimit\":\"0x7A1200\",\"difficulty\":\"0x0\",\"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"coinbase\":\"0x0000000000000000000000000000000000000000\",\"alloc\":{\"0x71562b71999873DB5b286dF957af199Ec94617F7\": {\"balance\":\"0x4192927743b88000\"}, \"0x703c4b2bD70c169f5717101CaeE543299Fc946C7\": {\"balance\":\"0x4192927743b88000\"}},\"number\":\"0x0\",\"gasUsed\":\"0x0\",\"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\"}"
genesisJSONLatest = genesisJSONDUpgrade
firstTxAmount = new(big.Int).Mul(big.NewInt(testMinGasPrice), big.NewInt(21000*100))
@@ -98,7 +98,7 @@ func init() {
testEthAddrs = append(testEthAddrs, addr1, addr2)
}
// BuildGenesisTest returns the genesis bytes for Subnet EVM VM to be used in testing
// BuildGenesisTest returns the genesis bytes for EVM VM to be used in testing
func buildGenesisTest(t *testing.T, genesisJSON string) []byte {
ss := CreateStaticService()
@@ -289,8 +289,8 @@ func TestVMUpgrades(t *testing.T) {
expectedGasPrice *big.Int
}{
{
name: "Subnet EVM",
genesis: genesisJSONSubnetEVM,
name: "EVM",
genesis: genesisJSONEVM,
expectedGasPrice: big.NewInt(0),
},
}
@@ -381,7 +381,7 @@ func issueAndAccept(t *testing.T, issuer <-chan commonEng.Message, vm *VM) snowm
func TestBuildEthTxBlock(t *testing.T) {
// reduce block gas cost
issuer, vm, dbManager, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "{\"pruning-enabled\":true}", "")
issuer, vm, dbManager, _ := GenesisVM(t, true, genesisJSONEVM, "{\"pruning-enabled\":true}", "")
defer func() {
if err := vm.Shutdown(context.Background()); err != nil {
@@ -479,7 +479,7 @@ func TestBuildEthTxBlock(t *testing.T) {
}
restartedVM := &VM{}
genesisBytes := buildGenesisTest(t, genesisJSONSubnetEVM)
genesisBytes := buildGenesisTest(t, genesisJSONEVM)
if err := restartedVM.Initialize(
context.Background(),
@@ -520,8 +520,8 @@ func TestBuildEthTxBlock(t *testing.T) {
func TestSetPreferenceRace(t *testing.T) {
// Create two VMs which will agree on block A and then
// build the two distinct preferred chains above
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "{\"pruning-enabled\":true}", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "{\"pruning-enabled\":true}", "")
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONEVM, "{\"pruning-enabled\":true}", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONEVM, "{\"pruning-enabled\":true}", "")
defer func() {
if err := vm1.Shutdown(context.Background()); err != nil {
@@ -771,8 +771,8 @@ func TestSetPreferenceRace(t *testing.T) {
// accept block C, which should be an orphaned block at this point and
// get rejected.
func TestReorgProtection(t *testing.T) {
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "{\"pruning-enabled\":false}", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "{\"pruning-enabled\":false}", "")
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONEVM, "{\"pruning-enabled\":false}", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONEVM, "{\"pruning-enabled\":false}", "")
defer func() {
if err := vm1.Shutdown(context.Background()); err != nil {
@@ -949,8 +949,8 @@ func TestReorgProtection(t *testing.T) {
// / \
// B C
func TestNonCanonicalAccept(t *testing.T) {
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
defer func() {
if err := vm1.Shutdown(context.Background()); err != nil {
@@ -1120,8 +1120,8 @@ func TestNonCanonicalAccept(t *testing.T) {
// |
// D
func TestStickyPreference(t *testing.T) {
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
defer func() {
if err := vm1.Shutdown(context.Background()); err != nil {
@@ -1390,8 +1390,8 @@ func TestStickyPreference(t *testing.T) {
// |
// D
func TestUncleBlock(t *testing.T) {
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
defer func() {
if err := vm1.Shutdown(context.Background()); err != nil {
@@ -1579,7 +1579,7 @@ func TestUncleBlock(t *testing.T) {
// Regression test to ensure that a VM that is not able to parse a block that
// contains no transactions.
func TestEmptyBlock(t *testing.T) {
issuer, vm, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer, vm, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
defer func() {
if err := vm.Shutdown(context.Background()); err != nil {
@@ -1637,8 +1637,8 @@ func TestEmptyBlock(t *testing.T) {
// |
// D
func TestAcceptReorg(t *testing.T) {
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer1, vm1, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
issuer2, vm2, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
defer func() {
if err := vm1.Shutdown(context.Background()); err != nil {
@@ -1843,7 +1843,7 @@ func TestAcceptReorg(t *testing.T) {
}
func TestFutureBlock(t *testing.T) {
issuer, vm, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer, vm, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
defer func() {
if err := vm.Shutdown(context.Background()); err != nil {
@@ -1897,7 +1897,7 @@ func TestFutureBlock(t *testing.T) {
}
func TestLastAcceptedBlockNumberAllow(t *testing.T) {
issuer, vm, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer, vm, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
defer func() {
if err := vm.Shutdown(context.Background()); err != nil {
@@ -1977,7 +1977,7 @@ func TestConfigureLogLevel(t *testing.T) {
{
name: "Log level info",
logConfig: "{\"log-level\": \"info\"}",
genesisJSON: genesisJSONSubnetEVM,
genesisJSON: genesisJSONEVM,
upgradeJSON: "",
expectedErr: "",
},
@@ -2035,9 +2035,9 @@ func TestConfigureLogLevel(t *testing.T) {
}
// Regression test to ensure we can build blocks if we are starting with the
// Subnet EVM ruleset in genesis.
func TestBuildSubnetEVMBlock(t *testing.T) {
issuer, vm, _, _ := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
// EVM ruleset in genesis.
func TestBuildEVMBlock(t *testing.T) {
issuer, vm, _, _ := GenesisVM(t, true, genesisJSONEVM, "", "")
defer func() {
if err := vm.Shutdown(context.Background()); err != nil {
@@ -2122,7 +2122,7 @@ func TestBuildSubnetEVMBlock(t *testing.T) {
func TestBuildAllowListActivationBlock(t *testing.T) {
genesis := &core.Genesis{}
if err := genesis.UnmarshalJSON([]byte(genesisJSONSubnetEVM)); err != nil {
if err := genesis.UnmarshalJSON([]byte(genesisJSONEVM)); err != nil {
t.Fatal(err)
}
genesis.Config.GenesisPrecompiles = params.Precompiles{
@@ -2407,7 +2407,7 @@ func TestVerifyManagerConfig(t *testing.T) {
func TestTxAllowListDisablePrecompile(t *testing.T) {
// Setup chain params
genesis := &core.Genesis{}
if err := genesis.UnmarshalJSON([]byte(genesisJSONSubnetEVM)); err != nil {
if err := genesis.UnmarshalJSON([]byte(genesisJSONEVM)); err != nil {
t.Fatal(err)
}
enableAllowListTimestamp := time.Unix(0, 0) // enable at genesis
@@ -2522,7 +2522,7 @@ func TestTxAllowListDisablePrecompile(t *testing.T) {
func TestFeeManagerChangeFee(t *testing.T) {
// Setup chain params
genesis := &core.Genesis{}
if err := genesis.UnmarshalJSON([]byte(genesisJSONSubnetEVM)); err != nil {
if err := genesis.UnmarshalJSON([]byte(genesisJSONEVM)); err != nil {
t.Fatal(err)
}
genesis.Config.GenesisPrecompiles = params.Precompiles{
@@ -2645,7 +2645,7 @@ func TestFeeManagerChangeFee(t *testing.T) {
// Test Allow Fee Recipients is disabled and, etherbase must be blackhole address
func TestAllowFeeRecipientDisabled(t *testing.T) {
genesis := &core.Genesis{}
if err := genesis.UnmarshalJSON([]byte(genesisJSONSubnetEVM)); err != nil {
if err := genesis.UnmarshalJSON([]byte(genesisJSONEVM)); err != nil {
t.Fatal(err)
}
genesis.Config.AllowFeeRecipients = false // set to false initially
@@ -2705,7 +2705,7 @@ func TestAllowFeeRecipientDisabled(t *testing.T) {
func TestAllowFeeRecipientEnabled(t *testing.T) {
genesis := &core.Genesis{}
if err := genesis.UnmarshalJSON([]byte(genesisJSONSubnetEVM)); err != nil {
if err := genesis.UnmarshalJSON([]byte(genesisJSONEVM)); err != nil {
t.Fatal(err)
}
genesis.Config.AllowFeeRecipients = true
@@ -2765,7 +2765,7 @@ func TestAllowFeeRecipientEnabled(t *testing.T) {
func TestRewardManagerPrecompileSetRewardAddress(t *testing.T) {
genesis := &core.Genesis{}
require.NoError(t, genesis.UnmarshalJSON([]byte(genesisJSONSubnetEVM)))
require.NoError(t, genesis.UnmarshalJSON([]byte(genesisJSONEVM)))
genesis.Config.GenesisPrecompiles = params.Precompiles{
rewardmanager.ConfigKey: rewardmanager.NewConfig(utils.NewUint64(0), testEthAddrs[0:1], nil, nil, nil),
@@ -2907,7 +2907,7 @@ func TestRewardManagerPrecompileSetRewardAddress(t *testing.T) {
func TestRewardManagerPrecompileAllowFeeRecipients(t *testing.T) {
genesis := &core.Genesis{}
require.NoError(t, genesis.UnmarshalJSON([]byte(genesisJSONSubnetEVM)))
require.NoError(t, genesis.UnmarshalJSON([]byte(genesisJSONEVM)))
genesis.Config.GenesisPrecompiles = params.Precompiles{
rewardmanager.ConfigKey: rewardmanager.NewConfig(utils.NewUint64(0), testEthAddrs[0:1], nil, nil, nil),
@@ -3037,7 +3037,7 @@ func TestRewardManagerPrecompileAllowFeeRecipients(t *testing.T) {
}
func TestSkipChainConfigCheckCompatible(t *testing.T) {
// The most recent network upgrade in Subnet-EVM is SubnetEVM itself, which cannot be disabled for this test since it results in
// The most recent network upgrade in EVM is EVM itself, which cannot be disabled for this test since it results in
// disabling dynamic fees and causes a panic since some code assumes that this is enabled.
// TODO update this test when there is a future network upgrade that can be skipped in the config.
t.Skip("no skippable upgrades")
@@ -3045,7 +3045,7 @@ func TestSkipChainConfigCheckCompatible(t *testing.T) {
metrics.Enabled = false
defer func() { metrics.Enabled = true }()
issuer, vm, dbManager, appSender := GenesisVM(t, true, genesisJSONPreSubnetEVM, "{\"pruning-enabled\":true}", "")
issuer, vm, dbManager, appSender := GenesisVM(t, true, genesisJSONPreEVM, "{\"pruning-enabled\":true}", "")
defer func() {
if err := vm.Shutdown(context.Background()); err != nil {
@@ -3083,14 +3083,14 @@ func TestSkipChainConfigCheckCompatible(t *testing.T) {
// use the block's timestamp instead of 0 since rewind to genesis
// is hardcoded to be allowed in core/genesis.go.
genesisWithUpgrade := &core.Genesis{}
require.NoError(t, json.Unmarshal([]byte(genesisJSONPreSubnetEVM), genesisWithUpgrade))
genesisWithUpgrade.Config.SubnetEVMTimestamp = utils.TimeToNewUint64(blk.Timestamp())
require.NoError(t, json.Unmarshal([]byte(genesisJSONPreEVM), genesisWithUpgrade))
genesisWithUpgrade.Config.EVMTimestamp = utils.TimeToNewUint64(blk.Timestamp())
genesisWithUpgradeBytes, err := json.Marshal(genesisWithUpgrade)
require.NoError(t, err)
// this will not be allowed
err = reinitVM.Initialize(context.Background(), vm.ctx, dbManager, genesisWithUpgradeBytes, []byte{}, []byte{}, issuer, []*commonEng.Fx{}, appSender)
require.ErrorContains(t, err, "mismatching SubnetEVM fork block timestamp in database")
require.ErrorContains(t, err, "mismatching EVM fork block timestamp in database")
// try again with skip-upgrade-check
config := []byte("{\"skip-upgrade-check\": true}")
@@ -3121,7 +3121,7 @@ func TestCrossChainMessagestoVM(t *testing.T) {
require.NoErrorf(err, "could not parse abi: %v")
calledSendCrossChainAppResponseFn := false
issuer, vm, _, appSender := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
issuer, vm, _, appSender := GenesisVM(t, true, genesisJSONEVM, "", "")
defer func() {
err := vm.Shutdown(context.Background())
+12 -12
View File
@@ -47,7 +47,7 @@ func TestVMUpgradeBytesPrecompile(t *testing.T) {
}
// initialize the VM with these upgrade bytes
issuer, vm, dbManager, appSender := GenesisVM(t, true, genesisJSONSubnetEVM, "", string(upgradeBytesJSON))
issuer, vm, dbManager, appSender := GenesisVM(t, true, genesisJSONEVM, "", string(upgradeBytesJSON))
// Submit a successful transaction
tx0 := types.NewTransaction(uint64(0), testEthAddrs[0], big.NewInt(1), 21000, big.NewInt(testMinGasPrice), nil)
@@ -96,7 +96,7 @@ func TestVMUpgradeBytesPrecompile(t *testing.T) {
metrics.Enabled = true
}()
if err := vm.Initialize(
context.Background(), vm.ctx, dbManager, []byte(genesisJSONSubnetEVM), upgradeBytesJSON, []byte{}, issuer, []*commonEng.Fx{}, appSender,
context.Background(), vm.ctx, dbManager, []byte(genesisJSONEVM), upgradeBytesJSON, []byte{}, issuer, []*commonEng.Fx{}, appSender,
); err != nil {
t.Fatal(err)
}
@@ -193,13 +193,13 @@ func TestVMUpgradeBytesPrecompile(t *testing.T) {
// require.NoError(t, err)
// // initialize the VM with these upgrade bytes
// issuer, vm, dbManager, appSender := GenesisVM(t, true, genesisJSONPreSubnetEVM, "", string(upgradeBytesJSON))
// issuer, vm, dbManager, appSender := GenesisVM(t, true, genesisJSONPreEVM, "", string(upgradeBytesJSON))
// vm.clock.Set(testTimestamp)
// // verify upgrade is applied
// require.True(t, test.checkUpgradeFn(vm.chainConfig, big.NewInt(testTimestamp.Unix())))
// // Submit a successful transaction and build a block to move the chain head past the SubnetEVMTimestamp network upgrade
// // Submit a successful transaction and build a block to move the chain head past the EVMTimestamp network upgrade
// tx0 := types.NewTransaction(uint64(0), testEthAddrs[0], big.NewInt(1), 21000, big.NewInt(testMinGasPrice), nil)
// signedTx0, err := types.SignTx(tx0, types.NewEIP155Signer(vm.chainConfig.ChainID), testKeys[0])
// require.NoError(t, err)
@@ -210,21 +210,21 @@ func TestVMUpgradeBytesPrecompile(t *testing.T) {
// require.NoError(t, vm.Shutdown(context.Background()))
// // VM should not start again without proper upgrade bytes.
// err = vm.Initialize(context.Background(), vm.ctx, dbManager, []byte(genesisJSONPreSubnetEVM), []byte{}, []byte{}, issuer, []*commonEng.Fx{}, appSender)
// err = vm.Initialize(context.Background(), vm.ctx, dbManager, []byte(genesisJSONPreEVM), []byte{}, []byte{}, issuer, []*commonEng.Fx{}, appSender)
// require.ErrorContains(t, err, fmt.Sprintf("mismatching %s fork block timestamp in database", test.name))
// // VM should not start if fork is moved back
// test.setTimestampFn(upgradeConfig, big.NewInt(2))
// upgradeBytesJSON, err = json.Marshal(upgradeConfig)
// require.NoError(t, err)
// err = vm.Initialize(context.Background(), vm.ctx, dbManager, []byte(genesisJSONPreSubnetEVM), upgradeBytesJSON, []byte{}, issuer, []*commonEng.Fx{}, appSender)
// err = vm.Initialize(context.Background(), vm.ctx, dbManager, []byte(genesisJSONPreEVM), upgradeBytesJSON, []byte{}, issuer, []*commonEng.Fx{}, appSender)
// require.ErrorContains(t, err, fmt.Sprintf("mismatching %s fork block timestamp in database", test.name))
// // VM should not start if fork is moved forward
// test.setTimestampFn(upgradeConfig, big.NewInt(30))
// upgradeBytesJSON, err = json.Marshal(upgradeConfig)
// require.NoError(t, err)
// err = vm.Initialize(context.Background(), vm.ctx, dbManager, []byte(genesisJSONPreSubnetEVM), upgradeBytesJSON, []byte{}, issuer, []*commonEng.Fx{}, appSender)
// err = vm.Initialize(context.Background(), vm.ctx, dbManager, []byte(genesisJSONPreEVM), upgradeBytesJSON, []byte{}, issuer, []*commonEng.Fx{}, appSender)
// require.ErrorContains(t, err, fmt.Sprintf("mismatching %s fork block timestamp in database", test.name))
// })
// }
@@ -235,11 +235,11 @@ func TestMandatoryUpgradesEnforced(t *testing.T) {
// but this should not be used because we are enforcing
// network upgrades within the code
var genesis core.Genesis
if err := json.Unmarshal([]byte(genesisJSONPreSubnetEVM), &genesis); err != nil {
if err := json.Unmarshal([]byte(genesisJSONPreEVM), &genesis); err != nil {
t.Fatalf("could not unmarshal genesis bytes: %s", err)
}
genesisSubnetEVMTimestamp := utils.NewUint64(5)
genesis.Config.SubnetEVMTimestamp = genesisSubnetEVMTimestamp
genesisEVMTimestamp := utils.NewUint64(5)
genesis.Config.EVMTimestamp = genesisEVMTimestamp
genesisBytes, err := json.Marshal(&genesis)
if err != nil {
t.Fatalf("could not unmarshal genesis bytes: %s", err)
@@ -299,7 +299,7 @@ func TestMandatoryUpgradesEnforced(t *testing.T) {
}()
// verify upgrade is rescheduled
require.Equal(t, test.expected, vm.chainConfig.IsSubnetEVM(0))
require.Equal(t, test.expected, vm.chainConfig.IsEVM(0))
})
}
}
@@ -313,7 +313,7 @@ func mustMarshal(t *testing.T, v interface{}) string {
func TestVMStateUpgrade(t *testing.T) {
// modify genesis to add a key to the state
genesis := &core.Genesis{}
err := json.Unmarshal([]byte(genesisJSONSubnetEVM), genesis)
err := json.Unmarshal([]byte(genesisJSONEVM), genesis)
require.NoError(t, err)
genesisAccount, ok := genesis.Alloc[testEthAddrs[0]]
require.True(t, ok)
+2 -2
View File
@@ -586,7 +586,7 @@ func TestReceiveWarpMessage(t *testing.T) {
}
func TestMessageSignatureRequestsToVM(t *testing.T) {
_, vm, _, appSender := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
_, vm, _, appSender := GenesisVM(t, true, genesisJSONEVM, "", "")
defer func() {
err := vm.Shutdown(context.Background())
@@ -646,7 +646,7 @@ func TestMessageSignatureRequestsToVM(t *testing.T) {
}
func TestBlockSignatureRequestsToVM(t *testing.T) {
_, vm, _, appSender := GenesisVM(t, true, genesisJSONSubnetEVM, "", "")
_, vm, _, appSender := GenesisVM(t, true, genesisJSONEVM, "", "")
defer func() {
err := vm.Shutdown(context.Background())
+4
View File
@@ -12,10 +12,14 @@ import (
)
func main() {
<<<<<<< HEAD
<<<<<<< HEAD
versionString := fmt.Sprintf("Subnet-EVM/%s [Lux Node=%s, rpcchainvm=%d]", evm.Version, version.Current, version.RPCChainVMProtocol)
=======
versionString := fmt.Sprintf("Subnet-EVM/%s [Luxd=%s, rpcchainvm=%d]", evm.Version, version.Current, version.RPCChainVMProtocol)
>>>>>>> b36c20f (Update executable to luxd)
=======
versionString := fmt.Sprintf("EVM/%s [Luxd=%s, rpcchainvm=%d]", evm.Version, version.Current, version.RPCChainVMProtocol)
>>>>>>> fd08c47 (Update import path)
runner.Run(versionString)
}
+5
View File
@@ -15,9 +15,14 @@ import (
"github.com/ethereum/go-ethereum/common"
=======
"github.com/ethereum/go-ethereum/common"
<<<<<<< HEAD
"github.com/luxdefi/subnet-evm/precompile/contract"
"github.com/luxdefi/subnet-evm/vmerrs"
>>>>>>> 9e0b39d (Update deps)
=======
"github.com/luxdefi/evm/precompile/contract"
"github.com/luxdefi/evm/vmerrs"
>>>>>>> fd08c47 (Update import path)
)
// AllowList is an abstraction that allows other precompiles to manage
+4
View File
@@ -10,6 +10,10 @@ import (
"github.com/luxdefi/evm/accounts/abi"
"github.com/luxdefi/evm/vmerrs"
<<<<<<< HEAD
=======
"github.com/ethereum/go-ethereum/common"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/crypto"
)
@@ -9,7 +9,10 @@ import (
"fmt"
"math/big"
<<<<<<< HEAD
"github.com/luxdefi/evm/accounts/abi"
=======
>>>>>>> fd08c47 (Update import path)
"github.com/luxdefi/evm/commontype"
"github.com/luxdefi/evm/precompile/allowlist"
"github.com/luxdefi/evm/precompile/contract"
@@ -11,7 +11,10 @@ import (
"github.com/luxdefi/evm/core/state"
"github.com/luxdefi/evm/precompile/allowlist"
"github.com/luxdefi/evm/precompile/contract"
<<<<<<< HEAD
"github.com/luxdefi/evm/precompile/precompileconfig"
=======
>>>>>>> fd08c47 (Update import path)
"github.com/luxdefi/evm/precompile/testutils"
"github.com/luxdefi/evm/vmerrs"
"github.com/ethereum/go-ethereum/common"
@@ -9,10 +9,16 @@ import (
"fmt"
"math/big"
<<<<<<< HEAD
"github.com/luxdefi/evm/precompile/allowlist"
"github.com/luxdefi/evm/precompile/contract"
"github.com/luxdefi/evm/vmerrs"
=======
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/luxdefi/evm/precompile/allowlist"
"github.com/luxdefi/evm/precompile/contract"
"github.com/luxdefi/evm/vmerrs"
)
const (
@@ -62,7 +68,7 @@ func PackMintInput(address common.Address, amount *big.Int) ([]byte, error) {
// function selector (4 bytes) + input(hash for address + hash for amount)
res := make([]byte, contract.SelectorLen+mintInputLen)
err := contract.PackOrderedHashesWithSelector(res, mintSignature, []common.Hash{
common.BytesToHash(address.Bytes())
common.BytesToHash(address.Bytes()),
common.BigToHash(amount),
})
@@ -10,7 +10,10 @@ import (
"github.com/luxdefi/evm/core/state"
"github.com/luxdefi/evm/precompile/allowlist"
"github.com/luxdefi/evm/precompile/contract"
<<<<<<< HEAD
"github.com/luxdefi/evm/precompile/precompileconfig"
=======
>>>>>>> fd08c47 (Update import path)
"github.com/luxdefi/evm/precompile/testutils"
"github.com/luxdefi/evm/vmerrs"
"github.com/ethereum/go-ethereum/common"
@@ -10,7 +10,10 @@ import (
"github.com/luxdefi/evm/precompile/allowlist"
"github.com/luxdefi/evm/precompile/contract"
"github.com/luxdefi/evm/precompile/precompileconfig"
<<<<<<< HEAD
=======
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
)
@@ -6,6 +6,15 @@ package rewardmanager
import (
"testing"
<<<<<<< HEAD
=======
"github.com/luxdefi/evm/constants"
"github.com/luxdefi/evm/core/state"
"github.com/luxdefi/evm/precompile/allowlist"
"github.com/luxdefi/evm/precompile/contract"
"github.com/luxdefi/evm/precompile/testutils"
"github.com/luxdefi/evm/vmerrs"
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
@@ -9,7 +9,10 @@ import (
"github.com/luxdefi/evm/precompile/contract"
"github.com/luxdefi/evm/precompile/modules"
"github.com/luxdefi/evm/precompile/precompileconfig"
<<<<<<< HEAD
=======
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
)
+3
View File
@@ -9,7 +9,10 @@ import (
"github.com/luxdefi/evm/constants"
"github.com/luxdefi/evm/utils"
<<<<<<< HEAD
=======
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
)
+4
View File
@@ -1,3 +1,7 @@
<<<<<<< HEAD
=======
// Code generated by MockGen. DO NOT EDIT.
>>>>>>> fd08c47 (Update import path)
// Source: github.com/luxdefi/evm/precompile/precompileconfig (interfaces: Predicater,Config,ChainConfig,Accepter)
// Package precompileconfig is a generated GoMock package.
+7
View File
@@ -8,11 +8,18 @@ import (
"testing"
"time"
<<<<<<< HEAD
=======
"github.com/luxdefi/node/snow"
>>>>>>> fd08c47 (Update import path)
"github.com/luxdefi/evm/commontype"
"github.com/luxdefi/evm/precompile/contract"
"github.com/luxdefi/evm/precompile/modules"
"github.com/luxdefi/evm/precompile/precompileconfig"
<<<<<<< HEAD
"github.com/luxdefi/evm/utils"
=======
>>>>>>> fd08c47 (Update import path)
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
+6 -1
View File
@@ -23,7 +23,7 @@ version_lt() {
}
if version_lt "$(go_version)" "$go_version_minimum"; then
echo "SubnetEVM requires Go >= $go_version_minimum, Go $(go_version) found." >&2
echo "EVM requires Go >= $go_version_minimum, Go $(go_version) found." >&2
exit 1
fi
@@ -48,6 +48,11 @@ else
exit 1
fi
<<<<<<< HEAD
# Build Subnet EVM, which is run as a subprocess
echo "Building Subnet EVM @ GitCommit: $SUBNET_EVM_COMMIT at $BINARY_PATH"
=======
# Build EVM, which is run as a subprocess
echo "Building EVM @ GitCommit: $SUBNET_EVM_COMMIT at $BINARY_PATH"
>>>>>>> fd08c47 (Update import path)
go build -ldflags "-X github.com/luxdefi/evm/plugin/evm.GitCommit=$SUBNET_EVM_COMMIT $STATIC_LD_FLAGS" -o "$BINARY_PATH" "plugin/"*.go
+1 -1
View File
@@ -16,7 +16,7 @@ source "$SUBNET_EVM_PATH"/scripts/versions.sh
# Load the constants
source "$SUBNET_EVM_PATH"/scripts/constants.sh
BUILD_IMAGE_ID=${BUILD_IMAGE_ID:-"${LUX_VERSION}-Subnet-EVM-${CURRENT_BRANCH}"}
BUILD_IMAGE_ID=${BUILD_IMAGE_ID:-"${LUX_VERSION}-EVM-${CURRENT_BRANCH}"}
echo "Building Docker Image: $DOCKERHUB_REPO:$BUILD_IMAGE_ID based of $LUX_VERSION"
docker build -t "$DOCKERHUB_REPO:$BUILD_IMAGE_ID" "$SUBNET_EVM_PATH" -f "$SUBNET_EVM_PATH/Dockerfile" \
+4
View File
@@ -28,8 +28,12 @@ DATA_DIR=${DATA_DIR:-/tmp/evm-start-node/$(date "+%Y-%m-%d%:%H:%M:%S")}
LUXD_BUILD_PATH=${LUXD_BUILD_PATH:-"$GOPATH/src/github.com/luxdefi/node/build"}
LUXD_PATH=${LUXD_PATH:-"$LUXD_BUILD_PATH/node"}
LUXD_PLUGIN_DIR=${LUXD_PLUGIN_DIR:-"$LUXD_BUILD_PATH/plugins"}
<<<<<<< HEAD
DATA_DIR=${DATA_DIR:-/tmp/subnet-evm-start-node/$(date "+%Y-%m-%d%:%H:%M:%S")}
>>>>>>> b36c20f (Update executable to luxd)
=======
DATA_DIR=${DATA_DIR:-/tmp/evm-start-node/$(date "+%Y-%m-%d%:%H:%M:%S")}
>>>>>>> fd08c47 (Update import path)
mkdir -p $DATA_DIR
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e
# This script assumes that an Luxd and Subnet-EVM binaries are available in the standard location
# This script assumes that an Luxd and EVM binaries are available in the standard location
# within the $GOPATH
# The Luxd and PluginDir paths can be specified via the environment variables used in ./scripts/run.sh.
+4
View File
@@ -1,12 +1,16 @@
#!/usr/bin/env bash
set -e
<<<<<<< HEAD
<<<<<<< HEAD
# This script assumes that an Lux Node and Subnet-EVM binaries are available in the standard location
# within the $GOPATH
# The Lux Node and PluginDir paths can be specified via the environment variables used in ./scripts/run.sh.
=======
# This script assumes that an Luxd and Subnet-EVM binaries are available in the standard location
=======
# This script assumes that an Luxd and EVM binaries are available in the standard location
>>>>>>> fd08c47 (Update import path)
# within the $GOPATH
# The Luxd and PluginDir paths can be specified via the environment variables used in ./scripts/run.sh.
>>>>>>> b36c20f (Update executable to luxd)
+8
View File
@@ -46,11 +46,19 @@ The above information is called a _state summary_, and each syncable block corre
1. The engine calls `StateSyncEnabled`. The VM returns `true` to initiate state sync, or `false` to start bootstrapping. In `evm`, this is controlled by the `state-sync-enabled` flag.
<<<<<<< HEAD
2. The engine calls `GetOngoingSyncStateSummary`. If the VM has a previously interrupted sync to resume it returns that summary. Otherwise, it returns `ErrNotFound`. By default, `evm` will resume an interrupted sync.
3. The engine samples peers for their latest available summaries, then verifies the correctness and availability of each sampled summary with validators. The messaging flow is documented [here](https://github.com/luxdefi/node/blob/master/snow/engine/snowman/block/README.md).
4. The engine calls `Accept` on the chosen summary. The VM may return `false` to skip syncing to this summary (`evm` skips state sync for less than `defaultStateSyncMinBlocks = 300_000` blocks). If the VM decides to perform the sync, it must return `true` without blocking and fetch the state from its peers asynchronously.
5. The VM sends `common.StateSyncDone` on the `toEngine` channel on completion.
6. The engine calls `VM.SetState(Bootstrapping)`. Then, blocks after the syncable block are processed one by one.
=======
1. The engine calls `GetOngoingSyncStateSummary`. If the VM has a previously interrupted sync to resume it returns that summary. Otherwise, it returns `ErrNotFound`. By default, `evm` will resume an interrupted sync.
1. The engine samples peers for their latest available summaries, then verifies the correctness and availablility of each sampled summary with validators. The messaging flow is documented [here](https://github.com/luxdefi/node/blob/master/snow/engine/snowman/block/README.md).
1. The engine calls `Accept` on the chosen summary. The VM may return `false` to skip syncing to this summary (`evm` skips state sync for less than `defaultStateSyncMinBlocks = 300_000` blocks). If the VM decides to perform the sync, it must return `true` without blocking and fetch the state from its peers asynchronously.
1. The VM sends `common.StateSyncDone` on the `toEngine` channel on completion.
1. The engine calls `VM.SetState(Bootstrapping)`. Then, blocks after the syncable block are processed one by one.
>>>>>>> fd08c47 (Update import path)
## Syncing state
The following steps are executed by the VM to sync its state from peers (see `stateSyncClient.StateSync`):
+4 -4
View File
@@ -154,7 +154,7 @@ var Forks = map[string]*params.ChainConfig{
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(5),
},
"Pre-SubnetEVM": {
"Pre-EVM": {
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
@@ -166,7 +166,7 @@ var Forks = map[string]*params.ChainConfig{
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
},
"SubnetEVM": {
"EVM": {
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
@@ -177,7 +177,7 @@ var Forks = map[string]*params.ChainConfig{
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MandatoryNetworkUpgrades: params.MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
EVMTimestamp: utils.NewUint64(0),
},
},
"DUpgrade": {
@@ -191,7 +191,7 @@ var Forks = map[string]*params.ChainConfig{
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MandatoryNetworkUpgrades: params.MandatoryNetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
EVMTimestamp: utils.NewUint64(0),
DUpgradeTimestamp: utils.NewUint64(0),
},
},

Some files were not shown because too many files have changed in this diff Show More