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

Error handling #248

Merged
merged 39 commits into from
Nov 16, 2023
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6cb5bb0
Move envs to odra-core
kubaplas Sep 18, 2023
a855b74
CasperVM
kubaplas Sep 26, 2023
eaed399
Wip
kubaplas Sep 28, 2023
00a859a
Wip
kubaplas Sep 28, 2023
f00e4fc
odra2, wasm backend, counter
zie1ony Sep 28, 2023
ccd7e84
deployer
zie1ony Sep 28, 2023
0bfabfc
Running tests on casperVM
kubaplas Sep 29, 2023
df10f8b
Odra VM Machine (Odra VeryMilusia Machine)
kubaplas Sep 29, 2023
58b638e
OdraVm - continue
kubaplas Sep 29, 2023
74152f0
Running tests without features
kubaplas Oct 2, 2023
dbfc9e5
Squashed commit of the following:
kubaplas Oct 2, 2023
bca6a31
Fix justfile
kubaplas Oct 2, 2023
12f926a
EntryPointsCaller
kubaplas Oct 2, 2023
06f217e
allow for dead code
zie1ony Oct 2, 2023
6e08c32
Everything is now Bytes.
kubaplas Oct 3, 2023
fc6e117
Constructors
zie1ony Oct 23, 2023
9ceba08
Resurect counter_pack and add print_gas_report for host env.
zie1ony Oct 23, 2023
bed4c50
Cross Calls
kubaplas Oct 24, 2023
8eae676
Remove generic consts
zie1ony Oct 24, 2023
86b58fd
Balances in OdraVm
kubaplas Oct 26, 2023
c351c55
Balances on Casper.
kubaplas Oct 26, 2023
0cbd6d2
Move directories around
kubaplas Oct 27, 2023
4acaeb1
get_block_time
kubaplas Oct 27, 2023
8429541
Removed balance_of from contract_env
kubaplas Oct 27, 2023
1e2781e
Remove generic consts
zie1ony Oct 24, 2023
9d3d0ba
merge
zie1ony Oct 27, 2023
c67a872
get_event
kubaplas Oct 31, 2023
4f038be
Skip proxy getter in casper tests if not needed.
zie1ony Nov 6, 2023
1b08371
Merge branch 'feature/envs-in-odra-core' of github.com:odradev/odra i…
kubaplas Nov 6, 2023
6150711
Events
kubaplas Nov 7, 2023
c48e684
Merge remote-tracking branch 'origin/release/0.8.0' into feature/envs…
kubaplas Nov 8, 2023
20d61b8
Wrap event in another layer of Bytes in OdraVm
kubaplas Nov 8, 2023
3bf87af
get_event in Ref
kubaplas Nov 8, 2023
7dc7480
WIP
kubaplas Nov 10, 2023
c04b0bd
Events using new ces interface
kubaplas Nov 10, 2023
8de7fec
Change return type of HostContext::call_contract
kpob Nov 14, 2023
923c0db
Improve error handling
kpob Nov 15, 2023
b1820b5
Merge branch 'release/0.8.0' into feature/errors
kpob Nov 15, 2023
41f2ac6
Apply peer's suggestions
kpob Nov 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CasperVM
kubaplas committed Sep 26, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a855b74dd95cd7e8e4ea36c977163c80c8992837
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ members = [
"odra-casper/codegen",
"odra-casper/shared",
"odra-casper/test-env",
"odra-casper/test-env2",
"odra-casper/livenet"
]

21 changes: 21 additions & 0 deletions odra-casper/test-env2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "odra-casper-test-env2"
edition = "2021"
description = "Odra test environment for the Casper Blockchain."
keywords = ["wasm", "webassembly", "blockchain"]
categories = ["wasm", "smart contracts"]
version = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
homepage = { workspace = true }
repository = { workspace = true }

