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

Protocol 22 Changes #27

Closed
aditya1702 opened this issue Oct 10, 2024 · 1 comment
Closed

Protocol 22 Changes #27

aditya1702 opened this issue Oct 10, 2024 · 1 comment

Comments

@aditya1702
Copy link

aditya1702 commented Oct 10, 2024

Protocol 22

XDR Changes

  • Added new XDR support for Soroban constructors which allows a contract to run custom initialization logic atomically when it's first created. You can read more about this change in CAP-58. The following changes are introduced:
    • A new special contract function __constructor that may only be called by the Soroban host environment. The environment will call __constructor function if and only if the contract is being created from a Wasm exporting that function.
    • Introduce a new host function create_contract_with_constructor in Soroban environment that allows constracts to instantiate other contracts with constructors.
    • Introduce a new HostFunction XDR variant HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2 that acts in the same way as HOST_FUNCTION_TYPE_CREATE_CONTRACT, but also allows users to specify the constructor arguments.
    • Introduce a new SorobanAuthorizedFunction XDR variant SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_V2_HOST_FN that allows users to sign the authorization payload corresponding to HOST_FUNCTION_TYPE_CREATE_CONTRACT_V2 host function calls.

Horizon API

Breaking Changes

  • Changed ErrorResultXDR field naming from camelcase to snakecase - error_result_xdr - for transactions_async endpoint. (#5445)
  • The following deprecated fields have been removed (#5478):
    • /asset: num_accounts and amount fields
    • /transactions/:id: valid_before and valid_after fields

Soroban-RPC

Breaking Changes

  • createdAt field in getTransaction response is now encoded as string instead of int64. (#251)
  • The fields in getVersionInfo response were changed to Camel-case naming (#164):
    • commitHash
    • buildTimestamp
    • captiveCoreVersion
    • protocolVersion
  • The legacy cost field has been removed from simulateTransaction response. (#295):
    • The correct resource costs can now be retrieved from the transactionData XDR in the response.
  • Remove pagingToken from getEvents response and replace it with cursor. (#297)
    • Instead of being present in all event objects, the cursor will be at the top level of the response similar to getTransactions. This makes it easier to use and brings it in sync with how Cursor is used in other RPC endpoints
  • Deprecated getLedgerEntry endpoint is now removed. (#276)
    • Users can use the more powerful getLedgerEntries endpoint to get the same result.

Non-Breaking Changes

  • Add transaction hash field - txHash - to getTransactions and getTransaction response. (#299, #314)
    • Each transaction object in the response now also includes a hex-encoded transaction hash string.

SDF Reference Implementations

@cuongph87
Copy link
Collaborator

Added in #28

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

No branches or pull requests

2 participants