Skip to content

[DRAFT] feat: v0.2.0 diamond proxy#347

Open
tbraun96-nomyx wants to merge 1 commit into
OpenZeppelin:mainfrom
nomyx-io:main
Open

[DRAFT] feat: v0.2.0 diamond proxy#347
tbraun96-nomyx wants to merge 1 commit into
OpenZeppelin:mainfrom
nomyx-io:main

Conversation

@tbraun96-nomyx

Copy link
Copy Markdown

Submission of the Diamond Proxy infrastructure.
Status: DRAFT

After internal review, we will mark this as ready for code review. In the interim, this PR can be used to guide discussions around the concept and its security. The PR is open to concept review at this time.

@netlify

netlify Bot commented Aug 5, 2025

Copy link
Copy Markdown

Deploy Preview for delightful-dieffenbachia-2097e0 canceled.

Name Link
🔨 Latest commit be8e86f
🔍 Latest deploy log https://app.netlify.com/projects/delightful-dieffenbachia-2097e0/deploys/689206df24abbe000883f6d1

@netlify

netlify Bot commented Aug 5, 2025

Copy link
Copy Markdown

Deploy Preview for delightful-dieffenbachia-2097e0 canceled.

Name Link
🔨 Latest commit f9a0bf9
🔍 Latest deploy log https://app.netlify.com/projects/delightful-dieffenbachia-2097e0/deploys/68920db5ee0fdc00084eabe0

@ozgunozerk

Copy link
Copy Markdown
Collaborator

Wow thanks a lot! Tagging the relevant discussion here: https://github.com/orgs/stellar/discussions/1700

We definitely need some time to inspect all these :)

@janewang

Copy link
Copy Markdown
Collaborator

Hi @leighmcculloch Please take a look when you have a chance, thank you

@mootz12 mootz12 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a few things with the authorizations.

Added more architectural feedback to the discussion: https://github.com/orgs/stellar/discussions/1700#discussioncomment-17265420

Comment on lines +222 to +237
// Create a unique authorization marker for this call
// The facet will require auth on the diamond proxy address with the facet address as argument
// This ensures only calls through the diamond proxy's fallback can succeed
let auth_args = soroban_sdk::vec![&env, target.clone().into_val(&env)];

env.authorize_as_current_contract(soroban_sdk::vec![
&env,
InvokerContractAuthEntry::Contract(SubContractInvocation {
context: ContractContext {
contract: env.current_contract_address(), // Diamond proxy address
fn_name: Symbol::new(&env, "__check_auth"),
args: auth_args.clone(),
},
sub_invocations: soroban_sdk::vec![&env],
})
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you expand on what you are trying to achieve here? I'd be surprised if this did anything tangible

context: ContractContext {
contract: target.clone(),
fn_name: selector.clone(),
args: args.clone().into_val(&env),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'd likely need to extend this with the proxies contract address, so the facet can require_auth it.

Ditto for the storage ones above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants