Commit 9ef215b8 authored by Kelvin Fichter's avatar Kelvin Fichter Committed by Matthew Slipper

maintenance: decrease geth diff

parent 855fc76a
---
'@eth-optimism/l2geth': patch
---
Various small changes to reduce our upstream Geth diff
...@@ -34,7 +34,6 @@ type ABI struct { ...@@ -34,7 +34,6 @@ type ABI struct {
Constructor Method Constructor Method
Methods map[string]Method Methods map[string]Method
Events map[string]Event Events map[string]Event
MethodsById map[[4]byte]*Method
} }
// JSON returns a parsed ABI interface and error if it failed. // JSON returns a parsed ABI interface and error if it failed.
...@@ -123,13 +122,6 @@ func (abi *ABI) UnmarshalJSON(data []byte) error { ...@@ -123,13 +122,6 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
return err return err
} }
abi.Methods = make(map[string]Method) abi.Methods = make(map[string]Method)
// UsingOVM specific changes
// Create a cache of methods when running under the OVM because
// looking up methods based on the 4 byte selector is part of the hot
// code path. Without this cache, it was observed that 50% of the CPU
// time during syncing was spent hashing the function selectors
// during the call to `abi.MethodsById`
abi.MethodsById = make(map[[4]byte]*Method)
abi.Events = make(map[string]Event) abi.Events = make(map[string]Event)
for _, field := range fields { for _, field := range fields {
switch field.Type { switch field.Type {
...@@ -146,18 +138,13 @@ func (abi *ABI) UnmarshalJSON(data []byte) error { ...@@ -146,18 +138,13 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
_, ok = abi.Methods[name] _, ok = abi.Methods[name]
} }
isConst := field.Constant || field.StateMutability == "pure" || field.StateMutability == "view" isConst := field.Constant || field.StateMutability == "pure" || field.StateMutability == "view"
method := Method{ abi.Methods[name] = Method{
Name: name, Name: name,
RawName: field.Name, RawName: field.Name,
Const: isConst, Const: isConst,
Inputs: field.Inputs, Inputs: field.Inputs,
Outputs: field.Outputs, Outputs: field.Outputs,
} }
abi.Methods[name] = method
// UsingOVM specific changes
// Add method to the id cache
sigdata := method.ID()
abi.MethodsById[[4]byte{sigdata[0], sigdata[1], sigdata[2], sigdata[3]}] = &method
case "event": case "event":
name := field.Name name := field.Name
_, ok := abi.Events[name] _, ok := abi.Events[name]
...@@ -183,15 +170,12 @@ func (abi *ABI) MethodById(sigdata []byte) (*Method, error) { ...@@ -183,15 +170,12 @@ func (abi *ABI) MethodById(sigdata []byte) (*Method, error) {
if len(sigdata) < 4 { if len(sigdata) < 4 {
return nil, fmt.Errorf("data too short (%d bytes) for abi method lookup", len(sigdata)) return nil, fmt.Errorf("data too short (%d bytes) for abi method lookup", len(sigdata))
} }
for _, method := range abi.Methods {
// UsingOVM specific changes if bytes.Equal(method.ID(), sigdata[:4]) {
// Use the method cache to prevent the need to iterate and hash return &method, nil
// each method in the ABI }
method, exist := abi.MethodsById[[4]byte{sigdata[0], sigdata[1], sigdata[2], sigdata[3]}]
if !exist {
return nil, fmt.Errorf("no method with id: %#x", sigdata[:4])
} }
return method, nil return nil, fmt.Errorf("no method with id: %#x", sigdata[:4])
} }
// EventByID looks an event up by its topic hash in the // EventByID looks an event up by its topic hash in the
......
...@@ -494,8 +494,6 @@ var bindTests = []struct { ...@@ -494,8 +494,6 @@ var bindTests = []struct {
"github.com/ethereum-optimism/optimism/l2geth/crypto" "github.com/ethereum-optimism/optimism/l2geth/crypto"
`, `,
` `
t.Skip("OVM breaks this... SKIPPING: CallFrom test. CALLER must be transpiled for this test to work properly.")
// Generate a new random account and a funded simulator // Generate a new random account and a funded simulator
key, _ := crypto.GenerateKey() key, _ := crypto.GenerateKey()
auth := bind.NewKeyedTransactor(key) auth := bind.NewKeyedTransactor(key)
...@@ -543,8 +541,6 @@ var bindTests = []struct { ...@@ -543,8 +541,6 @@ var bindTests = []struct {
"github.com/ethereum-optimism/optimism/l2geth/core" "github.com/ethereum-optimism/optimism/l2geth/core"
`, `,
` `
t.Skip("OVM breaks this... SKIPPING: NonExistent contract test. This should be fixed & should pass if we returned the correct error messages.")
// Create a simulator and wrap a non-deployed contract // Create a simulator and wrap a non-deployed contract
sim := backends.NewSimulatedBackend(core.GenesisAlloc{}, uint64(10000000000)) sim := backends.NewSimulatedBackend(core.GenesisAlloc{}, uint64(10000000000))
...@@ -643,8 +639,6 @@ var bindTests = []struct { ...@@ -643,8 +639,6 @@ var bindTests = []struct {
"github.com/ethereum-optimism/optimism/l2geth/crypto" "github.com/ethereum-optimism/optimism/l2geth/crypto"
`, `,
` `
t.Skip("OVM breaks this... SKIPPING: CallFrom test. CALLER must be transpiled for this test to work properly.")
// Generate a new random account and a funded simulator // Generate a new random account and a funded simulator
key, _ := crypto.GenerateKey() key, _ := crypto.GenerateKey()
auth := bind.NewKeyedTransactor(key) auth := bind.NewKeyedTransactor(key)
...@@ -1281,8 +1275,6 @@ var bindTests = []struct { ...@@ -1281,8 +1275,6 @@ var bindTests = []struct {
"github.com/ethereum-optimism/optimism/l2geth/crypto" "github.com/ethereum-optimism/optimism/l2geth/crypto"
`, `,
` `
t.Skip("OVM breaks this... SKIPPING: UseLibrary test.")
// Generate a new random account and a funded simulator // Generate a new random account and a funded simulator
key, _ := crypto.GenerateKey() key, _ := crypto.GenerateKey()
auth := bind.NewKeyedTransactor(key) auth := bind.NewKeyedTransactor(key)
...@@ -1500,8 +1492,6 @@ var bindTests = []struct { ...@@ -1500,8 +1492,6 @@ var bindTests = []struct {
"github.com/ethereum-optimism/optimism/l2geth/core" "github.com/ethereum-optimism/optimism/l2geth/core"
`, `,
` `
t.Skip("OVM breaks this... SKIPPING: MultiContracts test.")
key, _ := crypto.GenerateKey() key, _ := crypto.GenerateKey()
addr := crypto.PubkeyToAddress(key.PublicKey) addr := crypto.PubkeyToAddress(key.PublicKey)
......
...@@ -467,7 +467,7 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) { ...@@ -467,7 +467,7 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) {
username, avatar, address, err = authNoAuth(msg.URL) username, avatar, address, err = authNoAuth(msg.URL)
default: default:
//lint:ignore ST1005 This error is to be displayed in the browser //lint:ignore ST1005 This error is to be displayed in the browser
err = errors.New("Something funky happened, please open an issue at https://github.com/ethereum-optimism/optimism/l2geth/issues") err = errors.New("Something funky happened, please open an issue at https://github.com/ethereum-optimism/optimism/issues")
} }
if err != nil { if err != nil {
if err = sendError(conn, err); err != nil { if err = sendError(conn, err); err != nil {
......
...@@ -183,7 +183,7 @@ Fatal: Failed to unlock account f466859ead1932d743d622cb74fc058882e8648a (could ...@@ -183,7 +183,7 @@ Fatal: Failed to unlock account f466859ead1932d743d622cb74fc058882e8648a (could
`) `)
} }
// https://github.com/ethereum-optimism/optimism/l2geth/issues/1785 // https://github.com/ethereum/go-ethereum/issues/1785
func TestUnlockFlagMultiIndex(t *testing.T) { func TestUnlockFlagMultiIndex(t *testing.T) {
datadir := tmpDatadirWithKeystore(t) datadir := tmpDatadirWithKeystore(t)
geth := runGeth(t, geth := runGeth(t,
......
...@@ -43,7 +43,7 @@ var ( ...@@ -43,7 +43,7 @@ var (
Description: ` Description: `
The Geth console is an interactive shell for the JavaScript runtime environment The Geth console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the Ðapp JavaScript API. which exposes a node admin interface as well as the Ðapp JavaScript API.
See https://github.com/ethereum-optimism/optimism/l2geth/wiki/JavaScript-Console.`, See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.`,
} }
attachCommand = cli.Command{ attachCommand = cli.Command{
...@@ -56,7 +56,7 @@ See https://github.com/ethereum-optimism/optimism/l2geth/wiki/JavaScript-Console ...@@ -56,7 +56,7 @@ See https://github.com/ethereum-optimism/optimism/l2geth/wiki/JavaScript-Console
Description: ` Description: `
The Geth console is an interactive shell for the JavaScript runtime environment The Geth console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the Ðapp JavaScript API. which exposes a node admin interface as well as the Ðapp JavaScript API.
See https://github.com/ethereum-optimism/optimism/l2geth/wiki/JavaScript-Console. See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.
This command allows to open a console on a running geth node.`, This command allows to open a console on a running geth node.`,
} }
...@@ -69,7 +69,7 @@ This command allows to open a console on a running geth node.`, ...@@ -69,7 +69,7 @@ This command allows to open a console on a running geth node.`,
Category: "CONSOLE COMMANDS", Category: "CONSOLE COMMANDS",
Description: ` Description: `
The JavaScript VM exposes a node admin interface as well as the Ðapp The JavaScript VM exposes a node admin interface as well as the Ðapp
JavaScript API. See https://github.com/ethereum-optimism/optimism/l2geth/wiki/JavaScript-Console`, JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console`,
} }
) )
......
...@@ -256,7 +256,7 @@ var dashboardContent = ` ...@@ -256,7 +256,7 @@ var dashboardContent = `
<p>Starting with the 1.5 release of go-ethereum, we've transitioned away from shipping only full blown Ethereum clients and started focusing on releasing the code as reusable packages initially for Go projects, then later for Java based Android projects too. Mobile support is still evolving, hence is bound to change often and hard, but the Ethereum network can nonetheless be accessed from Android too.</p> <p>Starting with the 1.5 release of go-ethereum, we've transitioned away from shipping only full blown Ethereum clients and started focusing on releasing the code as reusable packages initially for Go projects, then later for Java based Android projects too. Mobile support is still evolving, hence is bound to change often and hard, but the Ethereum network can nonetheless be accessed from Android too.</p>
<p>Under the hood the Android library is backed by a go-ethereum light node, meaning that given a not-too-old Android device, you should be able to join the network without significant issues. Certain functionality is not yet available and rough edges are bound to appear here and there, please report issues if you find any.</p> <p>Under the hood the Android library is backed by a go-ethereum light node, meaning that given a not-too-old Android device, you should be able to join the network without significant issues. Certain functionality is not yet available and rough edges are bound to appear here and there, please report issues if you find any.</p>
<br/> <br/>
<p>The stable Android archives are distributed via Maven Central, and the develop snapshots via the Sonatype repositories. Before proceeding, please ensure you have a recent version configured in your Android project. You can find details in <a href="https://github.com/ethereum-optimism/optimism/l2geth/wiki/Mobile:-Introduction#android-archive" target="about:blank">Mobile: Introduction &ndash; Android archive</a>. <p>The stable Android archives are distributed via Maven Central, and the develop snapshots via the Sonatype repositories. Before proceeding, please ensure you have a recent version configured in your Android project. You can find details in <a href="https://github.com/ethereum/go-ethereum/wiki/Mobile:-Introduction#android-archive" target="about:blank">Mobile: Introduction &ndash; Android archive</a>.
<p>Before connecting to the Ethereum network, download the <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> genesis json file and either store it in your Android project as a resource file you can access, or save it as a string in a variable. You're going to need to to initialize your client.</p> <p>Before connecting to the Ethereum network, download the <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> genesis json file and either store it in your Android project as a resource file you can access, or save it as a string in a variable. You're going to need to to initialize your client.</p>
<p>Inside your Java code you can now import the geth archive and connect to Ethereum: <p>Inside your Java code you can now import the geth archive and connect to Ethereum:
<pre>import org.ethereum.geth.*;</pre> <pre>import org.ethereum.geth.*;</pre>
...@@ -287,7 +287,7 @@ node.start(); ...@@ -287,7 +287,7 @@ node.start();
<p>Starting with the 1.5 release of go-ethereum, we've transitioned away from shipping only full blown Ethereum clients and started focusing on releasing the code as reusable packages initially for Go projects, then later for ObjC/Swift based iOS projects too. Mobile support is still evolving, hence is bound to change often and hard, but the Ethereum network can nonetheless be accessed from iOS too.</p> <p>Starting with the 1.5 release of go-ethereum, we've transitioned away from shipping only full blown Ethereum clients and started focusing on releasing the code as reusable packages initially for Go projects, then later for ObjC/Swift based iOS projects too. Mobile support is still evolving, hence is bound to change often and hard, but the Ethereum network can nonetheless be accessed from iOS too.</p>
<p>Under the hood the iOS library is backed by a go-ethereum light node, meaning that given a not-too-old Apple device, you should be able to join the network without significant issues. Certain functionality is not yet available and rough edges are bound to appear here and there, please report issues if you find any.</p> <p>Under the hood the iOS library is backed by a go-ethereum light node, meaning that given a not-too-old Apple device, you should be able to join the network without significant issues. Certain functionality is not yet available and rough edges are bound to appear here and there, please report issues if you find any.</p>
<br/> <br/>
<p>Both stable and develop builds of the iOS framework are available via CocoaPods. Before proceeding, please ensure you have a recent version configured in your iOS project. You can find details in <a href="https://github.com/ethereum-optimism/optimism/l2geth/wiki/Mobile:-Introduction#ios-framework" target="about:blank">Mobile: Introduction &ndash; iOS framework</a>. <p>Both stable and develop builds of the iOS framework are available via CocoaPods. Before proceeding, please ensure you have a recent version configured in your iOS project. You can find details in <a href="https://github.com/ethereum/go-ethereum/wiki/Mobile:-Introduction#ios-framework" target="about:blank">Mobile: Introduction &ndash; iOS framework</a>.
<p>Before connecting to the Ethereum network, download the <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> genesis json file and either store it in your iOS project as a resource file you can access, or save it as a string in a variable. You're going to need to to initialize your client.</p> <p>Before connecting to the Ethereum network, download the <a href="/{{.GethGenesis}}"><code>{{.GethGenesis}}</code></a> genesis json file and either store it in your iOS project as a resource file you can access, or save it as a string in a variable. You're going to need to to initialize your client.</p>
<p>Inside your Swift code you can now import the geth framework and connect to Ethereum (ObjC should be analogous): <p>Inside your Swift code you can now import the geth framework and connect to Ethereum (ObjC should be analogous):
<pre>import Geth</pre> <pre>import Geth</pre>
...@@ -419,7 +419,7 @@ try! node?.start(); ...@@ -419,7 +419,7 @@ try! node?.start();
<p>Puppeth is a tool to aid you in creating a new Ethereum network down to the genesis block, bootnodes, signers, ethstats server, crypto faucet, wallet browsers, block explorer, dashboard and more; without the hassle that it would normally entail to manually configure all these services one by one.</p> <p>Puppeth is a tool to aid you in creating a new Ethereum network down to the genesis block, bootnodes, signers, ethstats server, crypto faucet, wallet browsers, block explorer, dashboard and more; without the hassle that it would normally entail to manually configure all these services one by one.</p>
<p>Puppeth uses ssh to dial in to remote servers, and builds its network components out of docker containers using docker-compose. The user is guided through the process via a command line wizard that does the heavy lifting and topology configuration automatically behind the scenes.</p> <p>Puppeth uses ssh to dial in to remote servers, and builds its network components out of docker containers using docker-compose. The user is guided through the process via a command line wizard that does the heavy lifting and topology configuration automatically behind the scenes.</p>
<br/> <br/>
<p>Puppeth is distributed as part of the <a href="https://geth.ethereum.org/downloads/" target="about:blank">Geth &amp; Tools</a> bundles, but can also be installed separately via:<pre>go get github.com/ethereum-optimism/optimism/l2geth/cmd/puppeth</pre></p> <p>Puppeth is distributed as part of the <a href="https://geth.ethereum.org/downloads/" target="about:blank">Geth &amp; Tools</a> bundles, but can also be installed separately via:<pre>go get github.com/ethereum/go-ethereum/cmd/puppeth</pre></p>
<br/> <br/>
<p><em>Copyright 2017. The go-ethereum Authors.</em></p> <p><em>Copyright 2017. The go-ethereum Authors.</em></p>
</div> </div>
......
...@@ -363,7 +363,7 @@ func TestClique(t *testing.T) { ...@@ -363,7 +363,7 @@ func TestClique(t *testing.T) {
failure: errRecentlySigned, failure: errRecentlySigned,
}, { }, {
// Recent signatures should not reset on checkpoint blocks imported in a new // Recent signatures should not reset on checkpoint blocks imported in a new
// batch (https://github.com/ethereum-optimism/optimism/l2geth/issues/17593). Whilst this // batch (https://github.com/ethereum/go-ethereum/issues/17593). Whilst this
// seems overly specific and weird, it was a Rinkeby consensus split. // seems overly specific and weird, it was a Rinkeby consensus split.
epoch: 3, epoch: 3,
signers: []string{"A", "B", "C"}, signers: []string{"A", "B", "C"},
......
...@@ -55,7 +55,7 @@ func TestTestMode(t *testing.T) { ...@@ -55,7 +55,7 @@ func TestTestMode(t *testing.T) {
} }
// This test checks that cache lru logic doesn't crash under load. // This test checks that cache lru logic doesn't crash under load.
// It reproduces https://github.com/ethereum-optimism/optimism/l2geth/issues/14943 // It reproduces https://github.com/ethereum/go-ethereum/issues/14943
func TestCacheFileEvict(t *testing.T) { func TestCacheFileEvict(t *testing.T) {
tmpdir, err := ioutil.TempDir("", "ethash-test") tmpdir, err := ioutil.TempDir("", "ethash-test")
if err != nil { if err != nil {
......
...@@ -165,8 +165,6 @@ func (a Accounts) Swap(i, j int) { a[i], a[j] = a[j], a[i] } ...@@ -165,8 +165,6 @@ func (a Accounts) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a Accounts) Less(i, j int) bool { return bytes.Compare(a[i].addr.Bytes(), a[j].addr.Bytes()) < 0 } func (a Accounts) Less(i, j int) bool { return bytes.Compare(a[i].addr.Bytes(), a[j].addr.Bytes()) < 0 }
func TestCheckpointRegister(t *testing.T) { func TestCheckpointRegister(t *testing.T) {
t.Skip("OVM breaks this with invalid number of events, probably because the CheckpointOracle must be transpiled to function properly.")
// Initialize test accounts // Initialize test accounts
var accounts Accounts var accounts Accounts
for i := 0; i < 3; i++ { for i := 0; i < 3; i++ {
......
...@@ -982,8 +982,6 @@ func TestLogReorgs(t *testing.T) { ...@@ -982,8 +982,6 @@ func TestLogReorgs(t *testing.T) {
} }
func TestLogRebirth(t *testing.T) { func TestLogRebirth(t *testing.T) {
t.Skip("OVM Genesis breaks this test because it adds the OVM contracts to the state.")
var ( var (
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
addr1 = crypto.PubkeyToAddress(key1.PublicKey) addr1 = crypto.PubkeyToAddress(key1.PublicKey)
...@@ -1422,8 +1420,6 @@ func TestEIP155Transition(t *testing.T) { ...@@ -1422,8 +1420,6 @@ func TestEIP155Transition(t *testing.T) {
} }
func TestEIP161AccountRemoval(t *testing.T) { func TestEIP161AccountRemoval(t *testing.T) {
t.Skip("OVM breaks with `expected account to exist`, probably based on some unknown transaction failure.")
// Configure and generate a sample block chain // Configure and generate a sample block chain
var ( var (
db = rawdb.NewMemoryDatabase() db = rawdb.NewMemoryDatabase()
...@@ -1494,7 +1490,7 @@ func TestEIP161AccountRemoval(t *testing.T) { ...@@ -1494,7 +1490,7 @@ func TestEIP161AccountRemoval(t *testing.T) {
// tests that under weird reorg conditions the blockchain and its internal header- // tests that under weird reorg conditions the blockchain and its internal header-
// chain return the same latest block/header. // chain return the same latest block/header.
// //
// https://github.com/ethereum-optimism/optimism/l2geth/pull/15941 // https://github.com/ethereum/go-ethereum/pull/15941
func TestBlockchainHeaderchainReorgConsistency(t *testing.T) { func TestBlockchainHeaderchainReorgConsistency(t *testing.T) {
// Generate a canonical chain to act as the main dataset // Generate a canonical chain to act as the main dataset
engine := ethash.NewFaker() engine := ethash.NewFaker()
...@@ -1755,8 +1751,8 @@ func TestIncompleteAncientReceiptChainInsertion(t *testing.T) { ...@@ -1755,8 +1751,8 @@ func TestIncompleteAncientReceiptChainInsertion(t *testing.T) {
// overtake the 'canon' chain until after it's passed canon by about 200 blocks. // overtake the 'canon' chain until after it's passed canon by about 200 blocks.
// //
// Details at: // Details at:
// - https://github.com/ethereum-optimism/optimism/l2geth/issues/18977 // - https://github.com/ethereum/go-ethereum/issues/18977
// - https://github.com/ethereum-optimism/optimism/l2geth/pull/18988 // - https://github.com/ethereum/go-ethereum/pull/18988
func TestLowDiffLongChain(t *testing.T) { func TestLowDiffLongChain(t *testing.T) {
// Generate a canonical chain to act as the main dataset // Generate a canonical chain to act as the main dataset
engine := ethash.NewFaker() engine := ethash.NewFaker()
......
...@@ -82,7 +82,7 @@ func TestMatcherRandom(t *testing.T) { ...@@ -82,7 +82,7 @@ func TestMatcherRandom(t *testing.T) {
// Tests that the matcher can properly find matches if the starting block is // Tests that the matcher can properly find matches if the starting block is
// shifter from a multiple of 8. This is needed to cover an optimisation with // shifter from a multiple of 8. This is needed to cover an optimisation with
// bitset matching https://github.com/ethereum-optimism/optimism/l2geth/issues/15309. // bitset matching https://github.com/ethereum/go-ethereum/issues/15309.
func TestMatcherShifted(t *testing.T) { func TestMatcherShifted(t *testing.T) {
// Block 0 always matches in the tests, skip ahead of first 8 blocks with the // Block 0 always matches in the tests, skip ahead of first 8 blocks with the
// start to get a potential zero byte in the matcher bitset. // start to get a potential zero byte in the matcher bitset.
......
...@@ -31,8 +31,6 @@ import ( ...@@ -31,8 +31,6 @@ import (
) )
func TestDefaultGenesisBlock(t *testing.T) { func TestDefaultGenesisBlock(t *testing.T) {
t.Skip("OVM breaks this test because it adds the OVM contracts to the Genesis state.")
block := DefaultGenesisBlock().ToBlock(nil) block := DefaultGenesisBlock().ToBlock(nil)
if block.Hash() != params.MainnetGenesisHash { if block.Hash() != params.MainnetGenesisHash {
t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash(), params.MainnetGenesisHash) t.Errorf("wrong mainnet genesis hash, got %v, want %v", block.Hash(), params.MainnetGenesisHash)
......
...@@ -638,7 +638,7 @@ func (s *StateDB) Copy() *StateDB { ...@@ -638,7 +638,7 @@ func (s *StateDB) Copy() *StateDB {
} }
// Copy the dirty states, logs, and preimages // Copy the dirty states, logs, and preimages
for addr := range s.journal.dirties { for addr := range s.journal.dirties {
// As documented [here](https://github.com/ethereum-optimism/optimism/l2geth/pull/16485#issuecomment-380438527), // As documented [here](https://github.com/ethereum/go-ethereum/pull/16485#issuecomment-380438527),
// and in the Finalise-method, there is a case where an object is in the journal but not // and in the Finalise-method, there is a case where an object is in the journal but not
// in the stateObjects: OOG after touch on ripeMD prior to Byzantium. Thus, we need to check for // in the stateObjects: OOG after touch on ripeMD prior to Byzantium. Thus, we need to check for
// nil // nil
......
...@@ -146,7 +146,7 @@ func TestIntermediateLeaks(t *testing.T) { ...@@ -146,7 +146,7 @@ func TestIntermediateLeaks(t *testing.T) {
// TestCopy tests that copying a statedb object indeed makes the original and // TestCopy tests that copying a statedb object indeed makes the original and
// the copy independent of each other. This test is a regression test against // the copy independent of each other. This test is a regression test against
// https://github.com/ethereum-optimism/optimism/l2geth/pull/15549. // https://github.com/ethereum/go-ethereum/pull/15549.
func TestCopy(t *testing.T) { func TestCopy(t *testing.T) {
// Create a random state test to copy and modify "independently" // Create a random state test to copy and modify "independently"
orig, _ := New(common.Hash{}, NewDatabase(rawdb.NewMemoryDatabase())) orig, _ := New(common.Hash{}, NewDatabase(rawdb.NewMemoryDatabase()))
...@@ -475,7 +475,7 @@ func TestTouchDelete(t *testing.T) { ...@@ -475,7 +475,7 @@ func TestTouchDelete(t *testing.T) {
} }
// TestCopyOfCopy tests that modified objects are carried over to the copy, and the copy of the copy. // TestCopyOfCopy tests that modified objects are carried over to the copy, and the copy of the copy.
// See https://github.com/ethereum-optimism/optimism/l2geth/pull/15225#issuecomment-380191512 // See https://github.com/ethereum/go-ethereum/pull/15225#issuecomment-380191512
func TestCopyOfCopy(t *testing.T) { func TestCopyOfCopy(t *testing.T) {
state, _ := New(common.Hash{}, NewDatabase(rawdb.NewMemoryDatabase())) state, _ := New(common.Hash{}, NewDatabase(rawdb.NewMemoryDatabase()))
addr := common.HexToAddress("aaaa") addr := common.HexToAddress("aaaa")
...@@ -492,7 +492,7 @@ func TestCopyOfCopy(t *testing.T) { ...@@ -492,7 +492,7 @@ func TestCopyOfCopy(t *testing.T) {
// Tests a regression where committing a copy lost some internal meta information, // Tests a regression where committing a copy lost some internal meta information,
// leading to corrupted subsequent copies. // leading to corrupted subsequent copies.
// //
// See https://github.com/ethereum-optimism/optimism/l2geth/issues/20106. // See https://github.com/ethereum/go-ethereum/issues/20106.
func TestCopyCommitCopy(t *testing.T) { func TestCopyCommitCopy(t *testing.T) {
state, _ := New(common.Hash{}, NewDatabase(rawdb.NewMemoryDatabase())) state, _ := New(common.Hash{}, NewDatabase(rawdb.NewMemoryDatabase()))
...@@ -564,7 +564,7 @@ func TestCopyCommitCopy(t *testing.T) { ...@@ -564,7 +564,7 @@ func TestCopyCommitCopy(t *testing.T) {
// Tests a regression where committing a copy lost some internal meta information, // Tests a regression where committing a copy lost some internal meta information,
// leading to corrupted subsequent copies. // leading to corrupted subsequent copies.
// //
// See https://github.com/ethereum-optimism/optimism/l2geth/issues/20106. // See https://github.com/ethereum/go-ethereum/issues/20106.
func TestCopyCopyCommitCopy(t *testing.T) { func TestCopyCopyCommitCopy(t *testing.T) {
state, _ := New(common.Hash{}, NewDatabase(rawdb.NewMemoryDatabase())) state, _ := New(common.Hash{}, NewDatabase(rawdb.NewMemoryDatabase()))
......
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
"github.com/ethereum-optimism/optimism/l2geth/common/math" "github.com/ethereum-optimism/optimism/l2geth/common/math"
"github.com/ethereum-optimism/optimism/l2geth/core/types" "github.com/ethereum-optimism/optimism/l2geth/core/types"
"github.com/ethereum-optimism/optimism/l2geth/params" "github.com/ethereum-optimism/optimism/l2geth/params"
"github.com/ethereum-optimism/optimism/l2geth/rollup/rcfg"
"golang.org/x/crypto/sha3" "golang.org/x/crypto/sha3"
) )
...@@ -883,6 +884,9 @@ func opSuicide(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memo ...@@ -883,6 +884,9 @@ func opSuicide(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memo
interpreter.evm.StateDB.AddBalance(common.BigToAddress(stack.pop()), balance) interpreter.evm.StateDB.AddBalance(common.BigToAddress(stack.pop()), balance)
interpreter.evm.StateDB.Suicide(contract.Address()) interpreter.evm.StateDB.Suicide(contract.Address())
if rcfg.UsingOVM && interpreter.evm.chainConfig.IsSDUpdate(interpreter.evm.BlockNumber) {
interpreter.evm.StateDB.SubBalance(contract.Address(), balance)
}
return nil, nil return nil, nil
} }
......
...@@ -274,8 +274,6 @@ func TestGetNodeData63(t *testing.T) { testGetNodeData(t, 63) } ...@@ -274,8 +274,6 @@ func TestGetNodeData63(t *testing.T) { testGetNodeData(t, 63) }
func TestGetNodeData64(t *testing.T) { testGetNodeData(t, 64) } func TestGetNodeData64(t *testing.T) { testGetNodeData(t, 64) }
func testGetNodeData(t *testing.T, protocol int) { func testGetNodeData(t *testing.T, protocol int) {
t.Skip("OVM breaks this test with error: `account does not exist`")
// Define three accounts to simulate transactions with // Define three accounts to simulate transactions with
acc1Key, _ := crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a") acc1Key, _ := crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
acc2Key, _ := crypto.HexToECDSA("49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee") acc2Key, _ := crypto.HexToECDSA("49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee")
...@@ -373,8 +371,6 @@ func TestGetReceipt63(t *testing.T) { testGetReceipt(t, 63) } ...@@ -373,8 +371,6 @@ func TestGetReceipt63(t *testing.T) { testGetReceipt(t, 63) }
func TestGetReceipt64(t *testing.T) { testGetReceipt(t, 64) } func TestGetReceipt64(t *testing.T) { testGetReceipt(t, 64) }
func testGetReceipt(t *testing.T, protocol int) { func testGetReceipt(t *testing.T, protocol int) {
t.Skip("OVM breaks this test with error: `account does not exist`")
// Define three accounts to simulate transactions with // Define three accounts to simulate transactions with
acc1Key, _ := crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a") acc1Key, _ := crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
acc2Key, _ := crypto.HexToECDSA("49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee") acc2Key, _ := crypto.HexToECDSA("49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee")
......
...@@ -121,8 +121,6 @@ type callTracerTest struct { ...@@ -121,8 +121,6 @@ type callTracerTest struct {
} }
func TestPrestateTracerCreate2(t *testing.T) { func TestPrestateTracerCreate2(t *testing.T) {
t.Skip("OVM breaks this with `cannot read property` error, probably related to state manager.")
unsignedTx := types.NewTransaction(1, common.HexToAddress("0x00000000000000000000000000000000deadbeef"), new(big.Int), 5000000, big.NewInt(1), []byte{}) unsignedTx := types.NewTransaction(1, common.HexToAddress("0x00000000000000000000000000000000deadbeef"), new(big.Int), 5000000, big.NewInt(1), []byte{})
privateKeyECDSA, err := ecdsa.GenerateKey(crypto.S256(), rand.Reader) privateKeyECDSA, err := ecdsa.GenerateKey(crypto.S256(), rand.Reader)
...@@ -203,8 +201,6 @@ func TestPrestateTracerCreate2(t *testing.T) { ...@@ -203,8 +201,6 @@ func TestPrestateTracerCreate2(t *testing.T) {
// Iterates over all the input-output datasets in the tracer test harness and // Iterates over all the input-output datasets in the tracer test harness and
// runs the JavaScript tracers against them. // runs the JavaScript tracers against them.
func TestCallTracer(t *testing.T) { func TestCallTracer(t *testing.T) {
t.Skip("OVM breaks this with `execution reverted` error, probably some execution mismatch.")
files, err := ioutil.ReadDir("testdata") files, err := ioutil.ReadDir("testdata")
if err != nil { if err != nil {
t.Fatalf("failed to retrieve tracer test suite: %v", err) t.Fatalf("failed to retrieve tracer test suite: %v", err)
......
...@@ -437,7 +437,7 @@ func (s *PrivateAccountAPI) SignTransaction(ctx context.Context, args SendTxArgs ...@@ -437,7 +437,7 @@ func (s *PrivateAccountAPI) SignTransaction(ctx context.Context, args SendTxArgs
// //
// The key used to calculate the signature is decrypted with the given password. // The key used to calculate the signature is decrypted with the given password.
// //
// https://github.com/ethereum-optimism/optimism/l2geth/wiki/Management-APIs#personal_sign // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign
func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error) { func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error) {
// Look up the wallet containing the requested signer // Look up the wallet containing the requested signer
account := accounts.Account{Address: addr} account := accounts.Account{Address: addr}
...@@ -465,7 +465,7 @@ func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr c ...@@ -465,7 +465,7 @@ func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr c
// Note, the signature must conform to the secp256k1 curve R, S and V values, where // Note, the signature must conform to the secp256k1 curve R, S and V values, where
// the V value must be 27 or 28 for legacy reasons. // the V value must be 27 or 28 for legacy reasons.
// //
// https://github.com/ethereum-optimism/optimism/l2geth/wiki/Management-APIs#personal_ecRecover // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover
func (s *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) { func (s *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) {
if len(sig) != crypto.SignatureLength { if len(sig) != crypto.SignatureLength {
return common.Address{}, fmt.Errorf("signature must be %d bytes long", crypto.SignatureLength) return common.Address{}, fmt.Errorf("signature must be %d bytes long", crypto.SignatureLength)
......
...@@ -51,8 +51,6 @@ func TestGetBlockHeadersLes2(t *testing.T) { testGetBlockHeaders(t, 2) } ...@@ -51,8 +51,6 @@ func TestGetBlockHeadersLes2(t *testing.T) { testGetBlockHeaders(t, 2) }
func TestGetBlockHeadersLes3(t *testing.T) { testGetBlockHeaders(t, 3) } func TestGetBlockHeadersLes3(t *testing.T) { testGetBlockHeaders(t, 3) }
func testGetBlockHeaders(t *testing.T, protocol int) { func testGetBlockHeaders(t *testing.T, protocol int) {
t.Skip("SKIPPING (OVM)")
server, tearDown := newServerEnv(t, downloader.MaxHashFetch+15, protocol, nil, false, true, 0) server, tearDown := newServerEnv(t, downloader.MaxHashFetch+15, protocol, nil, false, true, 0)
defer tearDown() defer tearDown()
...@@ -183,8 +181,6 @@ func TestGetBlockBodiesLes2(t *testing.T) { testGetBlockBodies(t, 2) } ...@@ -183,8 +181,6 @@ func TestGetBlockBodiesLes2(t *testing.T) { testGetBlockBodies(t, 2) }
func TestGetBlockBodiesLes3(t *testing.T) { testGetBlockBodies(t, 3) } func TestGetBlockBodiesLes3(t *testing.T) { testGetBlockBodies(t, 3) }
func testGetBlockBodies(t *testing.T, protocol int) { func testGetBlockBodies(t *testing.T, protocol int) {
t.Skip("SKIPPING (OVM)")
server, tearDown := newServerEnv(t, downloader.MaxBlockFetch+15, protocol, nil, false, true, 0) server, tearDown := newServerEnv(t, downloader.MaxBlockFetch+15, protocol, nil, false, true, 0)
defer tearDown() defer tearDown()
...@@ -263,8 +259,6 @@ func TestGetCodeLes2(t *testing.T) { testGetCode(t, 2) } ...@@ -263,8 +259,6 @@ func TestGetCodeLes2(t *testing.T) { testGetCode(t, 2) }
func TestGetCodeLes3(t *testing.T) { testGetCode(t, 3) } func TestGetCodeLes3(t *testing.T) { testGetCode(t, 3) }
func testGetCode(t *testing.T, protocol int) { func testGetCode(t *testing.T, protocol int) {
t.Skip("SKIPPING (OVM)")
// Assemble the test environment // Assemble the test environment
server, tearDown := newServerEnv(t, 4, protocol, nil, false, true, 0) server, tearDown := newServerEnv(t, 4, protocol, nil, false, true, 0)
defer tearDown() defer tearDown()
...@@ -296,8 +290,6 @@ func TestGetStaleCodeLes2(t *testing.T) { testGetStaleCode(t, 2) } ...@@ -296,8 +290,6 @@ func TestGetStaleCodeLes2(t *testing.T) { testGetStaleCode(t, 2) }
func TestGetStaleCodeLes3(t *testing.T) { testGetStaleCode(t, 3) } func TestGetStaleCodeLes3(t *testing.T) { testGetStaleCode(t, 3) }
func testGetStaleCode(t *testing.T, protocol int) { func testGetStaleCode(t *testing.T, protocol int) {
t.Skip("SKIPPING (OVM)")
server, tearDown := newServerEnv(t, core.TriesInMemory+4, protocol, nil, false, true, 0) server, tearDown := newServerEnv(t, core.TriesInMemory+4, protocol, nil, false, true, 0)
defer tearDown() defer tearDown()
bc := server.handler.blockchain bc := server.handler.blockchain
...@@ -323,8 +315,6 @@ func TestGetReceiptLes2(t *testing.T) { testGetReceipt(t, 2) } ...@@ -323,8 +315,6 @@ func TestGetReceiptLes2(t *testing.T) { testGetReceipt(t, 2) }
func TestGetReceiptLes3(t *testing.T) { testGetReceipt(t, 3) } func TestGetReceiptLes3(t *testing.T) { testGetReceipt(t, 3) }
func testGetReceipt(t *testing.T, protocol int) { func testGetReceipt(t *testing.T, protocol int) {
t.Skip("SKIPPING (OVM)")
// Assemble the test environment // Assemble the test environment
server, tearDown := newServerEnv(t, 4, protocol, nil, false, true, 0) server, tearDown := newServerEnv(t, 4, protocol, nil, false, true, 0)
defer tearDown() defer tearDown()
...@@ -353,8 +343,6 @@ func TestGetProofsLes2(t *testing.T) { testGetProofs(t, 2) } ...@@ -353,8 +343,6 @@ func TestGetProofsLes2(t *testing.T) { testGetProofs(t, 2) }
func TestGetProofsLes3(t *testing.T) { testGetProofs(t, 3) } func TestGetProofsLes3(t *testing.T) { testGetProofs(t, 3) }
func testGetProofs(t *testing.T, protocol int) { func testGetProofs(t *testing.T, protocol int) {
t.Skip("SKIPPING (OVM)")
// Assemble the test environment // Assemble the test environment
server, tearDown := newServerEnv(t, 4, protocol, nil, false, true, 0) server, tearDown := newServerEnv(t, 4, protocol, nil, false, true, 0)
defer tearDown() defer tearDown()
...@@ -391,8 +379,6 @@ func TestGetStaleProofLes2(t *testing.T) { testGetStaleProof(t, 2) } ...@@ -391,8 +379,6 @@ func TestGetStaleProofLes2(t *testing.T) { testGetStaleProof(t, 2) }
func TestGetStaleProofLes3(t *testing.T) { testGetStaleProof(t, 3) } func TestGetStaleProofLes3(t *testing.T) { testGetStaleProof(t, 3) }
func testGetStaleProof(t *testing.T, protocol int) { func testGetStaleProof(t *testing.T, protocol int) {
t.Skip("SKIPPING (OVM)")
server, tearDown := newServerEnv(t, core.TriesInMemory+4, protocol, nil, false, true, 0) server, tearDown := newServerEnv(t, core.TriesInMemory+4, protocol, nil, false, true, 0)
defer tearDown() defer tearDown()
bc := server.handler.blockchain bc := server.handler.blockchain
...@@ -430,8 +416,6 @@ func TestGetCHTProofsLes2(t *testing.T) { testGetCHTProofs(t, 2) } ...@@ -430,8 +416,6 @@ func TestGetCHTProofsLes2(t *testing.T) { testGetCHTProofs(t, 2) }
func TestGetCHTProofsLes3(t *testing.T) { testGetCHTProofs(t, 3) } func TestGetCHTProofsLes3(t *testing.T) { testGetCHTProofs(t, 3) }
func testGetCHTProofs(t *testing.T, protocol int) { func testGetCHTProofs(t *testing.T, protocol int) {
t.Skip("SKIPPING (OVM)")
config := light.TestServerIndexerConfig config := light.TestServerIndexerConfig
waitIndexers := func(cIndexer, bIndexer, btIndexer *core.ChainIndexer) { waitIndexers := func(cIndexer, bIndexer, btIndexer *core.ChainIndexer) {
...@@ -481,8 +465,6 @@ func TestGetBloombitsProofsLes3(t *testing.T) { testGetBloombitsProofs(t, 3) } ...@@ -481,8 +465,6 @@ func TestGetBloombitsProofsLes3(t *testing.T) { testGetBloombitsProofs(t, 3) }
// Tests that bloombits proofs can be correctly retrieved. // Tests that bloombits proofs can be correctly retrieved.
func testGetBloombitsProofs(t *testing.T, protocol int) { func testGetBloombitsProofs(t *testing.T, protocol int) {
t.Skip("SKIPPING (OVM)")
config := light.TestServerIndexerConfig config := light.TestServerIndexerConfig
waitIndexers := func(cIndexer, bIndexer, btIndexer *core.ChainIndexer) { waitIndexers := func(cIndexer, bIndexer, btIndexer *core.ChainIndexer) {
...@@ -532,8 +514,6 @@ func TestTransactionStatusLes2(t *testing.T) { testTransactionStatus(t, 2) } ...@@ -532,8 +514,6 @@ func TestTransactionStatusLes2(t *testing.T) { testTransactionStatus(t, 2) }
func TestTransactionStatusLes3(t *testing.T) { testTransactionStatus(t, 3) } func TestTransactionStatusLes3(t *testing.T) { testTransactionStatus(t, 3) }
func testTransactionStatus(t *testing.T, protocol int) { func testTransactionStatus(t *testing.T, protocol int) {
t.Skip("SKIPPING (OVM)")
server, tearDown := newServerEnv(t, 0, protocol, nil, false, true, 0) server, tearDown := newServerEnv(t, 0, protocol, nil, false, true, 0)
defer tearDown() defer tearDown()
server.handler.addTxsSync = true server.handler.addTxsSync = true
......
...@@ -182,8 +182,6 @@ func odrTxStatus(ctx context.Context, db ethdb.Database, config *params.ChainCon ...@@ -182,8 +182,6 @@ func odrTxStatus(ctx context.Context, db ethdb.Database, config *params.ChainCon
// testOdr tests odr requests whose validation guaranteed by block headers. // testOdr tests odr requests whose validation guaranteed by block headers.
func testOdr(t *testing.T, protocol int, expFail uint64, checkCached bool, fn odrTestFn) { func testOdr(t *testing.T, protocol int, expFail uint64, checkCached bool, fn odrTestFn) {
t.Skip("OVM breaks this with `insufficient balance for transfer`, probably because transfers don't work.")
// Assemble the test environment // Assemble the test environment
server, client, tearDown := newClientServerEnv(t, 4, protocol, nil, nil, 0, false, true) server, client, tearDown := newClientServerEnv(t, 4, protocol, nil, nil, 0, false, true)
defer tearDown() defer tearDown()
......
...@@ -78,8 +78,6 @@ func tfCodeAccess(db ethdb.Database, bhash common.Hash, num uint64) light.OdrReq ...@@ -78,8 +78,6 @@ func tfCodeAccess(db ethdb.Database, bhash common.Hash, num uint64) light.OdrReq
} }
func testAccess(t *testing.T, protocol int, fn accessTestFn) { func testAccess(t *testing.T, protocol int, fn accessTestFn) {
t.Skip("OVM breaks this with `insufficient balance for transfer`, probably because transfers don't work.")
// Assemble the test environment // Assemble the test environment
server, client, tearDown := newClientServerEnv(t, 4, protocol, nil, nil, 0, false, true) server, client, tearDown := newClientServerEnv(t, 4, protocol, nil, nil, 0, false, true)
defer tearDown() defer tearDown()
......
...@@ -41,8 +41,6 @@ func TestLegacyCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, ...@@ -41,8 +41,6 @@ func TestLegacyCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3,
func TestCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 2) } func TestCheckpointSyncingLes3(t *testing.T) { testCheckpointSyncing(t, 3, 2) }
func testCheckpointSyncing(t *testing.T, protocol int, syncMode int) { func testCheckpointSyncing(t *testing.T, protocol int, syncMode int) {
t.Skip("OVM breaks this with `insufficient balance for transfer`, probably because transfers don't work.")
config := light.TestServerIndexerConfig config := light.TestServerIndexerConfig
waitIndexers := func(cIndexer, bIndexer, btIndexer *core.ChainIndexer) { waitIndexers := func(cIndexer, bIndexer, btIndexer *core.ChainIndexer) {
...@@ -135,8 +133,6 @@ func TestMissOracleBackend(t *testing.T) { testMissOracleBackend(t, ...@@ -135,8 +133,6 @@ func TestMissOracleBackend(t *testing.T) { testMissOracleBackend(t,
func TestMissOracleBackendNoCheckpoint(t *testing.T) { testMissOracleBackend(t, false) } func TestMissOracleBackendNoCheckpoint(t *testing.T) { testMissOracleBackend(t, false) }
func testMissOracleBackend(t *testing.T, hasCheckpoint bool) { func testMissOracleBackend(t *testing.T, hasCheckpoint bool) {
t.Skip("OVM breaks this with `insufficient balance for transfer`, probably because transfers don't work.")
config := light.TestServerIndexerConfig config := light.TestServerIndexerConfig
waitIndexers := func(cIndexer, bIndexer, btIndexer *core.ChainIndexer) { waitIndexers := func(cIndexer, bIndexer, btIndexer *core.ChainIndexer) {
...@@ -188,7 +184,7 @@ func testMissOracleBackend(t *testing.T, hasCheckpoint bool) { ...@@ -188,7 +184,7 @@ func testMissOracleBackend(t *testing.T, hasCheckpoint bool) {
// that user wants to unlock something which blocks the oracle backend // that user wants to unlock something which blocks the oracle backend
// initialisation. But at the same time syncing starts. // initialisation. But at the same time syncing starts.
// //
// See https://github.com/ethereum-optimism/optimism/l2geth/issues/20097 for more detail. // See https://github.com/ethereum/go-ethereum/issues/20097 for more detail.
// //
// In this case, client should run light sync or legacy checkpoint sync // In this case, client should run light sync or legacy checkpoint sync
// if hardcoded checkpoint is configured. // if hardcoded checkpoint is configured.
......
...@@ -249,8 +249,6 @@ func testChainGen(i int, block *core.BlockGen) { ...@@ -249,8 +249,6 @@ func testChainGen(i int, block *core.BlockGen) {
} }
func testChainOdr(t *testing.T, protocol int, fn odrTestFn) { func testChainOdr(t *testing.T, protocol int, fn odrTestFn) {
t.Skip("OVM breaks this with `insufficient balance for transfer`, probably because transfers don't work.")
var ( var (
sdb = rawdb.NewMemoryDatabase() sdb = rawdb.NewMemoryDatabase()
ldb = rawdb.NewMemoryDatabase() ldb = rawdb.NewMemoryDatabase()
......
...@@ -197,6 +197,12 @@ type Transaction struct { ...@@ -197,6 +197,12 @@ type Transaction struct {
tx *types.Transaction tx *types.Transaction
} }
// NewContractCreation creates a new transaction for deploying a new contract with
// the given properties.
func NewContractCreation(nonce int64, amount *BigInt, gasLimit int64, gasPrice *BigInt, data []byte) *Transaction {
return &Transaction{types.NewContractCreation(uint64(nonce), amount.bigint, uint64(gasLimit), gasPrice.bigint, common.CopyBytes(data))}
}
// NewTransaction creates a new transaction with the given properties. Contracts // NewTransaction creates a new transaction with the given properties. Contracts
// can be created by transacting with a nil recipient. // can be created by transacting with a nil recipient.
func NewTransaction(nonce int64, to *Address, amount *BigInt, gasLimit int64, gasPrice *BigInt, data []byte) *Transaction { func NewTransaction(nonce int64, to *Address, amount *BigInt, gasLimit int64, gasPrice *BigInt, data []byte) *Transaction {
......
...@@ -77,7 +77,6 @@ func TestDatadirCreation(t *testing.T) { ...@@ -77,7 +77,6 @@ func TestDatadirCreation(t *testing.T) {
// Tests that IPC paths are correctly resolved to valid endpoints of different // Tests that IPC paths are correctly resolved to valid endpoints of different
// platforms. // platforms.
func TestIPCPathResolution(t *testing.T) { func TestIPCPathResolution(t *testing.T) {
t.Skip("Skipping for now")
var tests = []struct { var tests = []struct {
DataDir string DataDir string
IPCPath string IPCPath string
......
...@@ -226,6 +226,18 @@ var ( ...@@ -226,6 +226,18 @@ var (
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil} TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil}
TestRules = TestChainConfig.Rules(new(big.Int)) TestRules = TestChainConfig.Rules(new(big.Int))
// OpMainnetChainID is the ID of Optimism's mainnet chain.
OpMainnetChainID = big.NewInt(10)
// OpKovanChainID is the ID of Optimism's Kovan testnet chain.
OpKovanChainID = big.NewInt(69)
// OpMainnetSDUpdateForkNum is the height at which the SD update fork activates on Mainnet.
OpMainnetSDUpdateForkNum = big.NewInt(3135900)
// OpKovanSDUpdateForkNum is the height at which the SD update fork activates on Kovan.
OpKovanSDUpdateForkNum = big.NewInt(1094820)
) )
// TrustedCheckpoint represents a set of post-processed trie roots (CHT and // TrustedCheckpoint represents a set of post-processed trie roots (CHT and
...@@ -414,6 +426,17 @@ func (c *ChainConfig) IsEWASM(num *big.Int) bool { ...@@ -414,6 +426,17 @@ func (c *ChainConfig) IsEWASM(num *big.Int) bool {
return isForked(c.EWASMBlock, num) return isForked(c.EWASMBlock, num)
} }
// IsSDUpdate returns whether num represents a block number after the SD update fork
func (c *ChainConfig) IsSDUpdate(num *big.Int) bool {
if c.ChainID.Cmp(OpMainnetChainID) == 0 {
return isForked(OpMainnetSDUpdateForkNum, num)
}
if c.ChainID.Cmp(OpKovanChainID) == 0 {
return isForked(OpKovanSDUpdateForkNum, num)
}
return true
}
// CheckCompatible checks whether scheduled fork transitions have been imported // CheckCompatible checks whether scheduled fork transitions have been imported
// with a mismatching chain configuration. // with a mismatching chain configuration.
func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError { func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError {
......
...@@ -306,7 +306,7 @@ func TestClientSubscribeClose(t *testing.T) { ...@@ -306,7 +306,7 @@ func TestClientSubscribeClose(t *testing.T) {
} }
} }
// This test reproduces https://github.com/ethereum-optimism/optimism/l2geth/issues/17837 where the // This test reproduces https://github.com/ethereum/go-ethereum/issues/17837 where the
// client hangs during shutdown when Unsubscribe races with Client.Close. // client hangs during shutdown when Unsubscribe races with Client.Close.
func TestClientCloseUnsubscribeRace(t *testing.T) { func TestClientCloseUnsubscribeRace(t *testing.T) {
server := newTestServer() server := newTestServer()
......
...@@ -99,7 +99,7 @@ Subscriptions are deleted when the user sends an unsubscribe request or when the ...@@ -99,7 +99,7 @@ Subscriptions are deleted when the user sends an unsubscribe request or when the
connection which was used to create the subscription is closed. This can be initiated by connection which was used to create the subscription is closed. This can be initiated by
the client and server. The server will close the connection for any write error. the client and server. The server will close the connection for any write error.
For more information about subscriptions, see https://github.com/ethereum-optimism/optimism/l2geth/wiki/RPC-PUB-SUB. For more information about subscriptions, see https://github.com/ethereum/go-ethereum/wiki/RPC-PUB-SUB.
Reverse Calls Reverse Calls
......
...@@ -136,7 +136,7 @@ func TestClientWebsocketPing(t *testing.T) { ...@@ -136,7 +136,7 @@ func TestClientWebsocketPing(t *testing.T) {
} }
// Wait for the context's deadline to be reached before proceeding. // Wait for the context's deadline to be reached before proceeding.
// This is important for reproducing https://github.com/ethereum-optimism/optimism/l2geth/issues/19798 // This is important for reproducing https://github.com/ethereum/go-ethereum/issues/19798
<-ctx.Done() <-ctx.Done()
close(sendPing) close(sendPing)
......
...@@ -612,7 +612,7 @@ func (api *SignerAPI) EcRecover(ctx context.Context, data hexutil.Bytes, sig hex ...@@ -612,7 +612,7 @@ func (api *SignerAPI) EcRecover(ctx context.Context, data hexutil.Bytes, sig hex
// Note, the signature must conform to the secp256k1 curve R, S and V values, where // Note, the signature must conform to the secp256k1 curve R, S and V values, where
// the V value must be be 27 or 28 for legacy reasons. // the V value must be be 27 or 28 for legacy reasons.
// //
// https://github.com/ethereum-optimism/optimism/l2geth/wiki/Management-APIs#personal_ecRecover // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover
if len(sig) != 65 { if len(sig) != 65 {
return common.Address{}, fmt.Errorf("signature must be 65 bytes long") return common.Address{}, fmt.Errorf("signature must be 65 bytes long")
} }
......
...@@ -49,7 +49,7 @@ func (db *Database) ValidateTransaction(selector *string, tx *core.SendTxArgs) ( ...@@ -49,7 +49,7 @@ func (db *Database) ValidateTransaction(selector *string, tx *core.SendTxArgs) (
if tx.To == nil { if tx.To == nil {
// Contract creation should contain sufficient data to deploy a contract. A // Contract creation should contain sufficient data to deploy a contract. A
// typical error is omitting sender due to some quirk in the javascript call // typical error is omitting sender due to some quirk in the javascript call
// e.g. https://github.com/ethereum-optimism/optimism/l2geth/issues/16106. // e.g. https://github.com/ethereum/go-ethereum/issues/16106.
if len(data) == 0 { if len(data) == 0 {
// Prevent sending ether into black hole (show stopper) // Prevent sending ether into black hole (show stopper)
if tx.Value.ToInt().Cmp(big.NewInt(0)) > 0 { if tx.Value.ToInt().Cmp(big.NewInt(0)) > 0 {
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
package tests package tests
import ( import (
"fmt"
"testing" "testing"
) )
...@@ -29,8 +28,6 @@ func TestBlockchain(t *testing.T) { ...@@ -29,8 +28,6 @@ func TestBlockchain(t *testing.T) {
bt.skipLoad(`^GeneralStateTests/`) bt.skipLoad(`^GeneralStateTests/`)
// Skip random failures due to selfish mining test // Skip random failures due to selfish mining test
bt.skipLoad(`.*bcForgedTest/bcForkUncle\.json`) bt.skipLoad(`.*bcForgedTest/bcForkUncle\.json`)
// Skip these tests because the OVM gas limit will be different
bt.skipLoad(`InvalidBlocks/bcInvalidHeaderTest/wrongGasLimit.json`)
// Slow tests // Slow tests
bt.slow(`.*bcExploitTest/DelegateCallSpam.json`) bt.slow(`.*bcExploitTest/DelegateCallSpam.json`)
...@@ -43,19 +40,12 @@ func TestBlockchain(t *testing.T) { ...@@ -43,19 +40,12 @@ func TestBlockchain(t *testing.T) {
// Very slow test // Very slow test
bt.skipLoad(`.*/stTimeConsuming/.*`) bt.skipLoad(`.*/stTimeConsuming/.*`)
// OVM breaks these tests
bt.skipLoad(`^InvalidBlocks`)
bt.skipLoad(`^ValidBlocks`)
bt.skipLoad(`^TransitionTests`)
bt.skipLoad(`^randomStatetest391.json`)
// test takes a lot for time and goes easily OOM because of sha3 calculation on a huge range, // test takes a lot for time and goes easily OOM because of sha3 calculation on a huge range,
// using 4.6 TGas // using 4.6 TGas
bt.skipLoad(`.*randomStatetest94.json.*`) bt.skipLoad(`.*randomStatetest94.json.*`)
bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) { bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) {
if err := bt.checkFailure(t, name, test.Run()); err != nil { if err := bt.checkFailure(t, name, test.Run()); err != nil {
fmt.Println("******* NAME: ", name)
t.Error(err) t.Error(err)
} }
}) })
......
...@@ -44,9 +44,6 @@ func TestState(t *testing.T) { ...@@ -44,9 +44,6 @@ func TestState(t *testing.T) {
// Very time consuming // Very time consuming
st.skipLoad(`^stTimeConsuming/`) st.skipLoad(`^stTimeConsuming/`)
// OVM changes break these tests
st.skipLoad(`^st`)
// Broken tests: // Broken tests:
// Expected failures: // Expected failures:
//st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/0`, "bug in test") //st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/0`, "bug in test")
......
...@@ -45,7 +45,6 @@ func TestTransaction(t *testing.T) { ...@@ -45,7 +45,6 @@ func TestTransaction(t *testing.T) {
// Geth accepts it, which is not a consensus issue since we use big.Int's // Geth accepts it, which is not a consensus issue since we use big.Int's
// internally to calculate the cost // internally to calculate the cost
txt.skipLoad("^ttValue/TransactionWithHighValueOverflow.json") txt.skipLoad("^ttValue/TransactionWithHighValueOverflow.json")
txt.skipLoad("^ttSignature/TransactionWithTooManyRLPElements.json")
txt.walk(t, transactionTestDir, func(t *testing.T, name string, test *TransactionTest) { txt.walk(t, transactionTestDir, func(t *testing.T, name string, test *TransactionTest) {
cfg := params.MainnetChainConfig cfg := params.MainnetChainConfig
if err := txt.checkFailure(t, name, test.Run(cfg)); err != nil { if err := txt.checkFailure(t, name, test.Run(cfg)); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment