Changelog for odra.
- Refactor of
CEP-95token implementation.
set_name,set_symbolandset_decimalsfunctions toCEP-18module.- Support for events from RPC to detect transaction success/failure.
- Refactor of
CEP-95token implementation.
ODRA_CASPER_LIVENET_TTLenvironment variable to set the TTL for the Casper livenet.
- Transaction TTL changed from 1m to 5m.
- Support for deploying upgradable contracts and possibility to upgrade them.
- Rich stacktrace for OdraVM.
DeployerExt::load_or_deploy_with_cfginodra-clito make contracts deployment smoother.- Support for minimum bid amount in OdraVM to reflect the default CasperVM behaviour.
- Contract can query ValidatorInfo for its minimum bid amount.
- Support for deploying upgradable contracts and possibility to upgrade them.
- Fixed mismatch between rewards in OdraVM and CasperVM.
- Improved support for decoding a wider range of types in
odra-cli. - Smarter
CasperClient::wait_for_transaction, that handles empty execution results.
OdraConfigtrait is now replaced byInstallConfigstruct.
init_dictionaryfunction inContractEnv.initfunctions to all named keys related modules.- Enforce all named keys in
CEP-18andCEP-95to be initialized in theinitfunction. - New commands in
odra-cli:whoami- prints the address of the current account.print-events- prints all events emitted by the contract.
- A base cli implementation in templates.
- Signature of functions in
HostEnv, to accept&Addressableinstead ofAddress. - Signature of
emitted_*functions inHostEnv, to acceptT: ToBytes + EventInstanceinstead of a&Treference. odra-clirequires thegasparameter to call a mutable entrypoint.__attached_valueis nowattached_valueinodra-cli.HostEnv::address() -> &Addressnow isHostEnv::contract_address(&self) -> Address.Addressable::address()returnsAddressinstead of&Address.
CEP-95token implementation inodra-modules.- Psuedorandom number generator in
ContractEnv. - Examples of
odra-cliusage inodra-examples.
CEP-18is now more relaxed in terms of required entrypoints.
- Support for Casper 2.
- Native Casper events are now supported, alongside CES events:
- new contract env functions:
emit_native_event - new host env function
emitted_native,emitted_native_event,native_eventsandnative_event_names
- new contract env functions:
- Support for delegating funds by the contracts:
- new contract env functions:
delegate,undelegateanddelegated_amount - new host env functions:
delegated_amount,get_validator,remove_validator,advance_with_auctions,auction_delayandunbonding_delay
- new contract env functions:
- New contract env function
pseudorandom_byteswhich uses a randomness source from host. - New host env functions
block_time_millisandblock_time_secsto avoid any confusion with EVM based code. odra-bdd- a new crate for testing Odra contracts using BDD style.odra-cli- a new crate for creating cli tools for Odra contracts.
- Support for Casper 1.
- bumped rust-toolchain to
nightly-2024-07-31
- More public methods in
CEP18module.
deploy_with_cfgto handleodra_cfgargs inlivenet.odra-cliis now in the repository.
- Calling
initfails inodra_vm.
OdraContracttrait grouping module-related structures.
Deployeris no longer implemented forHostRefbut forOdraContract.chainspec.tomlfile has been updated to be compatible with the latest version ofcasper-execution-engine.
Externtype for simple external calls.
- Allow for reminting tokens in
CEP78. - Include custom types into schema.
- Support for CSPR.cloud's auth token.
newmethod forAddressto create an address from a string.transferfunction in theHostEnvallowing native token transfers between accounts.- Reverse lookup feature for
CEP78. Addressabletrait for types that can be converted toAddress.
- Fix
get_block_timeincasper-rpc-client. - Calling
try_functions in the livenet context now returns aResultinstead of panicking. - Improve error messages in the livenet context.
- Update
HostEnvfunctions acceptAddressableinstead ofAddress.
- Add
try_deployfunction to theDeployertrait, which allows deploying a contract and returning an error if the deployment fails. - Add
Cep18toodra-modules- a standard for fungible tokens. - Add
Cep78toodra-modules- a standard for non-fungible tokens. - Add
cep18andcep78templates.
- Update casper crates to the latest versions.
- Fix minor bugs in generated code.
- Fix events collection in submodules.
#[odra::odra_type]attribute can be applied to all flavors of enums (before applicable to unit-only enums).
Maybe<T>- a type that represents an entrypoint arg that may or may not be present.EntrypointArgument- a trait for types that can be used as entrypoint arguments.- an example of using
Maybe<T>inodra-examplescrate. get_opt_named_arg_bytes(&str)inContractEnvodra::contract_def::Argumenthas a newis_requiredfield.odra-schemacrate for generating contract schema that aligns with Casper Contract Schema.odra::eventproc macro that combines Casper Event Standard and Casper Contract Schema boilerplate code.odra::moduleacceptserrorattribute to generate custom error in the schema.
- update modules and examples to reflect the changes.
OdraTypederive macro is now an attribute macro[odra::odra_type].OdraErrorderive macro is now an attribute macro[odra::odra_error].
- #391 - compile error when using a type reference in the constructor signature.
ContractReftrait withnewandaddressfunctions. All contract references now implement it.disable-allocatorfeature forodracrate. It allows to disable the allocator used by Odra Framework in wasm build.odra-buildcrate for including the code in contract's build.rs file.
- Traits implemented by modules are now also implemented by their
ContractRefsandHostRefs.
- Replaced
contract_env::withself.env()in the contract context (of typeContractEnv). For example, instead ofcontract_env::caller()useself.env.caller(). - Replaced
test_envwithodra_test::env()in the test context (of typeHostEnv). - It is no longer possible to put a Mapping inside a Mapping. Use tuple keys instead, for example, instead of
allowances: Mapping<Address, Mapping<Address, U256>>use
allowances: Mapping<(Address, Address), U256>Refhas been divided into two:HostRefandContractRefdepending on the context.- Storage keys are constructed differently, keep that in mind when querying the storage outside the contract.
token_balance(address: Address)in test context is nowbalance_of(address: &Address).- Modules needs to be wrapped in SubModule<> when used in another module.
HostRef(formerlyRef) methods parameters accept values even if endpoints expect references.unwrap_or_revertandunwrap_or_revert_withnow require&HostEnvas a first parameter.Variablehas been renamed toVar.- Spent Gas is taken into account when checking an account balance. This means that all calls appear to cost 0 gas to the test accounts, but it is still possible to check the costs of the calls.
- Various changes of method signatures in
odra-modules, e.g.&[U256]changed toVec<U256>inon_erc1155_batch_receivedmethod. get_block_time()now returnsu64instead of wrapped typeBlocktime(u64).- The
nameproperty inOdra.tomlis not required anymore. odra-casper-backendcrate is nowodra-casper-wasm-envodra-mock-vmcrate is nowodra-vmodra-proc-macrosis the only code generation point.
- Removed
#[odra::init]macro - now only one method can be a constructor, and it has to be namedinit. - Removed
emit()method from events. Useself.env.emit_event(event)instead. - Removed
assert_events!macro. Useenv.emitted_eventand similar methods instead. - Removed
native_token_metadata()and its respective structs. - Removed
assert_exception!macro. Usetry_prefix for endpoints instead. It returns aResultwhich can be used with a regularassert_eq!macro.` - Removed
odra(using)macro. - Removed
default()method fromDeployer. Useinit()instead. - Removed
StaticInstanceandDynamicInstancetraits. UseModuleinstead. - Removed
Nodetrait. - Removed
odra-types,odra-ir,odra-codegen,odra-casper-backend,odra-casper-shared,odra-utilscrates. - Removed
OdraEventtrait,odrareexportscasper_event_standardcrate instead.
last_call()in test env withContractCallResultstruct which holds all information about the last call.odra::prelude::*module which reexports all basic types and traits. It is recommended to use it in the module code.odra-testcrate providingHostEnvfor testing purposes.odra-corecrate providing framework core functionalities.odra-casper-rcp-clientcrate providingCasperClientfor interacting with Casper node.odra-casper-livenet-envcrate providing a host environment fo for the Casper livenet.HostReftrait - a host side reference to a contract.HostRefLoadertrait for loading a contract from the host environment.EntryPointsCallerProvidertrait.Deployertrait - a struct implementing that trait can deploy a contract.InitArgstrait - a struct implementing that trait can be used as a constructor argument.NoArgsstruct, an implementation ofInitArgsfor empty/none (no constructor) arguments.
- Copy
binfolder andbuild.rsfiles from a freshly generated project usingcargo-odraat version at least0.1.0. - Update
Cargo.tomlby removing features and adding [[bin]] sections (SeeCargo.tomlfrom generated project). - Update the code to reflect changes in the framework.
no_stdis now the default mode for WASM.odra-typesare the only types crate.
- Removed
odra-casper-typesandodra-mock-vm-types. - Removed
OdraTypein favor ofToBytesandFromBytestraits.
stdfeature for odra crate.odra::preludereexports basic types and traits based on std feature.
- Replace
WeeAllocwithink!'sBumpAllocator.
- Signature verification in contract_envs.
- Signature creation in test_envs.
- StaticInstance and DynamicInstance traits.
- Node trait to build static keys at the compilation time.
Listnow can contain modules.
- Crypto module from odra-modules.
- Instance trait.
- derive PartialEq, Eq, Debug from storage building block (Var, Mapping, List).
- utilize
KeyMakerto create storage keys incasperandcasper-livenet. - Only
payableentrypoints checks incoming Casper purse and it is optional. - Casper contract's
cargo_purseis now created just once and reused.
odra-casper-livenethas new resource:proxy_caller.wasm.odra-casper-shared,odra-casper-typesandodra-typesare nowno_std.- Modules can have arguments that are references.
odra-casper-test-envhas newgas_report()function, that shows gas usages.
- Casper gas counting.
test-env/getter-proxyis nowproxy-caller.proxy_getter.wasmis nowproxy_caller_with_result.wasm.- Casper's
callmethods for wasm build has a new set of arguments including upgradable contracts. - Support for the Casper 1.5.1 version.
casper-nodeis no longer a dependency forodra-casper-livenet.Composer
Composer- a tool for composing Odra modules' instances.- Casper's
chainspec.yamladded to the repository. - Improvements to numeric conversions.
Typedtrait is implemented automatically forOdraTypetypes.test_envexposestotal_gas_used()function to allow better native token usage tracking.RUST_BACKTRACE=-1will show the backtrace of the contract calls that panicked.- Panicked contract calls will print the information about the call.
- Better handling of call stack in MockVM.
- Better handling of native transfers in MockVM.
- Genesis in the MockVM generates more addresses with more tokens.
- Improved
assert_exception!macro. It no longer needs new instance of Ref.
transfer_tokens()now reverts if the transfer failed instead of returning false.advance_block_time_by()now uses milliseconds instead of seconds.
- new module -
Sequence- for storing single value in the storage that can be incremented. - Casper contracts now generate schemas automatically. containing contract structure and Events schemas following the Casper Event Standard.
- Modules and Mappings now can be a part of a Mapping allowing to nest them.
- Namespaces can be generated manually for a finer control over nesting.
#[odra::module(events = [Event1, Event2, ...])]attribute for modules to generate events.delegate!macro for delegating calls to other modules.#[odra(non_reeentrant)]attribute for modules to enable reentrancy guard.#[derive(OdraType)]for derivingOdraTypetrait for custom types.- Unit-type Enums can now be OdraTypes.
- New Odra Modules:
Erc721,Erc1155,Ownable,Ownable2Step,AccessControl.
- Experimental
odra-casper-livenetcrate for deploying contracts to Casper Livenet.
last_call_contract_cost()is nowlast_call_contract_gas_used().- It is no longer possible to build zero address in casper.
newmethod for Address.
- Global
CHANGELOG.md. odraListcollection.- Add tests for
VarandMapping. - Contract refs (
*Refstruct) haswith_tokens()function to attach tokens to the call.
odra-mock-vm- Add
AccountBalanceto store the native token amount associated with theAddress. - Add
CallstackElementto stack contract execution along with the attached value.
- Add
- New crate
odra-mock-vm-types- encapsulatesmock-vm-specific types. - New crate
odra-casper-codegen- generates Casper contracts, moved fromodra-casper-backend. - New crate
odra-casper-types- encapsulatesCasper-specific types. odra-casper-test-env- Add
dummy_contract_envmodule.
- Add
- New crate
odra-examplesOwnable- simple storage, errors, events.Erc20- erc-20 standard implementation.OwnedToken- modules reuse.BalanceChecker- external contract calls.TimeLockWallet- payable.
- New crate
odra-modulesa set of reusable modules.Erc20- erc-20 token.WrappedNativeToken- erc20-based wrapped token.
CONTRIBUTING.mdandSECURITY.md.justfile
odra- Features update: rename
wasmtocasper, removewasm-test. - Features check: setting
casperandmock-vmcauses compile error. Mapping's functions:set(),add(),subtract().Var's functions:set(),add(),subtract().VarandMappingare implemented forOdraType.- Add
amountparameter tocall_contract. contract_envandtest_envare modules not structs.- To deploy contract in test, structs no longer have
deploy_*function,*Deployerstructs are generated. - The default contract constructor is called
*Deployer::default.
- Features update: rename
odra-types- Add
Typeenum describing all supported types. - Rename
EventtoOdraEvent. - Remove all dependencies.
- Update
VmErrors. - Bring
contract_defmodule fromodracrate. - Remove
casperdependencies fromcontract_def.
- Add
odra-utils- Remove
odra-typesdependency. - Change
event_absolute_positionsignature - the function returnsOption<usize>.
- Remove
odra-codegen- Handle
odra(payable)attribute. - Adjust generated code to framework changes.
- Handle
odra-mock-vmMockVMrefactor.test_envis a module not a struct.- Change
call_contract()signature. - Add
advance_block_time_by(),token_balance(),one_token()functions.
odra-casper-backend,odra-casper-shared,odra-casper-test-envmoved from a separate repository.odra-casper-backendcontract_envis a module not a struct.- Add
one_token(),self_balance(),attached_value(),transfer_tokens()functions. - Change
call_contract()signature odra-casper-test-envtest_envis a module not a struct.- Change
call_contract()signature. - Add
advance_block_time_by(),token_balance(),one_token()functions.
odraextern bindings.odra-test-env-wrappercrate.- Separate changelog files per crate.
odra-casper-backend,odra-casper-shared,odra-casper-test-envdocumentation.
odracontract_defprovides an abstract definition of a smart contract.external_apimodule that defines the api to be implemented by a backed blockchain.instancemodule exposing a trait used to instantiate a module.variableandmappingmodules that allow to read and write single values and collections in smart contracts.test_utilsmodule that defines functions and macros to utilize smart contracts testing.unwrap_or_revertmodule that provides a trait for unwrapping values in the context of smart contract.CHANGELOG.mdandREADME.mdfiles.
odra-typesaddressmodule defines a blockchain-agnostic address struct that can be used for storing contract and account addresses.arithmeticmodule defines traits for safe (revertable), overflowing addition, and subtraction.eventmodule that defines an event interface and companion errors.errormodule encapsulates errors that may occur during smart contract execution.ToBytesandFromBytestraits for structs serialization and deserialization, e.g. events.CHANGELOG.mdandREADME.mdfiles.- Re-export
casper-typesasodra-types.
odra-utilscamel_to_snakefunction for the contract name conversion.event_absolute_positionfunction to calculate the event absolute position.CHANGELOG.mdandREADME.mdfiles.
odra-test-env-wrapperTestBackenddefines the api oflibodra_test_env.so.on_backendfunction to interact withlibodra_test_env.so.CHANGELOG.mdandREADME.mdfiles.
odra-mock-vmTestEnvandContractEnvimplementations used to run tests.MockVM, a lightweight blockchain virtual machine.CHANGELOG.mdandREADME.mdfiles.
odra-proc-macros- Procedural macro
odra::module. - Procedural macro
odra::instance. - Procedural macro
odra::external_contract. - Procedural macro
odra::execution_error. - Procedural macro
odra::odra_error. - Derive macro
Event. CHANGELOG.mdandREADME.mdfiles.
- Procedural macro
odra-ir- structs responsible for capturing code used to generate code for
odra::module,odra::instance,odra::external_contract,odra::execution_error,odra::odra_error, andEventmacros. CHANGELOG.mdandREADME.mdfiles.
- structs responsible for capturing code used to generate code for
odra-codegen- code generators for
odra::module,odra::instance,odra::external_contract,odra::execution_error,odra::odra_error, andEventmacros. CHANGELOG.mdandREADME.mdfiles.
- code generators for
odra-casper-test-envgetter_proxychild crate.CHANGELOG.mdandREADME.mdfiles.env::CasperTestEnvthat wraps Casper'sInMemoryWasmTestBuilder.#[no_mangle]functions used to communicate with thelibodra_test_env.so
odra-casper-sharedcasper_address::CasperAddressstruct.CHANGELOG.mdandREADME.mdfiles.
odra-casper-backendcodegenmodule that is used to generate wasm file.backendmodule that exports all required#[no_mangle]functions and interacts with the Casper Host.CHANGELOG.mdandREADME.mdfiles.
odra-casper-getter-proxygetter_proxy.rsbinary file.