Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/test/assembly_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import (
test_util "github.com/consensys/go-corset/pkg/test/util"
)

func Test_Asm_Add(t *testing.T) {
test_util.Check(t, false, "asm/add")
}

// Recusion
//
// func Test_Asm_Byte(t *testing.T) {
Expand Down
7 changes: 2 additions & 5 deletions pkg/util/word/big_endian.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ package word

import (
"bytes"
"encoding/hex"
"hash/fnv"
"math/big"

Expand Down Expand Up @@ -109,11 +108,9 @@ func (p BigEndian) Bytes() []byte {
}

func (p BigEndian) String() string {
if len(p.bytes) == 0 {
return "0"
}
bi := p.AsBigInt()
//
return hex.EncodeToString(p.bytes)
return bi.String()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: API Change: BigEndian String Representation

The BigEndian.String() method's behavior changed from returning a hexadecimal string representation to a decimal string representation. This is a breaking API change, as it now uses math/big.Int.String() instead of encoding/hex.EncodeToString. This change appears unrelated to the PR's stated purpose.

Locations (1)

Fix in Cursor Fix in Web

}

func trim(bytes []byte) []byte {
Expand Down
Binary file added testdata/asm/add.accepts.bz2
Binary file not shown.
15 changes: 15 additions & 0 deletions testdata/asm/add.zkasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
fn add(inst u8, arg1 u256, arg2 u256) -> (res u256) {
var c u1
;;
if inst == 0x01 goto insn_add
if inst == 0x03 goto insn_sub
;; FIXME: support fail
res = 0
return
insn_add:
c, res = arg1 + arg2
return
insn_sub:
c, res = arg1 - arg2
return
}