Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend pasing logic with addressable entity #10

Merged
merged 4 commits into from
Sep 19, 2024

Conversation

ZhmakAS
Copy link
Collaborator

@ZhmakAS ZhmakAS commented Sep 17, 2024

  • Resolves: #

Summary

TODO

  • ...

Checklist

  • Code is properly formatted
  • All commits are signed
  • Tests included/updated or not needed
  • Documentation (manuals or wiki) has been updated or is not required

@ZhmakAS ZhmakAS requested a review from ihor September 17, 2024 14:00
parser.go Outdated
return nil, err
log.Println("Error pn fetching schemas bytes from addressable entity: ", err)

schemasURefValue, err = p.casperClient.QueryGlobalStateByStateHash(context.Background(), nil, fmt.Sprintf("hash-%s", contractHash.ToHex()), []string{eventSchemaNamedKey})
Copy link
Member

Choose a reason for hiding this comment

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

@ZhmakAS, it probably would make more sense to provide the possibility to specify the version and use the dedicated approach for 1.5.x and 2.0.0. With fallbacks, we won't be able to use the parser efficiently in 1.5.x

Artem Zhmaka added 2 commits September 18, 2024 16:19
Added versioned fallback to FetchContractSchemasBytes method
parser.go Outdated

const (
NetworkVersionV1 NetworkVersion = iota
NetworkVersionV2
Copy link
Member

Choose a reason for hiding this comment

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

Let's call the versions:

  • Casper1x
  • Casper2x

README.md Outdated
There is only one interface change:

- `func LoadContractMetadataWithoutSchema` accept list of `NamedKeys` and ContractPackageHash instead of `casper.Contract`

Copy link
Member

Choose a reason for hiding this comment

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

Let's make it more user-oriented.

Migration to Casper 2.0.0 (Condor)

Casper 2.0.0 introduces changes in the API that aren't backward compatible with Casper 1.x. To use CES Go Parser with Casper 2.0.0 you need to the the version v2 of the parser:

    "github.com/make-software/ces-go-parser/v2"

If you want to use the same version of the parser for both Casper 1.x and Casper 2.x, you'll need to use the soft-migration constructor that requires you to specify the network version you are currently running on:

 	parser, err := ces.NewParserWithVersion(rpcClient, []casper.Hash{contractHash}, ces.CasperVersion1x)
 	if err != nil {
 		panic(err)
 	}

Breaking changes

In CES Go Parser 2.0.0, the LoadContractMetadataWithoutSchema function accepts a list of NamedKeys and ContractPackageHash instead of casper.Contract it accepted previously:

// @todo Example here

@ZhmakAS ZhmakAS merged commit 09db954 into master Sep 19, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants