Skip to content

Commit

Permalink
Merge pull request #277 from kommitters/v0.12
Browse files Browse the repository at this point in the history
Release v0.12.0
  • Loading branch information
Odraxs authored Jul 24, 2023
2 parents 58a3fb5 + e50f1c1 commit 5298c4e
Show file tree
Hide file tree
Showing 195 changed files with 7,073 additions and 4,933 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.12.0 (24.07.2023)

* [Soroban Preview 10 support](https://github.com/kommitters/stellar_base/issues/273).
## 0.11.1 (01.06.2023)

* [Add missing value types in SCVal](https://github.com/kommitters/stellar_base/pull/270).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You should only use **`stellar_base`** if you are planning to build on top of it
```elixir
def deps do
[
{:stellar_base, "~> 0.11.1"}
{:stellar_base, "~> 0.12.0"}
]
end
```
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
defmodule StellarBase.XDR.ConfigSettingContractExecutionLanesV0 do
@moduledoc """
Automatically generated by xdrgen
DO NOT EDIT or your changes may be overwritten
Target implementation: elixir_xdr at https://hex.pm/packages/elixir_xdr
Representation of Stellar `ConfigSettingContractExecutionLanesV0` type.
"""

@behaviour XDR.Declaration

alias StellarBase.XDR.UInt32

@struct_spec XDR.Struct.new(ledger_max_tx_count: UInt32)

@type ledger_max_tx_count_type :: UInt32.t()

@type t :: %__MODULE__{ledger_max_tx_count: ledger_max_tx_count_type()}

defstruct [:ledger_max_tx_count]

@spec new(ledger_max_tx_count :: ledger_max_tx_count_type()) :: t()
def new(%UInt32{} = ledger_max_tx_count),
do: %__MODULE__{ledger_max_tx_count: ledger_max_tx_count}

@impl true
def encode_xdr(%__MODULE__{ledger_max_tx_count: ledger_max_tx_count}) do
[ledger_max_tx_count: ledger_max_tx_count]
|> XDR.Struct.new()
|> XDR.Struct.encode_xdr()
end

@impl true
def encode_xdr!(%__MODULE__{ledger_max_tx_count: ledger_max_tx_count}) do
[ledger_max_tx_count: ledger_max_tx_count]
|> XDR.Struct.new()
|> XDR.Struct.encode_xdr!()
end

@impl true
def decode_xdr(bytes, struct \\ @struct_spec)

def decode_xdr(bytes, struct) do
case XDR.Struct.decode_xdr(bytes, struct) do
{:ok, {%XDR.Struct{components: [ledger_max_tx_count: ledger_max_tx_count]}, rest}} ->
{:ok, {new(ledger_max_tx_count), rest}}

error ->
error
end
end

@impl true
def decode_xdr!(bytes, struct \\ @struct_spec)

def decode_xdr!(bytes, struct) do
{%XDR.Struct{components: [ledger_max_tx_count: ledger_max_tx_count]}, rest} =
XDR.Struct.decode_xdr!(bytes, struct)

{new(ledger_max_tx_count), rest}
end
end
13 changes: 11 additions & 2 deletions lib/xdr/contract/config_setting/config_setting_entry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ defmodule StellarBase.XDR.ConfigSettingEntry do
ConfigSettingContractHistoricalDataV0,
ConfigSettingContractMetaDataV0,
ConfigSettingContractBandwidthV0,
ContractCostParams
ContractCostParams,
StateExpirationSettings,
ConfigSettingContractExecutionLanesV0,
UInt64List
}

@arms [
Expand All @@ -31,7 +34,10 @@ defmodule StellarBase.XDR.ConfigSettingEntry do
CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS: ContractCostParams,
CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES: ContractCostParams,
CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES: UInt32,
CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: UInt32
CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: UInt32,
CONFIG_SETTING_STATE_EXPIRATION: StateExpirationSettings,
CONFIG_SETTING_CONTRACT_EXECUTION_LANES: ConfigSettingContractExecutionLanesV0,
CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: UInt64List
]

@type value ::
Expand All @@ -42,6 +48,9 @@ defmodule StellarBase.XDR.ConfigSettingEntry do
| ConfigSettingContractMetaDataV0.t()
| ConfigSettingContractBandwidthV0.t()
| ContractCostParams.t()
| StateExpirationSettings.t()
| ConfigSettingContractExecutionLanesV0.t()
| UInt64List.t()

@type t :: %__MODULE__{value: value(), type: ConfigSettingID.t()}

Expand Down
5 changes: 4 additions & 1 deletion lib/xdr/contract/config_setting/config_setting_id.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ defmodule StellarBase.XDR.ConfigSettingID do
CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS: 6,
CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES: 7,
CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES: 8,
CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: 9
CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: 9,
CONFIG_SETTING_STATE_EXPIRATION: 10,
CONFIG_SETTING_CONTRACT_EXECUTION_LANES: 11,
CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: 12
]

