Skip to content
This repository has been archived by the owner on Aug 31, 2024. It is now read-only.

Commit

Permalink
update genisis
Browse files Browse the repository at this point in the history
Signed-off-by: Qiang Zhou <[email protected]>
  • Loading branch information
zhouqiang-cl committed Feb 2, 2024
1 parent 73190d7 commit 9571d34
Showing 1 changed file with 2 additions and 54 deletions.
56 changes: 2 additions & 54 deletions cairoVM/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,20 @@ package cairoVM
import (
"encoding/json"
"fmt"
"os"

"github.com/NethermindEth/juno/adapters/sn2core"
"github.com/NethermindEth/juno/blockchain"
"github.com/NethermindEth/juno/core"
"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/juno/db"
"github.com/NethermindEth/juno/starknet"
"os"
)

func init() {
blockchain.RegisterCoreTypesToEncoder()
}

//func SetGenesis(state *core.State, cairoFiles map[string]string) error {
//
// declaredClasses := make(map[felt.Felt]core.Class)
// deployedContracts := make(map[felt.Felt]*felt.Felt)
// declaredV1Classes := make(map[felt.Felt]*felt.Felt)
// nonces := make(map[felt.Felt]*felt.Felt)
// var (
// class core.Class
// classHash *felt.Felt
// compiledClassHash *felt.Felt
// err error
// )
//
// var addr uint64 = 0
//
// for sierraFileName, casmFileName := range cairoFiles {
// class, classHash, err = adaptClassAndHash(sierraFileName)
// if err != nil {
// return err
// }
// fmt.Println("genesis classHash = ", classHash.String())
// declaredClasses[*classHash] = class
// addrFelt := new(felt.Felt).SetUint64(addr)
// deployedContracts[*addrFelt] = classHash
// casmClass, err := contracts.UnmarshalCasmClass(casmFileName)
// if err != nil {
// return err
// }
// compiledClassHash = hash.CompiledClassHash(*casmClass)
//
// declaredV1Classes[*classHash] = compiledClassHash
//
// nonces[*addrFelt] = &felt.Zero
// addr++
// }
//
// newRoot, err := new(felt.Felt).SetString("0x56f007b0f69daa75af325ecfa0d717bfd4d72bfa102151912fe4a15b9dfd30f")
// if err != nil {
// return err
// }
//
// return state.Update(0, core.EmptyStateDiff(), declaredClasses)
//}

var AccountClassHash *felt.Felt

func BuildGenesis(classesPaths []string) (*blockchain.PendingStateWriter, error) {
Expand Down Expand Up @@ -91,15 +48,6 @@ func BuildGenesis(classesPaths []string) (*blockchain.PendingStateWriter, error)
addr++
}

//for addrFelt, classHash := range contractsData {
// err = genesisState.SetClassHash(&addrFelt, &classHash)
// if err != nil {
// return nil, err
// }
//}

//stateDiff, newClasses := genesisState.StateDiffAndClasses()
//return state.Update(0, stateDiff, newClasses)
return genesisState, nil
}

Expand Down

0 comments on commit 9571d34

Please sign in to comment.