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

encode error from basic features migration to new proxy and unified syntax #1516

Merged
Merged
Changes from all commits
Commits
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
25 changes: 2 additions & 23 deletions contracts/feature-tests/basic-features/src/codec_err_test.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
multiversx_sc::imports!();
use crate::types::CodecErrorTestType;

mod encode_err_proxy {
multiversx_sc::imports!();
use crate::types::CodecErrorTestType;

#[multiversx_sc::proxy]
pub trait EncodeErrorProxy {
#[init]
fn init(&self, error_arg: CodecErrorTestType);

#[endpoint]
fn encode_error_method(&self, error_arg: CodecErrorTestType);
}
}

/// Test various serialization errors.
#[multiversx_sc::module]
pub trait CodecErrorTest {
Expand Down Expand Up @@ -62,24 +48,17 @@ pub trait CodecErrorTest {
fn codec_err_event_data(&self) {
self.event_err_data(CodecErrorTestType);
}

#[proxy]
fn encode_err_proxy(&self) -> encode_err_proxy::Proxy<Self::Api>;

/// Never actually calls any deploy/upgrade, so it is appropriate in this contract.
/// It just covers contract init serialization errors.
#[endpoint]
fn codec_err_contract_init(&self) {
let _ = self.encode_err_proxy().init(CodecErrorTestType);
let _ = self.tx().raw_deploy().argument(&CodecErrorTestType);
}

/// Never actually calls any async/sync call, so it is appropriate in this contract.
/// It just covers contract call serialization errors.
#[endpoint]
fn codec_err_contract_call(&self) {
let _ = self
.encode_err_proxy()
.contract(ManagedAddress::zero())
.encode_error_method(CodecErrorTestType);
let _ = self.tx().raw_call().argument(&CodecErrorTestType);
}
}
Loading