diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-10-31 18:32:05 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-11-13 17:44:06 +0800 |
commit | 5cd86443ee071b5e3abe4995c777ce467c29f2c5 (patch) | |
tree | 0d67d118efab52c09a877c4be9560b9c9020f775 /tests/state_test.go | |
parent | 779ddb183275ed506ebae972876fe04098c738e5 (diff) | |
download | go-tangerine-5cd86443ee071b5e3abe4995c777ce467c29f2c5.tar.gz go-tangerine-5cd86443ee071b5e3abe4995c777ce467c29f2c5.tar.zst go-tangerine-5cd86443ee071b5e3abe4995c777ce467c29f2c5.zip |
tests: added new EIP158 tests
Diffstat (limited to 'tests/state_test.go')
-rw-r--r-- | tests/state_test.go | 301 |
1 files changed, 290 insertions, 11 deletions
diff --git a/tests/state_test.go b/tests/state_test.go index b266c2215..73dcc59a5 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -175,17 +175,6 @@ func TestCallCodes(t *testing.T) { } } -func TestDelegateCall(t *testing.T) { - chainConfig := ¶ms.ChainConfig{ - HomesteadBlock: big.NewInt(1150000), - } - - fn := filepath.Join(stateTestDir, "stDelegatecallTest.json") - if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { - t.Error(err) - } -} - func TestMemory(t *testing.T) { chainConfig := ¶ms.ChainConfig{ HomesteadBlock: big.NewInt(1150000), @@ -261,6 +250,17 @@ func TestStateTestsRandom(t *testing.T) { } // homestead tests +func TestHomesteadDelegateCall(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: big.NewInt(1150000), + } + + fn := filepath.Join(stateTestDir, "Homestead", "stDelegatecallTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + func TestHomesteadStateSystemOperations(t *testing.T) { chainConfig := ¶ms.ChainConfig{ HomesteadBlock: new(big.Int), @@ -704,3 +704,282 @@ func TestEIP158Specific(t *testing.T) { t.Error(err) } } + +func TestEIP158NonZeroCalls(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "stNonZeroCallsTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158ZeroCalls(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "stZeroCallsTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158_150Specific(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "EIP150", "stEIPSpecificTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158_150SingleCodeGasPrice(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "EIP150", "stEIPSingleCodeGasPrices.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158_150MemExpandingCalls(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "EIP150", "stMemExpandingEIPCalls.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadStateSystemOperations(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stSystemOperationsTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadStatePreCompiledContracts(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stPreCompiledContracts.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadStateRecursiveCreate(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stSpecialTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadStateRefund(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stRefundTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadStateInitCode(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stInitCodeTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadStateLog(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stLogTests.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadStateTransaction(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stTransactionTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadCallCreateCallCode(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallCreateCallCodeTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadCallCodes(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallCodes.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadMemory(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stMemoryTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadMemoryStress(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + if os.Getenv("TEST_VM_COMPLEX") == "" { + t.Skip() + } + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stMemoryStressTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadQuadraticComplexity(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + if os.Getenv("TEST_VM_COMPLEX") == "" { + t.Skip() + } + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stQuadraticComplexityTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadWallet(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stWalletTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadDelegateCodes(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallDelegateCodes.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadDelegateCodesCallCode(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stCallDelegateCodesCallCode.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} + +func TestEIP158HomesteadBounds(t *testing.T) { + chainConfig := ¶ms.ChainConfig{ + HomesteadBlock: new(big.Int), + EIP150Block: big.NewInt(2457000), + EIP158Block: big.NewInt(3500000), + } + + fn := filepath.Join(stateTestDir, "EIP158", "Homestead", "stBoundsTest.json") + if err := RunStateTest(chainConfig, fn, StateSkipTests); err != nil { + t.Error(err) + } +} |