@enum_spec %XDR.Enum{declarations: @declarations, identifier: nil}
Expand Down
40 changes: 20 additions & 20 deletions lib/xdr/contract/config_setting/contract_cost_param_entry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,47 @@ defmodule StellarBase.XDR.ContractCostParamEntry do
@behaviour XDR.Declaration

alias StellarBase.XDR.{
Int64,
ExtensionPoint
ExtensionPoint,
Int64
}

@struct_spec XDR.Struct.new(
ext: ExtensionPoint,
const_term: Int64,
linear_term: Int64,
ext: ExtensionPoint
linear_term: Int64
)

@type ext_type :: ExtensionPoint.t()
@type const_term_type :: Int64.t()
@type linear_term_type :: Int64.t()
@type ext_type :: ExtensionPoint.t()

@type t :: %__MODULE__{
ext: ext_type(),
const_term: const_term_type(),
linear_term: linear_term_type(),
ext: ext_type()
linear_term: linear_term_type()
}

defstruct [:const_term, :linear_term, :ext]
defstruct [:ext, :const_term, :linear_term]

@spec new(const_term :: const_term_type(), linear_term :: linear_term_type(), ext :: ext_type()) ::
@spec new(ext :: ext_type(), const_term :: const_term_type(), linear_term :: linear_term_type()) ::
t()
def new(
%ExtensionPoint{} = ext,
%Int64{} = const_term,
%Int64{} = linear_term,
%ExtensionPoint{} = ext
%Int64{} = linear_term
),
do: %__MODULE__{const_term: const_term, linear_term: linear_term, ext: ext}
do: %__MODULE__{ext: ext, const_term: const_term, linear_term: linear_term}

@impl true
def encode_xdr(%__MODULE__{const_term: const_term, linear_term: linear_term, ext: ext}) do
[const_term: const_term, linear_term: linear_term, ext: ext]
def encode_xdr(%__MODULE__{ext: ext, const_term: const_term, linear_term: linear_term}) do
[ext: ext, const_term: const_term, linear_term: linear_term]
|> XDR.Struct.new()
|> XDR.Struct.encode_xdr()
end

@impl true
def encode_xdr!(%__MODULE__{const_term: const_term, linear_term: linear_term, ext: ext}) do
[const_term: const_term, linear_term: linear_term, ext: ext]
def encode_xdr!(%__MODULE__{ext: ext, const_term: const_term, linear_term: linear_term}) do
[ext: ext, const_term: const_term, linear_term: linear_term]
|> XDR.Struct.new()
|> XDR.Struct.encode_xdr!()
end
Expand All @@ -62,9 +62,9 @@ defmodule StellarBase.XDR.ContractCostParamEntry do
def decode_xdr(bytes, struct) do
case XDR.Struct.decode_xdr(bytes, struct) do
{:ok,
{%XDR.Struct{components: [const_term: const_term, linear_term: linear_term, ext: ext]},
{%XDR.Struct{components: [ext: ext, const_term: const_term, linear_term: linear_term]},
rest}} ->
{:ok, {new(const_term, linear_term, ext), rest}}
{:ok, {new(ext, const_term, linear_term), rest}}

error ->
error
Expand All @@ -75,9 +75,9 @@ defmodule StellarBase.XDR.ContractCostParamEntry do
def decode_xdr!(bytes, struct \\ @struct_spec)

def decode_xdr!(bytes, struct) do
{%XDR.Struct{components: [const_term: const_term, linear_term: linear_term, ext: ext]}, rest} =
{%XDR.Struct{components: [ext: ext, const_term: const_term, linear_term: linear_term]}, rest} =
XDR.Struct.decode_xdr!(bytes, struct)

{new(const_term, linear_term, ext), rest}
{new(ext, const_term, linear_term), rest}
end
end
14 changes: 12 additions & 2 deletions lib/xdr/contract/config_setting/contract_cost_type.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,18 @@ defmodule StellarBase.XDR.ContractCostType do
VmMemRead: 16,
VmMemWrite: 17,
VmInstantiation: 18,
InvokeVmFunction: 19,
ChargeBudget: 20
VmCachedInstantiation: 19,
InvokeVmFunction: 20,
ChargeBudget: 21,
ComputeKeccak256Hash: 22,
ComputeEcdsaSecp256k1Key: 23,
ComputeEcdsaSecp256k1Sig: 24,
RecoverEcdsaSecp256k1Key: 25,
Int256AddSub: 26,
Int256Mul: 27,
Int256Div: 28,
Int256Pow: 29,
Int256Shift: 30
]

@enum_spec %XDR.Enum{declarations: @declarations, identifier: nil}
Expand Down
Loading

0 comments on commit 5298c4e

Please sign in to comment.