diff options
-rw-r--r-- | cmd/mist/assets/examples/coin.html | 3 | ||||
-rw-r--r-- | core/vm/gas.go | 7 | ||||
-rw-r--r-- | tests/vm/gh_test.go | 28 |
3 files changed, 32 insertions, 6 deletions
diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html index b265f777d..a734e144f 100644 --- a/cmd/mist/assets/examples/coin.html +++ b/cmd/mist/assets/examples/coin.html @@ -85,9 +85,6 @@ function refresh() { document.querySelector("#balance").innerHTML = contract.call({from:eth.coinbase}).balance(eth.coinbase); - - var table = document.querySelector("#table_body"); - table.innerHTML = ""; // clear } function transact() { diff --git a/core/vm/gas.go b/core/vm/gas.go index f7abe63f8..33fc3a002 100644 --- a/core/vm/gas.go +++ b/core/vm/gas.go @@ -2,8 +2,9 @@ package vm import ( "fmt" - "github.com/ethereum/go-ethereum/params" "math/big" + + "github.com/ethereum/go-ethereum/params" ) var ( @@ -37,8 +38,8 @@ func baseCheck(op OpCode, stack *stack, gas *big.Int) error { return err } - if r.stackPush && len(stack.data)-r.stackPop+1 > int(params.StackLimit.Int64()) { - return fmt.Errorf("stack limit reached (%d)", params.StackLimit.Int64()) + if r.stackPush && len(stack.data)-r.stackPop > int(params.StackLimit.Int64()) { + return fmt.Errorf("stack limit reached %d (%d)", len(stack.data), params.StackLimit.Int64()) } gas.Add(gas, r.gas) diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index cd5684dd4..69e2a9819 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -81,6 +81,13 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { + /* + vm.Debug = true + helper.Logger.SetLogLevel(5) + if name != "Call1MB1024Calldepth" { + continue + } + */ db, _ := ethdb.NewMemDatabase() statedb := state.New(common.Hash{}, db) for addr, account := range test.Pre { @@ -311,3 +318,24 @@ func TestStateTransaction(t *testing.T) { const fn = "../files/StateTests/stTransactionTest.json" RunVmTest(fn, t) } + +func TestCallCreateCallCode(t *testing.T) { + const fn = "../files/StateTests/stCallCreateCallCodeTest.json" + RunVmTest(fn, t) +} + +func TestMemory(t *testing.T) { + const fn = "../files/StateTests/stMemoryTest.json" + RunVmTest(fn, t) +} + +func TestQuadraticComplexity(t *testing.T) { + t.Skip() // takes too long + const fn = "../files/StateTests/stQuadraticComplexityTest.json" + RunVmTest(fn, t) +} + +func TestSolidity(t *testing.T) { + const fn = "../files/StateTests/stSolidityTest.json" + RunVmTest(fn, t) +} |