Skip to content

Commit

Permalink
Feat built in name literals (#662)
Browse files Browse the repository at this point in the history
* Create names file

* Add range check name

* Group constants

* Use variables instead of strings

* Fix linter issues

* Rollback changes in starknet.go

* Move Builtin Enum definition
- Refactor imports

* Refactor name.go

* Use builtin names

* Rename enum types

* Update references

* Update import of builtins

* Replace strings with builtin name variable
  • Loading branch information
danielcdz authored Sep 26, 2024
1 parent e51153f commit 9afede6
Show file tree
Hide file tree
Showing 21 changed files with 293 additions and 277 deletions.
86 changes: 43 additions & 43 deletions pkg/hintrunner/zero/zerohint_math_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"testing"

"github.com/NethermindEth/cairo-vm-go/pkg/hintrunner/hinter"
"github.com/NethermindEth/cairo-vm-go/pkg/parsers/starknet"
"github.com/NethermindEth/cairo-vm-go/pkg/utils"
"github.com/NethermindEth/cairo-vm-go/pkg/vm/builtins"
"github.com/consensys/gnark-crypto/ecc/stark-curve/fp"
)

Expand Down Expand Up @@ -445,8 +445,8 @@ func TestZeroHintMath(t *testing.T) {
"Assert250bits": {
{
operanders: []*hintOperander{
{Name: "low", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "low", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
{Name: "value", Kind: apRelative, Value: feltInt64(3042)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
Expand All @@ -459,8 +459,8 @@ func TestZeroHintMath(t *testing.T) {
},
{
operanders: []*hintOperander{
{Name: "low", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "low", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
{Name: "value", Kind: fpRelative, Value: feltInt64(4938538853994)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
Expand All @@ -473,8 +473,8 @@ func TestZeroHintMath(t *testing.T) {
},
{
operanders: []*hintOperander{
{Name: "low", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "low", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
{Name: "value", Kind: apRelative, Value: feltString("348329493943842849393993999999231222222222")},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
Expand All @@ -487,8 +487,8 @@ func TestZeroHintMath(t *testing.T) {
},
{
operanders: []*hintOperander{
{Name: "low", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "low", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
{Name: "value", Kind: apRelative, Value: feltString("348329493943842849393124453993999999231222222222")},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
Expand All @@ -501,8 +501,8 @@ func TestZeroHintMath(t *testing.T) {
},
{
operanders: []*hintOperander{
{Name: "low", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "low", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
{Name: "value", Kind: apRelative, Value: feltInt64(-233)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
Expand Down Expand Up @@ -578,8 +578,8 @@ func TestZeroHintMath(t *testing.T) {
"SplitFelt": {
{
operanders: []*hintOperander{
{Name: "low", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "low", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
{Name: "value", Kind: apRelative, Value: feltString("100000000000000000000000000000000000000")},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
Expand All @@ -592,8 +592,8 @@ func TestZeroHintMath(t *testing.T) {
},
{
operanders: []*hintOperander{
{Name: "low", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "low", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "high", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
{Name: "value", Kind: apRelative, Value: &utils.FeltMax128},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
Expand All @@ -611,8 +611,8 @@ func TestZeroHintMath(t *testing.T) {
{Name: "value", Kind: apRelative, Value: &utils.FeltZero},
{Name: "div", Kind: apRelative, Value: &utils.FeltMax128},
{Name: "bound", Kind: apRelative, Value: &utils.Felt127},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newSignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["bound"], ctx.operanders["r"], ctx.operanders["biased_q"])
Expand All @@ -624,8 +624,8 @@ func TestZeroHintMath(t *testing.T) {
{Name: "value", Kind: apRelative, Value: &utils.FeltZero},
{Name: "div", Kind: apRelative, Value: &utils.FeltZero},
{Name: "bound", Kind: apRelative, Value: &utils.Felt127},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newSignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["bound"], ctx.operanders["r"], ctx.operanders["biased_q"])
Expand All @@ -637,8 +637,8 @@ func TestZeroHintMath(t *testing.T) {
{Name: "value", Kind: apRelative, Value: &utils.FeltZero},
{Name: "div", Kind: apRelative, Value: &utils.FeltOne},
{Name: "bound", Kind: apRelative, Value: new(fp.Element).SetBigInt(new(big.Int).Lsh(big.NewInt(1), 130))},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newSignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["bound"], ctx.operanders["r"], ctx.operanders["biased_q"])
Expand All @@ -650,8 +650,8 @@ func TestZeroHintMath(t *testing.T) {
{Name: "value", Kind: apRelative, Value: feltInt64(-6)},
{Name: "div", Kind: apRelative, Value: feltInt64(2)},
{Name: "bound", Kind: apRelative, Value: feltInt64(2)},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newSignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["bound"], ctx.operanders["r"], ctx.operanders["biased_q"])
Expand All @@ -663,8 +663,8 @@ func TestZeroHintMath(t *testing.T) {
{Name: "value", Kind: apRelative, Value: feltInt64(6)},
{Name: "div", Kind: apRelative, Value: feltInt64(2)},
{Name: "bound", Kind: apRelative, Value: feltInt64(3)},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newSignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["bound"], ctx.operanders["r"], ctx.operanders["biased_q"])
Expand All @@ -676,8 +676,8 @@ func TestZeroHintMath(t *testing.T) {
{Name: "value", Kind: apRelative, Value: feltInt64(5)},
{Name: "div", Kind: apRelative, Value: feltInt64(2)},
{Name: "bound", Kind: apRelative, Value: &utils.Felt127},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newSignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["bound"], ctx.operanders["r"], ctx.operanders["biased_q"])
Expand All @@ -692,8 +692,8 @@ func TestZeroHintMath(t *testing.T) {
{Name: "value", Kind: apRelative, Value: feltInt64(-3)},
{Name: "div", Kind: apRelative, Value: feltInt64(2)},
{Name: "bound", Kind: apRelative, Value: &utils.Felt127},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "biased_q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newSignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["bound"], ctx.operanders["r"], ctx.operanders["biased_q"])
Expand Down Expand Up @@ -751,8 +751,8 @@ func TestZeroHintMath(t *testing.T) {
operanders: []*hintOperander{
{Name: "value", Kind: fpRelative, Value: feltUint64(100)},
{Name: "div", Kind: fpRelative, Value: feltUint64(6)},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newUnsignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["q"], ctx.operanders["r"])
Expand All @@ -766,8 +766,8 @@ func TestZeroHintMath(t *testing.T) {
operanders: []*hintOperander{
{Name: "value", Kind: fpRelative, Value: feltUint64(450326666)},
{Name: "div", Kind: fpRelative, Value: feltUint64(136310839)},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newUnsignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["q"], ctx.operanders["r"])
Expand All @@ -781,8 +781,8 @@ func TestZeroHintMath(t *testing.T) {
operanders: []*hintOperander{
{Name: "value", Kind: fpRelative, Value: feltUint64(0)},
{Name: "div", Kind: fpRelative, Value: feltUint64(10)},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newUnsignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["q"], ctx.operanders["r"])
Expand All @@ -796,8 +796,8 @@ func TestZeroHintMath(t *testing.T) {
operanders: []*hintOperander{
{Name: "value", Kind: fpRelative, Value: feltUint64(10)},
{Name: "div", Kind: fpRelative, Value: feltUint64(0)},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newUnsignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["q"], ctx.operanders["r"])
Expand All @@ -808,8 +808,8 @@ func TestZeroHintMath(t *testing.T) {
operanders: []*hintOperander{
{Name: "value", Kind: fpRelative, Value: feltUint64(10)},
{Name: "div", Kind: fpRelative, Value: feltString("10633823966279327296825105735305134079")},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newUnsignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["q"], ctx.operanders["r"])
Expand All @@ -823,8 +823,8 @@ func TestZeroHintMath(t *testing.T) {
operanders: []*hintOperander{
{Name: "value", Kind: fpRelative, Value: feltUint64(10)},
{Name: "div", Kind: fpRelative, Value: feltString("10633823966279327296825105735305134080")},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newUnsignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["q"], ctx.operanders["r"])
Expand All @@ -838,8 +838,8 @@ func TestZeroHintMath(t *testing.T) {
operanders: []*hintOperander{
{Name: "value", Kind: fpRelative, Value: feltUint64(10)},
{Name: "div", Kind: fpRelative, Value: feltString("10633823966279327296825105735305134081")},
{Name: "r", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(starknet.RangeCheck, 1)},
{Name: "r", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 0)},
{Name: "q", Kind: reference, Value: addrBuiltin(builtins.RangeCheckType, 1)},
},
makeHinter: func(ctx *hintTestContext) hinter.Hinter {
return newUnsignedDivRemHint(ctx.operanders["value"], ctx.operanders["div"], ctx.operanders["q"], ctx.operanders["r"])
Expand Down
4 changes: 2 additions & 2 deletions pkg/hintrunner/zero/zerohint_signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"testing"

"github.com/NethermindEth/cairo-vm-go/pkg/hintrunner/hinter"
"github.com/NethermindEth/cairo-vm-go/pkg/parsers/starknet"
"github.com/NethermindEth/cairo-vm-go/pkg/utils"
"github.com/NethermindEth/cairo-vm-go/pkg/vm/builtins"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -54,7 +54,7 @@ func TestVerifyZeroHint(t *testing.T) {
"VerifyECDSASignature": {
{
operanders: []*hintOperander{
{Name: "ecdsaPtr", Kind: reference, Value: addrBuiltin(starknet.ECDSA, 0)},
{Name: "ecdsaPtr", Kind: reference, Value: addrBuiltin(builtins.ECDSAType, 0)},
{Name: "signature_r", Kind: apRelative, Value: feltString("3086480810278599376317923499561306189851900463386393948998357832163236918254")},
{Name: "signature_s", Kind: apRelative, Value: feltString("598673427589502599949712887611119751108407514580626464031881322743364689811")},
},
Expand Down
5 changes: 2 additions & 3 deletions pkg/hintrunner/zero/zerohint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/NethermindEth/cairo-vm-go/pkg/hintrunner/hinter"
runnerutil "github.com/NethermindEth/cairo-vm-go/pkg/hintrunner/utils"
"github.com/NethermindEth/cairo-vm-go/pkg/parsers/starknet"
VM "github.com/NethermindEth/cairo-vm-go/pkg/vm"
"github.com/NethermindEth/cairo-vm-go/pkg/vm/builtins"
"github.com/NethermindEth/cairo-vm-go/pkg/vm/memory"
Expand Down Expand Up @@ -57,7 +56,7 @@ type hintOperander struct {
}

type builtinReference struct {
builtin starknet.Builtin
builtin builtins.BuiltinType
offset uint64
}

Expand Down Expand Up @@ -135,7 +134,7 @@ func runHinterTests(t *testing.T, tests map[string][]hintTestCase) {
offset uint64
addr memory.MemoryAddress
}
builtinsAllocated := map[starknet.Builtin]allocatedBuiltin{}
builtinsAllocated := map[builtins.BuiltinType]allocatedBuiltin{}
for _, o := range tc.operanders {
if o.Kind != reference {
continue
Expand Down
4 changes: 2 additions & 2 deletions pkg/hintrunner/zero/zerohint_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"testing"

runnerutil "github.com/NethermindEth/cairo-vm-go/pkg/hintrunner/utils"
"github.com/NethermindEth/cairo-vm-go/pkg/parsers/starknet"
"github.com/NethermindEth/cairo-vm-go/pkg/vm"
"github.com/NethermindEth/cairo-vm-go/pkg/vm/builtins"
"github.com/NethermindEth/cairo-vm-go/pkg/vm/memory"
"github.com/consensys/gnark-crypto/ecc/stark-curve/fp"
"github.com/stretchr/testify/assert"
Expand All @@ -30,7 +30,7 @@ func addrWithSegment(segment, offset uint64) *memory.MemoryAddress {
}
}

func addrBuiltin(builtin starknet.Builtin, offset uint64) *builtinReference {
func addrBuiltin(builtin builtins.BuiltinType, offset uint64) *builtinReference {
return &builtinReference{
builtin: builtin,
offset: offset,
Expand Down
83 changes: 4 additions & 79 deletions pkg/parsers/starknet/starknet.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,90 +4,15 @@ import (
"encoding/json"
"fmt"
"os"
"strconv"

"github.com/NethermindEth/cairo-vm-go/pkg/vm/builtins"
"github.com/consensys/gnark-crypto/ecc/stark-curve/fp"
)

type Builtin uint8

const (
Output Builtin = iota + 1
RangeCheck
Pedersen
ECDSA
Keccak
Bitwise
ECOP
Poseidon
SegmentArena
RangeCheck96
)

func (b Builtin) MarshalJSON() ([]byte, error) {
switch b {
case Output:
return []byte("output"), nil
case RangeCheck:
return []byte("range_check"), nil
case RangeCheck96:
return []byte("range_check96"), nil
case Pedersen:
return []byte("pedersen"), nil
case ECDSA:
return []byte("ecdsa"), nil
case Keccak:
return []byte("keccak"), nil
case Bitwise:
return []byte("bitwise"), nil
case ECOP:
return []byte("ec_op"), nil
case Poseidon:
return []byte("poseidon"), nil
case SegmentArena:
return []byte("segment_arena"), nil

}
return nil, fmt.Errorf("marshal unknown builtin: %d", uint8(b))
}

func (b *Builtin) UnmarshalJSON(data []byte) error {
builtinName, err := strconv.Unquote(string(data))
if err != nil {
return fmt.Errorf("unmarshal builtin: %w", err)
}

switch builtinName {
case "output":
*b = Output
case "range_check":
*b = RangeCheck
case "range_check96":
*b = RangeCheck96
case "pedersen":
*b = Pedersen
case "ecdsa":
*b = ECDSA
case "keccak":
*b = Keccak
case "bitwise":
*b = Bitwise
case "ec_op":
*b = ECOP
case "poseidon":
*b = Poseidon
case "segment_arena":
*b = SegmentArena
default:
return fmt.Errorf("unmarshal unknown builtin: %s", builtinName)
}
return nil
}

type EntryPointInfo struct {
Selector fp.Element `json:"selector"`
Offset fp.Element `json:"offset"`
Builtins []Builtin `json:"builtins"`
Selector fp.Element `json:"selector"`
Offset fp.Element `json:"offset"`
Builtins []builtins.BuiltinType `json:"builtins"`
}

type EntryPointByType struct {
Expand Down
Loading

0 comments on commit 9afede6

Please sign in to comment.