mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-08-26 20:01:16 +00:00
refactor(lee): migrate ChainedCall/Message program reference from ProgramId to AccountId
Chained-call and public-transaction dispatch now address the target program directly by AccountId instead of routing through ProgramId and converting internally, closing the gap that blocked PDA-addressed program invocation. The field is named program_account_id (not account_id) to stay unambiguous next to the account_ids list it sits beside in the same structs. Execution/PDA-derivation logic that fundamentally needs the RISC0 image id (self_program_id, caller_program_id, env::verify, PDA seed derivation) stays ProgramId-typed, recovering it from the dispatched AccountId via the existing bijection where needed.
This commit is contained in:
@@ -48,7 +48,7 @@ fn main() {
|
||||
let chained_call_greeting: Vec<u8> = b"Hello from tail call".to_vec();
|
||||
let chained_call_instruction_data = risc0_zkvm::serde::to_vec(&chained_call_greeting).unwrap();
|
||||
let chained_call = ChainedCall {
|
||||
program_id: hello_world_program_id(),
|
||||
program_account_id: hello_world_program_id().into(),
|
||||
instruction_data: chained_call_instruction_data,
|
||||
pre_states,
|
||||
pda_seeds: vec![],
|
||||
|
||||
@@ -60,7 +60,7 @@ fn main() {
|
||||
this
|
||||
};
|
||||
let chained_call = ChainedCall {
|
||||
program_id: hello_world_program_id(),
|
||||
program_account_id: hello_world_program_id().into(),
|
||||
instruction_data: chained_call_instruction_data,
|
||||
pre_states: vec![pre_state_for_chained_call],
|
||||
pda_seeds: vec![PDA_SEED],
|
||||
|
||||
@@ -53,7 +53,8 @@ async fn main() {
|
||||
// `run_hello_world_with_authorization` on how to use them.
|
||||
let nonces = vec![];
|
||||
let signing_keys = [];
|
||||
let message = Message::try_new(program.id(), vec![account_id], nonces, greeting).unwrap();
|
||||
let message =
|
||||
Message::try_new(program.id().into(), vec![account_id], nonces, greeting).unwrap();
|
||||
let witness_set = WitnessSet::for_message(&message, &signing_keys);
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
|
||||
|
||||
@@ -48,8 +48,13 @@ async fn main() {
|
||||
let instruction_data = ();
|
||||
let nonces = vec![];
|
||||
let signing_keys = [];
|
||||
let message =
|
||||
Message::try_new(program.id(), vec![account_id], nonces, instruction_data).unwrap();
|
||||
let message = Message::try_new(
|
||||
program.id().into(),
|
||||
vec![account_id],
|
||||
nonces,
|
||||
instruction_data,
|
||||
)
|
||||
.unwrap();
|
||||
let witness_set = WitnessSet::for_message(&message, &signing_keys);
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
|
||||
|
||||
@@ -65,7 +65,8 @@ async fn main() {
|
||||
.await
|
||||
.expect("Node should be reachable to query account data");
|
||||
let signing_keys = [&signing_key];
|
||||
let message = Message::try_new(program.id(), vec![account_id], nonces, greeting).unwrap();
|
||||
let message =
|
||||
Message::try_new(program.id().into(), vec![account_id], nonces, greeting).unwrap();
|
||||
// Pass the signing key to sign the message. This will be used by the node
|
||||
// to flag the pre_state as `is_authorized` when executing the program
|
||||
let witness_set = WitnessSet::for_message(&message, &signing_keys);
|
||||
|
||||
+2
-1
@@ -51,7 +51,8 @@ async fn main() {
|
||||
let instruction_data = ();
|
||||
let nonces = vec![];
|
||||
let signing_keys = [];
|
||||
let message = Message::try_new(program.id(), account_ids, nonces, instruction_data).unwrap();
|
||||
let message =
|
||||
Message::try_new(program.id().into(), account_ids, nonces, instruction_data).unwrap();
|
||||
let witness_set = WitnessSet::for_message(&message, &signing_keys);
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ async fn main() {
|
||||
let account_id = account_id.parse().unwrap();
|
||||
let nonces = vec![];
|
||||
let message = public_transaction::Message::try_new(
|
||||
program.id(),
|
||||
program.id().into(),
|
||||
vec![account_id],
|
||||
nonces,
|
||||
instruction,
|
||||
@@ -116,7 +116,7 @@ async fn main() {
|
||||
let to = to.parse().unwrap();
|
||||
let nonces = vec![];
|
||||
let message = public_transaction::Message::try_new(
|
||||
program.id(),
|
||||
program.id().into(),
|
||||
vec![from, to],
|
||||
nonces,
|
||||
instruction,
|
||||
|
||||
Reference in New Issue
Block a user