Skip to content
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

Integrate Soroban Domain #9

Merged
merged 3 commits into from
Jul 28, 2024
Merged

Integrate Soroban Domain #9

merged 3 commits into from
Jul 28, 2024

Conversation

tupui
Copy link
Owner

@tupui tupui commented Jul 25, 2024

Trying to get Soroban Domain registration in the registration itself.

https://sorobandomains.org

An alternative would be to only check that the project is register. We would call from the frontend the Soroban Domain contract or redirect to the official dApp.

@tupui tupui added this to the Smart Contract milestone Jul 25, 2024
let contract_domain_id_str = String::from_str(&env, CONTRACT_DOMAIN_ID);
let contract_domain_id = Address::from_string(&contract_domain_id_str);
let tld = Bytes::from_slice(&env, &[120, 108, 109]); // xlm
env.invoke_contract::<()>(
Copy link
Owner Author

Choose a reason for hiding this comment

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

@earrietadev hi 👋 if you have time, could you help us out here? I am getting a failure calling Soroban Domain's contract here and I don't understand the backtrace. Thanks in advance!

HostError: Error(WasmVm, InvalidAction)

Event log (newest first):
   0: [Diagnostic Event] topics:[error, Error(WasmVm, InvalidAction)], data:"escalating error to panic"
   1: [Diagnostic Event] topics:[error, Error(WasmVm, InvalidAction)], data:["contract call failed", register, [CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4, "soroban-versioning", [CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOLZM], "github.com/file.toml", "2ef4f49fdd8fa9dc463f1f06a094c26b88710990"]]
   2: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM, topics:[error, Error(WasmVm, InvalidAction)], data:"caught error from function"
   3: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM, topics:[error, Error(WasmVm, InvalidAction)], data:"escalating error to panic"
   4: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM, topics:[error, Error(WasmVm, InvalidAction)], data:["contract call failed", set_record, [Bytes(736f726f62616e2d76657273696f6e696e67), Bytes(786c6d), CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4, 31536000]]
   5: [Failed Diagnostic Event (not emitted)] contract:CATRNPHYKNXAPNLHEYH55REB6YSAJLGCPA4YM6L3WUKSZOPI77M2UMKI, topics:[error, Error(WasmVm, InvalidAction)], data:["VM call trapped: UnreachableCodeReached", set_record]
   6: [Failed Diagnostic Event (not emitted)] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM, topics:[fn_call, Bytes(2716bcf8536e07b567260fdec481f62404acc2783986797bb5152cb9e8ffd9aa), set_record], data:[Bytes(736f726f62616e2d76657273696f6e696e67), Bytes(786c6d), CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4, 31536000]
   7: [Diagnostic Event] topics:[fn_call, Bytes(0000000000000000000000000000000000000000000000000000000000000005), register], data:[CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4, "soroban-versioning", [CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOLZM], "github.com/file.toml", "2ef4f49fdd8fa9dc463f1f06a094c26b88710990"]
   8: [Diagnostic Event] contract:CBUSYNQKASUYFWYC3M2GUEDMX4AIVWPALDBYJPNK6554BREHTGZ2IUNF, topics:[fn_return, mint], data:Void
   9: [Contract Event] contract:CBUSYNQKASUYFWYC3M2GUEDMX4AIVWPALDBYJPNK6554BREHTGZ2IUNF, topics:[mint, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4, CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4, "aaa:GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGO6V"], data:10000000000000000
   10: [Diagnostic Event] topics:[fn_call, Bytes(692c360a04a982db02db346a106cbf008ad9e058c384bdaaf77bc0c48799b3a4), mint], data:[CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDR4, 10000000000000000]
   11: [Diagnostic Event] contract:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM, topics:[fn_return, init], data:Void
   12: [Diagnostic Event] topics:[fn_call, Bytes(0000000000000000000000000000000000000000000000000000000000000005), init], data:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4
   13: [Diagnostic Event] contract:CATRNPHYKNXAPNLHEYH55REB6YSAJLGCPA4YM6L3WUKSZOPI77M2UMKI, topics:[fn_return, init], data:Void
   14: [Diagnostic Event] topics:[fn_call, Bytes(2716bcf8536e07b567260fdec481f62404acc2783986797bb5152cb9e8ffd9aa), init], data:[CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM, 100, CBUSYNQKASUYFWYC3M2GUEDMX4AIVWPALDBYJPNK6554BREHTGZ2IUNF, 31536000, [Bytes(786c6d), Bytes(7374656c6c6172), Bytes(77616c6c6574), Bytes(64616f)]]
   15: [Diagnostic Event] contract:CBUSYNQKASUYFWYC3M2GUEDMX4AIVWPALDBYJPNK6554BREHTGZ2IUNF, topics:[fn_return, set_admin], data:Void
   16: [Contract Event] contract:CBUSYNQKASUYFWYC3M2GUEDMX4AIVWPALDBYJPNK6554BREHTGZ2IUNF, topics:[set_admin, GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGO6V, "aaa:GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGO6V"], data:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4
   17: [Diagnostic Event] topics:[fn_call, Bytes(692c360a04a982db02db346a106cbf008ad9e058c384bdaaf77bc0c48799b3a4), set_admin], data:CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4
   18: [Diagnostic Event] contract:CBUSYNQKASUYFWYC3M2GUEDMX4AIVWPALDBYJPNK6554BREHTGZ2IUNF, topics:[fn_return, init_asset], data:Void
   19: [Diagnostic Event] topics:[fn_call, Bytes(692c360a04a982db02db346a106cbf008ad9e058c384bdaaf77bc0c48799b3a4), init_asset], data:Bytes(0000000161616100000000000000000000000000000000000000000000000000000000000000000000000003)

Choose a reason for hiding this comment

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

@tupui doing a quick review, one thing I noticed is that you're hashing the domain before passing it to the contract so you need to make sure the value is not higher than the limit which is 15 digits. Also the last value you're passing is a i32 but the contract is expecting a u64

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thanks I really appreciate 🙏 I will try this out!

// setup for Soroban Domain
let contract_domain_id_str = String::from_str(&env, CONTRACT_DOMAIN_ID);
let contract_domain_id = Address::from_string(&contract_domain_id_str);
env.register_contract_wasm(&contract_domain_id, contract_domain::WASM);
Copy link
Owner Author

Choose a reason for hiding this comment

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

Registering here with the same address as mainnet

@tupui
Copy link
Owner Author

tupui commented Jul 28, 2024

Ok, seems like I got it to work now, thanks again @earrietadev 😃 ! It was hard to debug and in the end was just a matter of formatting. The tooling needs to improve a bit to properly propagate errors coming from other contract calls 😅

No I can play and see if we actually want to do this from the contract itself or just check that a domain was registered before and belongs to the person calling our register function.

@tupui tupui merged commit 3836108 into main Jul 28, 2024
3 checks passed
@tupui tupui deleted the soroban_domain branch July 28, 2024 16:26
@tupui tupui mentioned this pull request Jul 30, 2024
3 tasks
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.

2 participants