Skip to content

Commit

Permalink
add starknet-spec updates
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagodeev committed Jan 16, 2025
1 parent 094d21f commit d01082f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rpc/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func (provider *Provider) Call(ctx context.Context, request FunctionCall, blockID BlockID) ([]*felt.Felt, error) {
var result []*felt.Felt
if err := do(ctx, provider.c, "starknet_call", &result, request, blockID); err != nil {
return nil, tryUnwrapToRPCErr(err, ErrContractNotFound, ErrContractError, ErrBlockNotFound)
return nil, tryUnwrapToRPCErr(err, ErrContractNotFound, ErrEntrypointNotFound, ErrContractError, ErrBlockNotFound)
}
return result, nil
}
1 change: 1 addition & 0 deletions rpc/call_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func TestCall(t *testing.T) {
BlockID: WithBlockTag("latest"),
ExpectedPatternResult: utils.TestHexToFelt(t, "0x506f736974696f6e"),
},
// TODO: create a case for the ErrEntrypointNotFound error when Juno implement it
{
FunctionCall: FunctionCall{
ContractAddress: utils.TestHexToFelt(t, "0x025633c6142D9CA4126e3fD1D522Faa6e9f745144aba728c0B3FEE38170DF9e7"),
Expand Down
4 changes: 4 additions & 0 deletions rpc/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ var (
Code: 20,
Message: "Contract not found",
}
ErrEntrypointNotFound = &RPCError{
Code: 21,
Message: "Requested entrypoint does not exist in the contract",
}
ErrBlockNotFound = &RPCError{
Code: 24,
Message: "Block not found",
Expand Down
5 changes: 3 additions & 2 deletions rpc/types_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ type ContractsProof struct {
// The nonce and class hash for each requested contract address, in the order in which
// they appear in the request. These values are needed to construct the associated leaf node
type ContractLeavesData struct {
Nonce *felt.Felt `json:"nonce"`
ClassHash *felt.Felt `json:"class_hash"`
Nonce *felt.Felt `json:"nonce"`
ClassHash *felt.Felt `json:"class_hash"`
StorageRoot *felt.Felt `json:"storage_root"`
}

type GlobalRoots struct {
Expand Down

0 comments on commit d01082f

Please sign in to comment.