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

Fix/events and cep78 extensions #431

Merged
merged 49 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
31aef8b
cep-78 basics
kpob Apr 12, 2024
c00f941
cep-78 entrypoints implementation
kpob Apr 12, 2024
17bd2e8
reverse lookup wip
kpob Apr 15, 2024
70bf5f2
Skip args validation
kpob Apr 16, 2024
abc8b1d
Impl Default for Maybe
kpob Apr 16, 2024
116987e
update token impl
kpob Apr 16, 2024
4eccc45
ACL test wip
kpob Apr 16, 2024
f4b17b3
Add missing acl test
kpob Apr 17, 2024
4aca069
test set_varialbes endpoint
kpob Apr 17, 2024
ca7e6a7
minting tests
kpob Apr 18, 2024
637fdbe
Add burn tests
kpob Apr 19, 2024
e5d7166
Add events tests
kpob Apr 19, 2024
00cdaee
metadata tests
kpob Apr 19, 2024
2949e1b
Add transfer tests
kpob Apr 23, 2024
039e933
refactor
kpob Apr 24, 2024
facb85c
fix tests
kpob Apr 24, 2024
961f3c1
Refactor CEP78 module and fix tests
kpob Apr 24, 2024
24fa20e
fix linter issues
kpob Apr 24, 2024
af5e8e5
Reorganize test contracts and rename CEP78 to Cep78
kpob Apr 25, 2024
622ac03
wip
kpob Apr 25, 2024
3865982
Refactor contract deployment functions to return Result types
kpob Apr 25, 2024
f9f740e
Add missing installation time checks and tests
kpob Apr 25, 2024
32489d4
Add missing tests
kpob Apr 25, 2024
dd33780
make clippy happy again
kpob Apr 25, 2024
bd86080
Merge branch 'release/1.0.0' into feature/cep-78
kpob Apr 26, 2024
0aef4cb
cep78 using named keys - wip
kpob Apr 26, 2024
297bb72
Use named keys instead of Var and Mappings
kpob May 6, 2024
5aadae9
Allow token id as hash + mutable metadata. (#421)
zie1ony May 6, 2024
958dd73
fmt, add remove_dictionary to ContractEnv
kpob May 6, 2024
7aae548
bug fix
kpob May 6, 2024
ff35352
fix tests
kpob May 7, 2024
acd62a9
`get_named_key` does not revert if the key does not exists
kpob May 7, 2024
958a817
register events
kpob May 7, 2024
7dda987
Merge branch 'release/1.0.0' into feature/cep-78
kpob May 7, 2024
67c04cf
Update some args names to match the casper impl args
kpob May 7, 2024
a777639
Add livenet example
kpob May 7, 2024
f561155
Fix variable name in NftContract trait
kpob May 7, 2024
9be2222
Update CEP-78 livenet example
kpob May 8, 2024
f653b6e
Compile cargo-odra with stable
zie1ony May 9, 2024
d092625
wip
zie1ony May 10, 2024
e447fb9
Fix SubModule events
zie1ony May 10, 2024
d2d2e7d
Merge branch 'release/1.0.0' into fix/last-before-100
zie1ony May 10, 2024
c84726e
Events fix, version bump to 1.0.0-rc.1, small updates
zie1ony May 13, 2024
bea1ee5
Inline cep78 burn inner function.
zie1ony May 13, 2024
996b59e
Add Serde to Address
zie1ony May 13, 2024
bbe7cd1
Add Serde to Address
zie1ony May 13, 2024
bf94b08
enable serde for all
zie1ony May 13, 2024
6414984
wip
zie1ony May 13, 2024
84893d7
Change Serde encoding for Address
zie1ony May 14, 2024
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
17 changes: 9 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ exclude = [ "examples", "modules", "benchmark", "odra-casper/proxy-caller", "tem
resolver = "2"

[workspace.package]
version = "0.9.1"
version = "1.0.0-rc.1"
authors = ["Jakub Płaskonka <kuba@odra.dev>", "Krzysztof Pobiarżyn <krzysztof@odra.dev>", "Maciej Zieliński <maciej@odra.dev>"]
license = "MIT"
homepage = "https://odra.dev/docs"
repository = "https://github.com/odradev/odra"

[workspace.dependencies]
odra-core = { path = "core", version = "0.9.1" }
odra-macros = { path = "odra-macros", version = "0.9.1" }
odra-casper-test-vm = { path = "odra-casper/test-vm", version = "0.9.1" }
odra-casper-rpc-client = { path = "odra-casper/rpc-client", version = "0.9.1" }
odra-vm = { path = "odra-vm", version = "0.9.1" }
odra-casper-wasm-env = { path = "odra-casper/wasm-env", version = "0.9.1"}
odra-core = { path = "core", version = "1.0.0-rc.1" }
odra-macros = { path = "odra-macros", version = "1.0.0-rc.1" }
odra-casper-test-vm = { path = "odra-casper/test-vm", version = "1.0.0-rc.1" }
odra-casper-rpc-client = { path = "odra-casper/rpc-client", version = "1.0.0-rc.1" }
odra-vm = { path = "odra-vm", version = "1.0.0-rc.1" }
odra-casper-wasm-env = { path = "odra-casper/wasm-env", version = "1.0.0-rc.1"}
odra-schema = { path = "odra-schema", version = "1.0.0-rc.1" }
casper-contract = { version = "4.0.0", default-features = false }
casper-types = { version = "4.0.1", default-features = false }
casper-execution-engine = "7.0.1"
Expand All @@ -39,4 +40,4 @@ env_logger = "0.11.1"
serde = { version = "1.0.195", default-features = false }
serde_json = { version = "1.0.113", default-features = false }
num-traits = { version = "0.2.14", default-features = false }
mockall = { version = "0.11.4" }
mockall = { version = "0.12.1" }
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</p>
<p>
<a href="https://github.com/odradev/odra/actions">
<img src="https://img.shields.io/github/actions/workflow/status/odradev/odra/test.yml?branch=release%2F0.9.0" alt="GitHub Workflow Status" />
<img src="https://img.shields.io/github/actions/workflow/status/odradev/odra/test.yml?branch=release%2F1.0.0" alt="GitHub Workflow Status" />
</a>
<a href="https://codecov.io/gh/odradev/odra">
<img src="https://codecov.io/gh/odradev/odra/graph/badge.svg?token=8AT1UNOJMS" alt="Code coverage">
Expand Down
2 changes: 0 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ repository = { workspace = true }
casper-types = { workspace = true }
casper-event-standard = { workspace = true }
num-traits = { workspace = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
serde = { workspace = true, default-features = false, features = ["alloc", "derive"] }
serde_json = { workspace = true, default-features = false, features = ["alloc"] }

Expand Down
8 changes: 3 additions & 5 deletions core/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ use casper_types::{
bytesrepr::{self, FromBytes, ToBytes},
CLType, CLTyped, ContractPackageHash, Key, PublicKey
};
use serde::{Deserialize, Serialize};

/// An enum representing an [`AccountHash`] or a [`ContractPackageHash`].
#[cfg_attr(
not(target_arch = "wasm32"),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(PartialOrd, Ord, PartialEq, Eq, Hash, Clone, Copy, Debug)]
#[derive(PartialOrd, Ord, PartialEq, Eq, Hash, Clone, Copy, Debug, Serialize, Deserialize)]
// #[serde(untagged)]
pub enum Address {
/// Represents an account hash.
Account(AccountHash),
Expand Down
7 changes: 2 additions & 5 deletions core/src/call_def.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use crate::prelude::*;
use casper_types::bytesrepr::FromBytes;
use casper_types::{CLTyped, RuntimeArgs, U512};
use serde::{Deserialize, Serialize};

/// Represents a call definition, which includes the method name, runtime arguments, attached value, and mutability flag.
#[cfg_attr(
not(target_arch = "wasm32"),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CallDef {
entry_point: String,
args: RuntimeArgs,
Expand Down
21 changes: 6 additions & 15 deletions core/src/contract_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ use casper_types::{
bytesrepr::{FromBytes, ToBytes},
CLType, Key, PublicKey, URef, U128, U256, U512
};
#[cfg(not(target_arch = "wasm32"))]
use serde::{Deserialize, Serialize};

/// Contract's entrypoint.
#[derive(Debug, Clone)]
#[cfg_attr(not(target_arch = "wasm32"), derive(Serialize, Deserialize))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Entrypoint {
/// The entrypoint's ident.
pub name: String,
Expand All @@ -28,8 +26,7 @@ pub struct Entrypoint {
}

/// Defines an argument passed to an entrypoint.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(not(target_arch = "wasm32"), derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct Argument {
/// The argument's ident.
pub name: String,
Expand All @@ -44,8 +41,7 @@ pub struct Argument {
}

/// Defines an event.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(not(target_arch = "wasm32"), derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct Event {
/// The event's ident.
pub name: String,
Expand All @@ -61,8 +57,7 @@ impl Event {
}

/// Defines an entrypoint type.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(not(target_arch = "wasm32"), derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub enum EntrypointType {
/// A special entrypoint that can be called just once on the contract initialization.
Constructor,
Expand All @@ -71,8 +66,7 @@ pub enum EntrypointType {
}

/// Defines an entrypoint attribute.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(not(target_arch = "wasm32"), derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub enum EntrypointAttribute {
/// A non-reentrant entrypoint.
NonReentrant,
Expand All @@ -99,7 +93,6 @@ pub trait HasEvents {
fn events() -> Vec<Event>;

/// Returns a map of event schemas used by the contract.
#[cfg(target_arch = "wasm32")]
fn event_schemas() -> crate::prelude::BTreeMap<String, casper_event_standard::Schema> {
crate::prelude::BTreeMap::new()
}
Expand All @@ -109,8 +102,7 @@ pub trait HasEvents {
///
/// A contract blueprint is a set of events and entrypoints defined in a smart contract.
/// It is used to generate the contract's ABI.
#[derive(Debug, Clone)]
#[cfg_attr(not(target_arch = "wasm32"), derive(Serialize, Deserialize))]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ContractBlueprint {
/// The name of the contract.
pub name: String,
Expand Down Expand Up @@ -139,7 +131,6 @@ impl ContractBlueprint {
}
}

#[cfg(not(target_arch = "wasm32"))]
/// Converts the `ContractBlueprint` instance to a JSON string representation.
///
/// # Returns
Expand Down
7 changes: 2 additions & 5 deletions core/src/gas_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ use crate::prelude::*;
use crate::{Address, CallDef};
use casper_types::U512;
use core::fmt::{Debug, Display, Formatter, Result};
use serde::{Deserialize, Serialize};

/// A Vector of deploy reports makes a full gas report.
pub type GasReport = Vec<DeployReport>;

/// Represents a deploy report, which includes the gas used and the deploy details.
#[cfg_attr(
not(target_arch = "wasm32"),
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum DeployReport {
/// Represents a Wasm deploy.
WasmDeploy {
Expand Down
4 changes: 4 additions & 0 deletions core/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ impl<M: HasEvents> HasEvents for SubModule<M> {
fn events() -> Vec<crate::contract_def::Event> {
M::events()
}

fn event_schemas() -> crate::prelude::BTreeMap<String, casper_event_standard::Schema> {
M::event_schemas()
}
}

/// Wrapper for a module implementing the `Module` trait.
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "odra-examples"
version = "0.9.1"
version = "1.0.0-rc.1"
edition = "2021"

[dependencies]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "BalanceChecker",
"contract_version": "0.8.1",
"contract_version": "1.0.0-rc.1",
"types": [],
"errors": [],
"entry_points": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "CrossContract",
"contract_version": "0.8.1",
"contract_version": "1.0.0-rc.1",
"types": [],
"errors": [],
"entry_points": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "DogContract2",
"contract_version": "0.8.1",
"contract_version": "1.0.0-rc.1",
"types": [],
"errors": [],
"entry_points": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "DogContract3",
"contract_version": "0.8.1",
"contract_version": "1.0.0-rc.1",
"types": [],
"errors": [],
"entry_points": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "DogContract",
"contract_version": "0.8.1",
"contract_version": "1.0.0-rc.1",
"types": [],
"errors": [],
"entry_points": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "HostContract",
"contract_version": "0.8.1",
"contract_version": "1.0.0-rc.1",
"types": [],
"errors": [],
"entry_points": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "LivenetContract",
"contract_version": "0.8.1",
"contract_version": "1.0.0-rc.1",
"types": [
{
"struct": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "MathEngine",
"contract_version": "0.8.1",
"contract_version": "1.0.0-rc.1",
"types": [],
"errors": [],
"entry_points": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "MockModerated",
"contract_version": "0.8.1",
"contract_version": "1.0.0-rc.1",
"types": [
{
"struct": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"casper_contract_schema_version": 1,
"toolchain": "rustc 1.77.0-nightly (5bd5d214e 2024-01-25)",
"toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)",
"authors": [],
"repository": null,
"homepage": null,
"contract_name": "ModulesContract",
"contract_version": "0.8.1",
"contract_version": "1.0.0-rc.1",
"types": [],
"errors": [],
"entry_points": [
Expand Down
Loading
Loading