forked from TrueCloudLab/neoneo-go
oracle: add response codes to interop defintions
Client should be aware of them.
This commit is contained in:
parent
bba22cb736
commit
090d68f8fa
2 changed files with 28 additions and 0 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/native"
|
"github.com/nspcc-dev/neo-go/pkg/core/native"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/native/nnsrecords"
|
"github.com/nspcc-dev/neo-go/pkg/core/native/nnsrecords"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/native/noderoles"
|
"github.com/nspcc-dev/neo-go/pkg/core/native/noderoles"
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/interop/native/crypto"
|
"github.com/nspcc-dev/neo-go/pkg/interop/native/crypto"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/interop/native/gas"
|
"github.com/nspcc-dev/neo-go/pkg/interop/native/gas"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/interop/native/ledger"
|
"github.com/nspcc-dev/neo-go/pkg/interop/native/ledger"
|
||||||
|
@ -89,6 +90,18 @@ func TestCryptoLibNamedCurve(t *testing.T) {
|
||||||
require.EqualValues(t, native.Secp256r1, crypto.Secp256r1)
|
require.EqualValues(t, native.Secp256r1, crypto.Secp256r1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestOracleResponseCodes(t *testing.T) {
|
||||||
|
require.EqualValues(t, oracle.Success, transaction.Success)
|
||||||
|
require.EqualValues(t, oracle.ProtocolNotSupported, transaction.ProtocolNotSupported)
|
||||||
|
require.EqualValues(t, oracle.ConsensusUnreachable, transaction.ConsensusUnreachable)
|
||||||
|
require.EqualValues(t, oracle.NotFound, transaction.NotFound)
|
||||||
|
require.EqualValues(t, oracle.Timeout, transaction.Timeout)
|
||||||
|
require.EqualValues(t, oracle.Forbidden, transaction.Forbidden)
|
||||||
|
require.EqualValues(t, oracle.ResponseTooLarge, transaction.ResponseTooLarge)
|
||||||
|
require.EqualValues(t, oracle.InsufficientFunds, transaction.InsufficientFunds)
|
||||||
|
require.EqualValues(t, oracle.Error, transaction.Error)
|
||||||
|
}
|
||||||
|
|
||||||
type nativeTestCase struct {
|
type nativeTestCase struct {
|
||||||
method string
|
method string
|
||||||
params []string
|
params []string
|
||||||
|
|
|
@ -10,6 +10,21 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
|
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// These are potential response codes you get in your callback completing
|
||||||
|
// oracle request. Resulting data is only passed with Success code, it's
|
||||||
|
// nil otherwise.
|
||||||
|
const (
|
||||||
|
Success = 0x00
|
||||||
|
ProtocolNotSupported = 0x10
|
||||||
|
ConsensusUnreachable = 0x12
|
||||||
|
NotFound = 0x14
|
||||||
|
Timeout = 0x16
|
||||||
|
Forbidden = 0x18
|
||||||
|
ResponseTooLarge = 0x1a
|
||||||
|
InsufficientFunds = 0x1c
|
||||||
|
Error = 0xff
|
||||||
|
)
|
||||||
|
|
||||||
// Hash represents Oracle contract hash.
|
// Hash represents Oracle contract hash.
|
||||||
const Hash = "\x58\x87\x17\x11\x7e\x0a\xa8\x10\x72\xaf\xab\x71\xd2\xdd\x89\xfe\x7c\x4b\x92\xfe"
|
const Hash = "\x58\x87\x17\x11\x7e\x0a\xa8\x10\x72\xaf\xab\x71\xd2\xdd\x89\xfe\x7c\x4b\x92\xfe"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue