Skip to content

Commit

Permalink
Support v1 auth payload.
Browse files Browse the repository at this point in the history
After thinking for a bit, it doesn't seem like this could cause any security or logic issues, so we can improve backwards compatibility without much added maintenance cost.
  • Loading branch information
dmkozh committed Aug 23, 2024
1 parent fbd1a14 commit c1599c9
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 175 deletions.
9 changes: 6 additions & 3 deletions soroban-env-host/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,12 @@ impl AuthorizedFunction {
args: host.scvals_to_val_vec(xdr_contract_fn.args.as_slice())?,
})
}
SorobanAuthorizedFunction::CreateContractHostFn(_) => {
return Err(host.err(ScErrorType::Auth, ScErrorCode::InvalidInput,
"SorobanAuthorizedFunction::CreateContractHostFn is no longer supported in authorization payloads. Please use SorobanAuthorizedFunction::CreateContractHostFnV2 instead.", &[]));
SorobanAuthorizedFunction::CreateContractHostFn(xdr_args) => {
AuthorizedFunction::CreateContractHostFn(CreateContractArgsV2 {
contract_id_preimage: xdr_args.contract_id_preimage,
executable: xdr_args.executable,
constructor_args: Default::default(),
})
}
SorobanAuthorizedFunction::CreateContractV2HostFn(xdr_args) => {
AuthorizedFunction::CreateContractHostFn(xdr_args)
Expand Down
Loading

0 comments on commit c1599c9

Please sign in to comment.