[dependencies]
casper-engine-test-support = { version = "5.0.0", features = ["test-support"] }
casper-execution-engine = { workspace = true }
casper-contract = "3.0.0"
odra-core = { path = "../../odra-core" }
odra-types = { path = "../../types" }
odra = { path = "../../core" }
odra-casper-shared = { path = "../shared" }
casper-event-standard = "0.4.0"
261 changes: 261 additions & 0 deletions odra-casper/test-env2/resources/chainspec.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
[protocol]
# Protocol version.
version = '1.5.1'
# Whether we need to clear latest blocks back to the switch block just before the activation point or not.
hard_reset = true
# This protocol version becomes active at this point.
#
# If it is a timestamp string, it represents the timestamp for the genesis block. This is the beginning of era 0. By
# this time, a sufficient majority (> 50% + F/2 — see finality_threshold_fraction below) of validator nodes must be up
# and running to start the blockchain. This timestamp is also used in seeding the pseudo-random number generator used
# in contract-runtime for computing genesis post-state hash.
#
# If it is an integer, it represents an era ID, meaning the protocol version becomes active at the start of this era.
activation_point = 9100

[network]
# Human readable name for convenience; the genesis_hash is the true identifier. The name influences the genesis hash by
# contributing to the seeding of the pseudo-random number generator used in contract-runtime for computing genesis
# post-state hash.
name = 'casper'
# The maximum size of an acceptable networking message in bytes. Any message larger than this will
# be rejected at the networking level.
maximum_net_message_size = 25_165_824

[core]
# Era duration.
era_duration = '120min'
# Minimum number of blocks per era. An era will take longer than `era_duration` if that is necessary to reach the
# minimum height.
minimum_era_height = 20
# Minimum difference between a block's and its child's timestamp.
minimum_block_time = '32768ms'
# Number of slots available in validator auction.
validator_slots = 100
# A number between 0 and 1 representing the fault tolerance threshold as a fraction, used by the internal finalizer.
# It is the fraction of validators that would need to equivocate to make two honest nodes see two conflicting blocks as
# finalized: A higher value F makes it safer to rely on finalized blocks. It also makes it more difficult to finalize
# blocks, however, and requires strictly more than (F + 1)/2 validators to be working correctly.
finality_threshold_fraction = [1, 3]
# Protocol version from which nodes are required to hold strict finality signatures.
start_protocol_version_with_strict_finality_signatures_required = '1.5.0'
# Which finality is required for legacy blocks. Options are 'Strict', 'Weak' and 'Any'.
# Used to determine finality sufficiency for new joiners syncing blocks created
# in a protocol version before
# `start_protocol_version_with_strict_finality_signatures_required`.
legacy_required_finality = 'Strict'
# Number of eras before an auction actually defines the set of validators. If you bond with a sufficient bid in era N,
# you will be a validator in era N + auction_delay + 1.
auction_delay = 1
# The period after genesis during which a genesis validator's bid is locked.
locked_funds_period = '90days'
# The period in which genesis validator's bid is released over time after it's unlocked.
vesting_schedule_period = '13 weeks'
# Default number of eras that need to pass to be able to withdraw unbonded funds.
unbonding_delay = 7
# Round seigniorage rate represented as a fraction of the total supply.
#
# Annual issuance: 8%
# Minimum block time: 2^15 milliseconds
# Ticks per year: 31536000000
#
# (1+0.08)^((2^15)/31536000000)-1 is expressed as a fractional number below
# Python:
# from fractions import Fraction
# Fraction((1 + 0.08)**((2**15)/31536000000) - 1).limit_denominator(1000000000)
round_seigniorage_rate = [7, 87535408]
# Maximum number of associated keys for a single account.
max_associated_keys = 100
# Maximum height of contract runtime call stack.
max_runtime_call_stack_height = 12
# Minimum allowed delegation amount in motes
minimum_delegation_amount = 500_000_000_000
# Global state prune batch size (0 = this feature is off)
prune_batch_size = 0
# Enables strict arguments checking when calling a contract; i.e. that all non-optional args are provided and of the correct `CLType`.
strict_argument_checking = false
# Number of simultaneous peer requests.
simultaneous_peer_requests = 5
# The consensus protocol to use. Options are "Zug" and "Highway".
consensus_protocol = 'Highway'
# The maximum amount of delegators per validator. if the value is 0, there is no maximum capacity.
max_delegators_per_validator = 1200

