-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: replace
/common/abi
module (#1127)
* chore: replace /abi module Signed-off-by: Ivan Ivanov <[email protected]> * test: add tests Signed-off-by: Ivan Ivanov <[email protected]> * test: add tests for encoding Signed-off-by: Ivan Ivanov <[email protected]> * chore: address PR feedback Signed-off-by: Ivan Ivanov <[email protected]> --------- Signed-off-by: Ivan Ivanov <[email protected]>
- Loading branch information
Showing
15 changed files
with
3,327 additions
and
30 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,43 @@ | ||
//go:build all || unit | ||
// +build all unit | ||
|
||
package hedera | ||
|
||
/*- | ||
* | ||
* Hedera Go SDK | ||
* | ||
* Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestDecodeBytesBound(t *testing.T) { | ||
typ, _ := NewType("tuple(string)") | ||
decodeTuple(typ, nil) // it should not panic | ||
} | ||
|
||
func TestDecodeDynamicLengthOutOfBounds(t *testing.T) { | ||
input := []byte("00000000000000000000000000000000\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 00000000000000000000000000") | ||
typ, _ := NewType("tuple(bytes32, bytes, bytes)") | ||
|
||
_, err := Decode(typ, input) | ||
require.Error(t, err) | ||
} |
Oops, something went wrong.