Skip to content

Commit c82eba5

Browse files
committed
Change numbers to constants - test receiver
1 parent 4ae0694 commit c82eba5

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

bindings/ccip_dummy_receiver/dummy_receiver/dummy_receiver.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/ccip/ccip_dummy_receiver/sources/dummy_receiver.move

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ module ccip_dummy_receiver::dummy_receiver {
99
use ccip::client;
1010
use ccip::receiver_registry;
1111

12+
const E_TEST_ABORT: u64 = 1;
13+
1214
#[event]
1315
struct ReceivedMessage has store, drop {
1416
data: vector<u8>
@@ -46,7 +48,9 @@ module ccip_dummy_receiver::dummy_receiver {
4648
@ccip_dummy_receiver, DummyReceiverProof {}
4749
);
4850
let data = client::get_data(&message);
49-
if (data == b"abort") { abort 1 };
51+
if (data == b"abort") {
52+
abort E_TEST_ABORT
53+
};
5054

5155
let state = borrow_state_mut();
5256

contracts/ccip/ccip_offramp/tests/mock/mock_ccip_receiver.move

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ module ccip_offramp::mock_ccip_receiver {
4141
const E_UNAUTHORIZED: u64 = 2;
4242
const E_INVALID_TOKEN_ADDRESS: u64 = 3;
4343
const E_NO_TOKENS_AVAILABLE_TO_WITHDRAW: u64 = 4;
44+
/// Test-only abort triggered when message data equals "abort".
45+
const E_TEST_ABORT: u64 = 5;
4446

4547
#[view]
4648
public fun type_and_version(): String {
@@ -165,7 +167,9 @@ module ccip_offramp::mock_ccip_receiver {
165167
};
166168

167169
// Simple abort condition for testing
168-
if (data == b"abort") { abort 1 };
170+
if (data == b"abort") {
171+
abort E_TEST_ABORT
172+
};
169173
}
170174

171175
#[deprecated]
@@ -239,7 +243,9 @@ module ccip_offramp::mock_ccip_receiver {
239243
};
240244

241245
// Simple abort condition for testing
242-
if (data == b"abort") { abort 1 };
246+
if (data == b"abort") {
247+
abort E_TEST_ABORT
248+
};
243249

244250
option::none()
245251
}

0 commit comments

Comments
 (0)