-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix native build params circular reference (#636)
- Loading branch information
Showing
2 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (C) 2018 The ontology Authors | ||
* This file is part of The ontology library. | ||
* | ||
* The ontology is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The ontology is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with The ontology. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package test | ||
|
||
import ( | ||
"github.com/ontio/ontology/common" | ||
"github.com/ontio/ontology/smartcontract" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestBuildParamToNative(t *testing.T) { | ||
code := `00c57676c84c0500000000004c1400000000000000000000000000000000000000060068164f6e746f6c6f67792e4e61746976652e496e766f6b65` | ||
|
||
hex, err := common.HexToBytes(code) | ||
|
||
if err != nil { | ||
t.Fatal("hex to byte error:", err) | ||
} | ||
|
||
config := &smartcontract.Config{ | ||
Time: 10, | ||
Height: 10, | ||
Tx: nil, | ||
} | ||
//cache := storage.NewCloneCache(testBatch) | ||
sc := smartcontract.SmartContract{ | ||
Config: config, | ||
Gas: 100000, | ||
} | ||
engine, err := sc.NewExecuteEngine(hex) | ||
|
||
_, err = engine.Invoke() | ||
|
||
assert.Error(t, err, "invoke smart contract err: [NeoVmService] service system call error!: [SystemCall] service execute error!: invoke native circular reference!") | ||
} |