mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-08 19:10:30 +00:00
Merge pull request #1744 from nspcc-dev/fix/nativecall
Update `CallNative` to post-preview5
This commit is contained in:
commit
c9212f29e6
34 changed files with 165 additions and 113 deletions
|
@ -19,6 +19,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/services/oracle"
|
||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neo-go/pkg/wallet"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -39,11 +40,8 @@ func getOracleConfig(t *testing.T, bc *Blockchain, w, pass string) oracle.Config
|
|||
Password: pass,
|
||||
},
|
||||
},
|
||||
Chain: bc,
|
||||
Client: newDefaultHTTPClient(),
|
||||
OracleScript: bc.contracts.Oracle.NEF.Script,
|
||||
OracleResponse: bc.contracts.Oracle.GetOracleResponseScript(),
|
||||
OracleHash: bc.contracts.Oracle.Hash,
|
||||
Chain: bc,
|
||||
Client: newDefaultHTTPClient(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,6 +94,7 @@ func TestCreateResponseTx(t *testing.T) {
|
|||
}
|
||||
require.NoError(t, bc.contracts.Oracle.PutRequestInternal(1, req, bc.dao))
|
||||
orc.UpdateOracleNodes(keys.PublicKeys{acc.PrivateKey().PublicKey()})
|
||||
bc.SetOracle(orc)
|
||||
tx, err := orc.CreateResponseTx(int64(req.GasForResponse), 1, resp)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 167, tx.Size())
|
||||
|
@ -125,6 +124,12 @@ func TestOracle(t *testing.T) {
|
|||
orc1.UpdateOracleNodes(oracleNodes.Copy())
|
||||
orc2.UpdateOracleNodes(oracleNodes.Copy())
|
||||
|
||||
orcNative := bc.contracts.Oracle
|
||||
md, ok := orcNative.GetMethod(manifest.MethodVerify, -1)
|
||||
require.True(t, ok)
|
||||
orc1.UpdateNativeContract(orcNative.NEF.Script, orcNative.GetOracleResponseScript(), orcNative.Hash, md.MD.Offset)
|
||||
orc2.UpdateNativeContract(orcNative.NEF.Script, orcNative.GetOracleResponseScript(), orcNative.Hash, md.MD.Offset)
|
||||
|
||||
cs := getOracleContractState(bc.contracts.Oracle.Hash)
|
||||
require.NoError(t, bc.contracts.Management.PutContractState(bc.dao, cs))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue