[#1545] morph/event: Simplify frostfs contract event parsing
All checks were successful
DCO action / DCO (pull_request) Successful in 4m46s
Vulncheck / Vulncheck (pull_request) Successful in 5m22s
Build / Build Components (pull_request) Successful in 6m12s
Pre-commit hooks / Pre-commit (pull_request) Successful in 6m10s
Tests and linters / Run gofumpt (pull_request) Successful in 6m16s
Tests and linters / gopls check (pull_request) Successful in 6m19s
Tests and linters / Staticcheck (pull_request) Successful in 6m25s
Tests and linters / Lint (pull_request) Successful in 6m59s
Tests and linters / Tests (pull_request) Successful in 7m38s
Tests and linters / Tests with -race (pull_request) Successful in 8m37s
Tests and linters / Run gofumpt (push) Successful in 1m16s
Tests and linters / Staticcheck (push) Successful in 3m15s
Vulncheck / Vulncheck (push) Successful in 4m7s
Build / Build Components (push) Successful in 4m32s
Tests and linters / Lint (push) Successful in 4m50s
Pre-commit hooks / Pre-commit (push) Successful in 5m1s
Tests and linters / Tests (push) Successful in 5m14s
Tests and linters / Tests with -race (push) Successful in 5m54s
Tests and linters / gopls check (push) Successful in 6m2s

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-12-06 13:59:15 +03:00
parent 1c12f23b84
commit d1bc4351c3
Signed by: fyrchik
SSH key fingerprint: SHA256:m/TTwCzjnRkXgnzEx9X92ccxy1CcVeinOgDb3NPWWmg
8 changed files with 52 additions and 173 deletions

View file

@ -4,7 +4,6 @@ import (
"math/big"
"testing"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
"github.com/stretchr/testify/require"
@ -12,7 +11,7 @@ import (
func TestParseWithdraw(t *testing.T) {
var (
id = []byte("Hello World")
id = util.Uint256{1, 2, 3}
user = util.Uint160{0x1, 0x2, 0x3}
amount int64 = 10
@ -25,7 +24,7 @@ func TestParseWithdraw(t *testing.T) {
}
_, err := ParseWithdraw(createNotifyEventFromItems(prms))
require.EqualError(t, err, event.WrongNumberOfParameters(3, len(prms)).Error())
require.Error(t, err)
})
t.Run("wrong user parameter", func(t *testing.T) {
@ -59,12 +58,12 @@ func TestParseWithdraw(t *testing.T) {
ev, err := ParseWithdraw(createNotifyEventFromItems([]stackitem.Item{
stackitem.NewByteArray(user.BytesBE()),
stackitem.NewBigInteger(new(big.Int).SetInt64(amount)),
stackitem.NewByteArray(id),
stackitem.NewByteArray(id[:]),
}))
require.NoError(t, err)
require.Equal(t, Withdraw{
IDValue: id,
IDValue: id[:],
AmountValue: amount,
UserValue: user,
}, ev)