Conversation
…2025-08-01-VottunBridge
- Implement bidirectional bridge between Qubic and Ethereum - Add 27 comprehensive tests covering core functionality - Support for order management, admin functions, and fee handling - Include input validation and error handling - Ready for deployment and IPO process
…2025-08-01-VottunBridge
… into feature/2025-08-01-VottunBridge
… division operators - Remove duplicate and Spanish comments from VottunBridge.h - Clean up 'NEW'/'NUEVA' comments throughout the code - Optimize isAdmin and isManager functions (remove unnecessary locals structs) - Replace division operators with div() function for fee calculations - Add build artifacts to .gitignore - Fix syntax errors and improve code consistency
…d clean up build artifacts - Remove empty getAdminID_locals struct and use PUBLIC_FUNCTION macro - Remove versioned build/test artifacts from repository - Clean up remaining comments and code optimizations - Fix division operators to use div() function consistently
- Refactor isManager to use PRIVATE_FUNCTION_WITH_LOCALS - Move loop variable 'i' to isManager_locals struct - Comply with Qubic rule: no local variables allowed in functions - Address Franziska's feedback on loop variable requirements
- Add tokensReceived and tokensLocked flags to BridgeOrder struct - Update transferToContract to accept orderId and set per-order flags - Modify refundOrder to check tokensReceived/tokensLocked before refund - Update completeOrder to verify token flags for consistency - Add comprehensive security tests validating the fix - Prevent exploit where users could refund tokens they never deposited Tests added: - SecurityRefundValidation: Validates new token tracking flags - ExploitPreventionTest: Confirms original vulnerability is blocked - TransferFlowValidation: Tests complete transfer flow security - StateConsistencyTests: Verifies state counter consistency All 24 tests pass successfully.
- Update TEST_F declarations to use braces on new lines - Fix struct declarations formatting - Fix if statement brace formatting - Comply with project code style guidelines
- Remove all 'NEW' comments from functions and procedures
- Fix char literal '\0' to numeric 0 in EthBridgeLogger
- Keep underscore variables (_tradeFeeBillionths, _earnedFees, etc.) as they follow Qubic standard pattern
- All opening braces { are now on new lines per Qubic style guidelines
…2025-08-01-VottunBridge
…2025-08-01-VottunBridge
…2025-08-01-VottunBridge
…e types. Implement setProposalById and cancelProposal methods in the testing framework. Update test cases to validate proposal management and token refund mechanisms. Adjust project configuration to include necessary directories for testing.
…underflow protection. Introduce separate variables for operator and network fees, ensuring only available fees are refunded. Update available fees calculations in multiple functions for consistency and safety.
…plicate admins and managers during proposal processing. Update logic to ensure that existing addresses are not replaced or added again, maintaining the integrity of the admin and manager lists.
…proposal and IPO epochs
…dicated slot index for storing new proposals. This change improves clarity and ensures the correct slot is used when setting proposals, enhancing overall contract functionality.
…r limit. Implement checks to prevent adding more than three managers during proposal processing, enhancing contract security and integrity.
… orders. Implement logic to reserve and release fees for completed orders and refunds, enhancing fee management and underflow protection.
…cesses. Introduce minimum order amount validation to prevent zero-fee spam, enhance fee management with invocation rewards, and implement single-pass recycling for order and proposal slots. Add new refund functionality and corresponding tests to ensure proper fee handling and order status updates.
…act to enhance clarity and maintainability. Adjust admin addresses to reflect new configurations while ensuring proper initialization of state variables.
|
At the moment it looks like you touch some files that should not be touched! For example, |
…ngs, peers, qubic.cpp, packages.config, gitignore; remove cli.md and tests.md Made-with: Cursor
93fe600 to
a9346dd
Compare
fnordspace
left a comment
There was a problem hiding this comment.
A few little things are left. Also a merge with the latest develop branch is needed. Please do not force push anymore but merge so that we can track the open issues.
The develop branch introduces a change to how contract define state variables. I'll write Arcos in Discord with some information about what changes are needed.
src/contract_core/contract_def.h
Outdated
| REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QBOND); | ||
| REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QIP); | ||
| REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QRAFFLE); | ||
| REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(VOTTUNBRIDGE); |
There was a problem hiding this comment.
Move this to the end of the REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES right befor the test contracts
src/contract_core/contract_def.h
Outdated
| #ifndef NO_PULSE | ||
| {"PULSE", 204, 10000, sizeof(PULSE)}, // proposal in epoch 202, IPO in 203, construction and first use in 204 | ||
| #endif | ||
| {"VOTTUN", 199, 10000, sizeof(VOTTUNBRIDGE)}, // proposal in epoch 197, IPO in 200, construction and first use in 197 |
There was a problem hiding this comment.
Update to correct epochs.
src/contracts/VottunBridge.h
Outdated
| } | ||
| else if (locals.proposal.proposalType == PROPOSAL_WITHDRAW_FEES) | ||
| { | ||
| locals.availableFees = (state._earnedFees > (state._distributedFees + state._reservedFees)) |
There was a problem hiding this comment.
Fees are always drained in END_TICK() hence this might never run.
| { | ||
| uint8 status; // Operation status (0 = success, other = error) | ||
| uint64 orderId; // ID of the found order | ||
| id qubicDestination; // Destination address on Qubic (for EVM to Qubic orders) |
There was a problem hiding this comment.
Is never set in the function, is that on purpose?
|
I am Arcos,
I did merge the latest version of core, I will just create a new repo as
honestly, it's just a nightmare to make this and every time, different
things.
El mar, 10 mar 2026 a las 17:22, fnordspace ***@***.***>)
escribió:
… ***@***.**** requested changes on this pull request.
A few little things are left. Also a merge with the latest develop branch
is needed. Please do not force push anymore but merge so that we can track
the open issues.
The develop branch introduces a change to how contract define state
variables. I'll write Arcos in Discord with some information about what
changes are needed.
------------------------------
On test/test.vcxproj
<#786 (comment)>:
Please only add your file as include and do not change other things in
this file.
------------------------------
On test/test.vcxproj.filters
<#786 (comment)>:
Also here please only add you contract file and do not add project.conf.
------------------------------
In src/contract_core/contract_def.h
<#786 (comment)>:
> @@ -483,17 +498,26 @@ static void initializeContracts()
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QBOND);
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QIP);
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QRAFFLE);
+ REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(VOTTUNBRIDGE);
Move this to the end of the REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES
right befor the test contracts
------------------------------
In src/contract_core/contract_def.h
<#786 (comment)>:
> {"QRP", 199, 10000, sizeof(IPO)}, // proposal in epoch 197, IPO in 198, construction and first use in 199
- {"QTF", 199, 10000, sizeof(QTF::StateData)}, // proposal in epoch 197, IPO in 198, construction and first use in 199
- {"QDUEL", 199, 10000, sizeof(QDUEL::StateData)}, // proposal in epoch 197, IPO in 198, construction and first use in 199
- {"PULSE", 204, 10000, sizeof(PULSE::StateData)}, // proposal in epoch 202, IPO in 203, construction and first use in 204
+ {"QTF", 199, 10000, sizeof(QTF)}, // proposal in epoch 197, IPO in 198, construction and first use in 199
+ {"QDUEL", 199, 10000, sizeof(QDUEL)}, // proposal in epoch 197, IPO in 198, construction and first use in 199
+#ifndef NO_PULSE
+ {"PULSE", 204, 10000, sizeof(PULSE)}, // proposal in epoch 202, IPO in 203, construction and first use in 204
+#endif
+ {"VOTTUN", 199, 10000, sizeof(VOTTUNBRIDGE)}, // proposal in epoch 197, IPO in 200, construction and first use in 197
Update to correct epochs.
------------------------------
In src/contracts/VottunBridge.h
<#786 (comment)>:
> + {
+ state.managers.set(locals.i, NULL_ID);
+ locals.actionSucceeded = true;
+ locals.adminLog = AddressChangeLogger{
+ locals.proposal.targetAddress,
+ CONTRACT_INDEX,
+ 3, // Manager removed
+ 0 };
+ LOG_INFO(locals.adminLog);
+ break;
+ }
+ }
+ }
+ else if (locals.proposal.proposalType == PROPOSAL_WITHDRAW_FEES)
+ {
+ locals.availableFees = (state._earnedFees > (state._distributedFees + state._reservedFees))
Fees are always drained in END_TICK() hence this might never run.
------------------------------
In src/contracts/VottunBridge.h
<#786 (comment)>:
> + }
+
+ // Structure for the input of the getOrderByDetails function
+ struct getOrderByDetails_input
+ {
+ Array<uint8, 64> ethAddress; // Ethereum address
+ uint64 amount; // Transaction amount
+ uint8 status; // Order status (0 = created, 1 = completed, 2 = refunded)
+ };
+
+ // Structure for the output of the getOrderByDetails function
+ struct getOrderByDetails_output
+ {
+ uint8 status; // Operation status (0 = success, other = error)
+ uint64 orderId; // ID of the found order
+ id qubicDestination; // Destination address on Qubic (for EVM to Qubic orders)
Is never set in the function, is that on purpose?
—
Reply to this email directly, view it on GitHub
<#786 (review)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGE7KEESD4MD75OWXXKN7MT4QA6NRAVCNFSM6AAAAACWKILNOKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTSMRTGAYDOMBUGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Made-with: Cursor
…ata migration Made-with: Cursor
…ct definition for VottunBridge state; add contract_vottunbridge to project files.
Made-with: Cursor
…ndif in contract_def.h Made-with: Cursor
fnordspace
left a comment
There was a problem hiding this comment.
Currently not compiling. See #endif issue below.
Besides that only two little things left.
…tract definitions
fnordspace
left a comment
There was a problem hiding this comment.
All tests pass. Ready to go from my side.
QubicBridge
Qubic proposal:
https://github.com/sergimima/qubic-proposal/
Contract compliance check PASSED