[highway]
# Highway dynamically chooses its round length, between minimum_block_time and maximum_round_length.
maximum_round_length = '132seconds'
# The factor by which rewards for a round are multiplied if the greatest summit has ≤50% quorum, i.e. no finality.
# Expressed as a fraction (1/5 by default).
reduced_reward_multiplier = [1, 5]

[deploys]
# The maximum number of Motes allowed to be spent during payment. 0 means unlimited.
max_payment_cost = '0'
# The duration after the deploy timestamp that it can be included in a block.
max_ttl = '1day'
# The maximum number of other deploys a deploy can depend on (require to have been executed before it can execute).
max_dependencies = 10
# Maximum block size in bytes including deploys contained by the block. 0 means unlimited.
max_block_size = 10_485_760
# Maximum deploy size in bytes. Size is of the deploy when serialized via ToBytes.
max_deploy_size = 1_048_576
# The maximum number of non-transfer deploys permitted in a single block.
block_max_deploy_count = 50
# The maximum number of wasm-less transfer deploys permitted in a single block.
block_max_transfer_count = 1250
# The maximum number of approvals permitted in a single block.
block_max_approval_count = 2600
# The upper limit of total gas of all deploys in a block.
block_gas_limit = 10_000_000_000_000
# The limit of length of serialized payment code arguments.
payment_args_max_length = 1024
# The limit of length of serialized session code arguments.
session_args_max_length = 1024
# The minimum amount in motes for a valid native transfer.
native_transfer_minimum_motes = 2_500_000_000

[wasm]
# Amount of free memory (in 64kB pages) each contract can use for stack.
max_memory = 64
# Max stack height (native WebAssembly stack limiter).
max_stack_height = 500

[wasm.storage_costs]
# Gas charged per byte stored in the global state.
gas_per_byte = 630_000

[wasm.opcode_costs]
# Bit operations multiplier.
bit = 300
# Arithmetic add operations multiplier.
add = 210
# Mul operations multiplier.
mul = 240
# Div operations multiplier.
div = 320
# Memory load operation multiplier.
load = 2_500
# Memory store operation multiplier.
store = 4_700
# Const store operation multiplier.
const = 110
# Local operations multiplier.
local = 390
# Global operations multiplier.
global = 390
# Integer operations multiplier.
integer_comparison = 250
# Conversion operations multiplier.
conversion = 420
# Unreachable operation multiplier.
unreachable = 270
# Nop operation multiplier.
nop = 200
# Get current memory operation multiplier.
current_memory = 290
# Grow memory cost, per page (64kb).
grow_memory = 240_000

# Control flow operations multiplier.
[wasm.opcode_costs.control_flow]
block = 440
loop = 440
if = 440
else = 440
end = 440
br = 440_000
br_if = 440_000
return = 440
select = 440
call = 140_000
call_indirect = 140_000
drop = 440

[wasm.opcode_costs.control_flow.br_table]
# Fixed cost per `br_table` opcode
cost = 440_000
# Size of target labels in the `br_table` opcode will be multiplied by `size_multiplier`
size_multiplier = 100

