fix(lee,lez): derive PDAs from AccountId instead of ProgramId

CallerData and the PDA derivation primitives keyed authorization off a
program's image id (ProgramId), so two deployments of identical bytecode
with different update_auth collided on the same PDA. Switch derivation,
wire fields, and comparisons to the program's real dispatch AccountId
throughout the host, guest, and test-harness code, including the
privacy-circuit test harness's default dispatch address and the
wrapped_token/ping_receiver governance-authorization check, which
compared against the wrong address via the legacy bijection.
This commit is contained in:
Marvin Jones
2026-08-23 00:27:07 -04:00
parent 31b5b51a6c
commit 013e439c60
118 changed files with 1346 additions and 1357 deletions
@@ -47,7 +47,7 @@ async fn main() {
let hello_world_bytecode: Vec<u8> = std::fs::read(hello_world_path).unwrap();
let hello_world = Program::new(hello_world_bytecode.into()).unwrap();
let dependencies: HashMap<AccountId, Program> =
std::iter::once((hello_world.id().into(), hello_world)).collect();
std::iter::once((hello_world.deployed_account_id(), hello_world)).collect();
let program_with_dependencies = ProgramWithDependencies::new(simple_tail_call, dependencies);
let accounts = vec![AccountIdentity::PrivateOwned(account_id)];
@@ -46,13 +46,14 @@ async fn main() {
let program = Program::new(bytecode.into()).unwrap();
// Compute the PDA to pass it as input account to the public execution
let pda = AccountId::for_public_pda(&program.id(), &PDA_SEED);
let program_account_id = program.deployed_account_id();
let pda = AccountId::for_public_pda(&program_account_id, &PDA_SEED);
let account_ids = vec![pda];
let instruction_data = ();
let nonces = vec![];
let signing_keys = [];
let message =
Message::try_new(program.id().into(), account_ids, nonces, instruction_data).unwrap();
Message::try_new(program_account_id, account_ids, nonces, instruction_data).unwrap();
let witness_set = WitnessSet::for_message(&message, &signing_keys);
let tx = PublicTransaction::new(message, witness_set);