-
Notifications
You must be signed in to change notification settings - Fork 2
Add manual execution to offramp #249
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
2520535
350ce85
9593081
1ed32b7
9920fa6
37c0d0e
4d088a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import "../../lib/utils" | ||
|
||
enum Error { | ||
StateIsNotUntouched = 47900; // Facility ID * 100 | ||
AlreadyAttempted = 47900; // Facility ID * 100 | ||
UpdatingStateOfNonExecutedMessage; | ||
NotificationFromInvalidReceiver; | ||
NotOwner; | ||
ManualExecutionNotYetEnabled; | ||
SkippedAlreadyExecutedMessage; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,3 @@ enum Error { | |
InvalidOnRampUpdate | ||
} | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import "../common/types.tolk" | |
type OffRamp_InMessage = | ||
| OffRamp_Commit | ||
| OffRamp_Execute | ||
| OffRamp_ManuallyExecute | ||
| OffRamp_DispatchValidated | ||
| OffRamp_UpdateSourceChainConfig | ||
| OCR3Base_SetOCR3Config | ||
|
@@ -33,6 +34,13 @@ struct (0x27bdac33) OffRamp_Execute { | |
report: ExecutionReport; | ||
} | ||
|
||
//crc32('OffRamp_ManuallyExecute') | ||
struct (0xa00785cf) OffRamp_ManuallyExecute { | ||
queryId: uint64; | ||
report: ExecutionReport; | ||
gasOverride: coins; // TODO: should this just be part of the added gas value passed into the call? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can just pass through all TON value specified on the call here and avoid this override There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, but then we have to change the logic where we check |
||
} | ||
|
||
//crc32('OffRamp_UpdateSourceChainConfig') | ||
struct (0xb98c95e3) OffRamp_UpdateSourceChainConfig { | ||
queryId: uint64; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,11 @@ struct CCIPMessageReceived { | |
message: Any2TVMMessage | ||
} | ||
|
||
type Msg = Receiver_CCIPReceive; | ||
struct (0x00000001) SetRejectAll { | ||
rejectAll: bool; | ||
} | ||
|
||
type Msg = Receiver_CCIPReceive | SetRejectAll; | ||
|
||
fun onInternalMessage(in: InMessage) { | ||
val msg = lazy Msg.fromSlice(in.body); | ||
|
@@ -27,8 +31,9 @@ fun onInternalMessage(in: InMessage) { | |
// Standard for every receiver to implement: | ||
// - Check CCIPReceive only comes from offRamp/ router | ||
// - Send CCIPReceiveConfirm to msg.callback | ||
assert(in.senderAddress == Storage.load().offRamp, Error.Unauthorized); | ||
|
||
val st = Storage.load(); | ||
assert(in.senderAddress == st.offRamp, Error.Unauthorized); | ||
assert(!st.rejectAll, Error.Rejected); | ||
val receiveConfirm = createMessage({ | ||
bounce: true, | ||
value: ton("0.05"), //TODO how much do we need to send | ||
|
@@ -43,6 +48,11 @@ fun onInternalMessage(in: InMessage) { | |
message: msg.message, | ||
}); | ||
} | ||
SetRejectAll => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nicolasgnr like Solana the new receiver supports toggling a receiver to deliberately fail. I didn't add any access control checks since this shouldn't be used outside of testnet? |
||
var st = Storage.load(); | ||
st.rejectAll = msg.rejectAll; | ||
st.store(); | ||
} | ||
else => { | ||
// ignore empty messages, "wrong opcode" for others | ||
assert (in.body.isEmpty()) throw 0xFFFF | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ import "../../../lib/utils" | |
|
||
enum Error { | ||
Unauthorized = 34600; // Facility ID * 100 | ||
Rejected; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.