# Host function declarations are located in smart_contracts/contract/src/ext_ffi.rs
[wasm.host_function_costs]
add = { cost = 5_800, arguments = [0, 0, 0, 0] }
add_associated_key = { cost = 9_000, arguments = [0, 0, 0] }
add_contract_version = { cost = 200, arguments = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }
blake2b = { cost = 200, arguments = [0, 0, 0, 0] }
call_contract = { cost = 4_500, arguments = [0, 0, 0, 0, 0, 420, 0] }
call_versioned_contract = { cost = 4_500, arguments = [0, 0, 0, 0, 0, 0, 0, 420, 0] }
create_contract_package_at_hash = { cost = 200, arguments = [0, 0] }
create_contract_user_group = { cost = 200, arguments = [0, 0, 0, 0, 0, 0, 0, 0] }
create_purse = { cost = 2_500_000_000, arguments = [0, 0] }
disable_contract_version = { cost = 200, arguments = [0, 0, 0, 0] }
get_balance = { cost = 3_800, arguments = [0, 0, 0] }
get_blocktime = { cost = 330, arguments = [0] }
get_caller = { cost = 380, arguments = [0] }
get_key = { cost = 2_000, arguments = [0, 440, 0, 0, 0] }
get_main_purse = { cost = 1_300, arguments = [0] }
get_named_arg = { cost = 200, arguments = [0, 0, 0, 0] }
get_named_arg_size = { cost = 200, arguments = [0, 0, 0] }
get_phase = { cost = 710, arguments = [0] }
get_system_contract = { cost = 1_100, arguments = [0, 0, 0] }
has_key = { cost = 1_500, arguments = [0, 840] }
is_valid_uref = { cost = 760, arguments = [0, 0] }
load_named_keys = { cost = 42_000, arguments = [0, 0] }
new_uref = { cost = 17_000, arguments = [0, 0, 590] }
random_bytes = { cost = 200, arguments = [0, 0] }
print = { cost = 20_000, arguments = [0, 4_600] }
provision_contract_user_group_uref = { cost = 200, arguments = [0, 0, 0, 0, 0] }
put_key = { cost = 38_000, arguments = [0, 1_100, 0, 0] }
read_host_buffer = { cost = 3_500, arguments = [0, 310, 0] }
read_value = { cost = 6_000, arguments = [0, 0, 0] }
read_value_local = { cost = 5_500, arguments = [0, 590, 0] }
remove_associated_key = { cost = 4_200, arguments = [0, 0] }
remove_contract_user_group = { cost = 200, arguments = [0, 0, 0, 0] }
remove_contract_user_group_urefs = { cost = 200, arguments = [0, 0, 0, 0, 0, 0] }
remove_key = { cost = 61_000, arguments = [0, 3_200] }
ret = { cost = 23_000, arguments = [0, 420_000] }
revert = { cost = 500, arguments = [0] }
set_action_threshold = { cost = 74_000, arguments = [0, 0] }
transfer_from_purse_to_account = { cost = 2_500_000_000, arguments = [0, 0, 0, 0, 0, 0, 0, 0, 0] }
transfer_from_purse_to_purse = { cost = 82_000, arguments = [0, 0, 0, 0, 0, 0, 0, 0] }
transfer_to_account = { cost = 2_500_000_000, arguments = [0, 0, 0, 0, 0, 0, 0] }
update_associated_key = { cost = 4_200, arguments = [0, 0, 0] }
write = { cost = 14_000, arguments = [0, 0, 0, 980] }
write_local = { cost = 9_500, arguments = [0, 1_800, 0, 520] }

[system_costs]
wasmless_transfer_cost = 100_000_000

[system_costs.auction_costs]
get_era_validators = 10_000
read_seigniorage_recipients = 10_000
add_bid = 2_500_000_000
withdraw_bid = 2_500_000_000
delegate = 2_500_000_000
undelegate = 2_500_000_000
run_auction = 10_000
slash = 10_000
distribute = 10_000
withdraw_delegator_reward = 10_000
withdraw_validator_reward = 10_000
read_era_id = 10_000
activate_bid = 10_000
redelegate = 2_500_000_000

[system_costs.mint_costs]
mint = 2_500_000_000
reduce_total_supply = 10_000
create = 2_500_000_000
balance = 10_000
transfer = 10_000
read_base_round_reward = 10_000
mint_into_existing_purse = 2_500_000_000

[system_costs.handle_payment_costs]
get_payment_purse = 10_000
set_refund_purse = 10_000
get_refund_purse = 10_000
finalize_payment = 10_000

[system_costs.standard_payment_costs]
pay = 10_000
Binary file not shown.
Loading