@layerzerolabs/protocol-stellar-v2 0.2.11 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +202 -194
- package/.turbo/turbo-lint.log +38 -38
- package/.turbo/turbo-test.log +891 -891
- package/Cargo.lock +1 -1
- package/contracts/common-macros/src/lib.rs +3 -36
- package/contracts/endpoint-v2/src/endpoint_v2.rs +4 -4
- package/contracts/endpoint-v2/src/events.rs +40 -22
- package/contracts/endpoint-v2/src/interfaces/message_lib.rs +2 -2
- package/contracts/endpoint-v2/src/interfaces/message_lib_manager.rs +2 -2
- package/contracts/endpoint-v2/src/interfaces/messaging_channel.rs +2 -2
- package/contracts/endpoint-v2/src/interfaces/messaging_composer.rs +2 -2
- package/contracts/endpoint-v2/src/interfaces/send_lib.rs +2 -2
- package/contracts/endpoint-v2/src/message_lib_manager.rs +3 -3
- package/contracts/endpoint-v2/src/messaging_channel.rs +1 -1
- package/contracts/endpoint-v2/src/messaging_composer.rs +1 -1
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_lib_timeout.rs +4 -8
- package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_library.rs +3 -7
- package/contracts/message-libs/{block-message-lib → blocked-message-lib}/Cargo.toml +1 -1
- package/contracts/message-libs/treasury/src/events.rs +9 -6
- package/contracts/message-libs/uln-302/src/events.rs +19 -11
- package/contracts/message-libs/uln-302/src/interfaces/receive_uln.rs +2 -2
- package/contracts/message-libs/uln-302/src/interfaces/send_uln.rs +2 -2
- package/contracts/message-libs/uln-302/src/receive_uln.rs +2 -2
- package/contracts/message-libs/uln-302/src/send_uln.rs +3 -3
- package/contracts/message-libs/uln-302/src/tests/receive_uln302/set_default_receive_uln_configs.rs +5 -5
- package/contracts/message-libs/uln-302/src/tests/send_uln302/set_default_send_uln_configs.rs +5 -5
- package/contracts/message-libs/uln-302/src/tests/setup.rs +3 -3
- package/contracts/message-libs/uln-302/src/types.rs +24 -24
- package/contracts/message-libs/uln-302/src/uln302.rs +1 -1
- package/contracts/oapps/counter/integration_tests/utils.rs +1 -1
- package/contracts/oapps/oapp/src/oapp_core.rs +4 -3
- package/contracts/oapps/oapp/src/oapp_options_type3.rs +4 -3
- package/contracts/oapps/oft/integration-tests/utils.rs +1 -1
- package/contracts/oapps/oft/src/events.rs +5 -4
- package/contracts/oapps/oft/src/extensions/oft_fee.rs +10 -6
- package/contracts/oapps/oft/src/extensions/pausable.rs +4 -4
- package/contracts/oapps/oft/src/extensions/rate_limiter.rs +8 -6
- package/contracts/utils/src/ownable.rs +6 -4
- package/contracts/utils/src/tests/testing_utils.rs +7 -5
- package/contracts/utils/src/ttl.rs +5 -4
- package/contracts/workers/dvn/src/auth.rs +59 -45
- package/contracts/workers/dvn/src/dvn.rs +84 -16
- package/contracts/workers/dvn/src/errors.rs +10 -13
- package/contracts/workers/dvn/src/events.rs +7 -5
- package/contracts/workers/dvn/src/interfaces/dvn.rs +29 -1
- package/contracts/workers/dvn/src/multisig.rs +94 -71
- package/contracts/workers/dvn/src/storage.rs +9 -12
- package/contracts/workers/dvn/src/tests/auth.rs +56 -26
- package/contracts/workers/dvn/src/tests/dvn.rs +37 -37
- package/contracts/workers/dvn/src/tests/multisig/set_signer.rs +8 -8
- package/contracts/workers/dvn/src/tests/multisig/set_threshold.rs +9 -9
- package/contracts/workers/dvn/src/tests/multisig/verify_signatures.rs +6 -6
- package/contracts/workers/dvn/src/tests/setup.rs +5 -5
- package/contracts/workers/executor/src/auth.rs +93 -0
- package/contracts/workers/executor/src/events.rs +5 -4
- package/contracts/workers/executor/src/{lz_executor.rs → executor.rs} +25 -98
- package/contracts/workers/executor/src/interfaces/mod.rs +1 -1
- package/contracts/workers/executor/src/lib.rs +6 -5
- package/contracts/workers/worker/src/events.rs +23 -13
- package/contracts/workers/worker/src/worker.rs +32 -21
- package/package.json +3 -3
- package/sdk/dist/generated/bml.js +23 -23
- package/sdk/dist/generated/counter.js +25 -25
- package/sdk/dist/generated/endpoint.js +23 -23
- package/sdk/dist/generated/sml.js +23 -23
- package/sdk/dist/generated/uln302.d.ts +1 -1
- package/sdk/dist/generated/uln302.js +33 -33
- package/sdk/package.json +1 -1
- package/sdk/test/index.test.ts +1 -1
- package/sdk/test/oft.test.ts +847 -0
- package/sdk/test/suites/scan.ts +20 -4
- package/tools/ts-bindings-gen/src/main.rs +2 -1
- package/contracts/common-macros/src/event.rs +0 -16
- /package/contracts/message-libs/{block-message-lib → blocked-message-lib}/src/lib.rs +0 -0
package/Cargo.lock
CHANGED
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
//!
|
|
3
3
|
//! This crate provides foundational macros for Stellar contract development:
|
|
4
4
|
//! - **Storage macros** - Strongly-typed contract storage API generation
|
|
5
|
-
//! - **Event macros** - Contract event generation with proper derives
|
|
6
5
|
//! - **Error macros** - Contract error enum generation
|
|
7
6
|
//! - **Ownable macros** - Owner-based access control implementation
|
|
7
|
+
//! - **TTL macros** - Time-to-live configuration and automatic extension
|
|
8
8
|
//!
|
|
9
9
|
//! # Quick Links
|
|
10
10
|
//! - [`storage`] - Storage enum to API macro
|
|
11
|
-
//! - [`event`] - Event struct generation macro
|
|
12
11
|
//! - [`contract_error`] - Error enum generation macro
|
|
13
12
|
//! - [`ownable`] - Ownable trait implementation macro
|
|
14
13
|
//! - [`only_owner`] - Owner-only access control attribute macro
|
|
15
|
-
//!
|
|
14
|
+
//! - [`ttl_configurable`] - TTL configuration with freeze support
|
|
15
|
+
//! - [`contract_impl`] - Contract impl with automatic instance TTL extension
|
|
16
16
|
//!
|
|
17
17
|
use proc_macro::TokenStream;
|
|
18
18
|
|
|
19
19
|
mod contract_impl;
|
|
20
20
|
mod error;
|
|
21
|
-
mod event;
|
|
22
21
|
mod ownable;
|
|
23
22
|
mod storage;
|
|
24
23
|
mod ttl_configurable;
|
|
@@ -86,38 +85,6 @@ pub fn storage(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
|
86
85
|
storage::generate_storage(attr.into(), item.into()).into()
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
// ============================================================================
|
|
90
|
-
// Event Macro
|
|
91
|
-
// ============================================================================
|
|
92
|
-
|
|
93
|
-
/// Generates a contract event struct with necessary derives.
|
|
94
|
-
///
|
|
95
|
-
/// Combines `#[contractevent]` from soroban-sdk with standard derives
|
|
96
|
-
/// required for events (Clone, Debug, Eq, PartialEq).
|
|
97
|
-
///
|
|
98
|
-
/// Automatically uses the struct name as the topic.
|
|
99
|
-
///
|
|
100
|
-
/// # Example
|
|
101
|
-
/// ```ignore
|
|
102
|
-
/// #[event]
|
|
103
|
-
/// pub struct MyEvent {
|
|
104
|
-
/// pub data: u32,
|
|
105
|
-
/// }
|
|
106
|
-
/// ```
|
|
107
|
-
///
|
|
108
|
-
/// Generated code:
|
|
109
|
-
/// ```ignore
|
|
110
|
-
/// #[contractevent(topics = ["MyEvent"])]
|
|
111
|
-
/// #[derive(Clone, Debug, Eq, PartialEq)]
|
|
112
|
-
/// pub struct MyEvent {
|
|
113
|
-
/// pub data: u32,
|
|
114
|
-
/// }
|
|
115
|
-
/// ```
|
|
116
|
-
#[proc_macro_attribute]
|
|
117
|
-
pub fn event(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|
118
|
-
event::generate_event(attr.into(), item.into()).into()
|
|
119
|
-
}
|
|
120
|
-
|
|
121
88
|
// ============================================================================
|
|
122
89
|
// Error Macro
|
|
123
90
|
// ============================================================================
|
|
@@ -5,10 +5,10 @@ use crate::{
|
|
|
5
5
|
},
|
|
6
6
|
errors::EndpointError,
|
|
7
7
|
events::{
|
|
8
|
-
ComposeDelivered, ComposeSent, DefaultReceiveLibrarySet,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
ComposeDelivered, ComposeSent, DefaultReceiveLibTimeoutSet, DefaultReceiveLibrarySet, DefaultSendLibrarySet,
|
|
9
|
+
DelegateSet, InboundNonceSkipped, LibraryRegistered, LzComposeAlert, LzReceiveAlert, PacketBurnt,
|
|
10
|
+
PacketDelivered, PacketNilified, PacketSent, PacketVerified, ReceiveLibrarySet, ReceiveLibraryTimeoutSet,
|
|
11
|
+
SendLibrarySet, ZROSet,
|
|
12
12
|
},
|
|
13
13
|
interfaces::{ILayerZeroEndpointV2, IMessageLibManager, IMessagingChannel, MessagingFee, MessagingReceipt, Origin},
|
|
14
14
|
storage::EndpointStorage,
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
use crate::{Origin, Timeout};
|
|
2
|
-
use
|
|
3
|
-
use soroban_sdk::{Address, Bytes, BytesN};
|
|
2
|
+
use soroban_sdk::{contractevent, Address, Bytes, BytesN};
|
|
4
3
|
|
|
5
4
|
// ============================================================================
|
|
6
5
|
// EndpointV2 Events
|
|
7
6
|
// ============================================================================
|
|
8
7
|
|
|
9
|
-
#[
|
|
8
|
+
#[contractevent]
|
|
9
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
10
10
|
pub struct PacketSent {
|
|
11
11
|
pub encoded_packet: Bytes,
|
|
12
12
|
pub options: Bytes,
|
|
13
13
|
pub send_library: Address,
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
#[
|
|
16
|
+
#[contractevent]
|
|
17
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
17
18
|
pub struct PacketVerified {
|
|
18
19
|
#[topic]
|
|
19
20
|
pub origin: Origin,
|
|
@@ -22,7 +23,8 @@ pub struct PacketVerified {
|
|
|
22
23
|
pub payload_hash: BytesN<32>,
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
#[
|
|
26
|
+
#[contractevent]
|
|
27
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
26
28
|
pub struct PacketDelivered {
|
|
27
29
|
#[topic]
|
|
28
30
|
pub origin: Origin,
|
|
@@ -30,7 +32,8 @@ pub struct PacketDelivered {
|
|
|
30
32
|
pub receiver: Address,
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
#[
|
|
35
|
+
#[contractevent]
|
|
36
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
34
37
|
pub struct LzReceiveAlert {
|
|
35
38
|
#[topic]
|
|
36
39
|
pub receiver: Address,
|
|
@@ -47,12 +50,14 @@ pub struct LzReceiveAlert {
|
|
|
47
50
|
pub reason: Bytes,
|
|
48
51
|
}
|
|
49
52
|
|
|
50
|
-
#[
|
|
53
|
+
#[contractevent]
|
|
54
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
51
55
|
pub struct ZROSet {
|
|
52
56
|
pub zro: Address,
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
#[
|
|
59
|
+
#[contractevent]
|
|
60
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
56
61
|
pub struct DelegateSet {
|
|
57
62
|
#[topic]
|
|
58
63
|
pub oapp: Address,
|
|
@@ -63,7 +68,8 @@ pub struct DelegateSet {
|
|
|
63
68
|
// Messaging Channel Events
|
|
64
69
|
// ============================================================================
|
|
65
70
|
|
|
66
|
-
#[
|
|
71
|
+
#[contractevent]
|
|
72
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
67
73
|
pub struct InboundNonceSkipped {
|
|
68
74
|
#[topic]
|
|
69
75
|
pub src_eid: u32,
|
|
@@ -75,7 +81,8 @@ pub struct InboundNonceSkipped {
|
|
|
75
81
|
pub nonce: u64,
|
|
76
82
|
}
|
|
77
83
|
|
|
78
|
-
#[
|
|
84
|
+
#[contractevent]
|
|
85
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
79
86
|
pub struct PacketNilified {
|
|
80
87
|
#[topic]
|
|
81
88
|
pub src_eid: u32,
|
|
@@ -88,7 +95,8 @@ pub struct PacketNilified {
|
|
|
88
95
|
pub payload_hash: Option<BytesN<32>>,
|
|
89
96
|
}
|
|
90
97
|
|
|
91
|
-
#[
|
|
98
|
+
#[contractevent]
|
|
99
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
92
100
|
pub struct PacketBurnt {
|
|
93
101
|
#[topic]
|
|
94
102
|
pub src_eid: u32,
|
|
@@ -105,33 +113,38 @@ pub struct PacketBurnt {
|
|
|
105
113
|
// Message Lib Manager Events
|
|
106
114
|
// ============================================================================
|
|
107
115
|
|
|
108
|
-
#[
|
|
116
|
+
#[contractevent]
|
|
117
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
109
118
|
pub struct LibraryRegistered {
|
|
110
119
|
pub new_lib: Address,
|
|
111
120
|
}
|
|
112
121
|
|
|
113
|
-
#[
|
|
122
|
+
#[contractevent]
|
|
123
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
114
124
|
pub struct DefaultSendLibrarySet {
|
|
115
125
|
#[topic]
|
|
116
126
|
pub dst_eid: u32,
|
|
117
127
|
pub new_lib: Address,
|
|
118
128
|
}
|
|
119
129
|
|
|
120
|
-
#[
|
|
130
|
+
#[contractevent]
|
|
131
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
121
132
|
pub struct DefaultReceiveLibrarySet {
|
|
122
133
|
#[topic]
|
|
123
134
|
pub src_eid: u32,
|
|
124
135
|
pub new_lib: Address,
|
|
125
136
|
}
|
|
126
137
|
|
|
127
|
-
#[
|
|
128
|
-
|
|
138
|
+
#[contractevent]
|
|
139
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
140
|
+
pub struct DefaultReceiveLibTimeoutSet {
|
|
129
141
|
#[topic]
|
|
130
142
|
pub src_eid: u32,
|
|
131
143
|
pub timeout: Option<Timeout>,
|
|
132
144
|
}
|
|
133
145
|
|
|
134
|
-
#[
|
|
146
|
+
#[contractevent]
|
|
147
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
135
148
|
pub struct SendLibrarySet {
|
|
136
149
|
#[topic]
|
|
137
150
|
pub sender: Address,
|
|
@@ -140,7 +153,8 @@ pub struct SendLibrarySet {
|
|
|
140
153
|
pub new_lib: Option<Address>,
|
|
141
154
|
}
|
|
142
155
|
|
|
143
|
-
#[
|
|
156
|
+
#[contractevent]
|
|
157
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
144
158
|
pub struct ReceiveLibrarySet {
|
|
145
159
|
#[topic]
|
|
146
160
|
pub receiver: Address,
|
|
@@ -149,7 +163,8 @@ pub struct ReceiveLibrarySet {
|
|
|
149
163
|
pub new_lib: Option<Address>,
|
|
150
164
|
}
|
|
151
165
|
|
|
152
|
-
#[
|
|
166
|
+
#[contractevent]
|
|
167
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
153
168
|
pub struct ReceiveLibraryTimeoutSet {
|
|
154
169
|
#[topic]
|
|
155
170
|
pub receiver: Address,
|
|
@@ -162,7 +177,8 @@ pub struct ReceiveLibraryTimeoutSet {
|
|
|
162
177
|
// Message Composer Events
|
|
163
178
|
// ============================================================================
|
|
164
179
|
|
|
165
|
-
#[
|
|
180
|
+
#[contractevent]
|
|
181
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
166
182
|
pub struct ComposeSent {
|
|
167
183
|
#[topic]
|
|
168
184
|
pub from: Address,
|
|
@@ -175,7 +191,8 @@ pub struct ComposeSent {
|
|
|
175
191
|
pub message: Bytes,
|
|
176
192
|
}
|
|
177
193
|
|
|
178
|
-
#[
|
|
194
|
+
#[contractevent]
|
|
195
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
179
196
|
pub struct ComposeDelivered {
|
|
180
197
|
#[topic]
|
|
181
198
|
pub from: Address,
|
|
@@ -187,7 +204,8 @@ pub struct ComposeDelivered {
|
|
|
187
204
|
pub index: u32,
|
|
188
205
|
}
|
|
189
206
|
|
|
190
|
-
#[
|
|
207
|
+
#[contractevent]
|
|
208
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
191
209
|
pub struct LzComposeAlert {
|
|
192
210
|
#[topic]
|
|
193
211
|
pub from: Address,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
use crate::SetConfigParam;
|
|
2
|
-
use soroban_sdk::{
|
|
2
|
+
use soroban_sdk::{contractclient, contracttype, Address, Bytes, Env, Vec};
|
|
3
3
|
|
|
4
4
|
/// Type of message library indicating supported operations.
|
|
5
5
|
#[contracttype]
|
|
@@ -30,7 +30,7 @@ pub struct MessageLibVersion {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/// Interface for message libraries that handle cross-chain message verification and delivery.
|
|
33
|
-
#[
|
|
33
|
+
#[contractclient(name = "MessageLibClient")]
|
|
34
34
|
pub trait IMessageLib {
|
|
35
35
|
/// Sets the configuration for an OApp by the Endpoint.
|
|
36
36
|
///
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use soroban_sdk::{
|
|
1
|
+
use soroban_sdk::{contractclient, contracttype, Address, Bytes, Env, Vec};
|
|
2
2
|
|
|
3
3
|
/// Timeout configuration for receive library transitions.
|
|
4
4
|
#[contracttype]
|
|
@@ -45,7 +45,7 @@ pub struct ResolvedLibrary {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/// EndpointV2's Interface for managing message libraries.
|
|
48
|
-
#[
|
|
48
|
+
#[contractclient(name = "MessageLibManagerClient")]
|
|
49
49
|
pub trait IMessageLibManager {
|
|
50
50
|
/// Registers a new message library with the endpoint.
|
|
51
51
|
///
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
use soroban_sdk::{
|
|
1
|
+
use soroban_sdk::{contractclient, Address, BytesN, Env};
|
|
2
2
|
|
|
3
3
|
/// EndpointV2's Interface for managing messaging channels, nonces, and payload hashes.
|
|
4
|
-
#[
|
|
4
|
+
#[contractclient(name = "MessagingChannelClient")]
|
|
5
5
|
pub trait IMessagingChannel {
|
|
6
6
|
/// Skips the next expected inbound nonce without verifying.
|
|
7
7
|
///
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
use soroban_sdk::{
|
|
1
|
+
use soroban_sdk::{contractclient, Address, Bytes, BytesN, Env};
|
|
2
2
|
|
|
3
3
|
/// EndpointV2's Interface for managing composed messages between OApps and composers.
|
|
4
|
-
#[
|
|
4
|
+
#[contractclient(name = "MessagingComposerClient")]
|
|
5
5
|
pub trait IMessagingComposer {
|
|
6
6
|
/// Sends a composed message from an OApp to a composer.
|
|
7
7
|
/// The OApp can send compose to multiple composers with the same GUID.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
use super::{IMessageLib, MessagingFee};
|
|
2
|
-
use soroban_sdk::{
|
|
2
|
+
use soroban_sdk::{contractclient, contracttype, Address, Bytes, BytesN, Env, Vec};
|
|
3
3
|
|
|
4
4
|
/// Outbound packet containing all information for cross-chain transmission.
|
|
5
5
|
#[contracttype]
|
|
@@ -44,7 +44,7 @@ pub struct FeesAndPacket {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/// Interface for send libraries that handle outbound message encoding and fee calculation.
|
|
47
|
-
#[
|
|
47
|
+
#[contractclient(name = "SendLibClient")]
|
|
48
48
|
pub trait ISendLib: IMessageLib {
|
|
49
49
|
/// Quotes the fee for sending a packet without actually sending.
|
|
50
50
|
///
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
use super::*;
|
|
2
2
|
|
|
3
|
-
#[contract_impl
|
|
3
|
+
#[contract_impl]
|
|
4
4
|
impl IMessageLibManager for EndpointV2 {
|
|
5
5
|
/// Registers a new message library with the endpoint.
|
|
6
6
|
#[only_owner]
|
|
@@ -56,7 +56,7 @@ impl IMessageLibManager for EndpointV2 {
|
|
|
56
56
|
None
|
|
57
57
|
};
|
|
58
58
|
EndpointStorage::set_or_remove_default_receive_library_timeout(env, src_eid, &timeout);
|
|
59
|
-
|
|
59
|
+
DefaultReceiveLibTimeoutSet { src_eid, timeout: timeout.clone() }.publish(env);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/// Sets or removes the default receive library timeout for a source endpoint.
|
|
@@ -70,7 +70,7 @@ impl IMessageLibManager for EndpointV2 {
|
|
|
70
70
|
assert_with_error!(env, !t.is_expired(env), EndpointError::InvalidExpiry);
|
|
71
71
|
}
|
|
72
72
|
EndpointStorage::set_or_remove_default_receive_library_timeout(env, src_eid, timeout);
|
|
73
|
-
|
|
73
|
+
DefaultReceiveLibTimeoutSet { src_eid, timeout: timeout.clone() }.publish(env);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
// ============================================================================================
|
package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_lib_timeout.rs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
use soroban_sdk::{testutils::Address as _, testutils::Ledger, vec, Address};
|
|
2
2
|
|
|
3
3
|
use crate::{
|
|
4
|
-
errors::EndpointError, events::
|
|
5
|
-
|
|
4
|
+
errors::EndpointError, events::DefaultReceiveLibTimeoutSet, storage, tests::endpoint_setup::setup, MessageLibType,
|
|
5
|
+
Timeout,
|
|
6
6
|
};
|
|
7
7
|
use utils::testing_utils::assert_event;
|
|
8
8
|
|
|
@@ -203,7 +203,7 @@ fn test_set_default_receive_lib_timeout_success() {
|
|
|
203
203
|
assert_event(
|
|
204
204
|
env,
|
|
205
205
|
&endpoint_client.address,
|
|
206
|
-
|
|
206
|
+
DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: timeout.clone() },
|
|
207
207
|
);
|
|
208
208
|
|
|
209
209
|
// Verify it was set correctly via public interface
|
|
@@ -229,11 +229,7 @@ fn test_set_default_receive_lib_timeout_success_with_none() {
|
|
|
229
229
|
endpoint_client.set_default_receive_lib_timeout(&context.eid, &None);
|
|
230
230
|
|
|
231
231
|
// Verify the event was published
|
|
232
|
-
assert_event(
|
|
233
|
-
env,
|
|
234
|
-
&endpoint_client.address,
|
|
235
|
-
DefaultReceiveLibraryTimeoutSet { src_eid: context.eid, timeout: None },
|
|
236
|
-
);
|
|
232
|
+
assert_event(env, &endpoint_client.address, DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: None });
|
|
237
233
|
|
|
238
234
|
// Verify it was cleared via public interface
|
|
239
235
|
assert_eq!(endpoint_client.default_receive_library_timeout(&context.eid), None);
|
|
@@ -5,7 +5,7 @@ use soroban_sdk::{
|
|
|
5
5
|
|
|
6
6
|
use crate::{
|
|
7
7
|
errors::EndpointError,
|
|
8
|
-
events::{
|
|
8
|
+
events::{DefaultReceiveLibTimeoutSet, DefaultReceiveLibrarySet},
|
|
9
9
|
storage,
|
|
10
10
|
tests::endpoint_setup::setup,
|
|
11
11
|
MessageLibType, Timeout,
|
|
@@ -131,11 +131,7 @@ fn test_set_default_receive_library_success() {
|
|
|
131
131
|
&endpoint_client.address,
|
|
132
132
|
DefaultReceiveLibrarySet { src_eid: context.eid, new_lib: receive_lib.clone() },
|
|
133
133
|
);
|
|
134
|
-
assert_event(
|
|
135
|
-
env,
|
|
136
|
-
&endpoint_client.address,
|
|
137
|
-
DefaultReceiveLibraryTimeoutSet { src_eid: context.eid, timeout: None },
|
|
138
|
-
);
|
|
134
|
+
assert_event(env, &endpoint_client.address, DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: None });
|
|
139
135
|
|
|
140
136
|
// Verify it was set correctly via public interface
|
|
141
137
|
assert_eq!(endpoint_client.default_receive_library(&context.eid), Some(receive_lib.clone()));
|
|
@@ -193,7 +189,7 @@ fn test_set_default_receive_library_success_with_grace_period() {
|
|
|
193
189
|
assert_event(
|
|
194
190
|
env,
|
|
195
191
|
&endpoint_client.address,
|
|
196
|
-
|
|
192
|
+
DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: expected_timeout.clone() },
|
|
197
193
|
);
|
|
198
194
|
|
|
199
195
|
// Verify it was set correctly via public interface
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
use
|
|
2
|
-
use soroban_sdk::Address;
|
|
1
|
+
use soroban_sdk::{contractevent, Address};
|
|
3
2
|
|
|
4
3
|
/// Emitted when the native fee basis points is updated.
|
|
5
|
-
#[
|
|
4
|
+
#[contractevent]
|
|
5
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
6
6
|
pub struct NativeFeeBpSet {
|
|
7
7
|
pub native_fee_bp: u32,
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/// Emitted when fee collection is enabled or disabled.
|
|
11
|
-
#[
|
|
11
|
+
#[contractevent]
|
|
12
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
12
13
|
pub struct FeeEnabledSet {
|
|
13
14
|
pub fee_enabled: bool,
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
/// Emitted when the ZRO fee library is set or removed.
|
|
17
|
-
#[
|
|
18
|
+
#[contractevent]
|
|
19
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
18
20
|
pub struct ZROFeeLibSet {
|
|
19
21
|
pub zro_fee_lib: Option<Address>,
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
/// Emitted when a token (including native XLM) is withdrawn from the contract.
|
|
23
|
-
#[
|
|
25
|
+
#[contractevent]
|
|
26
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
24
27
|
pub struct TokenWithdrawn {
|
|
25
28
|
pub token: Address,
|
|
26
29
|
pub to: Address,
|
|
@@ -2,11 +2,11 @@ use crate::{
|
|
|
2
2
|
interfaces::{OAppExecutorConfig, OAppUlnConfig, SetDefaultUlnConfigParam},
|
|
3
3
|
SetDefaultExecutorConfigParam,
|
|
4
4
|
};
|
|
5
|
-
use common_macros::event;
|
|
6
5
|
use endpoint_v2::FeeRecipient;
|
|
7
|
-
use soroban_sdk::{Address, Bytes, BytesN, Vec};
|
|
6
|
+
use soroban_sdk::{contractevent, Address, Bytes, BytesN, Vec};
|
|
8
7
|
|
|
9
|
-
#[
|
|
8
|
+
#[contractevent]
|
|
9
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
10
10
|
pub struct ExecutorConfigSet {
|
|
11
11
|
#[topic]
|
|
12
12
|
pub sender: Address,
|
|
@@ -15,7 +15,8 @@ pub struct ExecutorConfigSet {
|
|
|
15
15
|
pub config: OAppExecutorConfig,
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
#[
|
|
18
|
+
#[contractevent]
|
|
19
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
19
20
|
pub struct UlnSendConfigSet {
|
|
20
21
|
#[topic]
|
|
21
22
|
pub sender: Address,
|
|
@@ -24,7 +25,8 @@ pub struct UlnSendConfigSet {
|
|
|
24
25
|
pub config: OAppUlnConfig,
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
#[
|
|
28
|
+
#[contractevent]
|
|
29
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
28
30
|
pub struct UlnReceiveConfigSet {
|
|
29
31
|
#[topic]
|
|
30
32
|
pub receiver: Address,
|
|
@@ -33,36 +35,42 @@ pub struct UlnReceiveConfigSet {
|
|
|
33
35
|
pub config: OAppUlnConfig,
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
#[
|
|
38
|
+
#[contractevent]
|
|
39
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
37
40
|
pub struct DefaultExecutorConfigSet {
|
|
38
41
|
pub params: Vec<SetDefaultExecutorConfigParam>,
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
#[
|
|
44
|
+
#[contractevent]
|
|
45
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
42
46
|
pub struct DefaultUlnSendConfigSet {
|
|
43
47
|
pub params: Vec<SetDefaultUlnConfigParam>,
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
#[
|
|
50
|
+
#[contractevent]
|
|
51
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
47
52
|
pub struct DefaultUlnReceiveConfigSet {
|
|
48
53
|
pub params: Vec<SetDefaultUlnConfigParam>,
|
|
49
54
|
}
|
|
50
55
|
|
|
51
|
-
#[
|
|
56
|
+
#[contractevent]
|
|
57
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
52
58
|
pub struct ExecutorFeePaid {
|
|
53
59
|
#[topic]
|
|
54
60
|
pub executor: Address,
|
|
55
61
|
pub fee: FeeRecipient,
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
#[
|
|
64
|
+
#[contractevent]
|
|
65
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
59
66
|
pub struct DVNFeePaid {
|
|
60
67
|
#[topic]
|
|
61
68
|
pub dvns: Vec<Address>,
|
|
62
69
|
pub fees: Vec<FeeRecipient>,
|
|
63
70
|
}
|
|
64
71
|
|
|
65
|
-
#[
|
|
72
|
+
#[contractevent]
|
|
73
|
+
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
66
74
|
pub struct PayloadVerified {
|
|
67
75
|
#[topic]
|
|
68
76
|
pub dvn: Address,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
use crate::types::{OAppUlnConfig, SetDefaultUlnConfigParam, UlnConfig};
|
|
2
|
-
use soroban_sdk::{
|
|
2
|
+
use soroban_sdk::{contractclient, Address, Bytes, BytesN, Env, Vec};
|
|
3
3
|
|
|
4
4
|
/// Interface for ULN302 receive library functions.
|
|
5
5
|
///
|
|
6
6
|
/// Handles DVN verification and message commitment on the receiving chain.
|
|
7
|
-
#[
|
|
7
|
+
#[contractclient(name = "ReceiveUln302Client")]
|
|
8
8
|
pub trait IReceiveUln302 {
|
|
9
9
|
/// Called by a DVN to verify a message with a specific number of confirmations.
|
|
10
10
|
///
|
|
@@ -3,7 +3,7 @@ pub use crate::types::{
|
|
|
3
3
|
UlnConfig,
|
|
4
4
|
};
|
|
5
5
|
use endpoint_v2::ISendLib;
|
|
6
|
-
use soroban_sdk::{
|
|
6
|
+
use soroban_sdk::{contractclient, Address, Env, Vec};
|
|
7
7
|
|
|
8
8
|
// ============================================================================================
|
|
9
9
|
// ISendUln302 Trait
|
|
@@ -12,7 +12,7 @@ use soroban_sdk::{contracttrait, Address, Env, Vec};
|
|
|
12
12
|
/// Interface for ULN302 send library functions.
|
|
13
13
|
///
|
|
14
14
|
/// Extends `ISendLib` with ULN-specific configuration management for executors and DVNs.
|
|
15
|
-
#[
|
|
15
|
+
#[contractclient(name = "SendUln302Client")]
|
|
16
16
|
pub trait ISendUln302: ISendLib {
|
|
17
17
|
/// Returns the treasury address for fee collection.
|
|
18
18
|
fn treasury(env: &Env) -> Address;
|
|
@@ -4,7 +4,7 @@ use super::*;
|
|
|
4
4
|
// IReceiveUln302 Contract Implementation
|
|
5
5
|
// ============================================================================================
|
|
6
6
|
|
|
7
|
-
#[contract_impl
|
|
7
|
+
#[contract_impl]
|
|
8
8
|
impl IReceiveUln302 for Uln302 {
|
|
9
9
|
/// Called by a DVN to verify a message with a specific number of block confirmations.
|
|
10
10
|
///
|
|
@@ -62,7 +62,7 @@ impl IReceiveUln302 for Uln302 {
|
|
|
62
62
|
fn set_default_receive_uln_configs(env: &Env, params: &Vec<SetDefaultUlnConfigParam>) {
|
|
63
63
|
for param in params {
|
|
64
64
|
param.config.validate_default_config(env);
|
|
65
|
-
UlnStorage::set_default_receive_uln_configs(env, param.
|
|
65
|
+
UlnStorage::set_default_receive_uln_configs(env, param.eid, ¶m.config);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
DefaultUlnReceiveConfigSet { params: params.clone() }.publish(env);
|
|
@@ -4,7 +4,7 @@ use super::*;
|
|
|
4
4
|
// ISendLib Contract Implementation
|
|
5
5
|
// ==============================================================================
|
|
6
6
|
|
|
7
|
-
#[contract_impl
|
|
7
|
+
#[contract_impl]
|
|
8
8
|
impl ISendLib for Uln302 {
|
|
9
9
|
/// Quotes the total fee for sending a cross-chain message.
|
|
10
10
|
///
|
|
@@ -81,7 +81,7 @@ impl ISendLib for Uln302 {
|
|
|
81
81
|
// ISendUln302 Contract Implementation
|
|
82
82
|
// ==============================================================================
|
|
83
83
|
|
|
84
|
-
#[contract_impl
|
|
84
|
+
#[contract_impl]
|
|
85
85
|
impl ISendUln302 for Uln302 {
|
|
86
86
|
/// Sets default executor configurations for multiple destination endpoints.
|
|
87
87
|
#[only_owner]
|
|
@@ -98,7 +98,7 @@ impl ISendUln302 for Uln302 {
|
|
|
98
98
|
fn set_default_send_uln_configs(env: &Env, params: &Vec<SetDefaultUlnConfigParam>) {
|
|
99
99
|
for param in params {
|
|
100
100
|
param.config.validate_default_config(env);
|
|
101
|
-
UlnStorage::set_default_send_uln_configs(env, param.
|
|
101
|
+
UlnStorage::set_default_send_uln_configs(env, param.eid, ¶m.config);
|
|
102
102
|
}
|
|
103
103
|
DefaultUlnSendConfigSet { params: params.clone() }.publish(env);
|
|
104
104
|
}
|