From 50ce75395fe6b6933a8b902ce47874c9096fb49d Mon Sep 17 00:00:00 2001 From: Phu Ngo <12547020+NgoKimPhu@users.noreply.github.com> Date: Sat, 2 Nov 2024 07:36:03 +0700 Subject: [PATCH 1/2] chore: change ci to run on ubuntu-latest --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e323385..57fcc2f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,4 +17,6 @@ on: jobs: ci: uses: KyberNetwork/service-framework/.github/workflows/ci.yaml@main + with: + runs-on: ubuntu-latest secrets: inherit From ff2de9b228a3ec926aeb3daa31159e9c190a80d1 Mon Sep 17 00:00:00 2001 From: Nguyen Tran Anh Duc Date: Wed, 13 Nov 2024 16:05:29 +0700 Subject: [PATCH 2/2] feat: add safe parse big.Int --- parser.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 parser.go diff --git a/parser.go b/parser.go new file mode 100644 index 0000000..f0450bd --- /dev/null +++ b/parser.go @@ -0,0 +1,14 @@ +package kutils + +import ( + "math/big" +) + +const LimitLength = 200 + +func SafeParseBigInt(s string, base int) (*big.Int, bool) { + if len(s) > LimitLength { + return nil, false + } + return new(big.Int).SetString(s, base) +}